Posts

Showing posts from May, 2012

Using C# classes/structs in SQL Server -

is there way can declare instances of .net class or struct in sql server stored procedure and/or use them parameters in function? i have .net method takes 2 instances of unitofmeasure class , converts value 1 unit other. my .net class looks following. i've omitted lot of code sake of brevity... public class unitofmeasure { public static unitofmeasure gram {get;} = new unitofmeasure("gram","g",unittype.mass, 0.001, 0); public static unitofmeasure kilogram {get;} = new unitofmeasure("kilogram","kg",unittype.mass,1,0); ... public static ienumerable<unitofmeasure> namedunits {get;} = new list<unitofmeasure>(){gram, kilogram, ...}; public string name {get; private set;} public string symbol {get; private set; } public unittype {get; private set;} public double standardunits {get; private set} public double standardoffset {get; private set} public unitofmeasure(string name, st

c# - Change TabItem child StackPanel to Vertical Orientation -

Image
i need adjust orientation property of stackpanel child tabitem above datatemplate in visual tree. from attached pic, can see wpf form, xaml, , visual tree. i'm not sure how stackpanel , change it's orientation. appreciated. thanks! i found out needed define own template (and not headertemplate).

wpf - Tab Item header styling inheritance -

i'm sure there simple i'm overlooking life of me haven't been able figure out. have started using mahapps mmetro ui has applied style of tabs. on tabs needed ability string formatting headers declared this: <tabitem content="{binding tasklist}"> <tabitem.header> <textblock text="{binding count, stringformat=tasks (\{0\})}" /> </tabitem.header> </tabitem> tab items headers defined not inherit metro ui styling. there way apply styling headers? unfortunately, bindingbase.stringformat used when target property of type string , tabitem.header of type object , binding directly stringformat specified fails give expected result. luckily, can use tabitem.headerstringformat property format header text while maintaining original style: <tabitem header="{binding count}" headerstringformat="tasks ({0})" (...) /> mind though headerstringformat used when value of header

android - Unable to instantiate main activity - ClassNotFound -

i cannot open application. far remember, appeared first time when created new class (now deleted). error occurs if delete below //referencje , part of layout related them. name of class edited, used work after that. 09-12 18:56:25.512: e/androidruntime(616): fatal exception: main 09-12 18:56:25.512: e/androidruntime(616): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.test2/com.example.test2.activity_main}: java.lang.classnotfoundexception: com.example.test2.activity_main 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.performlaunchactivity(activitythread.java:1983) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread.access$600(activitythread.java:130) 09-12 18:56:25.512: e/androidruntime(616): @ android.app.activitythread$h.handlemessage(activitythread.java:1195) 09-12 18:56:25.5

Scala equivalent of Haskell first and second -

haskell has convenient functions called first , second apply function 1 element of pair: first fn (a,b) = (fn a, b) second fn (a,b) = (a, fn b) are such functions defined in standard scala libraries? edit: know it's easy define them, possible it's cleaner use standard functions standard names… def first[a, b, x](fn: => x)(pair: (a, b)): (x, b) = (fn(pair._1), pair._2) def second[a, b, x](fn: b => x)(pair: (a, b)): (a, x) = (pair._1, fn(pair._2)) haskell's arrows ( first , second among them) implemented in scalaz: scalaz source some examples while it's technically not standard library it's stable , seems maintained. update syntax bit cumbersome though (maybe there way?): import scalaz._ import scalaz._ val f = (x: int) => x + 1 val g = f.second[string] g("1", 2) //> ("1", 3) // or type inference f second ("1", 2) //> ("1", 3)

gcc - Include assembly file in another assembly file -

i have 2 files, main.s , test.s test.s looks this: test: add a1,a2,a2 ...and main.s looks this: main: call test (very senseless examples). how can include test in main? using gcc this: gcc -o main main.c but have no idea how can use test in there...any help? you can include file else in gcc: #include"test.s" were using nasm use: %include "test.s"

Rails: Dropdown with links to show pages -

