Posts

Showing posts from January, 2011

Adding output from loop to hash table powershell -

i have following code, #pull number of physical drives $phy = $datafile.getenumerator()|where-object {$_.name -like "*physical*"} [array]$phydisks = ($phy.name | sort-object ) #for each of these drives work work out physical make of disk $drives= foreach($_ in $phydisks){ $cylinders = $datafile["$_"]["cylinders"] $head = $datafile["$_"]["trackspercylinder"] $sectors = $datafile["$_"]["sectorspertrack"] $bytespersector = $datafile["$_"]["bytespersector"] #convert output gigabites , round the next decimal place $physicaldrivegb = ((([int]$cylinders * [int]$head * [int]$sectors * [int]$bytespersector) / 1024) / 1024) /1024 $physicaldrivesize = [math]::round($physicaldrivegb,1) } $vmwarefile = @{servername=$servername;memory = $servermemorymb;number_of_processors = $processorcount;'number_of_cores/processor' = $processorcorecount;number_of_disks = $numberofdisks}

Where does this IntegrityError comes from on the Django ORM on MySQL? -

i have django 1.5 site running mysql db on cent os, , 1 of views used worked started fail on snippet : ipdb> video.objects.create(owner=usr, category=category, status="processing", title=request.post.get('title')) *** integrityerror: (1452, 'cannot add or update child row: foreign key constraint fails (`project`.`videos_manager_video`, constraint `category_id_refs_id_26102a51` foreign key (`category_id`) references `videos_manager_category (`id`))') the code hasn't changed, data base hasn't changed , ran mysqlcheck (it said tables ok), still explodes. of course checked category , proper category object, proper id. doing this: category.objects.get(id=cated.id) returns same categ. we purged cache, juste in case, still no go. what cause ? solve ?

MySQL 5.6 install on debian ERROR: -

i'm trying install mysql 5.6 on debian. here do: sudo dpkg -i mysql-5.6.12-debian6.0-i686.deb cd /usr/local ln -s /opt/mysql/server-5.6 mysql cd mysql scripts/mysql_install_db.sh --user=mysql --datadir=/var/lib/mysql and error get: fatal error: not find @bindir@/my_print_defaults if compiled source, need run 'make install' copy software correct location ready operation. if using binary release, must either @ top level of extracted archive, or pass --basedir option pointing location. could please suggest something? i'm installing mysql scratch (previous version removed). thanks. i might not able error you're getting. apt-get install -f mysql-server-5.5 worked me on debian wheezy. try replacing 5.5 5.6 , see if works well, , precede sudo .

anjlab/bootstrap-rails import not working -

Image
i'm trying use anjlab/bootstrap-rails. i'm @ step says "import twitter bootstrap @import "twitter/bootstrap";" but, i'm getting: error compiling css asset sass::syntaxerror: file import not found or unreadable: twitter bootstrap this pic of i've done: thanks help!

jquery - adding a next button onto jplayer -

i'm trying add next button on jplayer. try using click function didn't work. the way player setup it's using ajax it's songs , information songs. when song ends song using ajax also. thing trying adding next button don't know how to. ideas? $(document).ready(function () { $("#jquery_jplayer_1").jplayer({ ready: function () { var data = $.ajax({ url: "getsong.php", async: false }).responsetext; var string = data.split('|'); $(this).jplayer("setmedia", { mp3: string[0] }).jplayer("play"); $('#artist').html(string[1]); $('#songname').html(string[2]); $('#album').html("<img src='" + string[3] + "' width='250' height='250' />"); }, ended: function (event) { var d

JSF request scope with get parameter -

