Posts

Showing posts from September, 2013

Ruby send Json response to http post call -

i have ruby code takes http post client. makes http post, , want send json response based on response post. how do this? trying use answer post: how send simple json response in rails? but giving me errors when try compile. require 'sinatra' require 'rest-client' require 'sequel' require 'pg' require 'json/ext' require 'net/http' require 'json' require 'monza' require 'time' post '/receiptvalidation' # find devices corresponding reg_tokens base64receiptdatastring = params[:base64receiptdatastring] uri = uri("https://sandbox.itunes.apple.com") net::http.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') |http| response = http.post('/verifyreceipt', params_json) parsedjson = json.parse(response.body) # ***** send json response here ******* respond_to |format| # ... other formats here ... format.jsonr...

Haskell parse error on input ‘|’ when trying to compile -

hi i'm learning haskell , made code implemente fractions when compile error parse error on input ‘|’ code following: module fraccion(frac,div,mcd,fraccion) data frac = div integer integer deriving (eq, show) mcd :: integer -> integer -> integer mcd b | > b = mcd (a-b) b | < b = mcd (b-a) | == b = fraccion :: integer -> integer -> frac fraccion b | b == 0 = error "divisor can't 0" | b < 0 = fraccion (-a) (-b) | b > 0 = div (a `div` mcdab) (b `div` mcdab) mcdab = mcd (abs a) b instance (num frac) negate (div b) = (div (-a) b) abs (div b) = (div (abs a) b) (div b) * (div c d) = fraccion (a*c) (b*d) (div b) + (div c d) = fraccion (a*d+b*c) (b*d) (div b) - (div c d) = fraccion (a*d-b*c) (b*d) frominteger n = (div n 1) signum (div b) | > 0 = 1 | < 0 + -1 | == b = 0 instance show fr...

serialization - Weka Time Series Forecasting java.io.NotSerializableException -

loaded timeseries package eclipse forecastingpanel.java -> advananced configs -> base learners doesnt contains hello word base model added it m_baselearnereditor.setvalue(new weka.classifiers.functions. gaussianprocesses()); -> starting (sample.arff) problem copying model. java.io.notserializableexception: no.uib.cipr.matrix.upperspddensematrix hope, can me otherwise have move more "active" timeseries project, allows user save work.

javascript - Show dynamically created divs one by one -

i trying show dynamically created li's 1 one. here code. idea why not work? $('form').submit(function(e) { e.preventdefault(); var userinput = $('#inputnumber').val(); console.log(outputresult); var modifiedresult = outputresult.map(function(item) { return '<li class="ball">' + item + '</li>' }); $('.output').html(modifiedresult.join("")); $('.ball').each(function(i, e) { $(this).delay(i * 400).fadein(); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul class="output"></ul> when $('.output').html(modifiedresult.join("")); li s visible ( display property block default). it suffice add style="display:none" in html strings create #map() function - see demo below: var userinput = $('#inputnumber').val()...

linux - Compile Java source to another directory -

so i'm new java programming , can compile , run java code linux terminal using javac objects.java , java objects . although, wondering on how compile source code directory? let's have file person.java in /home/alarm/projects/src/ folder, want compile /home/alarm/projects/bin/ folder while still in current directory. not sure if makes sense, can explain if possible? btw, using arch linux know os. you can use parameter -d specify target directory. more information can found here .

css - one div below, not to right, of other -

re on ebay: http://www.ebay.com/itm/281670060888 on own site (at http://sallymilo.com/template-din.html ) , when running on own computer, right side div aligns top of left side div, when put on ebay, right side div below left - if make tabbed section 200 pixels narrower. a bit of main css: .row1 { width:100%; position:relative; float:left; background:url(https://myimagefiles.com/dinnerman/tbg.png); } .row1l { width:26%; position:relative; margin-left:2em; float:left; } .row1r { width:64%; position:relative; margin-left:2em; margin-right:2em; float:left; } and bit of tabbed section css: .tabholder { width:100%; height:14em; font-size:16px; } /* base font size em-scaling */ .tabholder div.tabtops { width:100%; max-width:550px; } the issue in ebay width of container lower 1000px . because of fact inner sections hardcoded widths break. i suggest use width % , in way not matter of container inner sections take number of percentage gave. .container { margin...

