Posts

Showing posts from June, 2013

php - rewrite wordpress paramlink in web.config not working for secondary domain over IIS 8 -

wordpress sites hosted on iis 8 , 1 main domain , 1 domain lets : maindomain.com , anotherdomain.com physical path : acb/maindomain ( main domain ) , physical path : acb/maindomain/anotherdomain.com ( domain ) maindoman.com working paramlink structure. bellow maindoman.com/web.config file code <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <!-- maindomain --> <rule name="maindomain" patternsyntax="wildcard"> <match url="*"/> <conditions> <add input="{request_filename}" matchtype="isfile" negate="true"/> <add input="{request_filename}" matchtype="isdirectory" negate="true"/> </conditions> <action type="rewrite...

batch script to transfer the file to the server after login into the another server -

i have 1 request need connect windows machine , transfer file windows machine. let machine a, map machine b (199.199.199.99), machine b user login only, can access machine c , transfer file, how can using windows batch script. file transfer a-> b ->c, please note c can accessed b. map machine ----------- net use s: "\\199.199.199.99\data" %password% /user:london_domain\%userid% :copy xcopy /f "a:\\file.csv "s:\file.csv"

Push onto array argument in javascript -

i have following function: function where(arr, num) { return arr.push(num); } where([40, 60], 50); // returns 3 i expecting return [40,60,50] returns 3. thanks help. the documentation states array.prototype.push() returns length of array. need push new number , return array. function where(arr, num) { arr.push(num); return arr; } myarray = where([40, 60], 50); // myarray === [40, 60, 50]

What does ":this(100)" mean in a C# method declaration? -

this question has answer here: what colon (:) mean? 7 answers what ":this(100)" mean in c# method declaration? while reading mdsn docs came across in line 6 of following code: public class stack { readonly int m_size; int m_stackpointer = 0; object[] m_items; public stack():this(100) {} public stack(int size) { m_size = size; m_items = new object[m_size]; } } public stack() is default constructor public stack(int size) is parametric constructor public stack():this(100) means default constructor call parametric constructor parameter size 100. refer this construtor more information this used in constructors. used overload constructors in c# program. allows code shared between constructors. constructor initializers, use this-keyword, pr...

osx - Installing Kubernetes on mac with vagrant and virtualbox -

this first attempt install , use kubernetes. trying install environment on mac developing own apps , deploying them test locally kubernetes. familiar using vagrant, virtualbox , docker same purpose. when saw page https://github.com/googlecloudplatform/kubernetes/blob/master/docs/getting-started-guides/vagrant.md assumed trivial. executed these lines: export kubernetes_provider=vagrant curl -ss https://get.k8s.io | bash this created master vm , minion, kubernetes seems have failed start on master. on master /var/log/salt/master full of python traceback errors, this: 2015-07-17 22:14:42,629 [cherrypy.error ][info ][3252] [17/jul/2015:22:14:42] engine started monitor thread '_timeoutmonitor'. 2015-07-17 22:14:42,736 [cherrypy.error ][error ][3252] [17/jul/2015:22:14:42] engine error in http server: shutting down traceback (most recent call last): file "/usr/lib/python2.7/site-packages/cherrypy/process/servers.py", line 187, in _start_http_thread sel...

Get X and Y Coordinate From Annotation iOS -

this should simple enough, i'm getting use mapkit framework. need here coordinates of selected annotation (to save them). im not concerned core data side of things. retrieve coordinates selected annotation. unfortunately, there doesn't seem resources on stack overflow topic. i have code set annotation title of selected annotation, of leg work should done here. there has similar can find coordinate of same annotation. [datasource sharedinstance].pointfrommapview = [self.mapview.selectedannotations objectatindex:([self.mapview.selectedannotations count]) -1]; [datasource sharedinstance].annotationtitlefrommapview = [datasource sharedinstance].pointfrommapview.title; the code above retrieve annotation title. there has way can use code retrieve coordinate well. ideas? use [datasource sharedinstance].pointfrommapview.coordinate coordinate annotation.

php - fwrite duplicate file when saving to server -

