Posts

Showing posts from March, 2011

react native - Onesignal making user appear 'active' every hour -

i segmenting users location filter. location updated if mobile app in foreground. there way mimic user's last activity / location every hour if app in background? using react native. you can update player / user record last location through rest api sending lat , long . https://documentation.onesignal.com/reference#edit-device you need use plugin or own native code location of device in background.

java - Moving Vehicle Path Distance Calculation Using Android Device and LocationManager -

any , gives accurate traveled distance example welcomed. tried calculating latitude , longitude. storing previous , current points data , distance , adding every 5 seconds when vehicle speed != 0 checked many rounds of moving vehicle, every time getting different kms distance. not accurate. accuracy solution moving vehicle path distance calculation. private double journeypathdistance(double currentlat, double currentlng) { if (isfirsttime && vehiclespeedvalue != 0) { location loc1 = new location(""); loc1.setlatitude(currentlat); loc1.setlongitude(currentlng); location loc2 = new location(""); loc2.setlatitude(currentlat); loc2.setlongitude(currentlng); isfirsttime = false; prevlat = currentlat; prevlng = currentlng; distancekms = loc1.distanceto(loc2) / 1000; } else { if (vehiclespeedvalue != 0) { location loc1 = new location(""); ...

android - Get PicturePath selected from gallery to store it in dataBase -

i used code upload image gallery .it works perfectly..but problem wanna image's path store in wamp database ..` public class image extends activity { imageview contact; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_image); contact = (imageview) findviewbyid(r.id.candidat); contact.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent, "select contact image"), 1); } }); } public void onactivityresult(int reqcode, int rescode, intent data) { if (rescode == result_ok) { if (reqcode == 1) contact.setimageuri(data.getdata()); } } } thank help ...

javascript - jquery selector for id starts with specific text -

this question has answer here: find html element id starts 4 answers i have jquery code: $( "#editdialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000 }, hide: { effect: "explode", duration: 1000 } }); but have several divs id's this: editdialog-0, editdialog-1, ...., editdialog-n. how can make jquery code of these divs, 1 above? use jquery starts with attribute selector $('[id^=editdialog]') alternative solution - 1 (highly recommended) a cleaner solution add common class each of divs & use $('.commonclass') . but can use first 1 if html markup not in hands & cannot change reason. alternative solution - 2 (not recommended if n large number ) (as per @mihai stancu's suggestion) $('#editdialog-0, #editdialog-1, #editdialog-...

java - Can't access sqlite db from Spark -

i have following code: val conf = new sparkconf().setappname("spark test") val sc = new sparkcontext(conf) val sqlcontext = new org.apache.spark.sql.sqlcontext(sc) val data = sqlcontext.read.format("jdbc").options( map( "url" -> "jdbc:sqlite:/nv/pricing/ix_tri_pi.sqlite3", "dbtable" -> "select security_id ix_tri_pi")).load() data.foreach { row => println(row.getint(1)) } and try submit with: spark-submit \ --class "com.novus.analytics.spark.sparktest" \ --master "local[4]" \ /users/smabie/workspace/analytics/analytics-spark/target/scala-2.10/analytics-spark.jar \ --conf spark.executer.extraclasspath=sqlite-jdbc-3.8.7.jar \ --conf spark.driver.extraclasspath=sqlite-jdbc-3.8.7.jar \ --driver-class-path sqlite-jdbc-3.8.7.jar \ --jars sqlite-jdbc-3.8.7.jar but following exception: exception in thread "main" java.sql.sqlexception: no suitable driver ...

swift - IOS Push Notifications using Parse -

i'm trying ping users in channel within distance current user's location. problem stuck on inability satisfy both constraints. 1 or other works itself. both, message sent nobody somehow. missing here? in advance! func finddriver(loc: cllocationcoordinate2d) { let driverquery = pfinstallation.query() driverquery?.wherekey("channels", equalto:"drivers") let geopoint = pfgeopoint(latitude: loc.latitude, longitude: loc.longitude) driverquery?.wherekey("location", neargeopoint: geopoint) let push = pfpush() push.setquery(driverquery) push.setmessage("looking drivers!") push.sendpushinbackground() } maybe try , query ? here link: https://www.parse.com/questions/combining-or-queries func finddriver(loc: cllocationcoordinate2d) { let driverquery = pfinstallation.query() driverquery?.wherekey("channels", equalto:"drivers") let geopoint = pfgeopoint(latitude: loc.latitude, lon...

html - autocomplete off still keep history? -

did puting autocomplete off on input text browser not remember text or not using it? i have textbox personal things , want sure cannot retrieve on public computer. according mdn page regarding html autocompletion, browsers not save data if autocomplete turned off form or field: setting autocomplete="off" here has 2 effects: it stops browser saving field data later autocompletion on similar forms though heuristics vary browser. it stops browser caching form data in session history. when form data cached in session history, information user has filled in visible after user has submitted form , clicked on button go original form page.

c# - Why I am getting null exception when using an Interface -

this question has answer here: what nullreferenceexception, , how fix it? 33 answers public class blah { public bool whatever { get; set; } public string whatyoujustsaid { get; set; } } public interface iblah { blah blahvalues { get; set; } } class class1:iblah { public blah blahvalues { get; set; } } and example: class1 c1 = new class1(); c1.blahvalues.whatyoujustsaid = "nothing"; c1.blahvalues.whatever = false; so how should change code blahvalues doesn't null? you have initialize blahvalues . using object initializer, can done below: class1 c1 = new class1() { blahvalues = new blah() }; as create c1 object, blahvalues it's default value, null . hence, when try assign value whatyoujustsaid , whatever null reference exception.

c# - Error 400 GCM Invalid Request json -

i new kind of programming don't know if there answer already, weren't able find it. testing see if can dry-run gcm message work without errors. the error error 400 invalid request, , it's saying json being invalid, have assumed problem has string manipulation or definition of postdata, can't figure out. of code copy pasted anyway 1 believe others in similar situation same error, if copy same source. and have put in actual values "lorem"s. this code: using system; using system.collections.generic; using system.text; using system.net; using system.io; using system.web.script.serialization; namespace servergmc { public class servergmc { static void main () { // prepares , calls function send message list<string> redidlist = new list<string>(1) { "aaaaaaaaaaaaaaaaaaaaaaaa" }; redidlist.trimexcess(); console.writeline(sendnotification(redidlist, "hellowor...

sharepoint - CQWP - displaying Author, Check Out To, etc... from multiple libraries -

i have cqwp created lists document icon, title, author, checked out to, , last modified. displays fine if point @ single document library when point subsite, in order see documents libraries, icon , title nothing else. missing? here code itemstyle.xsl: <xsl:if test="count(preceding-sibling::*)=0"> <div style="float:left; width:32px;">&#160;</div> <div style="float:left; width:15%; padding-right:15px;">name</div> <div style="float:left; width:10%; padding-right:15px;">created by</div> <div style="float:left; width:10%; padding-right:15px;">checked out</div> <div style="float:left;">last modified</div> </xsl:if> <div class="item...

c# - Entity Framework 6 - How can I view the SQL that will be generated for an insert before calling SaveChanges -

in entity framework 6, possible view sql executed insert before calling savechanges? using (var db = new stuffentities()){ db.things.add(new thing({...}); //can sql insert statement @ point? db.savechanges(); } i'm familiar how generated sql query before execution so: var query = db.thing.where(x => x.id == 9); console.writeline(query.tostring()); //this prints sql select statement the query returns iqueryable<> whereas insert returns dbset , calling tostring on dbset prints standard object name. another option (if understand question correctly), use idbcommandinterceptor implementation, seemingly allows inspect sql commands before executed (i hedge words have not used myself). something this: public class commandinterceptor : idbcommandinterceptor { public void nonqueryexecuting( dbcommand command, dbcommandinterceptioncontext<int> interceptioncontext) { // whatever command.commandtext } } regist...

installation - Cannot connect to Server (local) in SQL Server 2008 using windows authentication -

i'm attempting connect instance of sql server 2008 (developer edition) in sql server management studio receiving error: [window][1] [sql server management studio error message][2] and in sql server configuration manager, there no items although followed installation steps in link: https://blogs.msdn.microsoft.com/bethmassi/2011/02/18/step-by-step-installing-sql-server-management-studio-2008-express-after-visual-studio-2010/ and downloaded microsoft sql server 2008 management studio express here: https://www.microsoft.com/en-us/download/details.aspx?id=7593 does know problem is?

html - Z-index not working on :before & :after -

i'm trying make ribbon 1 in image linked, when use z-index send edges behind main part of ribbon disappears behind pages background color. can please tell me whats wrong code? ribbon image the html: <!doctype html> <html> <head> <title>newsletter signup</title> <link href="style.css" rel="stylesheet"> </head> <body> <div class="container"> <div class = "header"> <h1 class = "logo">skillcrush</h1> <div class="ribbon"> <p>the delightful way learn</p> </div> </div><!--header--> </div><!--container--> </body> </html> the css: .container-body{ margin: 0 auto; width:1200px; height:702px; background-color:#fff0da; z-index: auto; } .ribbon{ text-align: ...

python - I can not install packages with PIP from Jenkins and Virtualenv -

i'm trying execute script jenkins: #!/bin/sh source /home/user/venv/venv3/bin/activate cd /home/user/project/ pip install -r requeriments.txt python manage.py migrate python manage.py collectstatic --noinput but keep having issues installing package pip: error: not create '/home/user/venv/venv3/lib/python3.4/site-packages/markdown': permission denied i created virtualenv user (not sudo) , python3. jenkins runs "jenkins" user. user doesn't have write access user's directories. you'd have create virtualenv , project directory in jenkins' own home dir ( /var/lib/jenkins ). to debug it, run script hand jenkins user. not within jenkins, on command line after doing sudo su jenkins . you'll see same error.

java - Reading the incoming phone number -

i new android developer . writing application incoming caling number , stuff. have 1 activity " main_activity " code in main_activity : package com.example.callchecker; import android.os.bundle; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.telephony.telephonymanager; import android.util.log; public class main_activity extends broadcastreceiver{public main_activity() { // todo auto-generated constructor stub } @override public void onreceive(context context, intent intent) { // todo auto-generated method stub try { bundle extras=intent.getextras(); if (extras !=null){ string state = extras.getstring(telephonymanager.extra_state); log.w("my_debug_tag",state); if (state.equals(telephonymanager.extra_state_ringing)){ string phonenumber = extras.getstring(telephonymanager.e...

Which languages better support raw sockets? -

what languages more appropriate program raw sockets? packetfu's ruby doesn't have documentation. i've been using c far wondering if there alternatives. raw sockets easy in python ( https://docs.python.org/2/library/socket.html , http://bt3gl.github.io/black-hat-python-building-a-udp-scanner.html ) , in assembly ( http://sock-raw.org/ , have adapt code x64 assembly, see 64 bit version of socketcall system call linux ) packet sniffer in python (interface has set promiscous mode ): import socket import os # host listen host = '192.168.1.114' def sniffing(host, win, socket_prot): while 1: sniffer = socket.socket(socket.af_inet, socket.sock_raw, socket_prot) sniffer.bind((host, 0)) # include ip headers in captured packets sniffer.setsockopt(socket.ipproto_ip, socket.ip_hdrincl, 1) if win == 1: sniffer.ioctl(socket.sio_rcvall, socket_rcvall_on) # read in single packet pr...

html - Child Div in UL cuts off -

i have nested structure div contains ul in turn contains div. requirement have content of inner div display beyond width (boundary) of ul or outer div. /* positioning */ #box1 { position: absolute; overflow: hidden } #box2 { position: relative } #box3 { position: absolute; top: 10px } /* styling */ #box1 { background: red; padding: 5px; width: 125px } #box2 { background: blue; padding: 2px; width: 125px; height: 100px } #box3 { background: green; padding: 2px; width: 500px; height: 150px } <div id="box1"> <ul id="box2"> <li> <div id="box3" /> </li> </ul> </div> refer https://jsfiddle.net/ob641d3s/ note: working on chrome 47 stopped working chrome 49 onwards on mac. still working on chrome + ...

java - Aparapi data types -

i have following code studying. my calculate function produces unexpected results when runs on aparapi. is there problem code, or aparapi? results are; result num expected 2026982348 406816880 40681688012 2026982516 406816881 40681688180 2026982594 406816882 40681688258 2026982662 406816883 40681688326 2026982830 406816884 40681688494 2026982898 406816885 40681688562 2026982966 406816886 40681688630 2026983044 406816887 40681688708 2026983212 406816888 40681688876 2026983280 406816889 40681688944 2026983338 406816890 40681689002 2026983506 406816891 40681689170 2026983584 406816892 40681689248 2026983652 406816893 40681689316 2026983820 406816894 40681689484 2026983888 406816895 40681689552 2026983956 406816896 40681689620 2026984134 406816897 40681689798 2026984202 406816898 40681689866 2026984270 406816899 40681689934 edit: if set executionmode jtp or cpu, true results (result == expected) on gpu ...

Mad Lib program using Python -

automate boring stuff python has project in chapter 8: create mad libs program reads in text files , lets user add own text anywhere word adjective, noun, adverb, or verb appears in text file. it needs create new text file , print results screen. my solution causes blank new file created , shows nothing in terminal. using python 3.5.1 on os x. #! /usr/bin/env python3 open("/users/maverick/madlibproject1.txt", "wt") fout: open("/users/maverick/madlibproject.txt", "r") fin: line in fin: if line == "adjective": adj == input('enter adjective:\n') fout.write(line.replace('adjective', adj)) elif line == "noun": nou == input('enter noun:\n') fout.write(line.replace('noun', nou)) elif line == "adverb": adv = input('enter adverb:\n') ...

How to deal with files that are changed with zero impact in git? -

Image
i have couple of files in repository change every other commit these changes literally don't change anything. let me explain. example, have file called ethereal following contents: foo bar kappa i make commit , mysterious entity changes file this: foo, bar, kappa these files exactly same project. the mysterious entity changes them no reason. here's thing: git doesn't know these files same. that's why every commit includes meaningless change of file ethereal . and no, adding .gitignore won't because ethereal has in project repository. the commit clutter becomes real problem. solution found typing git update-index --assume-unchanged ethereal before every commit. but read here not supposed often. imagine there 20 files that. there's gotta better way of dealing this. the mysterious entity changes them no reason. here's thing: git doesn't know these files same. git see content changed if single byte has been modi...

Request never executes in node.js -

i'm struggling senseless problem: made request in node.js never executes. tried writing in every way, tried other api tools postman work , give me code use nothing work. console doesn't log anything, no errors, no responses, nothing. this (one of thousands versions made of): var options = { method: 'post', url: 'https://onfleet.com/api/v2/tasks', headers: { 'cache-control': 'no-cache', authorization: 'basic secret-code-auth-string' }, body: '{"merchant":"bno7g*q58ojqljtg25wntgyn","executor":"bno7g*q58ojqljtg25wntgyn","destination":"vrxou2hy~7ipqh*kcwtizito","recipients":["xbfxqmyvioxt3ufctq4tsbh3"],"pickuptask":"false","notes":"mega informazioni per chi consegna, lista prodotti e indirizzo di consegna","autoassign":{"mode":"load","team...

html - How do I center elements in a div or nav element? -

this navigation bar: #main-nav-bar .nav-item { display: inline-block; padding: 0.5%; border-right: 1px solid white; } #main-nav-bar { text-decoration: none; color: #cfcfe0; } <nav id="main-nav-bar"> <a href="#services" class="nav-tab nav-item selected">services</a> <a href="#resources" class="nav-tab nav-item">resources</a> <a href="#contact-us" class="nav-tab nav-item">contact us</a> <a href="#company" class="nav-tab nav-item">company</a> <form class="searchbar nav-item" action="http://www.google.com/search" name="f" target="_blank"> <input size="10" name="q" value="" class="searchform">&nbsp; <input type="submit" value="go!" name="btng" class="searchbutto...

profiling - How to organize data (writing your own profiler) -

Image
i thinking using reflection generate profiler. lets generating code without problem; how measure or organize results? i'm concerned cpu time memory suggestions welcome there lots of bad ways write profilers . i wrote thought pretty 1 on 20 years ago. is, made decent demo, when came down serious performance tuning concluded there nothing works better, , gives better results, dumb old manual method, and here's why . anyway, if you're writing profiler, here's think should do: it should sample stack @ unpredictable times, , each stack sample should contain line number information, not functions, in code being tuned. it's not important have in system functions can't edit. it should able sample during blocked time i/o, sleeps, , locking, because result in slowness cpu operations. it should have hot-key user can use, enable sampling during times care (like not when waiting user something). do not assume necessary measurement precision, necessita...

qt - QTreeView very slow sorting -

sorting qtreeview qsortfilterproxymodel extremely slow (compared basic qtreewidget). what's wrong code? how can speed-up? # coding: utf-8 import sys pyqt5.qtwidgets import (qtreeview, qabstractitemview, qmainwindow, qapplication) pyqt5.qtsql import (qsqldatabase, qsqlquery, qsqlquerymodel) pyqt5.qtcore import qsortfilterproxymodel class database: def __init__(self): self.db = qsqldatabase.adddatabase("qodbc") self.db.setdatabasename( r'driver={sql server native client 11.0};server={(localdb)\v11.0};') self.db.open() class model(qsqlquerymodel): def __init__(self, parent=none): super().__init__(parent) query = qsqlquery() query.prepare('select * companies name ?') query.bindvalue(0, '%elektro%') query.exec_() self.setquery(query) class treeview(qtreeview): def edit(self, index, trigger, event): if tri...

java - How do I create a JPanel and put it on a JFrame from another class? -

i trying learn java gui stuff. trying create special jpanel, have created in class [it panel 2 labels on it] inside 1 class, , using passed jframe add jframe other class. have been trying myjframe.add(thepanel) , such, never seems anything. have tried doubly making sure sset visible, @ reasonable location, ect. i trying create panel in 1 class, , .add given jframe. there not understanding. i not best @ java gui stuff... please kind :) advice can give wonderful. i using netbeans. if drag special panel created on panel in design editor, adds instance of panel, can't seem make own instance of , have appear.

Writing a Scope containing a method - Rails 4 -

i new rails , or advise appreciated i trying write scope displays users ratings equal or greater 4. unsure why scope not working , appreciated user.rb scope :ratings_equal_and_greater_than_4, where('average_rating_final_score >= 4') def average_rating_final_score if self.average_rating_score == 1.0 1 elsif self.average_rating_score == 2.0 2 elsif self.average_rating_score == 3.0 3 elsif self.average_rating_score == 4.0 4 elsif self.average_rating_score == 5.0 5 else self.average_rating_score end end def average_rating_score ratings_total.to_f / ratings_count end the scope works when written this: <% if user.average_rating_final_score >= 4 %> # display users ratings equal or greater 4 star <% end %> but write in views @users.ratings_equal_and_greater_than_4 could 1 kindly advise me how write correctly scope rails scopes arel - kind of ruby wrapp...

ajax - Typing a jQuery extension -

someone else wrote extension. surfaces ajax progress events syntax this: $.ajax(url) .progress(function(e) { // tracking downloading }) .uploadprogress(function(e) { // tracking uploading // if (e.lengthcomputable) { // var percentage = math.round((e.loaded * 100) / e.total); // console.log(percentage); //} }); typescript complains these new methods don't exist. it seems me need somehow add them jqueryxhr defined in jquery.d.ts definitelytyped. being third party library don't want edit - interfere updates. how go adding method typescript interface has been defined in file don't want edit? how go adding method typescript interface has been defined in file don't want edit typescript interfaces open ended , designed accomodate this. just create thelib.d.ts with: interface jqueryxhr { progress: any; uploadprogress: any; } more https://basarat.gitbooks.io/typescript/content/docs/types/ambient/interfac...

How to generate these vectors quickly in Python? -

suppose want generate vectors of length n such k components of n positions +1 or -1 (there no restrictions on being +1 or -1), , remaining n-k components zero. i can write code follows: from itertools import combinations, product result = [] x in combinations(range(n),k): y in product([-1,1],repeat=k) 0 = [0] * n in x: b in y: zero[a] = b result.append(zero) this way works, think bit tedious. there fast way give result? let's write function generates vectors of length n k 1s , n - k 0s: def gen(n, k): indices in itertools.combinations(range(n), k): l = [0] * n in indices: l[i] = 1 yield(l) then, let's turn of 1s -1s: def gen(n, k): indices in itertools.combinations(range(n), k): # each 1 of indices can -1 or +1 in range(len(indices) + 1): neg_indices in itertools.combinations(indices, i): l = [...

javascript: undefined variable -

Image
my variable 'todolist' showing undefined. new javascript , programming in general. appreciated! var todolist = { todos:[], displaytodos: function() { if (this.todos.length === 0) { console.log ('your todos list empty!'); } else { console.log('my todos:'); (var = 0; < this.todos.length; i++) { if (this.todos[i].completed === true) { console.log ('(x)', this.todos[i].todotext); } else { console.log('( )', this.todos[i].todotext); } } } }, addtodo: function(todotext) { this.todos.push({ todotext: todotext, completed: false }); this.displaytodos(); }, changetodo: function(position, todotext) { this.todos[position].todotext = todotext; this.displaytodos(); }, deletetodo: function(position) { this.todos.splice(position, 1); this.displaytodos(); }, togglecompleted: functio...

Filter wrong characters from android package name using regex -

i want filter wrong characters string (and replace them empty string later). tried making own regex expression have not succeeded make working. need javascript support. desired effect: com.12%example%.5a5pp => com.example.a5pp (regex matches: [1,2,%,%,5] ). you can find package name requirements here : a full java-language-style package name android application. name should unique. name may contain uppercase or lowercase letters ('a' through 'z'), numbers, , underscores ('_'). however, individual package name parts may start letters. i'm more familiar ruby myself, believe android apps written in java, , java can (?<) look-behinds. on assumptions, regex match incorrect character: /[^\w.]|(?<=^|\.)[^a-za-z]+/g you can plug 'replace' method replace match empty string. ( regex 101 place find meaning of each component of regex.) [update] javascript, doesn't support look-behinds, you'd have capture dot ...

swift - How to provide "hint" for Live Photo -

in ios human interface guidelines under live photos section apple says this, "make sure users can distinguish live photo traditional still photo. it’s important users make distinction when can share photo. best way show users they’re viewing live photo display little movement gives hint of experience. in cases hint isn’t possible, can display system-provided badge on live photo. live photo never displays playback button looks video playback button." i kind of confused on how provide little hint of movement in live photo. how provide hint of movement? you don't need dissect live photo still frames , construct animated uiimage, or dig out live photo's movie file... it's simpler. display user's live photo content in phlivephotoview . call startplaybackwithstyle: , pass .hint playback style "hint" hig talking about. there's no step three.

javascript - In Typescript, what is the difference between type and interface? -

what differences between following? type foo = { foo: string }; interface foo { foo: string; } interfaces can extended interface { x: number; } interface b extends { y: string; } and augmented interface c { m: boolean; } // ... later ... interface c { n: number; } type aliases, however, can represent things interfaces can't type numorstr = number | string; type neatandcool = neat & cool; type justsomeothername = sometype; so in general if have plain object type, shown in question, interface better approach. if find wanting write can't written interface, or want give different name, type alias better.

excel - VBA Matching Issues -

the following code used matching between 2 sheets. work fine, have problem when for example in sheet 1: (notes: use contents sheet 1 matching in sheet 2) cells(1, 8) value: rev# cells(1, 3) value: rev# in sheet 2: value rev#: 123xyz value rev#: pqrsabc rev# , rev# totally different thing, result program "123xyz". have idea correct result instead of rename rev# other? thanks advise. icol = 1 icol = 1 numofcol findstring = worksheets("temp_a").cells(1, icol).value set rng = activesheet.range(cells(1, 1), cells(numofrow1, numofcol1)).find(what:=findstring, lookin:=xlvalues, lookat:=xlwhole) if rng.value = "process type:" if instr(rng.offset(-1, 0).resize(1, 1).value, ":") > 0 temp = vbnullstring else temp = rng.offset(-1, 0).resize(1, 1).value end if else if instr(rng.offset(1, 0).resize(1, 1).value, ":") > 0 temp = vbnullstring...

php - Two Laravel Apps in one host only one app can login -

i have 2 laravel 5.2 apps in 1 host, 1 production , other staging. both have own database respectively. problem is, whenever login 1 app, other app fail login. know how deal it? i found answer it's not working 2 laravel apps, 1 can login here's configuration session.php 'driver' => env('session_driver', 'file'), 'files' => storage_path('framework/sessions'), 'cookie' => env('session_name', 'laravel_local'), 'path' => '/', 'domain' => null, it appear cookie used reference session being shared between both apps. make sure both apps have different value cookie config in config/session.php config file. 'cookie' => 'laravel_session', alternatively if using .env files (which noticed are) set cookie name, make sure change appropriate variable in .env file each app. be sure clear browsers cookies after making change. if possible creati...

arrays - MATLAB and Forward Euler Method -

i'm writing code uses forward euler method calculate following formula: dv(t)/dt = g - (c_drag) (p_air/p_water) (3v(t)^2 / 4*d ) i've outlined various constants in code below. clear; clc; close all; % 1. initialize dt = input('enter time step'); % choose delta t t_start = 0; % starting time t_end = 100; g = 9.81; y(1) = 0; p_air = 1.2; p_water = 1000; c_drag = 0.517; d = 0.002; nstep = ( t_end - t_start ) / dt;% number of time steps y = 1; % y(0) = 1, initial condition all_t = ( 1 : nstep ) * dt; % time points all_fe_y = zeros( nstep , 1 ); % approximate solution - pre-allocation all_exact_y = zeros( nstep , 1 ); % exact solution - pre-allocation % 2. forward euler time integration n = 1 : nstep y(n+1) = y(n) + (dt * (g - (c_drag * (p_air / p_water) * ((3*(y(dt))^2)/ (4*d))))); % compute solution @ time-step n+1 all_fe_y (n) = y(n+1); % store solution end % 3. compute exact solution n = 1 : nstep t = n * dt; all_exact_y...

PHP RESTful services; AJAX and DELETE method with username/password credentials -

i asked question related restful services here , , have question involving delete (put): same kind of situation want send along user credentials (username/password) put. delete service far: $http_req = $_server["request_method"]; switch ($http_req) { case delete: $user = $acct->read($_request["usernamedel"], $_request["passworddel"]); // method used read db table 1 record if (!empty($_request["deltaskid"]) && isset($_request["usernamedel"]) && isset($_request["passworddel"])) { if ($user == true) { $delete = fopen("php://input", "r"); $data = stream_get_contents($deleted); $params; parse_str($data, $params); $dropped = $mgr->delete($params["id"]) // calls method deletes particular row based on id echo $dropped; } ...

ios - Having trouble 'segueing' from one view controller to another, getting weird warnings -

i getting strange error. think compiler trying tell me can't segue view controller until done executing code in current view controller not sure. i'm literally getting input using alert box (i.e. calling function called generatetextfield ). then when done i'm saying "hey want go view controller" - the compiler instead tells me "hey don't think so". here error: warning: attempt present hairstyle1viewcontroller: 0x7...> on browsebarbersviewcontroller: 0x7...> presenting warning: attempt present hairstyle1viewcontroller: 0x7..> on browsebarbersviewcontroller: 0x7...> presenting @ibaction func addnewstylebuttonclicked(sender: anyobject) { // "hairstyle name" user generatetextfield(); // ok done function, transition // next screen performseguewithidentifier("hairstyle1", sender: self); } // generate text field user input (i.e. call alert function) ...

java - How do I make signOut Google+ in onNavigationItemSelected -

i'm doing sign in google+ leads navigation.activity. ive follow instruction on google developer took signin method(success) im stuck @ navigation.activity. how make logout navigationitemselected? what problem : google plus signin in main activity need logout navigation activity... ty helping else if (id == r.id.logout) { } this onresult @override public void onresult(googlesigninresult googlesigninresult) { hideprogressdialog(); handlesigninresult(googlesigninresult); } it call hideprogress , handlesigninresult method.. private void handlesigninresult(googlesigninresult result) { log.d(tag, "handlesigninresult:" + result.issuccess()); if (result.issuccess()) { // signed in successfully, show authenticated ui. intent intent = new intent(main.this,homeactivity.class); startactivity(intent); } else { // signed out } } private void hideprogressdia...

c++ - Singleton Design Pattern - Explicitly stating a Constructor outside the class -

i trying implement singleton pattern assumption of using private constructor, private instance of class , public static method return instance. encountered error following code in visual studio // singleton invoice #include <iostream> using namespace std; class singleton { public: //public static method return type of class access instance. static singleton* getinstance(); private: //private constructor singleton(); //private static instance of class static singleton* objsingleton; }; singleton* singleton::objsingleton = null; singleton* singleton::getinstance() { if (objsingleton == null) { //lazy instantiation: if instance not needed never created objsingleton = new singleton(); cout << "object created" << endl; } else { cout << "object created" << endl; } return objsingleton; } int main() { singleton::getinstance(); singleton::getinstance(); singleton::getinstance(); return 0...

android - How to query all the download item from the system DownloadProvider? -

is there method query download item system downloadprovider,i that,but need permission:android.permission.access_all_downloads,and worstly,this permission in signature level,i can't permission,is there other solution this.and want develop app manager downloads of system.thanks lot! int columnid = c.getcolumnindex(downloadmanager.column_id); int columntitle = c.getcolumnindex(downloadmanager.column_title); log.d(tag, "query complete!-->" + c.getcount()); (int = 0; c.getcolumnname(i) != null; i++) log.d(tag, c.getcolumnname(i)); while (c.movetonext()) { int status = c.getint(c.getcolumnindex(downloadmanager.column_status)); long id = c.getlong(c.getcolumnindex(downloadmanager.column_id)); string title = c.getstring(c.getcolumnindex(downloadmanager.column_title)); switch (status) { case downloadmanager.status_paused: ...

math - Is there an Inverse Error Function available in Swift's Foundation import? -

i'm using erf function in swift, this: import foundation erf(2) is there inverse error function well? we not have such function in standard library. here implementation of function- https://github.com/antelopeusersgroup/antelope_contrib/blob/master/lib/location/libgenloc/erfinv.c hth.

How to set :host {} based on media query in Polymer? -

i have set height on :root element, or else not viewport size want scrollbar. however, want set height: calc(100% - 130px); when viewport less 900px. how can since can not use @media query? tried no success: <template> <style include="iron-flex iron-flex-alignment"> :host[show] { background-color: var(--pink-color); width: 100%; overflow-x: hidden; overflow-y: auto; outline: none; display: flex; } :host[smallscreen] { height: calc(100% - 130px); } <div hidden$="{{!show}}"> <iron-media-query query="(max-width: 899px)" query-matches="{{smallscreen}}"></iron-media-query> ... <script> polymer({ is: 'video-selection', properties: { show: { type: boolean, value: true, reflecttoattribute: true }, smallscreen: { type: boolean, ...

Arrays.fill complexity in java -

how arrays.fill(char[] a,char val) implemented internally in java ? and complexity of it? if definition of fill(char[] a, char val) available in java.util.arrays class. it such this public static void fill(object[] a, object val) { (int = 0, len = a.length; < len; i++) //this loop continues length of a. a[i] = val; } so, complexity method o(n) . n length of object array object[] a passed parameter.

Android studio selecting wrong layouts -

Image
i new android. building first application. i have been trying make support multiple screens. have gone through developers section in android, but, not clear @ these things. what resolution, should use different drawable folders? (for example hdpi screen may have 500*600 screen or 1280*1920 screen.) i have been using layout folders mentioned in developers page, small, normal , rest, android keeps on selecting normal layouts screens nexus 6p(for guessing large appropriate). is there way make better?? have write layout once have define dimensions dimens.xml different different resolutions in app>res>values.