Posts

Showing posts from July, 2015

silverlight - IApplicationService in WPF -

i'm new wpf , i'm migrating project silverlight wpf 4.0 , problem can't find equivalence iapplicationservice , iapplicationlifetimeaware . the library , namespace system.windows loaded, yet have error message; "the type or namespace name 'iapplicationlifetimeaware' not found'. any idea missing please. thanks finally found there's no direct migration , need recoded. if implementing iapplicationservice , iapplicationlifetimeaware access statservice() , can make method public, without argument.. public void startservice() { . . } and call method during instanciation in app.xaml.cs public app() { this.startup += this.application_startup; this.exit += this.application_exit; initializecomponent(); offlinedatabaseservice x = new offlinedatabaseservice(); x.startservice(); }

c# - Minimizing WCF service client memory usage -

i'm implementing wcf service client aimed test several service methods. that's done using standard generated proxy class created add web reference (inherited system.web.services.protocols.soaphttpclientprotocol ). need execute type of requests many times simultaneously see how affect server performance (something capacity testing server infrastructure). here's problem - each of responses these requests pretty large (~10-100 mb) , see few calls like // parameterslist.count = 5 foreach(var param in parameterslist) { var serviceresponse = servicewebreferenceproxy.executemethod(param); // serviceresponse not saved anywhere else, // expected gc'd after iteration } causes private bytes of process jump ~500 mb of memory , working set 200-300 mb. suspect running them in parallel , increasing iterations count 100-200 needed cause stackoverflow/outofmemoryexception. how can done then? i'm expecting removal of assigning service method response variable help...

ios - Implement the Flash button animation as in iPhone camera in my app? -

im developing camera app, want implement same animation happens in default iphone camera app when click on flash button, i.e once click on falsh button, can see other 2 buttons animating, , once u click 1 button again animates , hides. how can this? thanks in advance.. take @ ddexpandablebutton able , includes example code creating flash button. https://github.com/ddebin/ddexpandablebutton

python - Failed to draw a row of rectangles (pygame) -

Image
i'm trying draw simple row of rectangles, somewhow when execute code doesn't draw screen. can't figure out why. overlooking obvious, need point me it. my code: import pygame # define colors black = ( 0, 0, 0) white = ( 255, 255, 255) green = ( 0, 255, 0) red = ( 255, 0, 0) pygame.init() # set width , height of screen [width,height] size = [255,255] screen = pygame.display.set_mode(size) pygame.display.set_caption("my game") width = 20 height = 20 margin = 5 x = 0 #loop until user clicks close button. done = false # used manage how fast screen updates clock = pygame.time.clock() # -------- main program loop ----------- while done == false: # event processing should go below comment event in pygame.event.get(): # user did if event.type == pygame.quit: # if user clicked close done = true # flag done exit loop # event processing should go above comment # game logic should go below comment...

bash - sed replace in conf 2 different patterns -

i want replace 2 entrys in conf file sed # set server /bin/sed -i 's/server: 127.0.0.1/server: xxx.xxx.xxx.xxx/' /etc/cobbler/settings # set next server /bin/sed -i 's/next_server: 127.0.0.1/next_server: 192.168.122.1/' /etc/cobbler/settings for reason changes the primary entry on both, why ? use 2 different patterns check "server" & "next_server" also know how change quoted string pattern #change default password /bin/sed -i 's/default_password_crypted: "$1$mf86/uhc$wvcicx2t6crbz2onwxyac."/default_password_crypted: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/' /etc/cobbler/settings thx just add ^ beginning of regexp require line starting string. # set server /bin/sed -i 's/^server: 127.0.0.1/server: xxx.xxx.xxx.xxx/' /etc/cobbler/settings # set next server /bin/sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.122.1/' /etc/cobbler/settings

c# - SqlDataAdapter as Object value? -

hello guys have got sqldataadapter finds highest value: datatable dt = new datatable(); sqldataadapter sda = new sqldataadapter("select max (id_k) klient", spojeni); sda.fill(dt); spojeni.close(); if selects need result add +1 , insert object value parameter. prikaz2.parameters.addwithvalue("@val4", ); // here should sda +1 i tried insert object value whole sqldataadapter nonsense. there way achieve that? thanks in advance you can use sqlcommand.executescalar() method getting value because; executes query, , returns first column of first row in result set returned query. since command returns maximum value of id_k column, want. sqlcommand command = new sqlcommand("select max (id_k) klient"); sqldataadapter sda = new sqldataadapter(command, spojeni); int max = (int)command.executescalar(); prikaz2.parameters.addwithvalue("@val4", max + 1);

iphone - Recognise a phrase from voice input only if the intensity hits certain decibel [iOS] -

i've had browse around topics in group trying see if question has been addressed before, couldn't find exact thing. so, apologies if old hat. please excuse newbie nature of question. how can have ios app recognise phrase voice input if intensity hits decibel? ex:when user says "hello there", should capture voice , check phrase make sure whether user said hello there or else. perhaps, openears might solve me. how can measure intensity of voice? voice input must considered if phrase "hello there" spoken @ 110db. if not, should ignore. can done openears? please guide me suggestions openears developer here. openears' pocketsphinxcontroller class (the class speech recognition) has property pocketsphinxinputlevel can read on secondary thread find out input power. there's info in docs , copy-paste-able example of usage in openears sample app should started. decibel levels use same convention audioqueue decibel readings give decibels negative...

