Posts

Showing posts from July, 2010

haskell - How to create a list of heterogeneous datatypes without using sum-types or copies -

the use-case: app follow users across several messaging services. there's twitteraccount datatype, facebookaccount datatype, etc. these joined account sum-type, next level of hierarchy leads problem. a twitteraccount has list of twitterpost s, facebookaccount has list of facebookpost s, etc. my task: want able put posts last 10 days accounts single list, , extract common time , message body fields them display. my failed approach: thought if every class of post implemented typeclass simplepost exposing functions messagebody , messagetime that might solve problem, can't create list of [simplemessage] . i want maintain invariant twitteraccount can contain twitterpost s, , on, can't use sum-types. i'd prefer not create copies of objects this. what best, cleanest, haskell-ish design problem? update isn't answer, alternative 4 solutions provided recursion.ninja , helder pereira i've been thinking if can meet invariants using phantom type...

.net - Dispose a SemaphoreSlim while WaitAsync -

the documentation of semaphoreslim says 'dispose should used when other operations have completed'. how should following class adjusted thread b can call dispose() while thread awaiting async(). async() must throw objectdisposedexception when dispose() called. class { semaphoreslim _sem = new semaphoreslim(0); public task async() { return _sem.waitasync(); } public void dispose() { _sem.dispose(); } } how should following class adjusted thread b can call dispose() while thread awaiting async() it shouldn't. documentation quote says, if operations aren't completed, dispose() shouldn't called. if there's thread still awaiting waitasync() operation isn't completed, , therefore dispose() should not called. from comment: dispose called means of cancelling pending requests , releasing resources. that's ill-advised way of cancelling request. sure, if puts object invalid state could cause exceptions in other thread...

php - Unable to fire ajax call in jQuery document ready -

i facing problem ajax call when trying submit form database. here code: <?php include 'dbconnect.php'; include 'session.php'; ?> <form class="form" id="form" action="" method="post"> <table class = "left"> <tr align="justify"> <td></td> </tr> <tr> <td> <p align="right"> <font size = "4">new subject name : <input type = "text" name = "subjectname" id = "subjectname"/> </font> </p> </td> </tr> <tr> <td> <p align="center"> <input type = 'image' name = 'submit' src="images/submit.gif" value = '...

Rewrite Rule Not working .htaccess -

i have following url trying make seo friendly url. tried few of online rewrite validators , validated perfect rules have written in .htaccess, it's still not working when uploaded server. appreciated. i want http://example.com/deal/de3582c47f/ redirected (without changing url end user) http://example.com/dealinfo.php?offerid=de3582c47f . there multiple sites deployed in common root directory. below .htaccess rules: options +followsymlinks rewriteengine on rewritecond %{http_host} ^example\.com [or] rewritecond %{http_host} ^www\.example\.com rewriterule ^deal/(.+)/$ dealinfo.php?offerid=$1 [l] i not sure going wrong? actually.. rewritecond rules have, tell latest rule, should work on domains. does virtualhost definition has allowoverride all? but go with: rewriteengine on rewritecond %{http_host} ^(www\.)?example.com [nc] rewriterule ^deal/(.+)/ /dealinfo.php?offerid=$1 [l] i added slash @ begining of dealinfo.php, on documentroot folder defined on vi...

html - Make Bootstrap columns appear in one row -

i have used bootstrap before, i'm having issue columns. cannot find answer on stackoverflow. my columns appearing in 2 rows instead of one. here fiddle: http://jsfiddle.net/n0syj75t/ html: <div class="container-fluid"> <div class="header row"> <div class="col-sm-1"></div> <div class="col-sm-3 logo"> <a href="#"><img src="http://lorempixel.com/output/abstract-q-c-300-63-7.jpg"></a> </div> <div class="col-sm-8 header-menu"> <div class="menu-menu-1-container"> <ul id="menu-menu-1" class="menu"> <li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-28"><a href="#">services</a></li> <li id="menu-item-26" class="menu-i...

javascript - AngularJS html5mode reloading page -

