Posts

Showing posts from May, 2012

c - error: expected expression before ',' token -

#include <stdio.h> #include <stdlib.h> #include <ctype.h> struct nodes { char* info; struct nodes * left; struct nodes * right; }; char* question = "any question?"; struct nodes * node = null; struct nodes * nodeleft = null; struct nodes * noderight = null; struct nodes newnode (char info[50], struct nodes * l, struct nodes * r) ` { struct nodes conf; conf.info = info; conf.left = l; conf.right = r; return conf; } here im trying create new root node null left , right nodes int main(){ node = newnode (question, nodoleft*, nodoright*); return 0; } dont know why i'm getting error while im trying create new node... i'm new in c error: error: expected expression before ',' token in "nodoleft*," , "nodoright*" looks though have started multiplication, , left off wi

How do I set up Emgu CV on Visual Studio 2013 for Unit Tests? -

i've got test in c# new c++/cli managed components in visual studio 2013 unit test it's visible in test explorer. 1 of components uses opencv cv::mat. it's been recommended use emgu cv unit tests. i've installed emgu cv windows x64. how install emgu in unit test project? in test project: add reference emgu.cv.world.dll add file opencv_corexxxd.dll xxx = version number properties | copy output directory = "copy always" above unit test class add using emgu.cv; see setting emgu c sharp .

android - How to find and retrieve nearby latitude and longitude values stored in a Firebase database? -

i developing android app users sign , store current location on firebase database. i'm looking display location of nearby users on map taking latitude , longitude of user , using through firebase database , find users live nearby (within radius). i'm trying order latitudes , longitudes in database, store them, , somehow loop through them find ones near user's location. seems inefficient way go database can become quite big more , more users. is there way can find out how many latitudes , longitudes fall within radius centered around user's current location?

android - How to save information in json file without deleting previous information python -

i making app using python , kivy allows user make new entry glucose readings. right saves json file new entry deletes previous data. how can make each entry saves separately can access information user's history? .py file from kivy.app import app kivy.lang import builder kivy.uix.popup import popup kivy.uix.button import button kivy.graphics import color, rectangle kivy.uix.boxlayout import boxlayout kivy.uix.floatlayout import floatlayout kivy.uix.image import asyncimage kivy.uix.label import label kivy.properties import stringproperty, listproperty kivy.uix.behaviors import buttonbehavior kivy.uix.textinput import textinput kivy.network.urlrequest import urlrequest kivy.storage.jsonstore import jsonstore os.path import join os.path import exists kivy.compat import iteritems kivy.storage import abstractstore json import loads, dump kivy.config import config import os import errno class phone(floatlayout): def __init__(self, **kwargs): # make sure aren'

java - Why are the apk sizes identical using conditional compile -

i using conditional compile in java using newest android studio newest gradle. so did little test using static final boolean compilethiscode = false; if (compilethiscode) { callalargeclass(); } and created apk with static final boolean compilethiscode = true; i have expected apks of different sizes since callalargeclass large class but apks compilethiscode = true , compilethiscode = false have same size could please me understand why if java doing conditional compile ? this influence runtime memory consumption. apk size depends on libraries , resources (res folder). "hello world" in project multiple big 3d party libraries can hit 65k limit . you can exclude unused dependences proguard config.

jquery - Trying to swap image url's for a blurred up look but getting flickering -

http://electricagenda.com/articles/public-panic-by-steph-copeland hey, above link example. i have div inline background-image 50px wide, , set cover , center center. have transition: 200ms ease-in-out on smooth out fade. essentially want load super fast , blurred out, does, swap in larger image. sometimes works perfect, on initial page load it's super quirky, upon refresh fine. basically function swaps large image url data-image img tag after 300ms. removes original background image. function loadbackground() { var $article_img_bg = $('#imgfocus .bg-img'), $article_img_url = $article_img_bg.data('bg'); $article_img_bg.removeattr('style').css('background','url(' + $article_img_url + '.jpg)' ); } settimeout(loadbackground, 300); any idea's on how improve appreciated.

