Posts

Showing posts from August, 2012

json - No results from API call in python -

my api call in python returns no results. exits code 0 there nothing displayed. there missing? still new python , got code youtube tutorial. using own api key. here code: #!/usr/bin/env python #learn how works here: http://youtu.be/pxofwuwts7c import urllib.request import json locu_api = 'xxxxxxxxxxxx' def locu_search(query): api_key = locu_api url = 'https://api.locu.com/v1_0/venue/search/?api_key=' + api_key locality = query.replace(' ', '%20') final_url = url + "&locality=" + locality + "&category=restaurant" json_obj = urllib2.urlopen(final_url) data = json.load(json_obj) item in data['objects']: print (item['name'], item['phone']) your script def ines function locu_search , not calling it; script terminates - having done nothing of value. you need call function after defined, like: def locu_search(query): #snip locu_search('san fran

Magento - Change Top Link Label of existing link (login link) -

the default magento template has top link called "login". being output standard template customer.xml. i did in local.xml, hoping remove current link "login" , readding same link different label "login / register" <action method="removelinkbyurl"><url helper="customer/getloginurl" /></action> <action method="addlink" translate="label title" module="customer"><label>log in / register</label><url helper="customer/getloginurl"/><title>log in</title><prepare/><urlparams/><position>100</position></action> however have 2 links there displaying, 1 called "login" , called "login / register". how can change label of toplink in magento? try remove <default> <reference name="top.links"> <action method="removelinkbyurl">

ios - 'UInt32' is not convertible to 'MirrorDisposition' -

