Posts

Showing posts from January, 2010

objective c - Check duplicate property values of objects in NSArray -

i have nsarray containing objects size property. how can check if nsarray has 2 objects same value size ? can like: int = 0; (id item1 in myarray) { nsdecimalnumber *size1 = [item1 size]; (id item2 in myarray) { nsdecimalnumber *size2 = [item2 size]; if ([size1 isequal:size2]) { ++; } } } if (i > [myarray count]) { nslog(@"duplicate sizes exist"); } or there easier way? use nscountedset . add objects counted set, , use countforobject : method find out how each object appears in array. you can check link how-to-find-duplicate-values-in-arrays hope helps you

javascript - RegEx- Validate negative and positive decimal numbers -

i trying build regex allow both negative , positive decimal numbers following rules. there can not more 2 digits after decimal point decimal point optional total length including decimal point should not exceed 12 char if no decimal point there, max length should not exceed 9 char can me out? lot in advance. check regex. ^[+-]?[0-9]{1,9}(?:\.[0-9]{1,2})?$ this regex says sign optional at least 1 , max 9 digits integer part if decimal point there, @ least 1 , max 2 digits after it.

python - Convert pygame app to kivy -

i have written application in pygame. great framework want have easier process bundling different platforms, including mobile. have found kivy . here question: what concrete steps need take convert pygame application kivy? update: reason asked question looks kivy built using pygame. wondering if there specific way leverage ease conversion? well, can't directly, kivy, uses pygame it's backend(when possible), frontend quite different, , not pygame's porting quite different. one way learn kivy, , port app pygame => kivy..

c# - Access controls on other windows - 2 -

