Posts

Showing posts from May, 2015

git - Nodegit Remote Push with --force -

i'm using single github repo ci work. app receives zip file, create repo locally, commit files master branch, add origin remote , try push github. since files exist in github repo, error, "[error: cannot push because reference trying update on remote contains commits not present locally.]" does nodegit support pushing remote --force flag overwrite everything? i've looked through docs , can't find it. thanks! jeff nodegit supports passing refspecs remote. force push master adding + front of refspec. example: remote.push('+refs/heads/master:remotes/origin/master', null, mysignature, mymessage)

vba - Find "carriage return" in a mail.body -

i have mails : hello, please note did ... @ 16h15 actions done: rebuilding etc sincerely mr. the actions change in every mail , want insert action in excel. problem don't know how "carriage return" (idk if right name, traduction gave me). find in internet vblfchr(10) "carriage return". tried find beginning : technicposition= instr(1, .body, "actions done: ") technicaction= mid(.body, technicposition, 14) ' first char action but can't last char (first "carriage return" technicaction). tried many things : instr(technicposition, .body, vbcrlf) my question : how sentence begin word "carriage return" (the first comes after beginning word) ? the carriage return in email body vbnewline this how it sub sample() dim sbody string dim myar dim long ' '~~> rest of code ' sbody = omail.body '~~> testing purpose 'sb...

JSF Primefaces Datatable ActionLink problems -

Image
prerequisites: glasfish 3.1 jsf 2.1 primefaces 5.2 user story: i want implement delete row function on primefaces datatable, delete function has displayed within table. implementation: datatable header <p:datatable value="#{a.list}" var="var"> delete <p:column headertext="delete"> <p:commandlink value="-" action="#{a.delete(var)}" /> </p:column> delete method in bean public void delete(something sth) { model.getlist().remove(sth); } outcome: when hovering on commandlink showing me uniform resource locator localhost/applicationname/# eclipse giving me facelet validator warning marker syntax error on expressionlanguage code #{a.delete(var)} question: what missing in order delete row? solution: i have changed commandlink jsf (not primefaces) , got error, method shouldnt void, string after changing , returning null works... public string d...

Randomly Assign Integers in R within groups without replacement -