linux - which signal should I use to come out of accept() API? -

i have 2 threads 1 blocked new connection in accept(), , 1 talks other processes. when application going shutdown, needs wake first thread accept(). have tried read man page of accept() did not find thing use full. question signal should send second thread first thread come out of accept , won't killed?? thanks. you can use select timeout, example thread executing accept wakes every 1 or 2 seconds if nothing occurs , checks shutdown. can check this page have idea.

jquery - javascript prototype constructor and instanceof -

when checked instanceof method, results not same . function a(){} function b(){}; first assigned prototype ( reference ) property , a a.prototype = b.prototype; var cara = new a(); console.log( b.prototype.constructor ); console.log( a.prototype.constructor == b ); console.log( b.prototype.constructor == b ); console.log( cara instanceof ); console.log( cara instanceof b ); the last 4 condition on above returns true . but when tried assign constructor of b .. results not same . a.prototype.constructor = b.prototype.constructor; var cara = new a(); console.log( b.prototype.constructor ); console.log( a.prototype.constructor == b ); console.log( b.prototype.constructor == b ); console.log( cara instanceof ); console.log( cara instanceof b ); on case cara instanceof b returns false . why returns false i found answer link .. https://stackoverflow.com/a/12874372/1722625 instanceof checking internal [[prototype]] of left-hand object . same below ...

tree - Non recursive Depth first search algorithm -