delphi - There are four standard radio buttons on a form. How do you make the first pair work independently of the second pair -

there 4 standard radio buttons on form. how make first pair work independently of second pair is linking them event best way ?? radio buttons grouped when have common parent . put 2 pairs in separate parent containers. can use tradiogroup , tgroupbox , tpanel , etc that.

ruby on rails - moved config/application.rb file -

i still learning ruby on rails. accidentally moved file config/application.rb config/locales directory. then figured out , moved back, after did rails generate , rails console commands stopped working. any advice? rails versions 4 , later use spring speed development process loading application memory. way, commands rake db:migrate , rails new or command requires load whole rails before running speeded up. because, launched , in memory. spring updates changed files. in case, ran rails new command in "broken" state, without application.rb file , application in memory. next time ran rails command running "broken" code. so, running spring stop stop spring fixed problem.

json - GameMaker runner crashes when making HTTP requests -

i got using gamemaker:studio, , hoo boy have there been massive updates since last used it! in fact last time used had windows , html5 export options... anyway, eager try out of new stuff, decided take shot @ native http functions, since looked promising. i did test using http_post_string() great effect, sending json string server , getting json string back. returned string represented object single property, "echo" , contained http request had been made, see gm:s sending. i didn't sent content-type: application/x-www-form-urlencoded when quite json, , wanted ability set own user agent string server know game talking without having pass parameter. so re-created same request using lower-level http_request() function. looked fine, tested it. it crashed. like, no error messages or anything, total crash , windows had force-close it. so here code rights should work fine, crashes when run... ///send_request(file,ds_map_data,callback_event_id) var request =

vba - Targeting an open outlook email for population (Outlook 2010) -

i've been trying improve "quality of life" follow-up email process in office userform+vba snippet, , i've hit roadblock in while i've been able create brand new email , format stuff .body, .attachments.add, .to, etc. , haven't been able figure out how reply already-existing email, necessary part of follow-up process. i saw this page gave solution c#/vb.net, , in using object browser found "application.activeexplorer" exists in vba well. i'm working with: private sub btnsubmit_click() dim msg string dim objmsg outlook.mailitem set followup = objmsg.activeinspector.currentitem followup ' compose message msg = "good morning," & "<br />" & "<br />" msg = msg & "this follow-up request following outstanding subjectivities: " & "<br />" & "<br />" = 0 listbox1.listcount - 1 if listbox1.selected(i) counter = counter + 1 msg =

Python - Ready text file and report count of individual characters -

i have python script prints out randomly generated password, prints prints text file, adding new row every time called. example: pswd = (str(pswd01)) + (str(pswd02)) + (str(pswd03)) + (str(pswd04)) # note, variables pswd01, pswd02 etc randomly created earier in script. print(pswd) open('pswd_output.txt','a') f: f.write(pswd + '\n') f.close() note, variable pswd contains lower case, upper case, , numbers. i want read file , count number of individual characters, , print report different text file, not sure how can this. have asked similar question here , answers how print character report console. any idea how can read pswd_output.txt, , count each different character, writing result separate text file? any appreciated! use dictionaries count characters repeat below: my_dictionary = {} f = open('pswd_output.txt','r') line = f.readline() while(line): letter in line: if letter in my_dictionary:

android - Installing Chrome extension via zip, requires App Runtime for Chrome: 'import' extension is not installed -

we releasing android app chromebook. has available file download (i.e. flash drive, private login) , not through chrome web store. arc welder gave me chrome extension zip based on original android app apk . zip installed on chromebook has arc welder, evernote or 1 of other android-on-chrome apps; because chrome app store have pre-installed app runtime chrome. if apps removed, , zip becomes first app require app runtime chrome, error error loading extension failed load extension from: /tmp/myapp_random 'import' extension not installed. followed json looks manifest. there import line has key of dependency i'm looking for. ... "import": [{"id": "mfaihdlpglflfgpfjcifdjdjcckigekc"}], ... to prevent error new users, rather not require them install arc welder, evernote, etc. how can either obtain app runtime chrome zip can install app runtime manually, or provide way them download arc welder without of apps relie

