Posts

Showing posts from August, 2010

Connecting Prolog File with PHP file -

i have prolog code data.pl , , need use php file. search in internet, found this: exec('start <path/to/prolog> -f data.pl -g elem(a,[a,b])', $output) i've tried shell-exec() , system() commands, not work either. i've tried correct directory paths, , move data.pl path/to/prolog folder, , still no result. can me on issue? a better approach integrating web application prolog application can using swi's built-in http server. spare need load prolog , parse input file every call. provides more web-ish integration, can use ajax , similar approaches. if insist on invoking prolog executable php runtime env., you'll have provide more details. errors in php logs? have checked file permissions? did try giving full paths both prolog executable , data file? saying "it doesn't work" statement, not question. finally, efficiency issues, advisable compile prolog data file quick load format (qlf) instead of re-parsing each request

gconf - Changing wallpapers in python -

i'm running maverick on machine, , i'm trying write script change wallpapers in python. heres progress far. import gconf client = gconf.client_get_default() current_bg = client.get_string("/desktop/gnome/background/picture_filename") client.set_string("/desktop/gnome/background/picture_filename","home/tsudot/pictures/zombie.jpg") after running script blank wallpaper. shows me white screen. i examined gcnonf.xml file , change has been made there. can me out? the problem you're missing / @ beginning of home/tsudot/pictures/zombie.jpg file isn't found. avoid problem happening in future, perhaps change code keep filename in variable , check before trying set config option that file exists os.path.exists(filename) .

decoding - Decode a wordpress theme -

possible duplicate: php decode starting $ooo000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63 this wordpress theme can big 10 on evil scale. functions.php file encoded can't rid of footer link. prevent improve theme , that's shame. so, can decode ? tried online decoders, can't right. lot ! <?php /* */$ooo000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');$ooo0000o0=$ooo000000{4}.$ooo000000{9}.$ooo000000{3}.$ooo000000{5};$ooo0000o0.=$ooo000000{2}.$ooo000000{10}.$ooo000000{13}.$ooo000000{16};$ooo0000o0.=$ooo0000o0{3}.$ooo000000{11}.$ooo000000{12}.$ooo0000o0{7}.$ooo000000{5};$ooo000o00=$ooo000000{0}.$ooo000000{12}.$ooo000000{7}.$ooo000000{5}.$ooo000000{15};$o0o000o00=$ooo000000{0}.$ooo000000{1}.$ooo000000{5}.$ooo000000{14};$o0o000o0o=$o0o000o00.$ooo000000{11};$o0o000o00=$o0o000o00.$ooo000000{3};$o0o00oo00=$ooo000000{0}.$ooo000000{8}.$ooo000000{5}.$ooo000000{9}.$ooo000000{16};$ooo00000o=$ooo000000{3}.$ooo000000{14}.

model view controller - database driven form controls -

how databse driveen jsp page, suppose have 5 text fields,if user wants put 1 of form field select box.jsp should identify , return select box if define in db select box. i dont know how achieve this,can suggest this. regards, raju komaturi there multiple tasks if want completely. world @ large has not gone way , there not many tools (if any) this. here main ideas. 1) want "data dictionary", collection of meta-data tells types , sizes of each column are, , primary , foreign keys are. 2) example of "knowing" field should drop-down, means column value foreign key table. code detects , builds listbox out of values in parent table. 3) can go far create complete form generator simple tables, of html generated, need way override more complex forms. if this, data dictionary should have column descriptions or captions. there many many more ideas, starting point describe.

rrdtool - not able to fetch the data from rrd file -

i using rrdtool version 1.2.30 on windows platform, have 1 .rrd file , when tried fetch data using 'rrdtool fetch' giving me following error. error: rrd not contain rra matching chosen cf on firing following command rrdtool fetch usage.rrd average -r 3600 -s 1298264400 -e 1298350800 i don't know whats wrong when tried view data in xml using rrdtool dump on usage.rrd showing me following error. <!-- round robin database dump --><rrd> <version> 0003 </version <step> 2 </step> <!-- seconds --> <lastupdate> 0 </lastupdate> <!-- 1970-01-01 05:30:00 in e --> <ds> <name> </name> <type> </type> <minimal_heartbeat> 0 </minimal_heartbeat> <min> 5.9287877501e-322 </min> <max> nan </max> <!-- pdp status -->

java - How to add vm option to jetty? -

how available specify vm option -javaagent start jetty or available thru maven_opts variable? need enable load-time-weaving of aspects. plugin seems doesn't work. <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.1</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>maven</executable> <arguments> <argument>-javaagent:path\to\org\aspectj\aspectjweaver\1.6.10\aspectjweaver-1.6.10.jar</argument> </arguments> </configuration> </plugin> may can done jetty-plugin, t

Red alerts for machines in TIBCO admin -

in tibco admin getting red status of machines. think issue hawk. why getting these alerts ? serious ? yes, hawk generates alerts. have more detail alerts it's generating? failing that, probable reason aren't running hawk agent on machines or on subnet, can't reached via rv.

.net - Refreshing AzMan through AZROLESLib -

