Posts

Showing posts from January, 2014

android - Multiple Numbers under one contact -

Image
i have listview custom lazy adapter attached. pull contacts phone , display them in list. having issue dealing multiple numbers. if 1 contact has multiple numbers different types appear different contacts shown below: here code getting contact list: public lazyadapter getcontactlist(){ contentresolver cr = mcontext.getcontentresolver(); cursor cur = cr.query(contactscontract.contacts.content_uri, null, null, null, null); if (cur.getcount() > 0) { while (cur.movetonext()) { string id = cur.getstring(cur.getcolumnindex(contactscontract.contacts._id)); string name = cur.getstring(cur.getcolumnindex(contactscontract.contacts.display_name)); if (integer.parseint(cur.getstring(cur.getcolumnindex(contactscontract.contacts.has_phone_number))) > 0) { cursor pcur = cr.query(phone.content_uri,null,phone.contact_id +" = ?",new string[]{id}, null);

ember.js - Ember select for belongsTo doesn't update hasMany end -

i'm trying change belongsto using built in ember select view. however, when select box changes belongs attribute updated, not hasmany relationship. following jsbin shows behaviour http://jsbin.com/ewosiy/3/edit . in example person hasmany events , event belongsto person. if change event belongsto, event removed original person never added new person. i roll own select-box component wondered if ember select not updating both ends of relationship. thanks. in order make work, need use 'pushobject' in relation of 'person' object, need this: change select this: {{view ember.select contentbinding=controllers.application.model optionvaluepath=content.id optionlabelpath=content.fullname selectionbinding=selectedperson}} and in eventcontroller add this: selectedpersonchanged: function() { if(this.get('selectedperson')) { this.get('selectedperson.events').pushobject(this.get('content')); } }.observes(&

sql server - Make word work with html tags -

i have wysiwyg on site, , saves text database in straight text, comes it's tags, have data looks <p><strong>hello world</strong></p> in sql server database. can put data 1:1 word file fine, i'm curious if there way convert tags, without having program myself it, because that's proving more challenge. i'm working on in vb.net if answer supplied relate that, bonus. thank you. tldr: how take wysiwyg text sql server database, ms-word using vb.net? try this: save formatted text html file open html file using word save opened file .docx this make word pick formatting without showing tags. it’s not ideal solution work. now sure if have code manipulate word docs, if not suggest using open xml vs office interop assemblies

Magento sets null value for non-selected attribute value in admin. It affects the frontend display. How to deal with it? -

i've created new attribute (type: dropdown) not required field. at moment, every product shows in frontend " my attribute: n/a ". after save in product, magento write null value inside catalog_product_entity_int table attribute. but in frontend attribute appear " my attribute: no " instead of "n/a". it looks bug, since didn't touch in attribute while editing new product. is there way deal or apply rule in phtml? actually not bug. it's feature. n/a displayed when there no record in table catalog_product_entity_int attribute. when add attribute there no values attribute product, save product has attribute, null value inserted in table (as stated). no value different null value . magic happens here mage_catalog_block_product_view_attributes::getadditionaldata() . these lines interest you: if (!$product->hasdata($attribute->getattributecode())) { // no value in database $value = mage::helper('catalog&

c++ - How to use opencv cvKnearest class from delphi xe2 -

i writing image processing delphi program using opencv delphi ( https://github.com/laex/delphi-opencv ) has reference of function cvknearest . (a class containing functions written in c++) how reference functions? see branch "classes" in https://github.com/laex/delphi-opencv examples: * samples\classes\cvknearest\class_2d_point_classification.dpr * samples\classes\cvknearest\cvknearest/class_labknn.dproj

android - How do I clear notifications using ADB shell -

i know can unlock screen, pull down notifications, , press clear notifications button, there's got way clear notifications through adb , right? i'm guessing it's intent sent through 'am' command, or maybe simpler, can't seem find on net. i'm getting java code use apk . edit: should mention i'm running on 4.3, commands may vary between versions. try: adb shell service call notification 1

Checkout Android source using repo from github -

the question same checking out android source github ; answers no longer apply. links gist in blog post pointed out first answer there no longer available. can indicate how may done, if @ possible, recent versions of android (>= 4.1)? http://source.android.com/source/downloading.html you want follow this. changed method of source unfortunately.

Android Studio rendering problems -

Image
i'm using android studio 0.2.3 , when opened activity layout normally, preview should appear on right side, can switch between text , design mode, should again show preview of layout. but no preview shown not on right side neither when i'm in text mode nor in design mode. error rendering problems... when compile , install app on device, works without errors. developing , experimenting layout, still nice if preview work. i have tried switch between different devices in studio, no success. does know how solve this? change android version on designer preview current version depend on manifest. rendering problem caused designer preview used higher api level current android api level. adjust current api level. if api level isn't in list, you'll need install via sdk manager.

Find difference between arrays in Ruby, where the elements are hashes -

i have 2 arrays of hashes find difference between. issue array elements single item hashes. so far, using array1 - array2 appears working correctly need watch out gotchas here? hash elements read h = {'id' => '76322'} , numeric value differs hash hash, nothing fancy. [edit] here's i'm looking for: array1 = [] array2 = [] h = {'id' => '76322'} array1.push(h) h = {'id' => '7891'} array1.push(h) array2.push(h) array1 = array1 - array2 # should result in array1 having single hash of values {'id', '76322'} array1 - array2 works putting elements of array2 temporary hash, returning elements of array1 don't appear in hash. hash elements compared using == determine whether match. comparing 2 hashes == gives true if keys , values of hashes match using == . so h1 = {'id' => '7891'} h2 = {'id' => '7891'} h1 == h2 evaluates true , though h

git - Switch branch preserving files -

background i've been running both subversion , git on single codebase. works well: can commit existing remote subversion repository, , use git local backup storing temporary commits. can commit git working, continue tidying before committing subversion sharing others. i'm know using git-svn this, i'm happy solution have. unless goes wrong , need backtrack, git write-only. what i'm trying do if switch branches in subversion, can commit git's master branch , start tracking again there. feel better have branches in git mirror in subversion there fewer files stage in git each time. how can switch branches in git without checking out branch? want files change based on svn switch, not overwritten git. want changes available staging in git if had made them manually, , have work each time switch between branches. you can use git symbolic-ref purpose. $branch local git branch trying switch to: git symbolic-ref head refs/heads/$branch you may w

database - Creating an auto-updating list in Rails -

i have 3 relevant models: class inventoryitem < activerecord::base belongs_to :item, :foreign_key => :item_id belongs_to :vendor has_many :shopping_list_items class shoppinglist < activerecord::base has_many :shopping_list_items belongs_to :user end class shoppinglistitem < activerecord::base belongs_to :shopping_list belongs_to :inventory_item end what trying create sidebar shopping list autoupdate shoppinglistitem attributes (specifically price) when respective attribute changed in inventoryitem table (again, price). thinking have these 3 classes , map shoppinglistitems directly inventoryitems, i'm unsure of how proceed that. alternatively, possible away shoppinglistitem class entirely , make shoppinglist collection of inventoryitems specified user? input appreciated. in advance! to redo comments real answer, yes, possible forego shoppinglistitem model in case, long don't need attach data model (e.g. time

c# - MassTransit - Consumer throws Exception / Publisher times out waiting for response -

i using masstransit , have following-ish code in app: requestmsg request = buildmearequest(); sometypeofresponse response = null; _servicebus.publishrequest(request, c => { c.handle<sometypeofresponse>(message => response = message); c.settimeout(timespan.fromseconds(30)); }); return response; and on consumer side, have this: public class requestmsgconsumer : consumes<t>.all { public requestmsgconsumer(iservicebus servicebus) { _servicebus = servicebus; } public void consume(requestmsg request) { sometypeofresponse response = doworktogetresponse(request); _servicebus.context().publish(response); } } this works great when goes ... if doworktogetresponse(request) throws exception (or portion of consume() method really) original requestor times out, there no indication of failure. my original idea build class either<exception, sometypeofresponse> requester e

matlab - How to make line invisible to datacursormode -

i have application create lines on cursor position. when enter datacursormode create datatips , create on lines follow cursor position. i wondering how remove them being visible datacursormode , don't making them invisible. to solve it, make handle hittest off. i.e, line created plot or line command, add following pair value @ end: plot(…,'hittest','off'); line(…,'hittest','off'); this make line invisible datacursormode.

List all routes from an application using Zend Framework 2 -

how list routes have defined in our application zend framework 2? by "routes" mean defined in: module/[modulename]/config/module.config.php under 'router' => array( 'routes' => array( ... ) ) i need list them can't figure out how , nor documentation nor forums helped me now. you can find complete (merged) config or dump router itself. there no way export route objects, there i've disappoint you. to complete config, service locator: // $sl instanceof zend\servicemanager\servicemanager $config = $sl->get('config'); $routes = $config['router']['routes']; if want view routes debugging purposes, can use var_dump or similar on router object: // $sl instanceof zend\servicemanager\servicemanager $router = $sl->get('router'); var_dump($router); to route instances can build routes using route plugin manager, not sure that's way want go...

define default named arguments in terms of other arguments in scala -

i have case class stores 3 tied parameters. i'd define companion object may build class 2 parameters, looks sample below, incorrect: def test(start : float = end - duration, duration : float = end - start, end : float = start + duration) { require( abs(start + duration - end) < epsilon ) ... } val t1 = test(start = 0f, duration = 5f) val t2 = test(end = 4f, duration = 3f) val t3 = test(start = 3f, end = 5f) what tricks may use similar usage syntax? you can use type-classes: // represents no argument object noarg // resolves start, duration, stop trait durationres[a,b,c] { def resolve(s: a, d: b, e: c): (float, float, float) } object durationres { implicit object startendres extends durationres[float, noarg.type, float] { def resolve(s: float, d: noarg.type, e: float) = (s, e-s, e) } implicit object startdurres extends durationres[float, float, noarg.type] { def resolve(s: float, d: float, e: noarg.type) = (s, d, s+d) } // etc. } def

ios - Gamekit turn based game -

i plan give try 1 of ios board game, built around gamekit's turn based api. i offer best game experience limiting amount of time available each turn. here, possible turn based api ? the goal let players play during 60 seconds, , display counter @ top of board can see when turn. so, global question is: there way prevent players stop playing without resigning game? should happen if player loose data connection while? i'll glad if share experience in type of game. cheers. cyril i implemented similar behaviour using socket connections between 2 devices in turn-based match. idea once player1 taking turn, sends respective message player2, player2 knows 1-minute timer started player1 , vice-versa. same happened when player did submitturn - other player stopped countdown , started waiting turn arrive via gc. however, in case in event of application going background (or game being otherwise interrupted) game ends tie outcome.

javascript - Making a link slide and open a new div to it's right -

i need help/guidance on how accomplish this, trying make div slide out right left side once individual link clicked. far, i'm struggling it, question how this? this have far. css: .main-header { width: 1020px; height: 50px; background: #555; border: 2px solid #444; border-top: none; -moz-border-radius: 0 0 25px 25px; -webkit-border-radius: 0 0 25px 25px; border-radius: 0 0 25px 25px; -moz-box-shadow: 0 22px 14px -14px #000, inset 0 -0.3em 0.9em 0.3em #000; -webkit-box-shadow: 0 22px 14px -14px #000, inset 0 -0.3em 0.9em 0.3em #000; box-shadow: 0 22px 14px -14px #000, inset 0 -0.3em 0.9em 0.3em #000; position: fixed; -moz-transition: .3s ease; -webkit-transition: .3s ease; -o-transition: .3s ease; transition: .3s ease; top: 0; } .main-header h1 { width: 1020px; float: left; text-align: center; } .toggle-menu { width: 44px; height: 44px; padding: 6px 0 0 12px; margin: 0; border-right: 2px solid #444; position

c# - How do I find the source of a "A procedure imported by 'xxx.dll' could not be loaded." exception? -

i have been chasing exception past week. situation is: i have application written in c# , built in visual studio 2010. application includes dll wrapper of unmanaged code library. unmanaged code written in c++ , built in visual studio 2008. required because code references additional libraries (qt) , code targets wince version 5 (necessary due devices supported in field). i have tried many of suggestions have seen here, including using various dependency walkers (vs 2008 depends, dependency_walker, , dependz) other tools such reflector , process monitor sysinternals. all of tools either show no problems (reflector) or old dependencies obsolete in environment (win 7) dcomp.dll, gpsvc.dll, & ieshims.dll. in debugger, can step through code right until instantiate object references managed wrapper dll. not step instantiation of object, throws exception immediately. in process explorer (from sysinternals) can see managed dll loaded, along necessary subsidiary dlls. in

jsf 2 - how to add ui-state-error to p:selectOneRadio on failure -

i'd make sure p:selectoneradio highlighted in way when required, nothing selected. currently, there error message added top of page, no error class added component. makes more difficult users able find problem when there lot of inputs. edit: added additional info in example example <div class="options-item r"> <fieldset class="default-radio"> <legend for="default_radio_id" class="legend-txt"> <span class="required c">*</span>#{msg['label.legend']} </legend> <p:selectoneradio id="default_radio_id" label="#{msg['label']}" required="true" layout="custom" value="#{bean.value.defaultisfalse}"> <f:selectitem itemlabel="#{msg['label.option1']}" itemvalue="#{true}"/> <f:selectit

json - Should cpu-intensive operations be processed client side if possible? -

i serving page on website renders statistical data formed thousands of data points. none of data sensitive, security not concern. my first instinct send data processed client doesn't slow doesn't slow server; yet, not sure if considered bad practice, or if potentially slower send large amounts of data instead of rendering few numbers first. the data stored json if matters the specifics matter here. can send 512kb of data browser successful processing? on desktops, yes. can send 20mb? no. try , see how works. if code in clean style, running in node vs browser should can experiment trying both ways.

angularjs - Behavior of controller inside directives -

i know $scope controller can shared link function in directives . for example, in code can call function declared controller print 'hello world' on browser console: .directive('mydirective', [function () { return { restrict : 'e', replace : true, controller: 'mycontroller', templateurl : 'directives/mydirective.tpl.html', link : function (scope, elem, attrs, controller) { scope.message = 'hello world!'; } }; }]) .controller('mycontroller', [function ($scope, $element, $attrs, $log, $timeout) { // $timeout wait link function ready. $timeout(function () { // prints hello world expected. $log.debug($scope.message); }); }); }]) ok, works fine. my questions are : in approach, same scope shared between controller , directive? what consequences

Adding a Textview to a relative layout in Android -

so have researched everywhere no else seems have problem because know how program, anyways i'm trying add textview relative layout in android app, no matter cannot text , buttons have in layout. here code activity: public class enterapp extends activity { int marblesinjar=0; int targetmarblesinjar=0; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent= getintent(); targetmarblesinjar= intent.getintextra("message_marbles",0); relativelayout marble= new relativelayout(this); textview textview = new textview(getapplicationcontext()); textview.settextsize(20); textview.settext("your marble jar full when has "+ targetmarblesinjar + " marbles. have " + marblesinjar + " marbles."); textview.settextcolor(color.black); marble.addview(textview); this.setcontentview(r.layout.activity_enter_app); // show button in action bar. setupact

javascript - Is there a performance advantage in using an object literal over a self instantiated constructor? -

question is there performance advantage in using object literal on self instantiated constructor? examples object literal: var foo = { //... }; self instantiated constructor: var foo = new function () { //... }; yes (the object literal will faster), subtly different in implementation 1 , represent different goals. constructor form "has bunch more stuff" while literal form can more highly optimized - definition (of as-of-yet-fixed set of properties), , not sequence of statements. even though micro-benchmark (which interesting, arun!) might show 1 being "much slower", doesn't matter in real program 2 amount of relative time spent in either construct approaches nothing. 1 when constructor used a prototype must introduced . not case object literal due it's fixed chain behavior. every object created constructor has implicit reference (called object’s prototype) value of constructor’s “prototype” property. ot

winapi - Win32 API for Deleting User Profile? -

one way of deleting user profile delete user profileslist registry key , delete user folder users directory. on windows 8 though not seem sufficient. there seems data present in hklm related user too. 1 such example hklm\software\microsoft\windows\currentversion\appx\'usersid'. hence i'm looking api (win32 sdk), delete filesystem , registry entries related user profile?

html - Changing subitems font color -

im using dreamweaver , it's first time use , can't find code change subitems menu color , how change background when hovered on dropdown. *{ margin:0; padding:0; } ul.menubarhorizontal { margin: 0; padding: 0; list-style-type: none; font-size: 100%; cursor: default; background:url(../images/menu5.png) no-repeat; width:420px; height:58px; } /* set active menu bar class, setting z-index accomodate ie rendering bug: http://therealcrisp.xs4all.nl/meuk/ie-zindexbug.html */ ul.menubaractive { z-index: 1000; } /* menu item containers, position children relative container , fixed width */ ul.menubarhorizontal li { margin: 0; padding: 0; list-style-type: none; font-size: 100%; position: relative; cursor: pointer; float: left; } /* submenus should appear below parent (top: 0) higher z-ind

c# - Windows Phone: How to draw a line on a Rectangle? -

i draw rectangle , need divide rectangle 2 parts. trying use line in order divide dont know why can not see line. rectangle rect = new rectangle(); rect.fill= colors.blue; rect.width=100; rect.margin = new thikness (0,40,0,0); grid.children.add(rect); line line = new line(); line.stroke = colors.black; line.strokethickness=1; line.x1=2; line.x2=7; line.y1=41; line.y2=41; grid.children.add(line); do have idea how can add line on rectangle? here how divide vertically:- a) drawing line 5 pixels in width not visible because line of stroke black , page background black line hidden. line drawn (2,41) (7,41). b) rectangle in center of page, 100 pixels wide , tall page , line on top left did not intersect rectangle in center c) recommend use of canvas since can set top , left pixel positions of each item on canvas i modified code in following way:- rectangle rect = new rectangle(); rect.fill = new solidcolorbrush(colors.blue); rect.width = 100; rect.height = 200;

ssh - Close the terminal but keep matlab running remotely -

i have run programs remotely in cluster via ssh. the problem following, programs run 2 or 3 days (they heavy). connect cluster , run programs following command matlab -nosplash -nodesktop -r script the program runs properly, if close terminal program stops running, , if disconnect network program give me following error: "broken pipe". is way can run program , can disconnect or close terminal , program keep running? thank much look program called screen . i'm assuming remote logging through ssh , using linux? screen link

jquery - Create buttons and text boxes like Google Web Pages -

how can create light weighted buttons , text boxes in google web pages google search, google plus , google play. using jsp , css.. ready use jquery.. kindly needful. in advance.. see.. exapmle http://purecss.io/ may useful u....

JQuery-Selector $(this).next("input[name='foo']") doesn't work -

i want react .change() on value change. case, other (hidden) field must updated. <input type="text" name="n1"><br> <input type="text" name="n2"><br> <input type="text" name="n3"><br> <input type="hidden" name="h1"><br> <script> $("input[type='text']").change( function() { try { $temp = $(this).next("input[type='hidden']"); } catch (e) { // testing alert("not found "+e); } try { $temp = $(this).next("input[name='h1']"); } catch (e) { { // testing alert("not found "+e); } $temp.val("hidden"); alert("temp "+$temp); alert("temp has following value:"+$temp.val()); }) </script> demo testing at: http://jsfiddle.net/22c2n/1209/ this statement $temp = $(this).next("input[type='hidden']

how to give relative path to jquery load function -

<script src="jquery.js"></script> <script> function loadcontent() { $("#includedcontent").load("../projects/menu.html"); // not working } </script> <div id="includedcontent"></div> <script> loadcontent() </script> $(document).ready(function(){ $('#includedcontent').load("../projects/menu.html", function() { //stuff }); });

asp.net - C# Drawing Chess Board -

i'm trying draw 8x8 chess board using c#. here's first attempt draw it. won't draw board , haven't found i'm missing. public void form1_load(object sender, eventargs e) { bitmap bm = new bitmap(8 * 100, 8 * 100); graphics g = graphics.fromimage(bm); color color1, color2; (int = 0; < 8; i++) { if (i % 2 == 0) { color1 = color.black; color2 = color.white; } else { color1 = color.white; color2 = color.black; } solidbrush blackbrush = new solidbrush(color1); solidbrush whitebrush = new solidbrush(color2); (int j = 0; j < 8; j++) { if (j % 2 == 0) g.fillrectangle(blackbrush, * 100, j * 100, 100, 100); else g.fillrectangle(whitebrush, *

web services - java.lang.IllegalArgumentException' faultactor: 'null' when using soap to call webservice from android device -

i create simple webservice connect android device. have used jax-ws follow guide: http://www.mkyong.com/webservices/jax-ws/jax-ws-spring-integration-example/ when run on client it's ok on device have fault. it's " soapfault - faultcode: 's:server' faultstring: 'java.lang.illegalargumentexception' faultactor: 'null' detail: org.kxml2.kdom.node@41aa21f0 " there wsdl file <!-- published jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.2.3-b01-. --> <!-- generated jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.2.3-b01-. --> <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/so

Camel timer reset after suspend -

i want camel timer reset every time route in, resumed. the problem use timer manage sending logon messages long interval , works fine first time after reconnection , resuming of logon route seems timer remembers state in prior suspension. maybe expected behaviour in cases in mine use way change it. know achieve stopping , starting route, maybe there other way ? this possible same question posted alreadt on camel mailing list being discussed , answered: http://camel.465427.n5.nabble.com/timer-with-delay-0-and-repeatcount-1-does-not-fire-after-resumed-td5737036.html

c# - Implementing dynamic permission control library -

i need create permissions resources , determine can read, write or delete them. these permissions in database table , should configurable administrator. want check permissions in 1 centralized place (for example filter attribute) below: //controller action method [httpput] [permissioncontrolfilter] public apiresultbase update(plandto model) { ... } // filter attribute class public class permissioncontrolfilterattribute : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { var permissions = getuserpermissions(user.identity.name); // check if user has permission action , // can read, write or delete according model type // , rules defined model type } } i need permissions defined user --> resource , claim --> resource . one challenge might how define permissions when comes detailed resources. example how s

java - Why hibernate always call "update" statement after using "select" statement in MySQL? -

is there me in case. using hibernate select data db, when check sql debug log. see update sql printed after use "select" sql data db. 2013-08-13 13:39:08,054 debug [http-0.0.0.0-8080-1-task]-[org.hibernate.sql] select this_.id id504_2_, this_.bridgedlinedialoguri bridgedl2_504_2_, this_.bridgedlineuri bridgedl3_504_2_, this_.currentsipsubscriberprofile currents4_504_2_, this_.currentsipsubscriberprofiletype currents5_504_2_, this_.messageeventuri messagee6_504_2_, this_.nemobjectid nemobjec7_504_2_, this_.objectid objectid504_2_, this_.objecttype objecttype504_2_, this_.sipbridgedlineurienable sipbrid10_504_2_, this_.sipdirectconnecturi

http status code 404 - Windows Azure The remote server returned an error: (404) Not Found -

i'm following this tutorial table storage service . i'm using emulator version of tutorial can find @ point 5 of paragraph "configuring connection string when using cloud services". this code pasted in 'about' actionresult : public actionresult about() { // retrieve storage account connection string. cloudstorageaccount storageaccount = cloudstorageaccount.parse( cloudconfigurationmanager.getsetting("storageconnectionstring")); // create table client. cloudtableclient tableclient = storageaccount.createcloudtableclient(); // create cloudtable object represents "people" table. cloudtable table = tableclient.gettablereference("people"); // create new customer entity. customerentity customer1 = new customerentity("harp", "walter"); customer1.email = "walter@contoso.com"; customer1.phonenumber = "425-555-0101"; // create tableoperation insert

c++ - Deploy Haxe cpp in single .exe -

i've created app launcher launches latest version of application , need deploy single .exe file. works fine on computer when try on computer seems missing dependency , cannot find documentation on how deploy haxe cpp , dependencies are. bin folder full of files main.exp, main.lib not know are. the error on other machines "error : not load module std@get_cwd__0"

parallel processing - Run a script that uses multiple MATLAB sessions -

how call function simple inputs in several matlab sessions automatically? the manual way be: open 3 sessions call magic(t) t 1, 2 or 3 respectively so, question is: how can programatically? in case relevant, not want use parallel processing toolbox. note don't think parfor loop can want. first of require parallel processing toolbox, , secondly want able debug 1 of these operations fails, without bothering other sessions. first of way must found open sessions programatically. based on this , this found can follows (works on windows well): % opening 3 matlab sessions t = 1:3 !matlab & end besides opening them, simple command can given !matlab -r "magic(5)" & now, combine small trick remains: for t = 1:3 str = ['!matlab -r "magic(' num2str(t) ')" &']; eval(str) end note if want use more complicated inputs can save them in struct , call them index using wrapper script called function.

Logback.xml configuration -

i trying configure stout save file. however, not saved file - have idea why?. - want log file name configurable inside logback.xml {log_file_name} come cmd - possible? this logback.xml: <?xml version="1.0" encoding="utf-8"?> <!-- assistance related logback-translator or configuration --> <!-- files in general, please contact logback user mailing list --> <!-- @ http://www.qos.ch/mailman/listinfo/logback-user --> <!-- --> <!-- professional support please see --> <!-- http://www.qos.ch/shop/products/professionalsupport --> <!-- --> <configuration> <appender name="defaultlog" class="ch.qos.logback.core.rolling.rollingfileappender"> <!--see http://logback.qos.ch/manual/appenders.html#rollingfilea

embedding - JPA @EmbeddedId: How to update part of a composite primary key? -

i have many-to-many relationship link table has additional property. hence link table represented entity class , called composition . primary key of composition @embeddable linking according entities, eg. 2 @manytoone references. it can happen user makes error when selecting either of 2 references , hence composite primary key must updated. due how jpa (hibernate) works of course create new row (insert) instead of update , old composition still exist. end result being new row added instead of 1 being updated. option 1: the old composition deleted before new 1 inserted require according method handling requires both old , new version. plus since updated version new entity optimistic locking not work , hence last update win. option 2: native query. query increments version column , includes version in clause. throw optimisticlockexception if update count 0 (concurrent modification or deletion) what better choice? "common approach" issue? why not c

python - Program to write all the numbers divisible by 99 to a text file not working? -

i trying write simple program starts @ number 99 , writes down multiples of 99 under 1000000000 text file named: 'blank.txt' code: f = open('blank.txt') = 99 while <= 1000000000: f.read() = str(a) f.write(a) = int(a) = * 2 f.close() one problem.. reason can't write text file? please me able write multiples of 99 text file. btw if have way using python please post it! you need open file in write( 'w' ) mode: with open('blank.txt', 'w') f: num in range(99, 1000000001, 99): #do here. note there's no need close file now, with statement automatically you.

json - Javascript objects parsed vs created -

what practical difference between p , p2 objects here: var person = function(name) { this.name=name; } var p = new person("john"); var p2 = json.parse('{"name":"john"}'); what cases when better create new person() , copy values parsed json, rather use parsed json object use instance of person ? ps. let's got json string websocket , have parse anyway. the main difference p object, instance of person while p2 "plain" object, instance of object . when difference important? 1) accessing prototype properties: var person = function(name) { this.name=name; } person.prototype.getname = function () { return this.name; }; p.getname() //works fine p2.getname() //error since getname not defined or: console.log(p.constructor) //person console.log(p2.constructor) //object 2) using instanceof operator: p instanceof person //true p2 instanceof person //false 3) has inheritance all 3 points can traced

c# - How to access other directories of hosted server -

i have website in asp.net. have hosted on server. server has 3 directories named c,d,e. asp.net application in c drive. in module have uploaded images stored in server's d directory. want access asp.net code display error message : "asp.net physical path virtual path expected" . how can access image scenario. please me.... code follows.. imagebutton lnkbtn = sender imagebutton; gridviewrow gvrow = lnkbtn.namingcontainer gridviewrow; string filename = grvimpact.datakeys[gvrow.rowindex].values[3].tostring(); string filepath = "d://upload//crdocument//" + filename.tostring(); if (filename != null) { response.contenttype = "image/jpg"; response.addheader("content-disposition", "attachment;filename=\"" + filepath + "\""); response.transmitfile(filepath); response.end(); } it not worked... use server.mappat

c - Undefined-Behavior at its best, is it -boundary break? -bad pointer arithmetic? Or just -ignore of aliasing? -

i'm working weeks c99 focusing undefined behaviour. wanted test strange code while trying respect rules. result code: (plz forgive me variable names, had eaten clown) int main(int arg, char** argv) { unsigned int uidiffofvars; int legalpointercast1, legalpointercast2, signedinttorespecttherules; char startvar;//only use have adress can move on char *theaccesingpointer; int itargetofpointeracces; itargetofpointeracces= 0x55555555; theaccesingpointer = (char *) &startvar; legalpointercast2 = (int) &startvar; legalpointercast1 = (int) &itargetofpointeracces; if ((0x80000000 & legalpointercast2) != (0x80000000 & legalpointercast1)) { //as im not sure in how far //"— apointer converted other integer or pointer type (6.5.4)." treating unsigned integers, //im checking way. printf ("try on next machine!\r\n"); return 1; } if ((abs (legalpointerc