android - How to restore element in Activity Transition Animation to different position? -

Image
i have linearlayout in vertical scrollview multiple imageviews, when click on 1 image view transition animation (activity 1) full screen gallery (activity 2), gallery has view pager user can swipe right / left .. when user swipes different image in gallery , presses current visible image in (activity 2) restored (again using transition animation) starting position in activity 1, problem image restored until reaches old position , disappears , reveals different image (since complicated discuss) attached image. activity1 layout: <linearlayout> <imageview /> <imageview /> <imageview /> <imageview /> <imageview /> <imageview /> </linearlayout> acivity2 (gallery) layout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_

c# - Post XML as "application/xml" instead of "text/xml" via RestSharp -

i'm hooking salesforce bulk api using restsharp . when add object using addbody : var request = new restrequest( method.post); request.requestformat = dataformat.xml; request.addheader("x-sfdc-session", loginresult.sessionid); var ji = new jobinfo { operation = "insert", @object = "contact", contenttype = "csv" }; request.addbody(ji, xmlns); salesforce rejects error message: unsupported content type: text/xml ... presumably because behind scenes restsharp interpreting request.requestformat = dataformat.xml; "text/xml". by fiddling around salesforce api have discovered wants "application/xml" instead of "text/xml". is there supported way make restsharp send "application/xml" instead? from documentation here requestbody if parameter set, value sent body of request. 1 requestbody parameter accepted – first one. the name of parameter used content-type hea

inheritance - Diamond of death and Scope resolution operator (c++) -

i have code (diamond problem): #include <iostream> using namespace std; struct top { void print() { cout << "top::print()" << endl; } }; struct right : top { void print() { cout << "right::print()" << endl; } }; struct left : top { void print() { cout << "left::print()" << endl; } }; struct bottom: right, left{}; int main() { bottom b; b.right::top::print(); } i want call print() in top class. when try compile error: 'top' ambiguous base of 'bottom' on line: b.right::top::print(); why ambiguous? explicitly specified want top right , not left . i don't want know how it, yes can done references, virtual inheritance, etc. want know why b.right::top::print(); ambiguous. why ambiguous? explicitly specified want top right , not left . that intent, that's not happens. right::top::print() explicitly names member function want call, &am

testing - @BeforeClass and @AfterClass in Xcode XCTests -

in junit testing, there notion of being able run code before or after tests run. see in xcode, however, -setup , -teardown, happen before , after every test. is there xcode equivalent @beforeclass , @afterclass in junit? there following methods provided xctestcase runs before , after test in test class executed: + (void)setup; setup method called before invocation of test method in class. + (void)teardown; teardown method called after invocation of every test method in class.

php - read JSON data sent using post in jquery with laravel framework -

i have codes, var obj = '{"items":[{"code":"c101","description":"car"}]}'; $.post('get-items',obj,function(){ }); i used code, file_get_contents('php://input') because cant post data sent. using above code, raw post data. how can read data sent without using file_get_contents('php://input')? because can't use file_get_contents('php://input'). here laravel controller function, public function getitems() { $data = file_get_contents('php://input'); if(isset($data)) { ... } } laravel 5.3 expects input sent in array format https://laravel.com/docs/5.3/requests#retrieving-input request sent through jquery $.ajax({ url: 'http://weburl.com/api/user/create', datatype: 'json', type: 'post', data: {'user': user}, success: function(data) { this.setstate({data: dat

java - gson with mixed read -

