Posts

Showing posts from April, 2011

c# - Cannot add any control on the workspace [Catastrophic failure] -

Image
there problem developer machine when created project on silverlight. @ moment add control on grid shows exception , layout destroyed. here steps replicate problem. create new silverlight application uncheck host silverlight application in new web site choose silverlight version: silverlight 5 and creates blank project file when tried add code inside grid <button content="button" horizontalalignment="left" margin="67,125,0,0" verticalalignment="top" width="75"/> it generates exception: see below >> click here see full screen image << the 2 stacktraces generated: at ms.internal.xcpimports.methodex(intptr ptr, string name, cvalue[] cvdata) @ ms.internal.xcpimports.methodex(dependencyobject obj, string name) @ ms.internal.xcpimports.uielement_updatelayout(uielement element) and at ms.internal.xcpimports.checkhresult(uint32 hr) @ ms.internal.xcpimports.frameworkel

wmi - How to know if IEEE 1394 (FireWire) is connected to my Windows 7? -

my computer has ieee 1394 (firewire) input. how programmatically know if 1394 connected windows 7? you can use win32_1394controllerdevice wmi class.

c++ - cin in a while-loop -

#include <iostream> using namespace std; int main() { string previous; string current; while (cin >> current) { if(current == previous) { cout << "repeated word"; } previous=current; } return 0; } my questions are: when states while(cin>>current) , why entire entered string of text not assigned current? don't understand how compares words individually. how word previous. how know 2 of same words adjacent? edit: think understood why. tell me if wrong think because compiler stops cin assignment @ space , first word assigned current, compares previous word, since first word, not have previous word assigned first word previous , compares next word in sentence until there no more words left. i'm how works going leave in case ever wondering similar. the default behavior stop on whitespace when reading strings doing. can change read whitespace saying std

Not a constructor error within jQuery.on -