i wrote delphi program 4 or 5 years ago, now, have .exe file, lost source. i'm c# programmer (beginner :d) now. resons, need change text of textbox in delphi program , press button new c# program. how can access controls on application's window? i read this , confused :(

sql server - VB.Net Dataset checking null -

using vb.net , sql server so dataset this: dim ds3 new focusdatasettableadapters.gajitableadapter and want item in dataset array. dataset empty now.. try.. dim smp new list(of string)() try = 0 ds3.getdata.count - 1 if (ds3.getdata.rows(0).item(3) nothing) smp.add("0") end if next catch ex exception = - 1 end try so want is.. if database null/empty add "0" array. everytime run code gives me error state there row @ current position (0)... your code should (maybe necessary more modification - snippet cannot tested): try dim tbl datatable=ds3.getdata() = 0 tbl.rows.count - 1 if (tbl.rows(i).item(3) dbnull.value) smp.add("0") end if next catch ex exception = - 1 'rather strange , causes endless loop end try you should aware getdata method returns datatable , want iterate it. reconsider errorhandling!

ios - UIButton action selector -

i have following code: - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { uiimage * search = [uiimage imagenamed: @"search.png"]; uiimageview * s = [[uiimageview alloc] initwithimage: search]; s.frame = cgrectmake(15, 14, search.size.width, search.size.height); uiimage * simg = [uiimage imagenamed: @"m_search_back.png"]; uiimage * img = [uiimage imagenamed: @"m_top.png"]; cgrect searchbarframe = cgrectmake(0, 0, self.tableview.frame.size.width, 45.0); self.searchbar = [[uisearchbar alloc] initwithframe:searchbarframe]; self.searchbar.backgroundimage = simg; [self.searchbar setsearchfieldbackgroundimage: simg forstate:uicontrolstatenormal]; self.searchbar.delegate = self; [self.searchbar addsubview: s]; uitextfield *searchfield = [self.searchbar valueforkey:@"_searchfield"]; // change search bar text color searchfield.textcolor = [uicolor c...

c# - Class not inheriting from object? -

i working on method using reflection inspect parameter types of methods. methods iterates through parameterinfo's , doing types of parameters. i under assumption if typeinfo.isclass true , type class , derives (indirectly) type object (except when type object of course). so, if typeinfo.isclass true, typeinfo.basetype must set. well assumption wrong! there classes not derive type object . , assumption messed code. for example: type type = typeof(int).makebyreftype(); type.isclass true , type.basetype null . if think it, logical. , can prevent code crash checking typeinfo.isbyref . now question is: there more such 'exotic' types (besided byref-types , type object ) class ( isclass == true ) not have base type ( basetype == null )? before answer: refering types isclass == true ! , example type int example. have been type. please no: interfaces structs void answers far: byref types ( t& ): descrybed in question. pointer types ( t...

java - Add two ArrayList to one ArrayList of hashmaps -

i have 2 arraylist , want make 1 arraylist adding them, both lists have same size i going way. is optimized or can make better , efficient when lists become large? i.e. private arraylist<bitmap> imagefile= new arraylist<bitmap>(); imagefile.add(xy); imagefile.add(ab); imagefile.add(cd); private arraylist<mediaplayer> musicfile= new arraylist<mediaplayer>(); musicfile.add(mm); musicfile.add(nn); musicfile.add(ll); private hashmap<bitmap, mediaplayer> mappedfiles= new hashmap<bitmap, mediaplayer>(); mappedfiles.put(imagefile.get(i),musicfile.get(i)) private arraylist<hashmap<bitmap, mediaplayer>> imagemusic= new arraylist<hashmap<bitmap, mediaplayer>>(); imagemusic.add(mappedfiles); based on comment, don't want map @ all, want classes , lists: public class track { private final string name; private final mediaplayer music; public tra...

grails - Render template using layout from plugin -

is possible render template using layout file plugin? if use plugin tag, template searched form plugin. e.g.: render (template: "templatefromproject", layout: "layoutfromplugin") according docs , there plugin attribute should using. render (template: "templatefromproject", layout: "layoutfromplugin", plugin: 'theplugin')

php - User Yii::t() value for arrays values -

i´m in proyect yii php framework , in muy model have public static array constante index this: const estado_activa = 1; const estado_rechazada = 2; const estado_aceptada = 3; public static $estados = array( self::estado_activa => 'activa', self::estado_rechazada => 'rechazada', self::estado_aceptada => 'aceptada' ); i need replace 'activa' this const estado_activa = 1; const estado_rechazada = 2; const estado_aceptada = 3; public static $estados = array( self::estado_activa => yii::t('category','activa'), self::estado_rechazada => yii::t('category','rechazada'), self::estado_aceptada => yii::t('category','aceptada'), ); when try error: parse error: syntax error, unexpected '(', expecting ')' i don´t understand what´s wrong. all.. using yii way (like in docs) create estados method: const estado_acti...

asp classic - Put TAB in selectbox's option list -

how can put tab inside itens in selectbox's option itens? i have: <select> <option>tese - teste de descrição</option> <option>mais um - de desc.</option> <option>tabulação - item de tabulação com info</option> </select> i wanna: <select> <option>tese teste de descrição</option> <option>mais um de desc.</option> <option>tabulação item de tabulação com info</option> </select> update: ok, vbtab or chr(9) it: <select> <option>tese<% response.write chr(9) & chr(9) & chr(9) %>teste de descrição</option> <option>mais um<% response.write chr(9) %>de desc.</option> <option>tabulação<% response.write chr(9) & chr(9) %>item de tabulação com info</option> </select> but see in source code. browser isn't rendering it. unfortunately in html not sp...

java - EL can't handle a single character before an underscore? -

i using el pull object bean stored in session. the object question called p_cov_moult , declared follows: this.p_cov_moult = new formfield("f_b_p_cov_moult",""); and accessed via getter method so: public formfield getp_cov_moult() { return p_cov_moult; } which generated netbeans. i appreciate usage of caps separated underscores not fit naming conventions non constants, it's useful semantic value. i have many other properties stored in same bean, , pulling fine , have been while. however, p_cov_moult , other properties in format of multiple underscore separated values first 1 being single character, javax.el.propertynotfoundexception. the objects/properties stored in same way rest, can't found. i've tried inserting separate method getp_cov_moult(), on assumtion converting name in el getter incorrectly (or correctly) , not calling getp_cov_moult(), instead calling different method, such getp_cov_moult(), didn't work. here...

faceted search - Elasticsearch ignoring whitespaces and cases for facet terms -

i have made es schema fields marked no_analysis creating facets. seems of data contains whitespaces or lowercase letters. e.g. field named color have values "black", "black", "black ", leads 3 different facet terms. there way handle without making changes data? you can analyze text without tokenizing if use keyword tokenizer . means "black dog" not split 2 tokens, can apply token filters modify tokens, instance lowercasing them using lowercase filter , trimming them using trim token filter . you need create custom analyzer in index settings , use in mapping field you're faceting on. as result index "black" token out of 3 "black", "black" , "black " provided input.

Automatically export a visual studio 2012 template -

i'm wanting way 'automatically' export templates visual studio 2012. i'm aware can manually selecting file->export template , fill out wizard's questions each project have in solution, takes long time (typing... etc). want automate in code. i've spent quite bit of time researching no avail; hence question here! investigation 1: 'could' macros, bit ugly , not professional. (how list of projects have in solution way?) investigation 2: apparently possible tapping visual studio's automation objects; can @ function export project, launches export template wizard resulting in having manually type in details anyway. see link investigation 3: can execute file called 'projectgen.exe', helps creation of wizard's options (so don't have type them), apparently belongs company and, after contacting them, not willing give me file. (not that, designed earlier versions of visual studio , calling out-of-proc exe not nice) see link ...

deleting elements in array in a loop Perl -

i want make loop go through elements in 1 array (@array1), , if same element found in array (@array2), want value third array (@array3) same index added first array , deleted third array. tried way, line if-statement runs on unitialized values, , loops forever. foreach $elem1 (@array1){ $i = 0; while ($i < scalar @array2){ if($array2[$i]==$elem1){ push (@array1, $array3[$i]); delete $array2[$i]; } else{ $i++; } } } the problem not increment $i if element matches. delete else .

python - Storing frames in list -

i'm trying store frames in list can widgets 3 3 on top of each other whit small space in between them but can't seem make work. code: self.cbocombo = [] self.frame_type = [] x in range(7): self.cbocombo.append([]) y in range(3): self.cbocombo[x].append([]) in range(7): self.frame_type.append(i) self.frame_type[i] = frame(self.frame_type) self.frame_type[i].pack(side=top, expand=1, ipady= 11) self.cbocombo[i][0] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][0]) self.cbocombo[i][0].pack(padx= 5) self.cbocombo[i][1] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][1]) self.cbocombo[i][1].pack(padx= 5) self.cbocombo[i][2] = ttk.combobox(self.frame_type[i], values=self.valcombo, textvariable=self.varcombo[1][2]) self.cbocombo[i][2].pack(padx= 5) error message: file "file.py", line 89, in __init__ self.frame_typ...