we've written simple azman wrapper class in .net uses azroleslib com interop library access azman. it works fine, except when make changes underlying xml store, changes not reflected in subsequent calls azroleslib. our code looks this: at class level store reference authorisation store: iazauthorizationstore authorisationstore = new azauthorizationstoreclass(); during construction of our class initialise store: authorisationstore.initialize(0, xml_store_path) the follow code gets executed whenever make request roles: authorisationstore.updatecache(); var application = authorisationstore.openapplication(appname); // query here , return results however, call updatecache seems nothing @ all. i've tried using closeapplication after every call throws exception: "the request not supported. (exception hresult: 0x80070032)". if new authorisationstore on every call, access denied exception instead (i assume because old authorisation store still has handle

colors - Changing JSF data table cell background -

how can change background of jsf data table cell? need change color of whole cell, not background of text in it. just use css give td element of interest background property color of interest. td.someclass { background: pink; } you can specify css classes td elements using columnclasses attribute of <h:datatable> . alternatively, if want apply on cells of same row, rather use rowclasses attribute in combination tr.someclass td css selector.

Building iPhone app with GData XML fails: undefined symbols (for architecture i386) -

Image
i've tried include gdata xml current project. far without success, however, building fails due error of kind that's out of scope..: since building iphone (and iphone simulator, sake of completeness), don't know why cares i386 anyway. again whole matter of including libxml2 bit beyond comfort zone - i'm doing first time. for setting flags , search paths referring step 4 of this tutorial . unable add other_cflags flag, since key of same name exists in llvm gcc 4.2 - language already. tried set -ddebug=1 there, didn't change anything. so, how things work properly? seems documentation on gdata xml sparse - can recommend ressource explains things better link found? edit: since koregan asked in comment, i'd add doesn't compile iphone simulator , actual device. if building device error different 1 (without i386 part) however: geez! got it. did import gdataxmlnode.h in apps pch file. found solution in this answer . have thought of that

c# - Entity Framework 4: Table per Type inheritance problem on insert -

Image
i have simple model "baseentity" , derived "fund" entity. when try insert new fund: hybridmodelcontainer container = new hybridmodelcontainer(); //create new fund fund fund = new fund(); fund.id = guid.newguid(); fund.datecreated = datetime.now; fund.name = "fund 1"; fund.number = 1; container.baseentities.addobject(fund); container.savechanges(); i following error: "cannot insert value null column 'id', table 'hybriddata.dbo.baseentities'; column not allow nulls. insert fails. statement has been terminated." it seems id assigned fund entity not inserted baseentity table. why not? i did "model first". if design database first, , create model it, works fine....but need model first! also...why isn't there objectset " funds " in datacontext (i.e., container.funds )? in advance help! i can answer second part of question: "also...why isn't there objectset "fu

vb.net - Convert VB function to Javascript -

any vb/javascript guru out there can convert me? protected function relativetime(byval dttime datetime) string dim timediff timespan = datetime.now.touniversaltime().subtract(dttime) if timediff.totalminutes < 1 return "less minute ago." elseif timediff.totalminutes < 2 return "about 1 minute ago" elseif timediff.totalminutes < 60 return string.format("about {0:n0} minutes ago", timediff.totalminutes) elseif timediff.totalhours < 2 return "about hour ago" elseif timediff.totalhours < 12 return string.format("about {0:n0} hours ago", timediff.totalhours) elseif timediff.totaldays < 365 return dttime.tostring("mmm d") else return dttime.tostring("mmm d, yyyy") end if end function there plenty of answers on address this. search &

jquery - Can't set element ID in JavaScript, it's always undefined -

i want have function generates id's on fly given jquery object, if doesn't have 1 already. these id's should used in future requests. i came code below, doesn't work. id's never set. commented out alert statement below return undefined. i pass code $(this) or $(options.el) parameter substitute 'el'. initially, elements not have explicitly id set in html. any appreciated, here's code: getelementid: function(el) { if(undefined == el.attr('id')) { el.attr('id',"anim-"+math.random().tostring().substr(2)); } // alert(el.attr('id')); return el.attr('id'); }, try changing: if(undefined == el.attr('id')) to: if("" == el.attr('id'))

asp.net - How To Freeze Columns in GridView -

i'm trying freeze columns in gridview grid has static height , rows rendered(no paging , scroll var visible). managed add scroll through content overflow property,but time columns scrolling well.my task freeze columns while maintaining column width . let grid <div style="height:200px;overflow:auto;"> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" useaccessibleheader="true or false"> <columns> <asp:boundfield datafield="name" headertext="name" /> <asp:boundfield datafield="surname" headertext="surname" /> </columns> </asp:gridview> </div> and code view public class person { public string name { get; set; } public string surname { get; set; } } ->on page load list<person> lst = new list<person>(); lst.add(new perso

android - Running WebView in background? -

i have webview application plays music flash player , continue playing user presses home button , uses other apps. there way have webview run in background , have behavior? thanks. services way music players implemented on android. http://developer.android.com/reference/android/app/service.html webview is gets displayed on screen. because services work in background don't have uis im not sure you'll have use hook online content going want inside service.

svn - What does subwcrev need? -

i wrote build script in ant. source code of project versioned in svn. as part of project had write java class, contains information subversion. in general, build script works fine. needed information gathered, except one. name of author commited last change in reporsitory. though read manual , still come ideas. my question is: exist way detail ant script? thanks edit: <target name="version" description="set version number"> <echo message="setting version information ..." /> <copy file="build/version.java.template" tofile="./cq/apps/src/de/anna/util/version.java" /> <tstamp> <format property="today_de" pattern="yyyy/mm/dd hh:mm:ss" locale="de,de"/> </tstamp> <replace file="./cq/apps/src/de/anna/util/version.java"> <replacefilter token="@appname@" value="${app.name

tfs2010 - Extending Team Foundation 2010 -

we use tfs 2010 source control, , have configured team collections can have own sharepoint portal. this works fine , can create tasks/bugs etc using this. however want extend custom apps log our own databases, , tfs. so bugs can raised people outside normal realm of operation. my question is, have or know of resources under skin of tfs, api tips , tricks. more advanced features. i happy buy books on this, unsure books right books buy. thanks in advance. how extending team foundation ?

containers - C# Casting of Dictionary -

i have function: void writemap(object value) { idictionary<string, object> vv = (idictionary<string, object>)value; foreach (keyvaluepair<string, object> obj in vv) { (write key) (write value) } } it works if value of type idictionary<string, object> , like: idictionary<string, int> idictionary<string, myclass> idictionary<string, string[]> etc. the cast throws run-time exception. function not modify container, prints keys , values. ideas on how can make work? appreciated. thanks! add generic type parameter method corresponding type of values in dictionary: void writemap<t>(idictionary<string, t> dict) { foreach (keyvaluepair<string, t> in dict) { // write key // write value } } this has advantage of eliminating cast. if need pass dictionary in object reason, cast idictionary .

relationship - Is it possible to get two different relation times between two nodes? -

i new neo4j & playing learn in deep. have small doubt like, if created 2 nodes in space , provided relationship , system time (to know @ time friends each other) between 2 nodes. so question is, possible 2 different relation times (if provide direction both & created relation once)? you people knows how traverse function behaves in neo4j. if please explain me example how ? your question not entirely clear. if have (person) - knows [started = time] -> (person) then can have many of relationships you'd like, in either direction (both means 2 relationship, 1 in either direction). for direct relationships do: node me, you; (relationship r : me.getrelationships(knows)) { if (r.getothernode(me).equals(you)) result.add(r.getproperty("time")); } for longer paths can use graphalgofactory.allsimplepaths retrieve paths between 2 people , relationships , time information whatever want. hth michael

flex - Which heap is used while building project in eclipse? -

i building flex project manually in eclipse , want know heap used during process: the heap used run eclipse mentioned in eclipse.ini or jre heap specified within eclipse? thanks much! i believe flex builder/flash builder plugins use java api compile flex apps, share heap eclipse. if running slowness/oom errors while compiling, try set heap higher in eclipse.ini. can check 'show heap status' checkbox in eclipse preferences under 'general' category. give indicator on bottom-right corner of eclipse showing used/total heap.

c++ - Initialize variable shared beetween dlls -

i all, have win32 application , several dlls must use global variable. in each dll put extern mytype* myvariable = null; and in main program have mytype* myvariable = null; mavariable = new mytype(); .... now, when dlls loaded myvariable null , cannot use it. how can share instance of main program dlls? you should make changes in program. if possible can move myvariable exe 1 dll. can continue use import libraries. it general can export functions or data exe, in cases there less sense this. can see seldom. example winword.exe or excel.exe this. if need export frunction or data exe , use in dll should use dynamical binding respect of getprocaddress , getmodulehandle(null) . can such kind of manual binding inside of dllmain . address of myvariable of exe can save in local myvariable of dll.

Combining generic type parameters with interfaces in Java -

as many inheritance problems, find hard explain want do. quick (but peculiar) example should trick: public interface shell{ public double getsize(); } public class tortoiseshell implements shell{ ... public double getsize(){...} //implementing interface method ... public tortoise gettortoise(){...} //new method ... } public class shellviewer<s extends shell>{ s shell; public shellviewer(s shell){ this.shell = shell; ... } } public class tortoiseshellviewer<t extends tortoiseshell> extends shellviewer{ public tortoiseshellviewer(t tshell){ super(tshell); //no problems here... } private void removetortoise(){ tortoise t = tshell.gettortoise(); //error: compiler can not find method in "shell" ... } } the compiler not recognise want use specific implementation of shell gettortoise() . have gone wrong? based on you've given here, proble

How do I use the DropDownList in ASP.NET MVC 3 -

i new mvc , trying populate dropdownlist in view list of 'rules' controller. when way listed, dropdownlist bunch of items cellularautomata.models.rules. know doing incorrectly, i'm wondering how show rule description each rule in dropdownlist. i have model public class rule { public int id { get; set; } public int name { get; set; } public string description{ get; set; } public rule(int name, string description) { name = name; description = description; } public rule() { name = 0; description = ""; } } a controller public actionresult index() { var rules = rule in db.rules select rule; return view(rules.tolist()); } and view @model ienumerable<cellularautomata.models.rule> @{ viewbag.title = "index"; } <h2>index</h2> <table> <tr> <td> @html.dropdownlist(&

unit testing - Rails 3: Ruby 1.9.2: rake test: winshellTEST -

i got app github called punchy , , got running on local server (windows vista). runs fine on windows, , runs fine on heroku. the environment : c:\users\jay\rapps\punchy>rake (in c:/users/jay/rapps/punchy) application's environment ruby version 1.9.2 (i386-mingw32) rubygems version 1.5.2 rack version 1.2 rails version 3.0.0 active record version 3.0.0 action pack version 3.0.0 active resource version 3.0.0 action mailer version 3.0.0 active support version 3.0.0 application root c:/users/jay/rapps/punchy environment development however, tried run tests running > rake test and went bad. here result. c:\users\jay\rapps\punchy>rake test (in c:/users/jay/rapps/punchy) c:/ruby192/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `load': no such file load -- winshelltest (loaderror) c:/ruby192/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `block in <main>

c++ - Structure initialization -

i have used following structure template <typename item> struct tset { typedef std::set <int, comparator <item> > type; }; as data member of the structure template <typename item> struct tobject { int code; ... typename tset <item> ::type indices; tobject ( const list <item> *list ) : code( 0 ), indices ( list ) {} }; where template <typename item> struct tlist { typedef std::vector <item> type; }; template <typename item> class list { private: typename tlist <item>::type items; }; but have changed data model to template <typename item> class tset : public std::set <int, comparator <item> > { }; template <typename item> struct tobject { int code; ... typename tset <item> indices; tobject ( const list <item> *list ) : code ( 0 ), indices ( list ) {} //error: can not convert parameter 1 const list <item> const

Saving as Flash in C++ -

how save iplimage of opencv flash file? maybe there library that? if mean storing output flash video (.flv) use ffmpeg (libavcodec/libavformat). cross platform , supports .flv format (besides massive amout of others) , should quite easy do. can embed audio too. as note: ffmpeg partially included in opencv (depending on build) video coder/decoder, don't know though if can force write .flv (by choosing right codec string) within opencv. anyways it's not hard convert iplimage ffmpeg buffer , store there. a problem might have latest opencv (2.1) has trouble build ffmpeg support or build against ffmpeg version don't want. mentioned above don't need use ffmpeg via opencv 2.1 api, since can use directly using ffmpeg api. look examples in libavcodec on how write video, , check opencv source on how convert iplimage avpacket/avframe. i've done before , quite easy do.

visual studio 2010 - How to set a breakpoint in code from referenced .dll? -

i trying set breakpoint on method library system.web.mvc: microsoft.web.mvc.html.htmlhelperextensions.editorfor the symbols loaded. how can set breakpoint if can't open source code? i've tried "debug > new breakpoing > break @ function" with microsoft.web.mvc.html.htmlhelperextensions.editorfor but no luck.

code generation - Auto-generate a interface implementation for a dbus interface in Python? -

are there tools can read set of dbus xml files , create set of representative python classes? embedded code generated catching related events & initialising interface benefit. currently project working on duplicating loads of lines of code large exported api. such tool invaluable. take @ code generation tools in telepathy-python . telepathy's spec xml format superset of standard d-bus introspection format; should able feed plain-ish introspection xml, possibly few annotations, tools.

asp.net mvc - How can I view all zones in a an Orchard theme? -

i'm trying learn orchard. theme machine has many zones place widgets. there way through browser see zones available , location on page? the best way see zones @ thememachines layout.cshtml file , see each of them placed. add widget each zone pszmyd recommends , turn on developer/experimental feature , see name of zone when leave cursor on it.

joomla - Copy home template to make changes & test on hidden menu -

i want copy homepage (index page) , make copy appear on hidden part of website can make changes , test before put new page live... so want able type url , see page on web, yet don't want page apart of websites main menu... make new menu menu management name 'hidden menu' or else add new menu item on . don't publish hidden menu elsewhere in site. assign copied template new menu item created under hidden menu. can copy link of new menu url.

How to test posts in Rails / Capybara / Cucumber or Rspec -

i'm using rspec, cucumber , capybara , i'm looking way test malicious user can't hack form post url he/she doesn't have permission to. have permissions set in cancan such "should" work, however, way can test hacking form myself. how can automate sort of testing? webrat in unit test rspec put :update, :user_id => @user.id, :id => @user_achievement.id response.should contain("error, don't have permission access that!") in capybara, however, visit get's seems. can't find way this, i've googled everwhere. any appreciated, thanks i think can rack-test https://github.com/brynary/rack-test in gemfile: gem 'rack-test' in env.rb file module capybaraapp def app; capybara.app; end end world(capybaraapp) world(rack::test::methods) step defintions somewhere: when /^i send post request "([^"]*)"$/ |path| post path end most of learned came here: http://www.anthonyeden.com/2010/

bash - Adding a zero to single digit variable -

trying add 0 before varaible if it's less 10 , create said directory. can't seem 0 add correctly. keeps resulting in making 02.1.2011 , 02.2.2011 etc,etc. i=0 in {01..31} if $i > 10 mkdir $path/02.0$i.2011 else mkdir $path/02.$i.2011 fi done you can replace whole lot with: for in 0{1..9} {10..31} ; mkdir $path/02.$i.2011 done while still not having start external processes (other may in loop body). that's not important here since mkdir not 1 of things tend lot of in tight loop will important if write lot of quick , dirty code in bash . process creation expensive when you're doing hundreds of thousands of times of scripts have done :-) example can see in action: pax$ in 0{7..9} {10..12}; echo $i; done 07 08 09 10 11 12 and, if have recent-enough version of bash , honor request leading digits: a sequence expression takes form {x..y[..incr]} , x , y either integers or single

xcode - As soon as I make a connection between my code and interface, my tab crashes (iOS SDK 4.2) -

using xcode 4, iphone ios 4.2 hey everyone, i'm using tabbar interface new app i'm trying finish. have declared uilabels , connect them in interface builder actual labels, whole app crash upon selection of tab @ runtime, in simulator , on iphone. i'm hoping there's simple answer out there, have no idea (i novice). thanks in advance, usually happens when change name of variables didn't update hooks in ib. easy fix unhook in ib, , hook them on again.

Hibernate Annotations: Store an int in a varchar column -

i'm using hibernate annotations. in pojo have year field int. i persist value in char(4) column in db, , have hibernate convert types , forth. there anyway can (i started @type annotation, don't want have write own custom type if possible)? if pojo 's field mapped db 's char(4) column access property , hibernate call setter , getter mapping between database , pojo . , conversion logic can implemented inside setter , getter of property. besides , intdate should mark @transient tell hibernate ignore mapping field. public class tableabc { private int id; private int intdate; @id @generatedvalue public int getid() { return id; } public void setid(int id) { this.id = id; } @column(length=4) private string getchardate() { return string.valueof(this.intdate); } private void setchardate(string chardate) { try { this.intdate = integer.parseint(chardate);

c++ - Finding all paths down stairs? -

i given following problem in interview: given staircase n steps, can go 1 or 2 steps each time. output possible way go bottom top. for example: n = 3 output : 1 1 1 1 2 2 1 when interviewing, said use dynamic programming. s(n) = s(n-1) +1 or s(n) = s(n-1) +2 however, during interview, didn't write code this. how code solution problem? thanks indeed! you can generalize recursive function take made moves. void steps(n, alreadytakensteps) { if (n == 0) { print taken steps } if (n >= 1) { steps(n - 1, alreadytakensteps.append(1)); } if (n >= 2) { steps(n - 2, alreadytakensteps.append(2)); } } it's not code, more of pseudocode, should give idea.

How to create a text overlay in Google Maps API v3 that does not pan? -

i'm using google maps api v3. create text overlay on map not move when map panned. best approach manipulate dom elements accessible mappanes object or best create custom control though not other display text? the simplest way found worked me few lines of javascript added after created new map. so, after this: map = new google.maps.map('mymapdivid', mapoptions); add this: var mytitle = document.createelement('h1'); mytitle.style.color = 'white'; mytitle.innerhtml = 'hello world'; var mytextdiv = document.createelement('div'); mytextdiv.appendchild(mytitle); map.controls[google.maps.controlposition.bottom_center].push(mytextdiv); you want style text nicer. an alternative put div in html: <div id="mytextdiv" style="color: white; position: absolute;"> <h1>hello world</h1> </div> and in javascript: var mycontrol = document.getelementbyid('mytextdiv'); map.control

objective c - How to display series of images when app loads in iPhone SDK? -

i want display series of images 1 one when app loads. want create kind of animation loading these images sequentially. i know possible. have seen many apps that. can please let me know how can done? thanks! take @ uiimageview's animationimages property. can assign nsarray of images property. below example there may typos i'm typing memory. -(void)viewdidload { uiimageview *flower = [[uiimageview alloc] init]; flower.animationimages = [nsarray arraywithobjects: [uiimage imagenamed:@"bloom1.png"],[uiimage imagenamed:@"bloom2.png"], [uiimage imagenamed:@"bloom3.png"], nil]; //add more images necessary flower.animationduration = 1.00; flower.animationrepeatcount = 1; [flower startanimating]; [self.view addsubview:flower]; [flower release] }

PHP + jQuery .validate issue -

ill try , make clear possible. have contact form on page , remote php file "random.php" generates 2 random numbers: <?php $randomnum = rand(0,9); $randomnum2 = rand(0,9); echo $randomnum . ' + ' . $randomnum2; $randomnumtotal = $randomnum + $randomnum2; ?> the parent page calls such: $(function() { $.get( 'php/random.php', function ( data ) { $('#resetnumbers").val(data); }); and has input: <input type="text" class="numbers" name="resetnumbers" id="resetnumbers" value="" size="6" readonly> no problems point, php file output's 2 random numbers , displayed on page. here's problem : have second text box have add 2 numbers make validate. <input type="text" class="numbers" name="resetmath" id="resetmath" size="6" maxlength="6" tabindex="27"> it never w

c++ - Do repetitive calls to member functions hurt? -

i have programmed in both java , c, , trying hands dirty c++. given code: class booth { private : int tickets_sold; public : int get_tickets_sold(); void set_tickets_sold(); }; in java, wherever needed value of tickets_sold , call getter repeatedly. for example: if (obj.get_tickets_sold() > 50 && obj.get_tickets_sold() < 75){ //do } in c value of particular variable in structure: if( obj_t->tickets_sold > 50 && obj_t->tickets_sold < 75){ //do } so while using structures in c, save on 2 calls otherwise make in java, 2 getters is, not sure if actual calls or java somehow inlines calls. my point if use same technique used in java in c++ well, 2 calls getter member functions cost me, or compiler somehow know inline code? (thus reducing overhead of function call altogether?) alternatively, better off using: int num_tickets = 0; if ( (num_tickets = obj.get_ticket_sold()) > 50 && nu

c# - Live video encoding using ffmpeg or expression encoder -

i want encode video captured webcam, flv or other format. related question: using ffmpeg in .net? a starting point samples in directshow.net , corrosponding documentation on msdn.

Specifying a db function in an insert statement in Zend -

i have this: $data = array('username' => 'john', 'password' => 'john123'); $table = new zend_db_table('users'); $table->insert($data); but want include hashing function password, sql this: insert `users` (`username`, `password`) values ('john', password('john123')); how can that, elegantly? $data = array('username' => 'john', 'password' => new zend_db_expr('sha1(john123)');

Can't Parse RSS XML with PHP -

i have rss trying parse url: http://weather.yahooapis.com/forecastrss?w=12797541 but when try parse using php doing this: $yahoo_response = new simplexmlelement($yahoo_url , 0, true); echo $yahoo_response->rss->channel->item->title; echo $yahoo_response->rss->channel->item->description; nothing gets outputed. know doing wrong here? need current forecast bit. thanks, alex the root element <rss> , represented simplexmlelement loaded $yahoo_response . echo $yahoo_response->getname(); // rss you trying <rss><rss> when should do: echo $yahoo_response->channel->item->title; echo $yahoo_response->channel->item->description;

wpf - Does anyone know a good .Net VoIP library? -

i have been searching ages .net based voip library. after having tried conaito , sip.net, have still haven't found fits needs. basically of these constructed using activex. unfortunately activex , wpf don't play together. , clickonce deployment doesn't register interop com components. i need find , pure .net managed code implementation. what these... asterisk arena - amiconnector (might not because of activex stuff) guide codeproject list of free libraries hope these useful, apologies if not.

asp.net - Passing a JavaScript variable to a helper method -

i using asp.net mvc 3 , yui library. i created own helper method redirect edit view passing in item's id model such: window.location = '@url.routeurl(url.newsedit(@model.newsid))'; now busy populating yui data table , call helper method above, not sure if possible because item's id javascript like: var formatactionlinks = function (ocell, orecord, ocolumn, odata) { var newsid = orecord.getdata('newsid'); ocell.innerhtml = '<a href="/news/edit/' + newsid + '">edit</a>'; }; store url custom id, you'll replace later on: var myurl = '@url.routeurl(url.newsedit(0))'; //let's use 0 later on: var formatactionlinks = function (ocell, orecord, ocolumn, odata) { var newsid = orecord.getdata('newsid'); //lets use url defined above, , replace 0 our id. ocell.innerhtml = '<a href="' + myurl.replace('0',newsid)+ '">edit</a>'; }

flex4 - Charting components in Flex 4 opensource SDK -

charting components in flex 4 opensource sdk free or not. is there difference between opensource flex sdk 4 , free adobe flex sdk interms of charting components. will need license if use commercial purpose...? any please..? thanks in advance yes, in flex 4, free. no longer need buy flash builder professional license use components.

How to change title bar image in WPF Window? -

how change titile bar image (the top-left icon) in wpf? the icon attribute of window used set icon of window. <window x:class="windowsample.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="wpf window sample" height="350" width="525" name="firstwindow" icon="icon1.ico" > the icon property of window class represents window's icon @ run-time. property takes imagesource variable. the following code snippet uses bitmapframe.create method create imagesource , sets icon property of window. uri iconuri = new uri("pack://application:,,,/icon1.ico", urikind.relativeorabsolute); this.icon = bitmapframe.create(iconuri); you can read more here

MySQL trying to get hourly summary and count on row data -

mytable is: tday char(3) dow int(1) tdate date ttime time t0 decimal(5,2) t1 decimal(5,2) t2 decimal(5,2) t3 decimal(5,2) total decimal(8,2) given above structure , following data: dow im cdate ctime g0 g1 g2 g3 thu 4 2010-12-02 05:29:15 1 3 0 11 thu 4 2010-12-02 05:34:22 0 4 1 0 thu 4 2010-12-02 05:39:28 6 0 7 0 thu 4 2010-12-02 05:44:35 8 7 3 9 thu 4 2010-12-02 05:49:41 0 7 0 8 thu 4 2010-12-02 05:54:48 1 7 0 1 thu 4 2010-12-02 05:59:54 3 0 5 3 thu 4 2010-12-02 06:05:01 0 9 1 0 thu 4 2010-12-02 06:10:07 2 9 10 0 thu 4 2010-12-02 06:15:13 0 0 16 0 thu 4 2010-12-02 06:20:20 2 0 8 0 thu 4 2010-12-02 06:25:26 1 0 0 0 thu 4 2010-12-02 06:30:33 1 5 19 21 thu 4 2010-12-02 06

Spring access global value from JSP -

in spring application wish add configurable system message can displayed on every page. example "the system going down in 10 minutes". i need store value globally, can't add code controllers, don't want have change every single 1 of them. thought of using @service, don't know how can access directly jsp. i'm happy use jsp scriptlet notation need. ideas? another idea put messages in application scope? many people not aware there 1 more scope other request, session, , page. at servlet, set attribute (request httpservletrequest object passed doget/dopost method): request.getsession().getservletcontext() .setattribute("my.sys.msg", "the system going down in 10 minutes."); in jsp file use this: <jsp:usebean id="my.sys.msg" scope="application" />

ruby on rails - Achieving 25K Concurrent connections in RubyOnRails Application -

i trying build suggestion board application. users raises query , multiple people post @ same time. expected supporting atleast 25k concurrent users. question format has checkboxes or radio buttons, in thats case writing db. please let me know how can achieve in ruby on rails. - hardware support (specific hardware lb) - software support (db clustering/app server clustering/ web traffic resolution) i think best plan worry scaling level once have many users. there's nothing stopping achieving in rails, or indeed other framework/language. the problem trying design architecture up-front scale level that, @ point, have absolutely no idea pain points going be. there specific pages going hit database harder, of pages heavy on html , images... there many questions ask cannot answered until you've gotten out there. this doesn't mean shouldn't worry scaling - means, try design data structures in such way allow scale later. put off major decisions, , think them

fetch gmail email without imap extensions in php -

is there way google emails using php without imap extension? sure pear's net_imap provides implementation of imap4rev1 protocol using pear's net_socket , optional auth_sasl class. to clarify, package implements imap protocol in php code, instead of requiring extension installed. not perform c-client would, should functional @ least.

c# - Restore oryginal value after validation fails - infragistics UltraWinGrid -

i've set regexppattern property in infragistics ultrawingrid column , works - when user edit cell , given input doesn't match regexp cell cleared. restore previous ( before edit started) value of cell instead of make blank. how can it? thanks in advance! i found solution: create event handler grid's event: celldataerror - set event argument properties in following sample: private void _ultragrid_configlist_celldataerror(object sender, infragistics.win.ultrawingrid.celldataerroreventargs e) { e.stayineditmode = false; e.raiseerrorevent = false; e.restoreoriginalvalue = true; }

vb.net - Unable to select more than 1 radio button -

i have 4 radio buttons, r1, r2, r3, r4. these 4 radio buttons in group box. r1 , r2 asking gender of person. r1 male , r2 female r3 , r4 asking whether user continue. r3 yes , r4 no. when click r1 , r3 becomes unchecked , vice versa. similar case r2 , r4. @ time can check 1 radio button. how can around problem . groupbox essential cannot remove it. radiobuttons grouped parent-control. sufficient re-group them in panel . current layout: groupbox radiobutton radiobutton radiobutton radiobutton new layout: groupbox panel radiobutton radiobutton panel radiobutton radiobutton

.net - VB.Net socket communication, unusual data being received -

i trying communicate local as3 air app on pc via sockets. vb.net app acting server in case while air app client. the .net app sends data every 25ms air app. have not send message termination. receive data on air app , process it. on receiving side when debug data see that transitions have been concated. something if send "abcdef" successively cases receive "abcdef" in cases receive "abcdefabcdef" is possible underlying tcp network combining data , sending 1 packet. need send message terminator instance "abcdef$" , split messages @ receiving end? am goofing big time? from documentation socket.send : there no guarantee data send appear on network immediately. increase network efficiency, underlying system may delay transmission until significant amount of outgoing data collected. successful completion of send method means underlying system has had room buffer data network send. there's no guarantee you'l

Does Internet Explorer support CSS transitions? -

css transitions neat way of animating changes in css properties. versions of internet explorer support them? the page link has compatibility table . chrome 1.0 (-webkit prefix) firefox 4.0 (2.0) (-moz prefix) 16.0 (16.0) (no prefix) internet explorer 10.0 (no prefix) opera 10.5 (-o prefix) 12.0 (no prefix) safari 3.2 (-webkit prefix) there article on msdn css3 transitions in internet explorer .

scheme - How do I return a copy of an object? -

i need implement function of 1 argument -- obj -- returns scheme expression that, when evaluated, return copy of obj . any ideas on how proceed problem? i'm guessing meant write "a function expr-returning [that accepts an] obj [and] returns scheme expression that, when evaluated, ..." assuming case: need here design recipe. begin with: write down examples of function accepts, , returns. clarify you're trying do, both others , (probably more importantly) yourself. hope helpful; sorry opaque...

javascript - document.getElementById("xxx").name = "sample" not working in firefox but works in IE -

can on one. trying set name of element dynamically. try using setattribute . example: var element = document.getelementbyid("xxx"); element.setattribute("name", "sample");

jquery - asp mvc 2 return json result -

trying return dictionary jsonresult, number of elements in dictionary > 3.6k; code: $('#go').click(function () { $("#content").empty().html('<img src="content/loading.gif" style="top:100px;left:100px;"/>'); $.ajax({ type: 'post', url: '<%= url.action("loadcontent","home") %>', async: true, data: { block: $('input[name=block]:checked').attr('value'), type: $('input[name=type]:checked').attr('value'), begin: $('#begindate').attr('value') + " " + $('#begintime').attr('value'), end: $('#enddate').attr('value') + " " + $('#endtime').attr('value') }, datatype: 'json', success: function (response) { alert(response);

Download a File From a External sever through Asp.net & C# -

first,i uploaded file in external server , got url server.now want download uploaded file external server through url got server through asp.net , c#. wrote c# code download file, during process got exception "exception of type 'system.outofmemoryexception' thrown". following c# code wrote download: double dlsize=0; string url = "http://www.sample.com/download.zip"; \\file size: 75mb int lastindex = url.lastindexof("/"); string tempurlname = url.substring(lastindex + 1, url.length - (lastindex + 1)); webrequest owebrequest = webrequest.create(url); owebrequest.timeout = -1; webresponse owebresponse = owebrequest.getresponse(); if (owebresponse.contenttype != "text/html; charset=utf-8") { string myfile = owebresponse.headers.get("content-length"); int tempmyfile = convert.toint32(myfile); double bytes_total = convert.todouble(tempmyfile); dlsize = convert.todouble(bytes_total / (1024 * 1024)); system.

c++ - diff between ADT list and linked list -

what ( real | significiant ) difference (s) between adt list implementation , linked list implementation with respect queue ? moreover, can suggest website visual example of these type of lists ? it hard understand question, in attempt ask actual question is, believe have figured out. assumption is, question is: "what difference between std::list , std::queue. @fatai: please correct me, when wrong. the std::list doubly-linked list. each element of list "knows" next , previous element. , list "knows" it's beginning , end. here: http://www.cplusplus.com/reference/stl/list/ the std::queue list, special functionality. functionality allows insert elements @ front, , remove elements back. have here: http://www.cplusplus.com/reference/stl/queue/ if want have minimal functionality, i'd use queue. queue optimized purpose. prevents doing things accidentally wrong (such remove element middle). i hope answers (confusing) question. ;-)

installer - How to set additional properties during RemoveExistingProducts -

i using recommended way upgrade (use upgrade , upgradeversion detect old version of product , use removeexistingproducts after installinitialize the thing is, during uninstall of existing product, need pass additional properties installer preserving existing database. there way that? all product being removed via removeexistingproducts receives single property upgradingproductcode . property set match productcode of installer removing other product. if had condition against in installer being removed, can act accordingly. if not, need make upgradeversion onlydetect , block until it's gone, invoke removal manually, or similar workarounds.

compilation - Linux vs Solaris - Compiling software -

background: at work i'm used working on solaris 10. have sysadmins know they're doing , can out if required. i've compiled things apache, perl , mod_perl source without problems. i've been given redhat server play , hitting problems. sysadmins out sick @ moment. i keep hitting problems regarding ld_library_path when building software. @ moment test purposes compiling home directory, don't have root, or permissions install anywhere else. i plan on having area under /opt install into, on solaris, i'll need out sysadmin around create us. my .bashrc had nothing ld_library_path i've been appending things stuff built (e.g. ffmpeg source). i've been reading , apparently isn't way go, it's not reliable or something. don't have access ldconfig (permission denied). now quetions: what best way build applications under linux won't break? creating entries under /etc/ld.so.conf.d/ ? can give brief overview of ld_library_path does?

SVN - how do I commit previous version back into svn? -

i in version 100 svn co -r92 http://www.projectname.svn/trunk projectname seems work how v92 version committed? if svn conflicts if svn commit won't work any idea's i'm lost here svn -rhead # sure you're updated latest head svn merge -rhead:92 . # reverse-merge revision 92 svn commit # commit

ios - Run NSBundle from the documents folder -

is there way use nsbundle documents folder on ios? not sure exact question is, either, here how access local document folder of app (this not documents folder store sources app uses, 1 app stores local resources) example, in app take pics camera , store them app's local folder, not device camera roll, number of images this, in viewwillappear method use: // create route of localdocumentsfolder nsarray *filepaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); //first use local documents folder nsstring *docspath = [nsstring stringwithformat:@"%@/documents", nshomedirectory()]; //then use bundle, indicating path nsstring *bundleroot = [[nsbundle bundlewithpath:docspath] bundlepath]; //then content nsarray *dircontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:bundleroot error:nil]; // counts total of jpg images contained in local document folder of app nsarray *onlyjpgs = [dircontents filteredarrayusingpr

iphone - copy NSMutableArray atIndex (0) to string variable -

i have array , want extract value of array @ specific index like: nsstring val1 = array1[index1]; array nsmutablearray. nsstring *stringtoextract = [arraytoextractfrom objectatindex:0];

iphone - -[UIImage CGImage] returning nil -

i'm wondering under circumstances code breaks in second assert. in other words, when can -[uiimage cgimage] return nil ? documentation isn't telling here. - (void)setimage:(uiimage *)animage { assert(animage); cgimageref cgimage = animage.cgimage; assert(cgimage); } i'm pretty sure, uiimage correct since it's fetched app bundle. far haven't been able reproduce case see user crash reports. another possibility have multiple threads accessing same uiimage object @ same time; happening in code same symptom. that might explain sporadic crash reports, too, since access patterns depend on timing changes run run.

grails - How to convert Time in String format ("12:45" or it can be "725:00" ) to minutes in java? -

i trying convert time in string format minutes. can use substring , find minutes there problem because there chance of getting time in format 720:00 hours. (as calculating time many days) pls me.... in advance........ hussain as far understood, need calculate how many minutes in given hours , minutes. well, i'd fast , simple: string time = "725:00"; string[] parts = time.split(":",2); int hours = integer.valueof(parts[0]); int minutes = integer.valueof(parts[1]); return hours*60+minutes;

rhino mocks - How can I modify the result of a method call on a mocked object before it is returned? -

given following streamlined example, using rhinomocks , mspec: [subject(typeof (locationcontroller))] public class when_creating_a_location_with_invalid_model : context_for_location_controller { static locationmodel model = new locationmodel(); static selectlist states = new selectlist(new dictionary<string,string> { { "in", "indiana" }, { "ny", "new york" } }); static actionresult result; establish context = () => { locationmodelbuilder.stub(x => x.build(arg<locationmodel>.is.equal(model))).return(model); } because of = () => result = subject.create(model); should_automatically_select_a_state = () => result.model<locationmodel>() .states.shouldnotbeempty(); } how can modify object contained in model variable before returned stubbed call of locationmodelbuilder.build() ? want perform assignment model.states = states

qt - Behaviour of QMetaObject within a base class constructor -

i have simple qobject-derived object: class myobject : public qobject { q_object public: myobject(qobject* parent = 0); }; myobject::myobject(qobject* parent) : qobject(parent) { std::cout<<"[base] "<<this->metaobject()->classname()<<std::endl; } and further derive object: class myderivedobject : public myobject { q_object public: myderivedobject(qobject* parent); }; myderivedobject::myderivedobject(qobject* parent) : myobject(parent) { std::cout<<"[derived] "<<this->metaobject()->classname()<<std::endl; } whenever instantiate class, following output: myderivedobject y; ## output ### [base] myobject [derived] myderivedobject i don't it. since inheritance hierarchy myderivedobject -> myobject -> qobject, both have same instance of qobject parent (right?). know of run-time type information provided via moc , shouldn't change fact once static_cast<qobject*>(/*mysom

"To Be or Not to Be" about variables in JavaScript -

just doing little introduction javascript. i'm used more testing existence of pointers in c++ not crash. never did read hamlet, read this page null , undefined in javascript. and in nutshell can: if (varname == null) if (varname === null) if (typeof(varname) != 'undefined') if (varname != undefined) if ('varname' in object) if (object.hasownproperty('varname')) honestly little me :). classical way in javascript testing variables avoid crashes? because of errors thrown reading undeclared globals, checking variable best done using third example, typeof example. if (varname == null) will tell whether value defined , nullish , throw error if undeclared. if (varname === null) will tell if value defined , null , throw error if undeclared. if (typeof(varname) != 'undefined') will tell if variable defined or not without throwing error. if (varname != undefined) is opposite of first. if ('varname' in objec

c# - How Do I Prevent JIT Compiler From Optimising Out This Method -

i have extension method looks following: //[methodimpl(methodimploptions.nooptimization)] public static ienumerable<char> takewhile(this binaryreader reader, func<int, bool> condition) { while (condition(reader.peekchar())) { char c = reader.readchar(); yield return c; } } i use method when parsing file binaryreader skip block of whitespace characters, amongst other things. have found jit compiler optimising out, when call so: // skip white space this.reader.takewhile(iswhitespace);//.firstordefault(); i have tried adding [methodimpl(...)] attribute instruct jit compiler not optimise out method, not work. write implementation of manipulates underlying stream buffer position out of curiosity know why so. the ways have found prevent optimisation use ienumerable results (eg - via call .firstordefault() commented above) or copy code calling method. have tried preventing optimisation of calling methods, using methodimplattribute, not