given following code: var test; this.test = function() { //... }; $(document).ready(function() { $(this).on('click', function(e) { test = new test(); //... i test not constructor. why? @edit: constructor , adding variable test type: function test(){ this.something = 'hello'; } $(document).ready(function() { $(this).on('click', function(e) { var test = new test(); alert(test.something); }); }); this result in alert 'hello' text. adapting code, can do: var test = { something: "hello" }; $(document).ready(function() { $(this).on('click', function(e) { var test = new object(); alert(test.something); }); });

java - JCombobox Listener how to enable it when item is selected? -

i have jcombobox displays name database patients_details public void comboitem() { chooser.removeallitems(); chooser.additem("please select..."); try { string sql="select * patients_details"; pst = conn.preparestatement(sql); rs=pst.executequery(); while (rs.next()) { string id = rs.getstring("patient_id"); // id string name = rs.getstring("name"); // name comboitem comboitem = new comboitem(id, name); // create new comboitem chooser.additem(comboitem); // put combobox string tmp=comboitem.getid(); } } catch (sqlexception sqle) { system.out.println(sqle); } } this comboitem class returns name , not id public string tostring() { return this.name ; } my question how selecteditem action can performed have no clue how have been trying bunch of code 2 hours appreciated nb java beginner private void ch

How to single sign on into gmail, yahoo mail & facebook from Spring based Web application with ldap as Authentication provider -

we have spring mvc & jsf based web application uses spring security user authentication using ldap provider & after successful authentication user profile fetched oracle database. now need integrate facebook, gmail & yahoo mail application. the expected behavior after doing login web application user should automatically logged in facebook , gmail & yahoo mail well. user profile in oracle database contain login id of gmail, facebook & yahoo mail. the menu in application contain links gmail, yahoo mail l & facebook & while user click on menu corresponding site open logged in user in iframe without asking user id & password of website. if password of gmail, yahoo mail & facebook account of users not needed keep database. please let me know if there way achieve this. i started thinking use oauth2 , don't know whether right way go forward or not. please me relevant single sign on solution solve this. [note: web application uses java

jquery - Caching AJAX results with PHP -

i have ajax call retrieves lines file via json. have 3m rows in database , want show result cannot see anything. the results retrieved via json wanted cache, if data requested more once, not send request again. best practices caching in jquery? i use php in server side. suggestions appreciated. my javascript code: function getsearchresult(char,company,category,country,page) { $.ajax({ type: "post", url: "companyresult.php", data: { mysearchchar : char, mysearchcompany : company, mysearchcategory : category, mysearchcountry : country, mypage : page }, cache: false, datatype : "html", beforesend: function(){ $("#loading").show(); //show image loading $('html, body').animate({scrolltop:$('#insid_body_web').offset().top}, 'slow'); $("#resultcompany1").hide();

java - how to read a file line by line and append some string each line? -

i want open file , read line line. in lines want append string line. possible? i have code opening file , reading following: file file = new file("myfile.txt"); bufferedreader bufrdr = new bufferedreader(new filereader(file)); string line = null; try { while((line = bufrdr.readline()) != null) { // read line line , append string line } } catch (ioexception e) { // ... } but how can append string current line , write file? as reading file line line. append text line , write other file. example file different name , later can rename file. just try { while((line = bufrdr.readline()) != null) { // read line line , append string line //pseudo code newline = line + "yourtext"; outputstreamtootherfile.write(newline); } } i think there no way can read , write same file concurrently, holds read/write locks. thanks

java - Google App Engine Cloud Endpoints OAuth 2.0 Scopes -

i'm trying follow following guide: https://developers.google.com/appengine/docs/java/endpoints/auth i've followed steps , added client id , user parameter when null throw oauthrequestexception exception. when deploy google , access api using api explorer expected unauthorised exception when accessing api without oauth. great works far! it suggests switch oauth 2.0 toggle. , message saying: * api not declare scopes. can manually add scopes using box below the message directs me to: http://code.google.com/apis/accounts/docs/oauth2.html learn more scopes. but there limited information scopes on suggested page. i'm new oauth , despite searching google , stackoverflow i'm not sure scope is? how declare on in api? when manually add api explorer prompt error message saying invalid_scope. valid scope? for authentication work cloud endpoints need request scope: https://www.googleapis.com/auth/userinfo.email the cloud endpoints library needs user&#

javascript - Can the requireJS optimizer update static file references and names with MD5 checksums? -

i'm doing first steps requirejs r.js optimizer . i want fingerprint static files adding md5 checksum filenames (as per here ) besides adding cache-control , expiry headers . i'm wondering if there feature in optimizer, create md5 checksum based on file contents , modify filename, plus references in application accordingly. since there lot of dependency tracing , file manipulation when running optimizer, wondering, if possible default or if there plugin available (although there nothing on plugins page)? thanks infos! not possible of now. more information on github / google group

linux - Validate Mail Status Bash Script -

i' doing this: echo "test mail" | mail -s "subject" "some@mail.com" it's send ok! must validate in shell script if mail sent or not. i don't find way validate if mail sent or not. edit: the validation have if return value in mail app 0 if [ "$?" = "0" ]; echo "mail enviado a: $destinatarios" else echo "mail no enviado a: $destinatarios" fi you should define "sent" means you. return status of "mail" specifies if message accepted local mta or not. there still many things may happen prevent delivery final recipient. beginning there being no network connection on local machine , ending recipient overlooking message in his/her inbox. mail delivery asynchronous. there mechanisms requesting delivery , read receipts, seldom work. may have better luck processing non-delivery reports. however, of them may take arbitrary time arrive. for matter, 0 exit stat

jquery - Get number of CSS3 rotation cycles from matrix3d -

i trying rotate image using css3 rotatey . need angle of rotation using jquery. my problem understanding how many cycles image has rotated. example: 180 degrees: matrix3d(-1, 0, -0.00000000000000012246467991473532, 0, 0, 1, 0, 0, 0.00000000000000012246467991473532, 0, -1, 0, 0, 0, 0, 1) 360 degrees: matrix3d(1, 0, 0.00000000000000024492935982947064, 0, 0, 1, 0, 0, -0.00000000000000024492935982947064, 0, 1, 0, 0, 0, 0, 1) 540 degrees: matrix3d(-1, 0, -0.00000000000000036739403974420594, 0, 0, 1, 0, 0, 0.00000000000000036739403974420594, 0, -1, 0, 0, 0, 0, 1) 720 degrees: matrix3d(1, 0, 0.0000000000000004898587196589413, 0, 0, 1, 0, 0, -0.0000000000000004898587196589413, 0, 1, 0, 0, 0, 0, 1) as can see each 180 degrees, absolute value of third element adds 0.00000000000000012246467991473532. satisfied result, @ point logic breaks , not apply more. after 4th cycle numbers being added become random. what correct way number of rotation cycles? --------------------

mysql - how to spread the tables over whole page -

Image
i generate eer diagram mysql workbench: as can see tables placed in 1 place , manually spread them annoying job. is there way automatically spread them on whole page? on 'arrange' menu, select 'autolayout'.

networking - How does a packet get to the destination on the same network -

Image
this shows network of 3 workstations , router. below routing table of pc 1 if pc1 sends packet pc 2. how destination? have understood pc1 refer routing table, , broadcast packet.for entry in routing table make use of? it's third entry in routing table: 172.16.18.0/24 routed through 172.16.18.1 local network interface. os knows packets network should delivered through interface.

html - Cannot set Property "Something" of undefined. Trouble with JavaScript "strict mode"! -

i having trouble javascript "strict mode". coding library constructor when enable strict mode @ beginning of library so, "use strict"; error - uncaught typeerror: cannot set property 'e' of undefined . following constructor code :- (function(window, document, undefined){ "use strict"; function ram(cssselector) { //the main constructor of library if (this === window) { return new ram(cssselector); } if ((cssselector !== undefined) && (typeof cssselector === "string")) { this.e = catchel(cssselector); } else { this.e = cssselector; } this.csssel = cssselector; } }(this, this.document)); thanks @dave , able fix issue in following way:- function ram(cssselector) { //the main constructor of library if (this === window) { return new ram(cssselector); } //this code helps call constructor without new keyword! //thanks dave help! if (this instanceof ram) { this.e =

r - How to configure FastRWeb to use RServer built-in web server -

i'm new rserve (and fastrweb). installed rserve 1.7.0 want use built-in webserver. have apache running on machine want run rserve/fastrweb on custom port. i did cd /usr/local/lib/r/site-library/fastrweb;sudo ./install.sh , created /var/fastrweb/ directory tree. i'm not seeing configuration file mentions port. default /var/fastrweb/code/rserve.conf looks this: socket /var/fastrweb/socket sockmod 0666 source /var/fastrweb/code/rserve.r control enable i'm guessing means uses unix sockets, default? think question exactly have put in (and remove from) file to, say, have listen on tcp port 8888? , there else need do? (i want able connect other machines, not localhost.) possibly related, i've looked @ /var/fastrweb/web/index.html , contains javascript going connect /cgi-bin/r/ path specific when using apache, or going fine, as-is, when using rserve? there explanation of setting port in rserve 1.7.0 release announcement . therefore, @ top of rserve.con

javascript - Creating new variable from another -

what best way create new array or object another. since doing var oldvar = {x:1,y:2} //or [x,y] var newvar = oldvar will link them, bets best way clone or cope new variable? numbers in javascript numbers in javascript spec calls ' primitive value type ' from specification numbers : number value # Ⓣ primitive value corresponding double-precision 64-bit binary format ieee 754 value. note number value member of number type , direct representation of number. so in case newvar copy of oldvar , not reference. in javascript, number , boolean , undefined , null or string value types. when passing of these 5 around, in fact passing values , not references, no need clone those. when pass else around (objects) need use cloning since reference types. when cloning objects in javascript there 2 approaches. shallow cloning this means clone 1 level deep. assuming our properties in object enumerable (this case if haven't used property

string - how to strip alt character code with php -

i'm using code strip unwanted characters string, have big problem alt+0160 character non break space. need remove well $name = str_replace ("'", "", $name); $name = str_replace ("&quot;", '"', $name); $name = str_replace ("&amp;", "&", $name); $name = str_replace ("&lt;", "", $name); $name = str_replace ("&gt;", "", $name); $name = str_replace ("&", "_", $name); $name = str_replace ("*", "_", $name); $name = preg_replace('/[^ \p{l}\p{n} \@ \_ \- \.]/u', '', $name); $name=str_replace(chr(0xc2a0),'',$name);

google app engine - Key.create vs. ofy().load() -

i want key entity (i don't need actual entity. need key child entity). so know there 2 ways of doing it: // 1. key<thing> tkey = com.googlecode.objectify.key.create(thing.class, id); // 2. key<thing> tkey = ofy().load().type(thing.class).id(id); what's difference between them? what's faster? 1 should use? would answer change if had well: thing t = tkey.get(); you want use key.create(thing, id) . ofy().load().type(thing.class).id(id) returns ref<thing> , not key<thing> . loads thing out of datastore, not want.

html - CSS sidebar iframe positioned incorrectly for firefox, chrome & most probably ie -

i have sidebar loads content through iframe. in safari looks fine in chrome & firefox .content div shoots out right can't seem pinpoint why happening. sidebar.html: <body> <div id="sidebar" class="open"> <div class="nav"> <div class="tr"> <div class="top"> <ul> <li class="link"><img src="_images/attributes/user.svg"></li> <li class="link"><img src="_images/attributes/contribute.svg"></li> <li class="link"><img src="_images/attributes/attribute2.svg"></li> <li class="link"><img src="_images/attributes/attribute2.svg"><

metadata - How can I add meta data to a maven pom -

i have maven pom deployed repo -and want add meta data tags..... example, date created, git md5, etc... most importantly , want meta data seen in pom itself, (and embedded in jar/zip artifact, easy do). can add more (nonidentifying) xml fields pom declaration, can used browsing not required defining pom resource ? if not, simple way annotate information resource in maven deployment server (i'm using archiva, similar nexus)-- of course, there "version" field, don't want have cram metadata 1 field. there fields in pom.xml can used found under more project information in pom reference. you squeeze information description tag , parse way like. or use <properties/> , create useful tags there fulfill requirements. may not recommended way use properties still option. by using properties easy values manifest.mf file using filtering techniques in combination maven jar plugin .

php - Increment on "__toString" -

i not sure title should be, code should explain better: class group { private $number = 20; public function __tostring() { return "$this->number"; } } $number = new group(); echo $number, php_eol; echo ++ $number, php_eol; echo php_eol; $number = "20"; echo $number, php_eol; echo ++ $number, php_eol; echo php_eol; $number = 20; echo $number, php_eol; echo ++ $number, php_eol; output: 20 20 <--- expected 21 20 21 20 21 any idea why got 20 instead of 21 ? code below works: $i = null ; echo ++$i ; // output 1 i know group object implements __tostring , expected ++ work string __tostring or @ least throw error the order in operations happen important: the variable fetched object, won't casted integer (or else). this ++ operator increments lval (the long value) of zval , nothing else. object pointer remains same. internal (fast_)increment_function called zval has pointer object, che

jquery - How can I use the minimal amount of Twitter Bootstrap to get the fluid benefits? -

i want sites work on form factors (phones, tablets, desktop/laptops) , orientations (vertical , horizontal). twitter bootstrap's "fluid" example seems great this. have i'm infatuated ... might "twitterpated"! is there template asp.net (web page/razor) web site (not web app) incorporates need of twitter bootsrap-o-rama fluidity? if not, "bare bones" must implement this? enough reference bootstrap .css , .js , add class="content-fluid" , "row-fluid" (or whatever they're named exactly) pertinent tags? the class declarations (row-fluid, etc.) need placed in _sitelayout.cshtml, stimmt? there template, bare minimum need is <div class="row-fluid"> <div class="span6">content</div> <div class="span6">more content</div> </div> you don't have use div.container-fluid (though bootstrap way, , helps when view result on phone). you don

java - how to convert Date object to string/long and send it via client/server -

hi i'm having little trouble sending date object client server can compare them. i'm trying is: 1)send date object 2)compare times 3)set time both machines average time both so far have done this: server: public class server implements runnable{ private int port; private string name; private date mydate = new date(); private date date; public server(int port, string name){ this.port=port; this.name=name; } public synchronized void run(){ while(true){ try{ method(); } catch(exception e){ return; } } } public synchronized void method() throws exception{ long dates; long average=0; string[] values = new string[10]; dateformat df = new simpledateformat("eee mmm dd kk:mm:ss zzz yyyy"); serversocket server = new serversocket(port); socket s=server.accept(); inputstream in= s.getinputstr

osx - Best install flow for a new rvm/ruby/pg/rails setup -

i've reformatted mac mountain lion machine due lots errors in rails development, broken links, outdated versions, etc, etc. i'm trying install rvm, ruby, postgresl , rails. i've installed xcode command line tools , i'm looking recommendations on order install rest reduce likelihood 1 can't find other. should install homebrew before of these? i've read rvm has new package manager of stuff, install homebrew - , not being unix expert appealing. have experience this? also recommend installing postgres before rvm or after rvm/ruby/rails set up? xcode command line tools homebrew git rvm ruby rails postgres you may @ point warning form nokogiri being built 1 version of libxml dynamically loaded another. pretty stuck whatever version being dynamically linked because macos depends on , loaded during boot , nokogiri needs dynamically linked. if starting new mountain lion should ok. if not, there dozens of variations of solutions amount compil

javascript - Limit various checkbox inside different classes independently -

i'm novice js , jquery , i'm facing problem cannot solve knowledge... have site lets users select different types of salads different options, need limit choices of items , don't know how it. checkboxes resides inside class, have many of them , wanted limit ones in particular class. $(document).ready(function(){ $('#dressing-1 input[type=checkbox]').click(function(){ if($('#dressing-1 input[type=checkbox]:checked').length>=2){ alert($('#dressing-1 input[type=checkbox]:checked').length); $('#dressing-1 input[type=checkbox]:not(:checked)').prop("disabled", true); } else { $('#dressing-1 input[type=checkbox]').prop("disabled", false); } }); }); this code have right , it's working, first item. make code available of items class .contenido-dressign , i'm using id #dr

asp.net mvc 3 - ViewData is empty when returning view -

i baffled s have never came across this. have shared view called "error" outputs standard message followed custom message: @model system.web.mvc.handleerrorinfo @{ viewbag.title = "error"; } <h2> sorry, error occurred while processing request. @{ viewdata["errormessage"].tostring(); } </h2> inside controllers catch block setting viewdata custom message: catch (exception ex) { ... viewdata["errormessage"] = "this custom message"; return view("error"); } however, when view loaded, viewdata shows key "errormessage" never outputs string. your expression not display because don't write out viewdata["errormessage"] response. with @{ ... } create razor code block not write output executes code inside. to write output need use @ sign: <h2> sorry, error occurred while processing request. @viewdata["errormessage

slice - Slicing in Python(Not Duplicate, Slicing for Translation) -

this question has answer here: how split list evenly sized chunks? 52 answers split string every nth character? 15 answers hey guys have simple question. how slice string of length equal parts ie agttgtcgaggttgcgatttattgggtgcgagt 3 into agt tgt cga ggt tgc gat tta ttg ggt gcg agt ? >>> s = 'agttgtcgaggttgcgatttattgggtgcgagt' >>> n = 3 >>> [s[i:i+n] in xrange(0, len(s), n)] ['agt', 'tgt', 'cga', 'ggt', 'tgc', 'gat', 'tta', 'ttg', 'ggt', 'gcg', 'agt']

iphone - pushViewController not working when animated:NO -

i'm not sure broke in app, when try change view controller, won't work when animated:no. when animated:yes, works displays error: unbalanced calls begin/end appearance transitions here's (fairly simple) code calling it: jviewerviewcontroller *viewer = [[jviewerviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:viewer animated:no]; i did nslog on navigation controller, viewer visible view controller. interestingly, counts viewer visible view controller. this occurs when try , display new viewcontroller before current view controller finished displaying. can reproduce navigating in viewwillappear. basically trying push 2 view controllers onto stack @ same time. push 1 @ time on stack , check on exit current view whether there queued detail views need displaying. hope helps you.

sql - How to update record from alphanumeric to numeric only? -

topic : data cleaning - checking outlier - out of pattern i'm trying update custid value 'a123' '123', '22a4' '224' want keep integer inside custid, don't want custid contain non-integer character (a z , z) create table customer ( custid varchar2(10) primary key, custname varchar2(30) ); insert customer(custid,custname) values ('a123','angel'); insert customer(custid,custname) values ('22a4','chris'); insert customer(custid,custname) values ('2333','chris'); update customer set custid = -- want change 'a123' '123', '22a4' '224' ; use this... update customer set custid = regexp_replace(custid, '[^0-9]+', '') ; or try this... update customer set custid = regexp_replace(custid, '[^[:digit:]]+', '') ;

wordpress - How make side bar appear first in moble? -

how can make sidebar appear fist before content in twenty eleven theme. now if resize browser sidebar goes end, need add sidebar go first in mobile. locate <?php get_sidebar(); ?> in template file, , move top. so, example, when @ index.php, this: <?php /** * main template file. * * generic template file in wordpress theme * , 1 of 2 required files theme (the other being style.css). * used display page when nothing more specific matches query. * e.g., puts home page when no home.php file exists. * learn more: http://codex.wordpress.org/template_hierarchy * * @package wordpress * @subpackage twenty_eleven */ get_header(); ?> <?php get_sidebar(); ?> <div id="primary"> <div id="content" role="main">

embed HTML within ASP.net -

i trying format items in shopping cart display in listbox in asp.net using ms visual studio 2010. program displays them elements of each item concatenated string, works less elegant like. my display function within cartitem class is: public function display() string return product.productname & "; " & product.productid & ", (" + quantity.tostring() & " @ " & formatcurrency(product.unitprice) & " each) " end function i told "embed html format string. add table, trs , tds , css." looked "embed html" in w3schools , got nothing seemed relevant. not find in class textbook. when try insert statements tags , visual studio transforms them , . tried putting statements response write follows: response.write("<html>") response.write("<table>") response.write("<tr>") response.write("<td>") response.write("<

oop - How to implement interface in Ada? -

dont know oop pattern called how can same pattern in ada? example code: interface vehicle{ string function start(); } class tractor implements vehicle{ string function start(){ return "tractor starting"; } } class car implements vehicle{ string function start(){ return "car starting"; } } class testvehicle{ function testvehicle(vehicle vehicle){ print( vehicle.start() ); } } new testvehicle(new tractor); new testvehicle(new car); my failed attempt in ada: how fix properly? with ada.text_io; procedure main package packagevehicle type vehicle interface; function start(self : vehicle) return string abstract; end packagevehicle; type tractor new packagevehicle.vehicle null record; overriding -- optional function start(self : tractor) return string begin return "tractor starting!"; end start; type car new packagevehicle.vehicle null record; overridi

error while sending a String from C client to Java server -

i send integer c client java server , worked perfectly. when tried same thing string got , error client code send string char clientstring[30]; printf("string send : \n"); if( send( to_server_socket, &clientstring, sizeof( clientstring ), 0 ) != sizeof( clientstring ) ) { printf( "socket write failed"); exit( -1 ); } and java code read it datainputstream din = new datainputstream(socket.getinputstream()); string clientstring=din.readutf(); system.out.println(clientstring); error java.io.eofexception @ java.io.datainputstream.readfully(datainputstream.java:180) @ java.io.datainputstream.readutf(datainputstream.java:592) @ java.io.datainputstream.readutf(datainputstream.java:547) @ servicerequest.run(servicerequest.java:43) @ java.util.concurrent.executors$runnableadapter.call(executors.java:439) @ java.util.concurrent.futuretask$sync.innerrun(fu

random procedure wants exact integers in scheme -

i given real number between 0 , 1. niceness-factor. factor kind of probability. mean if 0.2, means happen probability of 1/5. i tried use random procedure this. here code piece: (if (eq? 'c (tit-for-tat my-history other-history)) 'c (if (= (random (/ 1 niceness-factor)) 0) 'c 'd)) however "random" procedure wants me give exact integer number. how can solve problem? there procedure similar random? thanks in advance... just convert niceness-factor integer-like value (something comparable result of random ). example: (if (eq? 'c (tit-for-tat my-history other-history)) 'c (if (> (random 100) (* 100 niceness-factor)) 'c 'd)))

Opening not existing ftp folders via ftp.cwd() in python -

i have such case - i'm working ftp of ftplib in python. i have list of ftp pathes, need check existence. going check ftp.cwd() method + try\except , - when exception raised, folder doesn't exist. pwd of folders, don't exist in fact (i check ftpzilla ) return 250 cwd command successful , in ftp.nlst() list of folder on 1 or more folders above. according filezilla , ftp.nlst("order\dvd\pictures") there "games" folder. if make ftp.cwd("order\dvd\pictures\cars\ferari\") , returns 250 cwd command successful , ftp.nstl() equal ftp.nlst("order\dvd\pictures") . such case not in every folder, - when trying enter non-existing folders, no such file or directory right. maybe there "hidden" folders on ftp cannot found neither filezilla , nor ftp.nslt() , can reached fpt.cwd() ?

Posting symbols with Facebook api -

i trying create special characters '•' (alt+7 numlock on) on facebook api feed post using php sdk. - well, doesn't work, there issue character's encoding. tried calling: utf8_encode('•') , didn't work. when typing ' <3 ' facebook parses automatically , creates heart sign (♥). any idea how should encode that, or maybe there special magic charset '<3' creates bullet?

HTML table cell goes down when add text -

i have table this: <table class="rds" cellspacing="15px"> <tr> <td id="r1"><a id="rx1" href="#"></a></td> <td id="r2"><a id="rx2" href="#"></a></td> <td id="r3"><a id="rx3" href="#"></a></td> <td id="r4"><a id="rx4" href="#"></a></td> </tr> </table> and css file: .rds { width: auto; margin-left:auto; margin-right:auto; } .rds tr td a:link, .rds tr td a:visited { display: block; width: 39px; height: 39px; background-image: url('images/bg.png'); background-repeat: no-repeat; background-position: center; } .rds tr td a:active, .rds tr td a:hover { display: block; width: 39px; height: 39px; background-image: url('images/

redirect - Nginx Load Balancing -

i want load balance website nginx. the load balancing in nginx wiki proxy, actual file being downloaded frontend server. ( http://wiki.nginx.org/loadbalanceexample ) this how need balancing: user request file: http:// site.com/image1.jpg nginx redirect user 1 of servers (with location header): http:// s1.site.com/image1.jpg http:// s1.site.com/image1.jpg http:// s3.site.com/image1.jpg is possible nginx? http { split_clients "${remote_addr}" $server_id { 33.3% 1; 33.3% 2; 33.4% 3; } server { location ~* \.(gif|jpg|jpeg)$ { return 301 "${scheme}://s${server_id}.site.com${request_uri}"; } }

javascript - Rendering views for each model in a backbone collection -

i'm working on toy backbone.js application, library application perform crud operations on library. here book model , library collection (of books) var book = backbone.model.extend({ url: function() { return '/api/books' + this.get('id'); } }); var library = backbone.collection.extend({ model : book, url : '/api/books' }); this seems pretty straightforward. next, want able show book, have bookview... var bookview = backbone.view.extend({ tagname: 'li', render: function() { this.$el.html(this.model.get('author')); $('#list-of-books').append(this.$el); } }); all render method append li end of unordered list id of list-of-books in html. next, unsurprisingly, if add following code, list 1 item (the name of author of book id=4) var a_book = new book(); a_book.url = '/api/books/4'; a_book.fetch({ success: function() { var bookview = new bookview({ model

javascript - three.js get mouse coortinates on texture -

i want create interactive panorama one: http://mrdoob.github.io/three.js/examples/webgl_panorama_equirectangular.html but want let user interact it. is possible coordinates texture on mouse move create 3d image map three.js? thanks! check this: translating mouse location object coordinates when found triangle ray intersects, can gather triangles vertices 3d coordinates , uvs. there have enough data calculate uv position intersection point. pseudo-code: x0 = mouse.x; y0 = mouse.y; vec3 samplepoint = unproject(x0, y0); // returns (x, y, near-plane-z) coords ray.origin = camera.position; ray.direction = samplepoint - camera.position; var trianglecomplexobj = check_for_intersections( scene, ray ); // returns triangle, it's vertices , uv , 3d coord , intersection coord calulateuv( trianglecomplexobj , trianglecomplexobj.intersectionpoint ); it's maybe bit complex understand should trick. hope helps.

python - What's incorrect about my sollution in this google code jam exercise? -

today, i've participated in google code jam round 1b. in code jam, there problem called 'osmos': https://code.google.com/codejam/contest/2434486/dashboard problem description the problem states there's game, player thing, can eat things smaller it, , become larger size of thing ate. example, if player has size 10 , eats of size 8, becomes size 18. now, given size player starts off at, , sizes of other things in game, should give minimum number of operations required make game beatable, means you're able eat everything. an operation can either adding thing, or removing thing. the code used write_case function writes output every test case in right format. i've used in other code jam rounds, , know correct, , inp file object of input file. cases = int(inp.readline()) case in xrange(cases): # armin variable containing size of player, armin, n = int(inp.readline.split()[0]) # others list of sizes of other things others = [int(x) x

javascript - Toggling setInterval animation on/off -

new js , learning lot in research can't quite right. goal: 1: have image1 2: when clicked on runs setinterval function between image2 , image3, animating it. 3: when clicked on again clearinterval , goes static image1. bonus: no audio when static, plays audio when animate. caught on thirdstep. onclick function function clickio() { element=document.getelementbyid('myimage') if (element.src.match("image2.png","image3.png")) { clearinterval("animate()"); element.src="image1.png"; audiofile.pause(); } else { audiofile.play(); setinterval("animate()", 500) } } animate function function startfire() { element=document.getelementbyid('myimage') if (element.src.match("flame1.png")) { element.src="flame2.png"; } else { element.src="flame1.png"; } } example at: audibreeze another issue playing audio via various browsers. us

facebook - Fetching photos in which 2 or more people are tagged -

as title says, i'm trying fetch 10 photos in logged user , 1 or more of his/her friends tagged. i'm trying php api , fql. i'm new fql, not new programming etc. way able achieve want dynamically building multiple queries this: select pid, src_big photo pid in( select pid photo_tag subject = me() ) , pid in( select pid photo_tag subject = '1530195' or subject = '3612831' or subject = '6912041' or ... ) apart being ugly, slow. queries limited length shown above because fail when longer. multi-queries didn't me because can't use 'as', sql isn't greatest strength , i'm hoping i've missed something.. there must better way! anyone? just use 2 queries , intersection in programming language of choice. select subject, pid photo_tag subject = me() select pid, subject photo_tag subject in (select uid2 friend uid1=me()) batch these 2 calls fql?q={"userphotos":"s

c# - AForge ShapeCheker.IsCircle method -

well i'm using simpleshapechecker.iscircle method detect pupil. work fine, when sides pupil turns oval/ellipse shape. there method detect ovals?, or there way "relax" iscircle() method? thanks unfurtunately in aforge there not isoval() function. but can take @ source code of shape checker! https://code.google.com/p/aforge/source/browse/trunk/sources/math/geometry/simpleshapechecker.cs?r=1402 you can see iscircle() function , modify see if oval or not. this function: public bool iscircle( list<intpoint> edgepoints, out point center, out float radius ) { // make sure have @ least 8 points curcle shape if ( edgepoints.count < 8 ) { center = new point( 0, 0 ); radius = 0; return false; } // bounding rectangle of points list intpoint minxy, maxxy; pointscloud.getboundingrectangle( edgepoints, out minxy, o

ember.js - EmberJS Model find not up-to-date with underlying store -

for simple overview screen have developed route sets controller app.location.find(). app.locationsindexroute = ember.route.extend({ setupcontroller: function(controller) { controller.set('content', app.location.find()); }, rendertemplate: function() { this.render('locations.index',{into:'application'}); } }); i naively assumed go store , fetch me records, giving me up-to-date view of records. apparently not.... when external process starts removing records database, app.location.find() keeps on returning these deleted records. (although rest call doesn't show them anymore) if external process starts adding records database, app.location.find() picks them up. if delete records form within ember app model correctly updated. how should deal in ember app ? i'd have up-to-date view on whatever in database. right need refresh page (f5) date view. using linkto helpers shows me stale data. this seems yet trivial thing misse

actionscript 3 - Strange issues when using addChild and hitTest with AS3 -

i having couple of problems when adding child in action script 3. building space invaders game , writing function adds asteroids stage. my first problem previous asteroids being added each time try add new asteroid. my second issue when add hittestoject function. throws error , doesn't when space ship hits asteroid object. here error receive hittestobject: typeerror: error #1034: type coercion failed: cannot convert "ast_0" flash.display.displayobject. @ spaceranger_fla::maintimeline/addastroid() @ flash.utils::timer/_timerdispatch() @ flash.utils::timer/tick() and here code. use timer each asteroid added every 5000ms: // add astoid var asttimer:timer = new timer(5000); asttimer.addeventlistener(timerevent.timer, addastroid); var i:number = 0; function addastroid (e:timerevent):void{ var ast = new astroid(); ast.name = "ast_"+i; ast.y = math.random()*stage.stageheight; ast.x = 565; addchild(ast); trace(i

php - Standard encoding for urls for Sitemap -

this question exact duplicate of: sitemap urls special characters [closed] 6 answers i want submit sitemap google, don't want mess up. having trouble urls submit; of them have special characters in them such ampersand ( & ) symbol , parenthesis () . want know correct way handle them? i using php's urlencode() , turns them in %28 , %29 , on doesn't , scared if give google links , go on index them index them as domain.com/blabla%28blabla.html rather than domain.com/blabla&blabla.html are generating xml hand? please consider using php dom classes instead. you'll want encode ampersands &amp; , etc., it's best let library emit well-formed xml you. see generating xml document in php (escape characters) more discussion of this.

ios - Index 0 beyond bounds for empty array when calling addObject? -

i have nsmutablearray initializing this: self.items = [[nsmutablearray alloc] init]; at point, array empty. so, add object this: nsstring *string = @"item one"; [self.items addobject:string]; but app crashes , throws exception: *** terminating app due uncaught exception 'nsrangeexception', reason: '*** - [__nsarraym objectatindex:]: index 0 beyond bounds empty array' *** first throw call stack: (0x3460b3e7 0x3c306963 0x34556ef9 0xad7d 0x36465569 0x3644a391 0x36461827 0x3641d8c7 0x361c9513 0x361c90b5 0x361c9fd9 0x361c99c3 0x361c97d5 0x3642393f 0x345e0941 0x345dec39 0x345def93 0x3455223d 0x345520c9 0x3813133b 0x3646e2b9 0x7a15 0x3c733b20) libc++abi.dylib: terminate called throwing exception my question is, know array empty, why crashing when i'm trying populate it? the exception says all , there no errors in code have posted here. go through exception . **[__nsarraym objectatindex:]**: index 0 beyond bounds empty array it

ruby on rails - WebHDFS::ServerError when using webhdfs to access HDFS -

i'm using ror3 , webhdfs build web site access hdfs, when i'm using webhdfs in users_controller, webhdfs::servererror response body empty.. response. my userscontroller code is: class userscontroller < applicationcontroller ... ... def create @user = user.new(params[:user]) # create directory in hdfs user webhdfs = webhdfs::client.new('lhy-namenode', 50070, 'lhy') webhdfs.mkdir('abc') if @user.save flash[:success] = "welcome" redirect_to @user else render 'new' end end ... end and error message occurs when click submit button create new user. shows: webhdfs::servererror in userscontroller#create response body empty.. i don't know now, can me? thank much!