Posts

Showing posts from March, 2010

arraylist - invoking method in main method in Java -

i have question regarding using method in main class, here code race class: import java.util.arraylist; public class race { private arraylist<car>cars; public race(){ cars = new arraylist<car>(); } public void addcars(car car){ cars.add(car); } } the above have done make arraylist cars ready put in using main method in class: public class test { public static void main(string[] args) { car toyota = new car("toyota",1.0,1.0,2.0,2.0); cars.addcars(toyota); } } however, has error in last line, shows "cars cannot resolved",i not sure how should fix it, maybe writing getter method in race class? create instance of race , call addcars race race = new race(); race.addcars(toyota);

css - select div only if it contains select -

is there css selector selecting parent div if directly contains select inside ? example code: <div class="top_level"> <input type="radio"></input> </div> <div class="top_level"> <input type="text"></input> </div> <div class="top_level"> <select name="namehere"> <option>...</option> <option>...</option> <option>...</option> </select> </div> suppose want select third 3rd top_level class div, since contains select directly inside it, how ? i did try search around answer, couldn't find any. have been lot easier if parent selection possible in css. if you're using jquery, can use :has : $('div.top_level:has(select)') if you're using css, answer simple : no, don't have similar select parent.

javascript - Get element within function -

i did: var element = document.getelementbyid('myelement'); now want do: element.myfunction(); but have no idea how element within function. how do this? function myfunction() { // element here? } you can add custom function prototype of htmlelement objects this: htmlelement.prototype.customfunc = function(){ // within function, 'this' refer // element called on }; this means element have access customfunc function method. example: htmlelement.prototype.customfunc = function(){ console.log(this.id); }; // assuming html contains #myelement , #anotherelem: document.getelementbyid('myelement').customfunc(); // displays 'myelement' document.getelementbyid('anotherelem').customfunc(); // displays 'anotherelem' obviously, careful naming of function, don't want overwrite pre-existing methods or properties.

Symfony 2 This form should not contain extra fields -

i created form using formbuilder in symfony. add basic styling form inputs using external stylesheet , referencing tag id. form renders correctly , processes information correctly. however, outputs unwanted unordered list list item containing following text: this form should not contain fields. i having hard time getting rid of notice. wondering if can me understand why being rendered form , how remove it? many in advance! controller $form = $this->createformbuilder($search) ->add('searchinput', 'text', array('label'=>false, 'required' =>false)) ->add('search', 'submit') ->getform(); $form->handlerequest($request); twig output (form outputted , processed correctly this form should not contain fields. rendered html <form method="post" action=""> <div id="form"> <ul> <li>this form should not conta

javascript - TEXT INPUT BOX: how to display placeholder at the end of the typed text? -

Image
so... have list of input boxes in form... no labels, placeholder texts. lets have text input field email... and value of text ruby@rails.com i display: (email) after string... (only when input blured, when input focused, label shouldn't there)...this know how it... the problem is, don't know how calculate witdh of actual text inside input box, can display label right beside (another element positioned absolutely of course) any ideas? ========================================================== edit so, using in html markup <input type="text" name="my_field" value="" data-fixed-placeholder="(email)" placeholder="email"> and using jquery check if data fixed-placeholder present... , display it... so (just semantically... code not that) $("[data-fixed-placeholder]").on("focus", function(e){ //hide fixed placeholder }).on("blur", function(e){ //show palceholder

css - cover div adding a margin -

Image
i have #cover div following css #cover { background-color: #ffffff; height: 100%; opacity: 0.4; position: fixed; width: 100%; z-index: 9000; } i want cover entire (viewed) page so however when scroll down see this thats because margin of 8 added top , left. i tried adding margin:-8 -8 8 8; no success. why??? , how can fix this? demo fiddle. you fogot set position. add: top: 0; left: 0; since havn't posted complete markup, can assume body has margin or padding causing shift you're seeing. fiddle demonstratig problem fiddle fix applied

mysql - Error using utf-8 filenames in python script -

i have seemingly impossible conundrum , hope guys can point me in right direction. have been coming , leaving project weeks , think time solve it, hopefully. i making script supposed read bunch of .xls excel files directory structure, parse contents , load mysql database. now, in main function, list of (croatian) file names gets passed xlrd, , problem lies. the environment date freebsd 9.1. i following error when executing script: mars:~/20130829> python megascript.py python version: 2.7.5 filesstem encoding is: utf-8 removing error.log if exists... doesn't. done! connecting database... done! mysql database version: 5.6.13 loading pilots... done! loading tehnicians... done! loading aircraft registrations... done! loading file list... done! processing files... /2006/1_siječanj.xls traceback (most recent call last): file "megascript.py", line 540, in <module> main() file "megascript.py", line 491, in main data = readxlsfile(files

performance - Best approach to storing scientific data sets on disk C++ -

i'm working on project requires working gigabytes of scientific data sets. data sets in form of large arrays (30,000 elements) of integers , floating point numbers. problem here large fit memory, need on disk solution storing , working them. make problem more fun, restricted using 32-bit architecture (as work) , need try maximize performance solution. so far, i've worked hdf5, worked okay, found little complicated work with. so, thought next best thing try nosql database, couldn't find way store arrays in database short of casting them character arrays , storing them that, caused lot of bad pointer headaches. so, i'd know guys recommend. maybe have less painful way of working hdf5 while @ same time maximizing performance. or maybe know of nosql database works storing type of data. or maybe i'm going in totally wrong direction , you'd smack sense me. anyway, i'd appreciate words of wisdom guys can offer me :) assuming data sets large enough

c# - Limit IntegerUpDown to a specific set of numbers on WPF -

i new wpf, , there need couldnt find no how (i know should possible since there similar object on c# forms) want limit dataset of integerupdown on wpf form s.t default value 1 64 powers of two, problem there no place (by google search , microsoft website) tells me how that, help? i think ill go combobox have clue why might not recognize style? (its on same file...) im adding combobox - <xctk:combobox canvas.left="334" canvas.top="80" formatstring="" maximum="64" minimum="2" name="integerupdownframeavg" style="{staticresource mycomboboxstyle}" text="0" value="0" width="60" datacontext="{binding}"> <comboboxitem content="1"></comboboxitem> <comboboxitem content="2"></comboboxitem> <comboboxitem content="4"></comboboxitem> <comboboxitem content=

c# - Testing an Entity Framework database connection -

i have app connects mysql database through entity framework. works 100% perfectly, add small piece of code test connection database upon app startup. i had idea of running tiny command database , catching exceptions, if there problem (eg app.config missing or database server down) app takes huge amount of time run code , throw exception (~1 min). imagine due connection timeouts etc have fiddled such properties no avail. would able assist ideas go? are wanting see if db connection valid. if take @ using (databasecontext dbcontext = new databasecontext()) { dbcontext.database.exists(); } http://msdn.microsoft.com/en-us/library/gg696617(v=vs.103).aspx ef5 https://msdn.microsoft.com/en-us/library/gg696617(v=vs.113).aspx ef6 and checking if server machine up, db server or web services server , try this: public pingreply send( string hostnameoraddress ) http://msdn.microsoft.com/en-us/library/7hzczzed.aspx

gentoo - MySQL Cannot Resolve Hostname -

i have problem mysql server on gentoo. when starting /etc/init.d/mysql hangs nothing happening until interrupt ctl + c. trying start mysqld directly, mysqld says: 131007 0:54:00 [error] can't start server: cannot resolve hostname!: bad message 131007 0:54:00 [error] aborting in many forums sugested add skip-name-resolve option my.cnf. tried didn't help. has had same problem , knows how solve issue ? errors seeing mysql or other apps due problems in file /etc/hosts and/or /etc/conf.d/hostname. check contents of both. you need entry in /etc/hosts hostname set /etc/conf.d/hostname executed during bootup /etc/init.d/hostname (i assume have set run in 1 of initial runlevels rc). if have static ip, go ahead , put static ip in /etc/hosts. if using dhcp everywhere laptop, add hostname localhost ip address supposed exist regardless of whether online or not. you should not have set skip-name-resolve in my.cnf, may avoid issues binding mysql network socket l

linux - How to remove all symlinks to a specified file with an android/busybox shell command? -

i want remove symbolic links /system/bin/toolbox in /system/bin/ directory on android phone, other symlinks should kept. i.e. delete cat -> toolbox , df -> toolbox , etc. keep mount -> busybox . how can write command? (i have busybox installed already.) thanks in advance! ahoy, in bash shell want run following command after reading post: #find / -type l -exec unlink {} + this command search through root file system (change path of search path) , locate symlinks (identified -type l). once finds symlinks, use --exec argument run command. in case command unlink, , file path replaced {} appears in command. command ended plus sign. this command destructive , should run when understand command , desired intent, in it's current state may leave linux system command run on un-bootable since linux relies on symlinks.

json - Posting with angular http.post method - xmlhttprquest cannot load the service -

angular $http.post method not posting json service (restful service, node service). showing following error : xmlhttprequest cannot load /some/service. invalid http status code 404 here posted code $http({method:'post', url:'/some/service/',data:{"key1":"val1","key2":"val2"}}).success(function(result){ alert(result); }); the same code working old version of chrome i.e, v29. . .* . updated chrome v30. . .* . now, not working. not working in firefox well. there problem chrome , firefox? can help? i came across similar issue after updating chrome version 30.0.1599.101 , turned out server problem. my server implemented using express ( http://expressjs.com/ ) , code below allowing cors ( how allow cors? ) works well: var express = require("express"); var server = express(); var allowcrossdomain = function(req, res, next) { res.header('access-control-allow-origin', req.headers.origin

java - How to remove elements from collection while iterating without iterator -

let's i've got list of strings (simplification) fulllist = {a,b,c,d,a,d,c,b} and want find couples like coupleslist = {{a,a},{b,b}, ...} the way i'm approaching problem @ moment is get first element use guava predicate find proper object what now? i'm ending having 2 objects {a,a} can't remove them fulllist because i'm not using "iterator" style of iterating (because i'm using guava predicate wouldn't work anyway - since don't have iterator pointer element find itarables.find(...) function). i want in "efficient" way well, want avoid multiple nested loops etc. any ideas how approach problem more correctly/efficient way ? i'm bit stuck. i create frequency count each of elements. in guava terms multiset. can create collection of pairs, , collection of singles. can done 1 pass of original list , 1 pass of frequency count map. i.e. o(n)

javascript - Jquery form submit behavior not understandable -

i writing code small webproject using js , jquery. in it, @ point, onclicking button, create dialog. dialog has form within name field , number fields. supposed check user inputs , send them server, along appending name field list in browser, intimate user, 1 more item has been added. 2 strange things happening - 1) after posting form, dialog box closes on own without me issuing dialog('close') anywhere in submit button handler. 2) name entry doesn't appended list. if whole page refreshes after submit. original default entries of list of names. anyone has ideas on why happening? post code aid.please don't suggest use ajax instead. think reflects fundamental flaw in understanding of js ways , clear first switching other technology. <div id='dialog' title='define new matrix'> <form name='form1' id='form1' method='post'> <fieldset> <label for="name">name</label> <inp

Dependant ng-repeat in AngularJS -

i have following data structure coming rest: scope.taglist = [ { name: "mylist", tags: ["tag1", "tag2", "tag3", ...]}, { name: "mylist2", tags: ["tag2.1", "tag2.2", "tag2.3", ...]} ] in order present names of objects have following html: <div> <select ng-model="tagnameselection"> <option ng-repeat="tagobj in taglist" value="{{tagobj}}">{{tagobj.name}}</option> </select> </div> <div class="tagdetails"> <!-- present list of tags tagnameselection --> </div> now little bit of loss on how present tags list of individual object. able present array in raw format (by sticking {{tagnameselection}} inside tagdetails div) when try iterate through ng-repeat angular gives error message. oddly enough when hard-code 1 of tag lists scope in controller ng-repeat works flawlessly. ma

c# - WCF - when should i use netTcpBinding -

i use http binding @ services. read net.tcp binding works faster, not quite sure on when should use it? best practice, there drawbacks? thanks the msdn page nettcpbinding says best the default configuration nettcpbinding faster configuration provided wshttpbinding, intended wcf-to-wcf communication. so nettcpbinding use when have .net wcf client , .net wcf server, if need support clients not written in .net wcf (for example publishing public service , don't know language client written in) need use httpbinding instead. this page has quick summary of each type of binding , when should used. basichttpbinding - binding suitable communicating ws-basic profile conformant web services, example, asp.net web services (asmx)-based services. binding uses http transport , text/xml default message encoding. wshttpbinding - secure , interoperable binding suitable non-duplex service contracts. ws2007httpbinding - secure , interoperable binding pr

java - Incorrect output or won't compile -

i having issue couple of programs - 1 debug , other need write. the first 1 take user inputted planet name, convert uppercase , run through enum. did wrong? import java.util.*; public class debugnine4 { enum planet { mercury, venus, earth, mars, jupiter, saturn, uranus, neptune }; public static void main(string[] args) { planet planet; string userentry; int position; int comparison; scanner input = new scanner(system.in); system.out.print("enter planet in our solar system >> "); planet = input.nextline().touppercase(); planet = planet.valueof(planet); system.out.println("you entered " + planet); position = planet.ordinal(); system.out.println(planet + " " + (position + 1) + " planet(s) sun"); } } the 2nd 1 output not going through want it. coming with: cut shampoo and not info need - sortable name of service, cost , time. did go wrong on code? first need creat

hadoop - ORCfile storage implementation in Pig -

does know how use orcfiles input/output in pig? found kind of support rcfiles in elephant-birds, seems orc format not supported... please provide sample of using pig access/store orc files in pig? support orc storage through pig not yet committed , under active development. refer apache jira pig-3558. following this, able access orc files via pig script this load 'foo.orc' using orcstorage(); ... store .. using orcstorage('-c snappy');

mysql - Error with PHP Form, Keeps Redirecting to login page -

ok here issue. have created simple login system few pages. works. created page php form submits input mysql database. works well...on other pages on site. reason, when submit form, keeps redirecting login page , have no idea why. here form/code trying submit: <form method="post" action="admin_home.php?page=search.php"> <p>search date range: </p> from: <input type="text" id="from" name="from" />to: <input type="text" id="to" name="to" /> <br> <p>search by:</p> name: <input type="text" id="name" name="name" /> phone number: <input type="text" id="phone" name="phone" /> <input name="export" type="submit" value="search" /> </form> that form in file search.php search results displayed below form. here login code have on admin_home.php page:

refresh google map in android -

i created simple android application in used google maps. now in map activity created option menu , in when 1 particular item selected opened activity. now problem activity containing 1 list view , when particular list item selected again starting map activity using intent. now according item selected changes must me reflected, mean want clear particular googel map , again load it. should use recreate method refresh or there other option available? you have clear() method can use: from docs: removes markers, polylines, polygons, overlays, etc map.

ajax - How to get the input value after an other event in jsf? -

hava inputtext , gmap <h:inputtext class="text" value="#{restaurant.address}" /> <p:gmap id="gmap" center="21.027845,105.852268" zoom="12" type="roadmap" style="width:360px;height:388px" model="#{restaurant.emptymodel}" onpointclick="handlepointclick(event);" widgetvar="map"> first, address="" , when click on gmap, address="xxx" not null.so how can show value in inputtext tag after clicking on gmap. thank you! you can add ajax event map <p:gmap id="gmap" center="21.027845,105.852268" zoom="12" type="roadmap" style="width:360px;height:388px" model="#{restaurant.emptymodel}" onpointclick="handlepointclick(event);" widgetvar="map"> <p:ajax event="pointselect" updat

r - How to optimize for loops in extremely large dataframe -

i have dataframe "x" 5.9 million rows , 4 columns: idnumber/integer, compdate/integer , judge/character,, representing individual cases completed in administrative court. data imported stata dataset , date field came in integer, fine purposes. want create caseload variable calculating number of cases completed judge within 30 day window of completion date of case @ issue. here first 34 rows of data: idnumber compdate judge 1 9615 jvc 2 15316 ban 3 15887 wla 4 11968 wfn 5 15001 clr 6 13914 ieb 7 14760 hsd 8 11063 rjd 9 10948 ppl 10 16502 ban 11 15391 wcp 12 14587 lrd 13 10672 rtg 14 11864 jcw 15 15071 gmr 16 15082 pam 17 11697 dlk 18 10660 adp 19 13284 ecc 20 13052 jwr 21 15987 mak 22 10105 hea 23 14298 clr 24 18154 mmt 25 10392 hea 26 10157 erh 27 9188 rbr 28 12173 jcw 29 10234 par 30 10437 adp 31 11347 rdw 32 14032 jtz 33 11876 amc 34 11470 amc h

java - Socket proxy server redirecting url -

i have basic socket proxy server, want add redirection functionality in it. idea how go. changing host doesn't because buffer collected client contains old information. import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import java.net.serversocket; import java.net.socket; public class simpleproxyserver { public static final int portnumber = 5555; public static void main(string[] args) { simpleproxyserver proxyserver = new simpleproxyserver(); proxyserver.start(); } public void start() { system.out.println("starting simpleproxyserver ..."); try { serversocket serversocket = new serversocket( simpleproxyserver.portnumber, 1); byte[] buffer = new byte[10000]; while (true) { socket clientsocket = serversocket.accept(); inputstream bis = clientsocket.getinputstream(); int n = b

ios - Problems with updating XCode 5 with Cocos2d -

xcode cannot run selected device. choose destination supported architecture run on devide. i've tried changing supported architectures , right arm62 , armv7 , armv7s updated xcode 4.6 believe 5.0 , cant run application now. hope guys can me. thanks (found similar question no answer) i had similar issue while building sample app downloaded internet. tried lot of things cleaning project , setting valid architecture etc.. provided in other threads not helpful. but, found out compiler not set in build options of build settings. check "compiler c/c++/objective-c" i changed "compiler c/c++/objective-c" setting default compiler(apple llvm 5.0) , worked me! but, need check "architectures" set in build settings. i hope helps!!

jquery - how to make .top and .offset work together -

i'm having problems solving why jquery being ignored. below jquery: $(document).ready(function() { var $root = $('html, body '); $('a').click(function(e) { var href = $.attr(this, 'href'); $root.animate({ scrolltop: $(href).offset.top }, 500, function () { window.location.hash = href; }); return false; }); this jquery trying nicely scroll part of page works if use .offset('top') throws out error : uncaught typeerror: cannot use 'in' operator search 'using' in top which has made jquery jump instead of scroll nicely. the rest of jquery code: // responsive menu $(function() { var pull = $('#pull'); menu = $('nav ul'); menuheight = menu.height(); $(pull).on('click', function(e) { e.preventdefault(); menu.slidetoggle(); }); $(window).resize(function(){ var w = $(window).width();

javascript - How to Allow Window.opener.location.href Permission For Greasemonkey? -

i'm using greasemonkey in firefox following code if (window.opener) { alert(window.opener.location.href); } however, i'm getting permission denied error, possibly due cross-domain policy. how overcome protection? you can't if window on different domain opener. plain javascript, blocking information considered security safeguard. for greasemonkey, might less of security problem, greasemonkey devs have not added capability. greasemonkey plain javascript, select, limited, extension capabilities added on. you can open feature request for this, unlikely approved unless can make case both: how useful, , how won't result in careless gm users being "pwned". in meanwhile, can fork the greasemonkey source code , build own version breaks cross-domain barrier. or, depending on really trying do, there may workaround involving 2 or more script instances communicating. open new question , describe scenario, in full detail , workarou

java - button action in fragment -

i have fragment , there textview , button, found solution adding action button inside fragment, must change text in textview. did in way, doesn't work, can check ? fragment: public class articlefragment extends fragment { static public int licznik=0; public view view; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view = inflater.inflate(r.layout.article_view, container, false); final textview article2 = (textview)view.findviewbyid(r.id.article); button menubutton = (button)view.findviewbyid(r.id.button1); menubutton.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { article2.settext(++licznik); } }); return view; } @override public void onstart() { super.onstart(); textview article = (textview)view.f

wordpress - change text of label with image -

it's possible change text of label image? example, #unaestrella have text "unaestrella" , want clear text (or add image padding or similar) , show image http://www.domain.com/images/unaestrella.png . it's possible? <ul class="radio_list"> <li> <label for="unaestrella"> <input id="unaestrella" type="radio" value="unaestrella" name="topics"/> unaestrella </label> </li> <li> <label for="dosestrellas"> <input id="dosestrellas" type="radio" value="dosestrellas" name="topics"/> dosestrellas </label> </li> </ul> yes, it's possible use class label , because #unaestrella id have used input , id must unique, 1 id must assigned 1 element. css: .unaestrella{ background : url

named constants (parameter attribute) in derived data type fortran 90 -

it seems fortran 90 not allow named constants in derived data types. true? not work. program my_prog implicit none type :: my_type integer, parameter :: = 1 real(kind(1.d0)) :: b end type my_type type (my_type) :: complex_type end programmy_prog the compiler says parameter statement not permitted in derived type definitions. when remove parameter keyword works fine. how can make sure 'a' not modified elsewhere? according standard, not allowed. component attribute specifier may pointer , , dimension fortran 90/95 (section 4.4.1), additionally allocatable in fortran 2003 (section 4.5.3), , additionally codimension , , contiguous for fortran 2008 (section 4.5.4.1). you can documents here . i ran similar problem target specifier, not allowed. edit: why not try private components? module typedef type :: my_type integer, private :: a_int = 1 real(kind(1.d0)) :: b contains procedure :: end type my_type contains

c - error ssl with threads -

i have following code (some irrelevant parts removed) ssl_method *meth = null; ssl_ctx *ctx = null; ssl *ssl = null; bio *sbio; //open socket int sock = open_port(ip,80); if(sock == -1) return -1; meth=sslv23_client_method(); openssl_add_ssl_algorithms(); ctx=ssl_ctx_new(meth); /* connect ssl socket */ ssl=ssl_new(ctx); sbio=bio_new_socket(sock,bio_noclose); ssl_set_bio(ssl,sbio,sbio); if(ssl_connect(ssl)<=0) { ssl_free(ssl); ssl_ctx_free(ctx); return -1; } //ssl write & read part ssl_shutdown(ssl); ssl_free(ssl); ssl_ctx_free(ctx); //close socket close(sock); this function every thread calling ssl connection , works fine except after running while following error: *** glibc detected *** test: double free or corruption (fasttop): 0xc4813440 *** *** glibc detected *** test: double free or corruption (!prev): 0x096008b0 *** * which functions between ssl_free , ssl_ctx_free should not use ? or error somewhere else?*

java - Streamtokenizer to read very large numbers? -

i have take input containing large numbers of order 10^9 in java. how handle inputs fast? since streamtokenizer.nval gives double, how can read larger values?? before parsing, reset tokenizer syntax table , initialize recognize numbers words: streamtokenizer tokenizer = new streamtokenizer(r); tokenizer.resetsyntax(); tokenizer.whitespacechars(0, 32); tokenizer.wordchars('0', '9'); tokenizer.wordchars('-', '.'); tokenizer.wordchars('+', '+'); tokenizer.wordchars('a', 'z'); tokenizer.wordchars('a', 'z'); tokenizer.wordchars(0xa0, 0xff); // not needed here. */ tokenizer.slashslashcomments(true); tokenizer.slashstarcomments(true); tokenizer.quotechar('"'); tokenizer.quotechar('\''); then, when encountering word, check whether parseable number (a bit crude here, shows general idea): ... case streamtokenizer.tt_word: if ("true".equals(tokenizer.sval)) {

Formatting time in Python? -

how go formatting time in python? lets have time = 9.122491 the time in hours , need convert h:m format. desired output should be: 9:07 any appreciated! using datetime module: >>> datetime import datetime, timedelta >>> mytime = 9.122491 >>> temp = timedelta(hours=mytime) >>> print((datetime(1, 1, 1) + temp).strftime('%h:%m')) 09:07

storing a sentence from a file to a string java -

how can store sentence file string, , store next line, made of numbers, string? when use hasnextline or nextline, none of works. confused. scanner kb = new scanner(system.in); string secretmessage = null; string message, number = null; file file = new file(system.in); scanner inputfile = new scanner(file); while(inputfile.hasnext()) { message = inputfile.nextline(); number = inputfile.nextline(); } system.out.println(number + "and " + message); you're looping on entire file, overwriting message , number variables, , printing them once @ end. move print statement inside loop print every line. while(inputfile.hasnext()) { message = inputfile.nextline(); number = inputfile.nextline(); system.out.println(number + "and " + message); }

javascript - Calling Google Custom Search overlay from text link -

i'm using newish style of google custom search overlays search results on current page. the code below creates search box calls overlay. i'm wondering if there's anyway create text link launch results of overlay of our articles have line "you can search more references on [person] on our site." older 2 page cse ethod allowed call results page /search.shtml?q=person <script> (function() { var cx = 'mycseidnumber'; var gcse = document.createelement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(gcse, s); })(); </script> <gcse:search></gcse:search> i created text link this: /currentpage?cx=mycseidnumber&amp;q=$mysearchterms clicking on link doesn'

android - Using Intents to navigate between activities -

Image
i navigate between activities using intents pictorial representation looks below:: in activity - .......... there next button go activity b photos.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub intent photointent=new intent(a.this,b.class); startactivity(photointent); } }); in activity - b .......... there next button go again activity c map.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub intent photointent=new intent(b.this,c.class); startactivity(photointent); } }); now in activity c .... there 1 button if use above code can't go 2 activities depending on navigation came from suppose came a c ------ when use back button in c go a again when came

php - Purging & Removing Part of URL -

i creating vine video sharing website. i having issues. og:image:secure_url won't pick right because url getting displayed this.. https://v.cdn.vine.co/v/thumbs/2013/04/30/5d309eaf-962f-41e1-8f22-41e4aa50ffb7-967-00000195162f03bd_1.0.7.mp4.jpg?versionid=jq9yuwcebry1sgzpzu40z3wc_vf_pmb1 so facebook giving me error when bebugging.. object @ url 'http://vinesandstuff.com/' of type 'article' invalid because given value '' property 'og:image:secure_url' not parsed type 'url'. how it's setup in backend.. the og:image:secure_url setup, note script uses smarty code. <meta property="og:image:secure_url" content="{php} echo vine_pic($this->_tpl_vars['p']['youtube_key']);{/php}" /> and script grabs og:image twitter.. function vine_pic( $id ) { $vine = file_get_contents("http://vine.co/v/{$id}"); preg_match('/property="og:

java - Print formation -

i asked question , got great :d my first question . thought out of woods guess not. setting up/formation information program getting running problem when trying print variable "time" if 1 point out doing wrong obliged. the section of code believe problem is: // class prints loan statement showing amount borrowed // , amount borrowed, annual interest rate, number of months // , monthly payment public static void loanstatement(double principle, double interest, int time, double mpayment) { system.out.printf("%2s%13s%8s%20s%n", "principle", "interest", "time", "monthly payment"); system.out.printf("%2.2f%10.2f%10.2f%n", +principle, +interest +time); system.out.println("monthly payment is" +mpayment); system.out.println("interest is" +interest); system.out.println("time is" +time); when take out +time , remove 10.2f (i tried many

Is the first request to a Java Application always slow even with JIT Compiler? -

i have confusion compilation , interpretation , way jit works. know source code or java program gets compiled java byte code loaded onto jvm either interprets bytecode native machine code or uses jit. i going through interpreter doc , understood interpreter analyses each statement on every request , converts native code leading slower performance. and read jit dynamic translation , stores native code on cache used subsequent requests. what wanted understand how jit works? whenever first request made application converts part of byte code machine code, stores on cache , uses it.. process? if then, every first request slower needs translation of bytecode machine code? please explain in detail. depends on implementation, @ least in java, jit done "hotspots", i.e. used code. if jvm finds out method has been called more x times compile native code. meaning, have call few times first, , gets faster after that. also, jit results kept in-memory, not saved disk

chromecast - Stop casting on the receiver -

Image
i need disconnect sender , return receiver's main ("ready cast" screen). receiver decides when , how (e.g. 10 mins idling after media playback paused) i've tried stop receiver explicitly receiver.stop() and disconnecting connection service cs = receiver.getconnectionservice() cs.disconnect() that didn't work wanted, doesn't return main screen , senders still see ongoing cast session so how can force disconnecting on receiver? receiver api page seems describing these 2 methods. you shouldn't call receiver.stop() , nor calling cs.disconnect(); instead try using window.close() .

jquery - Dynamics Variable (variable++) in Append function DOM Javascript -

i have code function add_fullboard_dalam_kota(){ var data='<?php echo $data; ?>'; var tambah=1; var txt=1; $("#fullboard_dalam_kota").append('<tr align="center" valign="middle"bgcolor="#e4e4e4">' +'<td width="19%" ><input name="penyelenggara[]" type="text" id="'+tambah+'" onchange="showuser(this.value)"></td>' +'<td width="19%" ><div id="'+txt+'"><b></b></div>' +'</td>' +'<td width="19%" ><input name="jumlah_peserta[]" type="text" id="jumlah_peserta[]"></td>' +'<td width="19%" ><input name="jumlah_hari[]" type="text" id="jumlah_hari[]"></td>' +'</tr>')