Posts

Showing posts from April, 2012

ruby on rails - couldn't find file 'gmaps-autocomplete' with type 'text/css' -

i trying use gem 'gmaps-autocomplete-rails' add autocomplete functionality address field in 1 of forms. have followed documentation error: couldn't find file 'gmaps-autocomplete' type 'text/css' after following documentation have in application.js file. //= require jquery //= require tether //= require bootstrap //= require jquery_ujs //= require_tree . //= require gmaps-autocomplete application.scss *= require_self *= require_tree . *= require gmaps-autocomplete application.html <head> <title>protesttrump</title> <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all' %> <script async defer type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script> <%= javascript_include_tag 'application' %> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/lib...

javascript - Home-made encryptor sometimes gets letters wrong -

i'm making homemade text encryptor , works fine - apart fact decrypts message incorrectly. please see code example (sorry it's messy, i'm starting html/js): to see make mistake, type 'hi there' message , 'moo123' key. don't ask why, trying random words when found issue. copy encrypted message text input same key press decrypt. says 'ho there' instead. can tell me why happening , how fix it? thank you! <!doctype html> <html> <head> <meta charset="utf-8"> <title>encryptor</title> <style> body { font-family: monospace; } input { font-family: monospace; width: 400px; } </style> </head> <body> <h1>encryptor</h1> <p>enter text encrypt:</p> <input type="text...

matlab - Chance level accuracy for clearly separable data -

