Posts

Showing posts from April, 2011

exception - Xamarin.Android no stack trace in async method -

Image
anybody maybe found workaround bug: https://bugzilla.xamarin.com/show_bug.cgi?id=30513 ? it drives me crazy... screenshoot exception report got async method. here 1 solution worked me. add handler in application or main activity androidenvironment.unhandledexceptionraiser += delegate(object sender, raisethrowableeventargs args){ typeof (system.exception).getfield("stack_trace", bindingflags.nonpublic | bindingflags.instance) .setvalue(args.exception, null); throw args.exception; }; the explanation here in last post https://forums.xamarin.com/discussion/45219/stack-trace-not-captured-properly

javascript - Set multiple form values using jQuery Data attribute -

so let have form id #form has 2 input fields, namely title & price. i click on edit button somewhere in application has data attributes (e.g data-title="apple" data-price="10")that assigned #form upon clicking button. the obvious solution works $("#name").val($(this).data('name')); $("#price").val($(this).data('price')); this looks bad when have many fields. trying work $('#form').data($(this).data()); , more or less in single like have tried many ways no success any appreciated you create jquery plugin can call element contains data points , have apply data based on key elements within form of same name. example below $.fn.applydata = function(form) { $form = $(form); $.each($(this).data(), function(i, key) { $form.find('#' + i).val(key); }); }; jsfiddle: http://jsfiddle.net/lcm8s/43/

c - Why does `memmove` use `void *` as parameter instead of `char *`? -

the definition of c library function memmove following: void* memmove(void *s1, const void *s2, size_t n) { char *sc1; const char *sc2; sc1 = s1; sc2 = s2; ... } i'm wondering why need use void* , const void* parameters' type. why not directly char* , const char* ? update int test_case[] = {1, 2, 3, 4, 5, 6, 7, 8, 10}; memmove(test_case+4, test_case+2, sizeof(int)*4); output: test_case = {1, 2, 3, 4, 3, 4, 5, 6, 10} void * generic pointer type. memmove supposed manipulate memory regardless of type of objects in memory. similarly memcpy . compare strcpy uses char * parameters because it's supposed manipulate strings.

Using Census Bulk Geocoder with python requests library -

