Posts

Showing posts from April, 2010

jQuery dialog box not closing till a function is executed -

i'm using jquery dialog box alert user deleting record in table. following code: $('#deletebutton').click(function () { if($(this).attr('disabled')=='disabled'){ //do nothing } else{ var isdeleteyes = false; $('#delete-confirm').dialog({ height : 150, width : 400, autoopen : true, close: function( event, ui ) { //alert(closed) }, buttons : { "yes" : function () { isdeleteyes = true; $(this).dialog("close"); deletefunction(); }, "no" : function () { isdeleteyes=false; $(this).dialog("close");

java - How to integrate javascript in vaadin (eg OpenStreetMap)? -

is possible create javascript elements openstreetmap or jquery inside vaadin application? because vaadin websites created programming in java , letting compiler autocreate dom , javascript out of it? so, possible @ all? you can create such integration abstractjavascriptcomponent the basic idea here subclass class, annotate @javascript pull in needed js libs. write @ least global function, sets lib in dom (you have <div> @ disposal). component can hold state, server side can call defined functions on client (while sending e.g. state) , client can call server functions (params passed json). the wiki has example how include such component

excel vba - save selected files in particular path -

i want open file dialog box allow me select multiple files. selected files should saved in particular path instead of opening. able open dailog box select files not sure how save in particular folder. please assist. dim intchoice integer dim strpath string dim integer application.filedialog(msofiledialogopen).allowmultiselect = true intchoice = application.filedialog(msofiledialogopen).show if intchoice <> 0 = 1 application.filedialog(msofiledialogopen _ ).selecteditems.count strpath = application.filedialog(msofiledialogopen _ ).selecteditems(i) cells(i + 1, 1) = strpath next end if something this. loop through files selected. add tools pulldown select references, pick "microsoft scripting runtime". dim fso new filesystemobject fso.copyfile selectedfile, targetfile

android - Selendroid wating for an element in native app -

i using selendroid test android application . working fine having couple of problems. 1 when app opened element loaded after sometime, using thread.sleep(); work around want use built in waiting conditions not @ working me. please if can answer helpful. implementing following code webelement referimage = waitforelement(by.id("imageview_close"),30,driver); referimage.click(); i got answer question after more research changed above code webdriverwait wait = new webdriverwait(driver, 30); webelement element =wait.until(expectedconditions.presenceofelementlocated(by .id("imageview_close"))); element.click();

Google search based on country -

i using google chrome , google search engine default. current location india . when search anything, gives me result india . that's great. now, want have searched result country e.g. uae . should make change result uae or other country. there's artile here: http://www.entrepreneurs-journey.com/322/how-to-search-google-as-a-local-in-any-country/ you can change query parameter 'gl' value desired country result country. example ... this show results japan https://www.google.com/search?q=kangaroo&gws_rd=ssl&gl=jp and show results us https://www.google.com/search?q=kangaroo&gws_rd=ssl&gl=us hope clears.

javascript - Get correct time if it's changed on Window -

as title, how can correct date, time if it's changed user (with , without internet connection) example: real time july 2nd 2015 , user changed july 1st 2015, how can true value: july 2nd 2015??? (it's if using php, javascript or cmd) me please, thanks. , sorry bad english. edit: thanks answer about project: want create key, has start , end date must current time check if key out of date, if user changes time of window previous day, key won't out of date (project installed , run on user pc) again.

android - adding back button support in a activity while using variables of a fragment -

public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fragment_view frag=new fragment_view(); fragmentmanager manager=getfragmentmanager(); fragmenttransaction transaction=manager.begintransaction(); transaction.add(r.id.fragment,frag,"hey"); transaction.commit(); } @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { if (incustomview()) { hidecustomview(); return true; } if ((mcustomview == null) && webview.cangoback()) { webview.goback(); return true; } } return super.onkeydown(keycode, event); } now here variables incustomview , hidecustomview defined in fragment. how add button support on activity while using variables fragment. want implement button support in android activity while using defined variables fragment. public class fra

Rest & Soap transactional capability -