i have written believe quite simple svm-classifier [svm = support vector machine]. "testing" distributed data different parameters, classifier returning me 50% accuracy. wrong? here code, results should reproducible: features1 = normrnd(1,5,[100,5]); features2 = normrnd(50,5,[100,5]); features = [features1;features2]; labels = [zeros(100,1);ones(100,1)]; %% svm-classification nrfolds = 10; %number of folds of crossvalidation kernel = 'linear'; % 'linear', 'rbf' or 'polynomial' c = 1; % c 'boxconstraint' parameter. cvfolds = crossvalind('kfold', labels, nrfolds); = 1:nrfolds % iterate through each fold testidx = (cvfolds == i); % indices test instances trainidx = ~testidx; % indices training instances % train svm cl = fitcsvm(features(trainidx,:), labels(trainidx),'kernelfunction',kernel,'standardize',true,... 'boxc...

c++ - What causes the Eclipse CDT Unresolved inclusion: <iostream> -

just installed latest eclipse ide , following included c++ user guide right 'before begin' section. the simple application completed once got makefile project , c++ file tutorials, got "unresolved inclusion: <iostream> " error , bunch of others related "cout, cin, endl" because of it. i followed tutorials instructed , not sure why occurred. have since corrected following this answer , want know why happens, since following official tutorial , have add c++ include path every project on eclipse? related question that first error in screenshot linked in comments provides clue problem. if go preference page mentioned in error's "location", you'll see there field called "command compiler specs" contents like: ${command} ${flags} -e -p -v -dd "${inputs}" this command eclipse tries run compiler output built-in include paths , other similar information. the fact you're getting error progr...

dataframe - R: transfer the pattern of data.table -

my original data mydf(no duplicated) : group hed_pfnpi id 1: aa 111111 18 2: aa 111111 17 3: aa 222222 18 4: aa 333333 14 5: aa 444444 13 6: aa 555555 18 7: aa 555555 24 8: aa 222222 13 9: aa 222222 17 10: aa 333333 17 11: bb 666666 9 12: bb 666666 3 13: bb 888888 9 14: bb 999999 14 15: bb 444444 13 16: bb 555555 9 17: bb 555555 24 18: bb 888888 13 19: bb 888888 3 20: bb 999999 3 and want transfer mydf result table: group 1 2 weight id_list 1 aa 111111 222222 2 17,18 2 aa 111111 333333 1 17 3 aa 111111 555555 1 18 4 aa 222222 333333 1 17 5 aa 222222 444444 1 13 6 aa 222222 555555 1 18 7 bb 444444 888888 1 13 8 bb 555555 666666 1 9 9 bb 555555 888888 1 9 10 bb 666666 888888 2 3,9 11 bb 666666 9...

python - Efficient way to find the paths with highest average edge value between two points in a pandas dataframe? -

pardon seemingly confusing phrasing of question. here i'd do. given dataframe df fruit1 fruit2 weight orange apple 0.2 orange grape 0.4 orange pineapple 0.6 orange banana 0.8 apple grape 0.9 apple pineapple 0.3 apple banana 0.2 grape pineapple 0.1 pineapple banana 0.8 and constraint highest allowed path length, l i wish return dataframe has highest average path (i.e. summation of edges between points/path length maximum), edge represented weight column, given not exceed length l. to illustrate example of mean highest average path: let's have 4 points a, b, c & d. interested in finding highest average path between & d. the highest average path max( (a->d)/1, (a->b + b->d)/2, (a->c + c->d)/2, (a->b + b->c + c-> d)/3, (a->c + c->b + b-> d)/3 ) in case of l=3 for l=2, max( (a->d)/1, (a->b + b->d)/2, (a->c + c->d)/2 ) in ...

rest - HTTP 400 "redirect_uri_mismatch" error when trying to authenticate to Google Cloud with Postman -

Image
i'm using postman authenticate google cloud i'm receive http 400 error redirect_uri_mismatch when request token. values i'm using below: i looking @ another reply on stackoverflow , wondering if creating web application client id postman in gcp project resolve issue? have configured callback/redirection url on gcp correctly? should https://www.getpostman.com/oauth2/callback

android - ORMLite trying to load field without @DatabaseField annotation -

i have 2 classes following: @getter @setter @noargsconstructor @databasetable(tablename = "condicao_ambiental") public class condicaoambiental { @expose @databasefield(id = true, columnname = "id") private uuid id; @expose @databasefield(datatype = datatype.date_long) private date datacriacao; @expose @databasefield(columnname = "idusuario", foreign = true, foreignautorefresh = true) private usuario usuario; ... } and @getter @setter @noargsconstructor @databasetable(tablename = "usuario") public class usuario { @expose @databasefield(id = true, columnname = "id") private uuid id; @databasefield(foreign = true, columnname = "idcliente") private cliente cliente; @databasefield private string nome; @databasefield private string login; private string senha; ... } th...

network programming - Basic Distributed Counter using Java Sockets -

i have java processes(socket programs) running on different servers, on same network , on different networks. these processes have job maintain global counter . client can connect of these processes , issue command increase , decrease or get counter value. global counter should consistent( network partition can occur , can recover it). the solution have thought of far maintain count of increments , decrements on each node nodes. when increment command issued on node, increments own local copy of counts of increments , broadcasts increment , decrement count. nodes receive broadcast take max of received counts , local copy of sender's counts , stores result latest count. when get command issued on node gives difference of sums of increments , decrements. assume take care of cases broadcasts received out of order , other unreliabilities. don't want use persistence layer. is there better way implement this? protocol should use broadcast counts? gossip on udp work? ...

python script for finding files from a list -

i trying write unix script. purpose of script read list.txt file contains various file names without extension. once reads list, need go through files in directory , sub-directory locate files listed extension *.doc or *.pdf. if finds files same file name , extension, creates file found.txt , if files not found creates notfound.txt. both these files (found , not found have file names list.txt have not been found). i tried using grep command, requires me have updated list everytime search. avoid maintain list , directly directory , sub-directories. suggestions welcome. current code. used find , fgrep think have wrong. find . -name "*.doc" > output.txt -print0 | xargs -0 fgrep -f my-search-file.txt > my-result-file.txt thank you.

node.js - TypeScript + NodeJS readline property missing -

i'm working on small project in typescript tsc -v 2.4.2 , node v6.10.3. i capture keypresses in cli, tried import * readline 'readline' , later use readline.emitkeypressevents(process.stdin) , complains the property emitkeypressevents not found on typeof readline . i have done npm install --save @types/node . here's m(n)we: import * readline "readline"; import {sigint} "constants"; export class inputmanager { private _currentstates: array<ikeyentity>; private _oldstates: array<ikeyentity>; public constructor() { // throws error, won't compile readline.emitkeypressevents(process.stdin); } public handleinput() { if (process.stdin.istty) process.stdin.setrawmode(true); process.stdin.on('keypress', (str: string, key: any) => { process.stdout.write('handling keypress ['+str+']'); if (key && k...

python - how to map latitude/longitude to a specific US county? -

i have dataframe containing u.s. latitude , longitude coordinates. i create variable shows respective u.s. county includes these coordinates. how can in r/python? thanks! you use geopy . example documentation using nominatim (open street map): >>> geopy.geocoders import nominatim >>> geolocator = nominatim() >>> location = geolocator.reverse("52.509669, 13.376294") >>> print(location.address) potsdamer platz, mitte, berlin, 10117, deutschland, european union >>> print((location.latitude, location.longitude)) (52.5094982, 13.3765983) >>> print(location.raw) {'place_id': '654513', 'osm_type': 'node', ...} the raw output has dict key country , if 1 can found.

php - convert image to base 64 string with Laravel -

i want convert image base 64 laravel. image form . tried in controller: public function newevent(request $request){ $parametre =$request->all(); if ($request->hasfile('image')) { if($request->file('image')->isvalid()) { try { $file = $request->file('image'); $image = base64_encode($file); echo $image; } catch (filenotfoundexception $e) { echo "catch"; } } } i only: l3rtcc9wahbya0nqqlq= laravel's $request->file() doesn't return actual file content. returns instance of uploadedfile -class. you need load actual file able convert it: $image = base64_encode(file_get_contents($request->file('image')->pat‌​h()));

Keras LSTM dense layer multidimensional input -

i'm trying create keras lstm predict time series. x_train shaped 3000,15,10 (examples, timesteps, features), y_train 3000,15,1 , i'm trying build many many model (10 input features per sequence make 1 output / sequence). the code i'm using this: model = sequential() model.add(lstm( 10, input_shape=(15, 10), return_sequences=true)) model.add(dropout(0.2)) model.add(lstm( 100, return_sequences=true)) model.add(dropout(0.2)) model.add(dense(1, activation='linear')) model.compile(loss="mse", optimizer="rmsprop") model.fit( x_train, y_train, batch_size=512, nb_epoch=1, validation_split=0.05) however, can't fit model when using : model.add(dense(1, activation='linear')) >> error when checking model target: expected dense_1 have 2 dimensions, got array shape (3000, 15, 1) or when formatting way: model.add(dense(1)) model.add(activation("linear")) >> error when checki...

hiveql - In Hive, Combining JOIN and IN CLAUSE in Single query -

can in single query, want filter client partners - tabular & omni reports table , retrieve matching client partner message t1 & t2 tables i cannot use in clause within hive throws error select c.client_partner_name,c.client_partner_message_id reports c c.client_partner_message_id in (select a.client_partner_message_id t1 union select b.client_partner_message_id t2 b) , client_partner_name in ('tabular','omni') tabular format: t1 client_partner_name client_partner_messsage_id vin partner1 msg1 vin1 partner3 msg2 vin2 t2 client_partner_name client_partner_message_id vin partner1 msg9 vin6 partner2 msg10 vin7 reports client_partner_name vin client_partner_message_id partner1 vin1 msg1 partner3 vin2 msg2 partner1 vin6 msg6 partner2 vin7 msg7 partner2 vin8 msg8 partner2 vin9 msg9 partner3 vin10 msg10 expected output client_partner_name vin client_partner_mes...

ios - Trying to get steps using HealthKit but it's always returning 0.0 -

i'm trying steps half hour ago , i'm using method discussed here . following code: func getsteps(completion: @escaping (double) -> void) { let stepsquantitytype = hkquantitytype.quantitytype(foridentifier: .stepcount)! let = date() let calendar = calendar.current let halfhouragodate = calendar.date(byadding: .minute, value: -30, to: now) if let date = halfhouragodate { let predicate = hkquery.predicateforsamples(withstart: date, end: now, options: .strictstartdate) let query = hkstatisticsquery(quantitytype: stepsquantitytype, quantitysamplepredicate: predicate, options: .cumulativesum) { (_, result, error) in var resultcount = 0.0 guard let result = result else { completion(resultcount) return } if let sum = result.sumquantity() { resultcount = sum.doublevalue(for: hkunit.count()) return } dis...

c++11 - How to create nice-to-use type-checked aliases for primitive types in C++? -

this question has answer here: discriminating between typedefs same type in c++ 2 answers i'm writing code i'm creating multiple aliases primitive types, e.g. address , id being int s. i want avoid using addresses , ids together, e.g. in arithmetic operations. thus have type-checking on these aliases, following result can obtained: typedef int a; typedef int b; f(a a) { return a+a; }; int main() { a = 5; b b = 5; f(a); // work... f(b); // , not compile. } now not work, know can use wrapper struct/class 1 member: class { public: int x; a(int xx) { x = xx; }}; class b { public: int x; b(int xx) { x = xx; }}; f(a a) { return a(a.x+a.x); }; // ugly , i'd want able use: return a+a int main() { a = 5; b b = 5; f(a); // work... f(b); // won't compile... } my question is - what's best way can code working...

How does the Brave browser have Chrome's dev-tools? -

Image
really quick question: why brave browser have chrome's dev-tools? does mean don't need test website in brave if works in chrome? thanks :) take @ github page. tags added: notice word " electron ", explain electron have excellent explanation on about electron page : electron open source library developed github building cross-platform desktop applications html, css, , javascript. electron accomplishes combining chromium , node.js single runtime , apps can packaged mac, windows, , linux. as can see, electron uses "chromium". explain but.... you've guessed offer great explanation themselves : the chromium projects include chromium , chromium os, open-source projects behind google chrome browser , google chrome os, respectively. site houses documentation , code related chromium projects , intended developers interested in learning , contributing open-source projects. so thats why can access chrome dev...

c++ - Class member function address -

edit how in way related supposed post? both different errors, guys should stop trying farm rep so i've been searching around google , stackoverflow couldn't find 1 solution case. have d3d9device pointer , want endscene address of device, how approach so? dword aendscene = *(dword*)(&d3ddev->endscene); won't work following error '&': illegal operation on bound member function expression i think that's wrong because i'm trying address of d3ddev class member function pointers not per object, per type. in example, have multiple instances of idirect3ddevice9 , of have same pointer value endscene member function (assuming aren't different concrete types - isn't likely). the specific error getting because attempting address of pointer-to-member function object, isn't valid (eg. see '&' illegal operation on bound member function expression error ). it possible value of member function using type, instea...

imagej - Macro language equivalent to "Image > Adjust > Brightness/Contrast... > Apply" -

i trying write imagej macro , need duplicate happens when use "image > adjust > brightness/contrast... > apply" on image neither 8-bit nor rgb. have tested 16-bit grayscale , confirmed doing using gui does, in fact, change pixel values. however, when try use commands listed in recorder, gives me error message stating supposed limitations described in documentation . true both macro language ('run("apply lut")') , java ('ij.run(imp, "apply lut", "")'). output of recorder incorrect, missing else, or bug works using gui?

javascript - Clean all cache of current webpage via HRO (AJAJ)? -

when 1 runs in javascript console location.reload(true); browser fully refresh webpage (afaik, sessionstorage cache related webpage, deleted). is there way delete such cache, without refreshing webpage, sending request hro (via ajax or ajaj)? please share vanilla example without jquery.

mysql - Does using the WordPress get_results() database function prevent sql injection -

couldn't seem find answer wondering if following query database vulnerable sql injection. $searchpostresults = $wpdb->get_results($querysearchvals, object); this query used: global $wpdb; $offset = (isset($_post["moresearchresults"])) ? $_post["searchoffset"] : 0; $querysearchvals = " select distinct post_title, id {$wpdb->prefix}posts ("; $svals = array(); $svals = explode(" ", $searchval); $lastindex = intval(count($svals)) - 1; $orderbycasevals = ""; for($i = 0; $i<count($svals);$i++) { $querysearchvals .= " post_title '%$svals[$i]%' "; if($i != $lastindex) $querysearchvals .= " or "; $orderbycasevals .= " when post_title '%$svals[$i]%' ($i + 2) "; } $querysearchvals .= ") , {$wpdb->prefix}posts.post_type = 'post' , post_status = 'publish' order case when post_title '%$searchval%...

java - Does Object's constructor call super()? Which superclass constructor would that call? -

this question has answer here: what default constructor in class object do? [duplicate] 3 answers if object class contains default constructor generated compiler must have super(); declaration. if declaration there parent class constructor calling? , how? because object parent of classes, think if call super(); in object class constructor should give compile time error because know object doesn't inherit anything. class test { test() { super(); } public static void main(string[] args) { test t = new test(); } } no. jls-8.8.9. default constructor says (in part) if class being declared primordial class object , default constructor has empty body. otherwise, default constructor invokes superclass constructor no arguments.

r - Predicted(?) values from an lmer model -

i have data frame of bird counts. have participants id number, number of birds counted, year counted them, lat , long coordinates, , effort. have made model: model = lmer(count~year+lat+long+effort+(1|participant), data = df) i want model plot predicted values same data set. so, data 1997-2017, , want model give me predicted values each year. want plot these, final plot have predicted count on y-axis, , year (categorical) on x-axis. each year have 1 data point w/ confidence interval. i have tried figuring out predict() , i'm not quite sure how use want. seems need new data frame, don't have new data set run through model predict future count. want model go , work on previous data put already, based off of beta values in output of summary(model) . i found thread, , seems i'm looking do, can't sjplot dependencies download, sjlabelled throws error every time: how plot predicted values standard errors lmer model results? you try ggeffects-package , us...

php - how to encrypt jwt in python without [JWT - PyJWT] modules -

i want php code :- <? function base64encrypt($data) { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } $header = ['alg'=>'hs256','typ'=>'jwt']; $eheaders = base64encrypt(json_encode($header)); $payload = ['sub'=>'joe']; $epayload = base64encrypt(json_encode($payload)); $secret = 'secret'; $hash = hash_hmac('sha256',"$eheaders.$epayload",$secret,true); $signature = base64encrypt($hash); $jwt = "$eheaders.$epayload.$signature"; print $jwt ; ?> but in python not php :( jwt - pyjwt modules doesn't work :( from pyjwt module code :- import jwt print jwt.encode({'some': 'payload'}, 'secret', algorithm='hs256') error :- traceback (most recent call last): file "c:\users\acer\jwt.py", line 1, in import jwt file "c:\users\acer\jwt.py", line 2, in print jwt.encode({'some...

How do I divide a camel case string in Ruby? -

i'm using ruby 2.4. want create new string camel-case string inserting spaces before capital letters. if have abcdef i want result of abc def whereas if have string of just abcdef then nothing should happen. string of abcdefg should result as abc defg i tried below def format_camel_case_str(str) if str.present? && str.length > 1 && str !~ /[[:space:]]/ && !str.upcase.eql?(str) && str[0].upcase.eql?(str[0]) && str[1..str.length] =~ /[a-z]/ str = "#{str[0..(str.index(/[a-z]/) - 1)]} #{str[str.index(/[a-z]/)..str.length]}" end str end but returns input twice. also, should consider case of string "aaabbbccc" (should "aaa bbb ccc"). this 1 little bit harder read, since it's regex, example cases can done with: gsub(/(?<!\a)(?<char>[a-z])(?=[a-z])/, ' \k<char>') ['abcdef', 'abcdef', 'abcdefg', ...

php - add extra info box to wordpress post. plugin? -

Image
is there plugin of sort or code of sort add in box wordpress "add new post section"? want able have product im selling on wordpress page, , want "content box" can put in description product. , pull in description using shortcodes or something. for example, if have. is there plugin adds in content box can pull content in wordpress loop? basically this, green box second content box content not visible unless use shortcode in loop. something like. wordpress loop... code code..... <?php extra_product_info(); ?> end loop... and add in text 2nd content box. hope makes sense or if can steer me in right direction

ios - Refresh Token AWS Cognito User Pool, Code Block Not Even Running -

i attempting refresh users tokens, , doing in "child" app has access idtoken, accesstoken, refreshtoken, , user's information aside password. sandboxed , cannot communicate main app. i have attempted following code run initiateauth let authparams = [ "refresh_token": user.refreshtoken, "secret_hash": config.getclientsecret() ] let provider = awscognitoidentityprovider(forkey: config.getclientsecret()) let req = awscognitoidentityproviderinitiateauthrequest() req?.authflow = awscognitoidentityproviderauthflowtype.refreshtoken req?.clientid = config.getclientid() req?.authparameters = authparams provider.initiateauth(req!).continuewith() { resp in print("i'm not running") if (resp != nil) { print(resp.error.debugdescription) } else { print(resp.result.debugdescription) } return nil } shockingly enough, continuewith block of code doesn't run @ all, , print statement "i...

Why some softwares require admin right to RUN? Is there any legit reason behind it? -

i've notice software (usually custom made software or made small company) require admin right run it. these software not utility software interact os, accounting software, load stability calculation software,etc. popular software microsoft office, adobe photoshop, chrome, etc doesn't require admin right run, way more complex these custom made software, yet still not require admin right run. i'm not programmer nor having programming knowledge, don't know if there real reason why developer made software require admin right run. reason ask is, i'm dealing 1 of software house claim software absolutely need admin right ensure software run properly. thank you

ios - How to user UserDefaults to Save Logged in state? -

i'm making introdution app, in swift 4 ran intro problem. have introcontroller , homecontroller view,root view introcontroller want if user logged in homecontroller introcontroll, whenever user open app, first view appear homcontroller, ( don't need login again ). i think store login state inside of userdefaults, don't want app use navigation, idea? please help thanks in advance when make login save bool value this: userdefaults.standard.set("1", forkey: "islogin") in appdelegate check login state this: if userdefaults.standard.value(forkey: "islogin") != nil{ //navigate homeviewcontroller }else{ //navigate rootviewcontroller }

firebase messaging token returns null javascript -

i'm following instruction here , cannot token firebase messaging: gettoken returns null . since cannot include firebase srcipt in stackoverflow snippet, here's code: js: // initialize firebase var config = { apikey: "aizasycmlkvlzbv5peluzg99hzjm0h6cqskvqwe", authdomain: "rps-multiplayer-6e91f.firebaseapp.com", databaseurl: "https://rps-multiplayer-6e91f.firebaseio.com", projectid: "rps-multiplayer-6e91f", storagebucket: "", messagingsenderid: "879810800461" }; firebase.initializeapp(config); var bigone = document.getelementbyid('bigone'); var dbref = firebase.database().ref().child('text'); dbref.on('value', snap => bigone.innertext = snap.val()); //firebase message const messaging = firebase.messaging(); messaging.requestpermission() .then(function() { console.log('have permission'); return messaging.gettoken(); }) .then(function(token) { ...

javascript - Pushing objects with the same values to Array -

given have , array of objects: let objects = [ {name: 'bob'}, {name: 'foo'}, {name: 'bar'}, {name: 'foo'}, {name: 'foo'} ] how can transform array one: let objects = [ [ {name: 'bob'} ], [ {name: 'foo'}, {name: 'foo'}, {name: 'foo'} ], [ {name: 'bar'} ] ] higher order functions you use array .reduce() method iterate on array , put each object array in working object keyed off name property, afterwards use object.values() convert working object array of arrays: let objects = [ {name: 'bob'}, {name: 'foo'}, {name: 'bar'}, {name: 'foo'}, {name: 'foo'} ] let result = object.values(objects.reduce((a,c) => { if (!a[c.name]) a[c.name] = [] a[c.name].push(c) return }, {})) console.log(result)

ios - Check if line break in the UILabel -

this question has answer here: how find actual number of lines of uilabel? 7 answers figure out size of uilabel based on string in swift 2 answers i have problem using uilabel. set line count 0. when label receives big string value, occurred line break, problem when height of label, height comes smaller should, comes value line only, shown string 2 lines. i have tried use code below, no avail. let originalheight = label.frame.size.height label.sizetofit() //or label.layoutifneeded() let newheight = label.frame.size.height originalheight , newheight equals. if line break made using character \n , above code works. // mark: - getting dynamic height of string convenience init(for bodytext: string, width: cgfloat) { if (bodytext.characters.count ?? 0) <= ...

jquery - function that checks if a radio button is check/not-checked in javascript -

this question has answer here: how can check whether radio button selected javascript? 23 answers hey i'm stumped on rewriting function jquery javascript. function have written works great issue is, has written in plain javascript. here function have written: function checkfunc() { if ($('input[type="radio"]:checked').length === 0) alert("not checked"); else alert("checked"); } i need function work same way need in javascript! appreciated. thanks! simply document.queryselectorall function checkfunc() { if (document.queryselectorall('input[type="radio"]:checked').length === 0) alert("not checked"); else alert("checked"); } checkfunc() <input type="radio" checked> <input type="radio">

Java Error - java: class, interface, or enum expected -

would able advise me on causing java error in basic program trying write? the error received says: error:(27, 1) java: class, interface, or enum expected here code below package name. import java.util.scanner; public class main { public static void main(string[] args) { scanner kbd = new scanner(system.in); string s = ""; boolean isok = true; while (isok) { system.out.print("key in numeric string (enter minus sign - quit): "); s = kbd.nextline(); char c = s.charat(0); if (c == '-') { isok = false; system.out.print("you have quit program."); return; } } } } } you have closing brace remove last '}' . i tested code manually, simple, works fine.

javascript - How can hide name when sending through Js -

i sending data way on anchor hover showing table name how can hide table name , access name in function : <a href='javascript:item(1,'name');'> </a> $list->table_name showing table name on hover of anchor how can hide , access same name in item function. you can use data-* attribute. hide on hover on dom . <a href='javascript:item(".$list->id.");' data-table-name='\"".$list->table_name."\"'> </a> the output should ( when $list->id = 1 , $list->table_name = my_table ): <a href='javascript:item("1");' data-table-name='my_table'> </a> then can access using javascript element.getattribute() function. ex: var e = document.getelementbyid('some-id'), tablename = e.getattribute('data-table-name'); console.log(tablename); // my_table <a id="some-id" href='javas...

javascript - Installing js file using npm -

Image
i trying install .js package using npm getting error repository right in git. command. npm install -s apiconnect-cli-logger/logger.js and getting following error if trying install file system point absolute or relative path contains package.json file npm install -d ../foo if sre installing git use https url use clone npm install -d whsthever.git take @ docs: https://docs.npmjs.com/cli/install

Integrating Cordova plugin in Outsystems -

i'm using open source plugin named tesseract ( link ) in outsystems project. i'm making required changes, , made 2 client actions follows: loadlanguage: tesseractplugin.loadlanguage($parameters.language, function(response) { $resolve(response); $parameters.response = response; }, function(reason) { $reject('error on loading ocr file language. ' + reason); $parameters.reason = reason; } ); recognizetext: tesseracttext.recognizetext($parameters.imagedata, $parameters.language, function(recognizedtext) { $parameters.text = recognizedtext; }, function(reason) { $reject('error on recognizing text image. ' + reason); $parameters.reason = reason; } ); i have added url extensibility configurations, keep getting error: tesseractplugin not defined. how fix it? i apologize if i'm stating obvious things have done already, people forget obvious. so... 1) make sure extensibility configurations in espace created plugin in fo...

multithreading - BASH: Run two commands in parallel and wait for the second one to finish -

i have 2 commands, 1 logging things in background , won't stop until kill , second 1 stop. let's mark them , b respectively. i want execute: a , b in parallel wait b finish kill a [do more stuff] and repeat in loop. i'm running on macos , can't update bash 4.x because of gplv3. preferably (the logger) start first wouldn't mind if it's undefined or b start first since difference in time negligible. help appreciated. thanks

Python, Cv2, numpy to indicate areas in a picture/image -

i want specify areas in image. to specify 1 area can this: import cv2 import numpy np the_picture = cv2.imread("c:\\picture.jpg") target_area = the_picture[300:360, 130:280] the type of target_area type 'numpy.ndarray'. but list of coordinates problem. struggling in turning list of coordinates values required. what want is: the_picture = cv2.imread("c:\\picture.jpg") list_of_areas = [ [300:360 , 130:280] [300:360 , 440:540] [400:460 , 0:130] [400:460 , 250:400] [400:460 , 560:740] area in list_of_areas: the_picture(area) ### failed here coordinates: x y x1 y1 area1 130 300 280 360 area2 440 300 540 360 area3 0 400 130 460 area4 250 400 400 460 area5 560 400 740 460 i tried give list below doesn’t work. tried make them strings in list, changed square brackets round brackets neither worked. syntaxerror: invalid syntax what’s proper way give coordinates? if understo...

Storing project gloal forms/classes in C# -

i working on 20 year old program written multiple programmers apparently didn't know comments exist (also code in german). in project there multiple forms , classes global projects in solution (for example choose project, choose file, enter name...) right these forms stored in whatever project programmer had open @ time makes annoying find anything. how go storing forms global of projects of solution (can opened , used project)? create new project store them? there better ways in visual studio? how handle storing global forms/classes in general? thanks help! the ideal approach separating reusable code non-reusable code platform dependent , platform independent code. require create project shared among other projects within same solution. i.e. shared: foo - reusable class library/portable class library (pcl) (platform independent) bar - reusable forms project (platform dependent) main: forms project uses bar forms project b uses foo & bar w...

Firebase Passing State(continue to website link) in Password Reset Email and email verification -

i using firebase user authentication in website. trying build password reset flow user receives password reset email, reset's password , redirect website given url. problem: able send password reset email , change password account when click continue button provided firebase.it throws following error in browser console. uncaught domexception: failed execute 'assign' on 'location': 'https://?link=http://mywebsite.com/?email%3duser@example.com' not valid url. i getting same error email verification link also. the url whitelisted in firebase's authorized domains. please me! are passing canhandlecodeinapp true? means want reset link open in mobile app if installed. if so, looks fdl domain not configured (it resolving empty string). should go dynamic links section in firebase console , setup/agree terms of service. update link like: https://example.app.goo.gl/?link=.... able see domain in console dynamic links section. otherwise...

Not able to parse inner elements of XML using DocumentBuilderFactory in Java -

i'm having response xml. i'm trying parse xml object inner details. im using documentbuilderfactory this. parent object not null, when try deepnode list elements, returning null. missing anything here response xml responsexml <datapacket request-id = "1"> <header> </header> <body> <consumer_profile2> <consumer_details2> <name>david</name> <date_of_birth>1949-01-01t00:00:00+03:00</date_of_birth> <gender>001</gender> </consumer_details2> </consumer_profile2></body></datapacket> and im parsing in following way documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); inputsource = new inputsource(); is.setcharacterstream(new stringreader(responsexml)); // consumer details. if(doc.getdocumentelement().getelementsbytagnam...

sql - How to store semicolon separated long string into multiple columns? -

basically due restriction on live server, cannot use text file need hard code data in t-sql code. so first created string text file this: ("001122;sale item 1", "001123;sale item 23", "001124;sale item 24", .... ) i have table structure: declare @product table(productcode int not null, description nvarchar(100) not null) first need store code , description in table variable. once that's done, can map physical table , update records. how can achieve similar to: insert @product(productcode, description) values ("001122;sale item 1", "001123;sale item 23", "001124;sale item 24", .... ) code description 001122 sale item1 001123 sale item2 001124 sale item3 i crated sample you, please check this declare @questions varchar(100)= '"001122;sale item 1", "001123;sale item 23", "001124;sale item 24"' declare @myxml xml = n'<h...

Poloniex APi to Google Sheet CSV via Json -

Image
i've got following script pulls keys poloniex json output, doesn't put actual data corresponds keys actual sheet...it puts keys titles @ top of sheet. i'm new api's, , gas, , coding in general, i'm sure i'm missing incredibly obvious, i'd appreciate if point out what. thanks in advance function bitcoin_frompolo_tocsv() { //link script spreasdsheet using identifier found in spreadsheet url var ss = spreadsheetapp.openbyid('1cubxxxxxxxxxxxxjdqm'); var apipullsheet = ss.getsheetbyname("apipull"); // clear columns a,b,c,d apipullsheet.getrange('a2:d19999').clearcontent(); var url = "https://poloniex.com/public?command=returnchartdata&currencypair=btc_eth&start=1502344800&end=9999999999&period=14400"; //fetch pulls data url var responseapi = urlfetchapp.fetch(url); //parse json var parceddata = json.parse(responseapi.getcontenttext()); //break parsed data fields //de...

Python JQUERY like syntax to mimic Unix Shell Pipelines -

i not sure if has been asked before, wondering how can implement "set oriented" syntax in python mimic unix shell pipelines. in particular, how use "plain python functions" can produce, modify, or consume stream of records, , can glued using "." operator. a straightforward example assuming python functions unix programs: in unix can do: ls | egrep '^a' | wc -l to count files in current directory start 'a'. how about: unixtools import * ls().egrep('^a').wc(countlines=true) and implementation of ls generator: @pipeline def ls(): file in glob.glob("*"): yield file i have omitted obvious glue code, make possible connect ls other "commands" of pipeline. @pipeline attempt use decorators convert plain python function member of pipeline protocol. i realise can done using traditional syntax of python, less readable forcing write in reverse, , more error prone...

Different image file format samples -

in our own software support loading of different kind of images, including not limited .bmp, .gif, .tiff, .jpg, , .png. in code i've noticed of images might using color indexing , looks 1 of our image manipulation library missing of patches (lost upon time). i test our software against such odd image formats (we loading .png , .jpg ok), can recommend me set of images, can download lot of different image file formats different saving options. so color indexed .png's / .tiff's / .bmp's included @ least. although question off-topic want give advice. websearch yield useful if out there, asking here doesn't make sense. what plan is: random collection of images in various formats , hope software handle them properly. what want tell user if software fails? "sorry mate particular use case not part of random image collection found online testing?" what should do: create test samples every format software claims support. each supported fo...

json - Android : How to access a JSONObject -

i'm new android , have tried many options access jsonobject returns api call couldn't succeed of solutions looked didn't work me. what want access jsonobject , keep id & name in array. , populate names in autocompletetextview . how access jsonobject . please me this. i'm stuck on more day. following code handling jsonobject. @override public void processfinish(jsonobject output) { toast.maketext(mainactivity.this,"processfinish",toast.length_short).show(); allstations = output; if(output != null){ toast.maketext(mainactivity.this,output.tostring(),toast.length_short).show(); }else{ toast.maketext(mainactivity.this," connection failed!",toast.length_short).show(); } } following sample output of jsonobject { "success": true, "message": "found 398 results!", "nofresults": 3, "results": { "stationlist": [ ...

java - Firebase onMessageReceived not called when app is Killed -

it's been trending topics firebase cloud messaging data payload message not fired onmessagereceived () method lower end device. , it's true. here result. app killed scenario devices got data payload:: 1. nexus 5s : os 7.1 device not data payload:: 1. xiomi mi 4c: os 5.1 2. huawei lua -u22 :os 5.1 ensure i'm not sending notification key server / postman. i looking solution, got data payload firebase including types of devices , android os & api level 15. postman details follows. { "registration_ids": ["fc5uxgsrcsg:apa91bhh9fmxq41lpx6tjjssbkgrktwypzkimldzvbgshdpo2pq87jhqogup2kqrmji06sig_p6dfgrcim23ifzlbqairgtmdqrw4s39zuqv9czypqzxvl5ptnhprds4oagtutepnydi"], "data": { "title" : "my_custom_value", "message" : "tekksdasdasdsa", "isbackground" : "", "payload" : { }, "timestamp...

Getting error when running sql server query in Python -

i building web app using django framework of python , db sql server azure ,using pyodbc. i have issue unable resolve , getting parameter(file_name) string , when running query parameter getting empty results in first case and "sql = sql % tuple('?' * len(params)) typeerror: not arguments converted during string formatting" in 2nd case , doing wrong? file_name=request.post.get('filetodelete') connections['default'].cursor() c: 1st case parms=[file_name] sql='select * banks_row_data file_name=%s' c.execute (sql,parms) test=c.fetchall() 2nd case c.execute (sql,file_name) test=c.fetchall() pyodbc uses ? parameter placeholder, not %s . sql = 'select * banks_row_data file_name = ?' note though since using django should using django model layer fur kind of query.

php - Loadmore Box : wanted to add load more box on my page , but i dont know it will work on background -

i have made front end website , wanted add loadmore box , had make loadmore box wanted contain 9 content @ first , after show loadmore box 9 more content , keep going until content ended , when content end load more box should not see @ end . here code <section> <div class="container-fluid body-section"> <div class="row"> <div class="col-md-3"></div> <div class="col-md-9"> <h1> <i class="fa fa-tachometer"> job board</i> <small> order date</small></h1><hr style=" border: 1px solid #ccc;"> <div class="row tag-boxes"> <?php $query='select * posts '; $con=mysqli_connect("localhost","root","sudha","joboard"); $run=mysqli_query($con, $query); if(mysqli_num_rows($run)>0) { ...