Posts

Showing posts from May, 2014

graphics - Android: Moving a View with onTouch has definite lag -

i'm coming learning curve on android, @ moment working on user interface details. 1 of basic things trying moving around on screen finger. seems fundamental thing do. i started relativelayout (rl), created 100x100 view has contrasting background color (intentionally simple, low graphics overhead) , add view rl. using view.setx , view.sety can move view around fine. next, added ontouchlistener view , used resulting .getrawx , .getrawy values move view. works - there definite lag. expected view stay right under finger trails behind. it's noticeable. edit: here's ontouch code: public boolean ontouch(view v,motionevent event) { boolean bexitvalue = true; int iaction; iaction = event.getactionmasked(); if (motionevent.action_move == iaction) { v.setx(event.getrawx()); v.sety(event.getrawy()); } else if (motionevent.action_down != iaction) { bexitvalue = false; } ...

Google Voice Search add to favorites on chrome -

how can add on chrome, favorite button take me directly google voice search? i want save me go google homepage , click mic. useful. thanks. there chrome addon might allow that: https://chrome.google.com/webstore/detail/voice-search/hhfkcobomkalfdlmkongnhnhahkmnaad?utm_source=chrome-ntp-icon i haven't used wouldn't know how convenient it.

javascript - How do I append an element to a form inside a Shadowbox -

i'm trying append textarea small form exists within shadowbox. shadowbox called button: <input type="button" value="upload" onclick="uploadimagesb();"> the javascript invoke shadowbox written follows: <script type="text/javascript" src="../tribnet_2013/shadowbox-3.0.3/shadowbox.js"></script> <script type="text/javascript"> shadowbox.init({ }); function uploadimagesb() { // shadowbox image upload shadowbox.open({ content: 'http://mydomain.com/cgi-bin/photo.cgi', player: 'iframe', title: 'image upload', height: 200, width: 500, options: { onopen: function() { var ed = tinymce.activeeditor; var content = ed.save(); ...

google mirror api - Can I add custom menu item on a timelineitem from other service? -

can add custom menu item timelineitem of system or glassware app? for example, "take picture" adds timeline item, has 2 options, share or delete. there way add custom menu option timeline item, share, delete, or "do something"? you can access timeline items have been created or shared glassware. when user shares picture 1 of glassware contacts exact copy of card, can manipulate timeline.update or timeline.patch feel necessary, including adding/removing menu items. won't affect original "picture card" in user's timeline, copy has been shared service. you can add feature request glass issue tracker explaining why , how want access other cards.

How to manipulate dynamic objects in Sencha touch -