java - android camera2 api access to my both rear camera -

i have phone 2 rear cameras. tired access both of using android.hardware.camera2 cameramanager . protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); cameramanager = (cameramanager) getsystemservice(context.camera_service); try { string[] camerasids = cameramanager.getcameraidlist(); } catch (cameraaccessexception e) { e.printstacktrace(); } } ` but camerasids array contains 2 ids. may cause problem?

javascript - AngularJS - binding not working as expected -

i have application consisting of tens of pages/views, , far works fine. now, in current page i'm working on have situation of inputs not behaving expected, meaning, relevant $scope variable within controller not receiving value entered user. i'm putting here parts of code explanations: : : : <tbody> <tr ng-model="data_list" ng-repeat="one_source in data_list track $index" style="cursor:pointer"> : : : <td> <input ng-disabled="check_if_disable($index,'input')" type="number" id="param_input_{{$index}}" class="form-control" ng-blur="check_parameter_value($index,one_source.parameter_name)" string-to-number ng-change="handle_parameter_value_change($index)" ng-model="one_source.parameter_value" ng-class="set_class($i...

deployment - how to organize dll? qt windeployqt setup quite a few subfolders -

Image
as using running windeployqt, pulls in quite few dlls , few subfolders. subfolder has 1 or 2 dll in it. feel exe "buried" in dll , subfolder, there cleaner way deploy? there way let windepolyqt pull minimum set of dll? in addition: i wonder if can pull dll in subfolder , put them @ same level of other dll qt5core.dll? can put dll in subfolder of "dll", @ top level see "application.exe" , "dll" (folder)?

angularjs - Cookies are undefined for different domains -

in angularjs service this.getlocalization = function () { var deferred = $q.defer(); var cultureabbrev = null; var currentlanguagefromcookie = $cookies.get("currentlanguagecode"); console.log(currentlanguagefromcookie); if(currentlanguagefromcookie !== undefined){ cultureabbrev = currentlanguagefromcookie; deferred.resolve(cultureabbrev); } else{ this.getuserlanguage() .then(function(data) { deferred.resolve(data); }).catch(function(){ deferred.resolve("en"); }); }; return deferred.promise; } this.getuserlanguage = function (){ return $http.get(__env.apipath(subdomain, '/api/language/getuserlanguage'), {withcredentials: true}).then(function (response) { return response.data; }); } in web api controller [enabl...

reactjs - Animated.Text fade-in animation on change -

so receiving text web socket connection, , adding text component. starts off grey, , turns black after x amount of time ( app processes text ). have code below <text style={styles.confirmedtext}> {this.state.confirmedtext} <animated.text style={{ fontfamily: "helvetica neue", color: "#9b9b9b" }}> {this.state.temptext} </animated.text> </text> so temptext changing, want there fade-in animation when text goes empty string -> / text @ all. ideas how this? note: know code hasn't attempted implement haven't been able find working samples using animated.text follow. thanks in advance, edit: better yet, if temp had value of "some text", , word added it, eg "some text plus", added word "plus" animated in individually great. seems difficult though first, you'll want set animated value so: this.opacity = new animated.value(0) then, when ...

mysql - Update two different columns with a separate WHERE condition for each -

i wanna update 2 columns on table different conditions each one. i've looked on , cant seem find solution anywhere matches exact thing. wanna have this: update users set col1= 'name1' id=3 , col2='name1' id=10 you case expression: upadate users set col1 = case when id=3 'name1' else col1 end, col2 = case when id=10 'name1' else col2 end id in (3, 10) but find syntax awkward, , might rather logically separate updates not using case in separate commands within single transaction.

vb.net - Enable and disable command button when picture box is empty or filled -

i doing project on data add , update. below code enable command button if text fields filled , image uploaded file, command button enabling if image empty in picture box. please me enabling , disabling command button when image filled , emptied. private sub txtfields_textchanged(sender object, e eventargs) handles txtpassword.textchanged if not string.isnullorwhitespace(txtid.text) andalso not string.isnullorwhitespace(txtname.text) andalso not string.isnullorwhitespace(txtusername.text) andalso not string.isnullorwhitespace(txtpassword.text) andalso picuser.image nothing btnadd.enabled = true end if end sub you've written andalso picuser.image nothing then means that "if image nothing" i suggest change part to: andalso picuser.image nothing = false hope helps! :)

angular - Restrict a pipe to be used in one component in a module -

in angular 2, have pipe used in 1 component , know how prevent sharing other components in same module. i want ensure scope of custom pipe component want , not other components in same module. it not possible , way restrict pipe 1 specific component use separate ngmodule both pipe , component. if want use component above, should export component can used in module.

Http status code managed by which part of web? -

while studying web programming, wondering http status code come web (like apache), (like tomcat), or database server (like mysql). for example 4xx http status codes client side error , 5xx status codes server side errors. 2 http status codes come web? or web application server? since http protocol only relevant , handled http server status codes create , sent component. in contrast database server example has no idea http status code is. has nothing protocol layer. you can tell http server send specific http status application logic , done. rest apis example rely on that. example php script uses header() function. delegates specific code http server handles communication.

android - Select some data from SQLite using a date filter? -

Image
i want select data database table using filter date (date column is: [searchdate] datetime default current_timestamp,) in pic, i'm using sqlite expert , filter date: and code getting current year , month: dateformat year_format = new simpledateformat("yyyy"); dateformat month_format = new simpledateformat("mm"); year_date = year_format.format(new date()); month_date = month_format.format(new date()); date date = new date(); log.d("month", year_format.format(date) + " " + month_format.format(date)); and cursor query in app getting list filtered date (current year): public list<moment> moment_year(string year) { try { moment moment_table; list<moment> moments = new arraylist<>(); db_helper.opendatabase(); db.begintransaction(); cursor moment_cursor = db.rawquery("select * tblmoment strftime('%y...

android - NativeAdExpressView inside RecyclerView -

i have recyclerview following adapter class. want implement nativeadexpressview inside recyclerview. every 11th element of recyclerview should ad. best method add ads using below adapter class? public class searchresultadapter extends recyclerview.adapter<searchresultadapter.myviewholder> { private list<searchresult> resultlist; private context context; public class myviewholder extends recyclerview.viewholder { private textview name, course, department, bloodgroup; private imageview pro_image; private relativelayout relativelayout; public myviewholder(view view) { super(view); name = (textview) view.findviewbyid(r.id.name); course = (textview) view.findviewbyid(r.id.course); department =(textview)view.findviewbyid(r.id.department); bloodgroup = (textview) view.findviewbyid(r.id.bloodgroup); pro_image = (de.hdodenhof.circleimageview.circleimageview) view.findviewbyid(r.id.profile_image); relati...

Oracle SP Fails when called from Apex form due to date format -

i have table inserting , updating data using procedure based on input parameters. procedure called oracle apex form. procedure works fine in oracle. when call apex form, procedure fail error. on analysis, found because of date format mismatch in value passed apex form , in oracle. date format in apex form-->16-aug-2017 date format in oracle db-->2017-08-17 do need format input parameter in apex form before calling oracle procedure or need change format within procedure. please help. apex treats item values strings e.g. '16-aug-2017'. if procedure calling expects date parameter need convert value before calling it. go against grain many people, in apex application happily use implicit conversion: myproc (p_date => to_date(:p1_date)); this work regardless of date format setting in apex. alternative perform explicit conversion using prevailing apex date format this: myproc (p_date => to_date(:p1_date, :app_nls_date_format)); but seems red...

python - Converting BeautifulSoup object into list to extract data -

from following 2 lines of python code following html output belongs class 'bs4.beautifulsoup' site_link = soup.find_all('a', string='aberdeen')[0] row = site_link.findparent('td').findparent('tr').findall('td') <html><body><p>[</p><td><a href="../networks/site-info?site_id=abd">aberdeen</a><br/> <a class="smalltext" href="https://uk-air.defra.gov.uk/assets/graphs/abd_weekly_m.png">timeseries graph</a></td>, <td class="center"><span class="bg_low2 bold">48 (2 low)</span></td>, <td class="center"><span class="bg_low1 bold">4 (1 low)</span></td>, <td class="center"><span title="not measured">n/m</span></td>, <td class="center"><span class="bg_low1 bold">2 (1 low)</span...

javascript - How to reset count in AngularJs -

i have list 4 items. each item have counter. when click on item, count increase. want reset counter value 0 except clicking item. demo . var myapp = angular.module('myapp',[]); var jsoninfo = {"count":[{"name":"one",count:0} ,{"name":"two",count:0},{"name":"three",count:0} ,{"name":"four",count:0}]} function myctrl($scope) { $scope.data =jsoninfo; $scope.count = function (inc) { inc.count = inc.count + 1 }; } you can try this. loop on items , check if clicked item current one: increment , others set 0. try demo var myapp = angular.module('myapp',[]); var jsoninfo = {"count":[{"name":"one",count:0} ,{"name":"two",count:0},{"name":"three",count:0} ,{"name":"four",count:0}]} function myctrl($scope) { $scope.data =jsoninfo; $scope.count = function (inc) { ...

ios - Cannot convert return expression of type 'Array<AboutMe>' to return type '[About me]' -

i have data model struct aboutme { private(set) public var name: string init(name: string) { self.name = name } } and data service this struct dataservice { static let instance = dataservice() private let sections = [ [aboutme(name: "rate app on app store")], [aboutme(name: "facebook")], [aboutme(name: "twitter")], [aboutme(name: "linkeden")], [aboutme(name: "instagram")], [aboutme(name: "email feedback")] ] func getsections() -> [aboutme] { return sections } } however wen try return sections of type me, won't let me, says can't convert return expression one. how can fix this. sections (implicitly) declared [[aboutme]] return value of getsections() [aboutme] that's classic type mismatch. solutions: change body of sections struct dataservice { static let in...

SceneKit water like in Badger example -

Image
does enybody know how create water material in badger example apple? there "geotherm_01" object in "scene.scn" , object got materials "_1_terrasses_orange_water" , "_1_terrasses_eau" creates water slow animation looks realistic. i've tried repeat same materials in testing project can't same result. this water effect achieved using shader modifiers shown in scenekit scene editor within xcode. important material property normal map used affect lighting in order simulate wavelets on flat geometry. more modifier .surface entry point is float waterspeed = u_time * -0.1;vec2 uvs = _surface.normaltexcoord;uvs.x *= 2;vec3 tn = texture2d(u_normaltexture, vec2(uvs.x, uvs.y + waterspeed)).xyz;tn = tn * 2 - 1;vec3 tn2 = texture2d(u_normaltexture, vec2(uvs.x + 0.35 , uvs.y + 0.35 + (waterspeed * 1.3))).xyz;tn2 = tn2 * 2 - 1;vec3 rn = (tn + tn2) * 0.5;mat3 ts = mat3(_surface.tangent, _surface.bitangent, _surface.geometrynormal...

Get SQL Server database server address -

Image
i installing app , @ point supposed provide server details. installed sql server express , installed sql server management studio. this screenshot: i did execute command select @@servername but got response: i running on local machine. how can find database server address , server password?. ps: not remember setting password when installing sql server. thanks. when executed command select @@servername , how connected server? running command required knowing servername , authentication of kind. i'm guessing connected desktop-kojlcif\sqlexpress or .\sqlexpress using windows authentication. when installed sql express, there option windows authentication or sql server + windows (aka mixed mode) authentication. if chose windows authentication (which default if recall), not have sql server usernames or passwords. the app installing appears required sql auth, need pick mixed mode in setup (which allows both windows auth , sql auth). can find setti...

caffe create lmdb file error with coco dataset -

i followed instruction create lmdb files coco, changed classes, problem it's ok test lmdb,but train lmdb, met following mistakes, why happened?(in other words,i 4 lmdb files, 2 train wrong,because following mistake,2 test seems ok create) i0820 19:07:13.075296 7382 convert_annoset.cpp:122] total of 118287 images. i0820 19:07:13.075664 7382 db_lmdb.cpp:35] opened lmdb /home/liu/data/coco/lmdb/coco_train_lmdb f0820 19:07:13.136318 7382 io.cpp:393] unknown name: 17 *** check failure stack trace: *** @ 0x7f4a3168f5cd google::logmessage::fail() @ 0x7f4a31691433 google::logmessage::sendtolog() @ 0x7f4a3168f15b google::logmessage::flush() @ 0x7f4a31691e1e google::logmessagefatal::~logmessagefatal() @ 0x7f4a31cbf1d8 caffe::readjsontoannotateddatum() @ 0x7f4a31cbf5f1 caffe::readrichimagetoannotateddatum() @ 0x407dba main @ 0x7f4a30607830 __libc_start_main @ 0x4089d9 _start @ (nil) (unknown) /home/liu/caffe-ssd/build/tools/convert_annoset --anno_type=detection -- label_type=json --la...

java - add ToolBar in Preference Activity? -

i have created app settings preferences. noticed, there no toolbar in preferenceactivity. how can add toolbar preferenceactivity? public class settingsactivity extends preferenceactivity implements preference.onpreferencechangelistener { preferencemanager manager; listpreference listpreference; sharedpreferences sharedpreference; @suppresswarnings("deprecation") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.language_option_preference); sharedpreference = preferencemanager.getdefaultsharedpreferences(this); manager = getpreferencemanager(); listpreference = (listpreference) manager.findpreference("language_setting"); listpreference.setonpreferencechangelistener(this); } @override public boolean onpreferencechange(preference preference, object newvalue) { resources resource...

c++ - Reading private member of base class through inherited function (?) -

in following example call d.run(); prints ad bd cd , don't understand why. think should print ab bb cb ad bd cd instead pushing vector vars_base of base 6 times (?) based on output seems me copy made of vars_base member derived class although private base (?) i should clarify point of question merely understand behavour of example below - intention not access private members of base through derived . #include <iostream> #include <vector> class base { private: std::vector<std::string> vars_base; protected: std::vector<std::string> &get_vars() { return vars_base; } public: void push_back(const std::string &str) { get_vars().push_back(str); } void run() { (auto int_vars_it : get_vars()) { std::cout << int_vars_it << " "; } } }; class derived : public base { }; int main(int argc, char *argv[]) { base b; b.push_back("ab"); b.push_back("bb...

python - socket connect_ex error with .get()var -

what problem? .get()? functions.py import socket import pages.settings settings def portscan(): try: print(settings.ip.get()) print(settings.port.get()) p in range(1, 100): print("after for") s = socket.socket(socket.af_inet, socket.sock_stream) res = s.connect_ex(str(settings.ip.get()), 80) if res == 0: print("open port in:" + str(p)) s.close() except exception: print("check settings function portscan() = error") settings.py global ip global port global limit ip = tk.stringvar() port = tk.stringvar() limit = tk.stringvar() label_ip = tk.label(self, text="ip:") label_ip.grid(row=0, column=0, sticky=tk.e) error 1 192.168.100.101 80 after for check settings function portscan() = error i fixed it. error: res = s.connect_ex(str(settings.ip.get()), 80) typeerror: c...

unity3d - Managed mobile application monitoring performance -

what best mobile application monitoring solution know? with following requirements: managed solution support unity3d client monitor cpu, memory ability send custom events ability send events specific device (ability drill down later specific device) i found new relic solution example, bit expensive, i'm not sure device drill down abilities.

java - Integrate two types of Gregorian and solar (shamsi,jalali) calendar with each other in calendar view -

i wondering if can integrate 2 types of calendar in android(like solar , gregorian) each other , show them in 1 calendar view possible even? its example of saying: https://ibb.co/na1ygk for has problem solved making custom calendar view grid layout , create 2 calendar class of icu4j library(on gregorian calendar , 1 persian calendar , set them on view) lib: http://site.icu-project.org/download/59

javascript - uncaught reference $ is not defined -

i trying project javascript using events on keys display alphabets on screen, i'm stuck error. please help <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head...

angular - Angular2-Token not sending headers -

i finished setting angular2-token auth , see in docs, should sending client uid expiry , token in headers of every request, i'm noticing getting default sign in response on back-end. my angular(4) service simple. export class clientservice { constructor(private http: http) { } private clientsurl = 'baseurl/clients'; getclients() : observable<client[]> { return this.http.get(this.clientsurl) .map((res: response) => res.json()) .catch((error:any) => observable.throw(error.json().error || 'server error')); }; and in component: export class clientcomponent implements oninit { constructor(private clientservice: clientservice) { } clients: client[]; ngoninit() { this.getclients(); } getclients() { this.clientservice.getclients() .subscribe( clients => this.clients = clients, err => { console.log(err); } ); } } i have generic model includin...

classloader - Android: Isolated 'ClassNotFoundException' reported in Dev Console -

my app has been live on play store little while , has around 500 installs, today greeted following in dev console's anr & crashes section: java.lang.runtimeexception: @ android.app.activitythread.installprovider (activitythread.java:6423) @ android.app.activitythread.installcontentproviders (activitythread.java:6012) @ android.app.activitythread.handlebindapplication (activitythread.java:5951) @ android.app.activitythread.-wrap3 (activitythread.java) @ android.app.activitythread$h.handlemessage (activitythread.java:1710) @ android.os.handler.dispatchmessage (handler.java:102) @ android.os.looper.loop (looper.java:154) @ android.app.activitythread.main (activitythread.java:6776) @ java.lang.reflect.method.invoke (native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:1520) @ com.android.internal.os.zygoteinit.main (zygoteinit.java:1410) caused by: java.lang....

mysql - Error parsing attribute when generating XML from PHP -

i trying implement google map in website using data in mysql ended getting error this page contains following errors: error on line 1 @ column 18: error parsing attribute name below rendering of page first error. below code provided by: https://developers.google.com/maps/documentation/javascript/mysql-to-maps may know causing error? <?php require("connect.php"); function parsetoxml($htmlstr) { $xmlstr=str_replace('<','&lt;',$htmlstr); $xmlstr=str_replace('>','&gt;',$xmlstr); $xmlstr=str_replace('"','&quot;',$xmlstr); $xmlstr=str_replace("'",'&#39;',$xmlstr); $xmlstr=str_replace("&",'&amp;',$xmlstr); return $xmlstr; } // opens connection mysql server $connection=mysql_connect ('localhost', $username, $password); if (!$connection) { die('not connected : ' . mysql_error()); } // set active mysql database $...

JQuery/Django Syntax error -

i know there dumb error i'm missing. pycharm/brackets hasn't been able help, , i've combed dozen times. the idea when clicks on reservation slot (slot), can either reserve it, clear it, or blocked because has it. error returned "syntaxerror: missing : after property id" line 41, "console.log()" . i've been reading , it's syntax error elsewhere, i'm stumped. #views.py @ensure_csrf_cookie def reserve(request): if request.is_ajax(): pk = request.post['pk'] slot = event.objects.get(pk=pk) user = request.user if slot.is_reserved == true: if user == slot.teacher: slot.is_reserved = false slot.teacher = none slot.save() result = "clear" else: result = "blocked" else: slot.is_reserved = true slot.teacher = user slot.save() ...

(com.google.android.gms.maps.model.MarkerOptions)' on a null object reference -

this question has answer here: what nullpointerexception, , how fix it? 12 answers mainactivity.java package com.example.neetu.mapexample; import android.app.actionbar; import android.location.address; import android.location.geocoder; import android.os.asynctask; import android.support.v4.app.fragmentactivity; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import java.io.ioexception;...

java - if statement for first two characters of string -

this question has answer here: how check if string starts 1 of several prefixes? 7 answers i need if statement. if ticket doesn't begin particular string prompts them "invalid, try again", example of ticket ba200 public class game { public static void main(string[] args) { scanner keyboard = new scanner(system.in); system.out.println("enter ticket"); string ticket = keyboard.nextline(); if(ticket=("ab"|| "ab" || "ba" || "ba" || "cb" || "cb")) { system.out.println("correct"); } else { system.out.println("invalid, try again"); } } } use startswith method: import java.util.scanner; public class game { public static void main(string[] args) { scanner keyboard = new scanne...

What's the Perl DBI command syntax for connecting to mysql using AWS IAM authentication with a previously generated token? -

resolved: connection string needs have mysql_ssl=1 , mysql_ssl_ca_file: $dbh = dbi->connect(qq[dbi:mysql:host=$host;dbname=$name;mysql_ssl=‌​1;mysql_ssl_ca_file=‌​<pem cert location>, $user, $token, { raiseerror => 1, autocommit => 0 }); no idea why keeps downvoting question.. i have connect mysql using aws iam authentication token password perl , python scripts. token generation easy , connecting python. can't find exact syntax using perl's dbi. i set env variable cleartext $ export libmysql_enable_cleartext_plugin=1 i create rds certificate file $curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem > /home/ubuntu/rds-cert.pem i try connect code: token aws call below correct @ point - checked #!/usr/bin/perl use strict; use warnings; use dbi; $token = `aws rds generate-db-auth-token --hostname <my hostname nere> --username <my username here> --region eu-west-1`; $token =~ s/\n$//; ...

Why java doesn't recognize a variable? -

does know why java doesn't understand variable "increment"? tasked find out user's years of service , salary. after that, assign each of them increment. when want print variable "increment", java doesn't recognize it. may know why? import javax.swing.joptionpane; public class q4 { public static void main(string[] args) { int increment; string yearsstring = joptionpane.showinputdialog(null, "please enter years of service"); string salarystring = joptionpane.showinputdialog(null, "please enter salary"); int years = integer.parseint(yearsstring); double salary = double.parsedouble(salarystring); if(years < 10) { if(salary < 1000.0) { increment = 100; } else if (salary< 2000.0) { increment = 200; } else { increment = 300; ...

android - The vulnerabilities were addressed in OpenSSL 1.02f/1.01r. To confirm your OpenSSL version, you can do a grep search for: -

i got issue google playstore , unable fix issue. doing wrong? my gradle file: apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { applicationid "com.wiise" minsdkversion 17 targetsdkversion 25 versioncode 3 versionname "1.2" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } allprojects { repositories { maven { url "https://jitpack.io" } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude ...

excel - Macro to run different macros by criteria - depending on if specific cells are empty/not -

i have excel file defined macros opening specific ppt files. i'm looking vba code run specific macro based on if cells empty , other not. for example: if cells b1 , b2 empty cell b3 isn't --> run macro1 if cells b1, b2 & b3 empty cell b4 isn't --> run macro2 is possible? many thanks! thanks quick answer! chances missed there... report 3 should activated when d8 & d9 not empty , d10 empty (sorry other way) sub choose_macro() dim v variant worksheets("reports") v = application.match(chr(42), .range("d8:d11"), 0) if not iserror(v) select case clng(v) case 3 report_3 case 4 report_4 case else 'do nothing end select end if end end sub

swift - Not able to play a mp3 in iOS -

document directory url file:///var/mobile/containers/data/application/895de1a3-5d2e-462b-8d13-518b7cafc6c7/documents/146791.mp3 code using play url do { print(url) audioplayer = try avaudioplayer.init(contentsof: url, filetypehint: avfiletypempeglayer3) guard let player = audioplayer else { return } player.preparetoplay() player.play() } catch let error { print(error.localizeddescription) } error getting the operation couldn’t completed. (osstatus error 1685348671.) swift 3 do { let player = try avaudioplayer(contentsof: url!) player.volume = 0.6 player.preparetoplay() player.play() } catch { print("file not found") }

css - What is a positioned ancestor? -

i reading "positioning techniques" of article on mdn. talks "absolute positioning elements can fixed position relative nearest positioned ancestor element". my understanding of "positioned ancestor" ancestor position property other static. need expert opinions verify thought. when referring positioned ancestor mean closest ancestor element set position value, other static (which default). so there 2 assumptions here: in case there more 1 positioned ancestor s mean the closest . in case there ancestor set position:static (presumably set javascript, in order change "positioned ancestor") don't mean ancestor. why important? because "positioned ancestor" reference properties left , top calculated, when descendant given position:absolute . it's called "the reference element/parent" of descendant. also, if closest ancestor has set z-index (other auto ), creates stacking context descendants. ...

javascript - How to output debug statements to console in Visual Studio Code -

how write console .js method? console.log not showing in console tab in visual studio code here example of method _onpressitem = (index) => { console.log("property finder >> pressed row: "+index); }; this triggered when press on item in listview. if run through xcode, see console.log line above printed in xcode. if debug in vscode, see no console.log line being printed @ all. my steps: 1. open project in vscode vs code has installed react-native tools already cmd+p type command debug: start debuging (it available command, select it) my app starts, debug console tab shows lines no line console.log command shown debug > start debugging f5 , see output @ debug console

ios - Social network app gives error on a return line -

i finalizing social media application , consistently having same error regarding " username " of user during launch process of application (app running, user logged in, , next view controller fails come , crashes giving exc_bad_instruction ). i thinking might adata base problem had the profile picture, however, user name in database registered user email , password. the code of section error in: import foundation import firebase import firebasedatabase class post { private var _username: string! private var _userimg: string! private var _postimg: string! private var _likes: int! private var _postkey: string! private var _postref: databasereference! var username: string { return _username } var userimg: string { return _userimg } var postimg: string { { return _postimg } set { _postimg = newvalue } } var likes: int { return _likes } var postkey: string { return _postkey } init(imgurl: string, likes: int, username:...

javascript - jqGrid.info_dialog is not a function, do I have to call extend? -

i try use info_dialog on jqgrid, see typeerror: $(...).jqgrid.info_dialog not function in console. i have (!) not defined own info_dialog function. can see 1 in $.extend($.jgrid, ... here , expecting available default. info_dialog : function(caption, content,c_b, modalopt) { var mopt = { width:290, height:'auto', do somehow have enable grid? or else have can use version defined here (call extend on grid? ..) using 4.6.0 https://cdnjs.com/libraries/jqgrid using https://cdnjs.com/libraries/free-jqgrid 4.14.1 jqgrid defines not "standard" methods, can used $("#grid").jqgrid("methodname", ...) or $("#grid").methodname(...) , other methods. "standard" methods registered under $.fn.jqgrid.methodname (like $.fn.jqgrid.editgridrow function example) and, if no $.jgrid.no_legacy_api = true; specified before $.jgrid.no_legacy_api = true; , under $.fn.methodname too. in othe...

WordPress Integration in ASP.net 4.0 & SQL Server 2008 website -

i'm trying integrate wordpress in website running on .net framework 4.0 , using sql server 2008 database. can suggest me reference can proceed in right direction? thanks in advance. the requirements wordpress php , either mysql or mariadb database. https://wordpress.org/about/requirements/ the microsoft web server, iis, allows both of these installed.

unity3d - UNITY: How to make the UNITY preview look like an android portrait -

i develope apps android visual studio, want increase programming knowledge little , trying game development. i watched tutorials , debug on phone, have 1 major question ahead of me, before can start: so, in visual studio deliever 5 different hdpi folders, , work linearlayouts , set weights work form of percentage towards users screen. technique, apps build more or less same on every android device out there (which indeed lot). if come unity now, i'd set preview window of mobile game in portrait format. kind of 90 degree 16:9 ratio. can bring 16:9 ratio but, again landscape , never portrait. means kind of need guess game when finished - , no go! so how achieve need? sort of tilt 16:9 ratio on 90 degrees. hope made myself clear! thank you! okay thanks, kinda found way playing around it. said "16:9" right above preview screen. when clicking on , clicking on little "+" manually provide resolution such 1440 x 2560. brought portrait android mo...

ember.js - ember-bootstrap: Navbar component repeats itself 12 times -

Image
i using ember-bootstrap 's navbar example code in simple ember test app: {{#bs-navbar |navbar|}} <div class="navbar-header"> {{navbar.toggle}} <a class="navbar-brand" href="#">brand</a> </div> {{#navbar.content}} {{#navbar.nav |nav|}} {{#nav.item}} {{#nav.link-to "home"}}home{{/nav.link-to}} {{/nav.item}} {{#nav.item}} {{#nav.link-to "navbars"}}navbars{{/nav.link-to}} {{/nav.item}} {{/navbar.nav}} {{/navbar.content}} {{/bs-navbar}} however i'm having strange results; navbar showing 12 times in page. it's worth, toggle button doesn't either - might connected reason navbar appears 12 times. see following screenshot: here steps took set project: ember new bootstrap-test inside /bootstrap-test : ember install ember-bootstrap ember g ember-bootstrap --bootstrap-version=4 here contents of ember-cli-build.js file: /...

html - fixed width of div in oracle function -

i have oracle function format mail data before sending. function called pl/sql process in apex. have small problem css formating of mail. want have div fixed width 750px. , table , other elements fit specifed width. problem when define fixed width of div not work. have tried on jsfiddle , works not work in oracle function. when define other div parameter font size, color, border etc. works. not able change width of div. function: create or replace function "send_mail" return varchar2 pragma autonomous_transaction; kontr_tema varchar2(500); komentar varchar2(2000); obl varchar2 (100); riz varchar2 (1); riz_warning varchar2(100); last_report_id number; vystup varchar2(2601); begin select riziko riz audit_reports report_id = (select max(report_id) audit_reports); select oblast obl audit_reports report_id = (select max(report_id) audit_reports); x in(select opis_kontroly audit_reports rep...