Posts

Showing posts from March, 2011

HtmlPurifier AutoParagraph + Html.Allowed -

please me understand i'm doing wrong. i'm trying use htmlpurifier html.allowed whitelist, results messed up. here an example of html.allowed disabled – works expected. set whitelist containing used tags (span, p, ul, li) , htmlpurifier throws warnings , returns unexpected result, see here . i have spent hours trying find mistake. appreciated! david it's bug. if add 'div' allowed list, have desired effect. it has been fixed in: commit 0680832d41d4d5377ea3ea8d8c10fd574d2deb7e author: edward z. yang date: tue may 21 17:19:59 2013 -0700 use info_parent_def parent information, since may not present in info array. signed-off-by: edward z. yang

Catching dynamic exception types in PowerShell -

i'm working on powershell library automates network management operations. of these operations have arbitrary delays, , each can fail in unique ways. handle these delays gracefully, i'm creating generic retry function has 3 main purposes: execute arbitrary command (with parameters) if fails in recognized way, try again, limit if fails in unexpected way, bail , report the problem item #2. want able specify expected exception type command. how can in powershell? here's function: function retry-command { [cmdletbinding()] param( [parameter(mandatory=$true, position=0)] [string] $name, [parameter(mandatory=$true, position=1)] [string] $scriptblock, [string[]] $argumentlist, [int] $maxattempts=3, [int] $retryseconds=10, [system.exception] $retryexception=[system.management.automation.runtimeexception] ) $attempts = 1 $keeptrying = $true $cmd = [scriptblock]::create($scriptbl...

mysql - Finding unique emails across two tables -

i have 2 tables 1 each email address. want emails table a not in table b . here query, seems hanging. must have missed something.. select c.field_23_4306 email, c.field_25_9341, c.field_26_1838, c.field_40_7355 form_7 c left join bounceback b on c.field_23_4306 = b.email c.field_23_4306 "%@%" what did wrong? select a.mail not exists (select 1 b a.mail = b.mail)

version - how to check which flavor of android the user is running -

is there way in code? example want know if user using froyo , if are, something. use android.os.build.version you have several ways check such comparing agsinst codename or sdk version code

cordova - Transition between pages in jQuery mobile -

i working on app has pages , here flow: page1 -> page2 -> page -> 3 -> page1 now whenever press button, if on page 1, have exit app, , if om other pages, have go previous page. if native android development, have intents , can use transition between pages. i new jquery mobile , phonegap, have similar intents in phonegap/jquery mobile? or there other way can perform above? add transition when write code button you can add script on button click: $.mobile.changepage('url', { options } ); have on link

java - How to get a random number from a 2d coordinate and a seed? -

i'm trying make noise based terrain generation , need random point a coordinate point, , seed. now, hard part i'm struggling having same number returned same point if seed same. (random.nextdouble() makes go other number). i have tried doing sort of equation: return ((int) ((randomkey1.charat((5 ^ x) % 127)) + (int) ((randomkey2 .charat(math.abs(z ^ 2 % 64) % 127)))) / 256f * 40f); but doesn't work because if swap x , z coordinates similar number causing terrain mirrored diagonally. solved: double getratcor(int x, int z) { double a; random r = new random(seed + (x*10000) + (z*100)); = r.nextdouble()*40; system.out.println(a); return a; } how about? /** * return random number seed based on coordinates. */ double locationvalue(int x,int y){ long seed = z; seed = x + (seed << 32); // make x , z semi-independent parts of seed. random r = new random(seed); return r.nextdouble(); }

javascript - submitting a form via AJAX -

i have form looks following: <form accept-charset="utf-8" action="{{ path("fos_user_resetting_send_email") }}" method="post"> <div class="field"> <label for="username">email:</label> <input class="text" id="passwordemail" name="username" required="required" size="30" type="text"> <div class="field-meta">put in email, , send instructions changing password.</div> </div> <div class="field"> <input id="submitpasswordrequest" class="full-width button" name="commit" tabindex="3" type="submit" value="get password"> </div> <div class="field center"> <a href="#" onclick='togglepasswordform(); return false;' class=...

actionscript 3 - AS3 Global Variables -

ok have managed once before cannot remember how or find source found then. making simple flash game. there several characters moving. make each level more difficult other have decided alter movement speed of each character level level. if declare , assign values these variables on main timeline in frame 1 doesn't work way want it. when go level 2, in frame, speed goes should. when go next level, level 1 higher movement speed, value assignment processed again, means movement speed goes scratch. //frame 1 var speed:int = 5; //level accomplished, speed++, goto frame 2 //frame 2 //level accomplished, speed++, goto frame 1 and code on frame 1 runs again, setting value of "speed" 5. i have tried putting variable in class, problem still same, everytime goes frame 1 code "var speed:speed = new speed();" runs again , value of variable goes whatever assigned in speed.as file. i have tried many different combinations make global variables inside package outsid...

bioinformatics - Reverse complement of reconstruction model for assembling reads -