i trying put drop down in navbar users can click on links different stone show pages. code have in getting nomethoderror private method `each' called nil:nilclass. i pretty sure private method error coming because putting code in navbar in application.html.erb rather in stone model. point me in right direction should define methods navbar? or if there else should doing instead? here have attempted far: application.html.erb <div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">dropdown example <span class="caret"></span></button> <ul class="dropdown-menu"> <% @stones.each |stone| %> <li> <%= link_to stone_url %> <%= stone.name %> <% end %> </li> <% end %> </ul> </div> application_controller.rb class applicationcontroller < action

loadrunner - HP Load Runner not running -

i had installed hp load runner (trial version) on windows 8.1 . unable run it. had downloaded prerequisite components, didn't success. didn't created vugen shortcut on desktop also, had tried searching .exe file in bin, didn't it. so, me in scenario, newbie load runner. what version of windows? home? pro? ultimate? makes difference. @ requirements use, including credential levels.

wireshark - Capture a websites objects in separate pcap files -

a website consists of multiple objects (e.g. text file, few png files etc.), know if there's tool can capture individual requests/responses in different pcap files? so example if browse http://somewebsite.com , , http://somewebsite.com consists of {index.html, image1.png, somestylefile.css, image2.png}, tool capture entire load of http://somewebsite.com generate {index.html.pcap, image1.png.pcap, somestylefile.css.pcap, image2.png.pcap} i don't know of tool can this, or possible using scapy or similar? a http connection can have multiple requests inside same tcp connection , browsers make heavy use of http keep alive. http pipelining requests/responses don't need separated in time, i.e. client can send request though response previous 1 not there. , http/2 data can interleaved, i.e. several responses transferred @ same time inside same connection. insofar not possible capture data separate pcap file because might not separable @ packet level. if don

Getting values from a multidimensional array in php -

this question has answer here: how extract data json php? 2 answers i've multidimesional array in php code ... $waypoints = $_post['waypoints']; print_r ($waypoints); that returns [["1dcb4f6575fbf5ee4ebd542d5981a588",7.67468,44.91085],["7503c3e97935960d0f7abcb6f7ad70f4",7.67614,44.90977]] i need values @ index = 1 , index = 2 in array: if try value 7.67468 using print_r ($waypoints[0][1]); i obtain notice: uninitialized string offset: 1 as error using print_r ($waypoints[0]); i obtain [ as error suggestions? as $_post['waypoints'] json_encod ed string, try part of code: // decode json-string array $waypoints = json_decode($_post['waypoints'], true); // if want check have: print_r($waypoints) // echo required item: echo $waypoints[0][1]; more json can find here, in docume

java - Selenium error 'Permission denied to access property' -

is there way resolve 'permission denied access property' error? i have following code: system.setproperty("webdriver.gecko.driver","/home/ xxx /documents/selenium/geckodriver"); webdriver driver = new firefoxdriver(); driver.get("https:/unsplash.com/"); system.out.println(driver.getpagesource()); and last line, 'getpagesource()' causing error: exception in thread "main" org.openqa.selenium.webdriverexception: permission denied access property "__raven_wrapper__" (warning: server did not provide stacktrace information) i've seen in question ( permission denied access property "document" ) overcome error use chrome driver instead. is problem firefoxdriver or there way around? thanks,

c++ - Is it safe to delete a NULL pointer? -

is safe delete null pointer? and coding style? delete performs check anyway, checking on side adds overhead , looks uglier. very practice setting pointer null after delete (helps avoiding double deletion , other similar memory corruption problems). i'd love if delete default setting parameter null in #define my_delete(x) {delete x; x = null;} (i know r , l values, wouldn't nice?)

postgresql - Django psql full text search not matching un-stemmed word -

i'm running django 1.10.1 against postgres 9.4. staging server , dev environments have psql servers @ version 9.4.9 , production rds instance @ 9.4.7. it seems searchvectorfield not storing search configuration given in production, though in staging , dev, , seems either version thing (unlikely, given version difference , worked on 9.3 in staging/dev) or fact production on rds instead of local on server. i'm using custom configuration full-text search called unaccent , looks this: token | dictionaries -----------------+----------------------- asciihword | english_stem asciiword | english_stem email | simple file | simple float | simple host | simple hword | unaccent,english_stem hword_asciipart | english_stem hword_numpart | simple hword_part | unaccent,english_stem int | simple numhword | simple numword | simple sfloat | simple

javascript - onclick innerhtml does not work - not common issue -

what potentially wrong following simple code: <span onclick="this.innerhtml='123456'; return false;">xxxxxx <strong>show it!</strong></span> the problem exists few users, not have physical access machines debug it. when click on nothing happens. cannot replicate it, works fine everywhere have physical access (even tried browserstack) , i'm running out of ideas. yes, have js , running. different users, different browsers. asked them try on jsfiddle - same issue. buggy version of web browser? other software/addon blocks it? any ideas? had or have same issue? thx in advance.

I'm unable to interpret this error in stata -

after open dataset in stata, code runs automatically in backend. use "c:\users\vxk152430\desktop\stata_vxk152430\hw2\capm4.dta", clear but when try describe typing: des capm4 i following error. variable capm4 not found r(111); please help. thanks. des (and not des, stata case-sensitive) needs optional list of variable names, can omitted if want describe all of variables. since name of dataset not 1 of variables, stata complains. here's reproducible example demonstrating issue: sysuse auto, clear des price des des auto you can diagnose went wrong clicking on numeric error code, give more info short error message stata printed. can learn or command looking @ helpfile this: help des

java - Find the smallest non-negative integer not contained in a binary tree -

the method return smallest non-negative integer number not contains in binary tree. example: with 0 1 2 3 return 4. with 1 2 3 4 return 0. with 0 1 2 5 6 return 3. with 6 1 5 2 return 3. complexity of solution o(n^2). how can resolve in time no more o(n)? public static <e> int minintnotcontains(bintree<nodo<integer>> node) { list<integer> a=new arraylist<integer>(); int min=minintnotcontainsric(node,a); return min; } public static <e> int minintnotcontainsric(bintree<nodo<integer>> node,list<integer> a) { int min= node.getvalue().getvalue(); a.add(node.getvalue().getvalue()); if(node.getleftsubtree() != null) { min = math.min(min, minintnotcontainsric(node.getleftsubtree(),a)); } if(node.getrightsubtree() != null) { min = math.min(min, minintnotcontainsric(node.getrightsubtree(),a)); } if (min>0) return 0; else{ (int i=0;i<a.size();i++){

Python argparse, positional arguments and subparsers -

this question has answer here: argparse: identify subparser used [duplicate] 2 answers i have following snippet using argparse multiple subparsers parser = argparse.argumentparser(description = "setup db", add_help=false) parser.add_argument('action', type = str, choices=['drop','populate','print','create','print-metadata'], = "specify action", default = none) subparsers = parser.add_subparsers() drop_parser = subparsers.add_parser('drop',parents=[parser]) drop_parser.add_argument('-dataset-name', required=true, type = str, = "dataset name", default = none) ..... args = parser.parse_args() ..... when go run following: python .\populatedb.py drop -dataset-name foo populatedb.py: error: invalid choice: 'foo' (choose

AngularJS different size and value select boxes in ng-repeat -

i know issue is, far attempts solve problem not successful. appreciated. i creating table json data in ng-repeat loop. 1 of table columns represents select boxes, of different values , sizes. select statement inside ng-repeat block. <tr ng-repeat="unit in unitsdata"> <td>{{unit.unitname}}</td> <td>{{unit.unittype}}</td> <td> <select class="form-control" ng-model="unit.unit" ng-options="option.value option.name option in getunitlistforunittype(unit.unittype)"></select> </td> </tr> i getting error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! based on angular documentation select boxes, problem comes getunitlistforunittype function, created in controller return different lists based on provided parameter. not sure how code co

Java servlet cuts off file extension -

i'm attempting serve local or proxy files via java application. with this @responsebody @requestmapping(value = "/file/{file}", method = requestmethod.get) public void doget(httpservletrequest request, httpservletresponse response,@pathvariable("file") string f) throws ioexception { string filename = urldecoder.decode(f, "utf-8"); file file = new file("resources/files/", filename); response.setheader("content-type", "video/mp4"); response.setheader("content-length", string.valueof(file.length())); response.setheader("content-disposition", "inline; filename=\"" + file.getname() + "\""); files.copy(file.topath(), response.getoutputstream()); } with example url such example.com/file/out2kp2_1.mp4 i'm getting error: problem accessing /file/out2kp2_1.mp4. reason: resources\files\out2kp2_1 caused by: java.nio.fi

python - Accessing the choices passed to argument in argparser? -

is possible access tuple of choices passed argument? if so, how go it for example if have parser = argparse.argumentparser(description='choose location') parser.add_argument( "--location", choices=('here', 'there', 'anywhere') ) args = parser.parse_args() can access tuple ('here', 'there', 'anywhere') ? it turns out parser.add_argument returns associated action . can pick choices off of that: >>> import argparse >>> parser = argparse.argumentparser(description='choose location') >>> action = parser.add_argument( ... "--location", ... choices=('here', 'there', 'anywhere') ... ) >>> action.choices ('here', 'there', 'anywhere') note (afaik) isn't documented anywhere , may considered "implementation detail" , therefore subject change without notice, etc. etc. there is

swift - UIScrollView Zooming & contentInset -

Image
simliar ios photos app user zooming in , out of image pinching: uiview > uiscrollview > uiimageview > uiimage initially, had issue of zooming below scale 1: image being off centered. got fixed doing this: func scrollviewdidzoom(scrollview: uiscrollview) { let offsetx = max((scrollview.bounds.width - scrollview.contentsize.width) * 0.5, 0) let offsety = max((scrollview.bounds.height - scrollview.contentsize.height) * 0.5, 0) scrollview.contentinset = uiedgeinsetsmake(offsety, offsetx, 0, 0) } this works when zooming out. uiimage content mode aspectfit issue when zoom in , when zoomscale above 1, scroll view insets need hug surroundings of uiimage scroll view contains. takes away dead-space surrounding uiimage. ie, photos app when zooming-in pinching or double tapping. tried func scrollviewdidzoom(scrollview: uiscrollview) { if scrollview.zoomscale > 1 { let imagescale = (self.imageview.bounds.width/self.imagevie

java - Hash map with multiple keys? -

this question has answer here: how create hashmap 2 keys (key-pair, value)? 11 answers can have hash map in java looks this? hashmap<string, string, integer> hmap = new hashmap<string, string, integer>() my question similar 1 here question i'm newbie java. want know is, best data structure use if need above, if not valid? create simple class holding 2 string objects: public class mykey { private string a; private string b; // ... accessors, mutators etc. } and use it's objects keys in map: hashmap<mykey, integer> hmap = new hashmap<>() later, add new entry: hmap.put(new mykey("a", "b"), 2);

git branch - Git shortcut for checkout, pull, checkout, merge/rebase -

let's i've got 2 branches, master , codydev. before begin making changes on codydev, following in order make sure i'm starting latest master commit on codydev: git checkout master git pull git checkout codydev if changes, git merge master is there shortcut first 3 steps, don't have leave codydev branch? tend find out master has not been updated , checkout/pull/checkout 3 unnecessary commands. note did google try find answer question, there seems wide range of potential , complicated solutions. 1 seemed appealing affect of git fetch origin master:master , explanations read not super clear because examples bit more complicated. found myself wondering "why fetch instead of pull" (i.e. git pull origin master:master )? you can update codydev branch latest changes master without changing branches: git checkout codydev # ignore if on codydev git fetch origin # updates tracking branches, including origin/master git merge origin/

web services - How to run a Powershell DSC script locally -

i'm trying run simple powershell dsc script locally. (i never plan on pulling or pushing configuration files @ stage) i following error message. ws-management service running, there no firewall holes or ports reserved (server happens webserver)... there anyway can allow server accept local requests? the client cannot connect destination specified in request. verify service on destination running , accepting requests. consult logs , documentation ws-management service running on destination, commonly iis or winrm. if destination winrm service, run following command on destination analyze , configure winrm service: "winrm quickconfig". + categoryinfo : connectionerror: (root/microsoft/...gurationmanager:string) [], cimexception + fullyqualifiederrorid : hresult 0x80338012 + pscomputername : localhost configuration sampleiisinstall { node 127.0.0.1 { file filedemo { type =

swift - Set object properties using a UISwitch in a custom cell -

i'm trying should simple, i'm having issues due inexperience swift. i have viewcontroller has tableview inside of custom cells populated array of objects (called alllistitems ). these objects created using realm model object , i'm using instead of core data, think might pertinent. each custom cell has uiswitch in it, , ideally i'd set when user toggles uiswitch , modifies boolean isselected property indexpath.row , , appends object separate array, called selectedlistitems . all of searching through so, tuts+, , appcoda has revealed should using protocol - delegate pattern here, protocol in custom cell class , delegate in viewcontroller class. after flailing away @ of day haven't had luck, however, think might due arrays being realm model objects. as mentioned, i'm new swift , programming in general, eli5 responses appreciated! in advance! for reference, here custom cell: import uikit class alllistitemstableviewcell: uitableviewcell { @i

memory - why my application doesnt finish spark -

i run spark application (input 90mo), according jobs ui jobs has completed notice application doesn't finish , last messages ( why don't sc has stopped ) 16/09/13 02:17:31 info dagscheduler: job 15 finished: saveastextfile @ slowlychangingdimension.java:244, took 1,222274 s 16/09/13 02:17:38 info blockmanagerinfo: removed broadcast_49_piece0 on 10.0.10.45:46789 in memory (size: 26.2 kb, free: 1424.7 mb) 16/09/13 02:17:38 info blockmanagerinfo: removed broadcast_49_piece0 on 10.0.10.51:54860 in memory (size: 26.2 kb, free: 1424.7 mb) 16/09/13 02:17:38 info blockmanagerinfo: removed broadcast_48_piece0 on 10.0.10.45:46789 in memory (size: 4.4 kb, free: 1424.7 mb) 16/09/13 02:17:38 info blockmanagerinfo: removed broadcast_48_piece0 on 10.0.10.53:56003 in memory (size: 4.4 kb, free: 1458.5 mb) 16/09/13 02:17:38 info blockmanagerinfo: removed broadcast_48_piece0 on 10.0.10.47:51300 in memory (size: 4.4 kb, free: 1458.5 mb) 16/09/13 02:17:38 info blockmanagerinfo

angularjs - Can't get url of image uploaded to firebase storage -

i new ionic, program takes picture , sent firebase. question is: how can show url of image in view? have controller: i appreciate if can help, greetings .controller("formctrl", function($scope,sharedutils,$ionicpopup,$state, $rootscope, $cordovacamera) { $scope.capturarfoto = function(sourcetype) { var options = { quality : 75, destinationtype : camera.destinationtype.file_uri, sourcetype : sourcetype, encodingtype: camera.encodingtype.jpeg, popoveroptions: camerapopoveroptions, targetwidth: 500, targetheight: 500, savetophotoalbum: false }; $cordovacamera.getpicture(options).then(function(imagedata) { // $scope.images = imagedata; var storageref = firebase.storage().ref(); // filename = imagedata.name; var getfileblob = function(url, cb) { var xhr = new xmlhttprequest(); xhr.open("get", url); xhr.responsetype = "blob";

C++ readline and write to file (line sanitation) -

Image
i seem running odd issues portion of code involves reading line existing file , writing portion file: here example of seeing (i want vowels). here 3 functions involved this. got little .c_str() happy while trying figure out cause: void do_file_magic(string file){ fstream source; string outfile, line, vowels, temp; // name outfile outfile = "vowels_" + file; source.open(file); if (!source.is_open()) { die_a_clean_death("unable open source file:", file); }; ofstream destination(outfile); if (!destination.is_open()) { source.close(); die_a_clean_death("unable open destination file:", file); }; // read source file , output vowels destination file. { (int = 1; !source.eof(); i++ ){ getline(source, line); temp = vowels_on_a_line(line) + "\n"; destination << temp.c_str();

r - Coloring sets in plotly polar chart adds extra points? -

i'm using plotly make scatter radar plot , i'm having issues when setting colors in each set. whenever set "color" parameter plot shows points not in original data.frame. small example: df r t my_sets 1 0.8090 108.00000000000000000 set1 2 0.3090 -0.00000000000001029 set3 3 0.8090 35.99999999999999289 set1 4 0.5871 103.61382244080326132 set2 5 0.6489 154.43699940042691310 set2 6 0.3629 175.61382244080323289 set3 if this: p <- plot_ly(data=df, r=r, t=t, mode = "markers") layout(p, title = "simple_test", plot_bgcolor = torgb("grey90")) all 6 points plotted. however when this: p <- plot_ly(data=df, r=r, t=t, color = my_sets, mode = "markers") layout(p, title = "simple_test", plot_bgcolor = torgb("grey90")) i 2 points r>1 not in original df. any idea problem is? if run hobbs example in plotly website dont seem have problem...

Why can anyone PUT/POST/GET to any user without authentication in sails.js blueprint rest api? -

i have been working sails.js couple days now, , started out creating user model , rest api. implemented passport app authentication users. messing around requests , noticed wanted other users data, if logged on different user, without providing password (just id). seems able hack in , delete users data without permission. purposely left out of blueprint api, , missing big topic flew on head? need add other feature changes permissions? comment if need post code help. blueprints , routes not secured default, why should they? can secure them using policies http://sailsjs.org/documentation/concepts/policies e.g. { profilecontroller: { // apply 'isloggedin' default actions not specified below '*': 'isloggedin', // if action explicitly listed, policy list override default list. // so, have list 'isloggedin' again 'edit' action if want applied. edit: ['isadmin', 'isloggedin'] } }

Unable to fetch data from MySQL database using PHP in Android Studio -

i doing login , register subsystem of mobile application, did following youtube tutorial video, register feature working data stored in database. but when try login username created, shows message "username , password not exist!", doesn't return error message.i checked coding several times, googled answer couldn't find any, in advance! =) **now i'm sure activity don't have problem, php scripting file localdb public class localdb { public static final string sp_name = "userinfo"; sharedpreferences localdb; //constructor public localdb(context context) { localdb = context.getsharedpreferences(sp_name,0); } //store user data public void storedata(contact contact) { sharedpreferences.editor editor = localdb.edit(); editor.putstring("username",contact.username); editor.putstring("email",contact.email); editor.putstring("student_id",contact.student_id); editor.putstring("password"

mysql - How to calculate from 2 tables in SQL -

how create query join table , b condition a.salary * b.rate table --------------------- customerid salary a1 100 a2 200 a3 300 table b --------------------- customerid rate a1 2 a2 3 a3 4 my expect result. --------------------- customerid salary a1 200 a2 600 a3 1200 select t1.customerid, coalesce(t1.salary * t2.rate, 'na') salary tablea t1 left join tableb t2 on t1.customerid = t2.customerid i used coalesce when computing effective salaries in case either salary amount or rate null customer. demo here: sqlfiddle

android - E/RecyclerView: No adapter attached; skipping layout with fragments -

this first application in android studio , can´t resolve error, need help, thanks. e/recyclerview: no adapter attached; skipping layout e/recyclerview: no adapter attached; skipping layout mainactivity public class mainactivity extends appcompatactivity { private viewpager mpager; private slidingtablayout mtabs; private toolbar toolbar; private recyclerview recyclerview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //toolbar toolbar= (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); //sliding tab mpager = (viewpager) findviewbyid(r.id.pager); mtabs= (slidingtablayout) findviewbyid(r.id.tabs); mpager.setadapter(new myadapter(getsupportfragmentmanager(),this)); mtabs.setdistributeevenly(true); mtabs.setcustomtabview(r.layout.tab_view, r.id.tabteks); mtabs.setbackgroundcolor(getresources().getcolor(r.color.colorpri

c++ - Is there a way to invoke the new operator from CEF? -

i'd create customevent object within v8 context. tried using .create() browser doesn't let me create way. can call new operator within cef? this tried invoke with: (c++ code) cefrefptr<cefv8value> globalobj = context->getglobal(); cefrefptr<cefv8value> customevent = globalobj->getvalue("customevent"); cefrefptr<cefv8value> prototype = customevent->getvalue("prototype"); cefv8valuelist prototypeargs; prototypeargs.push_back(prototype); prototypeargs.push_back(); cefrefptr<cefv8value> object = globalobj->getvalue("object"); cefrefptr<cefv8value> create = object->getvalue("create"); cefrefptr<cefv8value> event = create->executefunction(null, prototypeargs); i want have easy way c++ call (javascript code) new customevent("test"); use cefv8context::eval execute javascript code need. cefrefptr<cefv8value> returnvalue; cefrefptr<cefv8exception&

ios - How to retrieve JSON data from webpage -

Image
my webpage displays constructive data in single line, let app retrieve it. json [{"long":"1234..45","lat":"345.12"}] this information in page, click here see: http://www.gogrex.com/sandbox/startloc.json how retrieve app json? have looked thru many examples still cannot solve it. swift 3.x class viewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // create url let geturl = url(string: "http://www.gogrex.com/sandbox/startloc.json")! // use urlsession data website urlsession.shared.datatask(with: geturl) { (data, response, error) in guard let data = data, error == nil else { print(error?.localizeddescription ?? "nil") return } // need serialize data using jsonserialization jsonobject(with:options) { if let jsonarray = try jsonserializa

javascript - Jquery Datatable Save state in DB not in client side -

i need save state of datatable in db.i want have save state button when pressed should in on click event of save state button ? functions have override send ajax request server containing state of datatable? want load saved state db. use statesavecallback callback "statesavecallback": function (settings, data) { // send ajax request server state object $.ajax( { "url": "/state_save", "data": data, "datatype": "json", "type": "post", "success": function () {} } ); for more info: https://datatables.net/reference/option/statesavecallback for loading use stateloadcallback callback "stateloadcallback": function (settings) { var o; $.ajax( { "url": "/state_load", "async": false, "datatype": "json", "success": function (json) { o =

OpenGTS Enterprise - Piccolo Device Configuration -

i have set opengts environment , can able access front page of opengts. now how can receive data piccolo device ? how configure open gts ? you'll have configure device send data ip address of server port number (find free port number on system). once this, you'll either have write dcs device, or 1 geotelematic. if have set up, on dcs configuration file, you'll have set port number set on device , start dcs. make sure add port firewalls on system packets device aren't blocked. should able see packets coming in, @ least on logs. if there isn't make sure dcs running using bin/psjava command.

Identify post or page in wordpress and when to use both -

i new wordress.. need create wordpress site.. little confused when use post , when use page? how identify whether site should pages or posts?? this post usefull make company website in wordpress there key differences between posts , pages in wordpress site. about posts posts entries listed in reverse chronological order on site homepage or on posts page if have set 1 in reading settings. if have created sticky posts, appear before other posts. posts can found in archives, categories, recent posts, , other widgets. posts displayed in rss feed of site. can control how many posts displayed @ time in reading settings. if want posts appear on page other home page, see front page. about pages pages static , not listed date. pages not use tags or categories. page classic example. pages can displayed in sidebar using pages widget, , themes display pages in navigation @ top of site. how many can have? there no limit on number of posts or pages can have. how post p

algorithm - Optimizing a function to place circle in position which does not overlap other circles -

i have algorithm places circles in xy-plane. record programming in php @ moment, question in regards larger algorithm. so here basic algorithmic code: function create_circles($n) { ($i = 0; $i < $n; $i++) { $x = rand_x(); $y = rand_y(); $coord = array($x, $y); $radius = rand_radius(); if ($i !== 0) { ($m = 0; $m < $i; $m++) { $distance = distance($coord, $position[$m]); if ($radius + $radii[$m] > $distance) { //repeat function again } else { continue; } } } //if function completes correctly $radii[$i] = $radius; $position[$i] = $coord; } } this simplified code , did not include variable declarations or auxiliary functions. hope enough info. as stands, function works, takes hours place 100 circles. looking way streamline function , cut down on execution time. edit ok, address comment , answer. first thank much. second provide little more information. the