i experimenting census bulk geocode api (documentation: http://geocoding.geo.census.gov/geocoder/geocoding_services_api.pdf ) the following curl command works: curl --form addressfile=@addresses.csv --form benchmark=9 http://geocoding.geo.census.gov/geocoder/locations/addressbatch --output geocoderesult.csv but when attempt port python requests: url = 'http://geocoding.geo.census.gov/geocoder/geographies/addressbatch' payload = {'benchmark':9} files = {'addressfile': ('addresses.csv', open('addresses.csv', 'rb'), 'text/csv')} r = requests.post(url, files=files, data = payload) print r.text i apparently not sending formed request , receiving "there internal error" in response. idea doing wrong in forming request? got it! turns out geographies request type required parameters locations type did not. working solution: url = 'http://geocoding.geo.census.gov/geocoder/geographies/addressbatch' ...

c# - Differentiating between processes with the same name outside of my application? -

i creating wpf application in c# monitor processes running on machine. want able collect list of running processes , compare them list of processes want run. if process want run not yet running, application start it. i having problem getting processes name because have numerous processes running off of 1 parent application (they started different executable parameters,) have same process name. can't use process id because there no way me know pid of processes started outside of application. need way differentiate processes 1 both started in , outside of application can tell if running. appreciated, thanks. as suggested here , can query command-line parameters of process wmi , doing following, example if have processid: var wmiquery = string.format("select commandline win32_process processid='{0}'", processid); var searcher = new managementobjectsearcher(wmiquery); var retobjectcollection = searcher.get(); foreach (managementobject retobject in ret...

handlebars.js - Dynamic paths in handlebars -

i searched through lot of questions hasn't found answer. use handlebars templates , have data structure: { privileged_users: [ "user1", "user2" ], users: { user1: { name: "n1" }, user2: { name: "n2" }, user3: { name: "n3" } } } i wan't output privileged users template. this: <table> {{#each privileged_users}} <tr><td>{{../users.[this].name}}</td></tr> {{/each}} </table> is possible without additional helpers? if isn't how can write block helper changing context ../users.[this] ? register following helper: handlebars.registerhelper('lookupprop', function (obj, key, prop) { return obj[key] && obj[key][prop]; }); then modify template like: <table> {{#each privileged_users}} <tr><td>{{lookupprop ../users 'name'}}</td></tr> {{/each}} </table> here working fiddle . ...

cmake - Can CMakeLists.txt depend on a file parsed by a function? -

i rather new cmake, starting off first time larger project consisting of many subprojects. for particular reasons (described below curious) have set of include files contain info source files needed each cmake target (lib or exe) – and, now, prefer (re)use these files (reason described below) writing function parse these files , add content source files targets surprisingly easy task. but – problem: want have each targets cmakelists.txt depend on particular include file, generates list of source files, changes on include file detected if changes cmakelists.txt itself, can’t find references on how accomplish that. n.b.: found addfiledependencies adding dependencies on source files, not cmakelists.txt. however, cmake can figure out dependencies included .cmake file somehow, figured, should possible somehow. background curious: project (quite number of libraries used quite number of executable targets, organized subprojects) using qmake (without using qt itself) setting mak...

postgresql query with time difference -

i have table structure follows id name point last_updated refresh_frequency 1 'abc' 100 2015-08-28 01:00:00 24 last_updated datetime field , refresh_frequency int i want rows having last_updated value before refresh_frequency (in hours) current time, how write query this? select * tablename last_updated < now() - refresh_frequency * interval '1 hour';

python - Tkinter widgets not showing -

i'm beginner , getting tkinter basics. i'm following along tutorial, none of widgets appearing in window. no errors. import tkinter class pinger(tkinter.tk): def __init__(self, parent): tkinter.tk.__init__(self, parent) self.parent = parent def initialize(self): self.grid() button = tkinter.button(self,text="button") button.grid(column=1,row=0) if __name__ == "__main__": app = pinger(none) app.title('server pinger') app.mainloop() the window opens without issue , no errors shown. button widget found, nor other widget try. your issue according indentation function - initialize() - outside class . if function inside class , never call . in python, indentation important , used defining blocks . , should call initialize() function inside init () function . example - import tkinter class pinger(tkinter.tk): def __init__(self, parent): tkinter.tk.__init__(self, parent) ...

ios - MBProgressHUD not added to ViewController -

i using mbprogresshud , when adding self.view not visible. if add tableview visible. in other project used add self.view , it's working correctly. in view tableview present. can me issue ? i set layer.zposition of mbprogresshud view , it's visible.

how to disable missing '@override' annotation check in Android Studio -

Image
i want change codes, in run time compile classes. can't change codes of classes. i search , realized have option deactivate. option's path in eclipse : windows - preferences - java - compiler - errors/warning . can't find path , option in last version on android studio (1.2.1.1). please show me option ( missing '@override' annotation ), in last version of android studio. it in settings -> editor -> inspections . default should disabled

image - Measurements from a picture -

i´m trying recreate surrounding in unreal engine 4. sadly i´m total loser when comes math. took picture of building. know door in picture 183 cm high , 103 cm wide. there way calculate whole length of building when know size of door? or in other words: how calculate distances in picture when know measures of 1 object in picture? if have answer nice if described process come answer.

GCC 4.1.2 compiler or similar compiler for windows pc -

i in need of gcc 4.1.2 compiler windows.i don't know compilers.if gcc compiler not available windows then, there similar compilers windows? 1 please me out. if want real easy way , you'll have gcc 4.x installed in 2 clicks. download codeblocks + mingw http://prdownload.berlios.de/codeblocks/codeblocks-13.12mingw-setup.exe http://www.codeblocks.org/downloads/26 [updated link: did 1 without mingw]

c# - How to show Persian date in WPF DataGrid? -

how can change code (or somewhere else): <datagridtemplatecolumn x:name="timecolumn" header="time" isreadonly="true"> <datagridtemplatecolumn.celltemplate> <datatemplate> <datepicker selecteddate="{binding time, mode=twoway, notifyonvalidationerror=true, validatesonexceptions=true}"/> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> to show date in persian format? time in database in timestamp format. want "show it" in persian format, , have persian calendar if possible. if want show persiandatetime can use system.globalization.persiancalendar in view-model this: public string persiandate { { persiancalendar pc = new persiancalendar(); datetime thisdate = convert timestamp datetime here ...; return string.format("{0}, {1}/{2}/{3} {4}:{5}:{6}"...

javascript - How to select a value of a row in a table with jquery? -

i want value of row in table jquery, when user click on it. i have tried solution, doesn't work correctly: $(document).ready(function() { $.post("./php/myjson.php", function(data, status) { obj = json.parse(data); var trhtml = ''; (var = 0; < obj.giocatori.length; i++) { trhtml += '<tr><td><img src="../media/image/squadre/' + obj.giocatori[i].squadra.tolowercase() + '.png"/></td><td>'+obj.giocatori[i].giocatore+'</td><td>' + obj.giocatori[i].cognome + '</td><td>' + obj.giocatori[i].prezzo + '</td></tr>'; } trhtml+='</tbody>'; $('#records_table').append(trhtml); }); $( "#records_table tr" ).on( ...

javascript - Position a div at the bottom of an absolute div without using tables or positoin:absolute -

i working on webapp needs div pushed bottom of absolutely positioned div. have tried bottom: 0 , vertical-align: bottom neither of them working. there way move div bottom of parent div using css may not have thought of or sort of workaround done using javascript? #wrapper { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: rgba(0,0,0,0.5); z-index: 1000; } #outer { margin-left: 12.5%; margin-right: 12.5%; margin-top: 5%; margin-bottom: 5%; width: 75%; height: 75%; background: rgb(0, 0, 0); z-index: 1001; } #a { position: absolute; width: inherit; height: 100%; } #inner { bottom: 0; background-color: white; } .invert { color:white; } .revert { color:black; } .text-center { text-align:center; } <div id="wrapper"> <div id="outer" class="invert"> <div id="a"> ...

linux - socket - maximum limit of active sockets -

i'm using node.js ws (a socket library) handle sockets. , i've read this link claims vps machine can have 64k client per port. question is, how many active sockets can have on linux vps? there theoretical limit how many open sockets can linux vps handle? , bottle neck? ram? or bandwidth? when computer connects b, both need have single socket allocated. when server accepts connection, copies clients ip address , port new connection. means next client can connect on same socket. need 1 file descriptor on server operation, limit number of file descriptors per process can check ulimit command. a client needs socket initiate connection. each socket identified 16 bit integer. means can have @ 64k sockets on client side. since server socket "released" after connection established, can accept more 64k connections. in theory, can fill server ram file descriptors without problem. in practice, connections made exchange data. real bottleneck bandwidth. ...

ios - How to get the filename from the filepath in swift -

how filename given file path string? for example if have filepath string file:///users/developerteam/library/developer/coresimulator/devices/f33222df-d8f0-448b-a127-c5b03c64d0dc/data/containers/data/application/5d0a6264-6007-4e69-a63b-d77868ea1807/tmp/trim.d152e6ea-d19d-4e3f-8110-6eacb2833ce3.mov and return result trim.d152e6ea-d19d-4e3f-8110-6eacb2833ce3.mov thank help. objective c nsstring* thefilename = [string lastpathcomponent] swift let thefilename = (string nsstring).lastpathcomponent

armadillo how to get rid of error message -

running following code still produces error message goes stdout (not stderr) although exception caught: mat<double> matrix_quantiles(const vector<double> & quantiles, const mat<double> & m) { mat<double> sorted_matrix; try { sorted_matrix = arma::sort(arma::cor(m)); } catch(std::logic_error & e) { /* col constant, causing correlation infinite. if happens, add normal random jitter values , retry. */ const mat<double> jitter = mat<double>( m.n_rows, m.n_cols, arma::fill::randn); return matrix_quantiles(quantiles, 1.e-3 * jitter + m); } etc. the error message is: error: sort(): given object has non-finite elements the code runs fine, , jittering strategy enough do, have filter out error message if write output stdout. thank you. to disable printing of error messagaes, define macro named arma_dont_print_errors before including armadillo header. example: #defin...

angularjs - How to check webpage is available or not using javascript -

i want make web page request if web page available. have written app using angularjs + javascript. there way determine whether webpage available or not using javascript ? if page in question on different origin , can't without using server somewhere or relying on other page implementing cross-origin resource sharing , supporting origin, because of same origin policy . if page in question on same origin, can ajax call query it: var xhr = new xmlhttprequest(); xhr.open("head", url); xhr.onreadystatechange = function() { if (xhr.readystate == 4) { if (xhr.status == 200) { // worked } else { // didn't } } }; xhr.send();

javascript - Simple dynamic directives (with dynamic controllers and scope)? -

i have feel should simple problem. working within typescript + angular application. in controller, have array of similar directives i'd use. these panels i'm using throughout app. i'll give them various attributes controller , templateurl , data , etc. in controller: public panels: ipanelconfig[] = [ { controllername: "menucontroller", templateurl: "menu/menu.html", data: // object boring stuff in }, { controllername: "anothercontroller", templateurl: "another/this/is/arbitrary.html", data: {} } ]; in view , loop through each panel , use generic directive called panel handles rest of work. this: <div ng-repeat="panel in vm.panels"> <div panel paneldata="panel.data" templateurl="panel.templateurl" ctrl="panel.controllername"></div> </div> my custom panel dir...

javascript - How change require to import with key in ES6? -

this question has answer here: how import part of object in es6 modules 2 answers i whant write require es6 import. in case without key it's pretty ease do var args2 = require('yargs2'); -> import foo 'bar'; but key, can't find appropriate syntax: var foo = require('bar').key; how can that? the syntax importing member of module aliased name is: import {key foo} 'bar'; this equivalent var foo = require('bar').key; if want import member without aliasing it, syntax simpler: import {foo} 'bar'; is equivalent to: var foo = require('bar').foo; mdn article import statement

c++ - What is happening with this code? -

i'm trying develop android keyboard using android aosp keyboard source model. there's quite bit of jni code, c++ bit rusty, , i'm having trouble following definition macro nelems : // disclaimer: see compile error if use macro against variable-length array. // sorry inconvenience. isn't supported. template <typename t, int n> char (&arraysizehelper(t (&array)[n]))[n]; #define nelems(x) (sizeof(arraysizehelper(x))) when try compile, second line of code (just above #define ) lights error: declaration of reference variable requires initializer the error message makes sense me; aosp code not. symbol arraysizehelper occurs else in aosp code or make files (that is, far can tell it's not macro else). from name of macro, guess supposed evaluate number of elements in array. far know, though, usual way be: #define nelems(x) (sizeof(x) / sizeof((x)[0])) so i'm wondering if else going on here. i'd appreciate explanation of code sup...

robotics - ROS - ROAR compile error on Ubuntu -

i trying install roar on ubuntu 14.04 following tutorial: http://wiki.ros.org/roar however, stuck on compiling step 3.2 rosmake roar --rosdep-install error error: sudo: rosmake: command not found i downloaded svn co https://mediabox.grasp.upenn.edu/svn/penn-ros-pkgs/roar_stack/trunk ~/ros/roar_stack home directory, not /opt/ros , set path export ros_package_path=~/ros:$/home/myfolder/ros/roar_stack what doing wrong? update installed clean version of ubuntu 14.04 on vmware , installed ros jade , same problem persists.

cors - ODATA and $getJSON - SyntaxError: missing ; before statement -

i consuming odata service under development , running locally. getting consumed jquery using below code. javascript rendered nintex form hosted in sharepoint environment in different domain. browser used testing 'firefox' var url = "http://localhost:57368/odata/employeesleaves('340674')"; $.getjson(url + "?callback=?", function (data) { alert('coming...'); }); i can see json object in firebug/firefox, error in console 'syntaxerror: missing ; before statement "odata.metadata":" http://localhost:57368/odata/ $metadata#employeesleaves/@el' any highly appreciated! thanks neeraj matta the webapi service been accessed, cors not enabled on it. below link enabling cors on web service. http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

javascript - Referencing the anchor tag that was clicked: What am I doing wrong? -

i keep getting "cannot read property 'split' of undefined" , indicating me $(this) in below code undefined. why that? html: <tbody> <tr> <td><a class='edit-link' id='jobid-3'>motion designer</a></td> <td>2015-07-21 11:06:57</td> </tr> <tr> <td><a class='edit-link' id='jobid-2'>web developer</a></td> <td>2015-07-21 09:53:36</td> </tr> <tr> <td><a class='edit-link' id='jobid-1'>creative team manager</a></td> <td>2015-07-21 09:41:20</td> </tr> </tbody> js: <script type="text/javascript"> jquery('.edit-link').click(function() { { var thisjobid = jquery(this).attr('id').split('-')[1]; console.log("thisjobid = " + thisjobid); /...

javascript - prevent html5 video from being downloaded through inspect element -

we have module in our project there option of uploading mp4 videos , using html5 video tag player playing videos. problem facing privacy of videos.at time easy user download our file either through right click save video or taking url src of video tag inspect element. have studied lot, , got idea blob url through youtube videos not accesible through anyway. tried study blob-url, created 1 video url still accessible , can downloaded. youtube blob-url not working. studied ques question first answer, through got idea youtube mechanism of buffering video , how blob url shown in inspect element youtube spoof. most importantly want know how can spoof our website url no 1 can download through inspect element. possible , how? link related please share me.i have tried study lot still missing something. what mechanism youtube follow creating blob url , save videos? as video has arrive @ users device there no way can stop user intercepting , storing file if want to. the ty...

php - Database not configured laravel during migration -

this might repeated question. had no luck previous answers i git clone laravel project. tried php artisan migrate . returns below error. [invalidargumentexception] database [] not configured. and migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--package[="..."]] [--pretend] [--seed] my app/config/database.php this: 'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'upgrade', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), i create upgrade database in mysql . could tell me i'm doing incorrectly? thanks in advance. i had same issue. have clo...

mac-address in local network with (javaScript or PHP) -

so far know, cannot mac-address javascript or php - except ie users , if have activex. but here 2 similar scenarios: , think these not duplicate questions... 1) can mac-address of every user (windows, android, apple, etc.) if website hosted locally , people access form via wifi? , if yes, can done php/javascript? 2) can mac-address of every user (windows, android, apple, etc.) if want track users 1 network, site hosted on linux server somewhere else? , if yes, can done php/javascript? • in case need know why want this: online draw @ night club , track mac-addresses, can sign once every device. can mac-address of every user (windows, android, apple, etc.) if want track users 1 network, site hosted on linux server somewhere else? , if yes, can done php/javascript? this not possible. can mac-address of every user (windows, android, apple, etc.) if website hosted locally , people access form via wifi? , if yes, can done php/javascript? if the we...

java - How can I create an image placeholder of an image I am fetching from the web? -

i given image size, , want create placeholder of image size's ratio. simple solid gray color fine. you can create 1 in code this: bitmap b = bitmap.createbitmap(width, height, bitmap.config.argb_8888); canvas c = new canvas(b); paint p = new paint(); p.setcolor(color.gray); p.setstyle(paint.style.fill); c.drawrect(0, 0, width, height, p); but think it's easier create xml drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffcccccc"/> </shape> you can set on imageview using r.drawable id, , don't have worry memory use because android handling caching , that.

java - Spring RestTemplate - passing in batches of GET requests -

i need query server links can obtained giving server reference. lets have 10 references , want 10 links in 1 go in arraylist. is below efficient way it? looks pretty resource intensive , takes approximately 4672ms generate i looked @ docs resttemplate: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/resttemplate.html#getforentity-java.lang.string-java.lang.class-java.util.map- there doesn't seem easier way want do. arraylist<string> references = new arraylist<>(); arraylist<string> links = new arraylist<>(); resttemplate resttemplate = new resttemplate(); resttemplate.getmessageconverters().add(new stringhttpmessageconverter()); (int = 0; < 10; i++) { responseentity<string> resource = resttemplate.getforentity(references.get(i), string.class); links.add(resource.getbody().tostring()); } edit: based on suggestions, have changed code i'm getting error: "asynchronous execution requ...

pointers - In C, why can't an integer value be assigned to an int* the same way a string value can be assigned to a char*? -

i've been looking through site haven't found answer 1 yet. it easiest (for me @ least) explain question example. i don't understand why valid: #include <stdio.h> int main(int argc, char* argv[]) { char *mystr = "hello"; } but produces compiler warning ("initialization makes pointer integer without cast"): #include <stdio.h> int main(int argc, char* argv[]) { int *myint = 5; } my understanding of first program creates variable called mystr of type pointer-to-char, value of address of first char ('h') of string literal "hello". in other words initialization not pointer, define object ("hello" in case) pointer points to. why, then, int *myint = 5; seemingly not achieve analogous this, i.e. create variable called myint of type pointer-to-int, value of address of value '5'? why doesn't initialization both give me pointer , define object pointer points to? in fact, can using ...

javascript - How does asynchronous call work in AngularJS 1.X? $Http call not returning value -

i have following function named getvalue . inside angularjs module controller. trying call function on click event invoking function in controller.(i hope clear) function: function getvalue(data, $http) { var value=undefined; $http({ url: /myurl, method: "get", params: { tmp: data.tmp, pressure: data.pressure } }).success(function (data, status, headers, config) { value=parsefloat( console.log(data));//console working here return value; }); return value; } code inside controller value= getvalue(formdata, $http ); alert(value);//undefined here. seems value never changed. i have not getting value on alert console printing value. need if possible 2 issues. how can change value inside success , return controller? is there way don...

apache pig - How to check COUNT of filtered elements in PIG -

i have following data set in need perform steps based on car's company name. (23,nissan,12.43) (23,nissan car,16.43) (23,honda car,13.23) (23,toyota car,17.0) (24,honda,45.0) (24,toyota,12.43) (24,nissan car,12.43) = load 'data.txt' (code:int, name:chararray, rating:double); g = group (code, regex_extract(name,'(?i)(^.+?\\b)\\s*(car)*$',1)); dump g; i grouping cars based on code , base company name 'nissan' , 'nissan car' records should come in 1 group , similar others. /* grouped data based on code , company's first name*/ ((23,nissan),{(23,nissan,12.43),(23,nissan car,16.43)}) ((23,honda),{(23,honda car,13.23)}) ((23,toyota),{(23,toyota car,17.0)}) ((24,nissan),{(24,nissan car,12.43)}) ((24,honda),{(24,honda,45.0)}) ((24,toyota),{(24,toyota,12...

javascript - Executing .bat file using Java-script -

can me in finding solution executing batch file using java-script, working nw.js , tried couple of things worked .exe not .bat var execfile = require ('child_process').execfile, child; child = execfile('c:\\worklog\\software\\abc.exe', //works //child = execfile('c:\\pdfrotation\\run.bat', //not working a batch program not executable, might have use cmd.exe invoke batch file try like: var spawn = require('child-process').spawn; spawn('cmd.exe', ['yourfile.bat']);

Removing default classes from wordpress plugins -

for plugin installed wordpress, how can remove default classes, ids , wrappers. there snippet included in functions.php? or other way rid off default markup? you can manually editing plugins' files, , there no other way that. the fact should avoid editing plugins way, can break them. if think class, id or else optional, can still contact plugin's author (it's possible wordpress.org). if optional, maybe update plugin make optional.

c# - Automatically insert new record into child table when new record is added to parent table? -

i have 1 many relationship between idealog table , ideastatus table respectively. trying create application using lightswitch , c# allow user enter new idea idealog table. once record created want created in ideastatus table default status of submitted. far haven't been able find information online me this. nudge in right direction appreciated! in lightswitch server project: locate data sources. locate parent table (.lsml) , open it. up top locate "write code" , click drop down arrow on right. select appropriate event. e.g. idealog_inserted insert record ideastatus table using entityframework (or sql, etc)

ios - Circualr progress bar for Audio -

Image
now developing app includes music. on using avaudio player playing music. issue need show circular progress bar play/pause buttons. sample image attached this. how can achieve this. you can use components example llacircularprogressview or uaprogresssview and can lengh of audio : audioplauer.duration

java - Remote Database -

i tried creating app in java works remote database. apps works fine on local database. have included the port number well. scared may ip address using. i thought myself there may hundreds if not thousands of pc's around world same ip mine... , how internet see 1 am, or stay secure it. sure don't give remote access ip of computer of home network, may wrong... don't know. this function. public void db() { try { class.forname("com.mysql.jdbc.driver"); connection mycon = drivermanager.getconnection("jdbc:mysql://ipofwebsite:3306/databasename", "username", "password"); system.out.println("connected"); mycon.close(); } catch (exception ex) { ex.printstacktrace(); } } on remote db have added public ip address, still received error "c:\program files\java\jdk1.8.0_25\bin\java" -didea.launcher.port=7532 "-didea.launcher.bin.path=c:\program files (x86)\je...

How to change Optional field(Java 8 API) into Java 7 -

i have application taken github in java 8 api, namely optional keyword, used. environment run app setup jdk_7. hence, have 0 experience java 8 api, can give alternative code block of following sample code: public final static optional<string> reversegeocodefromlatlong(final double latitude, final double longitude) { final stringbuilder bingmapsurl = new stringbuilder(); bingmapsurl .append(bing_maps_url_start) .append(latitude) .append(",") .append(longitude) .append(bing_maps_url_middle_json) .append(constants.bing_maps_api_key_value); logger.debug("bingmapsurl==>{}", bingmapsurl.tostring()); httpurlconnection httpurlconnection; inputstream inputstream = null; try { final url url = new url(bingmapsurl.tostring()); httpurlconnection = (httpurlconnection)url.openconnection(); if(httpurlconnection.http_ok == httpurlconnection.getresp...

actionscript 3 - Action Script 3.0 -

/* here code .. word search game ...in word list array ...these questions find in grid in game...my questions how can type other languages in array or how can use other languages in grids */ import flash.display.*; import flash.text.*; import flash.geom.point; import flash.events.*; import flash.net.filefilter; import flash.filters.glowfilter; const puzzlesize:uint = 20; const spacing:number = 24; const outlinesize:number = 20; const offsetoint = new point(162.9,179.7); const offsettoint = new point(300,265); const spacingg:number = 36; const letterformat:textformat = new textformat("bamini",18,0x000000,true,false,false,null,null,textformatalign.center); // words , grid var wordlist:array; var usedwords:array; var grid:array; // game state var dragmodetring; var startpoint,endpointoint; var numfound:int; // sprites var gamespriteprite; var outlinespriteprite; var oldoutlinespriteprite; var letterspritesprite; var wordsspriteprite; startwordse...

Check if path is directory or file C# -

i tried check if path deleted directory or file path directory or file. found code: fileattributes attr = file.getattributes(@"c:\example"); if (attr.hasflag(fileattributes.directory)) messagebox.show("it's directory"); else messagebox.show("it's file"); however code not working deleted directory or file. i have 2 folders c:\dir1 c:\dir2 in dir1 there normal files "test.txt", in dir2 there compressed files "test.rar" or "test.zip" , need delete file in dir2 when file in dir1 deleted. something tried, nothing works. is possible achieve this? thanks! if object represented path not exist or has been deleted file system, you've got string representing file system path: it's not anything. the normal convention indicating path intended directory (rather file) terminate directory separator, so c:\foo\bar\baz\bat is taken indicate file, while c:\foo\bar\baz\bat\ is taken i...

Spark & Scala - NullPointerException in RDD traversal -

i have number of csv files , need combine them rdd part of filenames. for example, below files $ ls 20140101_1.csv 20140101_3.csv 20140201_2.csv 20140301_1.csv 20140301_3.csv 20140101_2.csv 20140201_1.csv 20140201_3.csv i need combine files names 20140101*.csv rdd work on , on. i using sc.wholetextfiles read entire directory , grouping filenames patters form string of filenames. passing string sc.textfile open files single rdd. this code have - val files = sc.wholetextfiles("*.csv") val indexed_files = files.map(a => (a._1.split("_")(0),a._1)) val data = indexed_files.groupbykey data.map { => var name = a._2.mkstring(",") (a._1, name) } data.foreach { => var file = sc.textfile(a._2) println(file.count) } and sparkexception - nullpointerexception when try call textfile . error stack refers iterator inside rdd. not able understand error - 15/07/21 15:37:37 info taskschedulerimpl: removed taskset 65.0, tasks...

javascript - Sending information to a php file from AJAX and getting a response back from php not when I want to -

i have contact page i'm working on , coded if invalid email sent through, php sends response, way coded now, sends message field missing or nothing filled in @ , clicks send. can view @ http://sundayfundayleague.com/contact.php i still want normal html5 'required' fields take place , if email field not right php else response.. "invalid email, please provide valid email address."; show up. how can this? if (filter_var($email, filter_validate_email)) { // line checks have valid email address mail($to, $subject, $message, $headers); //this method sends mail. echo "your email sent!"; // success message }else{ echo "invalid email, please provide valid email address."; } ajax call <script> $(document).ready(function(){ $('#submit').click(function(){ $.post("contactsend.php", $("#mycontactform").serialize(), function(response) { ...

amazon web services - s3 bucket configuration changes takes effect only to new folders -

hi using aws s3 buckets storing images, have changed bucket policy, access permission, , cors configuration bucket , effects new folders have created after changing configurations. old folders not affected new configuration. whats wrong this?

c# - How to handle WebApi error 404 -

Image
i'm implementing mvc 5 application webapi2 in same domain. problem how handle error 404 in webapi. i'm using routing in webapi. [routeprefix("myapi")] public class myapicontroller : apicontroller { [route("value")] public string myvalue() { return "value"; } } now have url "/myapi/value" returns value string. problem requested "/myapi/value/bla/bla" or url not in api, returns error 404. i tried link http://weblogs.asp.net/imranbaloch/handling-http-404-error-in-asp-net-web-api , applies in webapi project not in mvc + webapi project. please help. tia update: please read carefully!!!! this default page if don't handle 404 in webapi. includes here physical path. updated: i think following has better description on how implement error handling webapi 2+ project: http://www.asp.net/web-api/overview/error-handling/web-api-global-error-handling . there 2 problems had in projects when combining m...

How to avoid duplicate values in mysql? -

i have table 'table1' this: id org_id project_name project_id emp_id business_id first_name from_date 3862 62 'project1' 51 2 73 'employee1' '2015-01-01' 3864 62 'project2' 52 3 74 'employee2' '2015-03-18' 3866 62 'project2' 52 2 74 'employee1' '2015-06-22' i want unique employees. output should this: id org_id project_name project_id emp_id business_id first_name from_date 3862 62 'project1' 51 2 73 'employee1' '2015-01-01' 3864 62 'project2' 52 3 74 'employee2' '2015-03-18' any help!! it's easy do. id org_id project_name project_id emp_id business_id when you're creating table put unique constraint @ end of ...

c++ - How to fetch data from sqlite3 without using while 1 and if -

i'm using method of fetching data sqlite3 database: while(1){ rc = sqlite3_step(stmt); if(rc == sqlite_row){ ... } else if(rc == sqlite_done){ break; } } what not if else construct, looks rather clunky here. , besides, knows if else evil. so, there method of fetching data sqlite , like: while(sqlite3_step(stmt)){ ... } or, probably, there fetch method or similar that. i want know other people in real world projects. something should job, though sure check errors after exiting loop. while((rc = sqlite3_step(stmt)) == sqlite_row) { ... } edit: note doesn't account if database busy, can correct either conditional goto after loop, or outside loop continues while rc it's not equal sqlite_done .

angularjs - CSS Column strange behaviour (offsetting items) -

Image
i displaying number of tiles vary in height see below image , thought had solved issue without using masonry using css columns. tiles: my code : -moz-column-count: 2; -moz-column-gap: 4px; -webkit-column-count: 2; -webkit-column-gap: 4px; column-count: 2; column-gap: 4px; each tile has ng-click runs function - passing exercise object function. the column css offsetting tiles one. example if click on tip toe line walking - passed object side step across beam - offset 1 place in grid. if run normal css functions perfectly. why column css display correctly pass incorrect variable? edit works fine in safari on ipad.

scala - More concise way to class match and access last of Option[List] -

i have function parameter takes object , if of correct type need access last element in option[list[int]] . have working solution seems clumsy. in case there not items in obj.listofthings need have i have value 0. there better way achieve this? val = foo match { case obj: bar => obj.listofints match { case some(ints) => ints.last case _ => 0 } case _ => 0 } technically return option[int] . i'm still pretty new scala , learn better approaches sort of problems. in case seems ende neu suggested right way go: val = foo match { case obj: bar => obj.listofints.map(_.last /* throws exception when list empty*/).getorelse(0) case _ => 0 } but if you'll see have bug in code, in case that obj.listofints some(nil) , because in case nosuchelementexception trying call last on empty list. try code foo = bar(some(nil)) , see yourself. when use option[list] think if want. after thinking scrap ...

http - Change URLs into files (Parse.com using Javascript CloudCode) -

i need batch change number of image links (url's links exist within class in) image files (that parse.com hosts). cloud code (apparently) how it. i've followed documentation here haven't had success. what wanted is: take url link "column_1" make file upload file "column_1" (overwrite existing url). if dangerous- can upload new column ("column_2"). repeat next row this code did not work (this first time js): imgfile.save().then(function () { object.set("column_1", imgfile); return object.save(); }).then(function (classname) { response.success("saved object"); }, function (error) { response.error("failed save object"); }); can recommend how this? ok- works else trying. parse.cloud.job("convertfiles", function(request, status) { //cuts rundata out of poor runs function sleep(milliseconds) { var start = new date().gettime(); (var = 0; < ...