Posts

Showing posts from April, 2012

Varying a stroke width of a curve in JavaFX -

Image
is there way create curve in javafx varying stroke width? example, starting @ 10 point , end @ 1 point. you can't vary stroke width. you can simulate behavior though, creating path layers multiple curves, start @ different starting positions converge single point. import javafx.application.application; import javafx.scene.group; import javafx.scene.scene; import javafx.scene.paint.color; import javafx.scene.shape.*; import javafx.stage.stage; import java.util.random; public class dividedpath extends application { private static final double width = 400, height = 400; private static final random random = new random(42); @override public void start(stage stage) { cubiccurve curve = randomcurve(width, height); path path = new path(); (int = -5; <= +5; i++) { path.getelements().addall( new moveto(curve.getstartx() + i, curve.getstarty()), new cubiccurveto(

angularjs - How to delay running logic for directive until ui-route is resolved? -

i using angularjs ui-router. attempting make use of angularjs pdf directive available @ https://github.com/sayanee/angularjs-pdf . i'm having make changes example given because not have url pdf right off bat. however, ran problem. because pass id value associated pdf route, have wait resolve parameter until route change has been successful. accomplished guidance @ https://github.com/angular-ui/ui-router/wiki under resolve section. but, when, visit page, before of resolved, , before make query api id resolve url of file, find myself clicking through directive. of course, haven't populated scope of directive values since route hasn't returned resolve promise yet, null value, give me error in pdf.js url isn't populated. how can delay executing logic within directive until scope has been appropriately populated require? so don't have download directive linked @ top, here's i'm working with: (function () { 'use strict'; angular.mo

liferay 6 - Can't set action in aui:form although I named the action in MVCPortlet -

i'm having bit of problem tracing error comes from, in jsp have form set this: <jsp:usebean id="usuario" type="com.cide.cajavirtual.econtinua.model.estudiantes" scope="request"> </jsp:usebean> <jsp:usebean id="compras" type="com.cide.cajavirtual.econtinua.model.estudiantescompras" scope="request"> </jsp:usebean> <% calendar = calendarfactoryutil.getcalendar(); %> <portlet:actionurl name="registrarcompra" var="registrarcompraurl"> <aui:form name="fmcompra" action="<%=registrarcompraurl.tostring() %>" method="post"> then in portlet class have: public class cajavirtualportlet extends mvcportlet { /* * el portlet registrousuarioscomprasportlet permite los estudiantes llenar la forma * de registro y hacer una compra de la oferta de educación continua * */ public void addcompra(actionrequest request, action

android - Change a ListView Item's Height based off it's location on the screen -

i'm trying make listview size of items in list view enlarged scroll up. have been looking ways buti'm having trouble finding how modify listview's scroll. thanks help. so after working @ while made discoveries. resizing size of each item computationaly rediculousely expensive. don't, once. this lead new approach. instead resize things inside view. has same effect drastically faster. this can done creating custom listitemview extends listview , overriding drawchild method. hope helps tries similar.

osx - Closing an App on Mac using Ruby code -

i can open app using file_to_open = "/applications/revu.app" system %{open "#{file_to_open}"} but i'm not sure how write code close using ruby. appreciated. shell out applescript: system %{ osascript -e 'tell application "revu" quit'}

Android Activities for Chat Application: Which flags or lauchmodes for Contact List (Roster) and Chat Conversation? -

i'm making chat app using asmack , i'm using activity login, b contact list , c conversation activity(where chat). is: a → b → c on activity b i've set android:launchmode ="singletask" dosen't create new instance everytime press button on activity c , far works. my goal create new instances of c , @ same time not destroy instances when go b. normal chats do. example: a → b → c1 a → c1 → b → c2 and able call c1 , not create new instance. example: a → c2 → b → c1 i've try using different intent flags , launchmodes , far failed. idea on how achieve this?

javascript - my html selecting code select all the html boxs -

i made jquery code can click link on top of "htmlbox" select inside "htmlbox" <p class="selecthtmlcode">إضغط هنا لتحديد النص أسفله</p> <textarea readonly="" class="htmlcode">&lt;div id='allinantiadblock'&gt; </textarea> $(document).ready(function(){ $( ".selecthtmlcode").click(function() { $( ".htmlcode" ).select(); }); }); but problem when have more 1 "htmlbox" (every 1 have selecting link on top of it), select last "htmlbox" simply want every link select "htmlbox" not last 1 or of them here link have problem http://showtime-info.blogspot.com/2014/04/24-anti-adblock.html by way "إضغط هنا لتحديد النص أسفله" means "click here select below text" you want select next .htmlcode element: $(".selecthtmlcode").click(function() { $(this).next(".htmlcode").select(); });

Woocommerce change default order [method - price] shipping en CART -

