Posts

Showing posts from June, 2014

tcp ip - TCP/IP server/client multiconnection using C# and receiving public ip address of client -

i need write application using c#, connect client server static ip address. the server , clients must able send , receive message @ same time. also, need log information respect of clients public address well. how can make using c#? shall use tcplistener / tcpclient or there other method can make multiple connections? if want go low level tcp/ip , own message parse/serialize/deserialize, can use socketasynceventargs high performance code, not easy tcplistener/tcpclient. http://msdn.microsoft.com/en-us/library/vstudio/system.net.sockets.socketasynceventargs http://www.codeproject.com/articles/83102/c-socketasynceventargs-high-performance-socket-cod question is, why not use example wcf/iis ?

objective c - ideal way for detecting collisions in sprite kit? -

-(void)handlecontact:(skphysicscontact*)contact{ nsarray *nodenames = @[contact.bodya.node.name, contact.bodyb.node.name]; if ([nodename containsobject:player] && [nodename containsobject:window] { //player , windows defined strings set in skspritenode names window } else if ([nodename containsobject:player] && [nodename containsobject:door]) door } //continue 10 times different defined strings except player } would sort of code ideal collision detection or there better way can face this?

testing - How to compile and run QTP script from command line -

i want use text file containing source code of qtp script, , compile (create usr,cfg,usp etc files created when manually "save" script in qtp) using command line. there way both? all files in qtp/uft when you're doing "more" writing script. stores test description, associated repositories, parameters, recovery scenarios, etc. if you're writing test logic in text file, there's chance you're not using of stuff either. take blank qtp/uft test create "template" of valid test. have replace 'action1/script.mts' file contents of text file. if want of command-line, you'll need write simple console-based application heavy lifting you.

jquery - Order DIV's by Value Username Value within -

i have following dom structure. each 'contactsbodymaindisplaymembercontainerdiv' shows member photo, name etc. i need able re-order these containerdiv's h2 username z. so below need move 'contactsbodymaindisplaymembercontainerdiv' pieces of dom it's ordered adam, bob, eric. note: need move whole piece of dom each user. <div id="contactsbodymaincontainerdiv"> <div class="contactsbodymaindisplaymembercontainerdiv"> <div class="contactsbodymaindisplaymemberwrapperdiv"> <h2 class="contactsbodymaindisplaymemberusernameh2">eric</h2> </div> </div> <div class="contactsbodymaindisplaymembercontainerdiv"> <div class="contactsbodymaindisplaymemberwrapperdiv"> <h2 class="contactsbodymaindisplaymemberusernameh2">adam</h2> </div> </div> <div class="contactsbodymaindisplaymembercontainerdiv&q

cordova - Phonegap heading example code not working -

i completly new 'phonegap'. have tested example code displays current heading , works in local ripple emulator. however when deploy android not work? nothing , no error written page. the following code should display compass heading screen: <!doctype html> <html> <head> <title>compass example</title> <script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script> <script type="text/javascript" charset="utf-8"> // wait phonegap load // document.addeventlistener("deviceready", ondeviceready, false); // phonegap ready // function ondeviceready() { navigator.compass.getcurrentheading(onsuccess, onerror); } // onsuccess: current heading // function onsuccess(heading) { document.write('heading: ' + heading); } // onerror: failed heading // function onerror() { document.write('error'); } </script> </head>

python - What is wrong with this ternary operator? -

for in str1: (newstr += chr(ord(i)+2)) if i.isalpha() else (newstr += i) it seems grieving += operator. know both variables strings though, don't understand why not concatenate them try following: for in str1: newstr += (chr(ord(i)+2) if i.isalpha() else i) edit : from python documentation : conditional_expression ::= or_test ["if" or_test "else" expression] expression ::= conditional_expression | lambda_expr and pointed @flornquake, assignment var += value statement, not expression.

r - Running multiple regressions is there a smart way to vectorize -

i have written believe semi-quick ols-regression function ols32 <- function (y, x,ridge=1.1) { xrd<-crossprod(x) xry<-crossprod(x, y) diag(xrd)<-ridge*diag(xrd) solve(xrd,xry) } now want apply following (vapply(1:la, function(j) me %*% ols32((nza[,j]),(cbind(nzaf1[,j],nzaf2[,j],nza[,-j],momf))) [(la+2):(2*la+1)],fun.value=0)) where nza,nzaf1,nzaf2 , momf 500x50 matrixes , la=50 , me vector of length 50. do regression use beta-coefficients momf multiply me. nza.mat<-matrix(rnorm(500*200),ncol=200) nza<-nza.mat[,1:50] nzaf2<-nza.mat[,101:150] momf<-nza.mat[,151:200] nzaf1<-nza.mat[,51:100] me<-nza.mat[500,151:200] is there imediate way of making things faster or need use someting rcppeigen? tks p so came faster way of solving rewriting ols-function calculates 2 crossproducts once whole matrix. new function looks this: ols.quick <- function (y, x, me) { la<-dim(y)[2] xx.cross<-crossprod(x) xy.cross<-crossprod(x, y) diag(xx

c# - Copy file into different folder directory name -

i create code copy don't know how combine copy code if filename not in jpeg , bmp , png or gif copy different folder name( c:\dump ) if filename extension exists file copy ( c:\destionation ). public static void copyfile( string[] args ) { copyfolder( @"c:\source", @"c:\destination" ); console.readline(); } static public void processdirectory(directoryinfo directory) { foreach (fileinfo file in directory.enumeratefiles("*.jpg,*.bmp,*.png,*.gif,*.jpeg")) { //how combin process directory info copy folder statement// } } static public void copyfolder( string sourcedir, string destfolder ) { if (!directory.exists( destfolder )) directory.createdirectory( destfolder ); string[] files = directory.getfiles( sourcedir ); foreach (string file in files) { string name = path.getfilename( file ); string dest = path.combine( destfolder, name ); file.copy( file, dest); } }

vb.net - Project to project reference - type not CLS compliant -

i have problem regarding public declaration in 1 project makes reference class in different project. the parent project references dependent project without problem. however, i'm getting warning type member 'user' not cls-compliant. it's declared public user user this declaration made in parent project. user class in supporting project can use type on form without fail. now, try pass off on form - in parent project: private olduser user olduser = frmusermgt.user and thing crashes. stepping through code shows olduser nothing. i built brand new solution , tested exchange without fail. i've searched solution , project settings until i'm blue in face , can't find difference. it's vs2012 vb solution. can post code needed if above description isn't sufficient - appreciated.

Modify Get Request of a Kendo UI treeview -

i'm having trouble kendo ui treeview, displays same node each time click go deeper tree. my problem regular request looks this: something/getchildren/3432fdsf8989/apr222014083453am when click next node request looks this: something/getchildren/3432fdsf8989/apr222014083453am?identifier=2323eded7664 and want have this: something/getchildren/2323eded7664/apr222014083453am is possible change url kendo ui hierarchicaldatasource? web service ignoring identifier , still using initial id. function inittreeview(date, targetid) { var requesturl = "something/getchildren/"+ targetid + "/" + date; var datasource = new kendo.data.hierarchicaldatasource({ transport: { read: { url : requesturl, datatype : "json" } }, schema: { model: { id: "identifier", haschildren: true, //all items may have children } } }); $("#treeview").ken

ios - How to retrieve list id by list name in Twitter API -

i've call twitter api's method https://api.twitter.com/1.1/lists/statuses.json?list_id=12345 to retrieve tweets user in list. customer provide me name of list , i've no idea how list id using list name. list this: https://twitter.com/datasportnews/lists/i-campioni-di-brasile2014 . i've tried method https://api.twitter.com/1.1/lists.json?screen_name=i-campioni-di-brasile2014 to id list return message {"errors":[{"message":"your credentials not allow access resource","code":220}]}. i'm logged api key , api secret , token well, method doesn't work. ideas ? the list name in url referred slug. when want request statuses list using slug , need pass owner_screen_name . for example, in case: /1.1/lists/statuses.json?slug=i-campioni-di-brasile2014&owner_screen_name=datasportnews more details on over endpoint's doc page @ https://dev.twitter.com/docs/api/1.1/get/lists/statuses

c# - Must manually close StreamWriter in Usings? -

at 2nd iteration, "file being used" error occurs @ "using (streamwriter" line. though streamwriter supposed auto-close after going out of usings. edit 1: real code note: mails list<mailmessage> (instantiated from/to addresses) foreach (var x in mails) { x.subject = "updated google exchange rates (" + datetime.now.tostring(new cultureinfo("en-us")) + ")"; stringbuilder emailbody = new stringbuilder(); emailbody.appendline("abc"); //<-- simplified x.body = emailbody.tostring(); _txtname = x.subject.replace(...); //replaces invalid file-name chars //note _txtname unique due x.subject's dependency on datetime using (streamwriter sw = new streamwriter("./exchange rate history/" + _txtname)) {

c# - Clicking on Html.ActionLink refreshing the layout view -

i have mvc 3 project created default template in visual studio. in project in layout view added dropdownlist using view , html.action like in _layout.cshtml @html.action("index", "ddldept") in index.cshtml of ddldeptcontroller.cs @model passingvaluesinviews.models.ddldeptviewmodel @html.dropdownlistfor(m => m.selecteddeptid, new selectlist(model.depts, "id" , "deptname")) when run project , click on 1 of default links home controller <li>@html.actionlink("home", "index", "home")</li> the page refreshed , whatever selected in dropdownbox cleared , default valued selected again. why dropdownbox refesh , how prevent that. my objective have common dropdown box couple of views. thanks help. @html.actionlink refresh page. same action occur if clicked on link generated traditional tags. if needed reload small section, you're looking ajax call via @ajax.actionlink.

ios - Set button title programatically -

i made button in storyboard , associated ibaction in header file. how can set title of button variable made displayphone , have call number well? .h #import <uikit/uikit.h> #import <parse/parse.h> @interface ibthirdviewcontroller : uiviewcontroller @property (nonatomic, strong) pfrelation *agentrelation; @property (nonatomic, strong) nsarray *agent; @property (weak, nonatomic) iboutlet uilabel *agentname; @property (strong, nonatomic) iboutlet uilabel *agentphone; @property (strong, nonatomic) iboutlet uilabel *agentemail; @property (strong, nonatomic) iboutlet uiimageview *agentimage; - (ibaction)phonebutton:(id)sender; @end .m #import "ibthirdviewcontroller.h" #import "ibagentstableviewcontroller.h" @interface ibthirdviewcontroller () @end @implementation ibthirdviewcontroller - (void)viewdidload { [super viewdidload]; } - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; //find agent ,

Python Change Button Image and change it back -

so have code changes image of button when clicked. now, if wanted have button change when clicked , return normal? (like normal button) can't add .config method skip first 1 , keep button same image. can not wait freezes program , produces same result. playup = photoimage(file=currentdir+'\up_image.gif') playdown = photoimage(file=currentdir+'\down_image.gif') #functions def playbutton(): pbutton.config(image=playdown) return #play button pbutton = button(root, text="play", command=playbutton) pbutton.grid(row=1) pbutton.config(image=playup) the best way make button image change real button press images this. define photos: playup = photoimage(file=currentdir+r'\up_image.gif') playdown = photoimage(file=currentdir+r'\down_image.gif') define functions: def returncolor(): pbutton.config(image=playup) def playbutton(): pbutton.config(image=playdown) pbutton.after(200,returncolor) initialize button:

performance - Javascript memory leak setTimeout issue -

Image
does 1 know why memory consumption stays constant here ? var count = 0; $(init); function init(){ var node = document.queryselector('.logs'); function check(){ var uarr = new uint16array(100); log(node, uarr.length); settimeout(check,100); } settimeout(check,100); } function log(node, text){ if( count % 30 == 0 ){ node.innerhtml = ''; } var child = document.createelement('div'); child.innertext = 'count ' + (count++) + " arr len " + text; node.appendchild(child); } http://jsfiddle.net/v99eb/11/ reason why should linearly increase memory allocation is: 'check' method calls inside it's definition, closure variables available inside check method execution, again creates execution context test function , on. also, in every execution, create memory block of uint16array, believe allocated in heap, , should never de-allocated since reachabl

git - how to make a flag in shell cli app -

i rewriting old git plugin made ( git-build ) has 2 commands want turn 1 command --flag run() { require_clean_work_tree rebase "please commit or stash them." source git-build.sh git add . git commit -m 'build $version' git tag $version } run-deploy() { require_clean_work_tree rebase "please commit or stash them." source git-build.sh git add . git commit -m 'build $version' git tag $version git push -tags } i wish have run-deploy turn run --deploy . unless there special magic involved git plugins that's simple as run() { require_clean_work_tree rebase "please commit or stash them." source git-build.sh git add . git commit -m 'build $version' [ "$1" = '--deploy' ] && git tag $version }

ios - IBOutletCollection for UITextView -

can please tell me steps in interfacebuilder connect set of uitextview objects iboutletcollection? in xib file (say myfile.xib) have row of 8 uitextview objects. in myfile.h file declare iboutletcollection: @property (nonatomic, retain) iboutletcollection(uitextview) nsarray *textviews; now want connect xib uitextview objects iboutletcollection. tried ctrl drag first uitextview in xib fileowner, didn't show me iboutlets. tried ctrl click (right click) on fileowner , popped little black menu. showed textviews outlet collection, tried dragging little circle textviews uitextview objects in xib, didn't anything. searched google find sort of info on this, found statements "connect uitextview iboutletcollection in usual way." don't know "the usual way" is. please help. are sure were dragging correct "little circle" text views, because works fine me. another way connect outlet opening assistant editor can see both xib file , control

android - java.lang.IllegalArgumentException: the bind value at index 2 is null -

just wondering few android devices getting below mentioned exception: caused by: java.lang.illegalargumentexception: bind value @ index 2 null @ net.sqlcipher.database.sqliteprogram.bindstring(sourcefile:237) @ net.sqlcipher.database.sqlitedatabase.updatewithonconflict (sourcefile:1794) @ net.sqlcipher.database.sqlitedatabase.update(sourcefile:1730) @ com.sample.android.sqdbhelper.onupgrade(sourcefile:276) @ net.sqlcipher.database.sqliteopenhelper.getwritabledatabase (sourcefile:123) @ com.sample.android.sqdbcontroller.read(sourcefile:431) @ com.sample.android.ui.mainactivity.oncreate(sourcefile:42) @ android.app.activity.performcreate(activity.java:5372) @ android.app.instrumentation.callactivityoncreate (instrumentation.java:1104) @ android.app.activitythread.performlaunchactivity sample code contentvalues contentvalues = new contentvalues(); contentvalues.put("col_value1", value1); contentvalues.put("col_value2", value2); contentvalues.

linux - Upgrade MySQL with Replication Master-Slave 5.0 to 5.6 -

i know on mysql website there's information , official documentation although i'm looking recipe on how-to upgrade mysql. if point blog, website or document great! details: linux (oracle linux/redhat, debian ) latest versions. upgrade map mysql 5.0 5.6. (5.0 5.1, 5.1 5.5 , 5.5 5.6) master , slave replication enviroment i appreciate information given. thank !

mysql - Getting error on executing prepared statement in PHP -

i have code follows giving me error on prepared statement line: homepage.php <html> <head> </head> <body> <ul id="list"> <li><h3><a href="#">tops</a></h3></li> <li><h3><a href="#">suits</a></h3></li> <li><h3><a href="#">jeans</a></h3></li> <li><h3><a href="newpage.php?name=women">more</a></h3></li> </ul> </body> </html> newpage.php <?php $mysqli = new mysqli('localhost', 'root', '', 'shop'); if(mysqli_connect_errno()) { echo "connection failed: " . mysqli_connect_errno(); } ?> <html> <head> </head> <body> <?php session_start(); $lcsearchval=$_get['name']; //echo "hi"; $l

javascript - HTML5 Canvas transparency for all overlapping content -

i made drawing app html5, it's basic paint/brush tool works good. problem is, don't know how make overlapping path have same opacity. i tried use globalalpha property overlap content bolder , bolder everytime draw line. ctx.beginpath(); // init @ onmousedown ctx.lineto(x, y); // @ onmousemove ctx.stroke(); // @ onmousemove edit: ok got wrong. need redraw canvas "background" before draw lines. it looks have this: http://jsfiddle.net/4namg/2/ and think want this: http://jsfiddle.net/4namg/1/ the difference in second case redraw background. since don't special clear canvas: ctx.clearrect(0, 0, c.width, c.height); edit: same example mouse button management , multi-path: http://jsfiddle.net/4namg/3/ (nb: cheated in case of single-point paths sake of clarity).

Excel VBA : Multiple lookup values -

i have 2 sheets. result needed in sheet1 required results column depicted below. results populated checking values in sheet2. noun modifier required results name1 value1 name2 value2 name3 value3 name4 value4 name4 value4 abrasive belt abrasive belt : 5in x 2in type wafer width length 5in thickness 2in diameter 2m abrasive belt abrasive belt : 11in x 6in x 3m type lugged width 11in length 6in thickness 3in diameter 3m abrasive belt abrasive belt : 12in x 7in x 3m type lugged width 12in length 7in thickness 3in diameter 4m sheet2 noun modifier attribute name fill abrasive belt type 0 abrasive belt width 1 abrasive belt length 2 abrasive belt thickness 3 abrasive belt diameter 0 abrasive rod ty

sql - MYSQL translate escaped HEX liked string to human readable -

this supposed spanish words. imported words dictonary in txt format. spanish 1 got translated these. thing cant search word. not find anything. how can convert these in mysql human readable , searchable string ? create table if not exists `es_words` ( `id` int(11) not null auto_increment, `word` varchar(255) character set utf8 collate utf8_unicode_ci not null, `user` int(11) not null, primary key (`id`) ) engine=innodb default charset=latin1 auto_increment=660099 ; insert `es_words` (`id`, `word`, `user`) values (1, 'ÿþa\0\r\0', 0), (2, '\0a\0-\0\r\0', 0), (3, '\0a\0a\0r\0ó\0n\0i\0c\0o\0\r\0', 0), (4, '\0a\0a\0r\0o\0n\0i\0t\0a\0\r\0', 0), (5, '\0a\0b\0a\0\r\0', 0), (6, '\0a\0b\0a\0b\0a\0\r\0', 0), (7, '\0a\0b\0a\0b\0i\0l\0l\0a\0r\0s\0e\0\r\0', 0), (8, '\0a\0b\0a\0b\0o\0l\0\r\0', 0), (9, '\0a\0b\0a\0c\0á\0\r\0', 0), (10, '\0a\0b\0a\0c\0a\0l\0\r\0', 0), etc i don't know many span

javascript - Highlight active (opened) link -

i want highlight active (opened) link . color must maintained time when link open. not on mouse click or hover. here js way tried: <script type="text/javascript"> $(document).ready(function(){ $("a.nav1").click(function () { $(".active").removeclass("active"); $(this).addclass("active"); }); }); </script> html links: <div id="navigation"> <ul> <li><a class="nav1" data-tab="#home" id="link-home"href="#home">home</a></li> <li><a class="nav1" data-tab="#football" id="link-football" href="#football">football</a></li> <li><a class="nav1" data-tab="#hockey" id="link-hockey"href="#hockey">hockey</a </li> </ul>

php - Generate ID based on file and line in (or something similar) -

in program need way create unique identifiers (like hash). important ids not random, same between calls same function or method. thus, if in line in file generated identifier xyz , in place should generated same identifier. i use code such instruction: $id = sha1(__file__ . __ line__); but not enough comfortable. i'd prefer use function or macro in c/c++ (i know php not have macros) follows: $id = generate_id(); the generate_id implemented below. works fine, i'm not convinced use function debug_backtrace in production code. maybe there's better solution? function generate_id() { $backtrace = debug_backtrace(); return sha1($backtrace[0]['file'] . $backtrace[0]['line']); } if intention have repeatable hash based on file, php has md5_file() method should need. $file = 'myfile.txt'; echo 'md5 file hash of ' . $file . ': ' . md5_file($file); as long file contents not change, md5 hash same each time g

javascript - Using jquery to check if element has class constantly -

i'm using stickyjs create sticky header wordpress website. have enqueued scripts , sticky working perfectly. what trying achieve check if nav element have set sticky has class called "is-sticky" , if change of css. here code have already: function stickyinit($) { $("#site-navigation").sticky({topspacing:0}); window.setinterval(check_sticky,500); function check_sticky(){ if($("#site-navigation-sticky-wrapper").hasclass("is-sticky")){ console.log ("do something"); } } } jquery(document).ready(function ($) { stickyinit($); }); this code in file have enqueued set nav sticky. as can see have used setinterval try , create loop test "#site-navigation-sticky-wrapper" element see if has class mentioned above. this code works , message in firebug console, ever once instead of repeatedly. so question is, how test element see if has class "is-sticky" can alternate nav css when does? als

Passing a total between groups in crystal reports -

group 1 = date of order group 2 = product , current on hand day1 20140423 (day 1) product 200 order 1 -20 order 2 -20 balance 160 product b 100 order 1 - 5 day 2 20140424 (day 2) product c 16 order 1 - 5 day 3 20140425 (day 3) product 160 how pass ending balance product day 1 beginning balance product day 3 pls explain in detail because novice report writer. try below approach: create formula @storevalue , write below code. local numbervar storevalue; local numbervar display; if ({date},{@group1})=20140423 , ({product},{@group2})=product a' storevalue:=//balance value of a; if ({date},{@group1})=20140425 , ({product},{@group2})=product a' display:=storevalue; else display:=//your calculation here; display; now place

arrays - plotting missing values with nan -

Image
i have plot looks hours = [0 1 2 3 4 5 6 12 13 14 15]; y = [0 1 2 nan 3 4 5 6 7 8 9]; figure(1) plot(hours, y, '-o'); as can see, x axis jumps 6 12. instead of having straight line connecting these points, have gap: hours = [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]; y = [0 1 2 nan 3 4 5 nan nan nan nan nan 6 7 8 9]; figure(2) plot(hours, y, '-o'); can done in elegant way without having manually insert nans , new 'hours' values? try - hours_new = min(hours):max(hours) nan_ind = ~ismember(hours_new,hours) y_new(~nan_ind) = y y_new(nan_ind) = nan then, plot - figure(2) plot(hours_new, y_new, '-o');

c# - FontLink with Myriad Pro in Win XP -

i have c# application running on winxp needs display symbols, i'm getting squares. did digging around , found font linking. i used arial , calibri, cannot work myriad pro. i set following in registry in hkey_local_machine–\software\microsoft\windows nt\currentversion\fontlink\systemlink (following http://msdn.microsoft.com/en-us/goglobal/bb688134 ) arial | reg_sz | segoe_ui_symbol.ttf,segoe ui symbol calibri | reg_multi_sz | segoe_ui_symbol.ttf,segoe ui symbol myriadpro | reg_multi_sz | segoe_ui_sumbol.ttf,segoe ui symbol and on myriadpro bold, bold condensed, bold condensed italic, bold italic, condensed, condensed italic, regular, semibol, semibold italic, still squares instead of characters... tried using myriad key, not work... before added entries arial , calibri had squares instead of characters, started working after added entries. what doing wrong? can not link myriad pro? thanks in advance! i managed figure wrong. apparently font

php - Combine several MySQL statements into one -

i make these 3 calls in rapid succession: update job set jstatus = '9' snum = :u , jstatus = '7' , jdate < :d delete job snum = :u , jstatus < '7' , jdate < :d delete jdate snum = :u , jdate < :d the params same each. @ present, each 1 done follows: $sth = $dbh->prepare(" update job set jstatus = '9' snum = :u , jstatus = '7' , jdate < :d"); $sth->bindparam(':u', $json['u']); $sth->bindparam(':d', $date); try{$sth->execute();}catch(pdoexception $e){echo $e->getmessage();} surely there must way combine them? i've looked @ $mysqli->multi_query , so question , both seem more complex have thought necessary. i'll provide answer under assumption you're using acid compliant engine (or mortals, engine supports transactions). what want avoid code complexity - in case it's running 3 queries bundled 1. it's pretty difficult maintai

python - Unicode object error in parsing XML using BeautifulSoup -

parsing contents of 'name' tag in xml output using beautifulsoup gives me following error: attributeerror: 'unicode' object has no attribute 'get_text' xml output: <show> <stud> <__readonly__> <table_stud> <row_stud> <name>rice</name> <dept>chem</dept> . . . </row_stud> </table_stud> </__readonly__> </stud> </show> however if access contents of other tags 'dept' seems work fine. stud_info = output_xml.find_all('row_stud') eachstud in range(len(stud_info)): print stud_info[eachstud].dept.get_text() #gives 'chem' print stud_info[eachstud].name.get_text() #---unicode error--- can python/beautifulsoup experts me resolve this? (i know beautifulsoup not ideal parsing xml. lets i'm compelled use ) tag.name attribute containing tag

python - Mix of scalars, tuples and numpy arrays as string argument -

i using python generate povray rendering code visualization of computed data. need pass lot parameters python strings of povray code. make scrips cleaner. use tuples , arrays directly arguments string formating. this: sign = -1 name = "temp1" nu = 0.245 boxmin =(0.01,0.01,0.01) # tuple boxmax =array([0.99,0.99,0.99]) # array povfile.write( ''' isosurface { function { %f*( %f - data3d_%s(x,y,z) ) } contained_by { box { <%f,%f,%f>,<%f,%f,%f> } } }''' %( sign, nu, name, *boxmin, *boxmax ) ) instead of this: povfile.write( ''' isosurface { function { %f*( %f - data3d_%s(x,y,z) ) } contained_by { box { <%f,%f,%f>,<%f,%f,%f> } } }''' %( sign, nu, name, boxmin[0],boxmin[1],boxmin[2], boxmax[0],boxmax[1],boxmax[2] ) ) supposing every element want write in string list (or iterable) - if constituted 1 element - can use workaround based on list flattening.

html - Mozilla doesn't read video -

since 2 days have nasty problem. www.y-angel.com .except mozilla every other browser open videos in showreel , shorts buttons.i tried .mp4, .webm - still in html , .ogg nothing!can this.i read lot of stuff on net nothing helped me.so, can anyone? <video width="512px" height="288px" controls="controls"> <source type="video/mp4" src="templates/angelyanakiev/videos/showreel.mp4"></source> <source type="video/webm" src="templates/angelyanakiev/videos/showreel.webm"></source> </video>

java - GWT - Error to load entry point -

i'm trying run app in gwt 2.6. project sample of webcam using elemental (library gwt-elemental). source code wich using, found example: https://code.google.com/p/elemental-getusermedia-demo/source/browse/#svn%2ftrunk%2felementalgetusermediademo when run app, error below show, can't find problem. message: 08:08:57.756 [error] [elementalgetusermediademo] unable load module entry point class com.jooink.experiments.elementalgetusermedia.client.elementalgetusermediademo (see associated exception details) java.lang.runtimeexception: deferred binding failed 'com.google.gwt.user.client.impl.domimpl' (did forget inherit required module?) @ com.google.gwt.dev.shell.gwtbridgeimpl.create(gwtbridgeimpl.java:53) @ com.google.gwt.core.shared.gwt.create(gwt.java:72) @ com.google.gwt.core.client.gwt.create(gwt.java:86) @ com.google.gwt.user.client.dom.&lt;clinit&gt;(dom.java:64) @ com.google.gwt.user.client.ui.flowpanel.&lt;init&gt;(flowpa

android - Call an Activity method from inside adapter? -

i have custom adapter has click listener on listview image. this code inside adapter getview: holder.iconimage.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //code stuff when image clicked } my images in listview consist of images of folders (to represent folder) , actual images. so if user clicks on folder image, want able call method called "movedownfolder" in activitya. i'm not sure if can done inside of adapter? [edit] in activitya have click listener on custom listview, if click on text in custom listview, moves down folder (if folder). but can click on image in listview, opens image in new activity. if click on folder icon in listview (which image of course in imageview) - want code move down folder, instead of trying open image. i recommending on using interface listener. for example: 1, create interface: public interface mylistener { void folderclicked

css - background-size contain AND length -

i have div has background image size set contain. however, image double resolution image retina computers (macbook pro, etc), i'd able make page aware somehow though i'm saying background-size:contain 200x200 image, should treating if 100x100 image. there way this? want this: { background-position:center bottom; background-size:contain background-size-again:100px 100px; /*???*/ } okay should use background-size:cover this force image stay @ high resolution , set element size size want it, example 100px x 100px

eclipse - Generate Signed APK grayed out in Android Studio -

i have files , .gradle eclipse (developer sent them me) , have .gradle on android studio. when go (build/generate signed apk) button grayed out have changed build version , name. would there better option me edit app instead of using .gradle have files never used android studio or eclipse before.

mongodb - Autopublish removed but why can I still retrieve data from db? -

i have simple meteor/mongodb project using 'roles' package optain data db client. roles package seems work fine , browser shows right data depending on logged in, should do. when running 'meteor remove autopublish' in terminal inside applications directory 'autopublish removed' should. still can retrieve data server before(!?) i have of db calls client/client.js. the server/server.js nothing (i have publish/subscribe code uncomment now) , same goes common js file in main directory. how can be? perhaps retrieving data minimongo somehow? have removed insecure if don't think matters in case(?) in advance. edit: here's code: client.js: //when uncomment subscribe's should not access server/db, 'data' holds inlogg info still shows. 'movies' on other hand doesn't, shouldn't. //meteor.subscribe('data'); //meteor.subscribe('movies'); /*############# user data ###############*/ template.userloggedin

breeze - BreezeJS - Zza sample won't run -

i'm trying run zza sample. i've followed instruction exactly. when try , run: "node server" or "node server.js" get: c:\users\robbyv\documents\code\breeze\samples\zza-node-mongo\zza-node-mongo\server.js:9 app.configure(function(){ ^ typeerror: object function (req, res, next) { app.handle(req, res, next); } has no method 'configure' @ object.<anonymous> (c:\users\robbyv\documents\code\breeze\samples\zza-node-mongo\zza-node-mongo\server.js:9:5) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:901:3 sorry, instructions , zip file downloaded outdated. discard them both. i have since updated the web site page sample new download instructions , have updated readme.md within sample instruction

php - Editing a plugin - User Messaging WP -

a question newbie in php: i have plugin called user messaging wpmu dev wordpress, allows users communicate each other. paid plugin. want, admin of wp receive content of every message being sent (for private , moderation reasons) got advice of i'm trying follow. "unfortunately, there no hooks achieve want. therefore, need make modifications plugin. doesn't require coding, need function messaging_new_message_notification() in messaging.php file. function sends email notifications user when message sent. need duplicate call wp_mail() in line 398 pointing specific email address. should notice email sent when user notification settings enabled, might need duplicate whole block if want send custom email default." so have code: function messaging_new_message_notification($tmp_to_uid,$tmp_from_uid,$tmp_subject,$tmp_content) { global $wpdb, $current_site, $user_id, $messaging_email_notification_subject, $messaging_email_notification_content; if (is_multisi

asp.net - Disable customErrors within a page -

is possible set customerrors="off" single page within page? i'm trying build short sample , want code contained within single page (just .aspx, including c# code) sample can distributed single file , enhance debuggability. is there anyway inline configuration in page?

python - to_excel on desktop regardless of the user -

is there way use pandas to_excel function write desktop, no matter user running script? i've found answers vba nothing python or pandas. pandas.dataframe.to_excel() requires argument excel_writer either file path or existing excelwriter-object. just give path argument: >>> df.to_excel('path_to_your_file.xls') more specifically, write users desktop, use os.path.expanduser : >>> path = os.path.join(os.path.expanduser("~"), "desktop", "your_file.xls") >>> df.to_excel(path) os.path.expanduser guarantees you'll home directory of user on posix , windows there many corner cases should take account. for example on windows, if users home directory managed via active directory, you'll home directory resides on network drive, , there might not desktop -folder. similarily linux users have free hands rename or delete folder called desktop . or might not have desktop folder, linux doesn't

javascript - AngularJS: Order search results by similarity to search text -

Image
i have built countless angular-powered, find-as-you-type-style searches on past year or so, , love how easy implement. however, 1 problem i've never found solution how sort search results. appreciate has ideas on how this. here's problem : please see this plunker reference if @ super-simple example plunker above, have list of sample pets want able search through. if type text field, list of pets gets narrowed down. great. problem, search results aren't sorted in relation how similar text entered. for example : there total of 8 pets in list, sorted name using orderby:'name' filter on list's ng-repeat directive. if type character t input, 5 remaining results. pet @ top of list "blackie" (because blackie first pet in list has t in it, because blackie's type "cat", contains t ). what see way sort remaining results similarity search text. so, in example above, instead of seeing "blackie" @ top of list,

android - httpurlconnection post empty json -

i trying post json string linux server. however, says no json object decoded. when testing @ local host 10.0.2.2:5000. can json object. is there can make work? thank you. the error shown below: valueerror: no json object decoded update: think has android permission. in manifest file, i've added <uses-permission android:name="android.permission.internet" /> is there other lines should've added make post request work? to answer own question: well, i've resolved problem. turns out have add 1 line: this works. here code: conn = (httpurlconnection) url.openconnection(); conn.setdoinput(true); conn.setdooutput(true); conn.setrequestproperty("content-type", "application/json;charset=utf-8"); conn.setrequestmethod("post"); conn.setusecaches(false); conn.connect(); wel

sql server - Locking when using Read Uncommitted -

Image
i have query take little while run, run isolation level set read uncommitted, data can dirty since used give quick overview of system @ glance. the query on day (first thing in morning) takes around 3-15 seconds run. (date sorting slows down, instant without sort) but day starts takes long , longer run, ends taking > 2 minutes run. what noticed query seems lot of object/page locks when executed. what don't understand why acquiring locks while set read uncommitted. one of index's query uses set use row/page locking. my q: does index set use row/page locks, cause data locked when being accessed, when query read uncommitted? read uncommitted isolation level changes behaviour of readers only. in read committed , higher isolation level, when task tries read row, forst asks lock manager shared lock on it. request honored if there no existing exclusive lock on other session, otherwise have wait it. in read uncommitted reader not request shared lo