i running experiment 2 experiments: experiment_1 , experiment_2. each experiment has 5 different treatments (i.e. 1, 2, 3, 4, 5). trying randomly assign treatments within groups. we via sampling without replacement iteratively within each group. want insure balanced sample possible in treatment (e.g. don't want end 4 subjects in group 1 getting assigned treatment 2 , no 1 getting treatment 1). if group has 23 subjects, want split respondent 4 subgroups of 5, , 1 subgroup of 3. want randomly sample without replacement across first subgroup of 5, gets assigned 1 of treatments, same things the second, third , 4th subgroup of 5, , final subgroup of 3 randomly sample without replacement. guarantee every treatment assigned @ least 4 subjects, , 3 assigned 5 subjects within group. groups in experiment , both treatments. resultant output this... group experiment_1 experiment_2 [1,] 1 5 3 [2,] 1 3 2 [3,] ...

multithreading - C++ Inheritance : Calling virtual method when it has been overridden -

i trying build service object can run (i.e. execute it's run() function) in separate thread. service object #include <boost/noncopyable.hpp> #include <atomic> #include <thread> #include <iostream> class service : public boost::noncopyable { public: service() : stop_(false), started_(false) { } virtual ~service() { stop(); if (thread_.joinable()) { thread_.join(); } } virtual void stop() { stop_ = true; } virtual void start() { if (started_.load() == false) { started_ = true; thread_ = std::thread([&] () { run(); }); } } protected: virtual void run() = 0; std::atomic<bool> stop_; std::atomic<bool> started_; std::thread thread_; }; i creating test class inherits abstract class , called in main() function class test : public service { public: test() : service() { std::cout<< "ctor" << std::endl; start(); } ~test()...

android - Issue in writing NDEF message to NFC tag -

i trying write ndef message nfc tag. have code write ndef message in onnewintent(). control not going onnewintent(). after onresume(), hanging. pls find below code. public class mainactivity extends activity { private bluetoothadapter mbluetoothadapter; private nfcadapter mnfcadapter; static final byte[] type_bt_oob = "application/vnd.bluetooth.ep.oob". getbytes(charset.forname("us_ascii")); private ndefmessage mndefmessage; string mlocalbluetoothaddress; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toast.maketext(this, "inside oncreate", toast.length_long).show(); mnfcadapter = nfcadapter.getdefaultadapter(this); if (mnfcadapter == null) { // stop here, need nfc toast.maketext(this, "this device doesn't support nfc.", toast.length_long).sho...

Managing network interfaces from node.js -

i developing node.js/express server application on debian platform. need allow users view and, importantly, change basic network settings: static/ip vs. auto/dhcp. suppose use (and write supporting code for): cp.exec('ifconfig', function (err, ifconfigout, stderr) but wondering best practices doing , if there recommended npm module (didn't seem find active ones)? short answer, given lack of responses , googling: there appears no 'de facto' node module provides necessary services managing network interfaces. did find 2 had promise incomplete: https://github.com/fgribreau/network-config , https://www.npmjs.com/package/ife . edit: of course can use https://nodejs.org/api/os.html#os_os_networkinterfaces view existing interfaces, if want change anything, core node not appear have functionality.

css3 - Transition on background-size doesn't work -

i'm trying put transition on background-image on hover. code far: html <div class="item-one"></div> css .item-one { height: 345px; width: 256px; background: url('http://placehold.it/256x345') scroll no-repeat center center; background-size: cover; -webkit-transition: background-size 1500ms linear; -moz-transition: background-size 1500 linear; -o-transition: background-size 1500 linear -ms-transition: background-size 1500ms linear; transition: background-size 1500ms linear; } .item-one:hover { background-size: 150%; } see jsfiddle but doesn't work me, tested in different browsers. other transitions background-color work expected. there restriction transitions on property? i think problem background-size: cover , when change background-size: 100%; it work jsfiddle there other question background-size: cover alternative, can is there alternative background-size:cover? ...

csv - Excel 2010 Reference table data from one sheet to other -

i prepared data sheet contains primary database b c 1 id col2 col3 2 800 90 120 3 799 50 110 4 798 80 785 5 797 60 642 6 796 60 212 7 795 26 163 8 794 66 171 9 793 36 673 10 792 16 223 11 791 31 133 12 790 83 253 13 789 33 256 14 788 31 623 i want create 3 more sheets named takeall , takeevery2nd , takeevery4th what trying do: take all - take data data sheet , display original: b c 1 id col2 col3 2 800 90 120 3 799 50 110 4 798 80 785 5 797 60 642 6 796 60 212 7 795 26 163 8 794 66 171 9 793 36 673 10 792 16 223 11 791 31 ...

php shopping cart session id remove -

if have session cart items more 1 not work.. have 1 work. happen this i put of codes in session. check happen case... here php code link ?action=remove&id=<value> function checkcartforitem($additem, $cartitems) { if (is_array($cartitems)){ foreach($cartitems $key => $item) { if($item['id'] === $additem) return $key; } } return false; } if (!empty($_get['qty'])) { $qty = $_get['qty']; } //store in array $item = array( //item name 'id' => $_post['id'] ); $additem = $_get['id']; //check if(!empty($_get["action"])) { switch($_get["action"]) { case "add": if(!empty($_get["qty"])) { $productbycode = $db_handle->runquery("select * product id='" . $_get["id"] . "'"); $itemarray = array($productbycode[0]["id"]=...

c - Trying to randomly generate a string in order to get a conditional to execute -

seems strings in c weak point, need guys' again. should have included in first one, apologize that. so have function got working correctly, fills string random chars set {r, e, s, e, t} , returns it: char *inputstring() { static char string[6]; const char *digits = "reset"; int i; (i = 0; < 5; i++) { string[i] = digits[ rand() % 4 + 0 ]; } return string; } so char @ string[5] '\0', correct? , string[1] through string[4] random combinations of other characters (r, e, s, e, t). now, have function calls one. these purpose of trying printf statement execute: other_fxn() { char *s; while (1) { s = inputstring(); if (s[0] == 'r'&& s[1] == 'e' && s[2] == 's' && s[3] == 'e' && s[4] == 's' && s[5] == '\0') { printf('worked!\n'); break; } } } main: { srand(time(null))...

c++ - Are stl algorithms classes with operator() or functions -

recently i've taken c++ quiz , here question it: select concepts represented in stl templated classes containers iterators functors algorithms exceptions obviously 1,2 , 3 templated classes, algorithms? never thought it, algorithms can templated functions, , can templated classes operator(). though, think not matter , rather silly question, i'm interested in answer, because have number of mistakes in quiz without knowing right , wrong. tl;dr: are stl algorithms functions or classes operator()? thank you. they're function templates. see algorithms library

How do I extract data from multiple related web pages in Android using Jsoup? -

well, have been working in app display news headings , contents site http://www.myagdikali.com i able extract data 'myagdikali.com/category/news/national-news/' there 10 posts in page , there links other pages 1,2,3... myagdikali.com/category/news/national-news/page/2. all need know is, how extract news every possible pages under /national_news ? possible using jsoup ? till code extract data single page is: public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_all, container, false); int = getarguments().getint(news); string topics = getresources().getstringarray(r.array.topics)[i]; switch (i) { case 0: url = "http://myagdikali.com/category/news/national-news"; new newsextractor().execute(); break; ..... [edit] private class newsextractor extends asynctask<vo...

java - Hibernate eagerly loads lazy reference -

i have 3 entities a, b , c. @entity public class { @id private long id; @onetoone(fetch = fetchtype.eager) @joincolumn(name = "id", insertable = false, updatable = false) public b b; } @entity public class b { @id private long id; @onetoone(fetch = fetchtype.lazy) @joincolumn(name = "id", insertable = false, updatable = false) public c c; } @entity public class c { @id private long id; @onetoone(fetch = fetchtype.lazy) @joincolumn(name = "id", insertable = false, updatable = false) public b b; } so there eagerly loaded reference of b in , between b , c lazily loaded bidirectional relation. my problem: when fetching instance of db, instance of c fetched hibernate. i discovered in heap dump due memory leak , tested programmatically: @test public void eagerandlazyloading() { a = dao.geta(1l); assert.assertnotnull(a); persistenceunitutil puu = emf.getpersistenceunitutil(); assert.asserttrue(puu.isload...

mysql - Passing parameters by value -

to all, learning visual basic , working on windows application. have 2 text box methods ( usernametextbox , passwordtextbox ). in user enter data , hit submit button ( button1_click ). method call connect. want able do, have user type-in username , password. passed value, not reference connect() when invoked inside button method. kind of authentication page. have values in connect(firstname:="johndoe", password:="password") - testing mysql server , demonstration of trying attempt. imports mysql.data.mysqlclient public class securepasswordlist dim conn new mysqlconnection public sub connect(byval firstname string, byval password string) dim databasename string = "mysql" dim server string = "10.1.0.0" if not conn nothing conn.close() conn.connectionstring = string.format("server={0}; user id={1}; password={2}; database={3}; pooling=false", server, firstname, password, databasename) ...

git - Squash all commits into one -

i branched off of master build feature our website, branch has maybe 1,000 commits now, , don't want merge master. take head of branch , remove of other commits. i tried doing rebase didn't seem work, still shows 1k(ish) commits. git rebase -i dev-dashboard i squash commits , make head commit, merge master. how can done? it seems should easier, started: git checkout topic git reset master git checkout master git add . git commit -m 'over 1,000 fakie rebase squash!' git branch -d topic inspired this git squash commits in branch without conflicting

javascript - Abort accessing success callback in backbone model -

i have backbone model consist of following parse method. parse: function(response, options){ // handling error http response 200 if( response.reasons && response.reasons[0] ){ var errorresponse = { responsejson: { reasons: [ { code: response.reasons[0].reasoncode, reason: '' } ] } } options.error( errorresponse ); return errorresponse; } } my issue is, web service won't give http response 500 errors. need check response & decide that. problem is, above code runs error callback after goes success callback well. need stop that. i receive json response server, similar following {data: {some data}} for error {data: {}, reasons: [{error code}]} please let me know how can that. in advance backbone default e...

The Cost of C++ Exceptions and setjmp/longjmp -

i wrote test measure cost of c++ exceptions threads. #include <cstdlib> #include <iostream> #include <vector> #include <thread> static const int n = 100000; static void dosomething(int& n) { --n; throw 1; } static void throwmanymanytimes() { int n = n; while (n) { try { dosomething(n); } catch (int n) { switch (n) { case 1: continue; default: std::cout << "error" << std::endl; std::exit(exit_failure); } } } } int main(void) { int ncpus = std::thread::hardware_concurrency(); std::vector<std::thread> threads(ncpus); (int = 0; < ncpus; ++i) { threads[i] = std::thread(throwmanymanytimes); } (int = 0; < ncpus; ++i) { threads[i].join(); } return exit_success; } here's c versi...

Strategy for mapping a function of several inputs and outputs using R -

i want plot function of many inputs , outputs using r study how outputs depend on inputs. function economic model but, simple example, write function as f <- function(x, y, z) { = x * y^2 return (data.frame(a, b = x + y + z, c = sqrt(a))) } (i used data.frame return several outputs open other suggestions - perhaps should taking data.frame input well?) now, want plot a function of x when y , z 1, likewise plot c function of y , x , z set 2.

java - Which servlets are good member of pre initialization? -

by setting <load-on-startup>-1</load-on-startup> property in web.xml make servlet load whenever server starts up. i know pre initialized servlets faster first request. my question kind of servlets member setting. kind of functionality useful? the load-on-startup controls when servlet's init() method called. so, logically, if you've servlet init() method expensive , time consuming stuff, such parsing xml configuration files and/or populating application scoped data database, may idea on startup instead of on first request. if don't have init() method, don't need care load-on-startup . see also: how servlets work? instantiation, sessions, shared variables , multithreading

php - Split ID's Up In Tables In While Loop -

i have following database table: award_id | nominee_id | voter_id | multi_code ------------------------------------------------------ 5 | 3 | 1 | 9326 5 | 4 | 1 | 9326 5 | 5 | 3 | 8746 i need display these results in tables grouped multi_code, example: so like <h1>multi code: 9326</h1> <table> <tr> <td>nominee: 3</td><td>nominee: 4</td> </tr> </table> <h1>multi code: 8746</h1> <table> <tr> <td>nominee: 5</td> </tr> </table> here sql + php far: $nomineedetails = mysqli_query($con,"select award_id, nominee_id, voter_id, multi_code b_awards_votes award_id = '5'"); $multi_code = -1; while($row = mysqli_fetch_array($nomineedetails)) { $awardid = $row['award_id']; $nomineeid = $row['nominee_id']; $voterid = $row['voter_id']; $m...

python - install HDF5 and pytables in ubuntu -

i trying install tables package in ubuntu 14.04 sems complaining. i trying install using pycharm , package installer, seems complaining hdf5 package. however, seems cannnot find hdf5 package install before tables . could explain procedure follow? try install libhdf5-7 , python-tables via apt

ios - using JSON data in SWIFT UI controls -

i need use data json web service update controls in swift app. can data no problem, can't seem access ui controls within task block , can't json persist out of block. i've searched around , haven't found answer. here's test code. current result value1result has value inside task, nil outside. in advance. var jsonresult:nsdictionary! var value1result:string! let task = nsurlsession.sharedsession().datataskwithurl(url!) { data, response, error in var error: nserror? jsonresult = nsjsonserialization.jsonobjectwithdata(data, options: nsjsonreadingoptions.allowfragments, error: &error)! as! dictionary<string, anyobject> println(jsonresult) if let value1 = jsonresult["value1"] { println(value1) value1result = value1 as! string } } task.resume() self.textview1.text = value1result you can use asynchronous block update main ui di...

XMPP Handshake Flow using Gloox C/C++ -

i trying perform xmpp handshake flow mentioned @ https://developers.google.com/cloud-print/docs/rawxmpp . this allows device subscribe , receive notifications. as of now, have explored following options: 1) libcurl 2) gloox c/c++ 3) txmpp 4) libjingle which option choice start with? consider support , maintenance of library major factor. thanks following solution using gloox c/c++ library perform xmpp handshake flow: #include <cassert> #include <iostream> #include <boost/make_shared.hpp> #include <iq.h> #include <parser.h> #include <base64.h> #include <connectiontcpclient.h> #include <connectiontls.h> #include <connectiondatahandler.h> #include <connectionhttpproxy.h> #include <logsink.h> #include <client.h> #include <connectionsocks5proxy.h> using namespace gloox; using namespace std; const string proxyhost = ""; //specify proxy server name const int proxyport = 0; //spec...

backbone.js - Is there another method, which exactly works as "onShow"? -

so, have 1 view(marionette itemview) render google maps based on address given input.this view being used in 3 places of application.where in 2 places, case 1: i'm using regions show view(like: xyzregion.show(new mapview().render());), case 2: i'm not using region, instead i'm doing like: this.el.innerhtml = new mapview().render();. though marionette documentation has mentioned itemview, compositeview, collectionview, layoutview( docs ) supports functionality of onshowwhen,if don't use region show map view, onshow not being triggered. after research came know "view won't trigger onshow, instead triggered region. is there way trigger "onshow", though view not bieng shown region? or else there other method same "onshow"? it sounds want write own custom implementation of pub-sub pattern. since you're using marionette, can use vent = new backbone.marionette.eventaggregator(); which object can broadcast / listen...

ios - Dynamic model cascading based on property with JSONModel -

given following json blob: [ { type: "audio", title: "audio example title", }, { type: "video", title: "video example title", }, { type: "audio", title: "another audio example title", }, ] and 2 jsonmodel model classes (audiomodel, videomodel). possible have jsonmodel automatically create either 1 of model classes based on type property when maps json models? it's possible using for..in loop , checking type property , creating model object based on type below nsmutablearray *audiomodelarray = [nsmutablearray alloc] init]; nsmutablearray *videomodelarray = [nsmutablearray alloc] init]; for(nsdictionary *jsondict in jsonarray) { if(jsondict[@"type"] isequaltostring:@"audio") { audiomodel *audio = [audiomodel alloc]initwithtitle:jsondict[@"title"]]; [audiomodelarray addobject: audio]; } else {...

mysql - Need Sql Query to generate output as shown below tables -

here in example 3 tables used employee, employeework , employeeeducation. employee table has 2 data rows. employee has 6 data rows, 3 first employee , other 3 second employee. finally employeeeducation has 4 data row, 2 first employee , 2 next employee. i want output (if possible or alternative solution ) shown in last table output sample. employee +--------------------------+ |empid | empname | empphone| +--------------------------+ |1 | john | 1234 | |2 | rick | 5678 | +--------------------------+ employeework +--------------------------------------------+ |empwrkid | empid | departmentname | workyrs | +--------------------------------------------+ |1 | 1 | support | 2 | |2 | 1 | development | 3 | |3 | 1 | retail | 5 | +--------------------------------------------+ |4 | 2 | support | 1 | |5 | 2 | development | 3 | |6 | 2 | ret...

Alfresco Java backed webscript for creating folders does not create folders -

i working on java backed webscript alfresco needs create folder structure based on path sent it. of folders have been sent may exist , may not. code i've got: for( int = 0; < folderpathparts.length; i++){ createdfolder = serviceregistry.getfilefolderservice().searchsimple(contextfolder, folderpathparts[i]); if( createdfolder == null){ try{ fileinfo subfolderinfo = serviceregistry.getfilefolderservice().create(contextfolder, folderpathparts[i], contentmodel.type_folder); contextfolder = subfolderinfo.getnoderef(); }catch(fileexistsexception fee){ contextfolder = serviceregistry.getfilefolderservice().searchsimple(contextfolder, folderpathparts[i]); } } } debugging script can see new node refs created, there nothing being created when go share. i read might need use transactions since script accessed multiple threads, , have tried using retrying transaction helper have same result.

How to append specific indices of a matrix in R -

if have matrix: x <- matrix(c(0), ncol=2, nrow=2) x [,1] [,2] [1,] 0 0 [2,] 0 0 and want change x[,2][2] 1 instead of 0 , save in new matrix y output be: y [,1] [,2] [1,] 0 0 [2,] 0 1 how do in r? if don't want modify original matrix, reverse order of operations want perform, meaning first store copy of matrix x in new variable y , manipulate entries of matrix y . y <- x y[2,2] <- 1 else, if want change x , afterwards store copy of modified matrix in y ... well, guess changes rather obvious: x[2,2] <-1 followed y <- x .

ajax - How does soundcloud play music on multiple players? -

if in soundcloud you'll notice when play song plays in main content of page 'footer' player. i'm trying achieve similar, jplayer or soundmanager. main content of pages ajaxed while footer stays consistent support continious player of website. but question is, how play music ajaxed footer player while animating main content player , having seek functions on both? with jplayer assume need listen $.jplayer.event.play , $.jplayer.event.pause , $.jplayer.event.ended , $.jplayer.event.seeked in main player , update secondary interface. you may need create secondary interface (play/pause buttons, seek bar, etc) , add event handlers them passing corresponding parameters main player.

Map/Object in javascript does not support Element as key -

my question how use element key in vanilla javascript. before es6, object , other map-liked structures use tostring() identify keys -- means impossible distinguish elements. https://code.google.com/p/closure-library/issues/detail?id=541 google closure library, vanilla javascript has same issue. es6 map resolves this, great! usual, how old browsers not support es6... the usual solution problem in es5 generate unique string key (a monotomically increasing number turned string works fine), assign dom object custom property , use string key in object/map. this gives unique string, can use map key , if given dom object again , asked in map, can check special key and, if found, use check map. if dom object not have unique key, must not have been in 1 of these maps yet. here's javascript object implements automatically (objectset): https://github.com/jfriend00/javascript-set/blob/master/objectset.js related code in answer: mimicking sets in javascript? . or, here...

registry - Always open certain links in Internet Explorer -

i know gets asked bit, i've been reading things day. know, horrible. sadly, have single link on our page launches silverlight tool, , while wait html5 version, need this. i read few answers , ended this: windows registry editor version 5.00 [hkey_classes_root\rvl] @="url:hypertext transfer protocol" [hkey_classes_root\rvl\application] "appusermodelid"="microsoft.internetexplorer.default" "applicationcompany"="@c:\\windows\\system32\\ieframe.dll,-55177" "applicationdescription"="@c:\\windows\\system32\\ieframe.dll,-55176" "applicationname"="@c:\\windows\\system32\\ieframe.dll,-55175" "applicationicon"="\"c:\\program files\\internet explorer\\iexplore.exe\",0" [hkey_classes_root\rvl\defaulticon] @="c:\\windows\\system32\\url.dll,0" [hkey_classes_root\rvl\shell] [hkey_classes_root\rvl\shell\open] [hkey_classes_root\rvl\shell\open\command] @=...

Autowiring Optional<object> in Spring 4.1 -

i trying autowire optional in component. object in custom threadscope , proxy-mode = interfaces. i think @autowired optional<objecttype> objecttypeoptional ensures autowiring not requried. objecttypeoptional.ispresnet() returns true. because there proxy objecttype. there way objecttypeoptional not present? post edit (adding more context question): my bean - @component public user { private final username; private final useremail; // constructors , getters } now want inject optional of user in service or controller. - @autowired optional<user> useroptional; so whenever user logged in, filter/interceptor create appropriate user object. when no user logged in should able check via optional - useroptional.ispresent() i believe provider more fit you. java docs you autowire @resource provider<usersconnectionrepository> usersconnectionrepositoryprovider; and have method or call get() on provider private usersconnectionreposi...

cocoa - Window moves when clicking control in title region with titlebarAppearsTransparent -

Image
i have window uses yosemite titlebarappearstransparent , titlevisibility = nswindowtitlehidden properties extend content under title region. movablebywindowbackground . this works fine, if have control, e.g. nspopupbutton , in titlebar region, when click , attempt choose menu item, whole window moves (while menu stays put). here's demo: i've tried subclassing nspopupbutton , overriding mousedowncanmovewindow , doesn't (it's called, apparently ignored). any ideas? edit : created demo project reproduce issue. seems related embedding popup inside nssplitviewcontroller . can't avoid that, though, i'm not sure solution might be. here's demo project , if want try it. edit 2 : apparently os bug, no workaround. filed radar #21973457 .

c++ - TreeView_SetExtendedStyle does not apply certain styles, what am I doing wrong? -

i wanted "play around" new extended styles , ones manipulate checkboxes. the problem none of them seem work. i can not determine if tvs_ex_doublebuffer works or not, because treeview small. haven't tested tvs_ex_richtooltip yet. apart that, no matter other style set, unable see effect. here relevant snippet: hwnd hwndtv = createwindowex(...); // first, add checkboxes dword dwstyle = getwindowlong(hwndtv, gwl_style); dwstyle |= tvs_checkboxes; setwindowlongptr(hwndtv, gwl_style, dwstyle); // add extended window styles hresult h = treeview_setextendedstyle(hwndtv, tvs_ex_partialcheckboxes, tvs_ex_partialcheckboxes); // insert items... i have checked return value of treeview_setextendedstyle macro , did not fail, increases frustration more. question: can show me how apply extended styles? example, how set tvs_ex_partialcheckboxes or other? thank you. there's nothing wrong how you're setting style - it's when you're setti...

ruby on rails - get an image and parse it as binary -

i'm using curb image : curl = curl::easy.new("http://www.myimage.com/path/to/my.jpg") curl.perform now need save returned curl.body_str database, expecting type binary . body_str returned string, how can massage such can save database binary?

javascript - Validation of input elements haing name as array -

i have textbox , upload file like: <input type="text" id = "contract_copy_text[]" name="contract_copy_text[]" value="" maxlength="50"/> <input type="file" name="contract_copy_pdf[]" id="contract_copy_pdf[]" accept="application/pdf" /> i not able validate it. i have tried : var contract_copy_text = $('#contract_copy_text[]').val(); // document.getelementbyid('contract_copy_text').value; var contract_copy_pdf = $('#contract_copy_pdf[]').val(); // document.getelementbyid('contract_copy_pdf').value; if (contract_copy_text == "") { alert("insert contract copy title file"); $('#err_lbl_contract_copy_text').html('insert contract copy title file'); return false; } if (contract_copy_pdf == "") { alert("please select contract copy pdf file upload")...

scala - Scaladoc (2.11.6) fails on throws tag with "unable to find any member to link" -

when attempting publish jars project via sbt "++2.11.6 publishlocal" or sbt +publishlocal , encounter scaladoc issues when publishing scala 2.11.6. appears have invalid links caused @throws tag. not sure why have invalid links nor why error occurs scala 2.11.6 while not scala 2.10.5 during cross-publishing. can't find indication @throws tag not supported on scala 2.11; so, i'm assuming issue scaladoc, don't know missing @ point. can give me insight issue? /** * attempts load jdi, asserting can , loaded. * * @throws assertionerror if failed load jdi */ @throws(classof[assertionerror]) protected def assertjdiloaded(): unit = assert(jdiloader.tryloadjdi(), """ |unable load java debugger interface! part of tools.jar |provided openjdk/oracle jdk , core of debugger! please |make sure java_home has been set , tools.jar available |on classpath! """.stripmargin.replace(...

java - Trim spaces before database inserts -

i have web application wherein need insert data database using hibernate several functionalities. however forgot trim spaces while inserting want future database inserts should done after trimming spaces. best way across controller classes(i using spring mvc). i need understand approach. thanks have @ stringtrimmereditor mentioned @ spring validation, data binding , type conversion , add controller code this: @initbinder public void initbinder(webdatabinder binder) { binder.registercustomeditor(string.class, new stringtrimmereditor(true)); }

Condition in Javascript doesn't work -

i'm mad because of conditions in javascript. why 1 doesn't work? if (isnan(first) || isnan(second) && (act !== '-' || act !== '+')) it should check first number, second number , act minus or plus. it's right numbers doesn't check act correct. what's wrong? e.g. first 1, act a, second 2. won't work. p.s. i've knowledge in c++ , java. i've never had problems it. since time i've started learn javascript, many mistakes this. is there different system of such expressions? it should check first number, second number , act minus or plus. it's right numbers doesn't check act correct. thus requirement stated above correct statement be if ( !isnan(first) && !isnan(second) && (act == '-' || act == '+')) if want invert condition, be if ( !(!isnan(first) && !isnan(second) && (act == '-' || act == '+'))) which equivalent to if ...

r - how to find time difference from row names? -

i have data frame object row names time stamps. "size" variable far. size 2008-01-14 09:29:49 0 2008-01-14 09:29:59 0 2008-01-14 09:29:59.1 0 2008-01-14 09:30:00 842 2008-01-14 09:30:00.1 34 2008-01-14 09:30:00.2 1 2008-01-14 09:30:00.3 1 2008-01-14 09:30:00.4 1 2008-01-14 09:30:00.5 1 2008-01-14 09:30:02 38 i create new column shows time difference previous row. time difference first row can blank. size dtime 2008-01-14 09:29:49 0 na 2008-01-14 09:29:59 0 10 2008-01-14 09:29:59.1 0 0.1 2008-01-14 09:30:00 842 0.9 2008-01-14 09:30:00.1 34 0.1 2008-01-14 09:30:00.2 1 0.1 2008-01-14 09:30:00.3 1 0.1 2008-01-14 09:30:00.4 1 0.1 2008-01-14 09:30:00.5 1 0.1 2008-01-14 09:30:02 38 1.5 i trying use loop solve like: file<-as.data.frame(mtq) l<-nrow(file) file$dtime<-na (f ...

php - ArrayObject::getIterator error -

this how trying apartments name database, getting er error. how trying apartments names $userapt = $user->getapartments()->getiterator(); while ($userapt->valid()) { echo ($userapt->key() . ' => ' . $userapt->current()) . "\n"; $userapt->next(); } $useraptname = $user->getapartment()->getiterator(); while ($useraptname->valid()) { ($useraptname->key() . ' => ' . var_dump($useraptname->current()) . "\n"); $useraptname->next(); } running this, following error: catchable fatal error: object of class mybundle\entity\userapartment not converted string 500 internal server error - contexterrorexception how can error fixed? in advance! you trying echo object echo ($userapt->key() . ' => ' . $userapt->current()) . "\n"; you can solve implementing public function __tostring() {} method in userapartament class. in way when try echo $user-...

angularjs - How to click the buttons without element id -

im using protractor e2e testing.i want click buttons is there reason you're not using protractor api, driver directly? selecting ng-click might not best approach here (good practice seems selecting based on page structure, not mechanics), recommend investigate if can't use by.buttontext : element(by.buttontext('place order')); edit: looking @ way selector made, above not work - please note by.buttontext match : button input type="button" input type="submit" i'm keeping might need in future. if not work, maybe @ least select class, e.g. inside parent? example: element(by.css('.btn-wrapper > .btn:nth-child(2)')); also, consider adding separate class/id button, might useful later anyway. last remark, if have large page test, consider using page objects instead of selecting same stuff in separate steps. way, instead of writing selector, you'll have nice, maintainable object, can use like: mypage.pla...

Best way for checking if a Id is repeated in javascript [performance] -

i have list of repeated products it's ids, having loop want each product goes once through loop. want prevent product going through next times. i want know best way of doing this: 1) var hansalido = {}; if(typeof(hansalido[productgroup.getvalue()]) == 'undefined'){ hansalido[productgroup.getvalue()] = true; }else{ continue; } 2) var hansalido = []; if(hansalido.indexof(productgroup.getvalue()) > -1){ continue; }else{ hansalido.push(productgroup.getvalue()); } 3) other way

javascript - Dropzone cross-platform thumbnail generation -

Image
i using dropzone image uploads , have noticed 2 issues: thumbnail generation same image fails in browsers e.g. image attached, thumbnail generated in chrome, blank in safari , in firefox grey background. in safari, thumbnails generated, not sizes/aspect ratios. e.g. once again attached image, if streched horizontally, safari generate thumbnail, otherwise not. update i have established being caused "null" param thumbnail width. setting value fixes issue in browsers. ideally, show thumbnail @ original aspect ratio, seems failing sizes/browsers described above. is there fix or workaround can show thumbnails @ original aspect ratios? dropzone init code: var photosdropzone = new dropzone("#photoscontainer", { url: "{% url 'ajax_photo_upload_view' %}", maxfilesize: 4, acceptedfiles: 'image/*', addremovelinks: true, dictremovefile:'delete', thumbnailheight:160, thumbnailwidth:null, }); try using followin...

ios - I need some clarification about whether I should (could?) deallocate view-related UI elements or not -

so understand, should release objects own. ( alloc/copy/retain stuff) and understand(kinda?), if had @property retain in of class, or instance variable alloc/init, should write custom dealloc make sure ones gets deallocated class. what not understand should manually release cell objects example? (since creating in cellforrowatindexpath alloc/init? yea, know, tableview should kill cells when gets deallocated, want make sure? also, manually release uilabel , uitextfield , on? know gets killed when deallocate view, again, still, want make sure? update: yea, tip reference counting, project exact purpose simple stuff, using manual memory management. funny how of tutors nowadays skips part entirely novice myself have figure stuff themselves. unless have strong / retain pointer ui element automatically dealloced once go out of screen. regarding cell s - should never dealloc them because they're intended reused. if dealloc , re- init them you'll really ...