Posts

Showing posts from June, 2015

Android TabLayout (API 22) add fragment to each tab without ViewPager -

i'm trying out android's new tablayout class add 2 tabs below actionbar. each tab host different fragment. also, don't want able swipe between 2 tabs - navigate between tabs, i'd able touch tab want navigate to. inside mainactivity, have: public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); tablayout tablayout = (tablayout) findviewbyid(r.id.tab_layout); tablayout.addtab(tablayout.newtab().settext("newsfeed")); tablayout.addtab(tablayout.newtab().settext("random")); tablayout.setontabselectedlistener(new tablayout.ontabselectedlistener() { @override public void ontabselected(tablayout.tab tab) { // ideally here, i'd // tab.setfragment(new mainfragment()). } @override public void ontabunselected(tablayout.tab

clang - LLVM: Disable some instructions while generating machine code -

i not want use particular machine instruction in generated assembly code llvm. is there way disable same? i'm ok modifying llvm code also. one solution specify llvm instruction cannot "lowered"... 2 things may happen: the compiler can perform same operation combination of instructions... things okay the compiler cannot without it, in case have modify target generator suggest workaround (not quite easy if you're not familiar llvm) to search xxxiseldagtodag.cpp , xxx target machine , specify constructor like: setoperationaction(isd::yyy, mvt::i8, expand); setoperationaction(isd::yyy, mvt::i16, expand); setoperationaction(isd::yyy, mvt::i32, expand); setoperationaction(isd::yyy, mvt::i64, expand); where isd::yyy instruction don't want use. quite easy locate when browsing source code. roughly: setoperationaction specifies want change default action given operation, along type (mvt::...) expand means "try expand operation"

php - Misplacement of info in rows in tables in Boostrap -

Image
i have responsive bootstrap table , of info generate php doesn't sit correctly in row. here link screenshot: the php code, generates table this: if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<div class='table-responsive'>"; echo "<table class='table'>"; echo "<tr>"; echo "<td>" . $row["id"] . "</td> " . "<td>" . $row["firstname"] . "</td> " . "<td>". $row["lastname"] ."</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; } } else{ echo "0 results"; } you using while loop above div generating div , table again , agian. insted of place loop after table tag , before <tr> . generate ne

C programming code error -

so program still incomplete, cant go further cause there error right after first input, tried using visual studio 2010 , 2015, both same problem: unhandled exception @ 0x60eae42e (msvcr100d.dll) in asd.exe: 0xc0000005: access violation writing location 0xccccccccc so can find problem in this? or test , see if working on pc? code supposed c int main() { int y[3][3], inv[3][3], co[3][3], d[3], sol[3], d = 0,i=0, j = 0; char z; start: // used restart program when persons want more work or has done error printf("the format linear equation is\na1.x + b1.y + c1.z = d1\na2.x + b2.y + c2.z = d2\na3.x + b3.y + c3.z = d3\n"); (i = 0;i < 3;i++) { (z = 'a';z < 'd';z++,j++) { printf("enter value %c%i\n", z, + 1); scanf("%i", y[i][j]); } printf("enter valie d%i\n", + 1); scanf("%i", d[i]); j = 0; } (i = 0;i <

c++ - Where and why do I have to put the "template" and "typename" keywords? -

in templates, , why have put typename , template on dependent names? dependent names anyway? have following code: template <typename t, typename tail> // tail unionnode too. struct unionnode : public tail { // ... template<typename u> struct inunion { // q: add typename/template here? typedef tail::inunion<u> dummy; }; template< > struct inunion<t> { }; }; template <typename t> // last node tn. struct unionnode<t, void> { // ... template<typename u> struct inunion { char fail[ -2 + (sizeof(u)%2) ]; // cannot instantiated u }; template< > struct inunion<t> { }; }; the problem have in typedef tail::inunion<u> dummy line. i'm inunion dependent name, , vc++ quite right in choking on it. know should able add template somewhere tell compiler inunion template-id. exactly? , should assume inunion class template, i.e. inunion<u> names type ,

out of memory - Android InvalidStateException on ViewPager when setting page limit too small -

i have problem viewpager image slider gallery. setting page limit 3 app craches on third image because child has parent. set limit number because want avoid large memory leaks, event 3 images uses 150mb of allocated memory incredibly huge ammount. maybe if resize image before uploading can them work more pages ? anyways, here code viewpager: viewpager mviewpager = (viewpager) findviewbyid(r.id.imagepager); vieweradapter adapter = new vieweradapter(this); //adapter.notifydatasetchanged(); mviewpager.setadapter(adapter); mviewpager.setoffscreenpagelimit(3); mviewpager.setcurrentitem(number); mviewpager.setonpagechangelistener(new viewpager.onpagechangelistener() { @override public void onpagescrolled(int position, float positionoffset, int positionoffsetpixels) { time.settext(caluculatetimeago(mainactivity.time[position])); if (mainactivity.distances[position] < 1000) { dist.settext(string.valueof(ma

php - Submit data in a textbox from a while loop to database -

i need enter scores subjects offered students in class simultaneously. retrieved students id, retrieved list of subjects being offered students, , placed textbox under each subject. now, want submit score in database subject name , student id, score not storing, subject name , student id. here code: <form method="post"> <?php include "includes/dbcon.php"; $subject_name =""; echo "<table border='1'><thead><tr><td>students name</td>"; $query_subjects = mysqli_query($link,"select * junior_subjects order subject_name asc"); while ($row_subject=mysqli_fetch_array($query_subjects)) { $subject_name .= $row_subject['subject_name']; echo "<td>".$row_subject['subject_name']."</td>"; } echo "</tr></thead>"; $query_students = mysqli_query($link,"select * students class_

jquery - Unable to access elements from ng-included files -

i'm trying simple of things, json i'm repeating menu scroll destination defined. on same repeated element set directive , pass destination parameter directive function. inside function i'm trying access element can't access element reason. all this: [context: document, selector: "#skills"] [context: document, selector: "#projects"] [context: document, selector: "#about"] [context: document, selector: "#form"] when should getting similar test did: [header#site-header.container-fluid.ng-scope, context: document, selector: "#site-header"] all of these selectors i'm trying access comes ng-included files this: <div ng-include="'views/templates/skillset.html'"></div> <div ng-include="'views/templates/projects.html'"></div> <div ng-include="'views/templates/about.html'"></div> <div ng-include="'views/templat

java - Eclipse can find file but Exe file cannot despite the fact that the file is in the same directory, -

for text maze game, eclipse can find text file , run properly, when convert jar of project exe , exe cannot find file. strange thing both jar file created , exe in same directory, yet jar file runs whereas exe file not. why this? here code: try { //find file, create maze, etc. } // exceptions catch (filenotfoundexception e) { file file = new file("maze.txt"); system.out.println(file.canread()); system.out.println(file.getabsolutefile().exists()); } both of 2 prints output false when run exe , though of files in same directory , works jar file. why this? using iexpress convert exe way. you can use launch4j easy use launch4j cross-platform tool wrapping java applications distributed jars in lightweight windows native executables. executable can configured search jre version or use bundled one, , it's possible set runtime options, initial/max heap size. wrapper provides better user experience through application icon, native pre

objective c - NSStream: Is there any airtight defense against blocking? -

under stream programming guide: polling versus run-loop scheduling section, last para says: it should pointed out neither polling nor run-loop scheduling approaches airtight defenses against blocking. if nsinputstream hasbytesavailable method or nsoutputstream hasspaceavailable method returns no, means in both cases stream has no available bytes or space. however, if either of these methods returns yes, can mean there available bytes or space or way find out attempt read or write operation (which lead momentary block). nsstreameventhasbytesavailable , nsstreameventhasspaceavailable stream events have identical semantics. so, seems neither hasbytesavailable / hasspaceavailable , nor stream events provide guarantee against blocking. there way guaranteed non-blocking behaviour streams? create background thread guaranteed non blocking behaviour, want avoid doing that. also, fail understand why nsstream can't provide gauranteed non-blocking behaviou

linux - How to change ubuntu to root? -

i new linux. when list files under folder 1, see below result -rwxrwxrwx 1 root root 920 jun 3 10:36 file1.xsd -rwxrwxrwx 1 root root 920 jun 3 10:36 file2.xsd drwxrwxrwx 2 ubuntu ubuntu 4096 jun 12 11:10 temp -rwxrwxrwx 1 ubuntu ubuntu 1853 jun 19 11:07 file3.xsd for files(file1 , file2) root root written after permisionsbut file3 ubuntu ubuntu displayed. what difference b/w ubuntu ubuntu , root root ? how can change ubuntu ubuntu file 3 root root ? the first "root" stands user name , second "root" stands group name. design, ubuntu uses "sudo" command run other commands "as root", , actual root user not used. so means, every time use command sudo run command, being done root. that's reason 2 of files being owned root (and group root). you can change ownership of file command chown: chown root:root file3.xsd

java - no response to setVisibility -

i'm trying write app buttons trigger sound , want buttons visible when pressed add setvisibility method when press button there no response. my code is: import android.app.activity; import android.media.mediaplayer; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imagebutton; import android.widget.relativelayout; import static android.view.view.invisible; import static android.view.view.visible; public class mainactivity extends activity { relativelayout background; imagebutton btn; mediaplayer sound; @override protected void onpause() { super.onpause(); sound.release(); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); sound = mediaplayer.create(this, r.raw.kick); btn = (imagebutton) findviewbyid(r.id.btn1); btn.setvisibility(invisible); btn.setonclicklistener(new view.onclicklistener() {

javascript - AngularJS display different object property via select list -

i have angularjs web app i'm building here (only entrees > breadsticks have items currently) everything fine, until decided wanted allow user select different size items (either large, medium or small). task has been headache me because need keep track of different prices, different sizes, , different number of orders each size. currently i'm trying build function return correct price depending depending on select option selected. here breadsticks object we're working with: $scope.breadsticks = [ { name: 'garlic buttered', pricesm: 2.99, pricemd: 3.99, pricelg: 4.99, sizesm: '6pcs', sizemd: '10pcs', sizelg: '14pcs', description: 'garlic buttery goodness on stick of cheesy bread.', numordersm: 0, numordermd: 0, numorderlg: 0, }, { name: 'mozzarella stuffed', pricesm: 3.49, pricemd: 4.49, pricelg: 5.49, sizesm: '6pcs', sizemd: &#

machine learning - Conclusion from PCA of dataset -

Image
i have set of data sequence labeling. did pca (with 2 principal components on x , y axis) on dataset , turns out below: using lstm network classify dataset above, decided extract activations hidden layer of lstm. obtain figure below: my question is, conclusion can draw comparing both results? fair features of original dataset self-organized after running through lstm classifier?

apache - Error while executing select query in Hive - how to update Hadoop version -

i using hadoop 1.0.3 version. installed apache hive run it. running select * query gave me nosuchmethoderror: org.apache.hadoop.mapred.jobconf.unset i further found out compatibility issue current version of hadoop , requires me upgrade 1.2 or later. i new hadoop , upgrade current version 1.2 or later. how go doing same. i not find resources online so. thanks. just download hadoop 1.2.x here , necessary configuration changes in new hadoop. change hadoop_home point new hadoop folder. note: change environmental variables (including .bashrc) point new hadoop.

Choosing the data structure for orgaininsng data with list of values in java -

i have map shown below in there key , values of type list : map<string, list<string> newdatamap = new hashmap<>(); map.put ("rtyname", arrays.aslist("wpn", "wpfnb", "dgeft", "xbthy")); map.put ("rtyrate", arrays.aslist("dd", "ww", "trrty", "httyure")) i'd add map on previous map, such there key , value above map. correct data structure, , how implement it? i want shown below key value b1 rtyname ----> "weepn", "weepfnb", "eedgeft", "xbteehy" rtyrate ----->"deed", "ww", "terrty", "hteetyure" b2 rtyname ----> "sssweepn", "wpefsssnb", "ggegdgeft", "xbteyyyyhy" rtyrate ----->"wwded", "wtetyw", "yyyytrerty", "iiiehttyure" as shown above

How we get local SQL Server instance through c# -

i creating windows app in need create connection string automatically. create windows form similar sql server management studio connect server form. need few things local sql server name of system. after user fill form select server name , authentication type need check that filled details correct. i need create automatic connection string in c# , create automatic database , execute sql query in c# code working fine. so me instance name , check data valid in c# window application. to instances of local network (and local) can use code: (from msdn ) sqldatasourceenumerator instance = sqldatasourceenumerator.instance; system.data.datatable table = instance.getdatasources(); and test connection string can open connection generated connection string. this: (from this answer) string provider = "system.data.sqlclient"; // example dbproviderfactory factory = dbproviderfactories.getfactory(provider); using(dbconnection conn = factory.createconnection()) {

windows 7 - Service runs in session != 0 but fails in session 0 -

i have service executes .bat file calls python program. python program includes win32com module. if service run session 0 fails somewhere deep in win32com. however, if service run session != 0, executes ok. similarly, if .bat file executed cmd window @ desktop runs ok. any thoughts why happening?

soap client - PHP SoapClient - how to get request to server and response -

i try create script communication ws-security (for first time) in php: require ('wssoapclient.php'); $soapclient = new wssoapclient('https://katastr.cuzk.cz/trial/dokumentace/ws22/wsdp/vyhledat_v22.wsdl'); $soapclient->__setusernametoken('username', 'password'); $params = array('katastruzemikod'=>693936, 'kmenovecislo'=>1385); $response = $soapclient->__soapcall('najdiparcelu', $params); var_dump($response); and script failed: php fatal error: uncaught soapfault exception: [wsse:invalidsecurity] error on verifying message against security policy error code:1000 in /home/jura/bin/wssoapclient.php:75 is way see, script sent server , response? the problem $soapclient->__setusernametoken('username', 'password') function expecting 3rd parameter of either 'passworddigest' or 'passwordtext'. this badly handled in wssoapclient class. should throw exception if

javascript - HTML Creating a button that contains opens up a link in a new window -

i have been using document.write open link creating in new window. document.write("<a target='blank' href='#"+link_number+"'>click here open link</a>"); link_number dynamic number creating( different every time ). trying put link in table is <div id="tabs-10"> <table style="width:300px"> <tr><td><input type="button" id="link1" checked /> go link 1</td></tr> </table> </div> i know how create button such how create html button acts link? but question is, how can convert document.write button in table? thank howard you mean this? var addbutton = function(text) { var btn = document.createelement('button'); var ttd = document.queryselectorall('td')[0]; btn.innerhtml = text; ttd.appendchild(btn); } document.queryselectorall('a')[0].onclick = function() { addbutton('ra

Swing Timer Not Working (Java) -

for reason though using exact code example oracle's website swing timer not waiting 1 second. skips joptionpane says "your score etc etc". here source code school project. why not working , not waiting 1 second before running rest of code? //check see if user has enetered if(!answered) { int delay = 1000; //milliseconds actionlistener taskperformer = new actionlistener() { public void actionperformed(actionevent evt) { //...perform task... } }; new timer(delay, taskperformer).start(); afk = true; incorrect += 1; answered = true; //this breakes out of loop } a timer used run callback after specific amount of time. if want delay, can either move code run after delay into taskperformer action listener. thread.sleep(1000) not ideal here, because cause ui freeze make ui thread sleep.

android - PubNub: Cannot resolve method subscribe -

i new android programming , using pubnub first time. have included .jar file in lib. have imported it. i following steps given here - http://www.pubnub.com/docs/android-java/pubnub-java-sdk#copy_and_paste_examples but getting error message. - " cannot resolve method 'subscribe(java.lang.string,anonymous javax.security.auth.callback.callback)' i using android studio. also, putting entire code in mainactivity. not sure code pubnub goes. my main activity - package com.example....<hidden>; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.textview; import com.parse.parse; import com.parse.parseobject; import com.pubnub.api.pubnub; import com.pubnub.api.pubnuberror; import com.pubnub.api.pubnubexception; import com.pubnub.api.*; import org.json.*; import javax.security.auth.callback.callback; public class mainactivity e

multithreading - construction of thread using lambda expression -

can explain thread created on lambda function below? technique used? can recommend reference understand semantics? i posted full code now: class threadpool { public: threadpool(size_t); template<class f, class... args> auto enqueue(f&& f, args&&... args) ->std::future<typename std::result_of<f(args...)>::type>; ~threadpool(); private: // need keep track of threads can join them std::vector< std::thread > workers_m; // task queue std::queue< std::function<void()> > tasks_m; // synchronization std::mutex queue_mutex_m; std::condition_variable condition_m; bool stop_m; }; // constructor launches amount of workers inline threadpool::threadpool(size_t threads) : stop_m(false) { std::thread::id id = std::this_thread::get_id(); (size_t = 0; < threads; ++i) { workers_m.emplace_back( [this] { (;;) {

Pointers returned from dll function when called from rebol -

i trying ascertain weather can use rebol few programming tasks. have written small program loads external library , calls function returns pointers in of arguments. when run program crashes rebol.exe. hoping can me out. dll function follows: void xxx swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, double dtimezone, int32 *iyear_utc, int32 *imonth_utc, int32 *iday_utc, int32 *ihour_utc, int32 *imin_utc, double *dsec_utc) and small test program: rebol [] astrology-lib: load/library %/c/sweph/bin/swedll32.dll swe-utc-time-zone: make routine! [ iyear [integer!] imonth [integer!] iday [integer!] ihour [integer!] iminute [integer!] dsec [decimal!] dtimezone [decimal!] iyear-utc [char*] imonth-utc [char*] iday-utc [char*] ihour-utc [char*] iminute-utc [char*] dsec-utc [char*] ] astrology-lib "_swe_utc_time_zone@60" swe-utc-time-zone 2015 6 20 0 19 0 -4.5 none none none none none none

apple push notifications - iOS UILocalNotification only makes a sound (no alert) when app is not running -

i'm using remote notifications wake app , conditionally trigger uilocalnotification. i've found if notification triggered while app not running, notification sound (no alert/notification). works expected if app in background. registering remote notifications in appdelegate: let settings = uiusernotificationsettings(fortypes: (.badge | .sound | .alert), categories: nil) application.registerusernotificationsettings(settings) application.registerforremotenotifications() creating/firing of uilocalnotification (as result of didreceiveremotenotification ) var notification = uilocalnotification() notification.alerttitle = "my app" notification.alertbody = "hello world!" notification.soundname = uilocalnotificationdefaultsoundname uiapplication.sharedapplication().presentlocalnotificationnow(notification) as far can tell documentation, notification behavior when app in background , not running should same.. when system delivers local notificati

node.js - Express - preventing two+ responses from being sent -

using node.js express server, errors "can't sent headers twice.." if attempt send 2 responses same request. want figure out best way prevent 2 responses being sent, particular case, potentially others well. i have simple /test route returns information state of server, looks this: app.get('/test', function (req, res, next) { var client = redis.createclient(); var response = {}; var alreadysentresponse = false; //i use boolean check if sent response client.on("error", function (err) { //this callback invoke res.send log.error('error in redis client test error callback:', err); if(alreadysentresponse === false){ alreadysentresponse = true; res.status(500).send({"test message smartconnect": err}); } }); client.info(function (err, resp) { //this callback invoke res.send response['redisinfo'] = resp; if(alreadysentresponse ===false

html - How to correctly style linebreaks in this javascript -

https://jsfiddle.net/mrnf4q7g/ i've been trying set fiddle onto 2 lines such as: 123 20 13 03 days hours min sec i've tried using br , \n tends staircase down page. create 4 separate elements within #countdown element <div id="countdown"> <span class="sect" id="days"></span> <span class="sect" id="hrs"></span> <span class="sect" id="mins"></span> <span class="sect" id="secs"></span> </div> then set elements display: inline-block .sect { display: inline-block; } then set each element's innerhtml separately , include line-break days.innerhtml = math.floor(distance / _day) + '<br> days '; hrs.innerhtml = math.floor((distance % _day) / _hour) + '<br> hours '; mins.innerhtml = math.floor((distance % _hour) / _minute) + '&

php - sendmail.exe" -t' is not recognized as an internal or external command -

This summary is not available. Please click here to view the post.

postgresql - Django 1.8 migration unable to cast column id to integer -

i'm migrating site sqlite backend postgres backend. we've been running native-django style migrations (i.e., not south) beginning of project. of migrations run fine, there's hiccup in our of our applications. we got far in postgres migration. (all other apps migrated.) of migrations ran without incident on sqlite3. processes [x] 0001_initial [x] 0002_auto_20150508_2149 [ ] 0003_auto_20150511_1543 [ ] 0004_auto_20150528_1739 [ ] 0005_process_upstream [ ] 0006_auto_20150605_1436 [ ] 0007_auto_20150605_1706 [ ] 0008_milestone_prevailing_process these 2 migrations ran correctly: 0001_initial.py: class migration(migrations.migration): dependencies = [ ] operations = [ migrations.createmodel( name='datereason', fields=[ ('id', models.autofield(verbose_name='id', serialize=false, auto_created=true, primary_key=true)), ('name', models.charfield(unique=

xcode7 - Can't create simulator in Xcode 7 -

Image
when open xcode 7.0 beta version, cannot create simulator. click blue button , nothing happens @ all. no error message displayed , no feedback. xcode -> preferences - > downloads not show sdks download. go "/library/developer/coresimulator/profiles/runtimes" , removed runtimes this work me. credit: https://forums.developer.apple.com/thread/11706

c# - Prevent program from closing when console window closes -

Image
so happening console program opens runs external c# program/code text file. runs fine when close original form window program/code executed closes. there way prevent text file code running closing? this code calling run program static void memexe(byte[] buffer) { assembly asm = assembly.load(buffer); if (asm.entrypoint == null) throw new applicationexception("no entry point found!"); methodinfo epoint = asm.entrypoint; epoint.invoke(null, null); } where buffer code/program in bytes and main static void main(string[] args) { var data = file.readalltext(@"program.txt"); memexe(data); } a workaround change project's output type in project's properties -> application -> output type console application windows application (see screenshot) this way no console window created, the process neither appear 2 runn

python - Using list of rows whether I have 1 row or N many -

i have foo=("bob","smith","123") and sometimes foo=(("bob","smith","123"),("sam","smith","124")) and loop: for rows in foo: but want loop treat foo list of rows if 1 row inside instead of n many. right if passed in 1st foo, iterate bob, smith, 123 if pass 2nd foo iterate rows (which want). objects pyodbc.row. another way of saying want able use: foo[0][1]=stuff if passed many rows, or one. how can this? a trick use inside function accepts different types of inputs first normalize uncommon input common type, , handle common type. similarly, in case (untested): if not isinstance(foo[0], tuple): # single row foo = (foo,) # add row tuple of lenght 1 row in foo: # sure foo tuple of rows # row

Git submodules and orphaned commits -

i have git repo (a) each commit orphaned commit name (branch). git repo b consumes submodule, , such holding reference sha in a. when make fresh clone of b need typical git submodule init/update incantation, don't want clone of a. want clone single orphaned commit submodule reference. however, when try git submodule update --init --recursive --depth 1 path/to/a , git clones master instead. there way can convince clone sha care about? if b consumes a submodule, should configuring a submodule follow branch . that way, git submodule update --init --recursive --remote --depth 1 path/to/a should checkout branch supposed follow.

algorithm - Methods to sample a 2-dim curve efficiently -

i ask efficient method / algorithm sample 2-dim curve following criteria. curve guaranteed not cross itself. the number of points should minimized; the sample curve, connects sample points lines, should resemble original one. for example, since sample points connected lines, line should sampled 2 points on both ends. arc, there more points along make sample curve accurate enough. you can try simplify polyline, constructed given points, douglas-peucker algorithm , build kind of smooth curve through reduced point set. to make smooth curve, can use splines (e.g. catmull-rom) or this approach (intended closed curves, might adapted open ones)

java - Hibernate Tutorial - Where to put Mapping File? -

Image
i following interesting tutorial on hibernate here: http://www.tutorialspoint.com/hibernate/hibernate_native_sql.htm this tutorial, however, neglects mention put these files. using folder structure of basic maven project. the folder structure follows: foo | |-> src | |-> main | | | |-> java | | | |-> org | | | |-> me | | | |-> bar | | | [all java source-files here] | |-> resources | | | |-> hiber | | | employee.hbm.xml | hibernate.cfg.xml the folder main has java , resources @ same level if not obvious ascii art. where should mapping file (employee.hbm.xml) go? file referenced in configuration

java - Parse list of complex JSON objects using Jackson -

i have list of json objects like: [ { "id": "a", "objs": [ { "obj1": 1 }, { "obj2": 0 }, ] }, { "id": "a", "objs": [ { "obj1": 1 }, { "obj2": 0 }, ] } ] and load them list of myobj: class myobj { private final string id; private final hashmap<string, integer> objs; // constructors, etc. here... } arraylist<myobj> list; is there smart way using jackson objectmapper or other bindings; i.e., minimal boilerplate code? without hashmap simple matter of: list = mapper.readvalue(file, new typereference<arraylist<myobj>>() {}); but hashmap pretty seems kill that. ideas? first of need model class json. should write own parser reading data array (map, list, etc.). jackson. small example old project. model class: package ru.model; import javax.persistence.*; import java.io.serializ

c# - Change Content-Disposition to open all image file files in a new tab -

here's logic downloading file. it automatically downloads file, whether it's .jpg, .pdf, .zip or whatever, open in new tab if it's image file(jpg, png, etc.) , else prompts download. i feel i'm missing when comes solving this. :/ public void downloadarchivedfiles(archivetype type, object id, string filename) { response.contenttype = "application/zip"; response.addheader("content-disposition", "filename=" + filename); string path = server.mappath(string.format("~/{0}files/{1}", type, id)); var fmfiles = new string[0]; var files=new string[0]; if(type==archivetype.issue) { fmfiles = _files.getissuefiles(new guid(id.tostring())).select(x => server.mappath("~" + x.filepath)).toarray(); }else if(type==archivetype.task) { fmfiles = _files.gettaskfiles(int.parse(id.tostring())).select(x => server.mappath("~

python - Pandas compare each row to reference row - certain columns only -

i have following pandas dataframe**** in python. temp_fact oscillops_read b c d e f g h j 0 today 0.710213 0.222015 0.814710 0.597732 0.634099 0.338913 0.452534 0.698082 0.706486 0.433162 1 b today 0.653489 0.452543 0.618755 0.555629 0.490342 0.280299 0.026055 0.138876 0.053148 0.899734 2 aactl 0.129211 0.579690 0.641324 0.615772 0.927384 0.199651 0.652395 0.249467 0.262301 0.049795 3 dfe 0.743794 0.355085 0.637794 0.633634 0.810033 0.509244 0.470418 0.972145 0.647222 0.610636 4 c real_mt_olv 0.724282 0.332965 0.063078 0.004550 0.585398 0.869376 0.232148 0.630162 0.102206 0.232981 5 e q_mont 0.221685 0.224834 0.110734 0.397999 0.814153 0.552924 0.981098 0.536750 0.251941 0.383994 6 d dfe 0.655386 0.561297 0.305310