i'm trying read json gson, can't "simple" gson example work. from: https://sites.google.com/site/gson/streaming public list<message> readjsonstream(inputstream in) throws ioexception { jsonreader reader = new jsonreader(new inputstreamreader(in, "utf-8")); list<message> messages = new arraylist<message>(); reader.beginarray(); while (reader.hasnext()) { message message = gson.fromjson(reader, message.class); messages.add(message); } reader.endarray(); reader.close(); return messages; } here's problem, if try with: jsonreader reader; gson gson = new gson(); gson.fromjson(reader,program.class); it doesn't build. the method fromjson(string, class<t>) in type gson not applicable arguments (jsonreader, class<program>) there seems method according eclipse: fromjson(jsonreader arg0, type arg1) replace import android.util.jso

HTML Language to highlight letters on a website -

is better use strong or h1 h6 bring out letters on website? have seen strong taught use h1 through h6 . what's difference? the <strong> tag phrase tag. defines important text . <strong>strong text</strong> the 6 different html headings applied on titles different levels . <h1>this heading 1</h1> <h2>this heading 2</h2> <h3>this heading 3</h3> <h4>this heading 4</h4> <h5>this heading 5</h5> <h6>this heading 6</h6>

database - performance tuning - Insert -

i have 1 unix script in creating table, index , loading date file table using sql loader . , doing near 70 direct update (not using or bulk collect) on table. at last inserting new table data table. per day it's processing 500 000 records. these update fast. during inserting data table taking 20 minutes. how can improved? no problem in insert because on same table inserting 500 000 rectors table that's working fine. insert done in less minute. insert tables () select () tablex; it's taking 20 min 500 000 records tablex- created , loaded , 70 direct update done in same shell script . checked explain plan cost select alone , insert script both same. insert tables () select () tabley; above statement executed less second. i used parallel hint. cost reduced . , cpu utilisation zero. shall create 1 more table tablez load data tablez final table? is stats gathering required? daily run program. when direct path insert using sql loader, records ins

nullpointerexception - Null Pointer Exception with Multiple Classes in Processing -

i'm trying make button class tic tac toe game in processing. code class this import processing.core.papplet; public class button extends papplet{ float buttonx; float buttony; float buttonwidth; float buttonheight; boolean cliked; public button(papplet canvas, float buttonx, float buttony, float buttonwidth, float buttonheight) { this.buttonx = buttonx; this.buttony = buttony; this.buttonwidth = buttonwidth; this.buttonheight = buttonheight; } public void drawbutton() { rect(200, 200, 200, 200); textsize(40); fill(200, 200, 200); text("start game", 300, 300); } } the code inside of setup() method processing is button startbutton = new button(this, 200, 200, 200, 200); startbutton.drawbutton(); i have no clue i'm doing wrong, keep receiving nullpointerexception . this caused because you've got 2 classes extend papplet . should have 1 class

c++ - Operator Overloading -

i'm confused topic regarding operator overloading. see following code: #include <iostream>; class vectors { public: int x, y; vectors() {}; vectors(int a,int b) { x = a, y = b; } vectors operator+(vectors aso) { vectors brandnew; std::cout << "aso x " << aso.x << std::endl; std::cout << "aso y " << aso.y << std::endl; brandnew.x = brandnew.x + aso.x; brandnew.y = brandnew.y + aso.y; return (brandnew); }; }; int main() { vectors v1(2,3); vectors v2(4,5); vectors v3; v3 = v1 + v2; std::cout << "vector v3 x : " << v3.x << std::endl; std::cout << "vector v3 y : " << v3.y << std::endl; } when print aso.x, y gives me 4 , 5. want add both v1 , v2; meaning x of v1 , v2, , y of v1 , v2. then, pass vectors object , return object. how accomplish that, given have

sql - Update and self join -

i want update blank name column in client table using non-blank column same client number. know how should modify below sql? thanks, update client set name=(select name client (name not null , name<>'') ) client c1, client c2 (name null or name='') , c1.client_no=c2.client_no i recommend using window functions purpose: with toupdate ( select c.*, max(name) on (partition client_no) maxname client c ) update toupdate set name = maxname name null or name = '';

