Posts

Showing posts from May, 2015

mysql - Scheduled task doesn't run -

create event `set_trips_finished` on schedule every 1 day starts '2015-08-25 01:50:00' on completion preserve begin update trips set status = 0 date(created_at) < curdate(); end; is scheduled task. fields don't updated. when run query - fields updated fine. i have scheduled task, same syntax, scheduled run 5 minutes later, , runs fine. i don't understand why wouldn't task run, or whether query not update table... suggestions? update i deleted other scheduled task (the 1 working), , set them both again, , neither fires... see if event scheduler running: show variables variable_name='event_scheduler'; +-----------------+-------+ | variable_name | value | +-----------------+-------+ | event_scheduler | off | +-----------------+-------+ nope create test table: create table trips ( id int auto_increment primary key, status int not null, created_at date not null ); insert trips(status,created_at) values (...

asp.net - Shadow Copy for un-managed .net resources -

i working on deployment scripts, script deploys updated binaries web application running under iis. can deploy new managed binaries while web application running (thanks shadow copy) not work un-managed binaries web application references. want deploy complete web application contents (managed , un-managed) without recycling application pool or stopping website. how can that?

Github python script fatal: pathspec -

i have made github script. works fine. adds, commits, , pushes. thing , fatal: pathspec, still adds file, commits, , pushes. here code subprocess import call add = raw_input('what file add?: ') call(["git", "add", add ]) #fatal: pathspec here. still adds file though. call(["git", "commit", "-m", add ]) #still commits call(["git", "push", "origin", "master" ]) #still pushes origin master i can deal error. nice not have it. should use different module? in whole code have 2 if statements, im not sure if bother nothing. i think can use gittle, gittle in git hub . makes git more easy.

using javascript slider with php array -

i'm attempting make range slider work php. have part of code can't range slider update number. can see is somewhere in onchange event. posted sections of code need attention. 1 big if else statement , javascript @ end. why did way don't know. i'm in bit of time crunch though. solution awesome. // view products else { // display site links echo "<p> <a href='./index.php'>sweetshop</a></p>"; echo "<h3>our products</h3>"; echo "<form name='form1' method='post' action=''> <p> <input id='slider' type='range' min='.50' max='2.00' step='.50' value='2.00' onchange='printvalue('slider','rangevalue')' /> <input style='text-align: center' id='rangevalue' type='text' size='2' /> </p> </form>...

c# - What is happening when dbcontext.Database.ExecuteSqlCommand is called? -

