Posts

Showing posts from May, 2010

html lists - Create string of nth li's in jQuery -

html lists - Create string of nth li's in jQuery - how create string of each 3rd li, resulting in black,red,blue from this: <div id="container"> <ul> <li>shirt</li> <li>x-large</li> <li>black</li> <li>9.99</li> </ul> <ul> <li>pants</li> <li>large</li> <li>red</li> <li>19.99</li> </ul> <ul> <li>shoes</li> <li>medium</li> <li>blue</li> <li>9.99</li> </ul> </div> try below, $(function () { var result = []; $('#container ul').find('li:eq(2)').each(function () { result.push($(this).text()); }); result.join(); }); demo: http://jsfiddle.net/bxjbh/ jquery html-lists css-selectors

Deciphering object oriented programming concepts in Java -

Deciphering object oriented programming concepts in Java - i've been reading object oriented concepts, , i'm getting lost. conceptually, understand method "does" , class "blueprint". i've read analogies, thing makes sense me far is: loops,if then, variable assignments, primitive info types, , basic syntax. to me, programme program program. type in instructions, , computer executes. guess don't see big picture. the biggest part of oop sky view, organization , code reuse. want organize 'objects' particular thing , want able reuse other applications well. thought makes easier maintain doing , info , how working together. broad allow me know not understanding. bundling code individual software objects provides number of benefits, including: modularity: source code object can written , maintained independently of source code other objects. 1 time created, object can passed around within system. information-hiding: inte...

How do you wrap var args in Go? -

How do you wrap var args in Go? - according several groups posts, next code should work: package main import "fmt" func demo(format string, args ...interface{}) { var count = len(args) := 0; < count; i++ { fmt.printf("! %s\n", args[i]) } fmt.printf("%+v\n", format) fmt.printf("%+v\n", args) fmt.printf(format, args) fmt.printf("\n") } func main() { demo("%s %d", "hello world", 10) fmt.printf("\n\n") demo("%d %s", 10, "hello") } and yield "hello world 10" , "10 hello", not. instead yields: ! hello world ! %!s(int=10) %s %d [hello world 10] [hello world %!s(int=10)] %d(missing) ! %!s(int=10) ! hello %d %s [10 hello] [10 %!d(string=hello)] %s(missing) which passing []interface{} function takes ...interface{} argument does not expand argument , instead passes value. first %s expands []interface{} string, , no farther argum...

message - RestFB: Exception: Unable to convert Facebook response JSON to a list of java.lang.String instances -

message - RestFB: Exception: Unable to convert Facebook response JSON to a list of java.lang.String instances - i have desktop application reads facebook messages (unified_message in fql terms), left on facebook page other users. problem is: when user writes message, include link, facebook automatically attaches object message. , attachment causes exception in restfb lib. unfortunately, page access token not help, because have logged in me in facebook in order utilize it. scenario simple, seek leave message on page “www.wheather.com - cool site”. i’ve tried restfb 1.6.9 , 1.6.11 – same result both. sorry formatting. couldn't in other way :( here stack 1.6.11: com.restfb.exception.facebookjsonmappingexception: unable convert facebook response json list of java.lang.string instances. offending json {"38d79791ef0dac6f0b645a87f4d152d7":{"icon":"https://fbstatic-a.akamaihd.net/rsrc.php/v2/yd/r/as8ecmyrys0.gif","fb_object_type":"...

linux - Socket.IO cannot call 'on' -

linux - Socket.IO cannot call 'on' - i making simple node.js app , intend utilize socket.io far cannot server start. this code: var http = require('http'), io = require('socket.io'), fs = require('fs'); http.createserver(function(request, response){ fs.readfile(__dirname + '/index.html', function(err, data){ if(err){ response.writehead(500, {'content-type': 'text/plain'}); homecoming response.end('error'); } response.writehead(200, {'content-type': 'text/html'}); response.end(data); }); }).listen(1337); io.sockets.on('connection', function(socket){ socket.emit('pic', { addr: '/pic.jpg' }); socket.on('status', function(data){ console.log(data); }) }) and output receive: [root@ip-10-224-55-226 node]# node server.js /srv/node/server.js:16 io.sockets.on('connection...

javascript - How to go about creating a tooltip that shows-up instantly while animating position and opacity? -

javascript - How to go about creating a tooltip that shows-up instantly while animating position and opacity? - this bit broad, note i'm not looking spoon-feeding solution general direction. i want create next behaviour: tooltip shows instantly, on click. opacity/position animation starts instantly, until fades out. several tooltips can visible @ 1 time (in case 2 or more buttons clicked shortly 1 after another) i'm looking plugin similar behaviour, find tooltip plugins standard tooltip behaviour. can seek code myself i wondered whether there's jquery plugin allows this, i'm not aware of.. it easier add together fading out animation tooltip plugin have trying find 1 witch suits needs. javascript jquery css3 jquery-animate css-animations

dojo - Dojox Form/Upload behavior on file selection -

dojo - Dojox Form/Upload behavior on file selection - how can observe when has indeed picked files file explorer , has nail select? want add together event on selection of files. i figured out. have tie input form onchange method. <input type="file" data-dojo-attach-event="onchange:_onupload" data-dojo-type="dojox/form.uploader"/> _onupload: function(evt){ } dojo dijit.form

c# - Passing path as arguments -

c# - Passing path as arguments - i trying pass path string arguments windows form application. understand need add together quotes. using below code. directoryinfo info = new directoryinfo(path); string.format("\"{0}\"", info.fullname); the code above works when path d:\my development\gitrepositories . when pass c:\ argument c:" because lastly \ character working escape character. am doing wrong? also, there improve way this? thanks in advance. commandlinearg space delimited, hence u need pass command-arg " which mean if path = c:\my folder\ sent 2 argument, if passed "c:\my folder\" single argument. so string commandarg = string.format("\"{0}\"", info.fullname) c# command-line-arguments