in 1 interview, interviewer asked, transactional capability,out of soap , rest having transactional capabilities? could please explain me in simple way. thanks in advance, had come across these references when ran similar questions. hope helps. from http://spf13.com/post/soap-vs-rest ws-atomictransaction need acid transactions on service, you’re going need soap. while rest supports transactions, isn’t comprehensive , isn’t acid compliant. fortunately acid transactions never make sense on internet. rest limited http can’t provide two-phase commit across distributed transactional resources, soap can. internet apps don’t need level of transactional reliability, enterprise apps do. from https://msdn.microsoft.com/en-us/magazine/dd942839.aspx what transactions? here area in soap , ws-* have explicit support "advanced" feature , rest has none. ws-atomic transactions supports distributed, two-phase commit transactional seman

java - How to use nested foreach in jsp -

i using struts2 framework jsp. want have nested foreach in jsp getting below error @ inner foreach. getting error while iterating nested objects from. <c:foreach var="emp" items="${dept.emplyees}"> exception: caused by: javax.servlet.jsp.jsptagexception: don't know how iterate on supplied "items" in &lt;foreach&gt; @ org.apache.taglibs.standard.tag.common.core.foreachsupport.toforeachiterator(foreachsupport.java:274) ~[jstl-1.2.jar:1.2] @ org.apache.taglibs.standard.tag.common.core.foreachsupport.supportedtypeforeachiterator(foreachsupport.java:238) ~[jstl-1.2.jar:1.2] @ org.apache.taglibs.standard.tag.common.core.foreachsupport.prepare(foreachsupport.java:155) ~[jstl-1.2.jar:1.2] @ javax.servlet.jsp.jstl.core.looptagsupport.dostarttag(looptagsupport.java:291) ~[javax.servlet.jsp.jstl-api-1.2.1.jar:1.2.1] @ org.apache.jsp.views.home.home_jsp._jspx_meth_c_005fforeach_005f1(home_jsp.java:364) ~[na:na]

how to get my while to update a string length in python -

i'm trying while loop working remove consonants front of input word, goes through once , finishes, how keep while loop going until consonants @ end of word (example: want "switch" "itch + sw" , to, once consonants moved, add "ay" @ end form "itchsway" here code far, i'm new python appreciated! print("pig latin translator test!") name = raw_input("what name?") if len(name) > 0 , name.isalpha(): print("hello!") else: print("that's not name!") word = raw_input("what word?") word0 = word[0] word0 = word0.lower() n = 0 if len(word0) > 0 , word0.isalpha(): word0proof = word0 else: print("that isn't word!") if word0proof in "aeiou": wordoutput = word + "yay" print (wordoutput) else: print("your word doesn't begin vowel") if word0proof in "bcdefghjklmnpqrstvwxyz": word1 = word0proof else:

iis 7.5 - How to configure DNS 'mask' name to cover ip and app name -

i have deployed app in virtual application folder on iis. when access is ip/app name 192.168.0.1/myapp/.... is there way mask single name example if entered myappdev/ , run direct that? no knwolage of iis or dns dummies guide great thanks link previous post explain various options. more info iis bindings hope helps.

linux - How can i check if some dir exist and then execute in makefile -

i have in makefile venv: virtualenv /var/www/env && source /var/www/env/bin/activate but want if /var/www/env not exist how can that unfortunately, make rules not support negative conditions. a common workaround use dummy files mark condition; in case have like var-www-env-does-not-exist: if [ -d /var/www/env ]; touch $@; else rm -f $@; exit 1; fi venv: var-www-env-does-not-exist /var/www/env/bin/activate virtualenv /var/www/env && source /var/www/env/bin/activate another idea write , call script calls virtualenv correctly deals case of existing /var/www/env .

voltrb - Use ruby classes in Volt Framework -

i wondering best way include ruby classes in volt framework. want use socket class find ip address of visitor of site. want use in controller, putting: require 'socket' at top of file not work. suggestions? well, don't think can use socket class on client-side since volt uses opalrb run ruby on client, , unfortunately don't think opal can support socket class since that's kind of hard in browser. can, however, run code on server side , pass desired results on client. can using volt's tasks . can create them so: require 'socket' class sockettask < volt::task def use_sockets # thing sockets here... end end and can use them elsewhere, e.g., in controller this: class controller < volt::modelcontroller def some_action sockettask.use_sockets # can use #then method of returned promise result of call. # can use #fail method on promise thrown errors. # following can run code on client. sockettask.use

dns - How do you convert a textual domain into an IPv6 in Java? -

how can convert textual domain ( dns ) www.abc.com equivalent ipv6 address fe80:0000:0000:0000:0202:b3ff:fe1e:8329 ? i tried using inet6address ended ipv4 address. example: inet6address.getbyname("www.abc.com").gethostaddress(); gave me like: 129.42.38.1 so i'm not sure issue in this.