i have 2 separate applications: angularjs client working on http://localhost:8080 nodejs api server working on http://localhost:3000 nodejs api server gives json data client (and not give html pages). so, provide client ability communicate server, enable cors technology on api server. app.use(function(req, res, next) { res.header("access-control-allow-origin", "*"); res.header("access-control-allow-headers", "origin, x-requested-with, content-type, accept"); res.header('access-control-allow-methods', 'get,put,post,delete,options'); next(); }); also want use clean urls without # symbol, enable html5mode in angularjs app function config($stateprovider, $urlrouterprovider, $locationprovider) { $locationprovider.html5mode(true); $urlrouterprovider.otherwise('/login'); ... ---index.html <!doctype html> <html lang="en" ng-app="app"> <head> <base ...

jquery - Re-executing Javascript every route in Meteor / Flow Router? -

i have code in theme appends background css background. here's js code: $('.background-image-holder').each(function() { var imgsrc = $(this).children('img').attr('src'); $(this).css('background', 'url("' + imgsrc + '")'); $(this).children('img').hide(); $(this).css('background-position', 'initial'); }); // fade in background images settimeout(function() { $('.background-image-holder').each(function() { $(this).addclass('fadein'); }); }, 200); now issue code works everytime refresh page, not when click 1 route next. e.g. refresh index page , cover image loads, if click page images on page no longer load... unless refresh page. i'm executing code using .onrendered method: template.mainindex.onrendered(function(){ ...code here }); is there anyway can have script re-execute on every load, or there better way resolve issue? i'm using ...

forms - What format is required to import a date into google spreadsheet -

with of "stackoverflow" , it's users i'm using app import data google spreadsheet. problem have date question on form, , can not manage import it. if change format (in forms) text, data imports has been sent app, when change date, nothing. i've believe i've tried usual date formats (dd/mm/yyyy, mm/dd/yyyy, yyyy/mm/dd, yyyy/dd/mm) yy above , numerical. i know google form shows date in users format , not problem. shows correctly in spreadsheet in local format (dd/mm/yyyy). does know format form uses send data spreadsheet, or anyway find out. thanks in advance. ok, after using wikipedia, , trying every different format works using format yyyy-mm-dd

How to display date in PHP? -

if date 2015-08-15. how display result this: 2015-08-15 2015-08-16 2015-08-17 i have following code: $today = date('y-m-d'); $a = "3"; $nextdate = date('y-m-d', strtotime($today . ' + ' . $a . ' days')); echo $nextdate; $date = new datetime(); echo $date->format('y-m-d') . '<br/>'; ($i = 1; $i < 3; $i++) { $date->modify('+1 day'); echo $date->format('y-m-d') . '<br/>'; }

javascript - How to order by json attribute -