i using entity framework code first database. i'm trying run existing unmapped stored procedure, using dbcontext.database.executesqlcommand, dynamically creating query , parameter array based on values passed in json (there many optional parameters). not expecting return value. when test service, sqlexceptions being thrown within stored proc: cannot insert value null column 'yyyyww', table 'dbname.dbo.table'; column not allow nulls. but when run same query using same values ssms '12, there no errors. table allow nulls column. exec [dbname].[dbo].[storedproc] @yyyymm = 201409, @s_id = 75 passing optional string parameter causes exception converting nvarchar int, doesn't happen in stored proc. i've tried few different ways set call, throw same exceptions. version 1: string query1 = "exec [dbname].[dbo].[storedproc] @yyyymm, @s_id"; list<sqlparameter> parms1 = new list<sqlparameter>(); parms1.add(new sqlparameter...

android - Unity error CS0119 moving an object -

i started learning programming in unity - moved eclipse, android studio. , followed tutorial in youtube error : assets/scripts/move.cs(9,17): error cs0119: expression denotes `method group', `variable', `value' or `type' expected my simple code: using unityengine; using system.collections; public class move : monobehaviour { void fixedupdate(){ float movehorizontal = input.getaxis ("horizontal"); float movevertical = input.getaxis ("vertical"); vector3 movement = new vector3 (movehorizontal, 0.0f, movevertical); getcomponent<rigidbody>.velocity = movement; } } usually problem in constructor word new saw online, had time, what's different tutorial online here : https://www.youtube.com/watch?t=206&v=rvslczg1m1e line rigidbody.velocity=movement gave me errors looked online , changed still give me error. thank this line incorrect getcomponent<rigidbody>.velocity = movement; it should rea...

sparse matrix - Greater weight to smaller values using `spy` in Matlab? -

i'm new matlab , have table of few hundred variables. know smaller variables hold greater significance larger variables in table , want sparse matrix graph illustrate this. not lim approaches 0 lim approaches 1 because know significant values approach 1. take inverse of matrix? note spy way visualize sparsity pattern of matrix, not let visualize value. that, imagesc candidate. it have more information problem, here 1 way illustrate importance of values closer 1. % generate random 10x10 matrix 50% sparsity in [0,9] x = 9*sprand(10,10,0.5); % add 1 non-zero elements in range [1,10] x = spfun(@(a) a+1, x); % visualize matrix figure(1); imagesc(x); colorbar; colormap('gray'); % create "importance matrix", inverts non-zero values. % non-zero elements in range [1/10,1] y = spfun(@(a) 1./a, x); % visualize matrix figure(2); imagesc(y); colorbar; colormap('gray'); edit address comment: % if want see values 1, can use y = spfun(@(a) a==1, ...

Convert service "display name" to "key name" C# -

basically, have large list of "display names" services have in service manager (ie "background intelligent transfer service") , i'm trying figure out how "convert" them service "key names" (ie "bits"). looking up, saw there one solution written in language (delphi) didn't appear use kind of dictionary, implies me there should way in c#. maybe i'm googling wrong, found surprisingly few relevant hits this. has figured out how it? this print out display name followed service name (referred key name in question): var services = servicecontroller.getservices(); foreach(var service in services) { console.writeline("{0} = {1}", service.displayname, service.servicename); } reference system.serviceprocess access servicecontroller. edit: convert dictionary (for ease of ups) use var servicenamelookups = servicecontroller.getservices().todictionary(s => s.displayname, s => s.servicename); the...

android - SimpleAdapter not keeping position when scrolling -

i have simpleadapter i'm using display 2 line listview. want 15th position on simple adapter of different format when scroll listview around, looses position , formatting changes positions. there solution this? i've tried mucking around convertview can't seem right format. code below. thanks! simpleadapter adapter = new simpleadapter(this, data, android.r.layout.simple_list_item_2, new string[] {"title", "publisher"}, new int[] {android.r.id.text1, android.r.id.text2}){ public view getview(int position, view convertview, viewgroup parent) { view view = super.getview(position, convertview, parent); if (position == 15) { textview text1 = (textview) view.findviewbyid(android.r.id.text1); text1.settextcolor(color.white); textview text2 = (textview) view.findviewbyid(android.r.id.text2); text2.settextcolor(color.white); view.setbackgr...

php - Show a 404 page if route not found in Laravel 5.1 -

i trying figure out show 404 page not found if route not found. followed many tutorials, doesn't work. have 404.blade.php in \laravel\resources\views\errors also in handler.php public function render($request, exception $e) { if ($e instanceof tokenmismatchexception) { // redirect form example of how handle mine return redirect($request->fullurl())->with( 'csrf_error', "opps! seems couldn't submit form longtime. please try again" ); } /*if ($e instanceof customexception) { return response()->view('errors.404', [], 500); }*/ if ($e instanceof \symfony\component\httpkernel\exception\notfoundhttpexception) return response(view('error.404'), 404); return parent::render($request, $e); } if enter wrong url in browser, returns blank page. have 'debug' => env('app_debug', true), in app.php. can me how show 404 page if...

javascript - How to download video flash from Qhonline ? -

i facing problem/challenge on figure out way scrape/download video flash encoded prevent user download content. please review link below example: http://www.qhonline.edu.vn/video-training16a2785255z725.html i did various researches on multiple sources, till haven't found solutions yet. thus, or suggestion highly appreciated.

sql - Joining a table with itself where there is a datestamp and with a secondary date variable? -

i have table - several table concatenated because [col1] takes 2 different strings , [value] takes numerical values relating [col1] string. there 2 sets of columns segments. analysis each segment , later combination of segments. datestamp available. col1 datestamp value col4 col5 cold ret 1/10/14 0 ret 1/11/14 1 ret 1/11/14 0 ent 1/10/14 0 ent 1/11/14 1 finished table this: col1ret col2ent datestamp col4 col5 cold value-ret value-ent ret ent 1/10/14 0 ret ent 1/11/14 1 -- -- what sql script this? you can use group by aggregated case . this. sql fiddle query select max(case when col1 = 'ret' col1 else null end) col1ret, max(case when col1 = 'ent' col1 else null end) col1ent, datestamp,col4,cold,col5, max(case when col1 = 'ret...

ios8 - IOS Realm Swift Other Realm Accessed from incorrect thread -

i error msg *** terminating app due uncaught exception 'rlmexception', reason: 'realm accessed incorrect thread' when switch other realm . working fine when use default realm . couldn't figure out part cause error. let realm:realm! var queue = dispatch_queue_create("realmqueue", nil) func init(){ var realmname = "test.realm" let documents = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true)[0] as! string let path = documents.stringbyappendingpathcomponent(realmname) realm = realm(path: path) } func loadcustomer(){ dispatch_async(queue){ //let realm = realm() var results = self.realm.objects() ... } } 👌 bad. dispatch_async(queue){ realm = realm(path:path) }

javascript - jQuery : select all element with custom attribute -

possible duplicate: jquery, select attribute value, adding new attribute jquery - how select attribute please consider code: <p>11111111111111</p> <p mytag="nima">2222222222</p> <p>33333333333</p> <p mytag="sara">>4444444444</p> how can select p tag attribute mytag ? thanks use "has attribute" selector : $('p[mytag]') or select 1 attribute has specific value: $('p[mytag="sara"]') there other selectors "attribute value starts with", "attribute value contains", etc.

java - how to write Hibernate Criteria to take nested list objects by Projection List? -

my question similar question how write hibernate criteria take nested objects projection list? but tiny differnce. in fact classes similar to class person { private long id; private string name; private list<car> cars; // differnce // getters , setters } how transformer list of objects?

java - How can I prevent Ivy from downloading multiple versions of the same dependency? -

i have ivy.xml file (without ivysettings.xml file) following dependency: <dependency org="org.freemarker" name="freemarker" rev="2.3.23"/> however when resolve ivy dependencies end freemarker-2.3.8.jar , freemarker-2.3.23.jar . causing problem in apache tomcat because 2.3.8.jar taking precedence on 2.3.23.jar , static final int called configuration.version_2_3_23 showing @ run-time unavailable (though available compile time). here full ivy.xml in case helps: <ivy-module version="2.0"> <info organisation="com.example" module="exampleproject"/> <configurations defaultconfmapping="default"> <conf name="default"/> <conf name="java8" extends="default" description="java 8 dependencies"/> <conf name="eclipse" description="special dependencies in eclipse"/> <conf ...

python - How to change `rdf:description` namespace using rdflib? -

i'm dabbling in managing rdf python using rdflib, , ran across page ( http://www.obitko.com/tutorials/ontologies-semantic-web/rdf-graph-and-syntax.html ) outlines rdf syntax. in it, rdf example following: <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns="http://www.example.org/~joe/contact.rdf#"> <foaf:person rdf:about="http://www.example.org/~joe/contact.rdf#joesmith"> <foaf:mbox rdf:resource="mailto:joe.smith@example.org"/> <foaf:homepage rdf:resource="http://www.example.org/~joe/"/> <foaf:family_name>smith</foaf:family_name> <foaf:givenname>joe</foaf:givenname> </foaf:person> </rdf:rdf> in here, code rdf object denotes foaf:person , in other instances i've seen, line rdf:description . i'm curious whether example correct, , if difference between re-defin...

c# - select query does not work with parameters using Parameters.AddWithValue -

the following query in c# doesn't work, can't see problem: string getquery = "select * user_tbl emp_id=@emp_id , birthdate=@birthdate"; cmdr.parameters.addwithvalue("@emp_id", uservalidate.emp_id); cmdr.parameters.addwithvalue("@birthdate", uservalidate.birthdate); odbccommand cmdr = new odbccommand(getquery, conn); odbcdatareader reader = cmdr.executereader(); reader.hasrows returns no result when query database got data. i'll assume code not quite presented, given wouldn't compile - you're using cmdr before declare it. first, you're trying use named parameters, , according documentation of odbccommand.parameters , isn't supported: when commandtype set text , .net framework data provider odbc not support passing named parameters sql statement or stored procedure called odbccommand . in either of these cases, use question mark ( ? ) placeholder. additionally, avoid using addwithvalue anyway - us...

jquery - javascript autocomplete with source being names of files from a directory -

i have spent considerable amount of time googling , hoping on here had reference or starting point expound upon. i looking javascript/jquery autocomplete script has source being file names inside of directory. welcome suggestions... thanks! if worse comes worse, can use autocomplete script (jqueryui or typahead.js) has source file results, have code separate function automatically write file each time new file put directory or deleted it, , trying avoid should exists. edit server side scripting unfortunately not option me. being run through html applications (hta) file, fortunately have additional freedoms typical web application. i found article autocomplete textbox using jsp, jquery has been used code written in such way data retrieved database , comes suggestion when user types letter or part of word. if looking it, can click here

oracle - count of product with parent_category_id -

Image
i have 2 tables table 1: cat_a table 2:prod_a out put must when category_id =1 product_id count must 7 when category_id = 3 product_id count must 5 when category_id = 6 product_id count must 3 when category_id = 7 product_id count must 2 when category_id = 5 product_id count must 2 please me . have searched lot of questions , answers , forums. couldn't find exact solutions. don't want spoon feeding answers . please mention hint or way answer. my problem resloved. select count( product_id) prod_a category_id in (select category_id cat_a start category_id = <i_category_id> connect prior category_id = parent_catogory);

ios - Prevent escaping brackets in URLs -

our image server allows pass url parameters trigger image manipulation operations. instance url https://www.example.com/i/example/10570250?layer0=[w=600&h=1000&bg=rgba(228,228,228,125)&cm=multi] scales image , applies blending mode. the problem feed string url object, example url(string: "https://www.example.com/i/example/10570250?layer0=[w=600&h=1000&bg=rgba(228,228,228,125)&cm=multi]") brackets escaped , image server stops applying operations. the url becomes: https://www.example.com/i/example/10570250?layer0=%5bw=600&h=1000&bg=rgba(228,228,228,125)&cm=multi%5d can prevent url escaping brackets? or ist there other way of escaping url, before feeding url(string:) , image server might accept? you´re not allowed include [ ] in url. consider changing api call make work you. a host identified internet protocol literal address, version 6 [rfc3513] or later, distinguished enclosing ip literal within square bracke...

java - RMI server to judge the host name of client which called it -

i have below program of spring rmi in client send port no s received @ server end , being displayed , using spring rmi achieve want there way since want remove hard coding client notsent hostname client call servre rmi server , rmi server should smart enough judge client host name , please advise f in below program stop passing hostname client side how server smart enough judge client hostname calculation interface there should method takes string parameter. public interface calculation { void print(string text ); void registeripaddress(string ip); } public class calculationimpl implements calculation { @override void print(string text) { system.out.println(text); } @override void registeripaddress(string ip){ list.add(ip);//or whatever want } your xml files both client , host right applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" ...

ios - How to pass data from ViewController to embed View Controller -

i have view controller, user taps button , moves second view, , want pass data it, second view has navigation view controller, prepareforsegue() doesn't work here. shall pass data navigation view , second view or else? according this: https://developer.apple.com/library/prerelease/ios/documentation/uikit/reference/uinavigationcontroller_class/#//apple_ref/occ/instp/uinavigationcontroller/topviewcontroller , following solution more correct: use "topviewcontroller" of uinavitaioncontroller. override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { let segueid = segue.identifier ?? "" switch segueid { case "tomynextvc": let nc = segue.destinationviewcontroller as! uinavigationcontroller let destinationvc = nc.topviewcontroller as! mynextviewcontroller destinationvc.vartopass = myvartopass default: break } }

php pdo get database version(MYSQL) -

this question has answer here: get mysql server version pdo 4 answers is there ways can mysql version using pdo ? i want set charset connection utf8mb4 appear 5.5.0 , after, need set charset utf8 fallback plan. you use pdo , query it: select version()

rust - Trouble implementing higher ranked lifetime type bound for a byte slice -

i trying implement trait on &'a [u8] , use in implementation uses higher ranked lifetimes, e.g.: pub trait intotest<'a, t> { fn into_test(&'a self) -> t self: sized; } impl<'a> intotest<'a, &'a [u8]> &'a [u8] { fn into_test(&'a self) -> &'a [u8] { self } } fn higher_ranked_lifetime<t>(test: t) t: for<'a> intotest<'a, &'a [u8]> { let _t = test.into_test(); } fn main() { println!("hello, world!"); let vec = vec![1u8]; let slice = &vec[..]; higher_ranked_lifetime(slice); } short url: http://is.gd/1qkhyk the error getting is: <anon>:19:5: 19:27 error: trait `for<'a> intotest<'a, &'a [u8]>` not implemented type `&[u8]` [e0277] <anon>:19 higher_ranked_lifetime(slice); how should doing this? right thing do? not want scope higher_ranked_lifetime specific life...

c# - Making class fields thread-safe -

say have list of values accessed different threads. make thread safe doing this: private static object syncobject; syncobject = new object(); public list<double> mylist { { lock(syncobject) { return mylist;} } set { lock(syncobject) { mylist = value;} } } if in 1 of functions, need access count attribute of list , may not thread safe anymore. how write such when accessing attributes, thread safe? like willem van rumpt said, synchronized access specific property, not made thread safe. not reinvent wheel, can use collections system.collections.concurrent ( https://msdn.microsoft.com/en-us/library/dd267312(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 ) another more viable option use immutable list. unfortunately, afaik .net doesn't offer here. implementation know in microsoft.fsharp.collections. list in namespace immutable singly-linked list. (although haven't used c#). update: matías fidem...

actionscript 3 - How to write files to a specific directory? -

i'm trying let user select directory , write files directory. i have code lets user browse directory: var file:flash.filesystem.file = new flash.filesystem.file(); file.browsefordirectory("select directory"); file.addeventlistener(event.select, selecthandler); protected function selecthandler(event:event):void { // these contain path want save files object(filereference).url; object(filereference).nativepath; // how create file in directory? } how create file in directory user selects? your select handler code not seem correct. should reference of folder object of type file doing event.currenttarget , , not object or filereference. next can create file using filestream class. selecthandler code should this: protected function selecthandler(event:event):void { var targetdirectory:file = event.currenttarget file; var file:file = targetdirectory.resolvepath("htmlfile.html"); var stream:filestream = new filest...

sql server - Can I manage database using database project without knowing connection string? -

i have created database project. able upgrade changes in sql server. have deploy same changes on environment. don t want change previous data. don t have access sql server don`t know connection string. i have options, deploy .dacpac file or .sql script, first delete database creates new one. loosing data. please me. if option there? the options see are: ask backup (or extract schema tables using task-->generate scripts ion ssms) - restore somewhere , use sqlpackage generate deployment script can ask them run ask them run sqlpackage.exe , either generate script or run directly ask them permissions can it if database being deleted have option "createnewdatabase" set true bad in production environment remove or set false! if run or ask permissions, these minimum permissions need generate script (to run script need dbo): https://the.agilesql.club/blogs/ed-elliott/what-permissions-do-i-need-to-generate-a-deploy-script-with-ssdt (my blog)

javascript - currentSpec in Jasmine 2 is undefined -

i want upgrade test suite latest jasmine version 2.3.4. have custom helper methods testing angularjs stuff inside spy_helper.js this: (function() { this.stubpromise = function(service, functionname) { var $q = jasmine.getenv().currentspec.$injector.get("$q") var $rootscope = jasmine.getenv().currentspec.$injector.get("$rootscope") var deferred = $q.defer(); var spy = spyon(service, functionname).andreturn(deferred.promise); spy.andresolvewith = function(value) { deferred.resolve(value); $rootscope.$apply(); return spy; }; spy.andrejectwith = function(value) { deferred.reject(value); $rootscope.$apply(); return spy; }; return spy; }; }).call(this); // inside test can stubpromise(someservice, 'foobar').andresolvewith("test"); the helper stubs promise , resolves or rejects promise. have bunch of such helpers. the problem jasmine 2 is, jasmine.getenv().currentspec ...

android: Error:Execution failed for task ':app:dexDebug'.Process finished with non-zero exit value 2 -

when compile mapbox project have error. compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4@aar'){ transitive=true } error:execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/bin/java'' finished non-zero exit value 2 i tried use multidexenabled true , doesn't work. , tried find same .jar files, think 'com.android.support:support-v4:22.2.0' ,i delete , no work. don't know how solve it, please help.

c# - mysql foreign key mistake -

i need issue. there problem not find it error message is cannot add or update child row: foreign key constraint fails ( db_kiosk . tbl_oyunhareketi , constraint oh_kioskid foreign key ( oh_kioskid ) references tbl_kiosk ( kiosk_id ) on delete no action on update no action) here code c# string sql = "insert db_kiosk.tbl_oyunhareketi (oh_oyuncuid,oh_kioskid,oh_puan,oh_tarih,oh_controlrow) values ('"+convert.toint32(label4.text)+"','"+convert.toint32(label3.text)+"','" + puan_txt.text + "' , '" + tarih_txt.text + "',1)"; label3.text = kiosk_drop.selectedvalue; label4.text = oyuncu_drop.selectedvalue; kiosk_drop , oyuncu_drop dropdownlist in asp.net , in selectedindexchanged function. when display labels values coming problem insertion. db attributes integer couldn't find problem. you have foreign key constraint prevents adding rows child table before have relevan...

c# - other way to check if value is null or empty and assign value -

if (!string.isnullorempty(stringtest)) newstring = stringtest; // newstring string else newstring = string.empty; is there (simple) way achieve this? you need null-coalescence operator: newstring = stringtest ?? string.empty;

Zoom on browser without triggering responsive styling css -

Image
so have footer and want work on pixel stuff precise weight of police or thing can seen view if zoom on it. my problem when zoom on it, using cmd + + / ctrl + + . got this. due css since responsive footer. so i'd able zoom on element without triggering responsive styling. example @media(max-width:768px){ #writing { display:none } } or of properties affected resize of window. i undo style apply @ max-width:... commenting or unchecked in dev' tool not i'm looking for. is there other way ? maybe browser extension or kind of 'zoom in screen' commande? edit i found answer below :) so simplest way of doing zooming on screen. solution mac user ⌘ cmd + ⌥ alt + = -> zooming in ⌘ cmd + ⌥ alt + - -> zooming out if know way of doing on pc i'll add answer. hope !

java - How to write a single responsibility principle -

i have menu class. menu class provide links. each link has iconid , text. class should create bitmap iconid? if link class build bitmap violates srp. if helper class build bitmap lazy class. whats right? public abstract class link { private int iconid; private string description; /* getters */ public abstract void action(); } it depends on scope of design. if link classes have same bitmap type image, might make sense place image resolving mechanism within abstract class itself. if, on other hand, have different image types , formats, have delegate image resolution extending classes. instance, have public class gifimagelink extends link , class take care of resolving gif image type, in turn delegated other singleton class.

git branch - Spurious change when using git diff <base>...<feature> -

github seems use triple dot comparison on pull requests, tricked me today showing spurious change between feature , base branch. here base branch (abbreviated): git show upstream/develop:script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], [004*a], [008*a], [008*d], [008*j], [008*l], [008*o], [009*a], [009*b], [009*g], [009*x], [009*u], [041*a], [041*c], here feature branch (abbreviated): git show feature:script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], [004*a], [008*a], [008*d], [008*j], [008*l], [008*o], [009*a], [009*b], [009*g], [009*x], [009*u], [041*a], [041*c], here output plain diff: git diff upstream/develop feature script.sql (no output.) here output "changed on feature branch"-triple dot operator diff: git diff upstream/develop...feature script.sql field in ( [001*a], [001*d], [001*y], [001*x], [001*z], + ...

java - How to install JCommander and use it in my program? -

i doing 1 project , want use jcommander parsing command line input. don't know how add machine , use it. here github page jcommander . how can add machine after downloading zip file of code? i not using ide (using sublime text , command line). i ran same question. here worked me. download jcommander jar file http://mvnrepository.com/artifact/com.beust/jcommander/latest , follow link "artifact" on table on page. dowloaded file named jcommander-x.xx.jar. after download, working file @ path myjavafiles/example.java, create directory myjavafiles/lib , put file there. create minifest.txt file so have structure myjavafiles ├── example.java ├── lib │   └── jcommander-x.xx.jar └── manifest.txt 5 can try sample java file example.java import com.beust.jcommander.jcommander; import com.beust.jcommander.parameter; class example { @parameter(names={"--length", "-l"}) int length; @parameter(names={"--pattern", ...

php - how to change json format from array to object? -

i need description how correct print format of json code: while($row = mysqli_fetch_array($result)){ //step 4 action current row $img = $row['image']; $link = $row['link']; $posts[] = array('img'=> $img, 'url'=> $link); //echo $row['image'] . "<br/> " ; //echo $row['link'] . "<br/> " ; } echo json_encode($posts, json_pretty_print); the output [ { "img": "catalog\/demo\/banners\/iphone6.jpg", "url": "index.php?route=product\/product&amp;path=57&amp;product_id=49" }, { "img": "catalog\/demo\/banners\/macbookair.jpg", "url": "" } ] i want: { "img": "catalog\/demo\/banners\/iphone6.jpg", "url": "index.php?route=product\/product&amp;path=57&amp;product_id=49"...

android - How can I clear cache of my app automatically after 1 hr -

i working on story application. in application download json data server , these data should saved in cache. stored data in cache want delete cache after particular time limit. my code adding data in cache follows: objectoutput out = new objectoutputstream(new fileoutputstream(new file(getactivity().getcachedir(),"")+"cachefile.srl")); string tetsing = jsonobject_one.tostring(); out.writeobject( tetsing ); when call server, receive callback , add entities in local db, can save in shared preferences long current system milliseconds: long cachetime = system.currenttimemillis(); everytime open activity needs call server, before doing request, check time in shared preferences: if(timeinsharedpreference < system.currenttimemillis() * 1000 * 60 * 60) { // request // update db }

java - android setvisibility for button in listview -

i parsing json url inside fragment , put data listview. each element have hidden button id button1 can see in xml layout. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/ler" > <!-- thumbnail image --> <com.android.volley.toolbox.networkimageview android:id="@+id/thumbnail" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignparentleft="true" android:layout_marginright="8dp"/> <!-- movie title --> <textview android:id="@+id/title" android:paddingtop="40dip" android:layout_width="wrap_content" android:layout_height=...

java - display seconds counting down in textview Android -

i have timer has set number of seconds count down way 0 if put 5 textview label want show 5,4,3,2,1,0, have timer stop. pass in random number selected user pass variable s timer my textview: mseconds = (textview)findviewbyid(r.id.secondslabel); my timer: int s = //int taken on spinner in class timer timer = new timer(); timer.schedule(new timertask() { @override public void run() { finish(); } }, s * 1000); so when put mseconds.settext(//what should add here); show number counting down 0 please check countdown timer: http://developer.android.com/reference/android/os/countdowntimer.html new countdowntimer(30000, 1000) { public void ontick(long millisuntilfinished) { mtextfield.settext("seconds remaining: " + millisuntilfinished / 1000); } public void onfinish() { mtextfield.settext("done!"); } }.start()

android - Custom layout for ListPreference -

i using preferenceactivity setting of app. want add new preference allow user select icon. task want use listpreference , want show icon in list. i tried customize listpreference use custom layout, problem once list items not clickable (it show custom layout , use default value current selection). i tested on different emulator version , on galaxy s2. when pressing item see effect of pressed/unpressed, onclick method not called. i followed instruction on android: checkable linear layout adding custom layout (i tried option describe in how customize list preference radio button , same result). icontypepreference.java (copied listpreference , modified): public class icontypepreference extends dialogpreference { private icontype value; private int clickeddialogindex; private boolean valueset; @targetapi(build.version_codes.lollipop) public icontypepreference(context context, attributeset attrs, int defstyleattr, int defstyleres) { sup...

javascript - If a Select All option is Checked then display a div using bootstrap multiselect -

after selecting "select all" option in drop down list,i'll click on generate graph button.then want display chart containing of options in drop down list in particular div using bootstrap multi-select. my code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jquery multi select dropdown checkboxes</title> <link rel="stylesheet" href="css/bootstrap-3.1.1.min.css" type="text/css" /> <link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> <script type="text/javascript" src="js/bootstrap-2.3.2.min.js"></script> <script type="text/javascript" src="js/bootstrap-multiselect.js"></script> <script src="https://cdnjs.cloudflare.com/...

regex - Python open text file, do multiline regular expressions, write out file -

i have spent years in 90s doing regular expressions on perl have been out of since , python newbie. syntactical wrappers need job in python? @ now, result computer doing nothing , it.: import os import re os.chdir("/users/.../") atext = open("textfile.txt", 'r').read() atext = re.sub(r'foo', r'bar', atext.rstrip()) print atext your problem .read() not read whole file, reads file given size in bytes: https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects what need, read file line line, can use atext.readlines() return whole file lines in list, or use code faster .readlines() import os import re os.chdir("/users/.../") open("textfile.txt", 'r') atext: line in atext: line = re.sub(r'foo', r'bar', line.rstrip()) print line

ios - Crashlytics error: Undefined symbols for architecture arm64 -

Image
after updated fabric crashlytics in app cant anymore run on ios device. on simulator works fine. error is: undefined symbols architecture arm64: "_gzopen", referenced from: -[clspackagereportoperation compressfile:] in crashlytics(clspackagereportoperation.o) "_gzwrite", referenced from: ___42-[clspackagereportoperation compressfile:]_block_invoke in crashlytics(clspackagereportoperation.o) "_gzclose", referenced from: -[clspackagereportoperation compressfile:] in crashlytics(clspackagereportoperation.o) ld: symbol(s) not found architecture arm64 clang: error: linker command failed exit code 1 (use -v see invocation) crashlytics , fabric require link target against following: security.framework systemconfiguration.framework libc++ libz just select target -> build phases -> link binary libraries -> add ones missing. i hope helped.

html - Cart logic in jsp -

how add "cart" on top of jsp page , how values selected using checkbox cart ? new programming, please provide logic. this simple logic wrote fornt end used jsp page , end servlet used.see here : full code link . made . happy help

ios - UITableView with automatic dimension do no display cells properly. Always the LAST label within that cell is sometimes broken -

Image
simple case: some of cells displayed randomly proper way or not: this way: this not way. what depends on, , how fix it? interesting thing: i added @ end label: and last label not displayed properly. previous label correct every time . going on? make sure: lines set 0 line breaks set character wrap if problem still not solved set preferredmaxlayoutwidth .

php - Prepared statements and mysqli_query / mysqli_num_rows? -

i trying find out how make code work prepared statements. understood entire process commented code. have in order integrate num_rows , mysqli_query part properly? function login_check() { global $connection; $name = $_post['name']; $password = $_post['password']; $query = "select id members name = $name , password = $password"; $stmt = $connection->prepare($query); $stmt->bind_param('ss', $name, $password); $stmt->execute(); $stmt->close(); // $result = mysqli_query($connection, $query); // $rows = mysqli_num_rows($result); if($rows > 0){ header('location:../../success.php'); exit; } else { header('location:../../failed.php'); exit; } } what tried: $result = mysqli_query($connection, $stmt); $rows = mysqli_num_rows($result); change $query = "select id members name = $name , password = $password"; ...

javascript - Shuffle.js options error fix -

i'm using shuffle.js current project. works pretty well... is, having console error default override-able options. my issue originates @ columnthreshold option part. if remove line of code, layout becomes unresponsive , messed up. when insert line columnthreshold: has_computed_style ? 0.01 : 0.1, , layout becomes responsive console error , effect of speed: 250 option becomes useless... can't control shuffle speed... the consol error states uncaught referenceerror: has_computed_style not defined . documentation not provide information regarding possible options columnthreshold . want columnthreshold value not affect speed or other options value. my entire code looks this: // overrideable options shuffle.options = { group: all_items, // initial filter group. speed: 250, // transition/animation speed (milliseconds). easing: 'ease-out', // css easing function use. itemselector: '', // e.g. '.picture-item'. sizer: null, /...