node.js - How to write a post request test in mocha with data to test if response matches? -

question: how write post request test in mocha tests if response matches? the response url string redirect 3rd party service. working example payload: curl -h "content-type: application/json" -x post -d '{"participant":{"nuid":"98asdf988sdf89sdf89989sdf9898"}}' http://localhost:9000/api/members member.controller.js // post method // creates new member in db. exports.create = function(req, res) { member.findbyidandupdate(req.body.participant.nuid, { "$setoninsert": { "_id": req.body.participant.nuid } }, { "upsert": true }, function(err,doc) { if (err) throw err; res.send({ 'redirecturl': req.protocol + '://' + req.get('host') + '/registration/' + req.body.participant.nuid }) } ); }; expected res.send {"redirecturl":"http://localhost:9000/registration/98asdf988sdf89sdf89989sdf9898"}

android - Camera2 with a SurfaceView -

i'm trying new camera2 working simple surfaceview , i'm having problems live preview. on devices image stretched out of proportions while looking fine on others. i've setup surfaceview programatically adjust fit size of preview stream size. on nexus 5 looks fine 1 samsung devices way off. samsung devices have black border on right part of preview. is not possible work surfaceview or time switch textureview ? yes, possible. note surfaceview , associated surface 2 different things, , each can/must assigned size. the surface actual memory buffer hold output of camera, , setting size dictates size of actual image each frame. each format available camera, there small set of possible (exact) sizes can make buffer. the surfaceview displaying of image when available, , can size in layout. stretch underlying associated image data fit whatever layout size is, note display size different data's size- android resize image data display automatically. causi

wcf - Web service must be accessible from internet but firewall blocks incoming request -

so here situation: we need client app able make requests throught internet wcf web service. we have total control of both service , client implementation, major problem don't control router service not visible internet. (and router configuration can't change , doesn't allow request internet) we don't want use vpn client or ipsec tunnel. the service knows clients, idea had initiate socket connections service clients, , client call service using callback methods. it not seem common way of communication, maybe more common think. wondering if had such kind of constraint, , if solution consider work. i fear run accross several issues in long term if wrong way proceed, because foundation of our platform need sure not over-complicate future development nor reduce system capabilities. we several tests opinion on ? or bad idea ? see @ first glance go wrong approach ? there important things should aware of ? for example service capabilities / wcf features lim

java - Split a string into two based on some special characters in android -