one way assemble fragments produced dna sequencing (often called reads) seek shortest common superstring contains reads of given set of reads. 1 model problem reconstruction model, calculates minimal edit distance between possible superstring (that contains fragments) , each 1 of fragments. don't understand yet fact when calculating edit distance given fragment, it's necessary calculate edit distance reverse complement of fragment. example of fragment , reverse complement be: actgtcc fragment tgacagg complement (the complementary strand know) ggacagt reverse complement according book i'm reading ideia behind find superstring short possible either given fragment or reverse complement must approximate substring of superstring. know many mathematical/computational models don't have biological sense way of soluting biological problem, recontruction model think it's biologically reasonable find string contains fragments of region of dna sequence, , complement fr...

html - How to style an <a> tag within an <li> -

say have html this.. <ul id="menu"> <li class="menu-item-1"> <a>cateogry 1</a> </li> <li class="menu-item-2"> <a>category 2</a> </li> </ul> the thing i'm trying style each "li" element area, want style invidual items. can't change classes generic. i tried ul#menu li.a but no dice. have include indivdual class of li in order each "a", or there way say, every single li, regardless of class, has "a" in it.. want style it.. um... don't know how explain without risk of being rude, know how select li elements inside ul ... same a : ul#menu li that said, should use selector: #menu>li>a this because ids must unique, because won't interfere if decide add nested lists later.

iphone - Is glDrawArray preferred way for dynamic vertices? -

i using gldrawelements render mesh (terrain) may have occasional udpates (terrain morphing). wondering if should technically go gldrawarrays instead? really depends on whenever primitives use different vertices or not. in terrain example, if layout grid, each row of primitives share vertices previous row. if call gldrawarrays instead of gldrawelements need pass down repeated vertices, , costly (more vertices transform). updating vertices has nothing on how render it, keep list of elements static in gpu memory, , update vertices (unless morphing requires update elements too, in case don't make them static). that being said try both , see faster (profile!).

ios - UISlider value is zero when trying to pass value to UIView with custom class -

i have uiview , uilabel , , uislider placed in uiveiwcontroller in viewcontroller files. have programmatically added uilabel uiview debugging tool. yes, connect uilabel within uiview same have other uilabel once solve problem passing value in graph calculation. i'm open suggestion passing variable uiview prefer avoid creating global variables. i'm passing uislider value uilabel placed in uiveiwcontroller should when try send value "referencing" slider value in graphview.m implementation file never makes , i'm getting value of zero. i've spent 2 days scouring stackoverflow forums, reviewing documentation, , re-reading books trying figure out issue , while i've learned great deal (and fixed other problems) i've still not figured 1 out. i'm sure simple , i'm sure gonna kick myself. welcome references other documentation (i've read it) please offer constructive feedback , direction well. code below: viewcontroller.h #i...

Can procs be used with case statements in Ruby 2.0? -

i remember procs being allowed in case statements in ruby 2.0, can't google it. i tried checking ruby 2.0.0 news , how write switch statement in ruby . visited http://ruby-doc.org , link had keywords ruby 1.9, not ruby 2.0. are procs allowed in case statements? yes. 2.0.0p0 :001> lamb = ->(x){ x%2==1 } #=> #<proc:0x007fdd6a97dd90@(irb):1 (lambda)> 2.0.0p0 :002> case 3; when lamb p(:yay); end :yay #=> :yay 2.0.0p0 :003> lamb === 3 #=> true 2.0.0p0 :007> lamb === 2 #=> false however, no different 1.9.1 since proc#=== defined then. since ruby-docs seems have problem showing method, clear documentation says proc === obj : invokes block obj proc's parameter #call . allow proc object target of when clause in case statement. for ruby beginner, when clause in ruby's case statements takes value in clause , calls === method on it, passing in argument case statement. so, example, code… case "cats...

iphone - Selecting multiple values shuffle when scrolled: UICollectionView -

trying select multiple cells in uicollectionview , when scrolled selection c hanges. why happening, please guide. below code. tried. - (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath { printf("selected view index=%d",indexpath.row); itempaths = [self.collectionview indexpathsforselecteditems]; uicollectionviewcell* cell=[self.collectionview cellforitematindexpath:indexpath]; cell.contentview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"blue_s.png"]]; } - (void)collectionview:(uicollectionview *)collectionview diddeselectitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell* cell=[self.collectionview cellforitematindexpath:indexpath]; cell.contentview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"yellow_seat.png"]]; } what else should try. you can 1 thing solve problem can give tag each cell using custom cell of uicoll...

php - APNS push not working, and not 'failing', after moving to EC2 instance -