i'm trying save data file using fwrite, problem is creating second file same file name, , data saved second file , not original. it works under windows localhost, apache 2.4.10, php 5.6 (no second file), not on live server running linux , php 5.4.42. edit.php $(document).ready(function() { var pagename = "<?php echo $pagename; ?> "; $('#save').click(function(e) { e.preventdefault(); var content = $('#content').html(); $.ajax({ type: 'post', url: 'includes/readinput.php', data: { content: content, pagename: pagename, } }).done( function(data){ } ); }); }); readinput.php. // receive post variable s "admin/ edit.php" $content = $_post['content...

jquery - selecting and showing a li element of ticker bxslider on the page -

i'm trying write code selecting , showing li element of ticker bxslider on page. when use ticker bxslider, images going , coming 1 side of screen other side. want random image of slider click show on screen. here ticker bxslider code is <div class="row sliderticker"> <ul id="bxsliderid" class="bxslider"> <li class="class1"></li> <li class="class2"></li> <li class="class3"></li> <li class="class4"></li> <li class="class5"></li> <li class="class6"></li> <li class="class7"></li> <li class="class8"></li> </ul> </div> <div class="row changeable"> <li class="changeableitem"></li> </div> i put images every class background-...

jquery mobile getting the html head duplicated and pop up not working -

i getting html "head" part duplicated in script , pop not open when clicked.it changes color when click nothing shows up.i know wrong code. @ address bar "#&ui-state=dialog". here address of website https://barexpress.club/mobile_detect_device/contact_us <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>website contact us</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script> </head> <body> <div data-role="page" id="index"...

Inno Setup: Shutdown service for custom page -

i'm building installer using inno setup need convert existing files if application installed. to need stop applications service works automatically install process. there way hook page between application shutdown , start routine? or postpone application restart later time? edit: tried checkformutexes('myappmutex') manually prompt user close application, function returns false. edit2: current workarround uses isprocessrunning script jakoch prompt user manually close application. prefer more automatic solution though.

javascript - Given an element and a list, how to functionally select the element after in the list? -

i'd understand how solve problem functionally (map/reduce/etc) say have list of objects (i'm working in javascript @ moment): l = [ {id: 43}, {id: 64}, {id: 12} ] and want function f gives next element in list. f(l, {id:64}) => {id:12}) and f(l, {id:12}) => {id:43} i understand how solve imperatively, having hard time seeing how map/reduce. thank you! not accounting things element being last item in collection, or not being in collection: function findnext(collection, element) { var current = collection.indexof(element); return collection[current + 1]; } i don't see how reduce or map make better. unless want pass in id, , not object collection. it's: function findnext(collection, id) { var current = collection.map(function (e) { return e.id }).indexof(id); return collection[current + 1]; } first version, working in jsfiddle: https://jsfiddle.net/cfxovfge/

PHP - Conditioned sum of some values of an array -

i have array in php of type, resulting particular query on db. $output = array ( [0] => array ( 'price' => 100 'date' => '2015-07-28' 'total' => 200 'qty' => 2 ) [1] => array ( 'price' => 80 'date' => '2015-07-28' 'total' => 240 'qty' => 3 ) [2] => array ( 'price' => 100 'date' => '2015-07-29' 'total' => 300 'qty' => 3 ) [3] => array ( 'price' => 90 'date' => '2015-07-28' 'total' => 90 'qty' => 1 ) ) i'm trying sum total , qty based on price key values, obtaining array this: $grouped = array ( [0] => array ( [price] => 100 [sumtotal] => 500 [sumqty] => 5 ...

java - Itterating through a list and drawing a colored square -

Image
where begin........... i have colored box, want change color every 1/2 second, want code run well. i'm using java awt's graphic api draw using g.fillrect(568, 383, 48, 48); g wrapped 'graphics.' so you'd think simple right? color[] colors colors = new color[4]; colors[0] = new color(color.red); colors[1] = new color(color.blue); colors[2] = new color(color.green); colors[3] = new color(color.yellow); for(int = 0; < colors.length; i++){ g.setcolor(colors[i]); g.fillrect(568, 383, 48, 48); } this cool problem none of program runs when loop running... i think can make game 'multi-threaded' means can more 1 thing @ time have no idea how , sounds hard, appreciated! thanks reading! most ui frameworks aren't thread safe, need beware of that. example, in swing, use swing timer act pseudo loop. because timer notifies actionlistener within context of event dispatching thread, makes safe update ui or state of ui within,...