networking - Does the size of the file increase when it is transferred to a destination system through a network? -

assume there 2 systems connected same network (modem). 1 system sender , other receiver. when sender sends kind of file receiver occupying 5000kb space, no matter how small sent file is. problem code or network (lan) i'm using? yes, depending on file system in case since same size, i've no idea.

c# 4.0 - How to Add Records in a 0:0..N in Entity Framework 5 -

we have ms sql server table structure such: table org { id int name varchar(50) } table request { id int name varchar(50) orgid int not null } our models this: public class org { public int id { get; set;} public string name { get; set;} public list<request> requests { get; set;} } public class request { public int id { get; set;} public string name { get; set;} public int orgid { get; set;} } and our configuration such: public class requestconfiguration : entitytypeconfiguration<request> { public requestconfiguration() { hasrequired(o => o.org) .withmany(o => o.requests) .hasforeignkey(o => o.orgid); } } every time go make new request instance, , assign org it, creates new record in org table - no matter what. on same dbcontext. i've tried various mappings in configuration, result in same behavior. doing wrong? thanks! you must tell ef org exists. ...

PHP interaction with AJAX -

so have function in javascript file: function updatethiscoursehistory(){ var ajax= new ajax.request("runneededqueries.php", { method: "post", parameters: {database: "history", action:"update"}, onsuccess: function(){alert("this course history entry has been updated");}, onfailure: function(){alert("could not find entry specified primary key");} } ); } suppose php file <?php header('http/1.0 400 bad request'); ?> would make onfailure method execute? the onsuccess callback fire when php script responds http 2xx response code , onfailure callback fire if http error code returned. if want take action based on response value, have options: modify php script return http error response (perhaps 400) on failure , take action based on specific value returned. header('http/1.0 400 bad reques...

Autoit - Capture Run/DOS command output as well print on STDOUT -

i have following code capture , process run command output. how modify such run command window , output active , @ same time captured , logged? p.s.replacing @sw_hide @sw_show or equivalent shows blank command window (all command execution truncated) something similar function of linux "tee" command logs file prints on stdout. $currentpid = run(@comspec & ' /c ' & $currentlogcmd, "", @sw_hide, $stderr_child + $stdout_child) if not processwaitclose($currentpid,60) writelog("[warning] timed-out.finding date in current hour raw log -" & $currentlogfilename) $f_logwarningexist=1 return $c_success ; take chances , proceed parsing raw logs endif $currentoutput = stdoutread($currentpid) consolewrite(_getdosoutput('ipconfig /all') & @crlf) func _getdosoutput($command) local $text = '', $pid = run('"' & @comspec & '" /c ' & $command, '', @sw_hide, 2...

java ee - TomEE, JAAS, SQLLoginModule and 403 -

i have added sqlloginmodule deployment (tomee 1.5.1): system property points login.config login.config configured use sqllogin realm server.xml updated use realm here's web.xml (i'm sure problem here) <security-constraint> <display-name>unsecured</display-name> <web-resource-collection> <web-resource-name>unsecured area</web-resource-name> <url-pattern>/login.html</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>entire application</web-resource-name> <url-pattern>*.html</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> ...

javascript - JQuery Adding a class from a random number -

im trying add class specific id tag in code. class kb1, kb2, kb3, or kb4. want javascript pick random number between 1 , 4 apply class have randomly add class. all of done in loop add , remove classes every 30 seconds. edit: apologies, trying explain problem , didnt add question. reason when runs nothing happens. no classes added. can add classes based on random numbers, , if why isnt im trying working properly? $(document).ready(function() { function kbadd() { number = 1 + math.floor(math.random() * 4); $("#kb1").addclass("kb"+number); $("#kb2").addclass("kb"+number); $("#kb3").addclass("kb"+number); $("#kb4").addclass("kb"+number); timeoutid = window.settimeout(kbremove(number), 30000); } function kbremove(number) { $("#kb1").removeclass("kb"+number); $("#kb2").removeclass("kb"+number); $("#kb3").removeclass("kb...

ruby on rails - select2 AJAX'd to a model, configuration -

so, discovered select2 . awesome. i'm trying figure out how use it, server side ajax / json. of examples see, everywhere, show using select2 jsonp retrieve data external source. feel should easier if calling local model, no? i'll right nitty gritty. json returns value, searchbox doesn't autocomplete, stays blank. view html: <%= form_tag request_pal_path, remote: true %> <%= hidden_field_tag :email, nil, class: 'ui-corner-all' %> <%= submit_tag "send request", class: 'button' %> <% end %> and calling js on it: $(document).ready(function() { $("#find_user #email").select2({ width: '400px', placeholder: "find user...", minimuminputlength: 1, multiple: false, id: function(obj) { return obj.id; // use slug field id }, ajax: { // instead of writing function execute request use select2's convenient helper url: "/users", d...

Add Markers to Google Maps based upon type of business -

using google maps api v3 wandering simplest method add markers map based upon type of business. e.g. display markers of coffee shops, or dentists etc etc... i understand achieved manipulating mapoptions yet figure out. thanks in advance, dan i answer guess because posted question here building web application , have map , want retrieve particular type of business , display result on map. you can result based on types of business. this official guide places: to see type of "places" api support click here .

jquery - Backbone model is destroyed even on service error -

i'm trying destroy backbone model , gets destroyed on service error. view : this.listento(this.collection, 'remove', function() {}); this.model.destroy({ success : function(model) { /* remove li view */ }, error : function() {} }); in above case model removed collection whether success/error. suppose if destroy callback fails model should not removed collection. how can achieved? pass {wait: true} if you'd wait server respond before removing model collection: view : this.listento(this.collection, 'remove', function() {}); this.model.destroy({ success : function(model) { /* remove li view */ }, error : function() {}, wait:true });

android - Schedule several automatic tasks using AlarmManager and Calendar -

i have piece of code... desc.setonclicklistener(new onclicklistener(){ public void onclick(view arg0){ alert.settitle("download"); alert.seticon(r.drawable.go_down_3_32x32); alert.setmessage("¿donwload?"); alert.setpositivebutton("yes", new dialoginterface.onclicklistener(){ public void onclick(dialoginterface dialog, int id){ asyncform2 af2 = new asyncform2(); af2.execute(idu, mdbh); } }); alert.setnegativebutton("no", new dialoginterface.onclicklistener(){ public void onclick(dialoginterface dialog, int id){ dialog.cancel(); } }); alertdialog alert0 = alert.create(); alert0.show(); } }); where desc variable of type imageview, alert variable of type alertdialog.builder, idu integer , mdbh instance of databasehelper (my class handle sqlite database). have background...

math - Determine image offset -

Image
i've got large circle image fill pattern. circle rotated. when click inside circle wish create smaller circle contains same image , same offset. should if smaller circle transparent. so question follows: how determine offset background image of smaller circle rotation of bigger circle? here's example of incorrect offset: i’m guessing source image smaller circle same big circle--just unrotated. if that’s case, need find un-rotated mouseclick position. then can clip smaller circle around unrotated mouseclick , rotate place. given: your original center of rotation cx/cy, your angle of rotation radangle (in radians) your rotated mousclick point rx/ry. you can calculate un-rotated mouseclick position ( prerx / prery ) this: // bigger circle's rotation point var cx=150; var cy=150; // rotation angle in radians var radangle=math.pi/6; // 30 degrees, example // rotated mouseclick point var rx=225; var ry=245; // radius of smaller circle...

how do facebook android sample apps work without debug hash? -

when create facebook app authenticate android devices, have put in debug hash testing hash production keystore. facebook samples apps on other hand intended work out of box, implies there universal android debug hash exists, or there exemption these apps (based on package name?) on facebook insight appreciated, mingli? there no universal debug hash android. i have not tried sample facebook apps, facebook makes exemption them on server side of things kind of identifier (package name or kind of authentication done via code).

c++ - Is it acceptable and safe to pthread_join myself? -

i've got setup bit this: void* work(void*) { while (true) {/*do work*/} return 0;} class workdoer { private: pthread_t id; public: workdoer() { pthread_create(&id, null, work, (void*)this); } void shutdown() { pthread_join(id, null); /*other cleanup*/ } } there's cases shutdown() called main thread, , other cases want call shutdown within thread (returning thread right after). the documentation pthread_join() says return edeadlk if calling thread same 1 passed. my question is: okay thing do, , if safe? (thus ignoring join fail, because i'll nicely ending thread in moment anyways?) or, should avoided? you can call pthread_join() running thread itself, , have found out call handle giving error code. however, there few problems: it doesn't make sense because join won't join anything. merely tell you doing wrong. the thread won't exit upon calling pthread_join() on itself. even if thread exists, state won't cleaned...

javascript - Breeze/Knockout dropdown causing entity to be modified -

this bit of odd issue came across today. have application using breeze , knockout. on 1 of pages allow user edit , save project data. save button enabled if change has been made. track changes subscribe propertychanged event. page has quite few dropdowns causing problems. here example of 1 of dropdowns. <div> <label for="projqamanager">qa manager</label> <select id="projqamanager" data-bind="options: qamanagers, optionstext: 'fullname', optionsvalue: 'username', optionscaption: 'none', value: project().qamanager"></select> </div> the issue occurs when project().qamanager "". propertychanged event gets fired project loaded , shows qamanager field being changed "" null. causing entity believe has be...

iphone - Unable to programmatically set UIButton action -

i'm having bit of trouble action on uibuttons. i'm creating 4 buttons programmatically i'm not able touchupinside event fire. i've had read through i'm still having trouble pointers appreciated! here's code create , set button , it's action: uibutton *btn; float newwidth = 10; (int = 0; < _btnimages.count; ++i) { btn = [uibutton buttonwithtype:uibuttontyperoundedrect]; cgrect imageframe = cgrectmake(/*x*/newwidth, /*y*/height - 80, 65, 65); btn.frame = imageframe; btn.tag = i; [btn setbackgroundimage:[uiimage imagenamed:[_btnimages objectatindex:i]] forstate:uicontrolstatenormal]; [btn addtarget:self action:@selector(btnselected:) forcontrolevents:uicontroleventtouchupinside]; [btn setenabled:true]; [self addsubview:btn]; newwidth = newwidth + 75; } and here btnselected method: -(void)btnselected:(uibutton *)button { nslog(@"button %ld clicked",(long int)[button ta...

java - Reverse method for Array<String> -

this question has answer here: reverse array order 8 answers i trying write method return playing cards ( array<string> ) in reverse order. each card represented combination of : card values (a, 1-9, t, j,q,k) , suits (h=hearts, d=diamonds, c=clubs, s=spades) 10 represented t not 10 2 characters. how write reverse method array<string> in java? public array<string> reversedeck(array<string> deckofcards) { } try this: public arraylist<string> reversedeck(arraylist<string> deckofcards) { arraylist<string> reverseddeck = new arraylist<string>(deckofcards.size()); for(int i=deckofcards.size()-1;i>=0;i--) reverseddeck.add(deckofcards.get(i)); return reverseddeck; }

asp.net - jQuery stop tooltip plugin displaying html -

i tooltip stop displaying rendered html , mark instead. noticed displaying data in i.e. repeater following works fine. using jquery tooltip plugin 1.3. server.htmlencode(eval("activitydescription") string) and thought same title attribute <td class="activitydescriptiontooltip" title="<%# server.htmlencode(eval("activitydescription") string) %>"> <%# utilities.truncateatword(server.htmlencode(eval("activitydescription") string),30) %> </td> tooltip called via plugin $j('.activitydescriptiontooltip').tooltip(); so if acticvitydescription "<h2>test</h2>" i want see "<h2>test</h2>" in tooltip. title attribute renders as title="&amp;lt;h2&amp;gt;test&amp;lt;/h2&amp;gt;" but in tooltip renders "test" h2 formatting. is possible ? yes, not possible, should work same in "repeater". the...

c# - Page.LoadControl throwing "Access Denied" for new controls -

i in deep trouble. previously developing website on windows7 using vs2012. installed win8 , migrated projects win8 , setup vs2012 , continued development. working fine. have loads of ascx controls load in website dynamically using page.loadcontrol method. existing controls loading perfect. when creating new controls, not loading. method fails , throws "access denied" bit puzzled. wrong new files dont have permissions? can body guide me how solve permission issue? update : wonder file.exists(path) unable find file. printed path , when access path, can see file. thanks

html - Container height issue using flexslider 2 only on IOS device -

Image
i have flexslider slideshow image , spot featured text. on full site starts image left , featured text area right (floated). both of these items in containing div black background. when screen shrunk down have through media queries made image go on top , featured text area go below , both 100%. relative content below changes position based on amount of text in featured text area. first example - tallest slide the image below example of rotator text. can see image takes top part , green takes bottom. don't see background of container div because contents fill whole container. second example - shorter slide this example shows happening on iphone. other slides somehow still affecting height of container. matter of fact links still clickable in gray area though nothing visible. what causing issue? happens on iphone not in browser. on browser container resizes , content shifts based on height of green area, on ios takes height of largest slide in rotator thou...

iPad portrait / langscape - no iPad recognition with JavaScript -

i want able set different viewport meta tags, depending on whether device ipad or not, , if it's ipad, whether it's being used in portrait or landscape view. it should doable javascript, apple's ipad user agent string, described in article david walsh . something this: if isipad , max-width=768px -> use viewport meta portrait else if isipad , max-width=1024px -> use viewport meta landscape else (not ipad) -> use default viewport meta non-ipad devices; (some kind of event listener) if ipad's max-width changes 768 1024, or 1024 768 - use corresponding viewport meta. could skillful translate actual javascript? thank in advance help! var isipad = navigator.useragent.match(/ipad/) != null; if (isipad) { var meta = document.createelement("meta"); meta.setattribute("viewport", "whatever"); var head = document.getelementsbytagname("head")[0]; head.appendchild(meta); } else { // etc.. };...

angularjs - Angular RouteProvider - resolve not passing object to controller -

take @ following plunker: http://plnkr.co/edit/uebednifubreenxzhb6h?p=preview the expected behaviour routeprovider resolve (to understanding) resolved object injected controller. angularjs throws "unknown provider" error. i have seen suggestions inject original service, result in deferred object, renders routeprovider resolve rather useless. you should specify controller root provider - not in template (or controller used regardless of path, may result in dependencies not resolving): $routeprovider.when('/',{controller:'testctrl', ... i've updated plunker: http://plnkr.co/edit/msb58e8cgdnyu27xsizk?p=preview

javascript - jQuery carousel bug in IE9, but not all instances of IE9 -

disclaimer: inherited project developer. swear god! i'm experiencing bug on homepage in ie9 not versions of ie9. should happening once page has loaded, main hero area should cycle through listed events. however, ie9 not this. can't reproduce error. have ordinary install of ie9 in win7. client can, however, in appears similar environment. i've managed reproduce in browserstack version of ie9 effect strange, if click anywhere in browser, on page, on scrollbars, carousel comes life , animates should. i @ total loss explain/fix this. here's page: http://staging.tdgardenhost.com/ any ideas might going on here?

java ee - Stateful session bean doesnt work in production - NoSuchObjectLocalException -

i have problem deployed java web application containing 1 stateful session bean. works fine until try invoke bean. exception: javax.ejb.nosuchobjectlocalexception: ejb not exist. session-key: 1f0090bf8a25c4d1-6500a82656529888-2 i tried google , have found exception means stateful session bean corresponding session-key not exist or reason destroyed. on localhost works fine. according article on web there might database error causing session bean destroyed. have found nothing in mysql error log. other stateless session beans work fine , operates on database without problems. i stucked here , dont know try. have ideas can wrong? there anythig have setup in jdbc connection pool or resource manage session beans work? update: believe these error messages log explain error in way: [#|2013-05-09t18:32:31.386+0000|info|glassfish3.1.2|org.shoal.ha.cache.command.load_request|_threadid=27;_threadname=thread-2;|skipped loading of 1f0090bf8a25c4d1-6500a8265c5d6306-c since there 1 ins...

swing - I need to set a background image for a java DesktopApplication -

i didn't know how, , there no background image property. researched answer find set labels icon inside panel null layout. worked , image there, covering single text field. can change z value of label? not see 'move back' option, if there one. this should solve problem: import java.awt.dimension; import java.awt.graphics; import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception; import javax.imageio.imageio; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.swingutilities; public class testimage { public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { contentpane panel = new contentpane(); jframe frame = new jframe(); frame.setdefaultcloseoperation(jframe.dispose_on_close); frame.add(panel); frame.pack(); frame.set...

c# - using UnitOfWork and Repository Pattern with Entity Framework -

i'm gonna use repository , unitofwork in data access layer take @ 1 contact aggregateroot public interface iaggregateroot { } this generic repository interface : public interface irepository<t> { ienumerable<t> getall(); t findby(params object[] keyvalues); void add(t entity); void update(t entity); void delete(t entity); } and poco contact class in model public class contact :iaggregateroot { public guid id { get; set; } public string name { get; set; } public string email { get; set; } public string title { get; set; } public string body { get; set; } public datetime creationtime { get; set; } } and icontactrepository inherit irepository , maybe has own method public interface icontactrepository : irepository<contact> { } now have done in iuitofwork , ...

r - Repeating sequential functions when creating multiple lists/matrices/dataframes within `lapply` -

this question elaboration on previous question i'd asked repeating functions on sequentially-labeled dataframes . in past, needed make minor alterations data.tables read in folder r (e.g. changing dates, recoding). now, however, goals bit more complex: i'd read in several text files folder, take random sample character vectos, read random sample corpus (using package tm ) , generate new data.frame has list of words/phrases , frequencies. the code i've developed far follows: bigramtokenizer <- function(x) ngramtokenizer(x, weka_control(min = 1, max = 5)) # finds words or phrases files <- list.files("~/path/", full.names = true, pattern="\\.txt$") # reads in files out <- lapply(1:length(files), function(x) { df <- scan(files[x], what="", sep="\n") # read in files df<-sample(c(df),size=1500,replace=f) # take random sample corpus <- corpus(vectorsource(df)) # create corpus corpus <- tm_map(corpu...

google app engine - Appengine with Go: Is there a http.Handle prehook or something similar? -

suppose have following init function routing requests. func init() { http.handlefunc("/user", handler1) http.handlefunc("/user/profile", handler2) http.handlefunc("/user/post", handler3) .... .... } all of these require have user's profile. i know can func handler1(w http.responsewriter, r *http.request) { getuserdata() //actual handler code ... ... } but, there way can data without putting function call in every handler? go want in first place? you have 2 options. you can inplement http.handler interface you wrap http.handlerfunc wrapper handlefunc. since looks want simple i'll illustrate wrapper func prehook(f http.handlerfunc) http.handlerfunc { return func(w http.responsewriter, r *http.request) { getuserdata() f(w, r) } } func init() { // use getuserdata() call before handler http.handlefunc("/user", prehook(handler1)) // don't use ...

mysql - CFOUTPUT with query from two tables -

here code working - <cfoutput> <cfquery name="getparser" datasource="librarydb" dbtype="odbc"> select name parser_acronym init = '#source#' </cfquery> <cfquery name="getuacode" datasource="librarydb" dbtype="odbc"> select name useragent logs.csuseragent contains '#%useragent.string%#' </cfquery> </cfquery> <cfset src = "#getparser.name#"> <cfset ua = "#getuacode.name#"> <cfif (dailycount mod 2) eq 0> <cfset via = '<td style="background-color: dbefb6;">#src#<br><font color="blue">#ua#</font></td>'> <cfelse> <cfset via = '<td>#src#<br><font color="blue">#ua#</font></td>'> </cfif> </cfoutput> i pulling data table using getparser query. displaying #src# - works correctly. now, need add more ...

web applications - Python - How is it used? -

this may seem stupid question, how python used? i'm new language , i'm wanting learn how use in building web applications, none of tutorials i've seen have demo of code in action. so, once you've done work in python, how go using in website? majority of experience in front end development i'm little confused how use in website. guess main question be. lets have simple app outputs "hello, world". run in application netbeans, how view in website? since there no index.html gets created it, i'm confused how use in actual website. thanks info. here rather elegant "hello world" in web.py : import web urls = ( '/', 'index' ) class index: def get(self): return "hello, world!" if __name__ == "__main__": app = web.application(urls, globals()) app.run() this script (with web.py) running web server. run call python interpreter so: python hello.py then access web brow...

Memory leak with Interaction Triggers in MVVM Light Toolkit Silverlight -

visual studio 2012 project memory leak hello! i've found memory leak when using interaction triggers in mvvm light toolkit. use xaml <usercontrol x:class="memoryleaktest.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ignore="http://www.ignore.com" mc:ignorable="d ignore" xmlns:i="clr-namespace:system.windows.interactivity;assembly=system.windows.interactivity" xmlns:mvvm="clr-namespace:galasoft.mvvmlight.command;assembly=galasoft.mvvmlight.extras.sl5" x:name="control" datacontext="{binding main, source={staticresource locator}}"> <grid x:name=...

java - WatchService is unreliable on Linux -

i've been trying simple application of watchservice in java 7. watches directory new files. it's running on linux centos 6. can copy file watched directory , file create event. good. i based upon oracle sample. the problem key goes invalid inexplicably. javadoc says there several cases can cause this, such cancelling key. i'm not doing cancelling it. goes invalid while program running no file creation happening. sitting there , goes invalid in minutes or longer. 1 time ran 4 days before mysteriously went invalid. the possible explanation javadoc watched directory deleted or no longer available. i'm not deleting it. leaves availability. now wonder if linux implementation watchservice using tells directory unavailable because of system load or else. can't imagine this. system isn't loaded. filesystem containing directory local system. directory not used else. what other possibilities?

c# - Error - No value given for one or more required parameters -

i have problem working on project. i'm trying read data excel file. works fine when i'm trying select rows greater col1value after add and gender = " + gender; gives me error "no value given 1 or more required parameters" cannot set specific gender column because different on every excel file although column name same , error appears when i'm trying fill dataset. if (boxgender.text != "") string gender = boxgender.text; string col1name = lbl1stcolumn.text; string query = "select * [data$] " + col1name + " > " + col1value + " , gender = " + gender; oledbdataadapter dacol1 = new oledbdataadapter(query, con); column1data.clear(); dacol1.fill(column1data) lblstucount1col.text = column1data.tables[0].rows.count.tostring(); i think might missing q...

Different color for different parts of MATLAB title -

i have, think might 'simple' problem. know how change color of matlab title. not know, how use 2 different colors, @ 2 different parts of title. for example, lets title of figure said "hello world". then, want "hello" in black, while "world" in blue. how this? thank you. you can use tex markup that. here's example: title(['hello {\color{blue}world}']);

android - Set my home screen as default programmatically -

assume have multiple home screen installed in android device. when booting or pressing home key, dialog shown user select desired home screen , check box set action default. i know code "default" home screen set when select "set action default" checkbox , launch application. i need programatically control home screen in 2 different modes. regards, praga short answer can't security purposes. (i.e. if can programmatically set myself default home screen, can theoretically "lock" user out of own device) if want implement going have build own version of os , install on own devices , can getting working within os, not people have stock os builds.

how to invoke cygwin thorugh java shell? -

i have code meant linux execute .sh files on unix shell. i wanted run same code windows. told should install cygwin windows. did how redirect commands cygwin shell? here part of code: public void compile() { try { bufferedwriter out = new bufferedwriter(new outputstreamwriter(new fileoutputstream(dir + "/" + file))); out.write(contents); out.close(); // create compiler script out = new bufferedwriter(new outputstreamwriter(new fileoutputstream(dir + "\\compile.sh"))); out.write("cd \"" + dir +"\"\n"); out.write("gcc -lm " + file + " 2> err.txt"); runtime r = runtime.getruntime(); process p = r.exec( dir + "\\compile.sh"); p.waitfor(); p = r.exec(dir + "\\compile.sh"); // execute compiler script timedshell shell = new timedshell(this, p, timeout); shell.start(); p.waitf...

ios - Social Share Cordova Plugin -

i working social share plugin ( https://github.com/bfcam/phonegap-ios-social-plugin ) , imagefilter plugin ( https://github.com/drewdahlman/imagefilter ). have both set , functioning. wanting have picture select photo library or take camera 1 shared instead of predefined image. <!doctype html> <html> <head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css"> <!-- core --> <script src='js/core/cordova-1.6.0.js'></script> <script src='js/core/jquery.js'></script> <!-- plugins --> <script src='js/plugins/imagefilter.js'></script> <script src='js/core/social.js'></script> <!-- our scripts --> <script src='js/init.js'><...