Posts

Showing posts from July, 2015

xaml - How can I bind a ContextMenu inside a DataTemplate to the DataContext of the parent ListBox -

i have contextmenu (from silverlight toolkit) inside datatemplate used itemtemplate of listbox: <datatemplate x:key="billitemdatatemplate"> <grid margin="0,0,0,12" x:name="itemgrid"> <kit:contextmenuservice.contextmenu> <kit:contextmenu> <kit:menuitem header="delete item" command="{binding ???????.deleteitemcommand}" commandparameter="{binding}" /> </kit:contextmenu> </kit:contextmenuservice.contextmenu> [...] </grid> </datatemplate> how can tell contextmenu.command bind property on view-model exposed outer datacontext (i.e. 1 applies listbox)? if i'm right, cannot use wpf relative declarations explained here . i prefer if child view-models wouldn't require reference "parent" view-model. use can use elementname bindings. don't have code here can like ...

html5 - Canvas consumes a lot of memory -

i having difficulties canvas-implementation open in overlay. canvas element 760px wide , 2640px high (i know, don't ask). i drawing lines @ every 27.5px high. ctx.moveto(0, y); ctx.lineto(760, y); ctx.strokestyle = 'rgb(100,100,100)'; ctx.stroke(); appearantly browser seems 'choke' on when creating canvas. comes through (1-5secs) , memory raised 20mb. closing overlay not seem free memory. when reopen overlay (which redraws canvas), memory again increased. , on, , on... chrome process goes 60mb memory 600+ in no time way. resizing canvas 264px high , drawing lines @ every 2.75px goes way faster , consumes 4mb (which not seem cleared of course). who has pointers on how avoid this. here more code data array of objects containing entries property array. [ { entries : [{...},{...},...] }, {...}, ... ] var $canvas = container.find('canvas') , canvas = $canvas.get(0) , maxy = canvas.height , maxx = canvas.width , dx = maxx / (d...

wpf - ListBox binding DataTemplate item to ItemsPanel Canvas.Left/Top -

Image
i have listbox canvas itemspanel. items in list labeledarrows: labeledarrow view model class (non visual) exposes properties start_x, start_y (arrow start), end_x, end_y (arrow head) , box_x, box_y (box possition) listboxitem datatemplate labeledarrow shown below. binding of arrowline x1, y1, x2, y2 labeledarrow start_x, start_y etc properties works fine because arrowline has exposed coordinate properties (x1 etc). box textblock have somehow set canvas.top , canvas.left attatched properties possition - binding shown below doesn't work. ideas? do need resort wrapping labeledarrow usercontrol? <listbox.resources> <datatemplate datatype="{x:type tp:labledarrow}"> <grid> <tp:arrowline stroke="red" strokethickness="2" x1="{binding path=start_x}" y1="{binding path=start_y}" x2="{binding path=end_x}" y2="{binding path=end_y}" /> <textblock ...

SQL Server Profiler - Error Details -

i enabled whole error-section says smth like: exception: error converting data type nvarchar datetime. it's know, what's details? wanna know particular query caused , other verbose information. there way attain this? i checked sql statement starting/completed, sp starting/completed etc. more should enable make show more details need? if have ability to, when begin profile session, select tsql_replay template. provide details need.

java - JButton's border don't go away even when set the Border to EmptyBorder -

Image
i designing gui using eclipse on mac, , want make jbutton display icon set. looks fine on mac os, when export jar file, , rut in on windows os, jbutton looks this: the borders emptyborder . what did wrong? how can make square @ go away? to answer question correctly, sscce required. anyway, believe you'll want invoke setcontentareafilled(false) on jbutton instances. should remove "square". however, important note exact behavior of calling function varies on component-by-component , l&f-by-l&f basis. import javax.swing.borderfactory; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.swingutilities; import javax.swing.uimanager; public final class jbuttondemo { public static void main(string[] args){ swingutilities.invokelater(new runnable(){ @override public void run() { createandshowgui(); } }); } private static void c...

c# - How to display data from a SQLite database into a GTK# TreeView? -

os: opensuse 11.4 ide: monodevelop 2.4.2 using gtk# i need display datatable of sqlite database in simple grid view, in windowsforms'/wpf's datagridview, gtk#. have been trying configure gtk.treeview display data properly, no luck. data not displayed , obscure error in application output. here code: type[] types; sqlitecommand cmd = new sqlitecommand("select * "+tables.users, _cddapconn); cmd.connection.open(); sqlitedatareader reader = cmd.executereader(); types = new type[reader.fieldcount]; for(int = 0; < types.length; i++) types[i] = typeof(string); gtk.liststore list = new gtk.liststore(types); for(int = 0; < tblusers.schema.length; i++) { table.appendcolumn(tblusers.schema[i], new gtk.cellrenderertext(), "text"); } while(reader.read()) { string[] rowdata = new ...

java - Listening on multiple sockets (InputStreamReader) -

i'm having problem little game i'm designing in class. problem got 2 clients connected server. (client1 , client2) each running game, in end, closes window. game window jdialog, then, when it's closed, send message, through socket, server, telling it's done. want server know of 2 clients completed first. reporting through printwriter on sockets' outputstream. did this: in1 = new bufferedreader(new inputstreamreader(client.getinputstream())); in2 = new bufferedreader(new inputstreamreader(client2.getinputstream())); try { in1.readline(); } catch (ioexception ex) { logger.getlogger(gameserver.class.getname()).log(level.severe, null, ex); } try { in2.readline(); } catch (ioexception ex) { logger.getlogger(gameserver.class.getname()).log(level.severe, null, ex); } problem waits first input, before starts listening on second. how can make listen on both @ same time? or solve problem other way. thanks...

Runtime Errors when reversing a list in Prolog -

following learning exercises/tutorials online encounter bellow error when running simple prolog program. testreverse :- transimage(reserselist,'imagein.pgm','imageout.pgm'). transimage(r,in,out) :- read_pgm(in,pgm), transf_pgm(r,pgm,pgm2), write_pgm(out,pgm2). transf_pgm(r, pgm(a,b,h,w,m,l), pgm(a,b,h,w,m,l2)) :- term =.. [r,l,l2], call(term). reserselist([],[]). reserselist([x|r],reversed):- reserselist(r, revlist), append(revlist,[x],reversed). and runtime error getting in swi-prolog is 10 ?- testreverse | . error: read_pgm/2: undefined procedure: fread/4 error: however, there definitions for: error: read/1 error: read/2 any ideas why? new prolog, literally 2 days online tutorials, accept apologies in advance if make further questions regarding answer. thank you. according error message havent defined fread/4. on other hand, in code gave read_pgm/2 not defined either (unless i'm missing someth...

runtime.exec - java Runtime process - check if waiting for input -

i wish create process using java's runtime: example. process proc = runtime.getruntime().exec("cmd"); then, want somehow wait process until in 'ready input' state, verify has finished of work. anyway on how it? one thing possible echoing "---finished---" , checking if line written using stdin of process. dislike idea. is there better (more formal) approach this? by way, need effect descriobed it. want wait before writing new commands batch file. thank you. here couple ideas. hinge on whether or not program you're running expects read , write stdin , stdout. there's no need wait "ready input" state once you've launched process. if need send commands, use getoutputstream , write them. if other program still getting ready, data you've written happily sit in buffer until program reads stdin. using processbuilder let control arguments , environment. example direct javadocs: processbuilder pb = new...

css - IE5.5 Filters - why is filter: gradient(properties) not available, while filter: alpha(properties) is? -

here's question experts out there. when ie5.5 launched, came range of new filters, such as: filter:progid:dximagetransform.microsoft.gradient(sproperties). later versions of ie supports shorter method enabling alpha-transparency: filter: alpha(opacity = 50); does have explanation, why ie doesn't support shorter method gradient, e.g. filter: gradient(startcolor, endcolor) ? the whole filter style proprietary microsoft , ie, , has never been subject kind of external standardisation process. therefore choice of syntax , supported or not entirely down whims of microsoft. one thing worth knowing filter:progid:.... syntax is invalid css, due colon after progid . have seen cases syntax has caused serious parsing errors in other browsers. (in 1 case, firefox 3.6 refused parse further down stylesheet after encountering rotation filter ) this sort of issue may possibly have been part of motivation providing shorter alternative syntaxes, since @ least syntac...

Is there any handy converter between html odf ooxml and rtf? -

question1 is there lib can convert between ooxml , html, mean ooxml2html , html2ooxml both. question2 and there lib can convert between odf , html(odf2html html2odf) question3 and there lib can convert between html , rtf(rtf2html html2rtf) i want write wyswyg online writer, can edit ooxml odf, think need converter first. can 1 help? many thanks! have tried opendocument-user mail list of oasis? http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#feedback archive available here: http://lists.oasis-open.org/archives/opendocument-users/ the know sorts of tools odf on there. :o)

java - Multiple tables in a DB SQLite -

i working 1 table , program ok, have add table database, , logic code : package net.shamanoperativo; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqlitedatabase.cursorfactory; import android.database.sqlite.sqliteopenhelper; public class usuariossqlitehelper extends sqliteopenhelper { //sentencia sql para crear la tabla de incidentes string sqlcreate = "create table incidentes ( idinterno integer primary key , codreg text, codgr text, entidad text, codinc text, loc text, dom text, sint text, movil text, sexo text, edad integer, estado text, latitud double, longitud double,colorloc text, colorgr text )"; string sqlcreate2 = "create table moviles (idinterno integer primary key, nummovil text, colmovil text, estado text, localidad text, cantserv integer)"; string sqlcreateindex = "create unique index idxidinterno on incidentes(idinterno)"; public usuariossqlitehel...

windows - how to bundle dependencies in exe -

often exe's have dll dependencies package installer nsis or inno . makes sense large programs overkill small scripts. is there alternative way bundle dependencies, user can execute single exe , not require directory of dll's in path? edit i hoping solution won't depend on type of dll's, , work other kinds of dependencies too. here potential options: http://www.adontec.com/index.htm?go=/runtimepacker_e.htm http://boxedapp.com/ http://www.filetransit.com/view.php?id=16640 does have experience tool this? ok, didn't either of other 2 ideas... here goes... you ship , give customers "stub exe". stub exe doesn't depend on else , contains zip file (or setup package or similar) resource in stub exe. zip file embedded in stub exe contains actual program exe , dependent dlls. when stub exe runs, unpacks zip file temp sub-directory , launches application exe. you optimize such if app has been installed in %temp%, skip unpacki...

c - start time of a process on linux -

how find process start time on ubuntu linux machine using c language. in linux there /proc/[pid]/stat file give information starttime %lu /*the time in jiffies process started after system boot*/ , file /proc/stat gives btime %lu /*measurement of system boot time since epoch in seconds*/ for adding both these values how can convert former value seconds because in jiffies unit. jiffies per second configurable when 1 compiles linux kernel. the following program uses number of jiffies per second on kernel you're running. takes optional command line parameter, process number. default process number of running program itself. each second, outputs start time of specified process, both local time , utc. reason repeat loop demonstrate value doesn't change. #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unist...

php - How to return the result of a function in the same page using jQuery? -

this simple don't seem able make happen in codeigniter. using simple php should be: <form id="volume" method="post" action="<?php echo $php_self;?>"> <label>length(cm):</label> <input type="text" name="length"> <label>width(cm):</label> <input type="text" name="width"> <label>height(cm):</label> <input type="text" name="height"> <button type="submit">submit</button> </form> <?php $length = $_post["length"]; $width = $_post["width"]; $height = $_post["height"]; $variable = 5000; $sum_total = ($length * $width * $height) / $variable; printf ("%01.2f" , $sum_total); ?> kg i put form in view, php in controller want return result in same page instead of redirecting me. thank in advance responses. put jquery similar on page submit butt...

How to set onchange of two dropdown in JQuery & CodeIgniter -

i'm using codeigniter , have question in setting onchange on 2 dropdown using jquery, here code : <? function generateselect($name = '', $options = array(), $code) { $html = '<select name="'.$name.' id="'.$name.'"">'; foreach ($options->result_array() $row) { if ($row[$name] == $code) { $html .= '<option value='.$row[$name].' selected>'.$row[$name].'</option>'; } else { $html .= '<option value='.$row[$name].'>'.$row[$name].'</option>'; } } $html .= '</select>'; return $html; } echo '<div id="actype"><table cellpadding=2 cellspacing=2 border=1><tr><td>ac type</td><td>'.generateselect('actype', $query_1, $actype).'</td>'; echo '<div id="acreg"><tr><td>ac reg</t...

java - hibernate : parent contains a collection of children, when child is deleted/saved I want to automatically "refresh" parent's collections -

so if child created or deleted, want remove/add collection on parent without manually calling accessing collection or retreving new parent object session. is possible? it's of responsibility maintain coherence of object graph. if create child referencing parent, should add child parent's collection. hibernate won't you. thereis no reason call merge on parent, though: goal of merge copy state of detached entity attached versioin, , don't see has problem.

c# - How can I split a string to obtain a filename? -

i trying split string. here string. string filename = "description/ask_question_file_10.htm" i have remove "description/" , ".htm" string. result looking "ask_question_file_10". have "/" , ".htm" appreciate help. you can use path.getfilenamewithoutextension method : string filename = "description/ask_question_file_10.htm"; string result = path.getfilenamewithoutextension(filename); // result == "ask_question_file_10"

How to integrate Google + in my android application? -

possible duplicate: android integrate google+ in app how make google + integrate in android application? , saw post in wall... thanx. you can try http://code.google.com/p/google-plus-java-api/ (haven't tried on android though)

objective c - UITableView delegate not called when UIViewController is popped -

i have view controller contains uitableview. when view controller gets pushed onto stack, table view delegate methods called , populates table. then push view controller onto 1 contains table view. make happen - when second view controller gets popped , return previous view controller, uitableview delegate methods called again (so repopulate table). in other words, how repopulate uitableview when popping view controller. thanks in viewdidload or viewdidunload , viewwillappear , viewwilldisappear (whichever of these right situation) can put [mytable reloaddata]; : // if can include code bit uncertain // trying question // should use whichever of these correct project: - (void)viewdidload { [super viewdidload]; [mytable reloaddata]; } - (void)viewdidunload { [mytable reloaddata]; } - (void)viewwillappear { [super viewwillappear]; [mytable reloaddata]; } - (void)viewwilldisappear { [super viewwilldisappear]; [mytable reloaddata]; } ...

iphone - upgrade version of an application -

i want know things need in developing upgrade version of application (like bundle version) if user download upgrade version of application update old version. i have develop upgrade version of app in old version , changed version no. need data of old app remains there. all data in document directory not touch when upgrading. files in bundle copies new version.

java - String.format() is not working? -

here code: timeformat = string.format("%02d:%02d:%02d",hoursformat, minsformat, secsformat); hoursformat , minsformat , , secsformat int s this gives compilation error: unresolved compilation problem: method format(string, object[]) in type string not applicable arguments (string, int, int, int) does know why string.format() not working way? i had similar problem printf. using jdk 1.6.0_27. setting compliance level 1.6 solved issue. can set in following way. project > properties > java compiler you can refer following thread: why getting compilation errors simple printf?

Jumping to source while editing scala with vim -

i edit scala code vim because of developmental state of scala plugin eclipse. find suitable of purposes, in screen instance continuous compilation ( mvn scala:cc or ~compile in sbt) in bottom pane. the feature miss being able jump source easily. know of way in vim? should theoretically possible since dependencies avaiable using maven/sbt. this question related https://stackoverflow.com/questions/3626203/text-editor-for-scala , question closed, , answer use emacs, consider if viper makes sense. edit: wrote blog post explores using vim full-featured editor scala. use ctags. vim has build-in support it(since ctags made vim), need download program . ctags doesn't come scala support, can configure support it (not scala user myself, haven't tested it). you use create tags file source files, , can use definition of function/class/everything in source code. ctrl+] jump tag under cursor. ctrl+w , ] open tag @ new window. :tag xxx jump definition of xxx. ...

html - Firefox 4.0 does not show type to be "application/xhtml+xml" -

i have following code. <?xml version="1.0" encoding="utf-8" standalone="no"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" > <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <title>title</title> <link rel="stylesheet" href="style.css" /> <script src="script.js" type="javascript"></script> </head> <body> <p>this paragraph</p> </body> </html> when load page in firefox 4.0, click on tools > page info, shows type="text/html". mean the document being served mime type of text/plain. if so, how serve mime type of application/xhtml+xml? thanks in advance. it me...

c# - 2 rich edit controls, same text -

i've put 2 rich edit controls, should display same text. so, when edit text in 1 of them, other should reflect changes. problem - don't want put code in text changed event: control1.rfttext = control2.rtftext because create new instance of string each time text edited. is there way send same instance of string both of controls or there other solutions problem? control1.rfttext immutable string if want modify it, you'll have create new string. using control1.rfttext = "my new string" create new string , appoint rfttext field said. if serious optimizing sort of value assignments, can create own implementation of derived rich edit class use sort of stringbuilder logic, or may internally represent text char[] array , modify that, may turn out real challenge, decide wisely.

android - How to change colour in TabHost -

i doing application tabhost formate, tab displaying default color, there possibility change default color our own color.? got ideas google, tabhost.setontabchangedlistener(new ontabchangelistener(){ @override public void ontabchanged(string tabid) { // todo auto-generated method stub for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { tabhost.gettabwidget().getchildat(i).setbackgroundcolor(r.color.transparent); //unselected } tabhost.gettabwidget().getchildat(tabhost.getcurrenttab()).setbackgroundcolor(color.parsecolor("#000011")); // selected } whenever doing getting force close error. if having idea of changing background color, pls guide me. you need first change default appearence for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { if (i == 0) tabhost.gettabwidget().getchildat(i).setbackgroundcolor(color.parsecolor("#ffffff")); el...

database - nosql db for python -

what popular nosql databases used python ? know there few options explained @ http://nosql-database.org/ python programmers use ? thanks most of nosql databases have python clients actively supported. pick database based on usage needs. using python shouldn't problem. name few: cassandra: https://github.com/datastax/python-driver riak: https://github.com/basho/riak-python-client mongodb: http://api.mongodb.org/python/current/ couchdb: http://wiki.apache.org/couchdb/getting_started_with_python redis: https://github.com/andymccurdy/redis-py

jpa - Can't clear a list of related entity beans from an entity bean -

i'm trying run code below, keep getting error "cannot merge entity has been removed". my db tables this: banner -id banner_period -id -banner_id -date my java code: banner b = getentitymanager().find(banner.getid()); list<bannerperiod> bps = b.getbannerperiodlist(); (bannerperiod bp : bps) { getentitymanager().remove(bp); } // <-- removed code adds periods here b.setbannerperiodlist(bps); getentitymanager().merge(b); i can't seem understand logic in this. explain is, i'm missing here? i've tried search answers already, find hard define keywords give me relevant results. update: banner entity: @onetomany(cascade = cascadetype.all, mappedby = "bannerid") private list<bannerperiod> bannerperiodlist; bannerperiod entity: @joincolumn(name = "banner_id", referencedcolumnname = "id") @manytoone(optional = false) private banner bannerid; list<bannerperiod> bps still contains refe...

mocking - PHPUnit mock with multiple expects() calls -

using phpunit, wonder how can have multiple expectation same stub/mock. for example, want test mock have method display() called , return null. want test method process() called. in fact test called testprocessiscalledifdisplayreturnnull() . so need setup 2 expectations on same mock object, , manual doesn't :( if know, method called once use $this->once() in expects(), otherwise use $this->any() $mock = $this->getmock('nameofthecalss', array('firstmethod','secondmethod','thirdmethod')); $mock->expects($this->once()) ->method('firstmethod') ->will($this->returnvalue('value')); $mock->expects($this->once()) ->method('secondmethod') ->will($this->returnvalue('value')); $mock->expects($this->once()) ->method('thirdmethod') ->will($this->returnvalue('value'));

asp.net mvc - how can i pass a "&" into a querystring value -

i have link in app following url: http://www.mysite.com/test?group=mygroup the issue 1 of groups called group & b when try , parse on serverside (through request.querystring["group"]) http://www.mysite.com/test?group=group & b i get group='group ' (because of &) how can change url can deal values "&" inside of them. use urlencode method make text safe querystring. var url = "http://www.mysite.com/test?group=" + system.web.httpserverutility.urlencode("group & b");

java - Problems with loop / equals == -

i have following bit of code having difficulty with. expectation output should applicant # correlated test score. first position of both arrays answer key. not quite sure going wrong this, appreciated. public class applicantcheck { //* main method public static void main(string[] args) { int = 0, j = 0, correct; //* initialization of applicant id's , answers int[] appid = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; char[][] appanswers = { {'n','y','n','n','y','n','n','y','n','y'}, {'n','y','y','n','y','n','y','y','n','y'}, {'n','y','n','y','n','y','y','y','n','n'}, {'n','y','y','n','y','y','y','y','y','y'}, {'y','y','n','n...

javascript - Js Password Array -

my homework "create basic web page update assignment 3.4. create array store @ least 8 valid passwords. then, ask user password using prompt dialog. utilize for-loop navigate password array. if user's input matches string in array, give them feedback password valid. otherwise, let them know invalid. you not have include feature give them chance re-enter password. can one-time search of password array." this javascript class... far have this: var accepted_passwords = new array ( ); accepted_passwords[0] = "saginaw"; accepted_passwords[1] = "bay city"; accepted_passwords[2] = "midland"; accepted_passwords[3] = "reese"; accepted_passwords[4] = "millington"; accepted_passwords[5] = "frankenmuth"; accepted_passwords[6] = "sheilds"; accepted_passwords[7] = "birch run"; var random_bg = new array ( ); random_bg[0] = "#0000cc"; random_bg[1] = "#33ff33"; random_bg[2] = ...

.net - Combining 2 LambdaExpressions into 1 LamdaExpression -

i dynamically generating expression trees sent off linq entities. providing framework , allow developers specify output columns lambda expressions. for instance, have column can specify way pull value database is: p => p.aliases.count() and column is: p => p.names.where(n => n.startswith("hello")) the problem here need combine both of these single expression. my first attempt was: getter = field.selectorexpression.body; and error message the parameter 'p' not bound in specified linq entities query expression makes since because linq can't know p in p.aliases.count() . the next thing tried was: getter = expression.invoke(field.orderbyselector, new[] {parameter}); however, recieve message the linq expression node type 'invoke' not supported in linq entities. makes since because don't expect sql server know how run lambda expressions. right have expression: item => new myclass { somevalue = item.name, ...

android - How to update database from server -

i making android application, have problem. have no idea best way update database in client application server (if user click "check update" button). how should set current database version in client-side can try compare latest database version in server ? how should check server if there new database update ? should use php / java server ? my case : user installed app come sqlite database version 1.0 later, updated sqlite database version 2.0 , upload server (i havent think kind of server use, idea (java or php) ?) , want when user click "check updates", app check latest database version, if latest db version 2.0 (which >1.0) download , replace old sqlite db (1.0). how should set sqlite database version in client-side (android) , compare latest version in server-side? any appreciated. ! based on comment this answer ... if problem simple suggest following: request server latest newest database state via http (it return timestamp or database ...

jquery - cross domain service call to retrieve some html causing IE security popup -

i calling web service using jquery sits on domain. web service returning html. problem every time make service call security popup in ie saying accessing information not in control of current site. cannot use jsonp because service returning text/xml. is there way avoid popup since changing service call return json not control. thanks, kunal nope can't bypass same origin policy unless web service implements cross-origin resource sharing .

postgresql - Search in all tables in PgAdmin -

in pgadmin, possible search value in tables? in phpmyadmin possible , quite convenient. search id value , find tables in occurs. can't seem find function in pgadmin. does exist? it doesn't exist in pgadmin.

Using PHP to connect to MySQL: ERROR? -

i tried running following code: (http://localhost/read.php) <html> <body> <?php $link = mysql_connect('localhost', 'root', 'password'); if (!$link) { die('could not connect: ' . mysql_error()); } echo 'connected successfully'; if (mysql_query("create database testphp",$link)) { echo "database created"; } else { echo "error creating database: " . mysql_error(); } ?> </body> </html> and got following error: fatal error: call undefined function mysql_connect() in c:\program files (x86)\apachesoftware foundation\apache2.2\htdocs\read.php on line 5 look @ phpinfo() . mysql extensions not there. and while @ it, drop ancient mysql_* way ow doing thing , learn how use pdo , prepared statements. it's abstraction api database connection , interaction.

c++ - about the const in an operator overloading definition -

for following definition of const vector3f operator*(const vector3f &v, float s); there 2 const , respective usages? the const-reference in argument means don't change v , can pass constant vectors (and temporaries!) function. that's thing. the constant by-value return sort of gimmick. prevents writing things this: vector3f v = get_vector(); vector3f w = v; (v * 1.5) = w; // outch! cannot assign constant, though, we're good. returning by-value constant problematic, though, since interferes c++11's rvalue references , move semantics: move_me(v * 1.5); // cannot bind `vector3f &&` :-( because of that, , because abuse 1 showed above unlikely happen accident, it's best return value non-constant.

javascript - Including twitter/flickr api calls on every page load (WordPress) -

i want include latest flickr photos , twitter status updates in wordpress sidebar or footer using jsonp requests. problem of course each page reload perform new ajax call, , believe twitter api has usage limits. i considering cross-browser data persistance options had javascript , best think of cookies. would storing ajax results in cookie (setting expiry day, dont update twitter/flickr often). best solution javascript-based twitter , flickr api call? thanks the best solution javascript-based twitter , flickr api calls when using wordpress use wordpress transient api . transient api persistent cache method built in wordpress meant cache items change frequently. can set cache expires time , wordpress check database first transient if returns false use json call return item. here example using transient , shortcodes store users recent tweet. code below aaron jorbin twitter transients plugin function twitter_status($atts){ extract(shortcode_atts(array( ...

javascript - Use jQuery plugin with Wordpress? -

i want show jquery flot graph on wordpress blog. (edit: post, clear.) i've got flot graph working outside wordpress, (lack of) documentation , (millions of conflicting) forum questions getting jquery plugins working wordpress confusing. what need use flot plugin wordpress? i'm guessing: add reference jquery somewhere in wordpress post. apparently jquery bundled wordpress, it's not included default in head, how refer it? add reference flot in wordpress post. i've installed wordpress flot plugin, actual javascript file? (the documentation doesn't say!) add flot script inside document.ready - forum posts refer need change $ jquery when using wordpress: need this? thanks this. think wrote definitive post on "using jquery plugins wordpress" lot of grateful traffic. wp_register_script('flot', plugins_url('/flot/jquery.flot.min.js', __file__), array("jquery", "jquery-ui-core", "excanvas" )...

node.js - How do you define a nested object to an existing schema in Mongoose? -

say have 2 mongoose schemas: var accountschema = new schema({ username: string , password: string }) var agentschema = new schema({ name : string , account: accountschema }) is there anyway add accountschema agentschema without being collection? it doesn't it's possible. 2 solutions either use documentid or virtuals: objectid: var mongoose = require('mongoose') , schema = mongoose.schema , objectid = schema.objectid; var accountschema = new schema({ username: string , password: string }) var agentschema = new schema({ name : string , account: {type: objectid} }) virtuals: var accountschema = new schema({ username: string , password: string }) var agentschema = new schema({ name : string , _accounts: [accountschema] }) agentschema.virtual('account') .set(function(account) { this._accounts[0] = account; }) .get(function() { return this._accounts.first(); }); ...

How to remove records from CSV in C#? -

i'm trying remove records csv formatted text file. here code reading , inserting records: oledbconnection con = new oledbconnection(); con.connectionstring = constr; con.open(); oledbcommand com = new oledbcommand(); com.connection = con; com.commandtext = "select * shop.txt id '" + textboxsearch.text + "%'"; oledbdataadapter da = new oledbdataadapter(com); dataset ds = new dataset(); da.fill(ds); com.executenonquery(); datagridview1.datasource = ds.tables[0].defaultview; con.close(); but dont work remove. remove query this: delete * shop.txt id <something> note: when calling executenonequery following exception occurred oledbexception: deleting data in liked list not supported in isam. deleting rows textfile not easy - ole adapter doesn't support it. options: select data want keep datatable , export csv file. parse csv file, filter unwanted lines , write other lines cs...

facebook - How to achieve dynamic fb actions? -

my site has feed system , when user clicks on 1 of feed snippets (the object), want action publish in facebook news feed. i'm confused on how go because far i'm aware how post actions on facebook's javascript sdk: fb.api('/me/namespace:action?object=url','post') how dynamically change properties of object? there parameters can send? far i'm concerned, facebook asks give pass url , it'll grab <meta> information url? am supposed perform request own server , change meta tags dynamically. sounds more work needs be. example, if feed includes paragraph of text, it'll impractical me post request , urldecode entire thing. i'm not sure totally understand question, but... you can dynamically change tags facebook og: properties, have before page loads (e.g. using php opposed javascript). after send post using javascript sdk, facebook crawls page , looks info in og: meta tags.

make columns unsortable in dataTables.js jQuery plugin -

i using datatables.js jquery plugin. the first column of table row counter, don't want sortable user. last column contains action link user can perform on row. how can make these 2 columns unsortable? note: using pipeline (server-side process) mode of datatables. this done setting bsortable false: /* using aocolumndefs */ $(document).ready(function() { $('#example').datatable( { "aocolumndefs": [ { "bsortable": false, "atargets": [ 0 ] } ] } ); } ); /* using aocolumns */ $(document).ready(function() { $('#example').datatable( { "aocolumns": [ { "bsortable": false }, null, null, null, null ] } ); } );

ios - Disable AirPlay with MPMoviePlayerController -

i have instance of mpmovieplayercontroller being used display live streaming video on iphone app. working fine, wish remove airplay functionality. to sure, disable airplay so: if([self.movieplayercontroller respondstoselector:@selector(setallowsairplay:)]) { self.movieplayercontroller.allowsairplay = no; } however, code, still see airplay icon on video controls. if select this, , select appletv, audio sent on airplay - video continues play within app. if set allowsairplay yes , both video & audio sent on airplay. does know why happens? feature of os, allows allow audio sent on airplay? it turns out airplay icon still visible (and should remain visible) audio can routed suitable device, eg. bluetooth headset. attempting hide icon considered bad practice.

How to post JSON data in rails 3 functional test -

i plan use json data in both request , response in project , having problems in testing. after searching while, find following code uses curl post json data: curl -h "content-type:application/json" -h "accept:application/json" \ -d '{ "foo" : "bar" }' localhost:3000/api/new in controller can access json data using params[:foo] easy. functional testing, find post , xhr (alias xml_http_request ). how can write functional test in rails achieve same effect using curl ? or should test in other ways? here's i've tried. find implementation xhr in action_controller/test_case.rb , , tried add jhr method changing 'conetent-type' , 'http_accept'. (added in test/test_helpers.rb .) def json_http_request(request_method, action, parameters = nil, session = nil, flash = nil) @request.env['content-type'] = 'application/json' @request.env['http_accept'] ||= [mime::json, mime::js,...

iphone - UI update in selector -

i perform selector in application: - (void) dofilter:(uibutton*)button { [activityindicator startanimating]; [self disablebuttons]; // ... // actions // ... sleep(2); [self enablebuttons]; [activityindicator stopanimating]; } when user clicks on button. activityindicator uiativityindicatorview. don't see activity indicators while code performing. how can fix it? firstly, should never ever use sleep on main thread. blocks entire app , user can't time. secondly, ui not updated until code returns control run loop. whenever call startanimating , stopanimating in same method without returning run loop in between, can sure nothing happen in ui (same disablebuttons , enablebuttons ). solution: call startanimating , disablebuttons . start tasks have perform in background ui not blocked. can use nsoperation , performselectorinbackground:... , grand central dispatch etc. that. finally, when long task finished, have call m...

Uncoment lines using bash script -

# deb http://archive.canonical.com/ubuntu lucid partner # deb-src http://archive.canonical.com/ubuntu lucid partner above lines /etc/apt/sources.list .there number of lines. how uncomment above 2 lines bash script. i'd sed -e "s/^# deb/deb/g" /etc/apt/sources.list instead of sed -e "s/^# //g" /etc/apt/sources.list because th second sed command either uncomment lines such : # see http://help.ubuntu.com/community/upgradenotes how upgrade # newer versions of distribution.

c# 4.0 - split List<User> in multiple List<User> in c# -

i want split list of user generic list small list each 5 records. ex i have list: u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15. must split list1:u1,u2,u3,u4,u5 list2:u6,u7,u8,u9,u10 list3:u11,u12,u13,u14,u15 any direct method available or need programing logic in c# ? you can group on index: list<list<user>> lists = list .select((u, i) => new { list = / 5, user = u }) .groupby(g => g.list, g => g.user) .select(g => g.tolist()) .tolist(); you can use range make loop , part of list each iteration: list<list<user>> lists = enumerable.range(0, (list.count + 4) / 5) .select(n => list.skip(n * 5).take(5).tolist()) .tolist();

Setting up nutch 1.3 and Hadoop 0.20.2 -

i have multi-node cluster running on uec(ubuntu enterprise cloud) , thought idea set nutch . however, found tutorial unhelpful http://wiki.apache.org/nutch/nutchhadooptutorial nucth release 0.8 , doesn't support latest versions . i'm stuck . can tell me how can configure nutch 1.3 hadoop? thank time .

actionscript 3 - Flash CS3 - menu for game -

i have started use flash. wrote game want add menu can chose how many players play. how it? have tried create 1 scene menu , creates buttons , in button action script: on (press){ _root.gotoandstop('game',1) } //game name of scene engine of game time have syntax error. sum up: how create kind of menu/front page of game , how past variable stage. is better use frames or stages? thanks

nosql - What are some real world implications of non-ACID database compliance? -

specifically there risk data can lost? i'm looking @ running intensive transaction processing system critical nothing lost. there examples of nosql being used in mission critical applications such banking transaction processing? without being flippant, absence of acid means no guarantees of atomicity, consistency, isolation, or durability. without atomicity, no guarantee multiple actions must either succeed or fail so. instance, if transactions require debit 1 account , credit in 1 go, in absence of atomic transactions, either have roll own solution, or accept it's possible debit 1 account, without making corresponding credit. without consistency, there's no guarantee "side effects" of transactions work - in relational databases, that's things firing of trigger, or cascading of foreign key relationship. so, if need kind of auto-incrementing unique identifier transaction, there's no guarantee one. without isolation, there's no way g...

c++ - TBB task_groups without using stack -

i perform post-order tree traversal in c++. tree can deep cannot use recursion (it exhausts stack). instead create std::stack<...> puts on heap, , traverse tree in while loop rather function calls. works great. now parallelize whole process using tbb. thinking of creating task_group @ every node, , running same functor on each of children. occurs me run same problem tree depth had before: running functor on each node of deepest path eat away stack until whole thing runs out. is there way out of problem? or imagining whole thing; there magic behind task_group::wait() avoids problem? from tbb documentation (about implicit continuation): because parent blocks, thread’s stack cannot popped yet. thread must careful work takes on, because continually stealing , blocking cause stack grow without bound. this not that, shows tbb not using stack magic empty stack blocked tasks. means stack-overflows bit later (spreaded among multiple thread's stacks...

AUTH_PROFILE_MODULE in django -

models.py class team(models.model): name = models.charfield(max_length=25, unique=true) def __unicode__(self): return self.name class userprofile(models.model): user = models.foreignkey(user, unique=true) team = models.foreignkey(team, unique=true) settings.py: auth_profile_module = 'project.pm.userprofile' views.py if request.method == 'post': r = registerform(request.post) if r.is_valid(): team = team(name=request.post.get('team')) team.save() user = user.objects.create_user(username=request.post.get('email'), email=request.post.get('email'), password=request.post.get('password')) user.get_profile.team = team.id user.save() i had error on line user.get_profile.team = team.id attributeerror @ /register 'instancemethod' object has no attr...

python - draw_networkx() in networkx -

Image
i getting error when trying networkx networkx.draw_networkx(g,ax = self.axes) typeerror: draw_networkx() takes @ least 2 non-keyword arguments (1 given) the code same g=networkx.graph() g.add_node("spam") g.add_edge(1,2) networkx.draw_networkx(g,ax = self.axes) can explain doing wrong , how can correct this.... link function draw_networkx . thanks it expecting pos argument, inform drawing routine how position nodes. here's how can use spring layout populate pos : networkx.draw_networkx(g, pos=networkx.spring_layout(g), ax=self.axes) output:

objective c - Hot to create custom NSSlider like "Start screen saver:" slider in System Preferences -

how create custom nsslider working slider in system preferences -> desktop & screen saver -> screen saver -> start screen saver: ? i tried subclass nsslidercell overridden continuetracking: don't work expected. i played around bit , @ least got off pretty start nsslidercell subclass. mdslidercell.h : #import <cocoa/cocoa.h> @interface mdslidercell : nsslidercell { bool tracking; } @end mdslidercell.m : #import "mdslidercell.h" @implementation mdslidercell - (bool)starttrackingat:(nspoint)startpoint inview:(nsview *)controlview { if ([self numberoftickmarks] > 0) tracking = yes; return [super starttrackingat:startpoint inview:controlview]; } #define md_snapping 10.0 - (bool)continuetracking:(nspoint)lastpoint at:(nspoint)currentpoint inview:(nsview *)controlview { if (tracking) { nsuinteger count = [self numberoftickmarks]; (nsuinteger = 0; < count; i++) { nsrect tickmarkrect...

wpf - DataGridComboBoxColumn Dynamic Binding -

i have datagrid combobox column. want bind column list of items generate dynamically in code-behind file. rows of datagrid have same list of items in combobox column. have done static binding using objectdataprovider, not sure how dynamically. any appreciated! thank you, santosh you can use observablecollection<t> items, if bind itemssource of datagrid collection can dynamically items collection , added datagrid. see collections binding section on msdn more info. if not looking might want elaborate question still seems quite unclear (at least me).

azure - Differences between NCQRS and Lokad.CQRS -

i looking @ cqrs frameworks use project hosted in azure . i have read ncqrs , lokad.cqrs , little bit confused. will both work azure, both capable of using nservicebus or lokad use own messaging? the clients use both web , mobile. thought of making wcf service commands, not sure wcf. any recommendations? lokad.cqrs designed work azure start. uses azure queues messaging (with azure blobs cases, when messages not fit in 8kb size limitation). i'm not sure ncqrs, might provide adapter lokad.cqrs.

oop - Problem solving related to Object oriented programming concepts -

for quiet sometime have been working on improving algo skills because requirement clear interviews in companies google, amazon etc. came across questions on object oriented programming concepts being asked in amazon interviews. being programmer in c doesn't know oops. sort of books, links improve these skills appreciated. in advance. i started first edition of tim budd's "an introduction object-oriented programming". language agnostic, learned concepts, not implementations. the third edition out.

java - Why does ShutdownHookThread 'setDaemon true' -

i needed add shutdown hook scala app have, , discovered scala provides helper called shutdownhookthread . in source noticed it sets new thread daemon thread . def apply(body: => unit): shutdownhookthread = { val t = new shutdownhookthread(hookname()) { override def run() = body } t setdaemon true // <--------- right here runtime addshutdownhook t t } why done? seems me you'd want opposite in shutdown hook thread (i.e. make sure thread exits before shutting down jvm). or daemon/not-daemon not relevant shutdown hooks? on jvm, in general non-daemon thread prevent jvm terminating. once there no longer non-daemon threads, jvm gracefully terminate initiating shutdown. see addshutdownhook javadoc more info. once shutdown has been initiated, i'm not sure daemon status matters. shutdown hook threads aren't started until shutdown has been initiated. in case t setdaemon true may unnecessary, won't hurt either. so in short "daemo...

how easy is it to mess with Firefox Javascript interpreter? -

since firefox open source, in theory should possible me hack behavior of interpreter. let's maybe build own profiler, or introduce more fine grained restrictions on javascript behavior , not allow in browser. or something, whatever... so how easy sort of thing in practice? achieved through sort of plugins? or need recompile interpreter source? or recompile entire browser? how big interpreter source anyway? hard thing grok has built toy compilers in college? if restrict interpreter, things not bad. if want deal 2 jits well, it's more work. in terms of codesize, looks we're talking 180k lines of code (headers , c++ files), not counting regexp engine , jits. understanding interpreter not bad; 1 thing there's bit of documentation @ http://developer.mozilla.org , people on #jsapi channel on irc.mozilla.org happy answer questions. something profiler need hack source if want profile without perturbing system much. experiments in terms of supported fe...

javascript - Passing value to JS function through URL on window load -

my page http://www.dinomuhic.com/2010/index.php loads showreel @ start of page using onload call in body this: <body onload="sndreq('96')"> 96 id of showreel in sql library. js function "sndreq" ajax call using jquery opens requested item , displays in main window. now question: if want send link client opens specific item directly not have navigate through site? something http://www.dinomuhic.com/2010/index.php?sndreq=234 (which of course doesn't work , opens showreel, because onload in body tag overrides it) how can implement this? want able open specific items url if nothing passed through url should open item 96. thank in advance. i'm sure pretty easy can't see it. cletus you need parse query string. find easiest way deal query string following. first, need extract query string url: var querystr = window.location.search; // give ?sndreq=234 then, can strip out ? , split each query string parameter arr...

xml - How to download file and save in local iphone application? -

i have locally saved 1 xml file , showing details using nsxmlparser(which stored in resource folder). but, want download new xml url(from client side) , need store new xml file in local , need delete existing 1 application. how can this? suggestions? there sample code/project reference? please me. reading poor english. advance. although u can delete file yr resource directory , save new 1 way perform file operation on app diretories document directory or cache directory. first u save yr xml file app resource cache directory access file there.and u can remove file resource directory ,its no longer needed. new file available in internet first remove old 1 cache , add new 1 cache directory. whole thing follows:- //get cachedirectory path nsarray *imagepaths = nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmask, yes); nsstring *cachdirectory = [[nsstring alloc] initwithstring:[imagepaths objectatindex:0]]; //first save file resource directory ap...

asp.net - How to deploy an asp site with SQL Server database -

i have site sql server database , having trouble deploying iis. page in iis cannot access db, can see page cannot login because database not accessible... i can access database when site runs debug visual studio. i guess security problem. how work? thanks, the normal approach switch sql server "windows/integrated authentication" "sql authentication". sql authentication allows create sql login , can specify in connection string like: data source=myserver;initial catalog=mydb;user id=myuser;password=***; virtually hosting providers use method.

php - What is the best caching module for lighttpd? -

i'm using lighttpd web server , have install wordpress run blog. i concerned caching. know there module php named xcache don't understand if have install module or install " super cache " wordpress plugin. what differences? can run together? thank you! xcache opcode cache. php compiles every time run. xcache cache code in machine language , store in ram. speed execution of script doesn't need recompiling , stored in ram (less i/o). however, means pages still dynamic, means pages generated everytime executing php code on there. if install super cache plugin, cache html of page. store html , serve user. means data static caching time , not dynamically generated every user. it best use both maximum performance results. need xcache installed on server able use xcache plugin in wordpress.