so, moved application ec2 instance, , apple push notification service stopped working. i'm using same certificate, same script, same everything. i've opened port 2195 in security group ec2 instance. from ec2 intance, telnet gateway.push.apple.com 2195 works my script receives no errors... gets end, fwrite returns true... yet, receive no push. things note. my ec2 instance accessed via https old server http, since script running locally, , has nothing apache, don't see why should matter. but, perhaps does, i'm letting know :d my script: $streamcontext = stream_context_create(); stream_context_set_option($streamcontext, 'ssl', 'local_cert', $apnscert); $ssl = 'ssl://' . $apnshost . ':' . $apnsport; $apns = stream_socket_client($ssl, $error, $errorstring, 30, stream_client_connect, $streamcontext); if($apns == false){ echo "error: $errorstring"; return false; } $payload['aps'] = array('aler...

plsql - ODI || Create Multiple Rows From Single Comma Separated Row -

i have comma separated list of values 2 columns , unique key single row. want create single row each comma separated row key repeating each value. for example, have unique_id || date || price abc || 2013/01/10,2013/01/11 || 12,13 what want is abc || 2013/01/10 || 12 abc || 2013/01/11 || 13 the comma separated values can upto n. i using odi 11g (oracle data integrator). how can this?

Hibernate persist object graph spread in two database -

if 1 object need save in database property needs save in different database should approach? example calss address { string owner_name, string house_no, } class employee { list<address> addlst; } in situation have address table in db1 , employee table in db2 , need save employee object @ 1 go. i know hibernate not suitable in situation there way can results below? db1: employee ---------- emp_id addredd_id 1 1 db2: address ---------- address_id owner house_no 1 abc bd/12 there no constraints database side. you can use postflush listener - when employee object flushed database can hold of address list , save using different session. you need same loading well. this approach lead lot of problems later on. it better have wrapper function saves these 2 things separately , use every else.

java - Why my class field is still pointing null after the initialisation? -

i have java nullpointerexception question. for instance: have 3 classes a, b , c. public class { public void methoda1() { } } ////////////////////////////// public class b { private a; private c c; public void methodb1() { = c.methodc1; } public void methodb2() { a.methoda1(); } } ///////////////////////////// public class c { public methodc1() { return new a(); } } as can see code above, main issues in class b. question is, if field in class b initilised in methodb1, why cannot use again in methodb2? compiler giving me nullpointerexception using code a.methodea1(). , cannot create new again need results methodb1(), namely in methodb1(). help, please. you create object of c class forget assign new object public class b { private a; private c c; public void methodb1() { c = new c(); // added = c.methodc1(); // problem here } public void methodb2(...

backbone.js - Backbone fetch collection but it won't save -

i'm building file browser backbone , heave problem saving fetched collection. json response server triggered , looks this: [{"name":".","type":"d"},{"name":"..","type":"d"},{"name":"bolt","type":"d"},{"name":"crm","type":"d"},{"name":"crm_backup","type":"d"},{"name":"parse.php","type":"f"},{"name":"places.txt","type":"f"},{"name":"pyrocms","type":"d"},{"name":"test.php","type":"f"},{"name":"time_test.php","type":"f"},{"name":"wordpress","type":"d"}] i've checked parse in collection , has 11 elements. when output collection it's em...

java - Variable not reachable without exception -

i have weird problem, classic of works on localhost , not in server. i've tried find bigger problem , discovered code : <div class="pageheader"><h1>products2 #{products.debug} </h1></div> when : @managedbean(name="products") @sessionscoped public class productsbean { private string debug = "debug : "; public productsbean() { debug = "debug : "; } public string getdebug() { return debug; } public void setdebug(string debug) { this.debug = debug; } and debug string has getters/setters, works in localhost not on remote. in remote server doesn't echo string @ all, , no exception gets thrown , have no idea how start looking problem. thing problem gets repeated in other ways, instance page has datatable appears empty, though it's not in localhost. when tried file uploading in whole different page got exception of target unreachable, identifier resolved null , not problem in case, se...

Need an Input Validation in a Java program(Java 2 SE) -

i had made java program in supposed take input user in gui frame , store in .dat file in row , columns. problem particular code not giving desired results. user should able enter numbers between 20 30 using keylistener. input should not accept number out of range, i.e, 19 or 31. eclipse throwing error 'invalid character constant'. there way out? // input validation restricts user enter specific number range between 20 , 30 txdeposit.addkeylistener(new keyadapter() { public void keytyped(keyevent ke) { char c = ke.getkeychar(); if(!(ke.getkeychar() >= '20' && ke.getkeychar() <= '30')) { gettoolkit().beep(); ke.consume(); } } }); your code cannot compiled because `` used mark characters, not string. character constant consist of 1 , 1 character only. therefore '20'` invalid. now, far understand want capture numbers 20 30. 2 digit number consists of 2 digits , therefore...

c# - Error : Interop.word.dll error -

Image
i have used microsoft.office.interop.word dll view word document , working fine on code level debugging after publishing project on same machine getting exception while creating dll object retrieving com class factory component wit clsid {000209ff-0000-0000-c000-00000000046} failed due following error : 80070005 didn't find solutions yet on web .. kindly me try this: goto start > run > dcomcnfg 64 console root > component services > computer > dcom config choose details view easy navigation. find excel , word right click > properties on security tab: select customize under launch , activation permissions , click edit… add account under site running (eg: network service) , assign local launch & local activation permissions , add iis_iusrs , give full permissions. snapshots step 2 step 3 step 4 p.s: adapted , modified so post

SQL Reporting 2008 and Excel as Data Source -

Image
i working on project need develop sql reports based on excel files. i able create odbc excel file , able connect using report services. my question is: how can used paramaters in query ? when try use @cif or @startdate kinds of errors , don't know how use parameters sql query excel. sample: select * [loans$] [cif] = @cif can tell me how? if extracting information without trying filter @ query level, workaround can add filtering @ dataset level, like: this extract data dataset then apply filter, not try @ same time. it's might not addressing root cause, , running in meantime. since don't list errors you're getting, it's hard offer more specific advice.

create dict from two lists python without zip()? -

i'm creating dict using zip(), how without zipping or numpy? def listtodict(list1, list2): d={} return dict(zip(list1, list2)) print listtodict([1,2,3,4,5],['a','b','c','d','e']) just fun... def listtodict(list1, list2): return dict(max(vars(__builtins__).items())[1](list1, list2))

c# - Handling n-n relationships in Entity Framework -

Image
i have simple bom database model , using model first map , use in ef.the problem is,i have n-n table,and can not add more 1 item it. for example in kartela table, can add multiple items kartelamalkodlari table since it's 1-n relationship. kartelamalkodlari _malkodlari = new kartelamalkodlari(); _malkodlari.malkodu = "walalala"; kartelamalkodlari _malkodlari2 = new kartelamalkodlari(); _malkodlari2.malkodu = "holowowlwo"; kartela _kartela = new kartela(); _kartela.kartelamalkodlari.add(_malkodlari); _kartela.kartelamalkodlari.add(_malkodlari2); ..so on. but since kartelabom table holds n-n relationships,i can not add multiple items it.how ef handle n-n relationships , whats way achieve it?

javascript - Unable to inject `$http` using AngularJS explicit `app.controller` syntax? -

i have been told should using app.controller syntax, in order support minification. rewriting sample (tutorial) example, , found couldn't work: use 'strict'; /* minifiable solution; doesn't work */ var app = angular.module('myapp', ['nggrid']); // phones.json: http://angular.github.io/angular-phonecat/step-5/app/phones/phones.json app.controller('phonelistctrl', ['$scope', '$http', function ($scope, $http) { $http.get('phones/phones.json').success(function (data) { $scope.phones = data; }); $scope.orderprop = 'age'; }]); /* alternate [textbook] solution; works */ function phonelistctrl($scope, $http) { $http.get('phones/phones.json').success(function (data) { $scope.phones = data; }); $scope.orderprop = 'age'; } phonelistctrl.$inject = ['$scope', '$http']; <body ng-app="myapp" ng-controller="phonelistctrl...

javascript - Convert this function from childhood times to something better? -

i needed show simple code example friend, example moving button along edge of screen clockwise. sure simple, no, simplest. found myself spending 30 minutes on that. embarased, because professional programmer 20+ years, , needed start program many times before button flying right ways. , thinking, why? speculated kind of code difficult right immediately, because old style, each case typed separately, each check must entered manually, need go through each iteration , make sure numbers , checks precisely correct, , hard because of nature of code style, is, eehh, spaghetti, messy? so like, there way convert "modern" way, use loop instead of cases, use templates or other meta-programming, use functional approach or @ least use arrays. , seems cannot find way this. var mx = screen.width - b.w, = screen.height - b.h setinterval(function() { var step = 3 if (state == 1) { b.x += step if (b.x >= mx) b.x = mx, state++ } else if (state == 2) { ...

c# - Textfile data not importable to third party application -

i in process of developing windows application 3 textboxes, application reads instrument's serial number via serial port saves string , displays number on 1 of textboxes. user manually enters cpu number , mine number in other 2 textboxes , data saved in textfile importing third party app.if try import textfile doesn't work whereas if type in data manually textfile imports no problems if copy same manually typed text file , try import copy doesn't work also. furthermore observed if edit serial number textbox (the 1 form serial port) clearing , typing same serial number produced textfile imports correctly. sample output text file looks 71a04619010000c7,99080101,132 71a04615430000b9,99080101,132 is there difference between manually typing , using streamwriter ? private async void savebutton_click(object sender, eventargs e) { string mydocpath = environment.getfolderpath(environment.specialfolder.mydocuments); stringbuilder sb = new stringbuilder(); sb.ap...

amazon web services - Get output frame rate from AWS elastic transcoder? -

i've tried get-job method retrieve information frame rate. but seems can specify input frame rate. want set input frame rate auto , retrieve frame rate output. does know if possible or have choose transcoding service? you can elastic transcoder, takes 2 steps. first must retrieve preset id used job. then, retrieve preset frame rate used transcoding job. here docs getting job: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/get-job.html and here docs retrieving preset info: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/get-preset.html

asp.net - Check Integer Value on Asmx -

i have sample web method on services, <webmethod()> _ public function addthis(byval x integer, byval y integer) integer dim mysum integer if not isnumeric(x) return 0 end if mysum = x + y return mysum end function when debug it, suddnely made mistake x or y value , , give me error : system.argumentexception: cannot convert gf system.int32. parameter name: type ---> system.formatexception: input string not in correct format. i try check value : if not isnumeric(x) return 0 end if but keep getting error, possible check value first before run services? at point check "isnumeric(x)", x numeric. expect integer parameters, error occur moment call function addthis. you have check x , y before calling function. or if not possible, use this: public function addthis(byval x string, byval y string) integer dim mysum integer if not isnumeric(x) or not isnumeric(y) return 0 end ...

c# - App started to crash -

after sending out update app store, app crashes when downloading app store, debugging via xamarin studio works fine. but when trying release/debug on device starts crashing giving error: 2013-05-21 10:20:30.933 nytlectio[10969:c07] not register assembly 'mbprogresshud': monotouch.monotouchexception: cannot register 2 managed types ('mbprogresshud.mtmbprogresshud' , 'alextouch.mbprogresshud.mbprogresshud') same native name ('mbprogresshud'). @ monotouch.registrar.registrar.registertype (system.type type, system.collections.generic.list`1 exceptions) [0x00000] in <filename unknown>:0 @ monotouch.registrar.registrar.registerassembly (system.reflection.assembly assembly) [0x00000] in <filename unknown>:0 i think thats whats leading crash, have no clue how fix it, , confuses me works debug , release in simulator not on device. hello using 2 libraries binds mbprogresshud , mbprogresshud.mtmbprogresshud , alextouch.mbprogre...

jquery mobile - Phonegap and the universe of frameworks? -

my concern find fitting framework developing cross mobile platform app via phonegap. using jqmobile user interface. i want build application structured , modular. means want keep capsulated. i know backbone.js , underscore.js , handlebar.js , mustache.js.... , many more. i wondering best method of structuring apps architecture?! moreover: there big dependencies result using frameworks? framework giving me best expandability , performance boosts? iam asking because hope can give me hint. save time. greetings chris. edit: useful information readers. my final decision based on " http://coenraets.org/blog/phonegap-tutorial/ ". tutorial developing phonegap application. christophe coenraets technical evangelist adobe. gives many advices how develop phonegap applications performance. link directs nice tutorial routing between views, css scrolling phonegap , many architectural information more. there 60 minute presentation performance / architecture , more similia...

html - Font import that isn't working anymore? -

i got code works not, miss see else see that's wrong? @font-face { font-family: 'ocraextendedregular'; src: url('ocraextended.eot?#iefix'); src: url('ocraextended.eot?#iefix') format('embedded-opentype'), url('ocraextended.woff') format('woff'), url('ocraextended.ttf') format('truetype'), url('ocraextended.svg#ocraextendedregular') format('svg'); font-weight: normal; font-style: normal;} after coding this, put in html: font-family:'ocr extended'; @ div that's this: <div id="left" style="padding-left:90px; margin-top:-67px; color:#ffffff; font-family:'ocr extended';"> . while typing: "font-family", can add font: ocr extended. css linked webpage in opinion think there's nothing wrong.. someone got idea? thanks! the name should call font in css defined in @font-face declaration says font-family . need refer...

jQuery mousemove over the div and not page -

i've got image behind ipad mini in html , css , i'm trying make image slide left right along mouse when mouse on ipad mini. i have got small piece of jquery code works when use $(document).mousemove jsfiddle html <div class="ipad-mini"> </div><!--ipad-mini--> <div class="ipad-mini-actuators ipad-move"> </div><!--ipad-mini-actuators--> css .ipad-mini{ position:relative; float:left; background:url(http://i609.photobucket.com/albums/tt179/diegosanchez88/ipad-mini-small_zpsb53e2bd8.png) no-repeat; width: 220px; height:330px; overflow:hidden; z-index:2; } .ipad-mini-actuators{ background:url(http://i609.photobucket.com/albums/tt179/diegosanchez88/actuators_zps8b1a7c1b.png) no-repeat center center; width: 200px; height:280px; top:20px; left:10px; position:relative; z-index:1; } jquery $(document).mousemove(function(e){ var mousepos = (e.pagex/$(wind...

php - Wordpress template deleted, but still working and showing on template selection -

i have template front-page.php in theme. name "front page". my problem when commit changes in file. wont reflect on front end. happened yesterday , don't know what's going on.. i tried deleting template but, page uses template still uses (deleted) template. when edit page, selected template still "front page". help me guys, thanks! i had same problem before , found issue because of duplicate template same name.you may have duplicate template

guard-livereload on Windows -

Image
my config of guard-livereload on windows : rubyinstaller 1.9.3-p429 devkit-tdm-32-4.5.2-20111229-1559 gem install: guard guard-livereload wdm newest browser extension firefox 2.0.9.xpi i don't have problems in console: (maybe except guard tells me i'm using old gem json (i've installed latest 1.8.0) tells me browser connected or disconnected. the problem is, guard-livereload (mostly) doesn't refresh page or refreshing once. guardfile same i'm using on linux fedora, it's working similiar config... :-/ did use guard-livereload successfuly on windows? a didn't find explanation issue, found replacement of livereload - livereloadx works :)

jaxb - Shared refrences with json -

is possible make use of concept of shared references json output mode? read article http://blog.bdoughan.com/2010/10/jaxb-and-shared-references-xmlid-and.html ), changing @produces on jax-rs json forces endless loop. want reduce object it`s id: public class foo { private long id; private string sometext; private bar bar; } i want bind instances of so: { "id": 1234, "sometext": "lorem", "bar_id": 9876 } this want avoid: { "id": 1234, "sometext": "lorem", "bar": { "id": 9876, "anothertext": "ipsum" } } note: i'm eclipselink jaxb (moxy) lead , member of jaxb (jsr-222) expert group. with moxy json-binding provider shared references post referenced (from blog) work json xml. since using jax-rs below example of configuring moxy in environment: http://blog.bdoughan.com/2012/05/moxy-as-your-ja...

I am confused between ISA (Industry standard architecture) and ISA (Instruction set architecture) -

one of these called bus standard book on industry standard architecture talks about: bus cycles, addressing, i/o, ram, rom, , cache memory, cache architectures, decode , reset logic, interrupts, system kernel, bus mastering, dma, rtc , configuration ram, and instruction set architecture defines type of instructions processor has. what relationship between two? totally confused. these different acronyms. isa in instruction set architecture refers instructions processor can execute. in old days, each computer had own instruction set , had programmed differently. in 1964 ibm introduced ibm system/360 , family of computers shared same isa. allowed ibm sell big , small machines , use same software on of them. mayor breakthrough. idea adopted competitors. today, common isas example intel x86 , arm , powerpc . because use same isa, can use same software processors intel or amd in windows pc. isa in industry standard architecture refers bus architecture, i.e. physical...

ios - AFNetworking error 401 with Core Data - Parse Sync tutorial -

i going through tutorial 'how synchronize core data web service' at http://www.raywenderlich.com/15916/how-to-synchronize-core-data-with-a-web-service-part-1 http://www.raywenderlich.com/15916/how-to-synchronize-core-data-with-a-web-service-part-2 and getting error on runtime several times request class holiday failed error: error domain=com.alamofire.networking.error code=-1011 "expected status code in (200-299), got 401" userinfo=0xe2806d0 {nserrorfailingurlkey=https://api.parse.com/1/classes/holiday, nslocalizeddescription=expected status code in (200-299), got 401} i guess 401 error code related authentication. signed @ parse , inserted proper application id , rest api keys code. not experienced in afnetworking library. suggestions? thanks!

android - Issues and contribution for Volley -

since there awesome presentation on volley tried include in project working on. found myself correcting bugs found in source code published. does know if there gonna github project 1 contribute project or there way communicate bugs , feature requests developer? regarding problems had volley: 1. seems redirection not work should: volley returns error code 302 instead of redirecting location given in response header. 2. getting cache directory not work on emulator running 4.2.2: cachedir = new file(context.getcachedir(), default_cache_dir); final string cachedir1 = "/android/data/cache/"; cachedir = new file(environment.getexternalstoragedirectory().getpath() + cachedir1); this workaround platform specific, though. wanted add completions sake. besides think volley awesome piece of code , looking until did myself ;) update 1 here link contribution page aosp . thought more standalone library. check out, although still appreciate more infos , tutorials...

open source - Evaluating search engines : free alternatives for TREC -

i evaluating several open-source search engines each other. wanted using trec data collections such wt10g or enterprise data collection... but seems of datasets expensive (500£ wt10g). why wanted ask if there free trec data collections can used open-source search engines such lucene? if not, there other data collections same quality of trec free? the venerable smart system comes bunch of test collections labeled queries, e.g. one compiled cacm papers . these collections aren't free in sense of permission distribute (modified) versions purpose, they're available @ no cost. might need work decipher file formats, they're plain text , documented. ms research has released test corpora non-commercial use, intended learning rank experiments potentially useful more general ir development.

How to deactivate the Xcode git feature? (remove git integration) -

my xcode project on git, don't xcode git integration , sometime, have errors coming xcode so remove feature of xcode. tried remove repository in organizer->repository (but after while, comes again). any idea? it's unsupported, has appeared work fine me in past: quit xcode remove bundle folder: xcode.app/contents/plugins/idegit.ideplugin or change bundle's extension. restart xcode this disables extension provides git support in xcode. can still use git version control -- not in xcode.

.net - How to reference a control template from a standard control using bindings? -

i building custom control inherits standard system.windows.controls.calendar control. i'm following article on code project. want make calendaritem sub object resizable, in article on msdn. i copied style calendar, calendardaybutton , calendaritem source code of calendar control custom control resourcedictionary located in generic.xaml. calendaritem style references 3 button templates (the previous month, next month , header buttons) this: <!-- start: previous button content --> <button x:name="part_previousbutton" grid.row="0" grid.column="0" template="{staticresource previousbuttontemplate}" height="20" width="28" horizontalalignment="left" focusable="false" /> <!-- end: previous button content --> <!-- start: header button content --> <button x:name="part_headerbutton" ...

objective c - Download font .ttf file from web and store on iPhone -

is possible download .ttf file web , store on iphone. use for labels , other stuff ? because client want control fonts database , don't want drop fonts xcode project right away. so in future if wants change font, add new font database, app recognize new font on web (thats done images, not problem), download , use font. thanks. the fonts have set in plist of app, , file cannot changed during runtime, need compile project fonts added it. you'll have think in other way of implementing it.

delphi - Custom painting of a gantt in TGanttSeries -

i've got need draw gantts consist of 2 subsections -- 1 painted brush has custom bitmap, , coloured in specified colour. these subsections have variable length, makes impossible have preset bitmap painting. the current solution i'm using have 2 instances of tganttseries, firs 1 used display first kind of subsections, second -- kind of subsections. quite cumbersome approach, provides additional challenges actions need performed on gantt visually appears single entity, in fact consists of 2 different gantts 2 different tganttseries instances. is possible provide custom painting of gantts in tganttseries single gantt represented rectangle have several subsections painted differently? you try using ongetpointerstyle event yeray suggested here . here example link: private { private declarations } function seriesgetpointerstyle(sender:tchartseries; valueindex:integer):tseriespointerstyle; //... procedure tform1.formcreate(sender: tobject); begin chart...

Shell script termination notification -

i have requirement in shell script in case if shell terminates reason i.e terminal closed or user terminated, work clean , unlocking etc. possible? if please explain how can done. in advance, praveen p b yes possible. check signal using trap command. see help trap . example cleanup() { ... exit } trap cleanup sigint # user terminated trap cleanup sighup # terminal closed trap cleanup sigterm # killed kill -15

java - Get running processes using JNA -

i trying obtain list of running processes on windows machine. i trying winapi calls via jna enumprocesses -> openprocess -> getmodulebasenamew -> closehandle fails @ openprocess call. getlasterror returns 5 (error_access_denied). this code: public static final int process_query_information = 0x0400; public static final int process_vm_read = 0x0010; public static final int process_vm_write = 0x0020; public static final int process_vm_operation = 0x0008; public interface psapi extends stdcalllibrary { psapi instance = (psapi) native.loadlibrary("psapi", psapi.class); boolean enumprocesses(int[] processidsout, int size, int[] bytesreturned); dword getmodulebasenamew(pointer hprocess, pointer hmodule, byte[] lpbasename, int nsize); } public interface kernel32 extends stdcalllibrary { kernel32 instance = (kernel32) native.loadlibrary("kernel32", kernel32.class); pointer openprocess(int dwdesiredaccess, boolean binherithandl...

Is It Possible to Convert Regular Java Applications to Web Applications? -

what mean question can people start .jar application embedded on web or have download ? made simple online game , people nowadays not want individually download game instead of directly accessing through browser. developed game on desktop, steps should take make web application, or can directly converted web application ? if don't want user download entire application must recode using web technologies. if want answers able launch application via browse (which involve download of application "transparently") can make applet @huseyin tugrul buyukisik said or can use java web start : http://docs.oracle.com/javase/tutorial/deployment/webstart/

events - Automatically detect when storing an object with ServiceStack.Redis -

i looking way subscribe events storing specific object type servicestack.redis. example may using (var redisclient = new redisclient()) using (var redismyobjects = redisclient.as<myobject>()) { redismyobjects.store(myobject);//<-- want trigger event somehow } is there onstore event can hook too, out of box? if not, there recommendation how should done? i don't think there can hook (could wrong). two options came mind: 1 - make extension method 2 - publish message store object , have handler listens response , something. overkill since it's heading publish/subscribe realm. but, think, worth looking into. ( basic example here , see pub/sub here ). extension method public static class redisclientextensions { public static void storewithtrigger<t>(this iredistypedclient<t> redisclient, t value, action<t> trigger) { redisclient.store(value); trigger(value); } } using extensionmethod public...

windows - Command to paste the Clipboard content into Notepad -

i have scenario can use command line operations things. i have file opened. want copy content file , save notepad. i able ctrl+a, ctrl+c, since in clipboard. do have 1 line command can paste clipboard content directly notepad. you can various clip tools can write clipboard file. a batch file can utilise them...

ios - Active perl Geo OSM Tiles -

i had installed geo-osm-tiles through active perl. problem dont know in path had installed. need terminal command downloading tiles through geo-osm-tiles (active perl). thanks in advance. geo-osm-tiles , other mass downloading tools against osm tile usage policy , should not used.

c++ - incorrect value in coledatetime -

i'm fighting few days coledatetime in mfc. have ctime correct values. correct years, days, months, hours, minutes , seconds. tried few ways convert ctime coledatetime : -1.i put ctim e data constructor of coledatetime coledatetime(int nyear,int nmonth,int nday, int nhour, int nmin,int nsec ); -2. formatted ctime time.format("%m/%d/%y %h:%m:%s"); and passed parsedatetime of coledatetime . -3. tried use setdatetime of coledatetime after i'm getting incorrect values of minutes 1-2 min. more or less. have never seen before , couldn't find nothing in internet.everybody says abot loss precision second, not minute. please advice me! thank you i think problem coledatetime internally uses float storage, , value represents number of days since 30 december 1899. as number of days gets larger, precision of smaller fields (like minutes) decreases. example, float can accurately store values 1000000 , 0.0000001, can't store 1000000.0000001. ...

perl - Error-global symbol requires explicit package name -

Image
i trying print values of database table on webpage in table format.i using perl file having .cgi extension.whenever try run code error "global symbol requires explicit package name".the rows of database table should displayed onload it's not happening.. i have tried lot can't understand whats wrong code.. please help.. code of people.cgi file .. #!/usr/bin/perl use cgi; use dbi; use strict; use warnings; print "content-type:text/html\r\n\r\n"; #$q = cgi->new; #print $q->header; $dsn = "dbi:mysql:demo:localhost"; # data source name $username = "mint"; # user name $password = "mint123"; # password $dbh; $sth; # database , statement handles $dbh = dbi->connect($dsn, $username, $password); $sth = $dbh->prepare("select * people"); $sth->execute(); print "<h1>ganesh</h1>"; print "<table > <tr>...

How to deserialize object from constructor in Java? -

i trying funky stuff have never done before. so trying is: create object doing following player playervar = new player(1234); players constructor player called 1234 , if exists, deserialize , store loaded object under 'playervar ' , if not it'll follow through , give a 'blank'` player object. i not sure if possible make current object other instance of same object, posting here. this trying do. this = deserielizedobject i know can done loading object, setting necessary variables manually, hardly ideal. how can 'replace' object instance of itself, within itself this code have player.java public class player implements java.io.serializable { player(string guid) // when loading new player { player player = loadplayer(guid); //i want set player // = player if know mean.... } player()//when creating new player { } private player lo...

user interface - Code::Blocks beginner issue with UI design -

Image
i new c::b , wxwidgets. i've tried create simple screen this: but when it's run: i have changed few properties following i'm not sure if right thing do. i placed flex grid on form. made 1 column , 3 rows placed 3 boxsizers. they're 1 under other. set expand property true. placed statictext , textctrl elements (one each) in first 2 boxer sizers placed spacer , button in 3rd box sizer for address text box, set multiline property true (check box) 5. but when run, not seem grow. button missing @ bottom. any ideas on how fix please... thanks! here's (part of) default code generated form. kbond::kbond(wxwindow* parent,wxwindowid id,const wxpoint& pos,const wxsize& size) { //(*initialize(kbond) wxboxsizer* boxsizer2; wxboxsizer* boxsizer1; wxflexgridsizer* flexgridsizer1; wxboxsizer* boxsizer3; create(parent, wxid_any, wxemptystring, wxdefaultposition, wxdefaultsize, wxdefault_dialog_style|wxresize_border, _t(...

Blackberry OS 5,6,7 -

i have build app should support blackberry os 5,6,7. question 1 app enough or have build 2 separate apps? i.e 1 compatible os 5 , 2nd os 6 , 7. also know if there open source graph api's blackberry 5,6,7 or not! please guide me! thanks you may build 5, 6 , 7 @ 1 time. use pre-processor directives avoid compilation problems multiple os's. need check separately ui items depending upon screen resolution , os version. 1 quick check can display.getwidth() .

javascript - jquery form submission in new window -

i want set header information , cookies form submission using $('#formid').submit(); javascript code. of site says setrequestheader working on ajax form submission. can not use ajax method submit form. my javascript code is $(document).ready(function(){ $("#leftnav a").click(function(event){ event.preventdefault(); href = $(this).attr('href'); $("#dynamicform :input").remove(); var querystringarray = href.split('?')[1].split('&'); $("#dynamicform").attr("action", href.split('?')[0]); $.each(querystringarray, function(index, value) { var elementarray = value.split('='); if(elementarray[0]=='methodtype') { $("#dynamicform").attr("method", elementarray[1]);} $('<input>').attr({ type: 'hidden', value: elementarray[1], name: elementarray[0] }).ap...

HTTP Response in Android - NetworkOnMainThreadException -

this question has answer here: how fix android.os.networkonmainthreadexception? 44 answers i want check http response of url before loading webview. want load webview if http response code 200. workaround intercepting http errors. have below: httpget httprequest = new httpget( "http://example.com"); httpclient httpclient = new defaulthttpclient(); httpresponse response = httpclient.execute(httprequest); int code = response.getstatusline().getstatuscode(); but encountered following error: java.lang.runtimeexception: unable start activity componentinfo android.os.networkonmainthreadexception how fix it? or workaround interept http errors in webview? thanks android.os.networkonmainthreadexception occurs whenever try make long running tasks/process on main ui thread directly. to resolve issue, cover webservice call inside asynctask . fyi, a...

php - Convert hexadecimal number to double -

the string of hexadecimal number like: 0x1.05p+10 the real value of hexadecimal number is:1044.0 i can convert using c language method strtod. can't find way convert in php. can show me how it? value string list: 1. "0x1.fap+9" 2. "0x1.c4p+9" 3. "0x1.f3p+9" 4. "0x1.05p+10" i think you'll have make custom function this. because i'm feeling nice today custom-made 1 you: function strtod($hex) { preg_match('#([\da-f]+)\.?([\da-f]*)p#i', $hex, $parts); $i = 0; $fractional_part = array_reduce(str_split($parts[2]), function($sum, $part) use (&$i) { $sum += hexdec($part) * pow(16, --$i); return $sum; }); $decimal = (hexdec($parts[1]) + $fractional_part) * pow(2, array_pop(explode('+', $hex))); return $decimal; } foreach(array('0x1.fap+9', '0x1.c4p+9', '0x1.f3p+9', '0x1.05p+10', '0x1p+0') $hex) { var_dump(str...