i know there many similar threads no mine: i have requestscope bean: @managedbean @requestscoped public class bean implements serializable{ private string username = ""; //managed textbox private string password = ""; //managed textbox private string id ="-"; //load parameter usual: @postconstruct public void fetchparams(){ system.out.println("fetch params"); facescontext facescontext = facescontext.getcurrentinstance(); string id = facescontext.getexternalcontext().getrequestparametermap().get("id"); if(id == null || id.length() == 0) return; setid(id); } // getters & setters public void dosomething(){ //executed when clicked on sumbit-button on jsf-site staticfunctions.dosomething(this); } } the code following: retrieves get-parameter "id" , saves string id (confirmed string.out....). but when method dosomething() exec

ssh - PHP errors on Magento store after restoring backup -

after failing upgrade magento store 1.4.1.1 1.7.02 decided go backup made before upgrading. unfortunately gives few errors when trying access website: notice: trying property of non-object in /home/ziezap.nl/public_html/app/code/core/mage/core/model/config.php on line 1125 notice: trying property of non-object in /home/ziezap.nl/public_html/app/code/core/mage/core/model/config.php on line 1125 notice: trying property of non-object in /home/ziezap.nl/public_html/app/code/core/mage/core/model/config.php on line 1125 fatal error: call member function getidfieldname() on non-object in /home/ziezap.nl/public_html/app/code/core/mage/core/model/abstract.php on line 151 any ideas how solve this? you can try clear cache - delete of files in /var/cache/, there's chance config cached.

internet explorer - Unable to add cookie to page using Selenium with php -

i'm using phpunit extension phpunit-selenium run test on website using selenium grid, whenever try running tests on internet explorer, error message stating: unable add cookie page (warning: server did not provide stacktrace information) the issue seems stem phpunit-selenium trying, unable set cookie "phpunit_selenium_test_id." i found example code of setting , removing cookies here , , interesting thing code link executes fine on ie, displaying contents of cookie, when try add cookies site, fails. i've tried possible solutions, such getting website before attempting set cookie, , turning "protected mode" off. is there security setting on ie or i'm missing? i ran similar problem running selenium tests in ie9. try setting ie default browser. http://kenhirakawa.com/selenium-unable-to-add-cookie-to-page/

osx - IntelliJ CE 12 won't start on Mac after upgrading Java to 1.7_25 -

i upgraded java 1.6 1.7_25 on mac os 10.6.8 following blog http://timhooker.blogspot.com/2013/05/install-java-jdk7-on-mac-osx-snow.html . when try click on intellij icon on dock, hangs , wont' launch. tried take @ /library/preferences/ideaic12/options/ide.general.xml , make sure not load last project (just in case project crashed). still not working. also tried open terminal: open -a /applications/intellij\ idea\ 12\ ce.app/, it's not working. makes me wonder if intellij 12 ce works on java 1.7 on mac ? change jvmversion 1.7* in /applications/intellij\ idea\ 13\ ce.app/contents/info.plist .

php - Array slice doesn't seems to work -

i'm trying have first file in directory ordered name asc. here code use (php): $dir = "fichiers/123/files_backup"; $premfic = array_slice(array_filter(scandir($dir), 'is_file'), 0, 5); print_r($premfic); but array empty... directory contains 18 files , scandir alone sees them. idea? thanks is_file won't work, because you're not in "fichiers/123/files_backup" . following should work: chdir($dir); $premfic = array_slice(array_filter(scandir('.'), 'is_file'), 0, 5); // may want chdir previous directory // can use getcwd() before chdir() dynamically determine or: $premfic = array_slice(array_filter(scandir($dir), function($filename) use ($dir){ return is_file($dir . '/' . $filename); }), 0, 5); or orangepill pointed out (since glob returns relative path, not filename): $premfic = array_slice(array_filter(glob($dir . '/*'), 'is_file'), 0, 5);

vba - Excel 2010: Need to copy certain cells to different worksheet based on cell value -

i have spreadsheet in excel 2010, wanting take cells in row , copy them worksheet when value entered specific cell in same row. for example: in worksheet a, in cell a2, if "x" entered, want cell a5, a7 , a13-17 copied worksheet b. in worksheet b, should copied next available row, need them copied specific cells (not same in worksheet a- i.e: cell a5 need copy cell 2 in worksheet b; a7 cell 4 , a13-17 10-14). , cells copied in worksheet b need created in new row. i have vba similar; however, copies entire row. above, need specific cells , won't match same cells in worksheet b. here have been able work (to copy entire row): sub testing_issue(byval target range) 'disable events code doesn't re-fire when row deleted application.enableevents = false 'was change made column t? if target.column = 20 'if yes, target read "y"? if target = "y" 'if y, determine next empty row in sheet "test" nxtrw

php - Cant get Laravel 4 to work - Getting Class not found error -

ok, trying create working facade resizer bundle laravel 3 ( https://github.com/maikeldaloo/resizer ). so far have: created "resizer.php" file code reszier bundle , added namespace barthompson\planesaleing; created "resizerfacade.php" contents of contained @ bottom of post; created "resizerserviceprovider.php", contents of contained @ bottom of post; these 3 files saved in: app\library\; added autoloader \app\config\app.php under 'providers' => array reads: 'barthompson\planesaleing\resizerserviceprovider', added alias \app\config\app.php under 'aliases' => array reads: 'resizer' => 'barthompson\planesaleing\resizer', added following directory autoload classmap in composer.json: "app/library" however, can load website successfully, when call resizer::open, following error: class 'barthompson\planesaleing\config' not found i getting confused namespaces. havent u

web applications - Should I use pull (AJAX) or push (WebSocket) to scale for large amount of users? -

i need web app scale 10,000 users. need implement functionality notifies user events, example, job submitted has finished, have new suggestions optimize , on. i'm thinking of 2 implementation strategies: (pull) every minute send ajax request server ask new notifications if there any (push) use websocket , notify user when there new notification which 1 recommended? details web app: the backend language i'm using java running on tomcat 6 (yes, saw tomcat 8 begins support websocket might end having upgrade). the application single-page web app. notification feature not necessary real-time, i'm concerned option more scalable. requests dealt via ajax.

title - Expression Engine- show default entry if url_title not present in url -

{exp:channel:entries dynamic="yes" limit="1"} // code {/exp:channel:entries} dynamic set on, display entry url_title present last segment of url. working fine. i have index page (as channel entry), url_title 'index_page'. want page appear default without last url segment having present. there way like: {exp:channel:entries dynamic="yes" default_url_title="index_page" limit="1"} // code {/exp:channel:entries} spent last hour googling no avail! thanks. rather using embeds (as slow expressionengine down ( http://www.sidd3.com/10-tips-to-optimize-expressionengine-website-for-better-performance/ ), alternate approach using url segments. for example if url_title you're using in segment_2 below: {if segment_2 == ""} <!-- default index page --> {exp:channel:entries dynamic="no" url_title="index_page"} // code {/exp:channel:entries} {if:else}

Is there a way to to see what dates/times tickets changed Status via the JIRA API? -

i trying run queries against jira api , results in can see dates , times each issue went through status change. e.g.: run query grab issues assignee , see, along rest of information, timestamps when each issue changed "open" "resolved". is possible? edit: have tried expanding changelog, while tells me status changes ticket went through (e.g., particular ticket transitioned "open" "resolved" , "resolved" "closed"), doesn't tell me when these transitions occurred. turns out each of transition objects showing status changes have "created" field contains time , date transition occurred, feel bit of misnomer, there is. example object inside "histories" array in expanded changelog object: { "author" : { "active" : true, "avatarurls" : { "16x16" : "https://company.jira.com/secure/useravatar?size=xsmall&avatarid=10072", "24

java - SEVERE: Missing dependency for field : private org.glassfish.jersey.server.wadl.WadlApplicationContext -

can me .. ? m trying create web service jax-rs gives me exception : severe: missing dependency field: private org.glassfish.jersey.server.wadl.wadlapplicationcontext org.glassfish.jersey.server.wadl.internal.wadlresource.wadlcontext here java classe's code: @path("/datajson") public class ressources { @get @produces(mediatype.application_json) public response test(){ string result = "@produces(\"application/json\") output: \n\nf c converter output: \n\n test succesful"; return response.status(200).entity(result).build(); } } --- web.xml part : <servlet> <servlet-name>jersey web application</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.servletcontainer</servlet-class> </servlet> <servlet-mapping> <servlet-name>jersey web application</servlet-name> <url-pattern>/ws/*</url-pattern> </servlet-mapping> ---- jar used :

Console Program in C++ -

this question has answer here: sleep milliseconds 14 answers i messing around c++ console programming. wondering if there way make text appear on console specific amount of time, go more text. essentially, i'm trying create timer object. or if you're familiar python, like import timer print "hello world" timer.sleep(2) print "hello again world" timer.sleep(2) if me this, appreciate it, in advance. there's no built-in c++ functionality this, have resort platform-specific functions. on posix systems (linux, mac os x, bsd, ...) can use sleep <unistd.h> (for delay second resolution) or nanosleep <time.h> (nominal resolution of nanoseconds, worse in practice). on windows, instead, can use sleep api <windows.h> (nominal resolution of milliseconds). ---edit--- as specified in comments, in c++11 ther

php - simple_html_dom find all elements that ONLY contain certain text -

i have: <span>something or other</span> <b>blarg</b> <b>blarg , stuff</b> <span>blarg</span> <em>wakka wakka</em> <em>wakka blarg</em> <em>blarg</em> and want elements contain "blarg" , no other text, so: <b>blarg</b> <span>blarg</span> <em>blarg</em> the important issue here i'm trying check if blarg exists within 1 element alone on page or not. i've had general luck regex i'd rather simple_html_dom can @ child , sibling elements well. does know simplest way simple_html_dom ? a way it, parse every tag, , test if contains 'blarg'... here's working example: $text = '<span>something or other</span> <b>blarg</b> <b>blarg , stuff</b> <span>blarg</span> <em>wakka wakka</em> <em>wakka blarg</em> <em>blarg</em>

wget - Download file to null (Windows CLI) -

i download file null in windows cli testing purposes. in linux used wget http://download.thinkbroadband.com/1gb.zip -o /dev/null this kept connection busy while. is there way in command prompt or power shell in windows 7? also other solutions generate traffic internet,ut withous saving disk, accepted. you can use exact same command on windows cygwin . make sure select wget in package list when installing cygwin

c - Character array Assignment -

this question has answer here: assigning strings arrays of characters 8 answers int main() { char s[]="stack"; s="overflow"; } this not allowed.its gives error.but below code works fine. int main() { char s[]="stack"; strcpy(s,"overflow"); } why happens? the variable s represents pointer string. more specifically, refers memory address of first letter in string "stack" . due reason, operation s="overflow" makes no sense. how can set value of s (a pointer) string? keep in mind c low-level language, have wary of things might seem intuitive not behaving way expect them to.

.htaccess - Rewrite URL in wordpress with subfolders -

i make simple url rewrite can not succeed... here have: i have 3 websites on same hosting. www.websiteaaa.com - regular website, located in '/website-aaa-folder' folder www.websitebbb.com - regular website, located in '/website-bbb-folder' folder www.websiteccc-wordpress.com - wordpress website, , located in '/website-ccc-wordpress-folder' folder i order redirect requests correct domain-filder have .htaccess file in main directory: options +symlinksifownermatch addtype text/html .shtml addoutputfilter includes .shtml #redirect correct folder rewritecond %{http_host} websiteaaa.com$ [nc] rewritecond %{request_uri} !^/website-aaa-folder/.*$ rewriterule ^(.*)$ /website-aaa-folder/$1 [l] #redirect correct folder rewritecond %{http_host} websitebbb.com$ [nc] rewritecond %{request_uri} !^/website-bbb-folder/.*$ rewriterule ^(.*)$ /website-bbb-folder/$1 [l] #redirect correct folder rewritecond %{http_host} websiteccc-wordpres

node.js - hogan.js how to debug a variable -

i'm familiar javascript console.log() , , php_dump() functions allows see what's in variable, want know if there function in hogan.js let inspect content of variable. add method data , include @ loctation need inspect scope var data = { ... // vars, ... inspect: function () { return function () { console.log(this); } } }; template.render(data); anywhere use {{inspect}} log current render context in console

html - Remove space between navbar and jumbotron in Bootstrap 3 -

there space between navbar , jumbotron in bootstrap 3. there space between jumbotron , 3 horizontal thumbnails. want rid of space. have change css , change padding or best way? _header <nav class="navbar navbar-inverse" role="navigation"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div style="font-family:webdings;"> <%= link_to "project", root_path, class: 'navbar-brand' %> </div> </div> <!-- colle

onclick - How to draw selectable lines using java swt -

i wondering if guide me in right direction. writing code using java swt, have 2 composites , connector connecting 2 composites. want able detect mouse click event on both composites , connector. mouse click on composite achieved not sure how achieve mouse click on connector. drawing connector using gc. following code draws line gc gc = new gc(composite); gc.fillrectangle(composite.getclientarea()); gc.setforeground(composite.getdisplay().getsystemcolor(swt.color_black)); gc.setlinewidth(3); gc.drawline(x,y,x,y); the above code draws line between 2 composite (taking starting point , ending point). now, want able detect when user clicks on line connecting 2 composites. there better way connect 2 composite give me ability detect mouse click. i appreciate if guide me towards right direction. thanks, rohith

python 3.x - tkinter sequential execution ordering -

i having trouble code won't execute code @ point. can't describe problem in wording, in code, remaining code under window.mainloop() not run need unless main window (gui) closed problematic. want able print(t.test) when code under def calculate has been executed. technically removing window.mainloop() run code before can gather input vital. need keep structure of coding same shown below well. import tkinter class test: def __init__(self): self.test = false def calculate(window, userinput, t): test = userinput.get() print(test) window.destroy() t.test = true def main(): t = test() gui = tkinter.tk() gui.title("example window") gui.geometry("400x400") userinput = tkinter.stringvar() window = tkinter.toplevel() window.title("entry") tkinter.message(window, text="label", width="200").pack() tkinter.entry(window, width=30, textvariable=userinput).pack() tkinter.button(window, text=&qu

servlets - Java Web application getting Cannot create PoolableConnectionFactory DB2 SQL Error: SQLCODE=-1776 for HADR configured on DB2 -

i have developed web application in i've configured 2 <resource> proper parameters in server.xml of apache tomcat server, using jndi connection pool. among 2 resource tags in server.xml, first tag having details of primary server , tag contains details of standby server. idea if dont connection primary time, i'll switch datasource standby , run query servlet. when ran code, gave me error cannot create poolableconnectionfactory (db2 sql error: sqlcode=-1776, sqlstate= , sqlerrmc=1, driver=3.57.82) i googled lot cant find concrete answer this, 1 thing common in i.e. hadr(hisgh availability disaster recovery) configuration of db2 server. please me out. generally speaking, cannot connect standby database unless assumes primary role after take-over. the correct way of setting db2 hadr cluster configure virtual ip address in cluster management software gets assigned new primary database after take-over; while change remains transparent client applicatio

sql - Reserving mySQL auto-incremented IDs? -

we want obtain auto-increment id mysql without storing until other non-mysql related processes completed, entry not stored if exception or application crash happens. need use id key other processes. in essence want “reserve” auto-increment , insert rows mysql last step. don’t want insert row until know entire process has completed successfully. is possible sort of auto-increment reservation in mysql? note: know sql transactions. our process contains non-sql stuff need happen outside of db. these process may take few mins several hours. don't want other process using same auto-increment id. why want "reserve" auto-increment id without inserting data db. – the way generate auto-increment value attempt insert. can roll transaction, , still read id generated. in mysql 5.1 , later, default behavior auto-increment values aren't "returned" stack when roll back. start transaction; insert mytable () values (); rollback; select last_insert_id() @m

asp.net - Ajax request is too slow -

i have page need click number in table read table accordingly database. used use asp gridview generate second table. tried use jquery ajax. when need request 20,000 records, jquery ajax extremely slow (about 6 seconds load) while asp gridview faster. aspx.vb <scriptmethod(responseformat:=responseformat.json)> _ <webmethod()> _ public shared function getorderdetail(byval id string) string dim ordernum integer = integer.parse(id) dim sbtable new stringbuilder dim sql new stringbuilder sql.append("select oh.[orderno], od.[style], s.[styledesc],od.[color], c.[colordesc], od.[size],") sql.append(" sum(convert(decimal(12,0),od.[totalqty])) 'item_total', och.[trackingno]") sql.append(" [orderheader] oh inner join [test1] ocd") sql.append(" on oh.[orderno] = ocd.[orderno] inner join [test2] och") sql.append(" on ocd.[fkey] = och.[pkey] inner join [test3] od") sql.append("

java - Why we call unbounded wild-card parameterized type as reifiable? -

i reading through angelikalangerdoc . reading after gap of 3 days. in earlier lesson, learnt that, arrays of unbounded wild card allowed created. studied unbounded wild-card parameterized types called reifiable types . when searched definition of reifiable type, states that, type type information known @ run-time called reifiable type . picking code snippet article. pair<?,?>[] inipair = new pair<?,?>[10]; i have following confusion in mind. why unbounded wild-card parameterized type called reifiable? in example above, how type information known? i know it's basic question. trying refresher on track of generics. can elaborate on issue? since java compiler replace unbounded type parameters object . according type erasure to implement generics, java compiler applies type erasure to: 1.replace type parameters in generic types bounds or object if type parameters unbounded. produced bytecode, therefore, contains ordinary classes, inte

c# - Append string to another string after a specified character -

i have string a="<tr>i'm working in c#<tr/> abcdefghjiklmnopqr ii oo yy uu hh gg rr" , , b="<td>finish</td></tr>" . need string a a="<tr>i'm working in c#<tr/> <td>finish</td></tr> abcdefghjiklmnopqr ii oo yy uu hh gg rr". how append string in string above? asked same question earlier wrong. here have find first ">" charcter , append b in a. please help. you looking string.format : string = "i'm working in c#"; string b = "finish"; = string.format("<tr>{0}<tr/> <td>{1}</td></tr>",a,b); see here how use first parameter: http://msdn.microsoft.com/en-us/library/txafckwd.aspx

c++ - Displaying FPS in GLFW window title? -

im trying fps display in window title program not having it. my fps code void showfps() { // measure speed double currenttime = glfwgettime(); nbframes++; if ( currenttime - lasttime >= 1.0 ){ // if last cout more 1 sec ago cout << 1000.0/double(nbframes) << endl; nbframes = 0; lasttime += 1.0; } } and want go after version here window = glfwcreatewindow(640, 480, game_name " " version " ", null, null); but cant call void i have convert char ? or ? there's istringstream trick: template< typename t > std::string tostring( const t& val ) { std::istringstream iss; iss << val; return iss.str(); } or boost.lexical_cast . you can use std::string::c_str() null-terminated string pass in glfwsetwindowtitle() .

sorting - Object iteration in reverse (javascript) -

how can iterate on javascript object, front. the object looks this. {"33":140, "34":100, "35":120, "36":200} i want display this... 36 | 200 35 | 120 34 | 100 33 | 140 i tried sorting first displaying, sorts second number, not key. how either iterate front, or reverse sort based on key. i realize pretty simple, im getting pretty frustrated it.... a modern version this: object.keys(obj).sort(function (a, b) { return number(b) - number(a); }).foreach(function (current) { console.log(current + ' | ' + obj[current]); }); similarly, little bit more code, written older browsers, too. or use shims.

java - how can I hook into a stream of 802.15.4 frames? -

using packet sniffer able detect , read "hello word" payload within 802.15.4 frame . it's great can see frames in sniffer, i'm @ point parse payload out , useful things it. i wondering if community point me sample c/c++/java (or labview, doesn't matter) code uses hardware (like xbee ) , can parse out payload in order useful operations. is possible use packet sniffer have purpose? i appreciate / advise. edit: have written better tool this: https://github.com/andrewdodd/pyccsniffer if still interested there few tools can receive sniffed packets in more friendly environment. i "wrote" 1 such tool combining 2 others available on github. see here more info https://github.com/andrewdodd/ccsniffpiper . nb: have careful version of firmware have loaded on sniffer, ti change format of bytestream time time.

indexing - R conditional replacement data frame values -

i want update dataframe column (df$d) result of mathematical operation on 1 or more other columns (df$b, df$c), conditional on value of column (df$a). set.seed(55) df <- data.frame(a = rnorm(10), b = rnorm(10), c = rnorm(10), d = 0) df$d[df$a > 0] <- df$b[df$a > 0] / df$c[df$a > 0] the third line produces expected values df$d. there way write more succinctly? i'm interested in options not require me repeat logical index. for example, style of expression works in python/pandas , requires 1 instance of '[df$a > 0]' on left-hand side of assignment operator: df$d[df$a > 0] <- df$b / df$c thank , advice. use data.table instead , life better: library(data.table) dt = data.table(df) # or construct same way: dt = data.table(a = rnorm(10),...) dt[a > 0, d := b/c]

visual studio 2012 - General-purpose, open-source tree vizualizer -

i consistently implement itreenode interface on tree structures. excellent have vizualizer available when debugging display tree structure in treeview. apart writing own scratch, there open source vizualizer out there adapted recognize itreenode interface? take @ jsonviewer @ http://jsonviewer.codeplex.com/ provides tree visualizer json string. have modified same project use visualize objects tree , can try same.

php - Return all records of non-given id if just one of those records matches the given id of another field -

after searching damn long time, i've not found query make happen. i have "offers" table "listing_id" field , "user_id" field , need records listing_id's @ least 1 record matches given user_id. in other words, need query determines listing_id's given user involved in, , returns offer records of listing_id's regardless of user_id. that last part problem. it's getting other user's offer records return when i'm providing 1 user's id , no listing id's i thinking of first determining listing_ids in separate query , using php loop create clause second query consist of bunch of "listing_id = $var ||" couldn't bring myself because figured there must better way. hopefully easy , reason has escaped me because i've had head ass. happy 1 behind me. thanks taking time. josh you 2 queries playing along on mysql side, this: select * offers listing_id in (select listing_id offers user_id =

How can I list app engine datastore parent values with python? -

not sure if on title should have said parent values or ancestors, here trying do. i learning use python in google app engine. while reviewing content of this page in guestbook tutorial, wondering if enhance listing possible guestbooks created. to give bit of context, how sample code works. application renders page allows create guestbook entry, switching/creating new guestbooks current or future entries. thought simple add ability list stored guestbooks dynamically generate list of links see each one. i thought simple, trying , can't figure out. how query datastore give me list of "guestbooks" available can build links dynamically? if guestbook called guestbook_2 url looks "?guestbook_name=guestbook_2". here code of application (i added string "insert list here" want addd list of links mentioned): import cgi import urllib google.appengine.api import users google.appengine.ext import ndb import webapp2 main_page_footer_template = &quo

javascript - brightcove not showing when rendered (not page refresh - plain Backbone.js View re-render) -

tldr; video player doesn't show on re-render (backbone view) is there global state brightcove keeps? i'm using backbone.js , rendering page using backbone view jst.ejs template. works first time around. if navigate next page , back, doesn't show anymore. <script language="javascript" type="text/javascript" src="http://admin.brightcove.com/js/brightcoveexperiences.js"></script> <script> window.bcvideo = bcvideofunction(); //bcvideofunction module pattern. </script> <object id="bc_experience" class="brightcoveexperience"> <param name="includeapi" value="true" /> <param name="templateloadhandler" value="bcvideo.ontemplateload" /> <param name="templatereadyhandler" value="bcvideo.ontemplateready" /> <param name="bgcolor" value="#ffffff" /> <param name="width" va

algorithm - Is this MSP an instance of the TSP? -

Image
in book, the algorithm design manual , steven s. skiena poses following problem:              now consider following scheduling problem. imagine highly-indemand actor, has been presented offers star in n different movie projects under development. each offer comes specified first , last day of filming. take job, must commit being available throughout entire period. cannot simultaneously accept 2 jobs intervals overlap. for artist such yourself, criteria job acceptance clear: want make money possible. because each of these films pays same fee per film, implies seek largest possible set of jobs (intervals) such no 2 of them conflict each other. for example, consider available projects in figure 1.5 [above]. can star in @ 4 films, namely “discrete” mathematics, programming challenges, calculated bets, , 1 of either halting state or steiner’s tree. you (or agent) must solve following algorithmic scheduling problem: problem: movie scheduling problem

c++ - visual studio Dll and Matlab -

i trying build dll visual studio can use in matlab ... tried thausand codes no solution !!! working on matlab 2013(32and64) , vs2010 ! tried example write code way ... //the header #ifndef simpleh_h #define simpleh_h #ifdef __cplusplus extern "c" { int sq(int x); #endif #ifdef __cplusplus } #endif #endif //the func(example) #include "simpleh.h" int sq(int x) { return (x*x); } visual studio build , make th dll file matlab doesn't see function ... should /* stucked :( */ in advance ... example: take following files, , build dll in visual studio. helper.h #ifndef helper_h #define helper_h #ifdef _win32 #ifdef export_fcns #define exported_function __declspec(dllexport) #else #define exported_function __declspec(dllimport) #endif #else #define exported_function #endif #endif simple.h #ifndef simpleh_h #define simpleh_h #include "helper.h" #ifdef __cplusplus extern "c&

c++ - embedded python passing unicode strings -

note works great if use ascii, but: in utf8-encoded script have this: print "frøânçïé" in embedded c++ have this: pyobject* cpython_script::print(pyobject *args) { pyobject *resultobjp = null; const char *utf8_strz = null; if (pyarg_parsetuple(args, "s", &utf8_strz)) { log(utf8_strz, false); resultobjp = py_none; py_incref(resultobjp); } return resultobjp; } now, know log() can print utf8 (has years, debugged) but actually prints this: print "frøânçïé" fr√∏√¢n√ß√Ø√© another method use looks this: kj_commands.menu("控件", "同步滑帧", "全局无滑帧") or kj_commands.menu(u"控件", u"同步滑帧", u"全局无滑帧") and in c++ have: superstring scpyobject::getas_string() { superstring str; if (pyunicode_che

python - Numpy / Matplotlib - Transform tick data into OHLCV -

i have tick data wold transform in ohlcv(open, high, low, close, volume) daily, hourly, 15min, 5min, 1min. the tick data have this: array([[u'2011-08-18 13:37:25', u'10.9', u'0.48990826'], [u'2011-08-19 13:19:24', u'11.85', u'0.08438819'], [u'2011-08-19 16:45:01', u'11.5', u'0.4'], ..., [u'2013-08-24 01:29:27', u'107.97', u'0.18523664'], [u'2013-08-24 01:29:35', u'107.98', u'4.61659567'], [u'2013-08-24 01:30:56', u'107.98', u'0.09339562']], dtype='<u19') the numpy array have (date, price, volume). i got data nympy array code: import matplotlib.pyplot plt import sqlite3 import numpy np database = sqlite3.connect('database.db') cursor = database.cursor() # criar o cursor cursor.execute("select date, price, amount table order date asc") ar=[[r[0], r[1], r[2]] r in cursor.fetchall()

javascript - XMLhttpRequest with a node js server with express -

for reason don't know can't use xmlhttprequest in local server created in node js , express. let me show you... here server in node js: var express = require('express'), app = express.createserver(); app.get('/count', function(req, res) { res.type('text/plain'); res.write('hello!') res.end(); }); app.listen(4003); and runs jus fine! when acess localhost:4003/count see "hello!". now server o.k, let's check html page: <script> var xmlhttp = new xmlhttprequest(); var resp = "" xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate==4 && xmlhttp.status==200){ resp = xmlhttp.responsetext; } } var cam = "localhost:4003/count" function show(){ xmlhttp.open("get",cam, true); xmlhttp.send(); alert(resp); } </script> <center><h1><div style="color:#339966"> <input type="button"

c# - Union Multiple Classes, Sort on Common Interface -

this question chiefly linq , possibly covariance. two of entities implement idateditem interface. i'd union, sort these, enumerating single list. must retain entity-specific properties @ enumeration-time. to clarify example, 1 approach tried was: context.table1.cast<idateditem>(). union(context.table2.cast<idateditem>()). sortby(i => i.date). foreach(u => customrenderselector(u, u table1)); in trying various ways, i've run various errors. linq entities supports casting edm primitive or enumeration types. unable process type '.idateditem[]', no known mapping value layer unable create constant value of type 'idateditem'. primitive types etc. the bigger picture: the idateditem interface shown here simplification of actual shared properties. in practice, tables filtered before union. the entity-specific properties rendered, in order, in web page. in parallel feature, serialized json result hierarchy. i'd able perfor

javascript - Node.js Express with Azure Bad Request -

i started website on azure , getting bad request errors unknown reason. thing isn't first website , i've encountered before, can't time! maybe i'm tired or something, can me out? following files things i've changed. server.js /** * module dependencies. */ var express = require('express'); var routes = require('./routes'); var azure = require('azure'); var http = require('http'); var fs = require('fs'); var path = require('path'); var app = express(); var index = require('./routes/index'); app.configure(function(){ app.set('port', process.env.port || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'

error ocuring while connecting to android and php with mysql -

i have following code in post_item.java file: package com.iwantnew.www; import java.util.arraylist; import java.util.list; import org.apache.http.namevaluepair; import org.apache.http.message.basicnamevaluepair; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.edittext; public class post_item extends activity { private progressdialog pdialog; jsonparser jsonparser = new jsonparser(); button add_room; edittext contact_no; edittext no_of_room; edittext price_per_room; edittext description; private static string url_create_product = "http://10.0.2.2/android_iwant/android_add_room.php"; private static final string tag_success = "success"; @override protec

javascript - Is there a simple way to only reload an element if it content has changed? -

i using rightjs (very similar jquery) on site i'm working on. loading element on page result of request so: var comp = $('completed_step'); if(comp != null) comp.load("/brew/completed_step"); this works trying find way load element if result of request 'brew/current_step' different value loaded in element. there easy way accomplish that? you need compare value of current element loaded. var comp2; var comp = $('completed_step'); //i'm assuming refers value if( comp != null || comp != "" ){ comp2 = load("/brew/completed_step"); } if( comp != comp2 ){ comp = comp2; } keep in mind, i'm not familiar rightjs, might wrong, should give right idea. edit: it looks xhr module in rightjs takes object allows specify when process has completed. http://rightjs.org/docs/xhr#load xhr.load('/some/url', { onsuccess: function(request) { // } }); that's example in documentation.

android - SSO (Singe Sign-On) not working when Facebook app is installed on device -

i developing android app integrates facebook. app works fine when set loginbutton.setloginbehavior(sessionloginbehavior.suppress_sso). the problem arises when try use sso. error below. used similar error when used incorrect keyhash; not case anymore because webview log in works fine. event more surprising android app works if app installed in fb. example, app manager therefore gets installed in facebook profile default, when try fb account doesn't have app installed doesn't work. when attempt log in error below appears , dialog telling me basic permissions granted, in reality not basic permissions. i have submitted app review in order shown on app center. when that, dialog shows checkbox acknowledge app uses sso. facebook need approve app before can use sso (if so, doesn't make sense) i have spent hours trying solve this, , can't find solution. please help. 08-24 01:39:16.058: w/bundle(21880): key com.facebook.platform.protocol.protocol_version expected stri