php - Invalid argument supplied for foreach() - Bing Search API -

this php code: <?php $acctkey = 'key'; $rooturi = 'https://api.datamarket.azure.com/bing/search'; $contents = file_get_contents('bing_basic.html'); if ($_post['query']) { $query = urlencode("'{$_post['query']}'"); $serviceop = $_post['service_op']; $requesturi = "$rooturi/$serviceop?\$format=json&query=$query"; $auth = base64_encode("$acctkey:$acctkey"); $data = array('http' => array('request_fulluri' => true,'ignore_errors' => true,'header' => "authorization: basic $auth")); $context = stream_context_create($data); $response = file_get_contents($requesturi, 0, $context); $jsonobj = json_decode($response); $resultstr = ''; foreach($jsonobj->d->results $value) { switch ($value->__metadata->type) { case 'webresult': $resultstr .= "<a href=\"{$value->url}\...

javascript - Sencha Touch 2: How to get (multiple) instances of a base class -

i got following classes on sencha web app: baseclass and aclass extends baseclass xtype aclass and bclass extends baseclass xtype bclass usually use ext.viewport.down('aclass') instance of class. question if there's way instances of baseclass? thanks help! ext.define('baseclass', { extend: 'ext.component', xtype: 'baseclass' }); ext.define('aclass', { extend: 'baseclass', xtype: 'aclass' }); ext.define('bclass', { extend: 'baseclass', xtype: 'bclass' }); var instances = ext.componentquery.query('baseclass') will return array instances of aclass , bclass

javascript - Set width to widest element while still having floats -

so have sidebar container buttons, on first line there element floats left , element floats right. below them buttons various lengths, 1 button per line. in container. how can make buttons , container length of widest button? floating element right makes container wide sidebar, should max width, not default one. can accept answer in javascript css. here i've done far: https://jsfiddle.net/ke2b7wq1/ css: #sidebar{ width: 250px; height: 100%; border: 1px solid #000; } #left-float{ padding: 0 5px; background: #f00; float: left; } #right-float{ padding: 0 5px; background: #f00; float: right; } .button{ text-align: center; background: #bbb; clear: both; float: left; margin-top: 7px; width: 100%; } .pusher{ clear: both; height: 0; } html: <div id="sidebar"> <div id="container"> <div id="left-float">hello</div> <div id="right-float">0</div> <div class="button">lorem ipsum...

scala - Spark: what options can be passed with DataFrame.saveAsTable or DataFrameWriter.options? -

neither developer nor api documentation includes reference options can passed in dataframe.saveastable or dataframewriter.options , affect saving of hive table. my hope in answers question can aggregate information helpful spark developers want more control on how spark saves tables and, perhaps, provide foundation improving spark's documentation. i believe you're looking for: https://github.com/databricks/spark-csv

c++ - error in mex: undefined reference to ".." -

i want compile following code mexw64 using ms visual c++ compiler. balltree.cpp #define mex #include "balltree.h" #include "mex.h" void mexfunction(int nlhs, mxarray *plhs[], int nrhs, const mxarray *prhs[]) { // check right number of arguments if(nrhs != 2) mexerrmsgtxt("takes 2 input arguments"); if(nlhs != 1) mexerrmsgtxt("outputs 1 result (a structure)"); // points, weights plhs[0] = balltree::createinmatlab(prhs[0],prhs[1]); } and balltree.h #ifndef __ball_tree_h #define __ball_tree_h #ifdef mex #include "mex.h" #endif #include <math.h> #include <stdint.h> #define false 0 #define true 1 double log(double); double exp(double); double sqrt(double); double pow(double , double); double fabs(double); #define pi 3.141592653589 class balltree { public: //typedef unsigned int index; // define "index" type (long) typedef uint32_t i...

ios - How to center multiple images in scrollview in Xcode/Swift -

Image
i trying horizontally center 30 images in scrollview. best approach so? thanks. edit: programmatically able create images, david cao, still having issue of not centering. thanks. if they're same image, why not programmatically? make loop , iterate through bounds. nsinteger numwidth = 3; nsinteger numheight = 10; cgfloat border = 8; cgfloat width = (self.scrollview.frame.size.width - (numwidth + 1) * border)/3; (nsinteger = 0; < numwidth; ++i) { (nsinteger j = 0; j < numheight; ++j) { uiimageview *imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"imagenamehere"]]; imageview.frame = cgrectmake(border + width*i, border + width*j, width, width); [self.scrollview addsubview:imageview]; } } [self.scrollview setcontentsize:cgsizemake(self.scrollview.frame.size.width, (border + width)*numheight + border];

dom - Javascript window.opener in iframe -

i trying access opener of popup using window.opener reference in popup's script file. consider following script included in popup.html: http ://localhost/test/popup.html <script> alert(window.opener.test_dom); </script> this works when no iframe involved, see alert message popup.html: http ://localhost/test/base.html <html> ... <script> var test_dom = 'test_dom'; var popup = window.open("http://localhost/test/popup.html",... </script> </html> the problem exists when there 3 files.. container page iframe in launches popup within iframe. not show alert message when popup appears: c:\testcontainer\container.html <html> ... <iframe src="http://localhost/test/base.html"> <script> var test_dom = 'test_dom'; var popup = window.open("http://localhost/test/popup.html",... </script> <iframe...

json - Scala + Reactivemongo: Controling custom readers/writers for REST-API -

i working on rest-api implemented in scalatra , using reactivemongo. persistent model implemented using case classes , thin repository layer uses common approach bson<->class mapping via documentreader/documentwriter (via implicit converters in case class companion object). case class address(street: string, number: string, city: string, zip: string) object address{ implicit val addresshandler = macros.handler[address] implicit val addressfmt = json.format[address] } the first formatter maps bson case classes second converts json (the output format of rest-api). this fine , quite happy how nicely integrates. in many cases though, don't need operate on domain objects (case class instances) , want stream data coming data base write http response. intermediate conversions overhead in scenarios. want control fields exposed (i once used yoga , jackson in java project). possible solutions to: have generic repository converts map structure intermediate format. con...

bash - re-organize object fields with jq -

i wondering if there way re-organize fields of object using jq. i mean, given that { "prop1": 1, "prop2": { "nested": 0 }, "prop3": true } i'd this { "prop1": 1, "prop3": true, "prop2": { "nested": 0 } } i want choose order of fields (without consideration type of field or alphabetical order, choice :) ) thanks ! the safe option have generate json string manually properties ordered in way want them. there no guarantee order set properties on object preserved. you can of function: def inorder(names): names $names | . $obj | "{\($names | map("\(@json):\($obj[.])") | join(","))}" ; then use it: inorder(["prop1", "prop3", "prop2"]) keep in mind return string. you'll want raw output object.

PHP script to create file if no exist -

i have small problem php code. please take look: <?php $urlud = $json['url']; $content = 'content 1 if file no exist generate'; $filename = $json['id'].".html"; if (file_exists($filename)) { echo "file exists!"; } else { file_put_contents('dir1/'. $filename, $content, file_append | lock_ex); } ?> <?php $urlud = $json['url']; $content = 'content 2 if file no exist generate'; $filename = $json['id'].".html"; if (file_exists($filename)) { echo "file exists!"; } else { file_put_contents('dir2/'. $filename, $content, file_append | lock_ex); } ?> this code generate 2 files in different directories different content. problem is: this code keeps replacing old file content. solution make create if file doesn't exist ? any other input make code simpler? thanks. if (file_exists('dir1/'. $filename)) an...

sql server - Transpose the columns to rows -

Image
i have result set table such following picture: returned following query: select [id],[siteid],[variableid],[qualifierid],[value],[valuedate],[insertdate],[insertuserid] ,[deletedate],[deleteuserid],[datastatus] mytable i transpose according other picture: i have tried follow pivot samples couldn't reach result. attempt (i did not include columns): select [1281] q1, [1282] q2, [1283] q3, [1284] q4, [1285] q5, [1286] q6, [1287] q7, [1288] q8, [1289] q9 ( select id, qualifierid, value, insertdate badmentries variableid=1000) p pivot ( max(value) qualifierid in ( [1281] , [1282], [1283], [1284], [1285], [1286], [1287], [1288], [1289] ) ) pvt but did not work, because result get: where error?! thanks, diego remove id column sub-query not using in pivot clause , in final select statement used grouping: select [1281] q1, [1282] q2, [1283] q3, [1284] q4, [1285] q5, [1286] q6, [1287] q7, [1288] q8, [1289] q9 ( select qualifierid, valu...

twitter bootstrap 3 - Background banners (skins) in responsive layout, how to implement them? -

i looking tutorials, ideas, suggestions on how implement "skin-banners" (also called background-banners) in responsive template famous twitter bootstrap template . how manage width of background picture? possibile implement backgroud banner without using javascript complex scripts? are there working examples? many thanks, fabio the solution display correct skin each viewport. first of needto read width of window browser: <script type='text/javascript'> var widthbrowser = $(window).width(); </script> then each viewport have call right skin. desktop version instance: if (widthbrowser > 1200){ // code skin } else if ...

ios - Visual management of main.storyboard objects has disappeared? -

on previous mac, when main.storyboard selected, see hierarchy of objects view controller > scroll view > button. things change name of button. menu has disappeared after transferred project files new mac. however, can still see storyboard file. how menu back? thank assistance.

Updating a LabVIEW GUI from a subVI -

i'm writing program control 2 similar devices in labview. in order avoid copying code use subvis. have piece of code update values on gui inside while loop. i'd know if possible somehow have loop inside subvi , have subvi sending 1 of output parameters after each iteration. to update gui within subvi can 1 of following: create queue or notifier in top level vi , pass reference in subvi. in subvi, send data queue or notifier. in top level vi, have loop waits data on queue or notifier , writes front panel indicator. create control reference front panel indicator in top level vi , pass reference subvi. in subvi, use property node write value property of indicator. if @ labview terms in bold you'll find documentation , examples how use them. of these options, use queue data it's important top level vi receives every data point (e.g. if data being plotted on chart or logged file) or notifier it's necessary user sees latest value. using contro...

mongodb - Group by array of document in Spring Mongo Db -

how can group tagvalu e in spring , mongodb? mongodb query : db.feed.aggregate([ { $group: { _id: "$feedtag.tagvalue", number: { $sum : 1 } } }, { $sort: { _id : 1 } } ]) how can same thing in spring mongodb, may using aggregation method? sample document of feed collections: { "_id" : objectid("556846dd1df42d5d579362fd"), "feedtag" : [ { "tagname" : "sentiment", "tagvalue" : "neutral", "modelname" : "sentiment" } ], "createddate" : "2015-05-28" } to group tagvalue , since array field, need apply $unwind pipeline step before group split array can actual count: db.feed.aggregate([ { "$unwind": "$feedtag" } { "$group": { "_id": "$feedtag.tagvalue", ...

jquery - Remove the unwanted text through javascript -

i have table cannot access html code. want remove 'information' , '|' coming before "registration" link. want registration link in <td> . trying do. <script> j$(document).ready(function() { j$('td.table-text:contains("|")').replacewith(" "); }); </script> </head> <table width="100%" cellspacing="0" cellpadding="0" id="registrants" class="grid"> <tbody> <tr class=""> <td class="table-text"> <input type="checkbox" onclick="autocheckguest('ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant', 'registrants', 'ctl00_contentplaceholder1_ctl01_traddanother', 'true');" name="ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$chkregistrant" id="ctl00_contentplaceholder1_ctl01_rpt...

Precedence of operators in Java -

this question has answer here: the difference between ++var , var++ 7 answers when run java code: int[] = new int[10]; int = 0,j = 0; while(i < 10){ a[i++] = j+++j++; } system.out.println(arrays.tostring(a)); i output: [1, 5, 9, 13, 17, 21, 25, 29, 33, 37] . can please explain how statement a[i++] = j+++j++ resolved. the first j++ in expression j+++j++ increments j , returns previous value. the second j++ increments j , returns previous value, value after first j++ incremented it. at start of next iteration, j larger 2 compared value @ start of previous iteration (since previous iteration incremented j twice). therefore : a[0] = 0++ + 1++ = 0 + 1 = 1; a[1] = 2++ + 3++ = 2 + 3 = 5; a[2] = 4++ + 5++ = 4 + 5 = 9; ...

excel - Sorting using VBA -

i have code below dim lasteuro long thisworkbook.sheets("euro cash").range("a2:af").sort key1:=range("t2:t"), order1:=xlascending, key2:=range("v:v"), order2:=xlascending, header:=xlyes lasteuro = sheets("euro cash").range("a1").end(xldown).row sheets("euro cash").range("a:u").autofilter field:=17, criteria1:=array("lnccp", "lnlchscm"), operator:=xlfiltervalues 'sec no.' sheets("euro cash").range("d2:d" & lasteuro).copy sheets("master").range("k6").pastespecial paste:=xlpastevalues 'cpty name' sheets("euro cash").range("f2:f" & lasteuro).copy sheets("master").range("l6").pastespecial paste:=xlpastevalues 'break' sheets("euro cash").range("i2:i" & lasteuro).copy sheets("master").range("m6").pastespecial paste:=xlpastevalues ...

java - HttpURLConnection application crashes with ESP8266 -

i have esp8266 simple http server following lua script print("my first lua program") --print(adc.readvdd33()) print("setting wifi") wifi.setmode(wifi.stationap) --[[ station + ap --]] wifi.setphymode(wifi.phymode_n) --[[ ieee 802.n --]] print(wifi.getmode()) print(wifi.getphymode()) wifi.sta.config("srs", "cometomyn/w0") tmr.delay(5000000) print("delay out") --print(wifi.sta.getip()) srv=net.createserver(net.tcp) srv:listen(80,function(conn) conn:on("receive",function(conn,payload) print(payload) conn:send("<h1> esp8266<br>server working!</h1>") conn:close() end) end) when connect server through laptop chrome, getting "server working!" response. but when connect through android app made, crashing :( . following app code public class httpmanager { public static string downloadurl(string uri) throws ioexception { htt...

php - Get records of all months in symfony -

this question has answer here: select entries between dates in doctrine 2 4 answers i developing web application using symfony framework.i want fetch records database of months.i dont know how write query fetching records jan december. code: $totalsearchesbyadminmonth = $em->createquerybuilder() ->select('count(searchhistory.id) totalsearchesbyadmin') ->from('drpadminbundle:log', 'searchhistory') ->where('searchhistory.last_updated :last_updated') ->setparameter('last_updated',$months.'-%') ->andwhere('searchhistory.event = :event') ->setparameter('event','admin_search') ->getquery() ->getarrayresult(); please help. assuming searchhistory.last_updated datetime field , $month number of months want search. $...

How to disable the checkbox in angularjs -

i have list of checkboxes on view page send notifications different roles.i want disable checkboxes in unchecked state initially. i working following code in view <div ng-repeat="notification in notificationlist | filter:{media: item.media}" ng-if="!collapsednotification" ng-class="{'pad-top-4':($first)}" > <label for="notificationlabel" class="col-sm-4 col-md-4 col-lg-4 control-label font-normal" title="{{notification.notificationlabel}}">{{notification.notificationlabel}}</label> <div class="col-sm-1 col-md-1 col-lg-1" style="line-height:35px;"> <span class="col-lg-2 col-md-2 col-sm-2 item-padding "> <span class="default-pointer" ng-checkbox ng-init="toadmin=false" ng-model='toadmin' ng...

android - ListView with toggle button doesn't scroll smoothly -

i have custom listview. it's populated cursor adapter. it's every row includes 1 imageview, 2 textviews , 1 togglebutton. these loads fine. when change state of group of togglebuttons true, when scroll fast listview not scrolling smoothly hangs sec , scrolls. happens when after group of unchecked buttons appears group of checked buttons , vice versa. why list view hangs while scrolling? any appreciated. code looks this: public void bindview(view view, context context, final cursor cursor) { final viewholder viewholder = new viewholder(view); (...) if (viewholder.toggle_artist != null) { viewholder.toggle_artist.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { int favourite = ischecked ? 1 : 0; contentvalues value = new contentvalues(); string = amdmcontract.artistentry.table_name + ...

csv - scikit learn - converting features stored as strings into numbers -

i'm dipping toes machine learning using scikit-learn python library , trying use .csv data in format date name average_price_sa 1995-01-01 barking , dagenham 70885.331285935 1995-01-01 barnet 99567.4268042005 1995-01-01 barnsley 49608.33494746 .... .... .... 2005-01-01 barking , dagenham 13294.12321312 i have read them in using panda using line data = pd.read_csv('data.csv') from have learned far, think i'm supposed convert 'name' category strings floats can accepted model. i'm not sure how go this. appreciated. thanks you can use scikit's labelbinarizer convert strings 1 hot vectors. these have n zeros (where n number of unique strings) 1 @ single component. from __future__ import print_function sklearn import preprocessing names = ["barking , dagenham", "barnet", "barnsley"] lb = preprocessing.labelbinarizer() vectors = lb.fit_...

how to pass value at runtime in url in android using json parsing? -

i trying name , address of hospitals,atm's,restaurants ....etc. near location of google near places api use json parsing ,since can able name , address problem can't understand how can different values of ex. hotel,hospital,atm,bank...etc. using same url putting different different values in run time.here url .... https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=26.841,75.801&radius=5000&types=hospital&key=aizasybstnd0ma7nzjpulzrcntowyjwxakxqsfi "; in above url there field "types" ,here want pass different different values @ run time.....like hotel,hospital,bank,atm ...etc. string type = "hospital"; int radius =5000; string string = string.format("https://maps.googleapis.com/maps/api/place/nearbysearch /json?location=26.841,75.801&radius=%d&types=%s& key=aizasybstnd0ma7nzjpulzrcntowyjwxakxqsfi", radius, type);

javascript - How to highlight particular region in horizontal way in dygraph and how to create dynamic graph -

i need highlight y value example 20 -10 , -30 -45 in y axis. permanently color opacity 50%, how do., in example how add external csv file following code. pls guide me var orig_range; window.onload = function(){ var r = []; var arr = ["7/13/2015 0:15:45",45,"7/13/2015 0:30",5,"7/13/2015 0:45",100,"7/13/2015 1:00",95,"7/13/2015 1:15",88,"7/13/2015 1:30",78]; (var = 0; < arr.length; i++) { r.push([ new date(arr[i]),arr[i+1] ]); i++; } orig_range = [ r[0][0].valueof(), r[r.length - 1][0].valueof() ]; g2 = new dygraph( document.getelementbyid("div_g"), r, { rollperiod: 7, animatedzooms: true, // errorbars: true, width: 1000, height: 500, xlabel: 'date', ...

ruby - Rails trying to create a user when updating user details -

i'm learning rails , building authentication system using guides around web , following railscasts tutorials. i've come stand still @ moment , need bit of assistance if possible. when ever try edit user profile, error message tells me can't create account due fields such email , username being taken. looking around seems it's related how edit form being submitted, can't solve it! any appreciated. users_controller.rb def edit @user = user.find(params[:id]) end def update @user = user.find(params[:id]) if @user.update_attributes(user_params) flash[:success] = "profile updated" redirect_to @user else render 'edit' end end edit.html.erb <%= form_for :user, url: '/users' |f| %> <form class="m-t" role="form" action="#"> <div class="form-group"> <%= f.label :name %> <%= f...