Image
edit: ok. changed code as: var randomx = int(arc4random()%6) wish think of before posting here :| i took accepted answer of topic reference: swift convert uint int i've been trying make simple ios guessing app swift. i'm generating random number , getting number user , comparing both. i'm stuck error: 'uint32' not convertible 'mirrordisposition' while comparing 2 integers (one of them converted string integer toint() method) below can see ui, code, 2 stackoverflow topics read , how changed code after reading topics. ui: (i couldn't resize image) my code: import uikit class viewcontroller: uiviewcontroller { @iboutlet var myimageview: uiimageview! @iboutlet var inputfield: uitextfield! @ibaction func clickedguessbuttonaction(sender: anyobject) { println("guess button clicked") var randomx = arc4random()%6 println("randomx = \(randomx)") var guess = inputfield.text.toint()

Android:How to Update a local XML file when device finds internet connectivity -

i developing android application. application has xml file locally stored within application apk file. file contains data displayed in application. have latest updated xml file on server. want update file on device either in background or notifying user. whenever device finds internet connectivity,it should check file modification date , should update/replace old file new file server. you can check internet availability code: public boolean isconnectivityon(context ctx) { boolean rescode = false; try { connectivitymanager cm = (connectivitymanager) ctx.getsystemservice(context.connectivity_service); rescode = cm.getactivenetworkinfo().isconnectedorconnecting(); } catch (exception e) { // todo: handle exception e.printstacktrace(); } return rescode; } having in manifest following permissions: <uses-permission android:name="android.permission.internet" /> <uses-permissio

Unison source compile errors in OCAML -

i trying compile unison source using ocaml compiler(ver 4.01.0) , gnu make 4.0. source code taken link ( http://www.seas.upenn.edu/~bcpierce/unison//download/releases/unison-2.27.57/ ) i extracted tar.gz , wrote command "make native=false" mentioned in user manual ( http://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html ) see section building unison scratch windows. code starts compiling few seconds stops , following errors appear: ---------- file "/cygdrive/c/unison_build/unison-2.27.57/update.ml", line 1: error: implementation /cygdrive/c/unison_build/unison-2.27.57/update.ml not match interface update.cmi: ... in module namemap: field `split' required not provided in module namemap: field `choose' required not provided in module namemap: field `max_binding' required not provided in module namemap: field `min_binding' required not provided in module namemap: field `bindings' required no

java - How to convert String to JsonObject -

i using httprequest json web string. it quite simple, cannot seem convert string javax.json.jsonobject . how can this? jsonreader jsonreader = json.createreader(new stringreader("{}")); jsonobject object = jsonreader.readobject(); jsonreader.close(); should trick. see docs , examples .

Correctly subset R variable with greater than condition -

i want plot scatterplot values of dataframe column greater number 28. this works fine return results: abovezero <- clicks > 28 but scatterplot inexplicably renders values integers of 1 or 0. how convert variable in order plot actual values? abovezero <- clicks[clicks>28]

java - Camel AggregatonStrategy wrong result -

i using camel aggregate responses 2 sources, 1 being xml , other json. have stubbed responses , getting them file. goal aggregate responses both sources. my aggregator route looks this from("direct:fetchprofile") .multicast(new profileaggregationstrategy()).stoponexception() .enrich("direct:xmlprofile") .enrich("direct:jsonprofile") .end(); my "direct:xmlprofile" route looks - from("direct:xmlprofile") .process(new processor(){ @override public void process(exchange exchange) throws exception { string filename = "target/classes/xml/customerdetails.xml"; inputstream filestream = new fileinputstream(filename); exchange.getin().setbody(filestream); } }) .split(body().tokenizexml("attributes", null)) .unmarshal(jaxbdataformat) .process(new processor(){ @override public void process(exchange

asp.net web api - BreezeJs With Web API OData Returns "404" error when try to read Meta Data information -

getting 404 page not found error when try access odata meta data information breeze, can information if put url directly on browser(without breeze). my server side odata entity configuration noted below. var odatabuilder = new odataconventionmodelbuilder(); odatabuilder.namespace = "bisservice.entities"; odatabuilder.entityset<companydto>("company").entitytype.haskey(x => x.id); config.mapodataserviceroute("bisservice", "bizservice", odatabuilder.getedmmodel()); i using following config on breeze.' var serveraddress = "/bisservice/"; breeze.config.initializeadapterinstance('dataservice', 'webapiodata', true); var manager = new breeze.entitymanager(serveraddress); var query = breeze.entityquery.from("company"); manager.executequery(query, function(data) { console.log(data) }); i ran issues similar while attempting implement breezejs odata. after reading odata on server

python - What the heck do I get when I subclass `declarative_base` using SqlAlchemy? -

i have simple sqlalchemy application: import sqlalchemy sa import sqlalchemy.ext.declarative dec import sqlalchemy.engine.url saurl import sqlalchemy.orm saorm import sqlalchemy.schema sch import abc class itemtable(): __tablename__ = 'book_items' @abc.abstractmethod def _source_key(self): pass rowid = sa.column(sa.integer, sa.sequence('book_page_id_seq'), primary_key=true) src = sa.column(sa.string, nullable=false, index=true, default=_source_key) dlstate = sa.column(sa.integer, nullable=false, index=true, default=0) url = sa.column(sa.string, nullable=false, unique=true, index=true) # [...snip...] base = dec.declarative_base(cls=itemtable) class testitem(base): _source_key = 'test' def __init__(self, *args, **kwds): # set default value of `src`. somehow, despite fact `self.src` being set # string, still works. self.src = self._source_key print(self)

mysql - PHP variable to .sql, zip it and then download -

i generating mysql script. result this... insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); insert `table` (`v1`,`v2`) values ('1', '2'); there on 10,000 lines. assigning variable called $sql_dump i download variable using following script... header("content-type: text/plain"); header("content-disposition: attachment; filename=backup_export.sql"); echo $sql_dump; it working fine. however, file big can big 20mb. instead of downloading .sql file. want zip , download it. don't want keep on server. should generate on fly. dump mysql phpmyadmin, when choose download zipped. please thanks you can use php exec function compress file zip server function, after sql file generated. after need check if file exist , download it. need hav

winapi - Win32 - passing data to CreateThread in a "safe" way -

i have code base creates threads ad-hoc in few places following pattern: use operator new create struct contain "the stuff" thread wants work with. call win32 createthread() api. in thread proc cast lpvoid object new 'ed in step 1. use object , manually delete it. this works has couple of issues: static code analyzers think objected in step 1 can leaked, guess in fact true cases createthread fails. i'd way make more raii/automatic. the manual casting can error prone. i figured std::shared_ptr might solution, e.g in step 1 replace new std::make_shared . seems have other problems: i don't think same instance of std::shared_ptr can used in other thread? what if function calls createthread exits before thread proc starts, using dangling pointer? can suggest more elegant , safe way of doing this? other option can think of have class wraps createthread , has std::shared_ptr member , calls lamba thread proc?

design patterns - Using Antipattern in Object Oriented Java -

after reading interesting article, have few questions around this. please refer common pitfall #8: pretending java more c (i.e. not understanding oop) on [zero-turn-around] i agree authors solution pitfall. face similar issue code (abuse of instanceof ). cannot implement code author has suggested. scenario below i have jms messaging bus. messages float around system. listener typically listen messages. all messages have single parent imessage. i use instanceof distinguish between messages. the listeners typically domain specific business logic. if agree authors solution, have implement domain specific business logic in message classes, think bloat light-weight message objects. not that, have many references (composition) in message objects think unfair message objects have business (domain) behavior in it. what reasonable solution problem? example code below public void onmessage(imessage mssg) { if(mssg instanceof mopn){ ... } else if(mssg instan

Wordpress redirect old permalink structure to new -

could me following predicament? i'd change permalink structure of website current one /%category%/%postname%/ to /%category%/%post_id%/ in way old publications still reachable through old links? thank in advance! first, need 100% sure want make change site because have impact on seo, positive or negative. once change permalinks have been changed wordpress installation update links itself, however, links in menu or hardcoded links need change yourself. but answer question, best using 301 redirects allowing happens stumble across old link make correct page / post. there plugin can achieve called simple 301 redirects . authors of plugin note: it's handy when migrate site wordpress , can't preserve url structure. this fair case 301 redirects. however, search engines beyond control unfortunatly. need resubmit xml site map.

How to read avro file with bytes schema using Avro C++ library -

i have avro file doesn't have json schema. has single field called "bytes" , value binary representation of object can decode. first few bytes of avro looks like; bash-4.1$ hexdump -c ped.avro -n 32 0000000 o b j 001 002 026 v r o . s c h e m 0000010 016 " b y t e s " \0 [ 346 q 266 266 207 anyone familiar avro c or avro c++ libraries, can answer how read these bytes field? avro c: http://avro.apache.org/docs/1.7.7/api/c/index.html avro c++: http://avro.apache.org/docs/1.7.5/api/cpp/html/ i don't believe there way read avro data avro c or c++ libraries if have no schema. avro supposed have schema , without there number of possible schemas fit data.

ios - Server socket with swift -

this question has answer here: socket server example swift 2 answers i want able have 1 ios-device multiple ios-devices (is there max?) able connect , send data(a string in case) first device. i have tried tutorial: http://www.raywenderlich.com/3932/networking-tutorial-for-ios-how-to-create-a-socket-based-iphone-app-and-server have hard time understanding objective-c actually, swift same objc. need port syntax objc swift: func initnetworkcommunication() { var readstream : unmanaged<cfreadstream>?; var writestream : unmanaged<cfwritestream>?; cfstreamcreatepairwithsockettohost(nil, "localhost", 80, &readstream, &writestream); if let read = readstream { inputstream = readstream!.takeunretainedvalue() } if let write = writestream { outputstream = writestream!.takeunretainedvalue() } }

c++ - Loss of accuracy with the return statement in my code -

i'm learning c++ through great tutorial @ http://www.learncpp.com/cpp-tutorial/210-comprehensive-quiz part of quiz need create calculator code seems drop decimal. believe occurs during return statement. anyways, newbie learning c++ appreciated. code: #include "stdafx.h" #include <iostream> int input(float); int math(double, double, char); void print(double); int _tmain(int argc, _tchar* argv[]) { double fnumberone = input(0); double fnumbertwo = input(1); char operator = input(2); print(math(fnumberone, fnumbertwo, operator)); return 0; } int input(float x) { using namespace std; if (x == 0) { cout << "please enter first number" << endl; double input; cin >> input; return input; } if (x == 1) { cout << "please enter second number" << endl; double input; cin >> input; return input; } if (x == 2)

r - Logging and writing error messages to a dataframe -

i intend record errors in r code while calling functions in dataframe (err_log, say). want use 'try' identify errors while calling function,if any.the dataframe(err_log) have following columns : time : time @ function called (sys.time) loc : function call error recorded (name of function) desc : description of error r throws @ (error message in r) example : first initialize blank dataframe 'err_log' these columns then write function f <- function(a){ x <- a*100 return(x) } now put output of call 'f' in 'chk' chk <- try(f()) the above call gives error 'error in * 100 : 'a' missing' (description of error) check if(inherits(chk,'try-error')) {then want populate err_log , stop code execution} how can done in r? use trycatch instead of try then inside trycatch() , use argument error=function(e){} e have element named message, use following call browser explore e$message :

Shell Script: Grep command for wild cards -

can please tell me how grep below line because when try grep it, giving wrong results. */5 * * * * /home/file.sh" you can use grep -f (fixed strings): grep -f '*/5 * * * * /home/file.sh' cron.txt */5 * * * * /home/file.sh

javascript - Phonegap : layout breaks when keyboard is shown -

i experiencing ui issues when keyboard opened. when keyboard opened,style of elements having position : fixed breaks. appear scrolling content. please me fix problem. the issue exists in ios 6.1, 7.1 as per documentation link of phonegap build version 3.1, need use "keyboardshrinksview" preferences in config.xml. set true scale down webview when keyboard appears, overriding default beavior shrinks viewport vertically. matches default behaviour android apps. <preference name="keyboardshrinksview" value="true"/> good luck!

php - I want a alert box to come up when records are updated -

i have php file need check if variables not empty , update table.everything works fine except alert. <?php $con=mysql_connect("localhost","root",""); mysql_select_db("sg",$con); error_reporting(0); $result1=mysql_query("select declarationno,declarantreferenceno sg_report declarationno='$dec' or declarantreferenceno='$dec'"); if(isset($_post['mytext'])){ $cn = $_post['mytext']; } if(isset($_post['mytext1'])){ $dec = $_post['mytext1']; } if(isset($_post['tb3'])){ $rem = $_post['tb3']; } want alert box come when records updated if( !empty($dec) && !empty($rem) ){ $result=mysql_query("update sg_report set creditnotestatus='$cn',remarks='$rem' declarationno='$dec' or declarantreferenceno='$dec'"); echo "<script type='text/javascript'>alert('updated successfully!');</scri

javascript - How to add CSS class to CQ dialog box -

i want add css definition and css class field "mybookmark" (see below). suggestions? (this tab occur when opening page properties.) <?xml version="1.0" encoding="utf-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primarytype="cq:panel" title="interactions"> <items jcr:primarytype="cq:widgetcollection"> <share jcr:primarytype="cq:widget" title="share" xtype="dialogfieldset" collapsed="{boolean}false" collapsible="{boolean}true"> <items jcr:primarytype="cq:widgetcollection"> <mybookmark jcr:primarytype="cq:widget" type="select" xtype="selection" defaultvalue="" fieldlabel="share button" name="./share" >

android - MediaRecorder throw "java.lang.RuntimeException: start failed: -2147483648" when trying to record audio on LG G Watch -

i trying record audio in app on lg g watch. following code throws runtimeexception message "start failed: -2147483648" @ statement "recorder.start();". wondering i'm doing wrong here. i have tried lot of different set of parameters, example audiosource: recorder.setaudiosource(mediarecorder.audiosource.default); //-and- recorder.setaudiosource(mediarecorder.audiosource.mic); also outputformat have tried recorder.setoutputformat(mediarecorder.outputformat.default); //-and- recorder.setoutputformat(mediarecorder.outputformat.mpeg_4); //-and- recorder.setoutputformat(mediarecorder.outputformat.three_gpp); also tried different audioencoder recorder.setaudioencoder(mediarecorder.audioencoder.default); //-and- recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); here source code: final mediarecorder recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.default); recorder.setout

php - limit td's per row using while using numberous if tags -

i'm trying pull if statements , put them array table return new row "" per every 5 results "image". possible use functioning? reason have use because way mybb setup. it's either pull number of cells or try sort out 1 cell 25+ lines in , no particular spacers...just crammed together. i've been testing lot of different things out, can work. every google search comes kind of related search different pages. $queryleader= mysql_query("select * pju_users `uid` = '1'") or die(mysql_error()); while($dataleader = mysql_fetch_array($queryleader)){ $queryfid = mysql_query("select * pju_userfields `ufid` = '".$dataleader['uid']."'") or die(mysql_error()); while($dataufid = mysql_fetch_array($queryfid)){ echo "<tr>"; if ($dataleader['avatar'] == ""){ echo "<td><img src='images/default_member.png&

Rails form_tag remote example -

i have incredible simple form: <%= form_tag("/portal/search", method: 'get', remote: true ) %> <%= label_tag(:query, 'search for:') %> <%= text_field_tag(:query) %> <%= submit_tag("find") %> <% end %> <div id="results"></div> i know documentation, can use ajax through remote option: <%= form_tag("/portal/search", method: 'get', remote: true ) %> then stuck. know how generate results in view/partial, how partial inside div element? know bit of jquery, can select element. found lot of results, seem miss lightbulb moment me. using rails 4.1.6 my results simple records model, book (title, author) thank helping! edit i've won cup missing point long shot. had add search.js.erb inside view folder instead of assets. let's @results out of search method. in controller, search method: respond_to |format| format.html {render or redire

Using CoSign and in case of multiple signatures, how do you specify which signature to use using SOAP API? -

i using cosign developer account , have created several graphical signatures. using sample code sign pdf file , works, able enumerate signatures couldn't figure out how specify signature use out of account's signatures list. code sample used: package trial; import com.arx.sapiws.dss._1.*; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.util.list; import oasis.names.tc.dss._1_0.core.schema.documenttype.base64data; import oasis.names.tc.dss._1_0.core.schema.*; import oasis.names.tc.saml._1_0.assertion.*; public class multipesignatures { public static void main(string[] args) throws exception { string filename = "d:/demo - copy.pdf"; string signerusername = ""; string signerpassword = ""; if (!checkfile(filename)) { system.out.println("cannot find '" + filename + "' or read/write protected. aborting.");

Get servers hostname using Nagios -

i sure must simple can not seem find out how. i want display in nagios hostname of host have setup. purely information gives me way check machine set in nagios called same actual servers hostname. thanks write own plugin take $hostname$ , compare local hostname value, returning appropriate nagios-friendly results.

javascript - How to execute a href without redirection -

i want execute href without redirecting me page. execution in background. here code <a id="speechoutputlink" href="http://translate.google.com/translate_tts?tl=fr&q=text" rel="noreferrer" >download</a> when click on the href download don't want redirected page of google translator. how can this? use jquery's event.preventdefault() method : if method called, default action of event not triggered. $('a#speechoutputlink').on('click', function(e) { e.preventdefault(); ... });

java - How to turn on DDL transactional support? -

i started using flywaydb , test tried create , insert queries , fired migrate ignored create table scripts :( i used -x option debug , found strange line debug: ddl transactions supported: false seems if made true, work. does faced issue, if yes how rid of this? have did on new schema, clean-init-migrate full stacktrace below: [ec2-user@ec2 flyway]$ ./flyway -x clean /usr/bin/tput flyway (command-line tool) v.3.0 debug: adding location classpath: /home/ec2-user/installables/flyway-3.0/bin/../jars/mysql-connector-java-5.1.26.jar database: jdbc:mysql://0.0.0.0:3306/test (mysql 5.5) debug: ddl transactions supported: false debug: schema: test debug: cleaning schema `test` ... cleaned schema `test` (execution time 00:00.025s) [ec2-user@ec2 flyway]$ [ec2-user@ec2 flyway]$ ./flyway -x init /usr/bin/tput flyway (command-line tool) v.3.0 debug: adding location classpath: /home/ec2-user/installables/flyway-3.0/bin/../jars/mysql-connector-java-5.1.26.jar database: jdbc:mysql://0

uml - Program exit, functioncall in conditional in sequence diagrams -

the following code belongs object of class called "console". if ( problem.success() ) { display("congratulations. solved problem using " + movecount + " moves.\n"); system.exit(0); } display(options); how show function call problem.success() in conditional statement? should assign result temporary variable , test on variable? also how show program exits if conditional true otherwise continues? should make note?

sql - Inner Join Excel recordset with Access recordset -

is possible make inner join between excel spreadsheet , and access database table? tried many ways make possible no success. this visual basic 6 code: dim dbtemp database dim exceldb database dim xlsrs recordset set dbtemp = opendatabase(app.path + "\mydb.mdb") set exceldb = opendatabase(app.path + "\queryexceldata.xls", false, true, "excel 8.0;") set xlsrs = exceldb.openrecordset(query, dbopendynaset) ' query sql query used other results until xlsrs.eof workspaces(0).begintrans sql = "insert presenze(enterprise, emp_id, myear, mmonth, mday, workhours) " _ & " select presenze.emp_id, '"+xlsrs("entps")+"', '" + xlsrs("yr") + "', '" + " _ & " xlsrs("mnth") + "', '" + xlsrs("dy") + "', '" + xlsrs("wh") + `"' " _

parsing my given JSON in android -

i have json , please explain how parse given json value. want value 2 in textview shown. can please explain me. below json : { "name": "nbusers", "args": [ { "nb": 2 } ] } http://www.tutorialspoint.com/android/android_json_parser.htm you can learn json parsing here. try { jsonobject result=new jsonobject("your result"); //your json value parameter jsonarray array=result.getjsonarray("args"); jsonobject finalresult=array.getjsonobject(0); string nb=finalresult.getstring("nb"); } catch (jsonexception e) { // todo auto-generated catch block e.printstacktrace(); } //your result here

c++ - Do gcc's __float128 floating point numbers take the current rounding mode into account? -

do arithmetic operations on gcc's __float128 floating point numbers take current rounding mode account? for instance, if using c++11 function std::fesetenv , change rounding mode fe_downward , results of arithmetic operations on __float128 rounded down? is guaranteed __float128 specification? i believe guaranteed operations on __float128 take rounding mode account. according gnu c library documentation floating-point calculations respect rounding mode. according gcc manual __float128 floating type supports arithmetic operations division etc. from deduce, operations on __float128 , rounding mode has be taken account. the gnu c library documentation states: 20.6 rounding modes floating-point calculations carried out internally precision, , rounded fit destination type. ensures results precise input data. ieee 754 defines 4 possible rounding modes: [...] reference: http://www.gnu.org/software/libc/manual/html_node/rounding.html

javascript - Making drop down menu by click using css -

this question has answer here: creating drop down menu on click css 8 answers i have simple example of drop down menu click using ajax: http://jsfiddle.net/dmitry313/1s62x8hc/2/ html: <a href="javascript:void(0);" class="dropmenu">dropdown menu</a> <ul style="display:none"> <li><a href="#">dropdown link 1</a></li> <li><a href="#">dropdown link 2</a></li> </ul> script: $(document).ready(function () { var click = function () { var divobj = $(this).next(); var nstyle = divobj.css("display"); if (nstyle == "none") { divobj.slidedown(false, function () { $("html").bind("click", function () {

c++ - OpenCv Cropping issue -

i new opencv. trying crop image code have written not cropping it. please me out. got region of interest when try copy it copies whole image not region of interest #include<iostream> using namespace std; #include<vector> #include<iostream> #include<opencv2\opencv.hpp> cvmemstorage * st = 0; cvhaarclassifiercascade * hcc= 0; char * path = "c:/users/gardezi/documents/visual studio 2012/projects/aimrl/aimrl/haarcascade_frontalface_alt.xml"; bool startdetection(iplimage * img) { int ; cvcreateimage(cvgetsize(img) , img->depth , img->nchannels ); cvpoint pt1 , pt2; iplimage * f ; if (hcc) { cvseq * face = cvhaardetectobjects(img , hcc , st , 1.1 , 2 , cv_haar_do_canny_pruning , cvsize(40 , 40 ) ); //face data base (i = 0 ;i < (face? face->total : 0 ) ; i++) { cvrect * r = (cvrect*)cvgetseqelem(face , ); pt1.x = r->x; pt1.y = r->y; pt2.x = r->x + r->width;

javascript - Change Image onclick and change Image color in canvas -

i tried can't it. choose image shows in <img src=" " onload="getpixels(this)" id="mug"/> function changes image colors. when change image again, color doesn't change changes color of first image instead of changing color of new one. help me please don't have idea :( <script src="//code.jquery.com/jquery-1.10.2.js"></script> <img src="<?=''?>" onload="getpixels(this)" id="mug"/> <a onclick="showimage(this);" href="#bg/big-polka-dots.png" data-href="bg/big-polka-dots.png"> <img src="bg/big-polka-dots.png" width="35" height="56"/> </a> <a onclick="showimage(this)" href="#bg/chevron-navy.png" data-href="bg/chevron-navy.png"> <img src="bg/chevron-navy.png" width="35" height

How to name or number code-block in reStructuredText and Sphinx? -

i line auto number code-blocks in restructuredtext, if auto numbering not possible name/number them manually. .. code-block:: python :name: super awesome code exaple no 5 = 1 when in training can reference them , tell students on witch example work on. don't need reference them in document itself. is possible in way? out of box or extending sphinx? it possible via extending sphinx. you have create own extension (see how create extension , where put own extension ) implement new custom directive (see how create directive ). directives usual python classes, namedcodeblock directive class should extend codeblock directive class (see sphinx.directives.code.codeblock ) , add support name optional argument able set names code blocks.

java - Set transparent background of the taken Snapshot -

i use snapshot() method on shape object in order convert imageview , nest label . problem is, when take snapshot of shape object closed square field white background. there way make transparent? use code below in order convert given shape imageview object: writableimage snapshot = shape.snapshot(new snapshotparameters(), null); imageview imageview = new imageview(snapshot); label label = new label(); label.setgraphic(imageview); pane.getchildren().add(label); here go snapshotparameters parameters = new snapshotparameters(); parameters.setfill(color.transparent); writableimage snapshot = shape.snapshot(parameters, null); ...

Javascript slideshow troubleshooting -

i creating javascript slideshow company, after writing code images not showing. goal of slide show expandable, can add more images if needed. going switching out previous , next html hyperlinks buttons. or suggestions appreciated. <html> <head> <script language="javascript"> var interval = 1500; var random_display = 0; var imagedir = "v/vspfiles/templates/133/images/template/"; var imagenum = 0; imagearray = new array(); imagearray[imagenum++] = new imageitem(imagedir + "091814_banner.jpg"); imagearray[imagenum++] = new imageitem(imagedir + "0914_banner1.jpg") imagearray[imagenum++] = new imageitem(imagedir + "0914_banner-1_v2.jpg") imagearray[imagenum++] = new imageitem(imagedir + "navigation_background_left2.png") var totalimages = imagearray.length; function imageitem(image_location){ this.image_item = new image(); this.image_item.src = image_location; } function get_imageitemlocation(imag

how to verify shortcut installation on android -

i have issue need clarification with. creating shortcut following code: intent intent = new intent(); intent.putextra("duplicate",false); intent.putextra(intent.extra_shortcut_intent, myotherintent); intent.putextra(intent.extra_shortcut_name, ((edittext) findviewbyid(r.id.text1)).gettext().tostring()); intent.putextra(intent.extra_shortcut_icon_resource,intent.shortcuticonresource.fromcontext(this, r.drawable.ic_launcher)); intent.setaction("com.android.launcher.action.install_shortcut"); sendorderedbroadcast(intent, null,new broadcastreceiver(){ @override public void onreceive(context context, intent intent) { log.d("in broadcast process","isorderedbroadcast:"+isorderedbroadcast()+"/"+system.currenttimemillis()); log.d("in broadcast process","resultcode:"+getresultcode()+":"+getresultdata()); } }, null, activity.result_o

ruby on rails - How to use the Countries gem -

i trying use countries gem , had basic questions on how incorporate gem after i've bundle-installed it. do need create new controller/model access countries? how create simple select drop-down show list of countries user select? where countries stored? (i saw data file in gem, need clarity how bring own app) 1) don't need new controller/model access countries 2) there example app on readme page shows how use forms , dropdowns. 3) countries stores within app. believe country_select includes iso 3166 gem list of countries. can view data in countries.yaml file if want know else, recommend looking @ example app . provides example of how use gem.