so dynamically load / change elements of xtype objects . example on logic in initialise method load either 1 or other this.down("#homeview").title . ext.define("apn.view.flyoutnavigation", { id: "flyoutnavigationpanel", extend: 'ext.ux.slidenavigation.view', requires: [ 'ext.container', ], config: { items: [ { itemid: 'nav_home', id: 'homeview', title: "thetitlethatiwanttochange" ... while i'm looking @ things sethtml , or assigning variable "" doesn't have impact on ui component. so question how dynamically load variable of object this.down("#homeview") to change title need call settitle() method. can provide code try set it?

get json object without array name in android 2 -

i've json this array ( 'status' => 'ok', 'categories' => array ( 'sepeda' => array ( 83 => 'sepeda mtb', 'fullbike' => array ( 370 => 'mtb', 371 => 'roadbike', 374 => 'fixie', 375 => 'sepeda lipat', 378 => 'city bike', 380 => 'bmx', 382 => 'onthel', ), that wanna ask , how code "fullbike" ?? advice , need , thanks try { //get full bike json object first jsonobject jsonobject = response.getjsonobject("categories").getjsonobject("sepeda").getjsonobject("fullbike"); //get inner values string mtb = jsonobject.getstring("370"); log.e("response", mtb); } catch (jsonexception e) { e.printstacktrace(); }

Multiprocessing in Python with large numbers of processes but limit numbers of cpus -

Image
i have large number of data files needed processed through function a. let 1000 files, each process each file takes less 15 min 6gb memory. computer has 32gb , 8 cpus, can use maximum 4 processes (24gb mem , 4 cpus) time safety. question can use multiprocess package in python create 4 processes , each process continuously function process data file independently figure below. each cpu has process approx. 250 files, file sizes of 1000 files diferent not true. 1 note once process finished, assigned new job no matter other processes finished or not, i.e there no wait time 4 processes finished @ same time. return of function not important here. please provide codes! thank suggestion. i think best solution use multiprocessing.pool . makes easy set pool of processes (as many specify), provide them jobs in parallel. here's basic example code: import multiprocessing mp def handle_file(filename): # processing here def process_files(list_of_files): pool = mp.pool...

c# - Multi-level sorting on strings -

here same of raw data have: sana paden,1098,64228,46285,2/15/2011 ardelle mahr,1242,85663,33218,3/25/2011 joel fountain,1335,10951,50866,5/2/2011 ashely vierra,1349,5379,87475,6/9/2011 amado loiacono,1406,62789,38490,7/17/2011 joycelyn dolezal,1653,14720,13638,8/24/2011 alyse braunstein,1657,69455,52871,10/1/2011 cheri ravenscroft,1734,55431,58460,11/8/2011 i used filestream nested streamwriter determine first, how many lines in file, 2 create array of longs give me start of every line in file. code , out put follows: using (filestream fs = new filestream(@"c:\sourcedatatoedit.csv", filemode.open, fileaccess.read)) { fs.seek(offset, seekorigin.begin); streamreader sr = new streamreader(fs); { while (!sr.endofstream && fs.canread) { streamsample = sr.readline(); numoflines++; }// end while block }//end stream sr block long[] dataarray = new long[numoflines]; fs.seek(offset, seekorigin.b...

overloaded operator() in c++ structure -

in effective c++, 3rd edition, page 173~175, scott meyers talked of alternatives virtual functions using strategy pattern: class gamecharacter; int defaulthealthcalc(const gamecharacter& gc); class gamecharacter { public: typedef std::tr1::function<int (const gamecharacter&)> healthcalcfunc; explicit gamecharacter(healthcalcfunc hcf = defaulthealthcalc) : healthfunc(hcf) {} int healthvalue const { return healthfunc(*this) } ... private: healthcalcfunc healthfunc; }; ... struct healthcalculator { int operator()(const gamecharacter&) const { ... } }; ... class eyecandycharacter: public gamecharacter { explicit eyecandycharacter(healthcalcfunc hcf=defaulthealthcalc) :gamecharacter(hcf) { ... } ... } ... eyeccandycharacter ecc(healthcalculator()); the last statement illustrate how use health calculation function object in constructor of eyecandycharacter class. my question is, constructor of eyecandychar...

jQuery to replace images with content -

Image
goal: fadein() 'company-content' when logo image clicked on and fading out of other content in 'tiles-wrapper' div. company content same width full 'tiles-wrapper' display div. then... when 'company-content' displayed, link returns page it's original state. do need use 2 separate ul's unique class names 'company-logos' , 'company-content' (= trash 'li.content-wrapper' idea) vs. posted code? **i have done before. i'm losing mind. can't remember how did this. suggestions appreciated.* <div class="tiles-wrapper"> <ul class="tiles-list"> <li class="company-wrapper"> <div class="company-logo"><a class="company-logo-btn" href="#"><img src="company1.png" alt="" border="0" /></a></div> <div class="company-content"> ...

java - Command to find default program related to file(.pdf) using command line in windows OS -

is there command through can find user has selected particular program (e.g. adobe reader/adobe acrobat) default program particular file extension (e.g. .pdf) in windows? more specifically: if select adobe reader default pdf viewer file properties string viewer1 = "command .pdf" (running in command prompt) then change acrobat file properties → change default program string viewer2 = "command .pdf" (running in command prompt) so, viewer1 != viewer2 i working in java swing, if there library or way find default program selected .pdf file, helpful me. does registry key exist, stores default program path specific file extension (.pdf)? edited okay missed part here. consists of 2 commands. assoc filetype association extension e.g. .jpg=jpegimage ftype default handler ftype jpegimage hope helps. suppose pipeline 2 have no idea how thats done in windows.

Staying Browser File after submitting - PHP -

<? $img=""; $comment=""; if(isset($_post['save'])) { $e="0"; $comment=trim($_post['comment']); if($comment=="") { $sel5="<--enter ur opinon"; $e="5"; $code5=""; } if($_files['photo']['name']=="") { $sel6="<--select photo"; $e="6"; $code6=""; } else { $rand=rand().time(); $photo_name=$_files['photo']['name']; $photo_tmp_name=$_files['photo']['tmp_name']; $photo_name1=explode(".",$photo_name); list($width,$height) = getimagesize($photo_tmp_name); if($photo_name1[1]=="jpeg"||$photo_name1[1]=="jpg"||$photo_name1[1]=="gif") { if($width<=365) { $img="1"; $photo_name1=$photo_name[0].$...

java - Correct way to sign and verify signature using bouncycastle -

i using bcmail-jdk16-1.46.jar , bcprov-jdk16-1.46.jar (bouncycastle libraries) sign string , verify signature . this code sign string : package my.package; import java.io.fileinputstream; import java.security.key; import java.security.keystore; import java.security.privatekey; import java.security.security; import java.security.signature; import java.security.cert.x509certificate; import java.util.arraylist; import java.util.list; import org.bouncycastle.cert.jcajce.jcacertstore; import org.bouncycastle.cms.cmsprocessablebytearray; import org.bouncycastle.cms.cmssigneddata; import org.bouncycastle.cms.cmssigneddatagenerator; import org.bouncycastle.cms.cmstypeddata; import org.bouncycastle.cms.jcajce.jcasignerinfogeneratorbuilder; import org.bouncycastle.jce.provider.bouncycastleprovider; import org.bouncycastle.operator.contentsigner; import org.bouncycastle.operator.jcajce.jcacontentsignerbuilder; import org.bouncycastle.operator.jcajce.jcadigestcalculatorproviderbuild...

portable executable - how to modify exe to make it console window hidden? -

i have program. program had open console window display logs when started. dont window, no source code. so, how hide console? such modify exe file? you can start hidden. i use little vbscript code it. create start hidden.vbs file in same folder of program.exe , write code in it: set oshell = createobject("wscript.shell") oshell.run "program.exe", 0 run start hidden.vbs , should start program hidden. process visible in task manager.

c - Dynamically allocate SIMD Vector as array of doubles -

i'm new vectors , i've been having read of gcc documentation trying head around it. is possible dynamically allocate size of vector @ run time? appears though have in typedef like: typedef double v4sf __attribute__((vector_size (16))); i want set values of vector array of doubles. i've tried so: v4sf curr_vect = double_array; where double_array array of doubles. fails compile. possible either of these things? if platform posix-compliant, can achieve aligned dynamic memory allocation using posix_memalign() function : double *p; if (posix_memalign((void **)&p, 16, sizeof(*p) * 16) != 0) { perror("posix_memalign"); abort(); } p[0] = 3.1415927; // ... free(p);

RabbitMq error while calling exchangeBind -

i have simple scenario. create queue, exchange , bind queue exchange. code : string queuename = new stringbuilder("lp.data.").append("testaccount").append(".").append("sublp").tostring(); channel.exchangedeclare(exchangeconstants.data_excg, "direct", true); channel.queuedeclare(queuename, true, false, false, null); channel.exchangebind(queuename, exchangeconstants.data_excg, queuename); following error when exchangebind() called. com.rabbitmq.client.shutdownsignalexception: channel error; reason: {#method<channel.close>(reply-code=404, reply-text=not_found - no exchange 'lp.data.testaccount.sublp' in vhost '/', class-id=40, method-id=30), null, ""} exchangeconstants.data_excg "data_excg". using rabbitmq admin see exchange , queue created. exception don't understand why looking exchange name "lp.data.testaccount.sublp", queuename. seems quite trivial, sure missing somethin...

c++ - Unrestricted union in practice -

i have questions unrestricted unions , application in practice. let's suppose have following code : struct mystruct { mystruct(const std::vector<int>& a) : array(a), type(array) {} mystruct(bool b) : boolean(b), type(bool) {} mystruct(const mystruct& ms) : type(ms.type) { if (type == array) new (&array) std::vector<int>(ms.array); else boolean = ms.boolean; } mystruct& operator=(const mystruct& ms) { if (&ms != this) { if (type == array) array.~vector<int>(); // edit(2) if (ms.type == array) new (&array) std::vector<int>(ms.array); else boolean = ms.boolean; type = ms.type; } return *this; } ~mystruct() { if (type == array) array.~vector<int>(); } union { std::vector<int>...

javascript - \d only matchs 0-9 digits? -

as far know, \d should matchs non-english digits, e.g. Û±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹Û° doesn't work in javascript. see jsfiddle: http://jsfiddle.net/xzpam/ is normal behavior? javascript not support unicode regex matching (and far language such true). http://www.regular-expressions.info/unicode.html

facebook - how to upload image with feed using FB.api method -

Image
we using fb api post feed on facebook. my code - if (response.authresponse) { var data = { name: "link apply", picture: 'http://www.hrgp.biz/uploads/companyfortesting_499/notesreminders/2608chemtec-logo.jpg', link: "http://www.hrgp.biz/bc0efdb3-f1a7-4d81-9635-d1418e808b6d.aspx", // go here if user click picture description: "thank you" } fb.api('me/feed', 'post', data, function (response) { if (!response || response.error) { alert(json.stringify(response.error)); } else { //alert('post id: ' + response.id); alert('feed posted successfully.'); } }); ...

javascript - Populate multiple dropdown lists with PHP -

i have 3 dropdown lists populate sql database using php , javascript/ajax. first list starts filled options, second list populates database depending on selection. works fine , echo entire second list php. problem is: cant second drop down box repeat "onchange" function. tried many combinations no luck. second javasript function belong ? in html or php ? appreciated. html first javascript function <html> <head> <title>insert test</title> <script> function getdate(str){ if (str==""){ document.getelementbyid("dateinput").innerhtml=""; return; } if (window.xmlhttprequest){// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else{// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readystate==4 && xmlhttp.status==200){ documen...

android - How to generate p12 certificate with 100 years validity using flash builder -

i trying upload debug version in google play store , getting error upload failed you uploaded apk signed certificate expires soon. need sign apk certificate expires farther future. i don't know how extend certificate validity 100 years. have seen in forums create certificate using keytool. getting lot of errors. can 1 me there way directly can create certificate 100 years validity using flash builder. thanks reply alexander. need certificate of 100 years validity found solution using command prompt can that.. missed in win 7 need run command prompt administrator enter following command keytool -genkey -v -keystore my-release-key.p12 -alias alias_name -keyalg rsa -validity 10000

c# - updating multiple records in database with linq to sql without loop, is it possible? -

ok, let want update multiple rows in database @ once, without looping, if loop, might : var products = (from prod in context.products prod.productcategoryid == myproductid select prod).tolist(); // modify each object foreach (var product in products) { product.phonenumber = ???; product.name = ???; product.address = ???; } context.submitchanges(); is there better way this? without doing loop? consider me beginner on linq, if there better way, great if provide me example, in advance. linq quering records. current foreach loop more readable , if try other approach use loop internally. you can see this answer modifies collection using linq, not recommended way.

asp.net mvc - Kendo UI - Tooltip reads only once -

given sample of kendo ui load tooltip ajax data. <ul id="products" class="dairy-photos"> <li><a href="#" data-id="11"> <img src="@url.content("~/content/12.jpg")" /></a> </li> </ul> @(html.kendo().tooltip() .for("#products") .filter("a") .loadcontentfrom("details", "tooltip") .position(tooltipposition.top) .width(220) .height(280) .events(events => events.requeststart("requeststart"))) <script type="text/javascript"> function requeststart(e) { e.options.data = { id: e.target.data("id") } } </script> this working fine, call tooltip controller made once !? i'm unable find way make sure call made -every- time tooltip hovered. on 1 ? seems fixed in latest release : http://www.kendoui.com/forums/mvc/tooltip/load-tooltip-content-via-ajax-everytime-it-op...

Unable to retrieve Dictionary value when used in LINQ -

i trying update 'name' datacolumn based on 'id' datacolumn in datatable. 'id'-'name' pairs stored in dictionary, created using datatable extension method follows: public static dictionary<object, object> todictionary(this datatable datatable, string keycolumn, string valuecolumn) { dictionary<object, object> resultdict = new dictionary<object, object>(); if (datatable.columns.contains(keycolumn) && datatable.columns.contains(valuecolumn)) { foreach (datarow dr in datatable.rows) if (resultdict.containskey(dr[keycolumn]) == false) resultdict.add(dr[keycolumn], dr[valuecolumn]); } return resultdict; } i using following linq syntax update datacolumn: misuserdetailsdt.asenumerable().tolist().foreach(row => row.setfield("departmentname", deptdict[row["departmentid"]].tostring())); here 'misuserdetai...

html5 canvas - Kineticjs Stage Cordinates after scaling -

i'm using kineticjs allow users free hand drawing shapes on canvas , able zoom in/out canvas stage setting scale. challenge: am not getting updated scaled coordinates values after zoom in/out. suggestion appreciated. as far know, coordinates don't scaled, because thing changing 'setscale()' method zoom. so, if want know tne coordinates in scaled stage have store scale amount in variable , when need coordinate after scaling, multiply original shape coordinate scale of stage. this approach, not sure if there other way ;)

responsive design - How to resize current browser window in Selenium WebDriver with Java? -

i need resize browser 300x400 during executing selenium automated tests. how can resize browser window in selenium webdriver (aka, selenium 2) java? [note: needs resize browser window testing responsive web design (rwd)] you can reference current window driver.manage().window() . , window has setsize() method, try dimension dimension = new dimension(800, 600); driver.manage().window().setsize(dimension)

How can I add an element at the top of an OrderedDict in python? -

i have this d1 = ordereddict([('a', '1'), ('b', '2')]) if this d1.update({'c':'3'}) then this ordereddict([('a', '1'), ('b', '2'), ('c', '3')]) but want this [('c', '3'), ('a', '1'), ('b', '2')] without creating new dictionary there's no built-in method doing in python 2. if need this, need write prepend() method/function operates on ordereddict internals o(1) complexity. for python 3.2 , later, can use move_to_end 1 method. method accepts last argument indicates whether element moved bottom ( last=true ) or top ( last=false ) of ordereddict . finally, if want quick, dirty , slow solution, can create new ordereddict scratch. details 4 different solutions: extend ordereddict , add new instance method from collections import ordereddict class myordereddict(ordereddict): def prepend(self, k...

android - How to set CheckBox or Radio button at same place in layout screen? -

fisrt have json data [{"test_id":"6","question_text":"what length of train?","answer_set_id":"1","correct_answer":"4","correct_answer_text":null,answer_choice_1":"45 km\/hr","answer_choice_2":"50 km\/hr","answer_choice_3":"54 km\/hr","answer_choice_4":"55 km\/hr","answer_type":"checkbox"}, {"test_id":"6","question_text":" speed of train is:","answer_set_id":"2","correct_answer":"2","answer_choice_1":"45 km\/hr","answer_choice_2":"50 km\/hr","answer_choice_3":"54 km\/hr","answer_choice_4":"55 km\/hr","answer_type":"radio"},} parse json of answer type show checkbox or radio button @ same place. if checkbox show 4 check...

googletest - Is there any good way to check mock calls if it is copied in Google Mock Framework -

i use google test , google mock making unit tests , there need check calls of object, placed std::vector. this: test(footest, sometest) { // given csomeclass someobject; strictmock<mockfoo> strictfoo; std::vector<foo> foocontainer; foocontainer.push_back(strictfoo); // expected expect_call(strictfoo, dosomething()); // can't because there copy of strictfoo in vector // when someobject.do(foocontainer); } i'd appreciate tips on accomplishing this. i guess i'd go more this: test(footest, sometest) { // given csomeclass someobject; std::vector<std::unique_ptr<foo>> foocontainer; foocontainer.emplace_back(new mockfoo); // expected auto mock_foo_ptr(static_cast<mockfoo*>(foocontainer.rbegin()->get())); expect_call(*mock_foo_ptr, dosomething()); // when someobject.do(foocontainer); }

javascript - Remove elements by class name with dojo -

how can remove elements found class name. want using dojo framework. try below code. <div id="list"> <div class="odd">one</div> <div class="even">two</div> <div class="odd">three</div> <div class="even">four</div> <div class="odd">five</div> <div class="even">six</div> </div> dojo.query(".odd").foreach(function(node, index, nodelist){ // each node in array returned dojo.query, // execute following code dojo.remove(node); }); referred below links : https://dojotoolkit.org/reference-guide/1.7/dojo/destroy.html http://dojotoolkit.org/documentation/tutorials/1.6/using_query/ thanks, siva

visualization - How to visualize effect of running kmeans algorithm in SPSS? -

how visualize effect of runnng kmeans algoritm in spss ? don't see there additional graphical options, think i've seen visualizations of kmeans results made in spss, seemed dedicated kmeans procedure. visualize values of centers of clusters. you might interested in cluster silhouette plots available stats clus sil extension command clustering method. requires python essentials available spss community website (www.ibm.com/developerworks/spssdevcentral) , command, site.

Breeze querying local cache with EF and Web API -

problem i have view 6 drop downs. each of being populated web api call. want use breeze run query locally once has populated remote server the code runs fine when data call against server. issue when trying query local cache. never results returned. approach flawed or doing wrong ? server side view model class genericdropdown() { public int value{get;set;} public string option{get;set;} } the webapi [a single sample method] [httpget] // api/<controller> public object getsomevals() { return _context.getclinician(); } the repository [a single sample method] public ienumerable<genericdropdown> getdropdownval() { return context.somemodel(a=>new{a.id,a.firstname,a.lastname}).tolist(). select(x => new genericdropdown { value = x.id, option = x.firstname+ " " + x.lastname});} } client side datacontext.js var _manager = new breeze.entitymanager("...

android - save serialized object in phone memory -

here have data want store in phone memory , retrieve when necessary here code: public void saveobject(person p){ try { fileoutputstream fos = openfileoutput("save_object.bin", context.mode_private); objectoutputstream oos = new objectoutputstream(fos); oos.writeobject(p); // write class 'object' oos.flush(); // flush stream insure of information written 'save_object.bin' oos.close();// close stream } catch(exception ex) { log.v("serialization save error : ",ex.getmessage()); ex.printstacktrace(); } } public object loadserializedobject(file f) { try { fileinputstream fin = openfileinput("save_object.bin"); object o = fin.read(); return o; } catch(exception ex) { log.v("serialization read error : ",ex.getmessage()); ex.printstacktrace(); } return null; } using sdcar...

javascript - difference between Object.create(Object.prototype) , Object.create(Object) and Object.create(null) -

which parameter should pass first parent object others inherit , 1 more efficient object.create(object.prototype) object.create(object) object.create(null) object.create(null) returns empty object object.create(object) returns function why????( checked log , says function...i used console.dir() ) object.create(object) returns non empty object how whole thing work ... m more used classname .prototype thing :( can't understand going on here preface: javascript uses prototypical inheritance, means object can have (usually have) prototype behind it, object. if try value of property object doesn't have, javascript engine looks object's prototype (and prototype, , on) find it. object.create creates objects. first argument give object.create object use prototype of object creates. so: // create object property 'foo' var = { foo: 42 }; // create blank object using `a` prototype var b = object.create(a); // give `b` property of ow...

sql - How to use the output statement and insert multiple values with that id -

i want insert values 2 tables. the first 1 looks this recipes recipeid (unique , ai) recipename method discontinued the second 1 looks this ingredientrecipe recipeuniqid (unique , ai) recipeid (same recipeid in recipes table) ingredientid i want insert recipename , method. if recipeid gets auto incremented. want insert 3 times ingredient recipeid. working 1 ingredient. insert recipes (recipename, method, discontinued) output inserted.recipeid, '5' ingredientrecipe( recipeid, ingredientid ) values ('potato , chips', 'potato , chips bake everything', 'false'); so want can add 3 times same recipeid different number ingredientid. how this? use sql server edit: i use asp.net c# , n-tier structure. use sql server database declare variable , store value of primary key used declare @id int insert data receipes table , use scope_identity function (see this more) insert recipes (recipename, method, discontin...

ios - Undefined symbols to framework when building application separated to library and application part -

i have application separated library part , application links library. library uses afnetworking , , requires systemconfiguration , mobilecoreservices frameworks. added build process , library builds nicely. why need add same frameworks application part in order build , not see linking errors? is not enough link library? i assume library static library. adding frameworks when building static library in order access include files; not linking frameworks. because static library not linked when it's built; it's collection of object files. try command line list object files: $ ar t /path/to/my/library.a when static library linked app binary must provide libraries , frameworks of both, if object files in static library had been part of app binary source tree. just think of static library simple collection of object files , should make sense you.

model - AutoMapper, how to keep references between mapped objects? -

Image
i using automapper convert ui model pocos later serialize xml using datacontractserializer in order preserve references between them. the problem comes that, when mapping, the references between entities lost . the ui classes reference each other, mapping process makes new instances every reference, original relations broken :( let me explain: i have 2 entities of type person person { list<house> ownedhouses } and these 2 objects john owns house1 will owns house1 when automapper maps each person correctly, when maps house1 2 different instances!! so have 2 copies of house1. john owns house1 (#1) , owns house1 (#2). they not linked anymore. is there way keep relations existed? thanks. edited: have this: a document contains list of childdocuments. each childdocument has list of designables (rectangles, lines, ellipses…) , especial designable called childdocumentadapter contains anoother childdocument. trouble, c...

python - wxPython childframes interaction -

i've created simple program consists 1 mainframe(frame) , 2 childframes (childframe1 , childframe2). mainframe has 2 buttons 1 check if childframe1 created , create same if not , other check if childframe2 created , create same if not. tricky part (at least tricky me), childframe1 has button needs check if childframe2 created mainframe , if not create it. in code button creates childframe2 alongside created childframe2 mainframe. how can make work? have 2 buttons on 2 frames 1 event. code import wx class frame(wx.frame): def __init__(self): wx.frame.__init__(self, none, wx.id_any,'parent') panel = wx.panel(self, -1) sizer = wx.boxsizer(wx.vertical) button = wx.button(panel, -1, 'open child1') button2 = wx.button(panel, -1, 'open child2') sizer.add(button, 0, wx.center|wx.all, 5) sizer.add(button2, 0, wx.center|wx.all, 5) panel.setsizer(sizer) self.bind(wx.evt_button, sel...

c# - Aspx page working in background even after browser window is closed -

i have aspx website hosted in iis server. website allows user search information , user can export details excel. once export successful email sent user link excel. observed if web browser closed within few seconds of clicking export button report generated , mail sent. happy see behaviour can tell actual reason behind this? when user clicks export button request sent server , server process request until ends, in case in email. even if client browser closed after button pressed request still sent , server has no idea client browser closed. now, (with browser open throughout process) request gets sent , client waits response returns @ end of processing. makes sense when getting page tells has happened when action creates other side effects (emails example) may not seem logical have client wait. in case, consider using ajax request send request ensure rest of page can still interacted whilst request being processed.

vb.net - DataFormatString not working with data grid -

i have format issue data grid. have applied formatting property adatacolumn.dataformatstring = "{0:d}" private function createcolumnfromnode(byval adisplaypropertynode xmlnode) boundcolumn dim propertykey string = cxmldoc.attributetostring(adisplaypropertynode, "propertykey") dim columnheader string = configurabletext(cxmldoc.attributetostring(adisplaypropertynode, "columnheader")) if propertykey = "" return nothing dim adatacolumn new boundcolumn() adatacolumn.datafield = propertykey adatacolumn.headertext = iif(columnheader = "", propertykey, columnheader) <b> adatacolumn.dataformatstring = "{0:d}"</b> return adatacolumn end function to data grid. while exporting excel takes default settings of system. i have used following code exporting. not custom code. it uses asp.net proprty. dim response h...

iphone - nskvopendingnotification error in objective-c -

i have following problem during abstraction have encapsulated class in objective c allows me change rectangles size , position on underlying image. use class in situations each different. in 1 need ensure minimum , maximum size in other rect must square. observe value set user , check against rules using objective-c methods: [rectdrawer addobserver:self forkeypath:@"value" options:nskeyvalueobservingoptionnew context:nil]; - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context in method check constraints. when want correct invalid value , write comes problem "exc_bad_access" exception i tried following avoid exception not help [rectdrawer removeobserver:self forkeypath:@"value"]; rectdrawer.value = _value; [rectdrawer addobserver:self forkeypath:@"value" options:nskeyvalueobservingoptionnew context:nil]; is there possible solution this

ios - How to get IMEI on iPhone 5 -

i'm develop application jailbroken ios devices. use https://github.com/erica/uidevice-extension/blob/master/uidevice-iokitextensions.m imei, on iphone 5 solution not work(return empty string). there way imei on iphone 5(ios 6.1.2)? there several ways imei on newer devices 1) private managedconfiguration.framework cfstringref mcctimei() 2) coretelephony.framework struct ctresult { int flag; int a; }; extern cfstringref kctmobileequipmentinfoimei; void *connection = _ctserverconnectioncreate(kcfallocatordefault, null, null); nsdictionary *info = nil; struct ctresult result; _ctserverconnectioncopymobileequipmentinfo(&result, connection, &info); [info autorelease]; cfrelease(connection); nsstring* imei = (nsstring*)info[(nsstring*)kctmobileequipmentinfoimei]; 3) liblockdown.dylib extern cfstringref klockdownimeikey; void* connection = lockdown_connect(); nsstring* imei = [(nsstring*)lockdown_copy_value(connection, null, klockdownimeike...

java - Guice: How can I cache data -

i new guice , have question regarding caching. i have webapp uses provider provide user configurations. bind(userconfiguration.class).toprovider(userconfigurationprovider.class).in(servletscopes.request); the provider declared as: public class userconfigurationprovider implements provider<userconfiguration>{ public userconfiguration get() { userconfigurationdatabase.getuserconfiguration(<some param here>); } } in method, calls db , make expensive db call. i have number of classes userconfiguration injected like: public class priceview { private userconfiguration userconfiguration; @inject public myclass(userconguration userconfiguration){ this.userconfiguration = userconfiguration; } ..... } public class orderview { private userconfiguration userconfiguration; @inject public myclass(userconguration userconfiguration){ this.userconfiguration = userconfiguration; } ........ } the ...

jQuery selector first td of each row -

i have stuff: <table> <tr> <td>nonono</td> <!-- find --> </td>foobar</td> </tr> <tr> <td>nonono2</td> <!-- find --> </td>foobar2</td> </tr> <tr> <td>nonono3</td> <!-- find --> </td>foobar2</td> </tr> </table> i have tried $('td:first') no luck; expected return: <td>nonono</td> , <td>nonon2</td> , <td>nonon3</td> thanks in advance! you should use :first-child instead of :first : sounds you're wanting iterate through them. can using .each() . example: $('td:first-child').each(function() { console.log($(this).text()); }); result: nonono nonono2 nonono3 alernatively if you're not wanting iterate: $('td:first-child').css('background', '#000'); jsfiddle demo .

applet - Java 7 update21 security pop ups -

i running java7 update21 , getting issues applets. checked oracle docs java7 update21. there got know refraining use of unsigned applets , introduction of new security pop up,which prompts either block or unblock code, in java7 update21. don't want see prompt while running applets. workaround user perspective check "enable-hide warning , run protections". want block default java control panel settings.i want block prompt code.i tried adding manifest attribute trusted-only true given in oracle docs. application misbehaving after adding attribute. there anyother approach should proceed with? i figured out solution case. using self signed jars, there third party self signed jars. , there mixed code involved. according release notes of java 7 update 21 need add the trusted-library: true attribute manifest of each jar used applet. after adding attribute manifest of jars (my own jar , third party jars) java loads classes in separate class loader. applet has ac...

Reference Variable in Java? -

Image
my doubt reference variable 'r' referencing rose object referencing flower object. what happend rose object now? destroyed? i have following code: class flower { public void smell() // { system.out.println("all flowers give smell, if can smell"); } } public class rose extends flower { public void smell() // ii { system.out.println("rose gives rosy smell"); } public static void main(string args[]) { flower f = new flower(); rose r = new rose(); f = r; // subclass super class, valid f.smell(); // ii } } it flower object eligible garbage collection. rose object still referred both reference variable f , r .

jquery - Toggle "tabbable" - bootstrap -

i'm trying achieve i'm relatively sure has been done several times before, can't seem find documetation on it. i'm using responsive bootstrap this, , affected functionality revolves around "tabbable" component. (see below) <div class="tabbable"> <!-- required left/right tabs --> <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">section 1</a></li> <li><a href="#tab2" data-toggle="tab">section 2</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> <p>i'm in section 1.</p> </div> <div class="tab-pane" id="tab2"> <p>howdy, i'm in section 2.</p> </div> </div> </div> what ...