wc-cart-functions.php function wc_cart_totals_shipping_method_label( $method ) { $label = $method->label; if ( $method->cost > 0 ) { if ( wc()->cart->tax_display_cart == 'excl' ) { $label .= ': ' . wc_price( $method->cost ); if ( $method->get_shipping_tax() > 0 && wc()->cart->prices_include_tax ) { $label .= ' <small>' . wc()->countries->ex_tax_or_vat() . '</small>'; } } else { $label .= ': ' . wc_price( $method->cost + $method->get_shipping_tax() ); if ( $method->get_shipping_tax() > 0 && ! wc()->cart->prices_include_tax ) { $label .= ' <small>' . wc()->countries->inc_tax_or_vat() . '</small>'; } } } elseif ( $method->id !== 'free_shipping' ) { $label .= ' (' .

playframework 2.2 - Redis connection closes when multiple tests are running in the same time -

i have few test cases in 1 class , 1 succeed others failed redis pool exception. how can make sure other tests can connection pool? [error] jedisconnectionexception: : not resource pool (pool.java:22) [error] redis.clients.util.pool.getresource(pool.java:22) [error] org.sedis.pool.withjedisclient(sedis.scala:79) [error] com.typesafe.plugin.redisplugin$$anon$1.set_(redisplugin.scala:147) [error] com.typesafe.plugin.redisplugin$$anon$1.set(redisplugin.scala:106) [error] play.api.cache.cache$.set(cache.scala:58) [error] controllers.security$resultwithtoken.withtokenshort(security.scala:51) [error] controllers.security$resultwithtoken.withtemptoken(security.scala:62) [error] controllers.security$$anonfun$hastoken$1$$anonfun$apply$3.apply(security.scala:83) [error] controllers.security$$anonfun$hastoken$1$$anonfun$apply$3.apply(security.scala:83) [error] controllers.security$$anonfun$hastoken$1.apply(security.scala:82) [error] controllers.security$$anonfun$hastoken$1.apply(securit

Java wierd error when trying to load image -

this question has answer here: nonstatic method cannot reference static context 4 answers i trying load image using static image terrain = null; followed by public static void main(string[] args) { arcanus arc = new arcanus(); try { terrain = imageio.read(getclass().getresource("arcanus terrain tileset.png")); font customfont = font.createfont(font.truetype_font, new file("golden-sun.ttf")).derivefont(12f); graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); ge.registerfont(font.createfont(font.truetype_font, new file("golden-sun.ttf"))); arc.setfont(customfont); } catch (ioexception e) { e.printstacktrace(); } catch (fontformatexception e) { e.printstacktrace(); } } but following error uncompilable source code - no

jquery - Why isn't JavaScript for loop incrementing? -

i'm trying replace <li> 1. 2. 3. respectively. managed change <li> number, number 0 . loop doesn't want work. honest, method may impossible. take @ fiddle if you'd like. this function(){...} : function doit(){ var input = document.getelementbyid("input"); var li = /<li>/; // match opening li var lib = /<\/li>/; // match closing li var numberofitems = input.value.match(li).length; // number of lis occur for(var = 0; < numberofitems; i++) { insertnumber(i); // execute insertnumber function w/ parameter of incremented } function insertnumber(number){ input.value = input.value.replace(li, number + "." + " ").replace(lib, ""); } } i understand insertnumber(){...} function is not necessary. here's alternative method , turning html textarea contents dom elements jquery can manipulate

java - Calendar getTimeInMills = July 4, 46452? -

i using calendar on samsung note. if new instance of calendar calendar.getinstance() , call gettimeinmills() without doing else 1403732346277, apparently value in far future. i need unix style timestamp. there other preferred way this? or reason why calendar returning value (i.e. standard adjustment can make)? unix time represents number of seconds epoch. name implies, gettimeinmillis() return number of milliseconds epoch. need divide milliseconds 1000 unix time. long unixtime = calendar.getinstance().gettimeinmillis() / 1000;

java - Is there a difference between int[] b = new int[a.length] b=a and int[] b = a? -

is there difference between int[] b = new int[a.length]; b=a; and int[] b = a; in java? they're same, there few differences: in general, first 1 create array becomes unreachable (eligible garbage collection), not exist. (in both versions, b ends referring same array a , aside caveats below.) if a null , first 1 throw nullpointerexception . if you're unlucky, first 1 throw outofmemoryerror or similar. the first 1 more cause compiler warnings, findbugs warnings, etc.

android - How to download file and store in sdcard? -

i working on should download file server , store in sdcard . but getting exception : java.io.filenotfoundexception (permission denied) public class mainactivity extends actionbaractivity { // usually, subclasses of asynctask declared inside activity class. // way, can modify ui thread here private class downloadtask extends asynctask<string, integer, string> { private context context; private powermanager.wakelock mwakelock; file file,sdcard; public downloadtask(context context) { this.context = context; } @override protected string doinbackground(string... surl) { system.out.print("background"); inputstream input = null; outputstream output = null; httpurlconnection connection = null; try { url url = new url(surl[0]); connection = (httpurlconnection) url.openconnection();

QA Requirements for KIK Integration -

blacklist: using kik's blacklist. screen words match blacklist exactly/completely. means, if player nest blacklisted word in more characters before and/or after word, not reject entry. instance, "ahole" rejected, "uraholedood" accepted. q: how restrictively kik's qa need apply blacklist? we're screening exact matches within kik's blacklist. load time / stopwatch timings: apply load of launch screen? or apply load time of every screen transition? , connection should testing on (eg 3g, wifi)? thanks! kik mobile web browser there no qa requirements having website show in browser. i'm going assume referring form of promotion kik (ads, featuring, etc) kik doesn't have officially documentated blacklist of words. documentation says websites must pg13 show in search or top sites ( http://dev.kik.com/build/#search ). use judgement in terms of deciding should/shouldn't shown kik overlays white loading screen on top of website

asp.net mvc 4 - Site returning blank page after deployment -

i'm working on mvc site working fine @ local, when deploy on server, specific page doesn't work (all other pages working perfectly)..it's returning blank page, status code 200 ok. i'm deploying site using publish profile visual studio , web deploy. ideas causing this? managed solve myself, posting answer in case else has same problem. put try catch in controller (in action method should redirect view) , in catch block wrote this: catch (exception ex) { response.statusdescription = ex.message; } to able see exception message in browser.

bash - Print out shell variables and "" in awk/sed script using echo/printf -

a printout question: need print out following awk .sh file. (remove row has "0" in 12th column) awk -f, '$12 != "0"' output.csv >> output2.csv here our script (the case loop necessary purpose. small step of bigger script. assume $targetids=123): case $targetids in ($p1) echo "awk -f, '$12 != "0"' ${targetids}_output.csv >> ${targetids}_output2.csv" >> output.sh; (*) ;; esac this print out following in "output.sh". "$1" in "$12" disappears : ( awk -f, '2 != "0"' 123_output.csv >> 123_output2.csv we try array: v="12" b=($v) case $targetids in ($p1) echo "awk -f, '${b[1]} != "0"' ${targetids}_output.csv >> ${targetids}_output2.csv" >> output.sh; (*) ;; esac this print out following in "output.sh". $12 disappear: awk -f, ' != 0' output.csv >> output2.c

ios - Sending data between users in the form of nsstrings - http post method -

i'm struggling quite bit concept of setting server communicate ios app i'm quite new @ programming (i know basics objective-c, not servers), hoping submit data need in form of nsstring server, sending user of same app on iphone, message. wondering if possible, communicating other iphone users through same app remotely, without using bluetooth. this broad question please forgive broad response. are limited distance, i.e. in same room or far away each other. if close maybe multipeer connectivity framework option. suspect no bluetooth part isn't case. given new using remote server app guess don't have skills or desire maintain 1 yourself. in case there are lots of services called baas (backend service), parse 1 such provider there many others out there. said might want check out firebase https://www.firebase.com/ , more chatty , more real time communication (i bring because mentioned sending message app). in general of them should have easy use sdk m

how to do dynamic sql query in vb.net? -

i'm trying dynamic sql query in vb.net declare 2 variable , pass select on each variable dim cmd new sqlcommand("declare @val1 int " & _ "declare @val2 int " & _ "set @val1 = 'select count(*) table1tbl'" & _ "set @val2 = 'select count(*) table2tbl'", conn) dim rdr sqldatareader = cmd.executereader rdr.read() dim str1 = rdr("@val1") dim str2 = rdr("@val2") rdr.close() i know code not right..so how makes right ? tnx in advance you can't sqlcommand, execute code you'd have create stored procedure , add end: select @val1, @val2 to return values table creating. i assume doing more creative actual example, there anyway of including in select statement? correct version should go this: select (select count(*) table1tbl), (select count(*) table2tbl) that return data in

golang: convert struct pointer to interface{} -

if have: type foo struct{ } func bar(baz interface{}) { } the above set in stone - can't change foo or bar. additionally, baz must converted foo struct pointer inside bar. how cast &foo{} interface{} can use parameter when calling bar? to turn *foo interface{} trivial: f := &foo{} bar(f) // every type implements interface{}. nothing special required in order *foo , can either type assertion : func bar(baz interface{}) { f, ok := baz.(*foo) if !ok { // baz not of type *foo. assertion failed } // f of type *foo } or type switch (similar, useful if baz can multiple types): func bar(baz interface{}) { switch f := baz.(type) { case *foo: // f of type *foo default: // f other type } }

oauth - CakePHP GmailOath Retrieve Contacts -

below link gmailoauth used cakephp nowadays whenever there new project, generated client id , client secret no longer work before. part need modify it? https://code.google.com/p/rspsms/source/browse/trunk/system/plugins/gmailcontacts/gmailoath.php?r=11 found out solution, looks newly generated client id , client secret have phased out older version of api. way make works implementing google contact apiv3 , using oauth2. hope rest having same issues.

javascript - Need to store JSON data in tabular form and to store it in a text field of a specif form -

i have create tabular form of data getting field in json format. when writing below code code works fine in mozilla showing error in ie. , need store value in textfield. please help. suva.js var data =[ { "id" : "1", "name" : "sh", "workphone" : "0804568944", "department" : "1", "location" : "dfd", "pickup" : "1" }, { "id" : "2", "name" : "sdfg", "workphone" : "0804562255", "department" : "ss", "location" : "2", "pickup" : "2" }, { "id" : "2", "name" : "sdfg", "workphone" : "0804562255", "department" : "ss", "location" : "2", "pickup" : "2" }, { &quo

ios - Autosize UILabels in custom style UITableViewCell -

Image
i've got uitableview 2 cell prototypes. 1 (the first 1 in screenshot above) might recognise subtitle style standard cell. second 1 custom , text field. when run app, labels using first template size width nicely depending on size of text in them, whereas 1 using custom template doesn't scale, clipping text after 3 characters. is there way configure custom template in xcode storyboard designer size label built-in subtitle cell template does? set constraints shown in figure the truncated label in image (t..) textfield. set row height minimum size cell 155.

iphone - How to update notification badge number in iOS's home screen when received push message? -

i want ios device can auto update budges number in home screen (app not run). currently, i'm using push notification , it's can receive push notifications ok. budges number don't auto update (it's can update after clicked view detail push notice). questions how reload budges number when received push message app not run (background app) - line chat app? function show budges number in appdelegate bellow: - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { int total_budges = [[userinfo objectforkey:@"badge_count"] intvalue]; [uiapplication sharedapplication].applicationiconbadgenumber = [uiapplication sharedapplication].applicationiconbadgenumber + total_budges; } thanks all! - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo method never going called when application background state else in-active state need manage it's badge count

curl - Using following shell script to find data on web with given username and password -

the following code prints files contains both- string1 , string2. want functionality find same on given ip-address given userame , password. kindly suggest modifications incorporate functionality for file in `find -name "*.java"` grep -q "string1" $file && grep -q "string2" $file && echo "\n`basename $file`" done for making search of file on remote machine never been easy. but in case want , have rights make search on remote computer, might want follow below steps. 1) first of believe current shell script naive. need improve this faq 2) now, need learn build basic .xml file through ant. need learn use it's sshexec functionality. execute shell script on remote machine 3) ensure ftp service , put shell script on remote machine through ftp. 4) execute through ant build , write data. i suggesting considering want run shell script "on remote machine" (not web) , allowed enter machine t

Loop inside the loop - python -

i want highest quantity sold s specific product id , i'm stuck. don't know how add loop calculate total quantity of each product id. below code , xml file. thank in advance. import xml.etree.elementtree et root = et.elementtree(file="nwind_medium.xml") orders = root.findall("./orders") order in orders: orderdetails = order.findall("./orderdetails") total = 0 detail in orderdetails: productid = detail.findall("./products/productid") quantity = detail.findall("./quantity") total += float(quantity[0].text) print total <?xml version="1.0"?> -<nwind> -<orders another="friday" orderid="10248"> -<customers> <companyname>vins et alcools chevalier</companyname> <customerid>vinet</customerid> </customers> -<orderdetails> -<products> <productid>72</productid> <produ

Android, Different drawable folders -

are able define drawable folders landscape , portrait screen able define layers defining layout-land ? and able define screen mode (xhdpi , ...) , rotation in same time? yes, example "drawable-land-xhdpi" should work fine. references: http://developer.android.com/guide/practices/screens_support.html#designingresources drawable-land-xhdpi = invalid resource directory name?

web scraping - Issues with my Crawl Spider and Pagination. Only Value from the First Page being Extracted -

my task take stock updates 1 of suppliers : www.sportsshoes.com . the issue facing despite crawl spider visiting each page of category page gives returns data first page. case if try , scrape each page independently i.e if assign scrape third page of category returns results first page. my code: from scrapy.contrib.spiders import crawlspider, rule scrapy.contrib.linkextractors.sgml import sgmllinkextractor scrapy.selector import htmlxpathselector scrapy.spider import basespider sportshoes.items import sportshoesitem import urlparse scrapy.http.request import request class myspider(crawlspider): name = "tennis" allowed_domains = ["sportsshoes.com"] start_urls = ["http://www.sportsshoes.com/products/shoe/tennis/", "http://www.sportsshoes.com/products/shoe/tennis#page=2", "http://www.sportsshoes.com/products/shoe/tennis#page=3"] rules = (rule (sgmllinkextractor(allow=(),restrict_xpaths=

vim plugin - Vim hard or soft tab depending on what's used in the file -

is there vim command or plugin span source file i'm opening, , adjust tab setting whatever used in file. i work on diverse codebase @ work, source files using hard tabs, other 4 space soft tabs, , other's 2 space soft tabs. hard tab, if forgot changes, can lead ugly whitespace in different editors if forget change when i'm editting soft tab file. i'd not have remember check whatever's convention used in file every time open buffer, , adjust preferences accordingly. i use yaifa great success. it's pretty "install-and-forget" plugin says without ever getting in way. working in messy environment work in horrible until found gem.

JavaScript - Converting URL like string params to an array -

i have string this: var str = 'my_type_1=ssd&my_value_1=16gb&my_category_1=disk capacity&my_type_2=sony &my_value_2=ps4&my_category_2=console&my_roworder=2,1'; string has 3 parts except last key: part 1 -> - common prefix part 2 -> type or value or category , can keep changing part 3 -> it's numeric value binding part 1, part 2 , part 3 spreadsheet row. the last key called my_roworder , it's comma delimeted value. specifies how construct output array. in above example, 2,1 means key value pair of my_type_2=sony&my_value_2=ps4&my_category_2=console should first in output array. using javascript, parse string , create array out of it, such output is: array ( [ 0 ] => array ( [type] => sony [value] => ps4 [category] => console [row] => 2 ) [ 1 ] => array ( [type] => ssd [value] => 16gb

Android - setListAdapter() + notifyDataSetChanged() clarification -

i have listfragment data populated custom adapter ( simpleadapter in case). experiencing issues using notifydatasetchanged() within class extended listfragment . after lot of looking around , several (useful) stack overflow posts later: listview not updating notifydatasetchanged() call android listview not refreshing after notifydatasetchanged adapters notifydatasetchanged not work notifydatasetchanged not working listview not update when calling notifydatasetchanged baseadapter i understand loose (and highly un-recommended) workaround re-set adapter using setlistadapter() . facing issues well. the documentation, http://developer.android.com/reference/android/app/listfragment.html#setlistadapter(android.widget.listadapter) , mentions setlistadapter() provides cursor list view. but still have questions. q1. initializing adapter multiple times using setlistadapter() 'point' same adapter instance ? q2. happens when call made getlistadapter() , noti

c++ - Simple error with the creation of a thread -

i try remember of how threads work, see c++11 simplify creation , utilisation of it. use answer post simple example of threading in c++ create simple thread. but there's difference between me , answer of post, i'm not in main, create thread in constructor, , it's not same parameters. here's simple code , try do: i'm in class mainwindow.cpp : //constructor mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { // constructs new thread , runs it. not block execution. thread t1(lancerserveur, null); ui->setupui(this); } void mainwindow::lancerserveur(){ std::cout << "le serveur se lance"; } the errors : expected ';' before 't1' statement cannot resolve address of overloaded function thread t1(lancerserveur, null); i think parameters thread t1(lancerserveur, null); false. could explain me how works ? thanks. you use std::cout , i'm assuming

javascript - Efficient logging in JS -

is there way in js make logging more efficient , without calling methods when not necessary use macros in c++ this. lets have logger , log('warning', 'this object' , json.parse(obj)); i dont want json.parse called if log level below warning. is there way way around had of thought of somehow encapsulating function call , logger calling function inside result think overhead of creating function each time not worth it. thoughts ? thanks.

ms access 2013 - Dlookup string failing -

for reason can't dlookup function correctly keep getting errors. error data type mismatch. option compare database private sub command131_click() docmd.setwarnings false if (nz(dlookup("lettersent1bool", "dbo_t_volunteers", _ "volunteerid = '" & me![volunteerid] & "'"))) > 0 msgbox "error ! volunteer has received letter ," else docmd.openquery "produceletterssixtotwelve", , acreadonly if dcount("*", "dbo_t_sixtotwelveweeks") > 0 msgbox "success ! please open mail merge template" else msgbox "error ! no records found" end if end if end sub figured out, need remove quotes around & me![volunteerid] option compare database private sub command131_click() docmd.setwarnings false if (nz(dlookup("lettersent1bool", "dbo_t_volunteers", _ "volunteerid = " & me![volunteerid]))) >

.net - multiple column group by and sum only two columns -

searchlist.groupby(s => new { s.clientref, s.clientname, s.option, s.wineid, s.producer, s.brand, s.variety, s.format, s.vintage, s.maturityto, s.rps, s.tradedate, s.target, s.auctionrequested, s.ukupdated, s.globalupdated }) .select(y => new { clientref = y.key.clientref, y.key.clientname, y.key.option, y.key.wineid, y.key.producer, y.key.brand, y.key.variety, y.key.format, y.key.vintage, y.key.maturityto, y.key.rps, y.key.tradedate, y.key.target, y.key.auctionrequested, y.key.ukupdated, y.key.globalupdated, totalbottles = y.sum(z => z.bottles), totalunitprice = y.sum(z => z.unit) }).tolist(); hi above actual query like. want group key columns come string[] cols rather fix. columns 3,4 or number 18 , sum during group process. so want searchlist.groupby(s=>cols.split(',')) .select(new {cols.split(','), totalunit= s.sum(z=>z.unit),totalbottles= s.sum(z=>z.bottles)}).tolist (); step 1: download

c# - Currency Format for CSV File -

i'm formatting currency local standard e.g. format 20000 r 20 000,00 using standard c# double.tostring() string amount = order.amount.tostring( "c", system.globalization.cultureinfo.createspecificculture( "en-za" ) ); this works pretty until data exported csv file produces funny characters one: r 20 000,00. if open same cvs file in plain text file looks good. anyone know how can rid of ugly looking a? thanks in advance! edit here's how csv file gets created: return file( new system.text.utf8encoding().getbytes( csv ), "text/csv", "order_report.csv" ); i'm writing app using asp.net mvc , opening in excel opening regular csv file.

Laravel generate secure https URL from route -

i can't find way generate secure url from route name. to full url, use echo route('my_route_name'); but do, if want url https? update: pointed out in comments, simpler way of doing adding url::forceschema('https'); laravel version between 4.2-5.3 or url::forcescheme('https'); version 5.4+ in boot method of appserviceprovider file. old answer: it's entirely possible , there's 1 line of code needed accomplish that. laravel doesn't check presence of ssl itself, depends on symfony. , there goes our key making believe current request secure. the thing is, have set https server param true , easiest method paste following code in boot method of appserviceprovider : $this->app['request']->server->set('https', true); in case, need force ssl in production, local env should still work on http. how force ssl on production: $this->app['request']->server->set('https', $t

Where can I download english dictionary database in a text format? -

i need read text file word , return meaning. other file format work. the gutenberg project hosts webster's unabridged english dictionary plus many other public domain literary works. looks they've got several versions of dictionary hosted copyright different years. 1 linked has 2009 copyright. may want poke around site , investigate different versions of webster's dictionary.

Access SQL Query: Comparing Date In Select Statement -

i have problem cannot seem figure out. have list of employees different travel dates , want display of them in cascading list format. problem want see employees once, , date closest today. for example have 'smith' in there multiple times dates before , after today, keep historical records. means can't min, try , display date before today, , max far forward. the code example below works. problem in select statement. want show minimum date after today, instead gives me 0's , -1's dates should be. there might way together, configuration seems allow other information such site, position, , comments displayed correctly alongside it. select a.`last name` [last name], min(a.`date in`) > now() [date in], max(b.site) site, max(b.position), max(b.comments) comments deployments inner join deployments b on a.id = b.id group a.`fsr name` having (((max(a.`actual tep in`))>now())); i did group name because want see each individual once. if don't add table jo

regex - Retrieving text from Pattern1 to Pattern2 - Python -

i have input file below pattern1 ptr1 blah blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2 pattern1 ptr2 blah blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2 ............................ ............................ pattern1 ptrn blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2 i need function return first column entries pattern1 pattern2 below, ptr1 needthis thisoneaswell ptr2 needthis thisoneaswell ...................... ...................... ptrn needthis thisoneaswell ptr1 , ptr2 ...... ptrn each different texts. pattern1 & pattern2 different consistently present in file. how can achieve in python? i still beginner in python , trying achieve use re.findall() not getting desired o/p: def retrieve(): file = open("filename","r") string = re.findall(r"pattern1",file.read()) print string you nest 2 regexes: txt='''\ p

java - Regular expression to reduce spaces between function parameters -

i have program i'm trying compare 2 files. file 1: void function( col1, col2, col3 ) file 2: void function(col1,col2,col3) what regexp should use remove spaces , enter between ( , ) since want reduce space between brackets , not other place in code. this problematic. pure java regex solution have compromise because correctly assess question "are between parentheses?" requires (in worst case, depending on input) handle nested parentheses, text within strings or comments should not modified , possibly other edge conditions. keeping in mind, simplistic solution works on example @ least (and assumes doesn't have handle nested parentheses, comments or strings, , doesn't have check whether parentheses belong function definition), be string result = subject.replaceall("\\s+(?=[^()]*\\))", ""); this matches , replaces whitespace iff next parenthesis after closing parenthesis.

javascript - drag and drop while keeping copy of dragged element -

i want drag , drop input elements 1 div div while keeping copy of dragged element in parent div.i achieve this.but after dropping droppable div still performing drag , drop function.and allowing make multiple copy also.but don’t want this.. how can avoid in droppable div. function allowdrop(ev) { ev.preventdefault(); } //alert("droped"); //alert("droped"); function drag(ev) { //alert("dragging"); ev.datatransfer.setdata("text",ev.target.id); } function drop(ev) { var data=ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data).clonenode(true)); ev.preventdefault(); } html page: <div id="drag1

javascript - calculate number of checked checkbox in angularjs -

i try display how many checked checkboxes using code <li class="list-group-item" ng-repeat="user in data"> <input type="checkbox" ng-model="user.checked"/> {{user.name}} </li> <p>total checked: {{user.checked.length}}</p> i tried count() within {{}} doesn't work. demo plunker you should filter users checked property: <p>total checked: {{ (data | filter:{checked: true }).length }}</p>

jquery - Parsley form always fails validation on first submit -

i have form i'm trying validate parsley this: $('form#captainregistrationform').on('submit', function() { var $this; $this = $(this); if ($this.parsley('validate')) { console.log('yes'); } else { console.log('no'); } return false; }); unexpected behavior: on first submit, console returns no (regardless of whether form valid or not). on second submit returns yes (if form valid). after second submit, purposely make form wrong, on third submit, console returns yes . after press submit again returns no . is there reliable way validate form parsley? i'm using parsley version 2.0.2 its kind of late respose. however, not binding parsley form before submit. should this: // bind parsley form $('form#captainregistrationform').parsley(); // on form submit, validate form $('form#captainregistrationform').on('submit', function(e) { var $this; $this = $(this); if ($th

python - How to read integers from byte file one time? -

i want read data .yuv file using python. these data uint8 integers. use such command: fp = open(filename, 'rb') data = fp.read(100) i 100 bytes data string. know can use ord() transfer 1 byte str 1 integer 1 time. how can read or transfer 100 integers in array 1 time? use struct.unpack : with open(filename, 'rb') fp: integers = struct.unpack('100b', fp.read(100))

google play - Android Alpha/Beta testing -

my company releasing communication app android in coming weeks/months. embedded app on nexus 7 2013 device, running aosp minor modifications. makes typical remote updates complicated there's step must run install apk/libs os system folders. the plan alpha , beta trials, , have started gathering volunteers. we'll loading apk onto devices , giving them out initially. i've found plenty of information on preparing release (unit testing, signing apk, etc) i'm looking information on alpha , beta releases. problems: we need update app remotely without bringing devices in we need gather (useful) data possible on usage, device statistics, bugs , crashes research & possible solutions: developer console alpha/beta testing - https://developer.android.com/distribute/googleplay/developer-console.html app blade or other third party support tools - https://appblade.com analytics libraries flurry - https://developer.yahoo.com/analytics mixpanel - https://mixpa

c# - Switch on Type with Dictionary on Func and async / await -

i'm trying write piece of code doesn't compile (stuff deleted/simplifiied): private async task<patientchartdata> getdomainlistingsummarymeta<t>(string phn) t : patientchartbase, new() { var getlistingsummarytypeswitch = new dictionary<type, func<????>> { { typeof(documents), async () => await this.getdocuments(phn) }, { typeof(encounters), async () => await this.getencounters(phn) }, { typeof(labs), async () => await this.getlabs(phn) }, }; task t = new task(async () => { // code without switch, e.g. // await this.getdocuments(phn); // type switch, want this: await getlistingsummarytypeswitch(typeof(t))(); }); t.start(); // notice, not waiting task complete } getdocuments returns task, getencounters returns task, etc. however, in current design, don't care response call them in background thread have side-effects (e.g. putting them in database/ca

javascript - particle.subSelf() Undefined is not a function -

i trying give velocity , origin particle threes cant add origin function getorigin() { return new three.vector3(weapon.vehicle.position.x, weapon.vehicle.position.y, weapon.vehicle.position.z); } function start() { time = weapon.time; done = false; var origin = getorigin(); particles = new three.geometry(); var pmaterial = new three.particlebasicmaterial({ color: weapon.explosion.color, size: weapon.explosion.size, map: three.imageutils.loadtexture("img/particula.png"), blending: three.additiveblending, transparent: true }); for(var p = 0; p < particlecount; p++) { // create particle random // position values, -250 -> 250 var px = (math.random() * weapon.vehicle.size.x) - (weapon.vehicle.size.x / 2), py = (math.random() * weapon.vehicle.size.y) - (weapon.vehicle.size.y / 2), pz = (math.random() * weapon.vehicle.size.z) - (weapon.vehicle.size.z

mysql - PHP Echo multiple select queries -

i use following way echo following query $select_time = mysql_query("select submit_time `table` field_name='user-email' , field_value='test'"); $fetch_time = mysql_fetch_array($select_time); echo $fetch_time['submit_time']; can, tell me how echo each values in below scenario $select_brands = mysql_query("select max(if(`field_name`='brand-name', `field_value`, null )) 'brand-name', max(if(`field_name`='brand-email', `field_value`, null )) 'brand-email', max(if(`field_name`='brand-phone', `field_value`, null )) 'brand-phone', max(if(`field_name`='brand-manager', `field_value`, null )) 'brand-manager' `wp_cf7dbplugin_submits` `form_name` = 'add brands' group `submit_time` order `submit_time` desc limit 0,100"); $fetch_branddetails = mysql_fetch_array($select_brands); i need echo brand-name, brand-email, brand-manager , brand-phone stuck syntax how write echo sta

css - making an image stick relative to other elements while page zooms in or out -

i have image, white rectangle, i'm trying use screen between top layer logo , text below. the logo part of header , acts 'sticky' - not moving when y-scrolling page. what i'm failing @ making rectangle stay fixed relative it's parent (the header) when zooming takes place. instead, rectangle floats away each zoom. header position fixed, img absolute. p.s. tried searching answer. above setting taken from: can position element fixed relative parent? please kindly help, yaron h.

iOS Swift unit test result in unresolved identifier -

Image
simple function in swift testing: func testexample() { var tagname = "someclass()" var logger = device("", "") //unresolved identifier xctassert(true, "pass") } even after import module "import ", still cannot use classes module. though might have messed in project, none of sample projects let me use module classes. seems should work might have broken in beta 2. edit: fixed ide didn't pick check param names. seems xcode still tad iffy i hit same issue today, not sure if available - rather using import target_name in test file and/or declaring classes/methods public , can add file tests target via xcode's file inspector . cmd + opt + 1 show while in file, , check box under target membership tests target. you may need rebuild.... cmd + b . should specific system.... i'm running xcode 6.3 beta 1, , testing via quick + nimble, both installed latest cocoapods beta.

javascript - Command Buttons Not Responding to JS functions -

i close finishing program unable past 1 last hurdle. want simple code execute when command buttons pressed. when submit order button pressed following code should run check form completed. function validateform() { if ($("tax").value = 0) { alert ("you have not selected order"); } if ($("shipcost").value = 0) { alert("you must select method of shipping"); } } and when reset button pressed following code should run. function initform() { $('date').value = todaytxt(); $('qty1').focus(); } unfortunately buttons not executing code trying execute through following set of functions. window.onload = function () { initform(); todaytxt(); productcosts(); shipexpense(); $('shipping').onchange = calcshipping; calcshipping(); $("submit order").onclick = validateform(); $("reset").onclick = initform(); } i have create

Weblogic - Order of JVM Arguments -

i've got oracle weblogic server (10.3.6) being started following jvm arguments: starting wls line: /oracle/javahome/jdk1.6.0_29/bin/java -server -xms512m -xmx1024m -xx:permsize=256m -xx:maxpermsize=768m <...some more arguments, , then...> -xms1024m -xmx2048m -xx:permsize=512m -xx:maxpermsize=1024m notice arguments 'ms', 'mx', 'permsize' , 'maxpermsize' each occur twice. now, i'd rather not have 2 occurrences (working on resolving that), in meantime, argument's sake, know occurrence of each argument weblogic jvm use? 1st or 2nd? thanks. it use first , ignore second occurrence. you getting 2 occurrences because must have mentioned path=...:%path% , here path contained same parameters.

c++ - Unicode, UTF-8, UTF-16 and UTF-32 questions -

i read lot unicode, ascii, code pages, history, invention of utf-8, utf-16 (ucs-2), utf-32 (ucs-4) , use them , on, still having questions tried hardly find answers couldn't , hope me. 1 - unicode standard encoding characters , specify code point each character. u+0000 (example). imagine have file has code points (\u0000), in point of application i'm going use it? this might silly question don't know in point of application i'm going use it. i'm creating application can read file has code points using escape \u , know can read it, decode next question. 2 - character set (code page) need convert it? saw c++ libraries uses name utf8_to_unicode or utf8-to-utf16 , utf8_decode , , makes me confuse. i don't know if appear answers this, might say: need convert code pages going use, if application needs internationalized? 3 - wondering, in c++ if try display non-ascii characters on terminal got confusing words. question is: makes characters displayed fo