c++ - Call javascript or set element focus from CHtmlView -

c++ - Call javascript or set element focus from CHtmlView - i have chtmlview instance load known page. there edit box element on page, , able set keyboard focus element programmatically in response serial event. unfortunately i'm stuck using visual studio 6 , finding documentation hard wade through. i can ihtmldocument2 interface view, not ihtmldocument3. looking guidance on how either phone call javascript chtmlview side, or set focus in window specific element. if knows of examples appreciated. i think nice article should starting point. has illustration how fill form c++ mfc vc6

php - Turning url from SQL into clickable link -

php - Turning url from SQL into clickable link - i'm trying create text url inserted 'tag' column of sql database turned clickable link within php table. right now, i'm having manually set link html in database, don't want do. this code i've got: <?php mysql_connect(localhost, user, pw) or die(mysql_error()); mysql_select_db(database) or die(mysql_error()); ?> <table id=table class=display> <thead><tr><th>owner</th><th>soquili's name</th><th>sex</th><th>generation</th><th>parents</th><th>kind</th><th>theme</th><th>colorist</th><th>tag</th><th>alt 1</th><th>alt 2</th><th>alt 3</th></tr></thead> <tbody> <?php // result limit $sql = "select * soquili limit 25"; $result = mysql_query($sql)or die(mysql_error()); while($row = mysql_fetch_ar...

nhibernate - NHibrenate Could Not Load Type -

nhibernate - NHibrenate Could Not Load Type - i'm getting unusual behavior linq nhibernate. can retrieve objects want , can add together clauses. but in specific case next exception: could not load type x.foo.bar.bars. possible cause: assembly not loaded or not specified. x.foo.bar.bars part of piece of lambda look in clause. where bars collection of objects. collection filled when query without clause. query.where(x => x.foo.bar.bars.any(b => b.name == "barname")); the stacktrace this: at nhibernate.util.reflecthelper.classforfullname(string classfullname) and yes, mapping files embedded resources. part of mapping: <bag name ="bars" inverse="true" lazy="false" cascade="none" optimistic-lock="false" access="framework.nhibernate.properties.entitycollectionaccessor, assembly"> <key column="bagid" /> <one-to-many class="...

process - Default/System Android Processes -