i have simple json file this: {"item1": {"p1": {"p1sub1": 8, "p1sub2": 7}, "p2": {"p2sub1": 6, "p2sub2": 5} }, "item2": {"p1": {"p1sub1": 4, "p1sub2": 3}, "p2": {"p2sub1": 2, "p2sub2": 1} } } which retrieve this: app.controller('customersctrl', function($scope, $http) { $http.get("content2.json") .success(function (data) {$scope.items = data;}); }); and show in html: <ul ng-repeat="(i, val) in items | orderby:'p1.p1sub1'"> <li>{{i}} - {{val.p1.p1sub1}} - {{val.p1.p1sub2}} - {{val.p2.p2sub1}} - {{val.p2.p2sub2}}</li> </ul> i this, no matter put in "orderby" filter: item1 - 8 - 7 - 6 - 5 item2 - 4 - 3 - 2 - 1 is there way order list 'p1.p1sub1' values? edit : want order rows p1.subp1 value has in ascendent/descendent order (in exam...

Label animation inside a switch case c# -

on face of it seems quite simple. have switch case , if condition met print text label animation. in case type writer animation. i have made animation cant seem integrate similar version switch case itself. help? type writer animation code c#: public partial class form1 : form { int _charindex = 0; string _text = "this test."; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { _charindex = 0; label1.text = string.empty; thread t = new thread(new threadstart(this.typewritetext)); t.start(); } private void typewritetext() { while (_charindex < _text.length) { thread.sleep(50); label1.invoke(new action(() => { label1.text += _text[_charindex]; })); _charindex++; } } } } and animation code needs placed this: switch case code: ...

vbscript - how to get permission to replace the utilman.exe -

i permission replace or rename utilman.exe . script below not working. dim strfolder, struser, strdomain strfolder = "c:\windows\system32\utilman.exe" set fso = createobject("scripting.filesystemobject") set objshell = wscript.createobject("wscript.shell") objshell.run("takeown /a /f" & chr(34) & strfolder & chr(34)),1,true objshell.run("icacls chr(34) & strfodler & chr(34) /grant administrator:f"),1,true wscript.quit you defined icacls commandline single string when apparently want contain value of variable strfolder in double quotes. must use string concatenation work in vbscript. also, may want put space after parameter /f of takeown , remove parentheses around commands. change this: objshell.run("takeown /a /f" & chr(34) & strfolder & chr(34)),1,true objshell.run("icacls chr(34) & strfodler & chr(34) /grant administrator:f"),1,true into this: ob...

angularjs - enabling cors in meanjs rest api server -

i creating api (server side) based on meanjs.org latest version (0.4.0) , managed pull off men part , create 1 in http://localhost:3000/api as frontend part created angularjs in http://localhost:4000/ and run both application using (p)ackage (m)anager 2 i trying create user sending user credentials using $resource this angular.module('users').factory('authenticationresource', ['$resource', function($resource) { return $resource('http://localhost:3000/api/auth/signup', {}, { post: { method: 'post' } }); } ]); ... //in controller $scope.signup = function() { authenticationresource.post($scope.credentials, function(response) { $scope.authentication.user = response; $state.go($state.previous.state.name || 'home', $state.previous.params); }); }; while in server side's express.js 'use strict'; var config = require('...

android - Map the ObjectId Pointer to a Collection in Parse during REST / CSV data upload? -

we using parse backend android & iphone mobile application. database has 2 collections 1 stores , other products. 1 store can have multiple products, however, 1 product can belong 1 store. for use case, have used pointer column in product collection points objectid store. now, want bulk upload products & stores database using either csv imports or rest api. how can map products in database corresponding store's objectid automatically during upload? have unique identifiers stores, products & mapping in data uploading.

explorer - Virtual filesystem integrated with windows -

i have application wrote let me explore/manipulate virtual disks legacy computer emulator. can point me in right direction hook windows explorer, in same way zip folders integrated (also similar acronis true image backup files (.tib files).

image - how to upload to kinvey only once -

i made program in delphi upload picture kinvey provider, first program saves image timage component in specific dir upload kinvey, issue every time open program uploads kinvey, how make sure upload 1 time if opened program multiple times image1.repaint; image1.bitmap.savetofile('some dir'); procedure ttabbedwithnavigationform.timer2timer(sender: tobject); var fn : string; lstream : tfilestream; lfile : tbackendentityvalue; begin fn := 'the file dir'; try lstream := tfilestream.create(fn, fmopenread); backendfiles1.files.uploadfile(fn,lstream, 'image/png',lfile); lstream.free; backendfiles1.free; end; end; end. the name of method "timer2timer" suggests code triggered... timer component named timer2. ;-) check timer activated. if enabled @ design time, event called defined time has elapsed, independently user interaction. btw: use try/finally-block streams, stream creation should directly before "try" (else trigg...

java - How I can catch exception in JSP files? -

i used exceptionhandler catch exception in controllers. @exceptionhandler(value = {exception.class, runtimeexception.class}) public final modelandview globalexceptionhandler(final exception exception) { modelandview modelandview = new modelandview("error/500"); modelandview.addobject("tl_exception", errorsystem.processingerror(exception)); return modelandview; } but, example, if in jsp file tring data null object, that's exception not cathcing. i need advice, how can catch exception in jsp file? or error need catching in controllers? update: the best solution put in web.xml uri errors. <error-page> <location>/error</location> </error-page> after create controller needed processing error request: @controller public final class errorcontroller { @requestmapping(value = "/error") public final modelandview globalerrorhandle(final httpservletrequest request) { string page = "err...

Android Json tag into String -

i use code reading tag specific url: public static string ter(final string private) { jsonparser parser = new jsonparser(); try { object obj = parser.parse(new filereader("my url string")); jsonobject jsonobject = (jsonobject) obj; string event = (string) jsonobject.get("event"); return event; } catch (exception e) { e.printstacktrace(); } return private; } then set subtitle private in way: getactionbar().setsubtitle("test"+ter(private)); but when run app, in subtitle read text "test" text "null" , doesn't read tag of json. has idea? code wrong? because may have not initializes variable therefore pointing towards null values.... when ever create object,either calling method or initializing variable @ declaration, can avoid null pointer exception... please refer post

ios - App freezes until image is downloaded and shown. Parse -

i using parse.com when download pffile(contains image) in viewdidappear app freezes while , shows pic. not right. want uiactivityindicatorview animated or @ least shown. know deals async or something. have no idea how make work correctly. pffile* imagefile = [[pfuser currentuser] objectforkey:@"profilepic"]; if (imagefile) { self.activity.hidden = no; [self.activity startanimating]; nsurl* imagefileurl = [[nsurl alloc]initwithstring:imagefile.url]; nsdata* imagedata = [nsdata datawithcontentsofurl:imagefileurl]; self.profilepic.image = [uiimage imagewithdata:imagedata]; } this downloads image , shows it. upd: pfquery* query = [pfuser query]; [query valueforkey:@"profilepic"]; [query findobjectsinbackgroundwithblock:^(nsarray* data, nserror* error) { pffile* imagefile = data[0]; [imagefile getdatainbackgroundwithblock:^(nsdata* data,nserror* error){ if (!error) { self.activity.hidden = no; [self.activity startanimating]; nsurl* imagefileurl = [[nsurl...

html - How do I create another window on top of a page using Javascript? -

i'm alittle confused how create page on top of page. want have page open with: hi ________. then, when user types name in , presses enter, name saved page writes "hi [insert name here]!. i'm not sure best course of action. should should use prompt, or input text box? how able save name provided? i'm not sure if there such effect? i know how create text input box, , how make form press enter keyboard, don't know how put effect on top. how can make window on top of window? so website prompts user <p>enter name</p> <button onclick="myfunction()">try it</button> <p id="demo"></p> after, page fills in name, name inserted script. page display name entered. example, "hi sam." in regular page. use version of this? <script> function myfunction() { var x = document.getelementbyid("mytext").value; document.getelementbyid("dem...

how to determine the statistics of memory analyzer for android app -

Image
i have started use mat analyse memory , following attached report. no know extent how use mat don't statistics stands reason. application's memory reports or worst ? how determine , resolve reduce risk. so how can identify critical area , steps resolve things

Trying to get my controller and action name in a javascript file -

i'm looking @ link here , anser given is var controllername = '@viewcontext.routedata.values["controller"].tostring()'; but doesn't seem return in javascript file. shows value string '@viewcontext.routedata.values["controller"].tostring()' doesn't compute name. i had put in view <script type="text/javascript"> var controllername = '@viewcontext.routedata.values["controller"].tostring()'; var actionname = '@viewcontext.routedata.values["action"].tostring()'; </script> i couldn't read in javascript file. 2 variables accessable in js file

C# combine to list in json object -

i have 2 lists of string: list<string> tmpcols = new list<string>(); list<string> tmprows = new list<string>(); e.g. tmpcols = [a,b,c]; , tmprows = [x, y]; i need iterate both list , json result this: new matrix() { id = "1", col = "a", row = "x" }); new matrix() { id = "2", col = "b", row = "x" }); new matrix() { id = "3", col = "c", row = "x" }); new matrix() { id = "4", col = "a", row = "y" }); new matrix() { id = "5", col = "b", row = "y" }); new matrix() { id = "6", col = "c", row = "y" }); the dimension in case 2 rows , 3 columns. this textbook example of nested loop. loops can contain other loops, inner 1 repeats each element of outer one. 1 might like: var result = new list<matrix>(...

c++ - android.mk sdl building errors -

i've looked around @ questions writing android.mk files , "make: * no rule make target .c needed .o"** center around typos don't think have. this sdl project builds fine cmake build scripts can't android.mk work me. here's project setup in cmake cmake_minimum_required(version 2.8) project(blp) #set(cmake_macosx_rpath 1) set(cmake_archive_output_directory ${cmake_binary_dir}/lib) set(cmake_library_output_directory ${cmake_binary_dir}/lib) set(cmake_runtime_output_directory ${cmake_binary_dir}/bin) set(cmake_module_path ${project_source_dir}/cmake_modules) find_package(sdl2 required) include_directories(${sdl2_include_dir}) include_directories("${project_source_dir}/source/core_math") include_directories("${project_source_dir}/source/utils/time_utils") include_directories("${project_source_dir}/source/utils/resource_utils") include_directories("${project_source_dir}/source/ren_opengl") include_directories(...

ajax - Handling Json data outside a function with pebble.js -

in function getweather() fetch weather data json-object , store data in variable data . within function, can handle json-data, how access data outside of getweather() ? it doesn't matter if return variable location or data . variable place not json. how handle place variable in order make work within function getweather() ? var ajax = require('ajax'); var place; place = getweather(); function getweather() { // make request ajax( { url: 'http://api.openweathermap.org/data/2.5/weather?q=paris.fr', type: 'json' }, function(data) { // success! console.log("successfully fetched weather data!"); // extract data var location = data.name; return location; }, function(error) { // failure! console.log('failed fetching weather data: ' + error); } ); } the in ajax stands asynchronous. what's happening in code trying assign value place...

scratchpad - How to register TSF with Windows Desktop speech engine -

here code initialize , register tsf: ::oleinitialize(null); hresult hr=cocreateinstance(clsid_tf_threadmgr,null,clsctx_inproc_server,iid_itfthreadmgr,(void **)&pthreadmgr); if (failed(hr) || pthreadmgr==null) return; hr=pthreadmgr->activate(&clientid); if (failed(hr)) return; hr=pthreadmgr->createdocumentmgr(&pdocumentmgr); if (failed(hr) || pdocumentmgr==null) return; ptextstore=new ctextstore(); // create itextstoreacp store hr=pdocumentmgr->createcontext(clientid,0,reinterpret_cast<itextstoreacp *>ptextstore,&pcontext,&editcookie); if (failed(hr) || pcontext==null) goto end; hr=pdocumentmgr->push(pcontext); if (failed(hr)) return; at end of code, textstore interface gets gettextview,getstatus , getwnd calls. however, no calls received settext() or other methods when speak microphone. default dictation scratchpad shows instead. don't want scratchpad show up. need text routed textstore. need register textstoreacp interfac...

javascript - How to draw a hex grid overlay with d3.js on Google Maps -

i'm trying figure out how draw interactive hex grid on top of google maps using d3.js, can't seem find documentation necessary particular implementation. current demo i'm working with this combination of ionic-starter-maps project d3.js geometry overlay demo mixed in ( code video here ). plan utilize hex grid information this article . the 2 heavy lifting (i think) functions here: function d3init() { width = map.getdiv().offsetwidth; height = map.getdiv().offsetheight; projection = d3.geo.equirectangular() .translate([0,0]) .scale(57.29578) .precision(.1) context = new polylinecontext(); path = d3.geo.path().projection(projection).context(context); equator = {type: 'linestring', coordinates: [[-180,20],[-90,0], [0,-20], [90,0], [180,20] ] } render(); } function render() { polyline.setoptions({ strokecolor: 'red', strokeweight: 2 }); context.setcurrent(polyline.getpath()); path(equator); } most of ...

Using an exported variable from another Meteor package -

i'm trying wrap extension chart.js in package meteor. inside extension, author tries access global chart variable. is exposing variable in export.js file (loaded before extension) considered proper solution? this.chart = package['chart:chart'].chart;

plot - MATLAB two for loops for a range and a recurrence equation -

i have been given recurrence equation: x(n) = a x(n-1)/1+b x(n-1). having trouble plotting solution matlab 2014b, returns figure plots multiple curves range o:10 on single graph. have far in terms of making range in form of y: function questions1 () n = 100; %xn in form of n x = zeros (n,1); x(1) = 0; = 2; b = 1; y = 0:10; %this range 0:10 plot curves n = 2:n; x(n) = a*x(n-1)/1+b*x(n-1); %this recurrence equation end end hold on; plot(x); hold off; notice that x(0)=0 x(1)=a*x(0)/1+b*x(0)=a*0+b*0=0 x(2)=a*x(1)+b*x(1)=a*0+b*0=0 .. ∀n, x(n)=0 so recursive equation quite bad.. , you're replacing x(n) on each y-iteration, here fix: function question1() n = 100; %xn in form of n x = zeros(n,1); x(1) = 0; = 2; b = 1; hold on; y = 0:10; %this range 0:10 plot curves n = 2:n; x(n) = a*x(n-1)/1+b*x(n-1); %this recurrence equation end plot(x); end hold off;

ios - Declare a read-only @NSManaged property in Swift for Parse's PFRelation -

i'm using parse object store in ios application , i've created custom subclass parse object, looks this: class mything: pfobject, pfsubclassing { // ...pfsubclassing protocol... @nsmanaged var name: string @nsmanaged var somethingelse: string @nsmanaged var relatedthings: pfrelation } the relatedthings property works: able fetch related objects store. however, keep getting warning parse: [warning]: pfrelation properties readonly, myapp.mything.relatedthings declared otherwise. in objective-c, have marked property readonly, unsure how in swift silence warning. using let instead of var not allowed in combination @nsmanaged . adding private(set) has no effect either: @nsmanaged private(set) var relatedthings: pfrelation so how parse expect me declare relationship property? now should use: var relatedthings: pfrelation! { return relationforkey("relatedthings") }

android - How do you interpret "java.lang.NoSuchMethodError: No direct method"? -

we decided, perhaps naively, should update many of our libraries two-year-old 1.12.0-betas nice new versions 1.20.0. example: updated google-http-client-1.12.0-beta.jar google-http-client-android-1.20.0.jar. when execute code: list<string> scopes = lists.newarraylist(sendtogoogleutils.fusion_tables_scope); googleaccountcredential credential = sendtogoogleutils.getgoogleaccountcredential( context, account.name, scopes ); if (credential == null) { return false; } fusiontables fusiontables = new fusiontables.builder( androidhttp.newcompatibletransport(), new gsonfactory(), credential).build(); we amazing error report: fatal exception caused by: java.lang.nosuchmethoderror: no direct method <init>(lcom/google/api/client/http/httptransport;lcom/google/api/client/http/httprequestinitializer;ljava/lang/string;ljava/lang/string;lcom/google/api/client/json/jsonobjectparser;lcom/google/api/client/googleapis/services/googleclientrequestinitializer...

javascript - What exactly is Hot Module Replacement in Webpack? -

Image
i've read few pages hot module replacement in webpack. there's sample app uses it . i've read of , still don't idea. what can it? supposed used in development , not in production? livereload, have manage yourself? webpackdevserver integrated in way? suppose want update css (one stylesheet) , js modules when save them disk, without reloading page , without using plugins such livereload. hot module replacement can me with? kind of work need do, , hmr provide? first want note hot module replacement (hmr) still experimental feature. hmr way of exchanging modules in running application (and adding/removing modules). can update changed modules without full page reload. documentation prerequirements: using plugins: http://webpack.github.io/docs/using-plugins.html code splitting: http://webpack.github.io/docs/code-splitting.html webpack-dev-server: http://webpack.github.io/docs/webpack-dev-server.html it's not hmr, here links: exa...

html - How do I center the text in my div? -

this question has answer here: how vertically center text css? 31 answers how the texts in div id="tools" centered evenly spaced in div created nav bar? here css , html second #learn { display: inline; background-color: white; font-size: 1.1em; } #sign { display: inline; background-color: white; font-size: 1.1em; } #find { display: inline; background-color: white; font-size: 1.1em; } #about { display: inline; background-color: white; font-size: 1.1em; } .toolnav { height: 50px; width: 1000px; background-color: white; border: 2px deepskyblue solid; border-radius: 15px; margin: auto; line-height: 50px; text-align:center; } <div class="toolnav"> <div id="learn">learn more</div> <div id="sign">sign up</div> <div ...

node.js - Could not find module 'shelljs' -

i have error when run apache cordova project visual studio 2015 below. error bld401 error : bld00401 : not find module 'shelljs'. please go tools --> options --> tools apache cordova --> cordova tools --> clear cordova cache , try building again. i tried install shelljs grobally npm install -g shelljs but still not working. should convert phonegap project , work on other ides? i found solution reason [-g] install globally wasn't working. did installing shelljs command in project location below. path project\platforms\android\cordova and install "shelljs" @ location npm install shelljs hope has same issue.

json - Parsing data from MapQuest reverse geocoding api in Python? -

my code: from urllib import request import json lat = 31.33 ; long = -84.52 webpage = "http://www.mapquestapi.com/geocoding/v1/reverse?key=my_key&callback=renderreverse&location={},{}".format(lat, long) response = request.urlopen(webpage) json_data = response.read().decode(response.info().get_param('charset') or 'utf-8') data = json.loads(json_data) print(data) this gives me following error: valueerror: expecting value: line 1 column 1 (char 0) i trying read county , state mapquest reverse geocoding api. response looks this: renderreverse({"info":{"statuscode":0,"copyright":{"text":"\u00a9 2015 mapquest, inc.","imageurl":"http://api.mqcdn.com/res/mqlogo.gif","imagealttext":"\u00a9 2015 mapquest, inc."},"messages":[]},"options":{"maxresults":1,"thumbmaps":true,"ignorelatlnginput":false},"result...

jquery - How to get json in javascript or ajax -

Image
i have json data how can data using javascript thanks :) this code var getjsondata = function(uri,callback){ $.ajax({ type: "get", datatype: "jsonp", url: uri, jsonpcallback: 'response', contenttype: "application/json", success: function(json){ console.log(json); callback(json); } }); } var uri = pbxapi+"/confbridge_participants/conference_participants.json?cid="+circle; getjsondata(uri, function(res){ } var uri = pbxapi+"/confbridge_participants/conference_participants.json?cid="+circle; getjsondata(uri, function(res){ var data = json.parse(res); for(var objectindex=0; objectindex < data.length; objectindex++){ var tempobject = data[objectindex]; var id = tempobject.id; var uid = tempobject.uid; .... var updated_at = tempobject.updated_at; } }

html - Does the Codecademy codebit window distort the real appearance of a website? -

https://www.codecademy.com/jack-aaron/codebits/vl8j7y/ this site i'm working on. code there. looks pretty nice in editor's browsing window. however, when copy-paste code index.html , style.css file respectively on computer , open in browser, styling looks different. image misplaced, sections different sizes , looks wrong. why that? i think may have answer: <link rel="stylesheet" href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css"> that's how load bootstrap page because that's "taught" codecademy. work outside of codecademy browser? welcome stack overflow! now, how work. reason looks odd because whole website designed using pixels. make funky on screens, except 1 designed on. to make correct, should (need) use percentages. now, why looks weird on there, , other places? different sized places, instance, on codecademy small preview window. yes, funky, use percentages, not pixels. ...

php - Magento - cron job script is running, but Magento order confirmation emails are not sending -

as magento documentation states, need set cron job on web server in order things order confirmation emails send out, so: * * * * * /bin/sh /absolute/path/to/magento/cron.sh this simple cron job. issue is, automated tasks not completing in magento. it's if script isn't being run cron job. , result, order confirmation emails not sending (among other magento automated tasks). i've installed aoe scheduler extension double-check every automated task in magento , see when tasks completing (or, in case, when they're not). none of tasks including core_email_queue_send_all completing on 1-minute-interval basis. now here's weird part. if go run cron.php script ( cron.sh triggers cron.php ) loading in web browser @ mydomain.com/cron.php , magento automated tasks execute! , since script works when run manually, , know cron jobs working...i can't figure out! please help! additional details here's how know cron jobs working—i have tested cron jobs o...

Visual Studio 2015 changes config from debug to release when i publish -

i have project set debug config normal coding. when publish using 'publish web' button, config automatically changes release after publish completed. if open 'edit publish profile' , publish dialog box, not happen. anyone know if bug or can address through type of config setting? thanks. martin noreke's comment correct: publish compile , push release build, doesn't reset afterwards. vice versa, if publish using profile has debug configuration while having release selected, visual studio switches debug. this happens when use web click once publish toolbar though. if publish using publish web dialog, visual studio doesn't switch configuration. can open dialog clicking button next publish button on toolbar, or right-clicking project , clicking "publish...". edit : appears fixed in visual studio 2017.

Why doesn't the FileSearch element's MinVersion attribute work in my WiX installer? -

i writing windows installer package using wix toolset . application integrates windows forms webbrowser control—basically internet explorer—and need ensure minimum version of internet explorer in installer. did not find easy, built-in method in wix check internet explorer version (as there .net framework), following wix tutorial's instructions checking file's version number during installation along microsoft's documentation of internet explorer version numbers (under heading, how determine version of internet explorer windows , third bullet point). here relevant code product.wxs file explanatory comments included: <property id="ie10orhigher"> <directorysearch id="progfolder" path="[programfilesfolder]\internet explorer"> <!-- tried following line ensure directorysearch path , filesearch name attributes functioning correctly. line--without minversion set--results in ie10orhigher proper...

How to pass an HTML Select tag using Javascript and Ajax to PHP $_POST with one (array) var when the name attribute is an array -

these links: " how modify html select when name array using javascript " and " how pass array html javascript? " blinds me on if have select tags 2 or more different names like: <select name='category[123]'> <option value='0'>off</option> <option value='1'>on</option> </select> <select name='category[456]'> <option value='0'>off</option> <option value='1'>on</option> </select> <select name='anothercategory[123]'> <option value='0'>off</option> <option value='1'>on</option> </select> <select name='anothercategory[456]'> <option value='0'>off</option> <option value='1'>on</option> </select> you can use $("form").serialize() posting values form.

How to pass the password to the jenkins build -

i have java class requires password of user stored in local machine of user, when trigger build in master jenkins, build failed due authentication searching user password not available in machine.how can make generics jenkins build successful. set environment variables instead of hard code. example: for each machine, set variable first your local set path_to_my_password="u:/authentication/pw.txt" jenkins set path_to_my_password="c:/my_jenkins/pw.txt" then change code to: private static final string password_file_path = system.getenv("path_to_my_password");

android - Image not getting displayed in imageView (TileView) -

i having issues setting custom decoder in setdecoder() method of tileview android library. nothing getting displayed on screen. having svg image , converting same bitmap using android svg library.kindly help. pfb code on create method in main class @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); tileview tileview = new tileview(this); tileview.setsize(600, 400); tileview.setlayertype(view.layer_type_software, null); tileview.settiledecoder(new bitmapdecoderassetscustom(this)); setcontentview(tileview); } the bitmapdecoderassetscustom decoder class. public class bitmapdecoderassetscustom implements bitmapdecoder { public bitmapdecoderassetscustom(context c){ decode("acid1_embedcss.svg",c); } @override public bitmap decode(string s, context context) { bitmap obj=null; try { svg svg = svg.getfromasset(context.geta...