java - Difference between apostrophe and backslash+apostrophe -

i don't understand difference between "'" , "\'" . is, public class test { public static void main(string[] args) { system.out.println("hello, i'm best!"); system.out.println("hello, i\'m best!"); } } gives same result: hello, i'm best! hello, i'm best! is feature of language? or may there more complicated description? there same result on android? for string literals, there no difference between ' , \' . character literals, in java enclosed ' characters, escape necessary. ''' // not legal character literal ' '\'' // escaped character literal ' according jls, section 3.10.6 , java escapes string , character literals, can use them in both cases. quoting jls link: the character , string escape sequences allow representation of nongraphic characters single quote, double quote, , backslash characters in characte

numpy - Python - Apply a function over a labeled multidimensional array -

i have numpy array labelled using scipy connected component labelling. import numpy scipy import ndimage = numpy.zeros((8,8), dtype=numpy.int) a[1,1] = a[1,2] = a[2,1] = a[2,2] = a[3,1] = a[3,2] = 1 a[5,5] = a[5,6] = a[6,5] = a[6,6] = a[7,5] = a[7,6] = 1 lbl, numpatches = ndimage.label(a) i want apply custom function (calculation of specific value) on labels within labelled array. similar instance ndimage algebra functions: ndimage.sum(a,lbl,range(1,numpatches+1)) ( in case returns me number of values each label [6,6] . ) is there way this? you can pass arbitrary function ndimage.labeled_comprehension , equivalent [func(a[lbl == i]) in index] here labeled_comprehension -equivalent of ndimage.sum(a,lbl,range(1,numpatches+1)) : import numpy np scipy import ndimage = np.zeros((8,8), dtype=np.int) a[1,1] = a[1,2] = a[2,1] = a[2,2] = a[3,1] = a[3,2] = 1 a[5,5] = a[5,6] = a[6,5] = a[6,6] = a[7,5] = a[7,6] = 1 lbl, numpatches = ndimage.label(a) def func(x):

JSON Deserialize with empty field c# -

i'm testing api calls in c# , getting following json response: { "message": "the request invalid. model validation failed.", "validationerrors": { "": { "reasons": [ "a customer must added order before can placed." ] } } } i want map response class json deserializer , have no control on how response formed. how handle empty field in validationerrors can still access reasons list in object? note: when ran through json2csharp gave not useful mapping field within validationerrors class. public __invalid_type__ __invalid_name__ {get;set;} deserialize dictionary<string, validationerror> : public class validationerror { public list<string> reasons { get; set; } } public class rootobject { public string message { get; set; } public dictionary<string, validationerror> validationerrors { get; set; } } this work out-of-the-box javascriptseriali

php - How to use txt content to onclick="doAjaxCall(' ')? -

i use voice xml select logo or movie. put logo.svg or movie.php in txt file. use php load logo.svg or movie.php $thedata . <?php ini_set("display_errors", true); // define file name variable $myfile = "voice.txt"; // file handle file: 'r' means set permission read $fh = fopen($myfile, 'r'); //read entire file , store contents in variable $thedata $thedata = fread($fh, filesize($myfile)); // close file ok use later fclose($fh); //echo whatever in file browser echo $thedata; // part 2 // file handle file: 'a' means set permission read $fh = fopen($myfile, 'w') or die("error trying open a"); $nodata = "no msgs"; //read entire file , store contents in variable $thedata $thedata = fwrite($fh, $nodata); // close file ok use later fclose($fh) ?> now want show either of them on webs. use: <input class="logo" type="button" value="call (832) 271-6319 " onclic

phonegap cli - cordova.js not loading in iOS simulator - file:///cordova.js Failed to load resource: The requested URL was not found on this server -

Image
i have 2 projects - demo project , actual project. in demo project, cordova.js (and rest of js , css) load correctly. in actual project, links js , css improperly formatted. in demo project, link cordova.js looks (from safari inspector): in actual & broken project, looks like: i've been searching , can't tell difference between projects. why second project using wrong reference files? are perhaps using angular , have <base href="/"> in index.html file? if need remove , go url hashing way. angular 2 adding { usehash: true } in routing module. see https://angular.io/docs/ts/latest/guide/router.html#!#browser-url-styles how-to , explanation. with angular 1 configure location provider. see https://docs.angularjs.org/guide/ $location#hashbang-and-html5-modes explanation , how-to.

c - remove characters of a char array -

in str char array below first locate first math symbol see, count backwards , remove whatever between previous 3 " _ " , remove 3 " _ ". can please ideas on how this? so this: xa_55_y_*_z_/_+_x_+ should turn into: xa*_z_/_+_x_+ my problem don't know how remove: _55_y_ here code far. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, char *argv[]) { char str [] = "xa_55_y_*_z_/_+_x_+"; int length = 0; int decrementor = 0; int underscore_counter = 0; int = 0; length = strlen (str); for(i = 0; < length; i++) { decrementor = 0; underscore_counter = 0; if(str[i] == '*' || str[i] == '/' || str[i] == '+' || str[i] == '-') { decrementor = i; while(underscore_counter != 3) { if(str[decrementor] == '_')

java - Using CardLayout for multiple JPanels and nothing displays -

i'm making simple (and bogus) computer power consumption calculator. i'm using card layout put multiple panels in when run it, there's small window not displaying anything. here's long code, put in 1 class. package my.project; import java.awt.*; import java.awt.event.*; import java.io.ioexception; import java.net.uri; import java.net.urisyntaxexception; import java.text.decimalformat; import javax.swing.*; public class mainproject extends jframe { cardlayout cl; int motherboardp, oddp, hddp, ssdp, fanp, cpup, gpup, monitorp, hoursint; int ramnum, hddnum, ssdnum, fannum, gpunum; double ramp, totalp, powerperyear; public float tariff = (float) 0.2180; public float costrm; jpanel mainpage, secondpage, thirdpage, results; //jpanel panelcont; jlabel title, icon, motherboard, ram, numram, numssd, numhdd, odd, numfan, cpu, gpu, numgpu, monitor, hours, outage, peryear, costyear, watt, kwatt, rm; jbutton start, exit1, exit2, nxt1, bck1, nxt2,

java - Why use getters instead of public fields in immutable objects? -

this question has answer here: immutable type: public final fields vs. getter 6 answers i aware using getters , making fields private has many advantages in general cases (data-hiding, decoupling, blah, blah, blah). i'm asking related immutable classes. let's i've created model class store data rest response, example: public final class profile { private final int id; private final string name; private final string info; private final string location; private final uri avatar; private final gender gender; // 10 more fields } the class , fields final , cannot changed or overridden. each field instance of immutable class , validated in constructor. also, every field needs publicly accessible (no data-hiding). in such case, possible advantage there tripling size of class add getters every field instead of making fields pu

osx - How to fix error: invalid value 'f95' in '-x f95'? -

i'm using fortran codeblocks ide, , when try build code error error: invalid value 'f95' in '-x f95' and after there no executable file. thing is, when write in terminal gfortran nameofmyfile.f i correct executable file "a.out". question: how can fix problem? especifications: have mac os x 10.8.5, installed xcode, gcc, , gfortran.

javascript - Checking for two equal values in objects, in an array -

Image
i have array objects in looks this: i need check see if of start dates same, , if are, objects. example, if arr[0], arr[3], arr[4] have start date of mon apr 25 2016 16:00:00 gmt-0700 (pacific daylight time), need select 3 objects , them. i'm not sure how this, appreciated. you can transform list of objects mapped start attribute , check see if of dates contain more 1 object. here's helper: function transform(list) { var map = {}; (var = 0; < list.length; i++) { var object = list[i]; if (object.start in map) { map[object.start].push(object); } else { map[object.start] = []; map[object.start].push(object); } } return object; } then need call transform list of objects map of objects identified start dates. iterate through them , you'll of objects each start date. var startdates = transform(list); // list of objects mapped start date // loop through each start date (var startdate in startdates) { var

c# - Backgroundworker updating log on the ui -

i have wpf application text box in main window supposed used display logging information while user runs long process. <textbox grid.row="1" margin="10,10,10,10" acceptsreturn="true" name="txtlogging" textwrapping="wrapwithoverflow" text="{binding path=logtext, mode=twoway}" scrollviewer.horizontalscrollbarvisibility="auto" scrollviewer.verticalscrollbarvisibility="auto" /> public string logtext { { return _logtext; } set { _logtext = value; onpropertychanged(); } } one of buttons on ui kicks off process takes minimum of 30 seconds, , few hours. needless say, running on background worker preferred. issue logging class in program being created on ui thread , has accessed during worker's execution update ui log of happening. the logger looks this; using system; using system.io; namespace batchinvoice { public enum logginglevel

python - Matplotlib savefig() on a zoomed in graph -

Image
drawing huge graph networkx , matplotlib i'm reasking linked question. think can better job explaining question. mathplotlib.show() called on large graph, default zoomed out, clustered output. desired endstate use mathplotlib.savefig() save plot use in report. however, savefig() output zoomed out, general. changing image size or dpi not fix this. makes zoomed out image bigger. there way zoom in graph , save without using ui? ui, can zoom in, spread nodes out, , center around node in question, not know how automatically. relevant code: nx.draw(g,pos,node_color=colorvalues, with_labels = false,node_size=values) fig.set_size_inches(11,8.5) if show ==0: plt.show() if show ==1: plt.savefig(name+" coremem.png",bbox_inches=0,orientation='landscape',pad_inches=0.1) you use ax.set_xlim , ax.set_ylim set x , y ranges of plot. example, import networkx nx import matplotlib.pyplot plt import numpy np filename = &

mysql - php database help, database hosted on separate server than web host -

hi making login/register database. not hosting database on same server how make point separate domain? if can tell me root pointing to... thx here files: db.php <?php $connection = mysql_connect('localhost', 'root', ''); if (!$connection){ die("database connection failed" . mysql_error()); } $select_db = mysql_select_db('register'); if (!$select_db){ die("database selection failed" . mysql_error()); } ?> links (my scripts , original scripts): https://docs.google.com/document/d/1u60x_mkd9z548qrh_vjdytx3hziiziyplua_rjx11mq/edit?usp=sharing for starters, don't use mysql_connect() ! use either mysqli or pdo . second, don't have application log in mysql root ; create application-specific unprivileged user ( with password! ) purpose. you'll need create unprivileged user connect privilege web server's ip or dns address, , instead of connecting localhost php need connect db server's ip or dn

How to run in vim plantuml on MacOsX? -

adapting instructions @ http://zbz5.net/sequence-diagrams-vim-and-plantuml , have in .vimrc file on macosx yosemite: let g:plantuml_executable_script='java -jar /users/documents/plantuml.jar' i have java installed correctly "java -version" gives version number. in directory have uml file, diag.uml: @startuml alice -> bob: test @enduml when open vim, type ":" , type g, message saying "regular expression missing global". how run expression given let variable above? g:plantuml_executable_script name of variable containing command execute; don't need type name vim. install the plugin mentioned in article; it'll use g:plantuml_executable_script set makeprg , , you'll able process plantuml file typing :make in vim.

Java string returning null after definition -

as title says, i'm using java , having problems string returning null @ runtime though set previously. i'm using libgdx doesn't complicate @ point, seemingly simple. or i'm tired. here's code: package com.jett.game; import java.util.arraylist; import com.badlogic.gdx.gdx; import com.badlogic.gdx.input.keys; import com.badlogic.gdx.screen; import com.badlogic.gdx.graphics.gl20; import com.badlogic.gdx.graphics.orthographiccamera; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.bitmapfont; import com.badlogic.gdx.graphics.g2d.sprite; import com.badlogic.gdx.graphics.g2d.spritebatch; import com.badlogic.gdx.graphics.g2d.freetype.freetypefontgenerator; import com.badlogic.gdx.graphics.g2d.freetype.freetypefontgenerator.freetypefontparameter; import com.badlogic.gdx.utils.array; public class gamescreen implements screen{ public orthographiccamera cam; public player player; public spritebatch mainbatch;

c - How to output 'passed' if a diff command results in no difference in bash? -

i writing shell script loops on ./tests directory , uses unix diff command compare .in , .out files against each other c program. here shell script: #! /usr/bin/env bash count=0 # loop through test files t in tests/*.in; echo '================================================================' echo ' test' $count echo '================================================================' echo 'testing' $t '...' # output results (test).res (./snapshot < $t) > "${t%.*}.res" # test diff against (test).out files diff "${t%.*}.res" "${t%.*}.out" echo '================================================================' echo ' memcheck echo '================================================================' # output results (test).res (valgrind ./snapshot < $t) > "${t%.*}.res" count=$((count+1)) done my question how can add if s

How to use busybox dd command to flash an image in windows -

i trying write companion application windows , mac os/x flash embedded linux os microsd card single click. use busybox's dd command this. have tried use windows port of this, crashes on windows 10. here few reason's why way. the users of these devices not technical, need 1 click ease of use. the installer needs portable , packaged in way can run off of usb. currently, have been trying run these commands in windows: busybox dd bs=4m if=\path\to\img of=e: busybox dd bs=4m if=\path\to\img of=\\.\e: both of these return errors. know of way can use busybox dd flash image sdcard in windows? i know there multiple ports of dd windows , behave different. this 1 i'm using , works flawlessly in windows 10 using \\.\e: syntax: http://www.chrysocome.net/dd however, needs run elevated rights ("as admin"), otherwise isn't allowed low-level access devices. (probably not relevant you, maybe others: careful, dd version offers "special"

TensorFlow: Reading images in queue without shuffling -

i have training set of 614 images have been shuffled. want read images in order in batches of 5. because labels arranged in same order, shuffling of images when being read batch result in incorrect labelling. these functions read , add images batch: # add files queue batch: def add_to_batch(image): print('adding batch') image_batch = tf.train.batch([image],batch_size=5,num_threads=1,capacity=614) # add summary tf.image_summary('images',image_batch,max_images=30) return image_batch # read files in queue , process: def get_batch(): # create filename queue of images read filenames = [('/media/jessica/jessica/tensorflow/streetview/training/original/train_%d.png' % i) in range(1,614)] filename_queue = tf.train.string_input_producer(filenames,shuffle=false,capacity=614) reader = tf.wholefilereader() key, value = reader.read(filename_queue) # read , process image # image 500 x 275: my_image = tf.image.

multithreading - Is it a good idea that using the race of multi-threads to be a random number generator? -

due unpredictable of racing situation of multiple symmetric threads, use uncertainty build uniform random generator? for example, codes http://www.cplusplus.com/reference/mutex/call_once/ , call twice generate random integer in [0,99]. #include <iostream> // std::cout #include <thread> // std::thread, std::this_thread::sleep_for #include <chrono> // std::chrono::milliseconds #include <mutex> // std::call_once, std::once_flag int winner; void set_winner (int x) { winner = x; } std::once_flag winner_flag; void wait_1000ms (int id) { // count 1000, waiting 1ms between increments: (int i=0; i<1000; ++i) std::this_thread::sleep_for(std::chrono::milliseconds(1)); // claim winner (only first such call executed): std::call_once (winner_flag,set_winner,id); } int main () { std::thread threads[10]; // spawn 10 threads: (int i=0; i<10; ++i) threads[i] = std::thread(wait_1000ms,i+1); std::cout << "w