i have string this: [{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"}]&@[{\"id\":2,\"text\":\"capital good\"},{\"id\":3,\"text\":\"general office items\"},{\"id\":1,\"text\":\"raw material purchase\"},{\"id\":0,\"text\":\"approved\"},{\"id\":1,\"text\":\"freezed\"},{\"id\":2,\"text\":\"cancelled\"},{\"id\":3,\"text\":\"completed\"},{\"id\":4,\"text\":\"foreclosed\"},{\"id\":5,\"text\":\"unapproved\"}] i want split string 2 based on &@ character combination this: string [] separated=line.split("&@"); but when checked valu

Route all traffic with iptables to external proxy -

i route http/https/other ports traffic coming pc1 pc2, pc2 should route external proxy able set @ pc2. my current config is: pc1 (eth0 / 192.168.0.1, gateway: 192.168.0.2) -> pc2 (eth0 / 192.168.0.2) pc2 has nics, eth0 , eth1. eth1 wan connection. in summary, eth1 @pc2 should able route incoming traffic eth0 proxy server. what i've tried: sysctl -w net.ipv4.conf.all.forwarding=1 -a forward -i eth0 -o eth1 -j accept -a forward -i eth1 -o eth0 -j accept iptables -t nat -a output -p tcp -o eth1 --dport 80 -j dnat --to proxy:3128 i'm able ping pc2, unfortunately already. i'm new iptables, help. there guide s etting transparent proxy squid seems might have useful information. seems have different methods adapted solve problem. most os distributions have guides , tutorials using iptables , routing particular semantics os of choice. have used guides ubuntu help , centos in past , helpful when first learning use iptables.

javascript - How do i get current value from bootstrap slider? -

this related question asked in link how min , max value of bootstrap slider? i not able answer particular question in discussion, thats why planed ask new question. what need current min , max value bootstrap slider control in javascript. this how control looks like <input id="rbslider" type="text" class="span2" value="" data-slider-min="0" data-slider-max="1000" data-slider-step="5" data-slider-value="[0,1000]" /> and in button click tried min ans max value using following var min = $('#rbslider').data('slider-min'); var max = $('#rbslider').data('slider-max'); but returns min 0 , max 1000 set min 2 , max 10. how 2 , 10 in javascript? for sure can way: var min = $('#rbslider').data('slider').options.min; var max = $('#rbslider').data('slider').options.max; update probably need: var min = $('#crsli

How to Access Database created through Wordpress in PHP using laravel framework -

i have created 1 website using wordpress , data coming website stored database.and more importantly database created using wordpress only. want access data through website developed through php(laravel framework) , have access database through phpmyadmin unable access database because data stored in encoded form wordpress. i have tried integrating wordpress in laravel framework didnt worked me. other solution please me. found tutorial here laravel & wordpress together , haven't tried it.

python - How to perform *synchronous* read/write into/from a asyncio transport object -

i using asyncio on windows , have reference transport object of named pipe: class datapipehandler(asyncio.protocol): def connection_made(self, trans): self.trans = trans # <<== reference transport object of type _proactorduplexpipetransport loop = asyncio.get_event_loop() server = loop.start_serving_pipe(lambda: datapipehandler(), r'\\.\pipe\test-pipe') now use self.trans synchronously write , read data named pipe. how can this? its important me synchronously kind of rpc call doing using pipe (writing , getting response quickly) , want block other activities of loop until "pipe rpc call" returns. if don't block other activities of event loop until rpc call done have unwanted side effects loop continue process other events don't want process yet. what want (the write pipe , read) similar calling urllib2.urlopen(urllib2.request('http://www.google.com')).read() event loop thread - here event loop activities blocked until

deserialize json response to c# -

i not able deserialize following response : json json { "disclaimer": "exchange rates/", "license": "data sourced various providers", "timestamp": 1435813262, "base": "usd", "rates": { "aed": 3.672973, "afn": 60.150001, "all": 126.7792, "amd": 472.46, "ang": 1.78875, "aoa": 121.253666, "ars": 9.095239, "aud": 1.307011, "awg": 1.793333, "azn": 1.04955, } } controller : [httppost] public actionresult index(test1 values) { string appid = values.apikey; httpwebrequest request = (httpwebrequest)webrequest.create("https://openexchangerates.org//api/latest.json?app_id=5db2fa81c8174a839756eb4d5a4a5e05"); request.method = "post"; using (streamwriter streamwriter = new streamwriter(request.getrequeststream(), asciiencodin

javascript - beforeEach with suite syntax for mocha tests -

i'm coming rspec style before(:each) blocks , working on javascript project uses mocha's suite instead of describe . seems mocha has beforeeach need, doesn't work because we're using suite instead of describe . team doesn't want change syntax. how run code before each test? you should able use setup , teardown , suitesetup , , suiteteardown . reference: https://github.com/mochajs/mocha/issues/310

Xcode (interface builder) is changing darkTextColor to calibrated RGB 0,0,0,1. Is this a bug? -

this being bugging me while. when open file in xcode - interface builder. files gets automatically changed. change worthless since changing darktextcolor , grouptableviewbackgroundcolor (and possibly others) absolute values. this time opening file new xcode 6.4 has happened in past too. commit changes, ignore. correct thing here? bug? i worried cases grouptableviewbackgroundcolor , change in future , app adopt latest colour when opened in lastest xcode. not sure if going happen if commit absolute values. diff --git a/companyapp/companyapp/base.lproj/main.storyboard b/companyapp/companyapp/base.lproj/main.storyboard index bf84644..775e1ac 100644 --- a/companyapp/companyapp/base.lproj/main.storyboard +++ b/companyapp/companyapp/base.lproj/main.storyboard @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="no"?> -<document type="com.apple.interfacebuilder3.cocoatouch.storyboard.xib" version="3.0" toolsver

javascript - How to add height and width to Jquery function -

i working jquery script found online ticketing software. adds functionality of adding videos wiki. problem not set height or width video possible can done code? if ($('#ideditarticle')) { var videos = $('a[href$=".m4v"], a[href$=".mp4"]'); $.each(videos, function(i, video) { $(video).parent().prepend('<video src="'+$(video).attr('href')+'" controls></video><br/>'); }); } here output in html <p> <a border="0" class="fb_attachment" href="default.asp?pg=pgdownload&amp;pgtype=pgwikiattachment&amp;ixattachment=136818&amp;sfilename=paragon%20invoice%203.mp4" rel="nofollow" title="">paragon invoice 3.mp4</a></p> even if possible manually add html. can't add inline css elements. tried wrapping div won't take inline style deletes upon submission. can add height , width jquery code a

Google tag manager won't push event's to datalayer on Android -

Image
i'm trying implement tag manager in android application following this guide , reason can't push event's datalayer. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); tagmanager tagmanager = tagmanager.getinstance(getapplicationcontext()); tagmanager.getinstance(getapplicationcontext()).setverboseloggingenabled(true); pendingresult<containerholder> pending = tagmanager.loadcontainerpreferfresh(google_tag_manager_container_id, r.raw.gtm_default_container_v2); pending.setresultcallback(new resultcallback<containerholder>() { @override public void onresult(containerholder containerholder) { tagmanager.getinstance(getapplicationcontext()).getdatalayer().push("event", "screenname"); // using "pushevent" method doesn't work either // tagmanager.getinstance(getapplic

Java - Find maximum number of duplicates within an array -

i utilizing hashset finding maximum number of duplicates of value in sorted integer array. algorithm doesn't seem work, not returning desired results. set variables storing number of duplicates found (0), , maximum number of duplicates (0). set hashset stores unique values of array. sort array ready comparison. loop through each value of array if hashset of unique values contains current value: increment duplicate count if currentvalue not equal previous value: if duplicatecount greater maximum count: maximumcount becomes duplicatecount reset duplicatecount 0 java code : hashset<integer> uniquevalues = new hashset<integer>(valuesequencelist); int duplicatecount = 0; int maxcount = 0; arrays.sort(valuesequence); (int = 0; < valuesequence.length; i++) { if (uniquevalues.contains(valuesequence[i])) { duplicatecount++; } if (i > 0 && valuesequence[i] != valuesequence[i-1]

in php remove keys and convert into a flat arrays -

Image
, want remove key "holiday_date" , falt arry array('2010-01-01','2010-01-02',...) smarter way rather loop? you need use array_column() , $tmp = array_column($tmp, 'holiday_date'); this pull out 'holiday_date' values internal arrays, , storing them in $tmp itself, after line, $tmp formed need. example: consider below array, $records = array( array( 'id' => 2135, 'first_name' => 'john', 'last_name' => 'doe', ), array( 'id' => 3245, 'first_name' => 'sally', 'last_name' => 'smith', )); applying, array_column() below, array_column($records, 'first_name'); will return, array ( [0] => john [1] => sally ) if using php version < 5.5, refer this quick implementation of array_column() .

php - JSONP response download as a file? -

when call webservices , response convert jsonp format, @ time response come correctly download file. file format not displayed. download file. try below code. $result = array( 'result'=>'error', 'errormessage'=>'please enter valid data ); header('content-type: application/jsonp'); return json_encode($result); i try echo , print replace of return keyword. $result = array( 'result'=>'error', 'errormessage'=>'please enter valid data ); $this->output->set_content_type('application/json')->set_output(json_encode($result ));

php - .htaccess not working with GoDaddy -

this .htaccess rewrite: options +indexes errordocument 400 /notfound.php errordocument 401 /notfound.php errordocument 403 /notfound.php errordocument 404 /notfound.php errordocument 500 /notfound.php rewriteengine on rewriterule (.*)\.xml(.*) $1.php$2 [nocase] i haven't had trouble using on server other godaddy. sites use custom cms file called "pages" (not "pages.php") links page alias (e.g. http://www.domain.com/pages/page-alias ) , works everywhere. the home page fine. when going page alias, pages file doesn't work. i need use "pages.php" file make work (linking http://www.domain.com/pages.php/page-alias ). is issue .htaccess file on godaddy server? is there i'm missing? with godaddy, need turn off multiviews: options -multiviews [ source ]

bash - Cygwin return different format of date for `date -u` command -

when execute date -u command cygwin terminal / cygwin bash shell, returns output tue, jul 14, 2015 2:52:47 pm but when executed bash command command line, executed date -u , returns output tue jul 14 14:52:27 utc 2015 i need command return output format: tue jul 14 14:52:27 utc 2015 (%a %b %d %h:%m%s %z %y) why return different datetime format? how can change these same format? path different cygwin terminal: cygwin terminal: c:\cygwin\bin\mintty.exe -i /cygwin-terminal.ico - cygwin bash shell: c:\cygwin\cygwin.bat bash: c:\cygwin\bin\bash.exe the date format depends on system's locale: $ lc_all=it_it.utf8 date -u mar 14 lug 2015, 18.04.18, utc $ lc_all=posix date -u tue jul 14 18:04:29 utc 2015 if want consistent date output, explicitly set system, user, script or date command use posix locale.

Javascript: Function inside object not working -

i trying create controller in javascript, respond button clicks , change view accordingly. i have function works looks this: document.getelementbyid("reset").onclick = function () { //do }; however, when try put function in controller object, "unexpected token" error: var controller = { this.reset = document.getelementbyid("reset").onclick = function () { //do }; } i'm not sure 2 things: how fix error? (i know due scope, don't know how fix in way still follows mvc patterns) generally speaking, way go creating controller object? (i'm new mvc model, , don't know if i'm following best practices.) thanks. the error due object cant declared that, there different ways it: var obj1 = { : function() { console.log('obj1'); } }; var obj2 = function() { var b = function() { console.log('obj2'); }; return { a: b } }; var obj

hadoop - Downloading list of files in parallel in Apache Pig -

i have simple text file contains list of folders on ftp servers. each line separate folder. each folder contains couple of thousand images. want connect each folder, store files inside foder in sequencefile , remove folder ftp server. have written simple pig udf this. here is: dirs = load '/var/location.txt' using pigstorage(); results = foreach dirs generate download_whole_folder_into_single_sequence_file($0); /* don't need results bag. dummy bag */ the problem i'm not sure if each line of input processed in separate mapper. input file not huge file couple of hundred lines. if pure map/reduce use nlineinputformat , process each line in separate mapper . how can achieve same thing in pig? pig lets write own load functions , let specify inputformat you'll using. write own. that said, job described sounds involve single map-reduce step. since using pig wouldn't reduce complexity in case, , you'd have write custom code use pig, i'd sug

System getting crashed whenever i try to open fabric plugin in eclipse -

steps performed: install fabric plug-in in eclipse, restart eclipse, click on fabric icon menu bar @ top of eclipse. logged in, after ubuntu crashed. after whenever click on fabric icon menu bar system gets crashed os version - ubuntu 15.04 eclipse version - luna (4.4.2)

Using a text editor other than the Google Apps Script default -

this question has answer here: external editor support google apps script 4 answers i have to work on project in google apps script (gas), , using built-in ide/editor not satisfactory number of reasons. before list these, question whether can use different editor/development environment 1 google provides (without having copy/paste code editor, of course). i use neovim everyday work, able use @ least vim emulation or, better yet, able sync gas files project being hosted online, without having leave normal editor. the built-in ide gas weak, no obvious documentation/keyboard shortcuts i've come across, makes switching between script files small chore. goes without mentioning difficulty debugging (although betterlog makes tolerable). i feel must missing huge (a tutorial maybe) because feel google 1 of first acknowledge developer comfort/laziness when building

amazon ec2 - Domain and subdomain setup in AWS Route 53 DNS Service -

i trying point domain.com , sub.domain.com same ec2 instance's elastic ip. here's how zone file looks like: domain.com - record - elastic_ip_address www.domain.com - alias - domain.com sub.domain.com - alias - domain.com. there soa , ns records domain.com i have tried making sub.domain.com record pointing same ip , no luck whatsoever. dns resolution failing sub.domain.com strange thing resolution not failing www.domain.com as such, visiting domain.com , www.domain.com function not sub.domain.com any idea going on? there more 1 way this, think want like: domain.com - record - elastic_ip_address www.domain.com - cname - domain.com. sub.domain.com - cname - domain.com. cname records non-alias.

objective c - How to setup Facebook iOS SDK properly with Parse in AppDelegate? -

i'm trying integrate facebook parse project, have problems new sdk version. with older versions i've imported related header files appdelegate, pasted 2 methods , worked well. this how i've done it: // appdelegate.m #import <parse/parse.h> #import <parsefacebookutils/pffacebookutils.h> #import <facebooksdk/facebooksdk.h> - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [parse setapplicationid:@"xy" clientkey:@"xy"]; [pffacebookutils initializefacebook]; [pfanalytics trackappopenedwithlaunchoptions:launchoptions]; return yes; } - (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { return [fbappcall handleopenurl:url sourceapplication:sourceapplication withsession:[pffa

jquery - Is there a way to find javascript-library dependency trough your application -

in application have there javascript-libraries need updated. updates there parts of application break. it's aps.net application , library needs updated jquery-ui is there way find out functions used trougout application?

c++ - Multiple definiton of function when including library -

i try include headers library in different files of project , multiple definition errors on functions of library. after reading answer this question think problem functions implemented directly in header files of library. in particular want include files codecfactory.h , deltautil.h fastpfor . don't know if relevant problem include cmake project code in cmakelists.txt: include_directories(../../fastpfor/headers) add_library(fastpfor static ../../fastpfor/src/bitpacking.cpp ../../fastpfor/src/bitpacking.cpp ../../fastpfor/src/bitpackingaligned.cpp ../../fastpfor/src/bitpackingunaligned.cpp ../../fastpfor/src/horizontalbitpacking.cpp ../../fastpfor/src/simdunalignedbitpacking.cpp ../../fastpfor/src/simdbitpacking.cpp ${headers} ) everything works fin

hadoop - Kafka on Windows - start service error -

i trying cleanly start kafka 2.10 - 0.8.2.1 on windows getting annoying error everytime start it. i have installed kafka following quick start guide (with exception have installed zookeeper myself). both kafka , zookeeper installed basic, on single machine. problem when run starting script: kafka-server-start.bat c:\kafka_2.10-0.8.2.1\config\server.properties i error: error [2015-07-14 17:00:45,197] warn error when freeing index buffer (kafka.log.offsetindex) java.lang.nullpointerexception @ kafka.log.offsetindex.kafka$log$offsetindex$$forceunmap(offsetindex.scala:301) @ kafka.log.offsetindex$$anonfun$resize$1.apply(offsetindex.scala:283) @ kafka.log.offsetindex$$anonfun$resize$1.apply(offsetindex.scala:276) @ kafka.utils.utils$.inlock(utils.scala:535) @ kafka.log.offsetindex.resize(offsetindex.scala:276) @ kafka.log.log.loadsegments(log.scala:179) @ kafka.log.log.<init>(log.scala:67) @ kafka.

javascript - Hide an input until a checkbox has been checked -

in following form how can hide <input> tag after checkbox , show when checkbox checked? <ul style="list-style-type:none"> <li> <input type="text" name="accountname" style="width:95%" class="field-style field-full align-none" placeholder="company name" /> </li> <li> <label>please fill in contact information below</label> <input type="text" name="firstname" class="field-style field-split align-left" placeholder="first name" /> <input type="text" name="lastname" class="field-style field-split align-right" placeholder="last name" /> </li> <li> <input type="text" name="address" class="field-style field-split align-left" placeholder="street # , name" /> <sele

html - Delete a cookie, javascript -

i'm trying conform italian cookie law banner notify cookies left website. used (and changed little bit) banner code made available google ( https://www.cookiechoices.org/ ) the banner works fine added little function (delete_cookie) in order let user delete manually cookie, left banner, clicking on link in cookie policy page. made tests , can't manage delete damn cookie when click on link :) (i'm working in local) (function(window) { if (!!window.cookiechoices) { return window.cookiechoices; } var document = window.document; // ie8 not support textcontent, should fallback innertext. var supportstextcontent; try{ supportstextcontent = ('textcontent'); } catch(e){ supportstextcontent = false; } var cookiechoices = (function() { var cookiename = 'displaycookieconsent'; var cookieconsentid = 'cookiechoiceinfo'; var dismisslinkid = 'cookiechoicedismiss'; function _createheadereleme

Is it possible to query cpu utilization of a compute instance using the gcloud api? -

when load testing single core compute instance noticed top showing 10% cpu utilization. however, in compute console utilization of instance 100%. believe top showing utilization of host while compute console showing container utilization. since container more relevant load testing wondering if possible query metric via api command? $ gcloud compute cpu-utilization "instance-name". something of sort. you can enable google cloud monitoring api project , query api cpu metric instance(s). you can find more information on cloud monitoring api on link . hope helps.

amazon web services - AWS javascript SDK multiple file upload progress bar -

i can upload files s3. want progress loaded in each file. bucket.upload(params, function(err, data){ console.log("file uploaded successfully"); }).on('httpuploadprogress', function(progress){ console.log(progress.loaded / progress.total * 100);} the problem code is. progress returns data not identify data single file. is there way find out if return progress single data?. for came across same issue. there's no need hack code actually. use this in upload progress callback. s3.upload(params, function (err, data) { ... }).on('httpuploadprogress', function(progress) { // here can use `this.body` determine file particular // event related , use info calculate overall progress. }); i've posted issue in aws sdk js repo, , maybe there better solution on time.

web services - 401 Error when connecting to PrestaShop webservice from android -

i trying call webservice in prestashop 401 not authorized error. though have passed username key. tried authenticator error httpretryingerror. find below code snippet of have done. method one: final string username = "key_here"; final string password = "";// leave empty url urltorequest = new url(urlstr); urlconnection = (httpurlconnection) urltorequest.openconnection(); urlconnection.setdooutput(true); urlconnection.setrequestmethod("get"); urlconnection.setrequestproperty("content-type", "text/xml;charset=utf-8"); string authtobytes = username + ":" + password; //.... byte[] authbytes = org.apache.commons.codec.binary.base64.encodebase64(authtobytes.getbytes()); string authbytesstring = new string(authbytes); //then code urlconnection.setrequestproperty("authorization","basic " + authbytesstring); int statuscode = urlconnection.getresponsecode(); ---> 401 if (statuscode != httpurlconnectio

ios - How to send data from Iphone to Apple Watch in OS2 in Objective-C -

i've seen similar question posted on how send data , forth in swift. i'm asking same question in objective-c. i've viewed apple's transition docs . i work best clear examples, rather lecture material. if has implemented , wouldn't mind sharing, appreciated. here´s link q/a watchconnectivity: send messages between ios , watchos watchconnectivity in watchos2 i give example go applicationcontext, there 2 other messaging techniques watchconnectivity. please watch wwdc2015 session video those. first need conform wcsessiondelegate protocol in classes want send , receive data from/to. e.g both on watch , iphone. basic checking before: (this example, implement better this) if ([wcsession issupported]) { wcsession *session = [wcsession defaultsession]; session.delegate = self; [session activatesession]; nslog(@"session avaible"); } //objective-c if ([[wcsession defaultsession] isreachable]) {

jQuery to JavaScript code -

i want convert below jquery code pure javascript load javascript function. html <select name="select" id="select" > <option id="en" value="global.html">global</option> <option id="au" value="australia.html">australia</option> <option id="id" value="indonesia.html">indonesia</option> </select> js code: function getcode () { var = new date().gettime(); var randomnumber = math.floor((math.random() * 100) + 1); var uniquenumber = + 'a' + randomnumber; $.getscript("getcountrycode.js?" + uniquenumber, function(data, textstatus, jqxhr) { if (country){ var code = country; alert("country code:" + code); document.getelementbyid(code).selected = 'selected'; document.getelementbyid('select').onchange.apply(); } }); } want a

ssl - Access SNI websites from Azure web role -

we have azure web role that's used send httpwebrequests it's imperative able access type of website. recently, noticed sni websites cannot accessed; tls handshake errors being reported in event log: a fatal alert received remote endpoint. tls protocol defined fatal alert code 40. the web role machine running windows server 2012 latest updates applied , sni websites cannot accessed ie10 either (although chrome can see them). have windows server 2012 machine set virtual machine, , unlike web role, machine has no trouble accessing sni sites. we noticed azure web roles come few root certificates preinstalled. tried manually installing root certificate didn't help.

javascript - Query on date for posts created the last 24h -

i have schema date field "created_at": var post = new mongoose.schema({ text : string, created_at : {type : date, index : true}, pos : {latitude: number, longitude: number}, created_by : {type : schema.types.objectid, ref : "userschema"} }); with this: post.pre("save", function (next){ var currentdate = new date(); if(!this.created_at) { this.created_at = currentdate; } next(); }); now want post created last 24h, how can query ? to posts created in last 24hrs, current time, subtract 24 hours , value of start date use in date range query: var start = new date(new date().gettime() - (24 * 60 * 60 * 1000)); post.find({ "created_at": { "$gte": start } }).exec(callback); if want know more $gte , check following article: https://docs.mongodb.org/manual/reference/operator/query/gte/ with momentjs library can simply var start = moment().subtract(24, 'hours&#