i looking non recursive depth first search algorithm non binary tree. appreciated. dfs: list nodes_to_visit = {root}; while( nodes_to_visit isn't empty ) { currentnode = nodes_to_visit.take_first(); nodes_to_visit.prepend( currentnode.children ); //do } bfs: list nodes_to_visit = {root}; while( nodes_to_visit isn't empty ) { currentnode = nodes_to_visit.take_first(); nodes_to_visit.append( currentnode.children ); //do } the symmetry of 2 quite cool. update: pointed out, take_first() removes , returns first element in list.

html - align nav to bottom of header -

my header holds logo image nav element. nav sit @ bottom of header, without using absolute positioning or specific top/left pixels because responsive. here code far http://jsfiddle.net/aiedail/86zgd/ i had tried adding nav{margin-top: 50%;} but used full page height rather containing div height. any suggestions or appreciated. i think best way solve this, set parent container to position: relative; and in nav, use position: absolute; bottom: 0; right: 0; this way, nav in rightbottom corner of header, header still relative, don't lose responsiveness. jsfiddle here

php - Calculate new subscription cost on upgrade / downgrade -

Image
i developing subscription system web application. need regarding approach new subscription costs when user decides downgrade or upgrade account. i created image make example of user keeps changing levels. a user can choose pay each month, quarter or year. i want add discount when user decides downgrade. discount factored new cost using formula: [final plan cost] = [new plan cost] * 12 - [discount] / [12 - month / 3 - quarter / 1 - year] if have user keeps changing plans this, how can calculate discount dynamically? it's easy 1 change - can take difference between 2 plans , multiply each payment made before. need regarding approach several changes, , how can keep track of discount. i think should put information in database table , call cells. if user @ plan getting discount based on sub; eg if(price this) discount {discount value database} x price of subscription.. not have worry if changes subscription in middle of month, have put information in differen...

java - all my methods on button click wait for the thread to complete before actioning -

i new java , trying build port scanner university course. have got majority of work although having problem ui. have set button text change "start scan" "stop scan" depending on set of variables. when "start scan" button pressed starts thread hosts scanner, however, button text not change, "stop scan" until after thread has finished. lost on how fix this. appreciated. this swing class package com.ui; import java.awt.color; import java.awt.font; import java.awt.event.itemevent; import java.awt.event.itemlistener; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.text.numberformat; import javax.annotation.postconstruct; import javax.swing.*; import javax.xml.bind.parseconversionevent; import com.scanner.portscanner; /** * code edited or generated using cloudgarden's jigloo * swt/swing gui builder, free non-commercial * use. if jigloo being used commercially (ie, corporation, * company or business purp...

KineticJS - replacing image within a group -

please see link when canvas loads there 2 images: yoda , darth vader. i want able click on yoda (to select it) , click on "change" button under canvas. button click should replace yoda darth vader , still keep "2nd" darth vader selected. my code follows: function replaceimage(i, callback) { selectedgroup.destroy(); var images = {}; images[i] = new image(); images[i].onload = function() { callback(i,images); }; images[i].src = sources[i].path; } i tried selectedgroup.removechildren() , adding image manually doesn't work either - ie function replaceimage(i) { selectedgroup.removechildren(); var image = new image(); var newimage = new kinetic.image({ id: i, image: image, x: 0, y: 0, width: sources[i].width, height: sources[i].height, name: 'image', stroke: 'red...

sdl - ncurses with graphics window -

i have bare-bones linux distro running on machine connected laser. want develop interface allows me to: configure settings laser (e.g. toolbars , buttons) display current path of laser (e.g. graphics window) since these bare-bones machines, don't have x11 installed. figured perhaps use ncurses develop cross-platform interface configure settings laser, , use sdl draw arcs , lines represent path of laser. while i'm comfortable using ncurses , sdl independently, i'm having trouble figuring out how embed sdl graphics within ncurses window. is possible embed graphics window (not sdl ) ncurses application? if not, there cross-platform alternative ncurses need without x11? the ncurses project appears focused on developing library construction of text-based user interfaces. such, not believe there is, nor planned be, support embedding sdl graphical context. i suggest looking other options such agar library enables creation of graphical user interf...

osx - Retina Images on a non-retina display -

i'm experiencing strange behaviour on os x application. seems loading retina images on non-retina display. if remove @2x versions, right @1x version loaded. i've got question retina version of image used on non-retina display not related problem. to export images psd use slicy ( http://macrabbit.com/slicy/ ) do have idea of can generate behaviour?!

Get value from input html in codebehind c# -

i did research , found out how can read value input html textbox. this worked fine me, @ once doesn't work. this code, input html returns null <input type="text" name="inpnickname" placeholder="nickname" data-placement="right" data-toggle="tooltip" title="nickname" id="txtnickname" runat="server"/> <input type="text" name="inppassword" placeholder="password" data-placement="right" data-toggle="tooltip" title="password" id="txtpassword" runat="server"/> string nickname = request.form["inpnickname"]; string password = request.form["inppassword"]; if change request.form[] id's, still doesn't work. since running @ server... txtnickname.value , txtpassword.value give need. when specify runat="server" giving property codebehind class. can access prop...

text - bigrams instead of single words in termdocument matrix using R and Rweka -

i've found way use use bigrams instead of single tokens in term-document matrix. solution has been posed on stackoverflow here: findassocs multiple terms in r the idea goes this: library(tm) library(rweka) data(crude) #tokenizer n-grams , passed on term-document matrix constructor bigramtokenizer <- function(x) ngramtokenizer(x, weka_control(min = 2, max = 2)) txttdmbi <- termdocumentmatrix(crude, control = list(tokenize = bigramtokenizer)) however final line gives me error: error in rep(seq_along(x), sapply(tflist, length)) : invalid 'times' argument in addition: warning message: in is.na(x) : is.na() applied non-(list or vector) of type 'null' if remove tokenizer last line creates regular tdm, guess problem somewhere in bigramtokenizer function although same example weka site gives here: http://tm.r-forge.r-project.org/faq.html#bigrams . inspired anthony's comment, found out can specify number of threads parallel library uses...

Facebook like buttonto like a particular wall post (photo, video, link, etc) of my facebook page? -

how can make facebook button on web page particular wall post/object (photo, video, link, etc) on facebook page when people click it? make people facebook page, not particular post/object (photo, video, link, etc) make sense? the middle response of facebook video button help? seems indicate facebook automatically embed button video upload them (rather linking external video). also article seems confirm it: http://yourinternetbusinesslink.com/facebook-like-button-video/

Versioning policy of homebrew formula? -

i provide formula install font, https://github.com/sanemat/homebrew-font/blob/master/ricty.rb , , added version '3.2.1' same font version. but want update formula, additional feature, i'm confused should bump version version '3.2.1.1' ? want detect formula update , version up, actual font version still 3.2.1 !. homebrew doesn't support (yet), other packaging systems might call revision. either create fake version number, propose, isn't recommended public packages. or manually uninstall , reinstall package.

c# - How to grab name of a streamreader -

in c#, how grab name or path of streamreader ie filein = new streamreader(@"c:\ee\fff\desktop\spreadtool\test.csv"); and want regex on path, how reference above. know filestreamer has getname() method streamreader? looked , doesn't seem have one. streamreader not have property contains filepath created. may not created file @ (it can created stream). if want path, should store in string before create streamreader string file = @"c:\ee\ccc\desktop\spreadtool\test.csv" filein = new streamreader(file); string path = path.getdirectory(file);

import - java imported resource names -

i'm new realm of programming has written need, , job bundle under simple class calls other person's functions, , typical uses of import strike me extremely odd. as example, i'm using open-source spell checking jar called jazzy-core.jar. why type import com.swabunga.spell.engine.spelldictionaryhashmap; to use piece of jar? expecting more like import jazzy-core.spelldictionaryhashmap; or just import jazzy-core; why of words (com, swabunga, etc) necessary, mean, , why none of them "jazzy"? because import doesn't mean include jar in application. jar file have different name , therefore specifying jar file's name in import statement wouldn't feasible. instead import allows reference spelldictionaryhashmap without specifying qualified name. can write stuff like spelldictionaryhashmap map = new spelldictionaryhashmap(); instead of com.swabunga.spell.engine.spelldictionaryhashmap map = new com.swabunga.spell.engine.spelldict...

javascript - jQueryMobile alternative to $(document).ready(function() -

i have issue web app creating. have function checks if if user has input data before can use part of web application. i've been binding function page create event. $(document).on('pagecreate', function(){ checkopencalls(); alert('page create event firing'); }); if parameters of function not input user before browsing page checkopencalls function opens dialog making user input data. issue if user accidentally browsed page , hits cancel on dialog. dialog opens again , user stuck in infinite loop. what event load function if page called via ajax doesn't keep firing when dialog closed? i've tried pageinit , pageshow events fire everytime page shown. edit: when browse directly page (open new tab in browser , go directly page) behavior want (the dialog closed , new 1 isn't opened) if go apps homepage , browse functions webpage behavior described in above in main post. you using correct page event problem ...

c# - Most efficent way to work with IEnumerable -

what efficient way traverse collection/ienumeration in c#. have list contains 1100 objects. 10 of objects, inturn contain 1000 subobjects (of same type). traversal list takes 5-6 seconds. here code: foreach (parameter par in this.allparameters) //this.allparameters generic.list type { foreach (parameter subpar in par.wrappedsubparameters) { subpar.isselected = false; } par.isselected = false; } is there way optimize code fast enough, not taking 5-6 seconds? the loops, written, 1 of fastest options. since in memory, , each write operation appears on separate instance (no synchronization), potentially parallelize gains: parallel.foreach(this.allparameters, par => { foreach (parameter subpar in par.wrappedsubparameters) { subpar.isselected = false; } par.isselected = false; }); note i'm parallelizing outer loop (on purpose), should provide enough work items adequately use processing cores. another potential ...

java - HQL query for Distinct records -

pls error time run application ....any pls. java.lang.illegalargumentexception: node traverse cannot null! org.hibernate.hql.internal.ast.util.nodetraverser.traversedepthfirst(nodetraverser.java:63) org.hibernate.hql.internal.ast.querytranslatorimpl.parse(querytranslatorimpl.java:272) org.hibernate.hql.internal.ast.querytranslatorimpl.docompile(querytranslatorimpl.java:180) org.hibernate.hql.internal.ast.querytranslatorimpl.compile(querytranslatorimpl.java:136) org.hibernate.engine.query.spi.hqlqueryplan.<init>(hqlqueryplan.java:101) org.hibernate.engine.query.spi.hqlqueryplan.<init>(hqlqueryplan.java:80) org.hibernate.engine.query.spi.queryplancache.gethqlqueryplan(queryplancache.java:119) org.hibernate.internal.abstractsessionimpl.gethqlqueryplan(abstractsessionimpl.java:214) org.hibernate.internal.abstractsessionimpl.createquery(abstractsessionimpl.java:192) org.hibernate.internal.session...

java - Choosing 15 colors from a 159 color palette to recolor (quantize) an image -

my question is, best way use imagemagick (or java library) recolor image using 15 colors chosen 159 color static palette. use 15 colors create 15_color_palette.png , use remap function of imagemagick convert recolor image. convert input.png +dither -remap 15_color_palette.png output.png i've tried couple of different methods, neither of them work enough (at least think better -- guess it's possible there no better method). example 1: convert input.png +dither -colors 15 work/15_color.png convert work/15_color.png -unique-colors work/15_color_palette.png convert work/15_color_palette.png -remap work/palette.png work/15_color_palette_converted.png convert input.png +dither -remap work/15_color_palette_converted.png work/final.png (this 1 chooses 15 colors colors, remaps palette 15 colors 159 color palette palette , uses 15 colors recolor original image). example 2: convert +dither -remap work/palette.png work/remap.png #use java count top 15 colors used remap,...

java - Refer to an object by using a name in a string android -

i want able use object in java using names stored in variables. example : string[] str={"name1","name2"}; button name1 = (button) findviewbyid(r.id.but1); button name2 = (button) findviewbyid(r.id.but2); //what want : instead of name1.settext("text"); //to use button.str[0].settext("text"); why not use map ? map<string,button> buttons = new hashmap<string,button>(); buttons.put("buttona", new button()); buttons.get("buttona"); // gets button...

android - Turn off default screen touch sound -

i writing simple android application in facing 1 unwanted sound. the problem whenever start application , touch anywhere on screen default system screen touch sound played every time. want stop sound being played while application running. please tell me how can that? this may you're looking for... http://developer.android.com/reference/android/view/view.html#setsoundeffectsenabled(boolean)

Finding max/min values and displaing them in a subform in Microsoft Access -

good morning, i'm building form in microsoft access track components/parts go building new products, , have question pertaining use of min/max values. first, context. simplified*, tables involved are: components : these pieces needed build widgets being sold suppliers : these places can components from. components available @ multiple locations @ different price points. products : various widgets can built. compsuppliers : many-to-many relationship between components , suppliers. includes additional information, such unit price each item each supplier. prodcomponets : many-to-many relationship between products , components. includes few additional details, such how many items required make widget in question. all tables have autonumber id field , relationships defined in database. i make form brings information when viewing given widget there sub-form lists components go said widget, plus best price & supplier each part. on main form can sum of these val...

zend framework2 - How to make ZfcUser use an abstract db_adapter -

i'm using zend framework 2 , i've installed module zfcuser. everything working correctly until i've decided add second db adapter in config/autoload/global.php <?php return array( 'db' => array( 'adapters' => array( 'cleardb' => array( 'driver' => 'pdo', 'dsn' => 'mysql:dbname=secret;host=secret.com', 'driver_options' => array( ... ), ), 'other' => array(...) ) ), 'service_manager' => array( 'abstract_factories' => array( 'zend\db\adapter\adapterabstract' => 'zend\db\adapter\adapterabstractservicefactory', ), ), ); now, zfcuser can't find default db adapter. in zfcuser.global.php i've updated line: 'zend_db_adapter' => 'cleardb' this error when try login: an alias "zfcuser_zen...

java - How to use Postgres inet data type with OpenJPA? -

i need record ip addresses in postgres (9.0) table openjpa (2.2.2). i've got working using native query: entitymanager entitymanager = entitymanagerfactory.createentitymanager(); entitymanager.gettransaction().begin(); int rows = entitymanager.createnativequery("insert click (ip) values (?::inet)") // .setparameter(1, inetaddress.getlocalhost().gethostaddress()) // .executeupdate(); entitymanager.gettransaction().commit(); entitymanager.close(); but i'd prefer figure out way openjpa handle w/o native query. i searched , found other suggestions annotating column this: @column(length = -1, columndefinition = "inet") but doesn't seem cast. exception: error: column "ip" of type inet expression of type character varying hint: need rewrite or cast expression. position: 32 {prepstmnt 1376458920 insert click (ip) values (?) [params=?]} [code=0, state=42804] can annotate field w/ @strategy , implement custom fieldstrategy or ...

regex - PHP basic regular expression -

this question has answer here: how parse , process html/xml in php? 27 answers for example i've kind of content <div id="t1" class="tt" tag='t2"><div class="t3">tee</div><a href='#'>test</a><span>test</span><div>asdf</div></div> <div id="t1" class="tt" tag='t2"><div class="t3">tee</div><a href='#'>test</a><span>test</span><div>asdf</div></div> i trying use preg_match content between parent div, here parent divs means <div id="t1" . use preg_match or there other way data between divs? a regular expression wrong tool job. want dom parser. $dom = new domdocument; $dom->loadhtml($html); $t1 = $dom->getelementbyid('t1...

sql - Count number of records with same column -

having employees table following columns eid ename salary did 100 king 5000 db 101 kochaar 7000 db 102 jack 6000 java 103 john 3000 java 104 marry 6000 db the o/p iz in form did count(eid) db 3 java 2 db 3 java 2 db 3 i tried using union all, i'm not sure, how achieve tiz o/p. select did , count(*) on (partition did) yourtable

SAS Proc SQL Count Issue -

i have 1 column of data , column named (daily_mileage). have 15 different types of daily mileages , 250 rows. want separate count each of 15 daily mileages. using proc sql in sas , not cross join command. not sure should started: proc sql; select a, b (select count(daily_mileage) work.full daily_mileage = 'farm utility vehicle (class 7)') cross join (select count(daily_mileage) b work.full daily_mileage = 'farm truck light (class 35)') b); quit; use case statements define counts below. proc sql; create table submit select sum(case when daily_mileage = 'farm utility vehicle (class 7)' 1 else 0 end) a, sum(case when daily_mileage = 'farm truck light (class 35)' 1 else 0 end) b work.full ; quit ;

Parsing html data into python list for manipulation -

i trying read in html websites , extract data. example, read in eps (earnings per share) past 5 years of companies. basically, can read in , can use either beautifulsoup or html2text create huge text block. want search file -- have been using re.search -- can't seem work properly. here line trying access: eps (basic)\n13.4620.6226.6930.1732.81\n\n so create list called eps = [13.46, 20.62, 26.69, 30.17, 32.81]. thanks help. from stripogram import html2text urllib import urlopen import re beautifulsoup import beautifulsoup ticker_symbol = 'goog' url = 'http://www.marketwatch.com/investing/stock/' full_url = url + ticker_symbol + '/financials' #build url text_soup = beautifulsoup(urlopen(full_url).read()) #read in text_parts = text_soup.findall(text=true) text = ''.join(text_parts) eps = re.search("eps\s+(\d+)", text) if eps not none: print eps.group(1) it's not practice use regex parsing html. use bea...

Backbone.js validation broken (0.9.9 vs. 0.9.10) -

backbone changed few things validation between these versions, first off, have explicitly pass {validation: true} set call validation trigger. there must have been change too, because doesn't work no longer. model.set(obj, { error : function(model, error){ //do stuff error } }) i found ticket on backbone's github, answers issue if using save, not set. https://github.com/jashkenas/backbone/issues/2153 here's solution i've discovered. 1) assign set variable called success (or whatever like) var success = model.set(obj, {validate : true}); 2) check status of success, , use model.validationerror if(!success){ var error = model.validationerror; // stuff error }

javascript - How make a change focus menu in css/html/jquery -

my problem simple: want make menu http://edition.cnn.com/ when click in 1 of buttons in menu, want focus , rest of them lose it. problem seems easy, tried different ways , none of them work. can me? how can make this? the other ways: putting focus in html.actionlink menu i want when click in button, when page refresh focus , others keep normal or, if button selected, turn normal. thanks sugestions. fiddle demo hope helps you!!! $(function(){ var jqmenu = $("#barre_menu").menu(); $("#focus1").click(function(){ try{ jqmenu.menu( "focus", null, jqmenu.find("#azer")); } catch(exc){ alert("exception caught : "+exc); } }); $("#focus2").click(function(){ try{ jqmenu.menu( "focus", null, jqmenu.find("#qsdf")); } catch(exc){ alert("exception caught : "+exc); ...

null - header title has a string addition and ignores one of the parametres when i run it remotely -

i have following problem: 1 member of header row addition of strings this: "amount (" + contexthelper.getlocalcurrency().tostring + ")" in order show, in case of local currency: amount (us) it works fine when run locally, whether if in pc hitting localhost or if run locally vm throug remote desktop connection, hitting localhost. when try hitting service running in vm pc (as client will), member of header row shows "amount ()" meaning contexthelper.getlocalcurrency().tostring returning null. ideas? in advance! if comes across problem, symbol $ in string giving vs hard time when trying understand currency y trying show: amount(us$) took away $ works fine. hope gives hand somebody, problem took me 8hs behind scheadule.

PHP to html with twitter api 1.1 -

this simple question have following php file references code twitter follower count. works in html website file want display "follower count" text , in php not sure line add. have script referenced in html , right trying using <span id="followers_count"></span> nothing appears. doing wrong or add php file take follower count , display text in html? thanks! <?php require_once('js/twitter-api-php/twitterapiexchange.php'); /** set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "key here", 'oauth_access_token_secret' => "key here", 'consumer_key' => "key here", 'consumer_secret' => "key here" ); $ta_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=inovize; $requestmethod = 'get'; $twitt...

brightcove - How do I upload a video to a specific playlist? -

this first time working brightcove. have been given access existing account many playlists , videos. i looking @ create_video example. don't see supposed specify playlist video. how upload video specific playlist? if using tag-based "smart playlist", need add appropriate tag video. {"method": "create_video", "params": {"video": {"name": "name","tags": ["playlisttag"],"shortdescription": "...","itemstate": ""},"token": "token","encode_to":"","create_multiple_renditions": ""}} if video added manual playlist, use update_playlist after create_video.

powershell - monitor for creation and then read a file via windows .bat script -

i write batch script poll windows directory time limit , pick file placed in directory. timeout after time if file not placed in directory within time frame. i parse xml file , check status. here's powershell script asked. $content variable store contents of file (it array of lines can throw foreach loop). $file = 'c:\flag.xml' $timeout = new-timespan -minutes 1 $sw = [diagnostics.stopwatch]::startnew() while ($sw.elapsed -lt $timeout) { if (test-path $file) { "$(get-date -f 'hh:mm:ss') found file: $file" $content = gc $file if ($content -contains 'something interesting') { "$(get-date -f 'hh:mm:ss') file has interesting in it!" } break } else { "$(get-date -f 'hh:mm:ss') still no file: $file" } start-sleep -seconds 5 }

c#....my while loop keep repeating -

this question exact duplicate of: c# programming constructs - while loop wont stop working when want to? [closed] i trying while loop keep repeating till subjects have been answered, should stop , display bonus , final score. don't know why not doing that? please. namespace assignment { class class1 { public static int attempt, sum, aptscore, genscore, mathscore, engscore, bonus, totalscore, finalscore, choice = 0; public static string ans; static void main(string[] args) { bool stop = false; console.writeline("welcome salisbury university iq test game"); console.writeline(); console.writeline("how many times have attempted test?"); attempt = convert.toint32(console.readline()); while (true) if (attempt > 1) { console.writeline(...

matlab - How to write a S-function, generating signal of higher than 2 dimensions? -

apparently, unable generate signal of [3x3x3] dimensions: function test_sf_02(block) % level-2 matlab file s-function. setup(block); function setup(block) % register number of ports , parameters block.numinputports = 0; block.numoutputports = 1; block.numdialogprms = 0; % setup functional port properties dynamically inherited block.setprecompoutportinfotodynamic; % register properties of output port block.outputport(1).samplingmode = 'sample'; %block.outputport(1).dimensionsmode = 'variable'; block.outputport(1).dimensionsmode = 'fixed'; block.outputport(1).dimensions = [3 3 3]; % register sample times % [-1, 0] : inherited sample time block.sampletimes = [-1 0]; % register methods called @ run-time block.regblockmethod('outputs', @outputs); function outputs(block) block.outputport(1).data = zeros(3,3,3); error occurs @ block.outputport(1).dimensions assignm...

c# - how to set up production credentials on behalf of third party -

we need in understanding how set production side of integration. suspect may not able set in way had anticipated (although there workaround). way of background: we have written custom application our customer intended allow customer send envelopes directly custom application have written them. where may have problem, anticipated envelopes sent using customer's existing docusign account. we using soap api c# application. our testing credentials set in c# per following pseudo code: ... credentials.accountid = " our account id here "; credentials.username = "[ our integrator key here ]" + "our email address"; credentials.password = " our password "; credentials.apiurl = " demo api url "; ... // elsewhere when define envelope envelope.accountid = " our account id here "; now, in production do: ... credentials.accountid = " our customer's account id here "; credentials.username = "[ our int...

php - getUser returning 0 facebook sdk -

i trying make login facebook on codeigniter app. have login button takes them grant permissions , redirects them page should display facebook information in array, getuser keeps returning 0, after log in. i have no clue start looking errors first dive facebook sdk here code: php facebook connect library: <?php include(apppath.'libraries/facebook/facebook.php'); class fbconnect extends facebook{ public $user = null; public $user_id = null; public $fb = false; public $fbsession = false; public $appkey = 0; public function __construct() { $ci =& get_instance(); $ci->config->load('facebook', true); $config = $ci->config->item('facebook'); parent::__construct($config); $this->user_id = $this->getuser(); $me = null; if ($this->user_id) { try{ $me = $this->api('/me'); $this->user = $me; ...

qt - Where can I compile the opengl source to generate libraries? -

where can find program can executed on visual studio compile opengl sources , generate libraries opengl32.lib, glut32.lib, etc. in fact have problem of version qt. want execute opengl using qt without qt opengl api. here's error message : lnk2026 module unsafe safeseh image opengl32.lib i'm lost. in advance help. opengl specification, not library defined source code. opengl implementations use, , of them propietary. of them open source (such mesa), in general not have public access source code.

php - .htaccess not redirecting successfully for pretty url's -

my .htaccess follows: options +followsymlinks rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ ./backend-scripts/url_parser.php and then, handling url redirect file url_parser.php follows. <?php // open file , contents in string format. $string = file_get_contents("../json/site_map.json"); // decode json string associative array. $jsonarray = json_decode($string, true); // add trailing slash uri if not there. $requesturi = $_server['request_uri']; $requesturi .= $requesturi[ strlen($requesturi) - 1 ] == "/" ? "" : "/"; // split url @ slashes. $uriarray = explode('/', $requesturi); // select last piece of exploded array key. $urikey = $uriarray[count($uriarray)-2]; // lookup key in sitemap // retrieve absolute file url. $abspath = $jsonarray[$urikey]; // reformulate url. $path = "../$abspath"; // include actual page. include($path); ?> ...

c - Is it possible to change the exit code in a function registered with atexit()? -

the man page atexit(3) says following: posix.1-2001 says result of calling exit(3) more once (i.e., calling exit(3) within function registered using atexit() ) undefined. on systems (but not linux), can result in infinite recursion; portable programs should not invoke exit(3) inside function registered using atexit() . however, i'm interested in modifying exit code in finalizer program. way i've managed calling exit() within finalization function, man page explicitly warns against that. is there practical danger against doing this? there implementations approach might cause problems? better, there way of doing this? you can call _exit() instead. within notes section of man page: the function _exit() exit() , not call functions registered atexit() or on_exit() . this should avoid "recursive" issue being warned in posix spec. if somehow able guarantee "exit code changing" exit handler runs last, should work perfectly...

c++ - Reading from a text file and then using the input with in the program -

i want have program read text file 20 single characters, on separate lines. want have characters compared against preprogrammed letters in program output wrong ones , total wrong. have constructed program can manually enter letters , wanted, knowledge of using files within code limited. have read vectors keep simple first , hang of before try learn else. have tried set code resembles think should like. i'm not getting errors now... how text file program? i've constructed code can't figure out last steps connect it. possible steer me in right direction. in advance. of forum learning more ever thought possible. #include <iostream> #include <conio.h> #include <cctype> #include <fstream> #include <string> using namespace std; void input(char[], int); //function prototype void checkanswers(char[], char[], int, int); int main() { const int num_questions = 20; const int min_correct = 15; int correctanswers = 0; //accumulator number of cor...

How to support count argument in a custom VIM text object? -

i have custom text object defined function: onoremap <buffer> <silent> <leader>m :<c-u>call myfunction()<cr> " myfunction() selects text in visual mode simple text operations d<leader>m work well. there way make work count argument (e.g. d5<leader>m )? expected result calling myfunction() 5 times, , deleting selected text. after referring these instructions came below snippet should problem: function! hello() normal ihello, world^m^[ endfunction map <f7> @=':call hello()<c-v><cr>'<cr> pressing f7 insert "hello, world\n" @ cursor location. 2f7 insert "hello, world\nhello,world\n" , on.

c++ - How to load texture from file with transparent background in DirectX -

recently i've picked book , started learn game programming direct3d , directx. it's been pretty far, problem can't load texture file backbuffer transparent background color. here source code initialize direct3d bool init_direct3d(hwnd hwnd,int width,int height,bool fullscreen) { // initialize direct3d object d3d = direct3dcreate9(d3d_sdk_version); if(d3d==null) { messagebox(null,text("fail initialize direct3d object"),text("error"),mb_iconerror); return false; } // initialize direct3d presentation parameter d3dpresent_parameters d3dpp; zeromemory(&d3dpp,sizeof(d3dpp)); d3dpp.windowed = !fullscreen; d3dpp.swapeffect = d3dswapeffect_copy; d3dpp.backbufferformat = d3dfmt_a8r8g8b8; d3dpp.backbuffercount = 1; d3dpp.backbufferwidth = width; d3dpp.backbufferheight = height; d3dpp.hdevicewindow = hwnd; d3dpp.enableautodepthstencil = true; d3dpp.autodepthstencilforma...

pthreads - Pthread_join & Pthread_exit in c -

#include<stdio.h> #include<stdlib.h> #include<pthread.h> void * function(void *); main() { pthread_t p[5]; int j; int *arg1[4]; int arr[5]={1,2,3,4,5}; for(j=0;j<=4;j++) pthread_create(&p[j],null,function,&arr[j]); for(j=0;j<=4;j++) pthread_join(p[j],(void **)&arg1[j]); for(j=0;j<=4;j++) printf("\n%d",*arg1[j]); } void * function(void *arg) { int *i = (int *) arg; pthread_exit(i); } output: -1498551536 32767 3 4 5 q.1) printing junk values first 2 values. why so? please correct me if wrong here. when changed code below, printing 1,2,3,4,5. for(j=0;j<=4;j++) { pthread_join(p[j],(void **)&arg1[j]); printf("\n%d",*arg1[j]); } q.2) different methods of returning values thread? can please summarize methods example , explain 1 method follow? your arg1 size 4, you're filling 5. setting proper size fix problem. in example doesn't work, you're n...

ubuntu - Virtualenv cannot specify minor Python version -

virtualenv not let me specify 2.7.5 in command (the version of python need), allows 2.7. however, specifying 2.7 gives me 2.7.4, version below 1 need. inherent limitation of virtualenv or missing something? $ virtualenv test/test --no-site-packages --python=python2.7 system ubuntu 13.04, has python 2.6.8, 2.7.4 , 3.3.1 installed. just download/make/install/apt-get/synaptic python 2.7.5 , point @ it's path when creating virtulenv: virtualenv test/test -p /usr/bin/my_2.7.5_directory/python2.7

asp.net mvc 4 - How to Auto Tab(Cursor) in Html.TextBoxFor(or Html.TextBox)? -

i'm new in asp.net mvc 4, , have questions i have 5 textbox following picture(link). http://i.stack.imgur.com/hmjjp.png in each textbox set maxlength its. following picture(link) http://i.stack.imgur.com/rsi4u.png example : textbox1 -> maxlength = 1 textbox2 -> maxlength = 4 textbox3 -> maxlength = 5 i want auto tab when insert data each textbox. example : when insert "1" textbox1(maxlength=1) cursor go textbox2 auto and thereafter want set data textbox example : string value = textbox1 + textbox2 + ... + textbox5 value = 1222233333... please accept sincere apology in advance mistake may occur. thank much. something following should work, markup <div class="tax"> <input type="text" maxlength="1" /> <input type="text" maxlength="4" /> <input type="text" maxlength="5" /> <input type=...

c# - Overcoming lazy loading of tabControls and Combobxes -

i loading few comboboxes lots of strings (one has +70,000 values) before main ui form loaded in c#. have comboboxes in separate tabpages of tabcontrol. doing when ui form shown, there no delays in showing tabs , comboboxes. now, problem first tabpage goes , shows quickly. however, other tabpages containing other comboboxes take 10 seconds rendered , shown up. i have tried create controls (comboboxes) using createcontrol before loading ui form , did not help. understand c# tabcontrols have called "lazy loading" behaviour. wonder how can overcome "lazy" feature comboboxes created , rendered before form shown , when change other tab pages, there no delays? [now editted tags - winforms related.] thanks, i guess threading concept overcome problem. can start new thread when form loads. let thread combo box filling or ever work required. this thread asynchronously update combo boxes. there no delay when form loads. short example of threads provided ...

Azure Sql Reporting Service external Image -

we working on sql azure reporting services, have situation need display client logo on report. passing image path (url) parameter report works fine on normal windows server reporting services, when move sql azure reporting fails show image on report e.g. image path can " http://p.lui.li/img-30718_images_j-r-full.jpg ". highly appreciated. from can tell not supported in azure sql reporting. tried in sample report , couldn't work if use azure blob storage. can upload image reporting server alternative external linking still not implemented. vote here: http://www.mygreatwindowsazureidea.com/forums/169380-business-analytics-sql-reporting/suggestions/2395600-support-external-image-in-reporting-services this similar azure cors problem going fixed soon. nice thing when fix notified if vote on it.

mysql - Can't select rows grouping by created_at -

i have table: +----+----------------------+---------------------+ | id | implemented_features | created_at | +----+----------------------+---------------------+ | 1 | 19 | 2013-07-18 04:10:12 | | 2 | 6 | 2013-07-18 04:10:12 | | 3 | 26 | 2013-07-19 04:10:12 | | 4 | 11 | 2013-07-19 04:10:12 | | 5 | 1 | 2013-07-20 04:10:12 | +----+----------------------+---------------------+ when query directly via mysql works want select date(created_at) date, sum(implemented_features) sum summaries group date(created_at); but when try convert query activerecord syntax returns me nil. 2.0.0p0 :035 > summary.select("date(created_at) date, sum(implemented_features)").group("date(created_at)") summary load (0.5ms) select date(created_at) date, sum(implemented_features) `summaries` group date(created_at) => #<activerecord::relation [#<summary id: nil>...