process - Default/System Android Processes - i working on android project monitors applications user running , cross-checks corresponding processes whitelist stored internally on device. in order create work, need know default or scheme processes device can add together them whitelist. beingness said, have few questions hoping might able answer: is there way differentiate between default/system process must running, , process belongs app on device? are there different default/system processes depending on phone/version of android user running? if so, process names available somewhere developer use? or there other way obtain them? if need elaborate more please allow me know, help. let's seek activitymanager , getrunningappprocesses() . iterate on array of runningappprocessinfo objects , find importance of importance_foreground . if docs right (haven't tried this), there should 1 process importance_foreground -- 1 in ui foreground. (services c...

Sorting a huge text file using hadoop -

Sorting a huge text file using hadoop - is possible sort huge text file lexicographically using mapreduce job has map tasks , 0 cut down tasks? the records of text file separated new line character , size of file around 1 terra byte. it great if 1 can suggest way accomplish sorting on huge file. used treeset in map method hold entire info in input split , persisted it. got sorted file! sorting hadoop mapreduce cloudera

javascript - Sunday only on Jquery Datepicker? -

javascript - Sunday only on Jquery Datepicker? - aim: allow users select sunday on datpicker calendar. currently have done, except reason every other day except sunday works. when utilize 7 sunday in code below entire calendar unclickable, other day works perfect. $(document).ready(function() { $("#datepicker2").datepicker({ autosize: true, // automatically resize input field altformat: 'yy-mm-dd', // date format used firstday: 1, // start mon beforeshowday: function(date) { homecoming [date.getday() == 7,''];}}); // allow 1 day week }); question: how can allow sunday selection? date.getday() returns value in range 0-6 , not 1-7 . beforeshowday: function(date) { homecoming [date.getday() === 0,'']; } javascript jquery datepicker

SQL Server 2008 R2 Standard: database tuning (to avoid deadlocks) -

SQL Server 2008 R2 Standard: database tuning (to avoid deadlocks) - currently, i'm facing problem microsoft sql server 2008 r2 standard edition (10.50.1600). structure/coding of database has not been modified much lately (been in utilize 3-4 years now) there has been alter in hardware. current spec. of new hardware follows: cpu: intel xeon e5-2630 @ 2.30 ghz ram: 16 gb windows: windows server 2008 64-bit hdd: 1 tb the problem that, since alter in hardware, there has been deadlocks , slow performances regularly. tried few suggestions find around web, being: 1.) alter "cost threshold parallelism" "5"(default) "8". 2.) added missing indexes according sql analyzer tool. it's been 2 months since alter , there has been improvement. however, there still few deadlocks every , then. question : apart sql-tuning (we need go through many steps before getting approved), there other way can improve performance? have read little snapsho...

php - Jquery pass parameter from script tag -

php - Jquery pass parameter from script tag - hi guys want know there possibility pass variables from <script src="js/scripts.js"></script> this tag? mean this: <script src="js/scripts.js">$par = "hello world"</script> or <script src="js/scripts.js" par="hello world"></script> there no need or utilize of defining variable do. try this: <script>var par = "<?php echo $par; ?>"</script> php javascript jquery variables parameter-passing

java - Call activity located in an external android library (jar) -

java - Call activity located in an external android library (jar) - i trying phone call activity located in external android library. i have two projects in eclipse : -superapp (contains mainactivity has "start calculator activity" button) -additionlibrary (contains calculatoractivity has "this calculator activity" textview) here source code activities : https://gist.github.com/poiuytrez/4714770 if reference application superapp using project properties->android->library http://tinypic.com/r/2v31s8z/6 app works fine. if export jar of additionlibrary (http://tinypic.com/r/30m9wld/6) add together in libs folder of superapp, , add together jar in java build path (http://tinypic.com/r/2efksk0/6), when launch app i have next issue : "android.content.res.resources$notfoundexception". http://tinypic.com/r/2hnbb6q/6 i have looked everywhere not find root cause of issue. if adding jar file project, need resources used in libr...

We would like to create a JavaScript API, is a jQuery plugin a good choice? -

We would like to create a JavaScript API, is a jQuery plugin a good choice? - we have android , ios libraries connecting restful web backend. now, considering javascript library. because ouselves using jquery lot considering jquery plugin. the problem examples have found seem based on modifying dom, e.g. typically functions plugin adds element-centric. our plugin, in constrast, abstracting ajax calls required. commerce api, have calls (e.g. get): jquery.ourapigetproduct("12345", { onerror: function(e) {... }, onsuccess: function(e){...} }); the api need initialized base of operations url , credentials, too. what think? jquery plugins fit, or improve off creatign standalone lib? there tutorials , examples out there network-based jquery/javascript apis? you should not set plugin methods in jquery. the reason involve jquery @ take advantage of $.ajax() , homecoming promises. javascript jquery api

jquery - image flicker javascript on mouseover when using image maps -

jquery - image flicker javascript on mouseover when using image maps - i using image maps hover images in slider, works there flicker until loads once, works well. knows why happening? by way, happens in firefox <script> image1 = new image() image1.src = "images/slide1aroll.jpg" function firstmap() { document.emp.src = image1.src; homecoming true; } </script> <li style="width: 480px; height: 610px;"><img src="images/slide1a.jpg" name="emp" id="emp" class="emp" width="480" height="610" usemap="#model1" style="display:block; border:none;" border="0" /></li> <map name="model1" id="model1" name="model1"> <area shape="rect" coords="31,6,289,576" href="#" onmouseover="firstmap();" onmouseout="document.emp.src = 'images/...

Link Cryptlib Library with Qt creator -

Link Cryptlib Library with Qt creator - i have qt creator 2.6.1 based on qt 5.0 have build cryptlib visual studio 2010 all cryptlib project on c:\sdk\cl342 when have built project crypt.h , cl32.lib , cl32.dll in folder c:\sdk\cl342 i getting linker error on every method phone call cryptlib such cryptinit have tried adding project menu , add together external library makes many changes pro file not allow me include crypt.h. mainwindow.obj:-1: error: lnk2019: unresolved external symbol _cryptend@0 referenced in function "public: __thiscall mainwindow::mainwindow(class qwidget *)" (??0mainwindow@@qae@pavqwidget@@@z) – my pro files looks this. **qt += core gui greaterthan(qt_major_version, 4): qt += widgets target = testlistview template = app sources += main.cpp\ mainwindow.cpp headers += mainwindow.h forms += mainwindow.ui includepath = c:\sdk\cl342\ dependpath += c:\sdk\cl342\ libs += c:\sdk\cl342\cl32.lib** qt qt-creator linker-er...

linux - Is there a .deb install file equivalent of .rpm first time install argument -

linux - Is there a .deb install file equivalent of .rpm first time install argument - in .rpm file, there alternative check whether current install first version installed on current scheme i.e. %pre , %post scripts passed argument equal 1* when lastly version erased %preun , %postun scripts passed argument equal 0*. ref: is there equivalent thing in installing of .deb files? seems pretty obscure , searches turning nil little. in .deb scripts, current version of bundle beingness installed passed in argument $2 . if it's empty, means there no version of bundle installed. linux install debian rpm deb

c# - Toggle an input -

c# - Toggle an input - i using slimdx utilize xbox 360 controller , way of when pressing button on controller state changes on , stays on when press 1 time again becomes off. sort of toggle. have been unable 1 far(just beginner really). thanks help. thomas. you may utilize bool determine if button toggled on or off. need know gamepad's previous state, bool won't toggle time, because maintain pressing button. bool mycommand = false; // declare bool gamepadstate oldstate; // need know previous state of gamepad public void update() { if (gamepad.getstate().keypressed == /*key*/ && oldstate.keypressed != /*key*/) mycommand = !mycommand; oldstate = gamepad.getstate(); } keep in mind, may need utilize other gamepad or gamepadstate , simply pseudo-code c# windows-7 toggle slimdx gamepad

algorithm - How to find the root of a dependency tree using parent and child information of a node -

algorithm - How to find the root of a dependency tree using parent and child information of a node - i first provide background info. how info stored: %pom_family{$gav} = [\%parents, \%children] before posing question define above variables way utilize them in context: $gav --> can considered random node in our dependency tree %parents --> hash contains list of nodes $gav depends on %children--> hash contains list of nodes depend on our $gav my question following: given have parents , children of chosen node, algorithm appropriate utilize in order analyze dependency dependency , find root $gav ie $gav has no parents. thanks in advance! :-d note: if question not clear enough, provide feedback , alter question :-) algorithm tree dependencies root nodes

ajax - twitter bootstrap dynamic carousel -

ajax - twitter bootstrap dynamic carousel - i'd utilize bootstrap's carousel dynamically scroll through content (for example, search results). so, don't know how many pages of content there be, , don't want fetch subsequent page unless user clicks on next button. i looked @ question: carousel dynamic content, don't think reply applies because appears suggest loading content (images in case) db server side , returns static content. my best guess intercept click event on button press, create ajax phone call next page of search results, dynamically update page when ajax phone call returns, generate slide event carousel. none of discussed or documented on bootstrap pages. ideas welcome. if (or else) still looking solution on this, share solution discovered loading content via ajax bootstrap carousel.. the solution turned out little tricky since there no way determine current slide of carousel. info attributes able handle .slid event (as suggest...

regex - regular expression with javascript for second match -

regex - regular expression with javascript for second match - i have complicated string. string next marked part: (second match) example: 1;#firstname,, surname,#domain\account,#email.@company.com,#email@company.com,#firstname,, surname25;#firstname,, surname,#domain\account,#email.@company.com,#email@company.com,#firstname,, surname26;#helpdesk,#de\helpdesk,#helpdesk@vega.com,#,#helpdesk30;#... i want sec "firstname,,surname" combination... ideas how this? in illustration above need ignore finish first part starting 1;# 25;# , need "firstname,,surname" , after rest of string should ignored. the numbers can different , length string... i started not working: ((.*?[0-9]+.*?){2})[0-9]+ thanks in advance help. you can utilize string split function , split var arry = yourstring.split(',') arry[9],arry[11] contain string. javascript regex

c# - where and how many try & catch blocks should I write? -

c# - where and how many try & catch blocks should I write? - i wonder @ levels of application whoudl write try-catch ? dal? cache? bl? ui-logic? if write log , re-throw it should utilize try-catch in every function? aswuming function can have exception didn't think of well, depends. in ui layer, grab errors globally in application_error, , handle these accordingly. try-catch errors not want bubble ui , cause redirection generic error page. has been effective me in reporting most, if not all, errors. some people handle errors differently; they'll grab errors in business layer, , either log , homecoming them bll, or log , rethrow generic error. instance, check out how enterprise library exception block approaches errors. you can utilize aop library postsharp attach objects want handle errors for, or utilize mvc's exception filtering handling errors too. c# asp.net asp.net-mvc

jar - jython ImportError: No module named -

jar - jython ImportError: No module named - i'm new jython , failing utterly @ importing java class within jar. what trying write wrapper shell script calls jython script. can not allowed edit jython @ all, adding jars sys.path within jython script not possible. error y", line 17, in com.polarland.testmodule.cache import cacheinterface importerror: no module named polarland i've added jar contains above bundle name of testmodule.jar path, classpath , jythonpath no avail. i'm worried due name of jar not sure. any advice appreciated!! in shell script use: export classpath=testmodule.jar:$classpath jython ... in case setting classpath enough. remember utilize total path name , remember utilize .jar name ( testmodule.jar , testmodul.jar different). maybe utilize wrong file rights. seek file command check if can read file. illustration 1 of jars use: mn$ file junit-4.1.jar junit-4.1.jar: zip archive data, @ to the l...

c++ - Casting between primitive type pointers -

c++ - Casting between primitive type pointers - is next well-defined: char* charptr = new char[42]; int* intptr = (int*)charptr; charptr++; intptr = (int*) charptr; the intptr isn't aligned (in @ to the lowest degree 1 of 2 cases). illegal having there? ub using @ stage? how can utilize , how can't you? first, of course: pointer guaranteed aligned in first case (by §5.3.4/10 , §3.7.4.1/2), , may correctly aligned in both cases. (obviously, if sizeof(int) == 1 , when not case, implementation doesn't have alignment requirements.) and create things clear: casts reinterpret_cast . beyond that, interesting question, because far can tell, there no difference in 2 casts, far standard concerned. results of conversion unspecified (according §5.2.10/7); you're not guaranteed converting char* result in original value. (it won't, example, on machines int* smaller char* .) in practice, of course: standard requires homecoming value of new char[...

android - How to remove the Default orange Highlight Effect for EditText programmatically? -

android - How to remove the Default orange Highlight Effect for EditText programmatically? - i utilize selector styling edittexts. want rid of orange color, when doubletap on edittext. utilize this: states.addstate(new int[] {r.attr.textcolorhighlight}, getresources().getdrawable(r.color.transparent)); but doesn't create difference! body know why? , interestingly part of code works well: states.addstate(new int[] {r.attr.state_focused}, getresources().getdrawable(r.color.transparent)); but don't want alter state, when focuced! this not easy (programmatically). seek accomplish using statelistdrawable. can utilize statelistdrawable background of edittext in theme can handle different states. if found interesting sample maybe helps out. sorry didn't seek myself: apply statelistdrawable programmatically android android-edittext state highlighting

d3.js - Transition line/path to depict "live" data D3 -

d3.js - Transition line/path to depict "live" data D3 - following on previous post: "live" graph d3.js simulated data. i pulling info @ 1 min intervals database. json array beingness updated new "live" data, while both x , y axis's updating line/path isn't? https://gist.github.com/majella/5fc4cd5f41a6ddf2df23 i cannot figure out why - can help? ps - tried adding data.push() , data.shift() "setinterval" function allow new info - doesn't seem create difference - , axis's beingness condensed , hard read new info added. you mention axes getting compressed. indicate info continually beingness added in mysql table, when run query, pulling all time values out. could suggest include line in mysql query pulls out amount info in length of time want display. for instance, if wanted display 60 minutes of info select lastly hr worth of results appropriate 'where' statement this... selec...

c# - How to prevent expose any other interface methods? -

c# - How to prevent expose any other interface methods? - i have 1 interface below public interface i1 { public int add(int , int b); public int subtract (int a, int b); } public class myclass : i1 { //here can access both methods of interface i1 //add , subtract want expose add together not subtract method //how can accomplish this? } how can expose particular method , prevent other. you hide method explicit implementation. i'd bad thought , should split interface in 2 instead, possible public class myclass { public int i1.subtract(int a, int b) { throw new notimplementedexception(); } } when done subtract visible when object cast i1 c# asp.net .net interface

c++ - Any downside to using the "and" operator vs the && operator? -

c++ - Any downside to using the "and" operator vs the && operator? - any pros/cons using "and" operator vs && operator? think "and" going cause confusion (ironically). if there aren't differences, why exist? seems silly , unnecessary. they're anachronisms - introduced accomodate folks didn't have "^" or "|" characters on keyboards. furthermore, although "and" , "&&" equivalent ... "and" , "&" quite different. using "and" instead of "&&" confusing on number of different levels, several different reasons. including giving poor maintenance programmer unnecessary "wtf?" experience. i not utilize them in code. , i've never seen them used in "live" code. imho... here's bit more on topic, if you're interested: the written versions of logical operators http://www.cplusplus.com...

g++ - error related to static linking of glibcxx and glibc -

g++ - error related to static linking of glibcxx and glibc - i am trying cross-compile x86 programme alpha using g++. that, tried both "-static-libgcc" , "--static" options when linking object file libraries generate binaries. cross compilation successful, got next errors when ran binaries on alpha machine: ./word_count: /lib/libc.so.6.1: version glibc_2.4' not found (required ./word_count) ./word_count: /usr/lib/libstdc++.so.6: version glibcxx_3.4.10' not found (required ./word_ these errors shouldn't happen, since using static linking! so, cannot figure out why getting these errors! help appreciated. you need link against both, standard c , c++ libraries. (source) g++

arduino - How to determine checksum from decoded IR remotes -

arduino - How to determine checksum from decoded IR remotes - i have little 3.5ch useries helicopter controlled ir remote control, using arduino have decoded 32 bit protocol. except lastly 3 bits appear form of checksum. have decoding channels remote, in track corresponding controls, can see slight changes in controls yield specific changes in 3 bits, reproducible , deterministic. whereas have not yet found mutual theme or formal reproduce supposed checksum. have tried simple things parity or added checksum. can see effects of changing specific bits on cksum when combine changes don't add together 3 bit value. struct useries // bit construction recieved 32 bit ir command { unsigned cksum : 3; // 0..2 unsigned rbutton : 1; // 3 unsigned lbutton : 1; // 4 unsigned turbo : 1; // 5 unsigned channel : 2; // 6,7 unsigned trim : 6; // 8..13 unsigned yaw : 5; // 14..18 unsigned pitch : 6; // 19..24 unsigne...

difference between new android application project and new android sample project on eclipse -

difference between new android application project and new android sample project on eclipse - i newbie world of android. wanted know difference between new android application project , new android sample project on eclipse. when click on new android sample project, straight shows me android api level display. display says "this target has no samples" , true if pick api level. new android sample project allows access sample projects provided sdk need download android manager. on eclipse go to->android sdk manager ->once open bundle details can find samples sdk (each api level have samples, may latest target backward compatible api level). install ones need. find samples target under new android sample project. new android project starting new project without using sample. android

Node.js chat app doesn't load -

Node.js chat app doesn't load - i created node.js chat app.. app doesn't load. code basic node.js chat app: // load tcp library var net = require('net'); // maintain track of chat clients var clients = []; // start tcp server net.createserver(function (client) { console.log("connected!"); clients.push(client); client.on('data', function (data) { clients.foreach(function (client) { client.write(data); }); }); }).listen(5000); // set friendly message on terminal of server. console.log("chat server running\n"); after compile it, write in chrome browser localhost:5000 page maintain loading , never finish. however, next code works perfectly: // load tcp library net = require('net'); // start tcp server net.createserver(function (client) { client.write("hello world"); client.end(); }).listen(5000); run windows 7 64 bit on computer, , i'm using...

php - Mysql Query formatting issue -

php - Mysql Query formatting issue - i'm building private message system, , database has multiple lines. in database: i love song you? -joe but query ends displaying this i love song you? -joe here's query <?php include 'core/init.php'; protect_page(); include 'includes/overall/header.php'; $username = $user_data['username']; ?> <?php $result = mysql_query("select * messages sentto1='$username'"); echo '<h2>messages: </h2><br>'; while($row = mysql_fetch_array($result)){ echo '<b>from: '; echo $row['from1']; echo '</b><br><br>'; echo 'subject: '; echo $row['subject1']; echo '<br><br>'; echo 'message: '; echo $row['message1']; echo "<br />"; echo "<br />"; } ?> <?php include 'includes/overall/footer.php'; ?> t...

Indexing error when running this binary search method in python -

Indexing error when running this binary search method in python - def unique(ip): file = open("/home/user/desktop/ipaddreses.txt",'r') list = file.readlines() list.sort() low = 1 hi = len(list) target = converttostr(ip) if hi > 1: while low <= hi: mid = low + (hi-low)/2 if list[mid] == target: file.close() homecoming false elif list[mid] < target: low = mid+1 else: hi = mid-1 else: if target == list[0]: homecoming false file.close() homecoming true get error: if list[mid] == target: indexerror: list index out of range purpose search through generated ip addresses create sure randomly created ip addresses unique. working before ... got home ...

jointable - Access join table fields in Doctrine2 -

jointable - Access join table fields in Doctrine2 - here (simplified) category entity: /** * @orm\entity */ class category { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id = null; /** * @orm\manytoone(targetentity="category", inversedby="children", fetch="eager") */ protected $parent = null; /** * @orm\onetomany(targetentity="category", mappedby="parent", fetch="lazy") * @orm\jointable(name="category_tree", * joincolumns={@orm\joincolumn(name="parent_id", referencedcolumnname="id")}, * inversejoincolumns={@orm\joincolumn(name="child_id", referencedcolumnname="id")} * ) */ protected $children; } can write dql query give me result with, each category: its id an array ids of children in sql it...

How to create a Rule on Drupal that creates activity streams of followed users? -

How to create a Rule on Drupal that creates activity streams of followed users? - i'm using flags, commons follow, message , rules modules create ability users follow each other. i utilize commons auto generated commons_follow_user flag create follow button. generate button through views on each node. if user presses button on node submitted user b, user starts next user b. default commons follow user module shows user b name on user business relationship page. need user see activity stream of user b, more see when user b adds new node. understand have utilize rules , messages modules. have created rule triggers message entity creation on new node creation how create stream visible users next user creates nodes? there way rule conditions? or should in other direction accomplish this? it looks you're trying create sort of social network. a module i'm pretty fond of statuses module if you're looking post activity, there's heartbeat module i ...

c# - regex to match string not starting and/or ending with spaces but allowing inbetween spaces -

c# - regex to match string not starting and/or ending with spaces but allowing inbetween spaces - i need regex not match strings starting and/or ending space(s) matching in between spaces. i'm not expert on regex. i can utilize 2 regexes if needed. note: using . showing space in examples. match false for .text. ..text text.. ..te.xt.. match true for text te..xt i came this. matches starting spaces. ^(?!\s+).*$ you can utilize \s character class ^ , $ anchors. ^\s(.*\s)?$ the optional .*\s grouping needed match single non-space character. c# regex

uiimagepickercontroller - Is it possible to Create custom album in IOS 6 -

uiimagepickercontroller - Is it possible to Create custom album in IOS 6 - can 1 tell me.. want work photographic camera application have know possible create custom album in ios 6. know possible in ios5 searched ios6 did not clear information.. yes, possible. method want alassetslibrary method addassetsgroupalbumwithname:resultblock:failureblock: detailed in docs here: http://developer.apple.com/library/ios/#documentation/assetslibrary/reference/alassetslibrary_class/reference/reference.html#//apple_ref/occ/cl/alassetslibrary it introduced in ios 5 , has not since been deprecated, i'm not quite sure issue if it's not working you. may have update or repost question if having problem it. uiimagepickercontroller alassetslibrary

c# - How to process time consuming serverside initialization in MVC? -

c# - How to process time consuming serverside initialization in MVC? - i started little project, expieriencing world of js , html5. i tried few months ago, already, stopped, because i've had not plenty time create mvc single page application scratch. there many concepts , patterns, had understood , have regretted losing knowledge lack of utilize on daily work. use or lose it! yesterday found this post on john papa's blog , thought great utilize start. it's mvc template, called hottowel, implements great concepts data-binding, minification , forth. experience code far needed moment , experience further, i'd need to. i'd build application fetching info works existing info model project. in our silverlight application, bootstrap through preloading , initializing dictionaries , other properties , calling async init() methods (e.g. downloading xml files containing custom codes , set them dictionaries). mef used rid of unhandy dependencies. as far un...

c# - Referencing multiple methods using one delegate -

c# - Referencing multiple methods using one delegate - i'm sandpitting delegates. in next illustration dd reference p.m and p.n ? can add together line run p.m 1 time again after adding p.n ? or need implement d dd = p.m; again? class programme { private delegate int d(int x); static void main(string[] args) { programme p; p = new program(); d dd = p.m;//d dd = new d(p.m); console.writeline(dd(3).tostring()); dd += p.n;//dd += new d(p.n); console.writeline(dd(3).tostring()); //<<is there quick way run p.m ? console.writeline("press [enter] exit"); console.readline(); } private int m(int y) { homecoming y*y; } private int n(int y) { homecoming y*y-10; } } yes, after first assignment ( d dd = this.m; ), assignment made using += called. you may remove method, using -= , refer next sample; d dd = p.m;//d dd ...

html - When i hover css menu horizontal scrollbar appears -

html - When i hover css menu horizontal scrollbar appears - like title says. i made css hover menu in <body> , , want in top right corner of browser. when hover menu horizontal scrollbar appears downwards in browser. someone know why ?? , how solve ? here link example: http://jsfiddle.net/pdbyz/24/ it's because of submenu's box-shadow, have clip somehow edit: because of <div class="sub_menu_top"></div> , have set it's position right:0 html css css3

getting a registry key and value in C# -

getting a registry key and value in C# - sorry if simple, haven't coded since college. i'm trying write programme view registry entries in windows 7. want check see if registry value exists first, check see value is. if doesn't exist, want 1 message, if exist, want 1 message reflecting value of 1, , reflecting value of 0. got code work if registry key doesn't exist, if add together key , value crashes. not sure i'm doing wrong here. suggestions appreciated. here code. using (registrykey key = registry.localmachine.opensubkey(@"system\currentcontrolset\services\lanmanserver\parameters")) if (key != null) { string val = (string)key.getvalue("enableoplocks"); if (val == null) { oplocktextbox.text = "not nowadays in registry"; oplocktextbox.backcolor = color.yellow; } else if (val == "1") { opslocktextbox.text = "no"; opslocktextbox.backcolor = color.red;...

wordpress - WP: How to get just one post, from one category and show it -

wordpress - WP: How to get just one post, from one category and show it - hello guys! have code, shows 1 post each category need show 1 post, , need set "name" of category i'm trying this: <?php $cat_args = array( 'orderby' => 'name', 'order' => 'asc', 'child_of' => 0 ); $categories = get_categories($cat_args); foreach($categories $category) { echo '<dl>'; echo '<dt> <a href="' . get_category_link( $category->name ) . '" title="' . sprintf( __( "view posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></dt>'; $post_args = array( 'numberposts' => 1, 'category' => $category->term_id ); $posts = get_posts($post_args); foreach($posts $post) { ?> <dd><a href="<?php the_per...

python - how mock only one method called within the object you are testing -

python - how mock only one method called within the object you are testing - i want test method mock out other methods calls. created simple illustration should illustrate concept: class myclass(): def one_method(self): print "hey" def two_deep(self): self.one_method() def three_deep(self): self.two_deep() i using python mock framework called mox , wrote next code this: def test_partial(self): self_mox = mox.mox() some_object = myclass() ## 1. create mock my_mock = mox.mockobject(some_object) my_mock.one_method().andreturn('some_value') self_mox.replayall() ret = my_mock.three_deep() ## *** see note below called "comment": self_mox.verifyall() comment: i thought if called mock on method hadn't been overwritten, mock default original code, chain of calls want, lastly phone call beingness replaced... doesn...

pandas - Resampling Minute data -

pandas - Resampling Minute data - i have min based ohlcv info opening range/first hr (9:30-10:30 est). i'm looking resample info can 1 60-minute value , calculate range. when phone call dataframe.resample() function on info 2 rows , initial row starts @ 9:00 am. i'm looking 1 row starts @ 9:30 am. note: initial info begins @ 9:30. edit: adding code: # extract info regular trading hours (rth) 24 hr info set rth = data.between_time(start_time = '09:30:00', end_time = '16:15:00', include_end = false) # extract info extended trading hours (eth) 24 hr info set eth = data.between_time(start_time = '16:30:00', end_time = '09:30:00', include_end = false) # extract info initial balance (rth) 24 hr info set initial_balance = data.between_time(start_time = '09:30:00', end_time = '10:30:00', include_end = false) got stuck tried separate opening range individual date , initial balance c...

python - Is it acceptable to refer a variable to itself? -

python - Is it acceptable to refer a variable to itself? - e.g. blob_info = upload_files[0] blob_info = blob_info.key() or improve do blob_info = (upload_files[0]).key() i prefer splitting things create them more readable blob_info = upload_files[0] blob_key = blob_info.key() makes more sense me. or event better, refer blob_info.key() whenever it's needed. python google-app-engine

visual studio 2010 - Regex to find pattern and white space -

visual studio 2010 - Regex to find pattern and white space - i want find //this comment //this new comment strings using regex. my problem is, have next entries in file: /// valid comment so here, don't want find , replace valid comment having chars right after // i trying visual studio 2010 find , replace. want regex replace case. means, should replace //this comment with // comment . here difference white space after // . find: //{[^ ]} replace with: // \1 regex visual-studio-2010

mysql - Daylight saving in timestamps -

mysql - Daylight saving in timestamps - i'm running matlab function ( fastinsert ) insert info mysql. results right whole year except 1 hr in march, during daylight saving. in fact seems cannot insert info between 2:00am , 3:00am on day. for illustration with: ts = 2006 3 26 2 30 0 looking within matlab function found problem lies into: java.sql.timestamp(ts(1)-1900,ts(2)-1,ts(3),ts(4),ts(5),secs,nanosecs) that gives result: 2006-03-26 03:30:00.0 how can solve this? i've run similar problems in storing datetime on many occasions. treating value derived value seems create sense. in other words, instead of storing local time store value gmt , time zone. derive appropriate value when query data. this has added benefit of making possible store values multiple locations without having worry confusion downwards road. mysql matlab timestamp dst

filesize - $_FILES["file"]["size"] in megabytes -

filesize - $_FILES["file"]["size"] in megabytes - i'm using part of code variable size while uploading if ($_files["file"]["size"]<1024) { //do } but when upload files more 1mb shows me file size 0. works when upload files in bytes or kilobytes are sure these uploads successful? maybe upload_max_filesize 1m, files bigger 1m aren't uploaded. thats why 0. guessing... file-upload filesize

To replace words in a string in php -

To replace words in a string in php - i have query result written bellow (383,'_transient_dash_aa95765b5cc111c56d5993d476b1c2f0','<div class="rss-widget"><ul><li><a class='rsswidget' href='http://ma.tt/2013/02/new-yahoo-2/' title='marissa mayer announces new yahoo hompage, on wordpress-powered blog. [&hellip;]'>matt: new yahoo</a></li><li><a class='rsswidget' href='http://ma.tt/2013/02/100-gpl/' title='creative market announced of wordpress themes 100% gpl, meaning list in marketplace , reach users theme must provide users same freedoms wordpress does. have great themes already. fantastic news , i’m proud of team taking bold step, , promised [&hellip;]'>matt: 100% gpl</a></li><li><a class='rsswidget' href='http://wordpress.tv/2013/02/20/leslie-hancock-developing-a-distinctive-online-voice/' title=' [&hellip;]...

c# - Windows 8 specific file type context menu association -

c# - Windows 8 specific file type context menu association - there need add together item particular file type's context menu. in windows 7 , previous versions that's done adding hkey_classes_root\<extension>\shell\<commandname>\command key value of @="<path_to_app> \"%1\"" to registry. in windows 8 doesn't work. after deleting persistenthandler key of respective type : what's interesting, if shell/command keys written in hkey_classes_root\*\ section, context menu item appears in menu files expected, that's huge overhead in case need add together application 2-3 filetypes without breaking existing associations. i'm using microsoft.win32.registry.classesroot in c# implement logic, problem not in code because a) works in windows 7 b) manual editing administrator previledges in windows 8 doesn't add together needed association. you must have noticed there wasn't "shell" key there...

RSS feed controlled by Javascript, if else statement confusion -

RSS feed controlled by Javascript, if else statement confusion - so have rss feed displaying on multiple pages. on 1 page want events equal or beyond today's date display. on page want future events (like homepage) events of specific string title. of avoided if file read rss feed correctly feed doesn't have old dates on it. real core of problem. as of set in place homepage. sees first x number of old entries , bypasses older ones not equal or greater today's date. works homepage. (var = 0; < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; //regex queries 'match' method var filter_by_reg = regexp(filter_by, 'i'); var filter_by_2_reg = regexp(filter_by_2, 'i'); var cond1 = result.feed.entries[i].title.match(filter_by_reg); var cond2 = result.feed.entries[i].title.match(filter_by_2_reg); var today = ne...

Html/CSS results page / scorecard for cricket in WordPress -

Html/CSS results page / scorecard for cricket in WordPress - i'm total newbie web-design , in process of creating sports website based on wordpress platform. one of sports site covering cricket. site done, i'm stuck @ few of import css/html tables data. appreciate if here guide/help me on how create tables ones in links bellow or whether there anyway can re-create html/css existing site , style it. i need re-create of tables, sorting options not needed similar scorecard lite possible great are these things possible css/html in wordpress or there improve alternative such tables? thanks in advance here 2 solutions use: solution #1: tabpress plugin through graphical panel, can customize table. can set own css, can have colspan, rowspan or together. check out demo. if don't want spend much time in coding, give try. solution #2: wp_list_table it's available since wordpress 3.1. wp 3.1 uses build tables can see in admin panel. table displa...

uml - How do I add a decision branch label in Enterprise Architect 9.3? -

uml - How do I add a decision branch label in Enterprise Architect 9.3? - how add together decision branch label in enterprise architect 9.3? it basic thing guess. this help page explains except expect help page, i.e. describing how utilize it. the solution simple, terminology not obvious unless confident in using enterprise architect. double click connector, select 'constraints' tab , set label text in 'guard' field. uml

monotouch - NSInvalidArgumentException error in button click - xamarin -

monotouch - NSInvalidArgumentException error in button click - xamarin - i have been next "hello, iphone" tutorial available in xamarin website. have completed steps now. now, run application , click on "action 1" button getting error objective-c exception thrown. name: nsinvalidargumentexception reason: -[helloworld_iphoneviewcontroller actionbuttonclick:]: unrecognized selector sent instance 0xb3a5a30 how can prepare issue ? using latest versions of monodevelop + monotouch static void main (string[] args) { // if want utilize different application delegate class "appdelegate" // can specify here. uiapplication.main (args, null, "appdelegate"); <-- here } my code uploaded here if @ connections button (in xcode) you'll see you've added 2 actions button - 1 called actionbuttonclick , 1 called actnbuttonclick. in controller, monotouch appears have added partial method sec action...

javascript - Web app into desktop app with qt-creator -

javascript - Web app into desktop app with qt-creator - i have web application works through browser want embed qt application it's html javascript , css. question is, can qt creator, , if need in order work? if point me tutorials or websites give me more info appreciate it. checked out qt project.org, lacking in documentation on how i'm asking. may @ sample gives yo start http://www.developer.nokia.com/develop/qt/code_examples/ javascript html web qt-creator

Filtering with conditions on an associations's association in CakePHP -

Filtering with conditions on an associations's association in CakePHP - in app have burger model, joint model, , location model. joints have many burgers, , have many locations. what want filter burgers 2 ways: based on rating, , bases on whether belong joint has location matches condition, in case, city. here's i've tried, no workey: $burgers = $this->burger->find('all', array( 'conditions' => array('burger.official_rating !=' => 0), 'contain' => array( 'joint', 'joint.location.conditions' => array( 'location.city' => 'toronto' ) ), 'order' => array('burger.official_rating desc'), 'limit' => 10 )); joint.location.conditions seems have no effect. edit: using joins, unsure if efficient way (notice, had add together contain clause, create sure associated info returned i...

ASP.NET MVC3 Entity Framework - Data Retrieval -

ASP.NET MVC3 Entity Framework - Data Retrieval - i'm developing study tool boss using asp.net mvc3 , entity framework. i'm using poco model , dbcontext retrieve info our database , create info layer. when created sample info simple: 2 tables little number of columns, , worked liked charm. trying test application in our test environment, issue has arisen. the database working has 137 tables, need info 2 of tables. i've emulated 2 tables need info , set application accordingly, no dice. question have create class each table, though application using 2 of tables database? also, have read-only privileges in environment. should fine because application selecting data, not manipulating it. update the error i'm receiving this: entitycommandexecutionexception unhandled user code. error occured while executing command definition. details: system.data.sqlclient.sqlexception: invalid column name the column name pk have other table i'm joining wit...

knockout.js - Disable Input based on Other Inputs Knockoutjs -

knockout.js - Disable Input based on Other Inputs Knockoutjs - i trying setup knockout observable disable input, if 2 other inputs not both between 1 , 30. right when run code in jsfiddle, input disabled. unfortunately, never able reenable input. here code on jsfiddle help. html <!-- *view* - html markup defines appearance of ui --> <p>alcohol days: <input data-bind="value: alcoholdays" /> </p> <p>alcohol 5+ days: <input data-bind="value: alcoholfiveplusdays" /> </p> <p>alcohol 4- days: <input data-bind="value: alcoholfourlessdays" /> </p> <p>drug days: <input data-bind="value: drugdays" /> </p> <p>both days: <input data-bind="value: bothdays, enable: enablebothdays" /> </p> <p>enable both days: <strong data-bind="text: enablebothdays"></strong> </p> <p>alcohol days: ...