Posts

Showing posts from September, 2013

c# - FileNotFoundException was unhandled - But the file is there -

i'm struggling this. wpf app, in debug/release works fine. after publish it, via installshield express, runtime exception , program crashes. when program crashes, can choose debug program in visual studio, breaks in relaycommand looks like public class relaycommand : icommand { public action<object> _execute; public relaycommand(action<object> execute) { this._execute = execute; } public bool canexecute(object parameter) { return true; } public event eventhandler canexecutechanged; public void execute(object parameter) { this._execute(parameter); // breakpoint } } the error message is filenotfoundexception unhandled not load file or assembly 'taskscheduler, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. system cannot find file specified i'm lost why is. have other commands on page, , set in following manner public icommand savesched

javascript - Checking authentication in Laravel via Angular -

in angular app created service: .factory('auth', function($http) { return { is_authenticated: function() { return $http.get('/api/users/is_authenticated'); } } }); my method in api backed laravel: public function is_authenticated() { if(auth::check()) { return response::json(array('authenticated' => true)); } return response::json(array('authenticated' => false)); } and in controller: auth.is_authenticated() .success(function(data) { $scope.is_authenticated = data.authenticated; if(data.authenticated) console.log('yes'); }); when go /api/users/is_authenticated see nothing on page, however, when echo auth::check() there 1 on page. in view have list ng-show="is_authenticated" it's not working. what doing wrong here? i'm failing see problem. why 'yes' not being logged conso

clojure - Datomic valueType -

when trying persist list of node entities :threshold attribute defined in schema: {:db/id #db/id[:db.part/db] :db/ident :node/threshold :db/valuetype :db.type/long :db/cardinality :db.cardinality/one :db/fulltext false :db/doc "threshold" :db.install/_attribute :db.part/db} i following error: compilerexception java.util.concurrent.executionexception: java.lang.illegalargumentexception: :db.error/wrong-type-for-attribute value 90 not valid :int attribute :node/threshold i use following code: (defn store-tree [tree] @(d/transact dbconn/conn (into [] (vals tree)))) (store-tree parsed-tree-with-refs) where tree map of node names nodes. curiously enough, took edn specific entity :node threshold 90 repl , manually transact'ed it, , worked without problems. used code: @(d/transact dbconn/conn [{:db/id (d/tempid :db.part/user), :node/threshold 90, :node/location "us"}]) can please help? thanks, vitaliy.

css - checkbox style is missing when form is submitted and angular scope variable is refreshed -

i have application uses charisma template 1.x , have used angularjs within template. application working fine problem having tab grid within there form submit window. in each group tab having n number of checkboxes, after clicking of checkboxes when click submit button, particular ng-submit action performed apart form action trying refresh scope values given below $scope.records = angular.copy($scope.recordcopy); the functionality working fine style of checkbox lost, sample mockup shown in plunker, there before clicking save notice style of checkbox, after clicking save button can see style of checkbox gone, still functionality working fine. can please tell me solution retaining checkbox style browser: firefox plunker i don't know why style of checkbox lost. but desappears because using of angular.copy wrong. please see definition of function copy here : https://docs.angularjs.org/api/ng/function/angular.copy angular.copy(source, [destination]); yo

java - IllegalStateException when persisting an object -

public void lagremelding(string bruker, string msg) { entitymanager em = emf.createentitymanager(); melding melding = new melding(bruker, msg); try { em.gettransaction().begin(); em.persist(melding); em.gettransaction().commit(); em.close(); } catch (rollbackexception e) { em.gettransaction().rollback(); } } the error report following: java.lang.illegalstateexception: exception description: cannot use entitytransaction while using jta. org.eclipse.persistence.internal.jpa.transaction.jtatransactionwrapper.gettransaction(jtatransactionwrapper.java:73) org.eclipse.persistence.internal.jpa.entitymanagerimpl.gettransaction(entitymanagerimpl.java:1311) no.hib.dat104.oblig1.kontroll.lagremelding(kontroll.java:37) no.hib.dat104.oblig1.meldingservlet.dopost(meldingservlet.java:80) javax.servlet.http.httpservlet.service(httpservlet.java:646) javax.servlet.http.httpservlet.service(httpservlet.jav

javascript - jQuery elevate zoom: initiate on click function -

i'm using elevate zoom plugin ( http://www.elevateweb.co.uk/image-zoom ) allow zooming images on hover. problem i'm having though images don't exist on document load, they're being appended on click function, , relevant elevatezoom function isn't working. jsfiddle demo: http://jsfiddle.net/neal_fletcher/3j33gb1y/ html: <button data-rel="http://2.bp.blogspot.com/-mucnevzlib8/trstjvp92ki/aaaaaaaabli/ek3vb1qmrrw/s1600/slide1-new.png">click!</button> <button data-rel="http://1.bp.blogspot.com/-kdih65cz8hs/tjo9rqbmt9i/aaaaaaaaafg/hevv38ckuzk/s1600/3.jpg">click!</button> <button data-rel="http://4.bp.blogspot.com/-pzunx8uqqhw/tjo9rdvyc8i/aaaaaaaaafy/n91storzgwc/s1600/2.jpg">click!</button> <button data-rel="http://4.bp.blogspot.com/-y1cpqvkits8/tjpdkh1-xdi/aaaaaaaaaga/l8jbwyqcqvi/s1600/hompimenu.jpg">click!</button> <div id="area"></div> jquery: $(do

How to set up SBT build to return zero exit code on test failure for Jenkins? -

when running specs2 tests in jenkins via sbt, build marked failure 1 test fails. since jenkins distinguishes between failure build , test failures, want change this. i know build failure in jenkins detected exit code of call sbt, appears return 1 @ least 1 test fails. what options have assuming want avoid changing build.sbt (or project in general) fix inconvenience? somehow think should possible put standard sbt project standard jenkins install , have work intended. tl;dr use testresultlogger custom test result logger doesn't throw testsfailedexception in turn sets non- 0 exit code. just noticed missed requirement "to avoid changing build.sbt . can use other *.sbt file, exitcodezero.sbt or ~/.sbt/0.13/default.sbt custom testresultlogger . it turns out since sbt 0.13.5 there's way have such behaviour - see added setting 'testresultlogger' allows customisation of test reporting testresultlogger born. > testresultlogger logs resu

c# - Getting the bytes[] / stream of an Image or ImageSource in Xamarin.Forms? -

i've been digging xamarin.forms.labs learn more how images accessed , manipulated. saving image android/ios photo gallery works fine, retrieving image either, @ least user interaction. the problem i'd able save files internally program. saving file doesn't seem problem - i've written interface/dependencyservice solution that. what can't seem access bytes[] or stream of image data xamarin.forms image or imagesource. reading stream imagesource relatively straightforward static method, how these bytes out in order save file within program itself? to frame this: i'm working on app right user takes/selects pictures include within form, , form posted website. being able save pictures, or access data in order transfer it, pretty key. one hacky way write custom renderer image. renderer byte[]/stream native control. here's rough implementation without error handling started: public class myimage : image { public func<byte[]> getbytes {

javascript - Empty response in MEAN database query -

i trying node.js server communicate database can extend angular front end. have path makes request database should return entire database (5 documents). have connection database can see connect when refresh server. i try list relevant code below: loading modules... var express = require('express'); var morgan = require('morgan'); var mongoose = require('mongoose'); var bodyparser = require('body-parser'); var methodoverride = require('method-override'); var app = express(); defining database schema , connecting // database connection , scheme =================== mongoose.connect('mongodb://localhost/data/'); var schema = mongoose.schema({ date: 'string', newproofs: [number], changes: [number], output: [number] }); var test2014 = mongoose.model('test2014', schema); middleware configurations. don't know methodoverride does. believe body parser allows response json? // application midd

xcode - Finding features of Xcode3 in Xcode5+ -

Image
my first day mac/apple , xcode5.2 (updated: 6.0.1), , watching video lesson on xcode3.2.1. the movie shows , narrates following tabs in xcode3.2.1 editor: on upper left: history tab (" playfile.m:2 " on screenshot below) functions list tab (" <no selected symbol> " on screenshot below) on upper right: bookmarks list tab breakpoints list tab class navigation tab list of included files tab counterparts tab (bouncing between .m , .h files) lock file tab (in upper right corner) split editor view tooltip on "split editor view" tab in xcode3: the result of splitting editor window in xcode3.2.1. upon pressing last button (on right, below lock tab) in xcode3: what see in xcode5.1.1 is: updated: same in xcode 6.0.1 : my questions: how can split editor window in xcode5/xcode6? where history, bookmarks, counterparts, etc. in xcode5 xcode6? can xcode3 "look , feel" in xcode

c# - How to save picturebox image into mysql database without imagepath -

i wanted know if possible save images database without image path example default image assigned picture box. sample code used requires image location. byte[] imagebt = null; filestream fstream = new filestream(this.txtimage.text, filemode.open, fileaccess.read); binaryreader br = new binaryreader(fstream); imagebt = br.readbytes((int)fstream.length); conn.open(); mysqlcommand command = new mysqlcommand("insert images(image)values(@img)", conn); command.parameters.add(new mysqlparameter("@img", imagebt)); reader = command.executereader(); messagebox.show("saved"); while (reader.read()) { } you can use memorystream save image picturebox byte array image image = picturebox.image; memorystream memorystream = new memorystream(); image.save(memorystream, imageformat.png); byte[] imagebt = memorystream.toarray(); other parts same.

ios - Do something every x minutes in Swift -

how can run function every minute? in javascript can setinterval , similar exist in swift? wanted output: hello world once minute... var helloworldtimer = nstimer.scheduledtimerwithtimeinterval(60.0, target: self, selector: selector("sayhello"), userinfo: nil, repeats: true) func sayhello() { nslog("hello world") } remember import foundation. swift 3: var helloworldtimer = timer.scheduledtimer(timeinterval: 60.0, target: self, selector: #selector(viewcontroller.sayhello), userinfo: nil, repeats: true) func sayhello() { nslog("hello world") }

java - how to make an method return both an integer array and another integer -

public class solution { public static void main(string[] args) throws ioexception { bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); int num = 6; int[] sticks = new int[num]; string line = br.readline(); string[] strs = line.trim().split("\\s+"); for(int i=0;i<num;i++) { sticks[i] = integer.parseint(strs[i]); } recursion(sticks,num); } public static void recursion(int[] sticks,int num) { int min_num = findmin(sticks,num); int cut=0; for(int i=0;i<num;i++) { sticks[i] = sticks[i] - min_num; cut++; } int[] res = minarray(sticks,num); system.out.println(cut); int len = res.length; while(len != 0) { recursion(res,len); } } public static int findmin(int[] arr,int size) { int minimum = arr[0]; for(int i=0;i<size;i++) { if(arr[i] < minimum) { minimum = arr[i]; }

ruby on rails - how do i get the id of the selected item in dropdown -

<%= form_for(:offer,:url=>{:controller=>'offers',:action=>'combo'}) |f|%> <%= f.select :catid_get, options_from_collection_for_select(@categories, "id", "name"), prompt: "select category" %> i new in rails.i have dropdown categories there.when select category dropdown want category id in controller,so can use id it's child dropdown . select each select option in html has 2 values -- value , label : <select> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> it's value passed controller. means if able create select tag in rails app correct value / label setup, pass correct data require. rails here's how i'd handle it: <%= form_for :offer, offers_combo_

memory management - Hashing google interview -

why can't powers of 2 or power's of 10 or prime numbers hashing functions? if want store overflow records in hash function, why aren't selection of hashing functions? suppose hash function returns 32-bit unsigned result. suppose choose modulus of 4096. is, effectively: index = hash & 0xfff -- so, throw away top 20 bits of hash value. now, if hash really good, , bottom 12 bits rest, that's not problem. however, if hash pretty on 32 bits, bottom 12 bits suspect (they might, example, more influenced last characters of string)... may regret discarding top 20. in case, if choose odd modulus, index = hash % modulus result depends on 32 bits of hash. so, more generally, if hash calculated modulo m , , index taken hash % n , want m , n co-prime. if m 2^m (as is), n=10^n poor choice, because bottom n bits of resulting index straight copy of bottom n bits of hash.

php - Laravel Routing to non index method in controller -

i trying create route: route::get('/apply/submit', 'applycontroller@submit'); but keep getting standard laravel error page. my applycontroller: class applycontroller extends basecontroller { public function index() { return view::make('apply.apply', array('metatitle' => 'china aupair | internships | apply online')); } public function submit() { return 'yay!'; } } which don't understand because route::get('/apply', 'applycontroller@index'); works should. what doing wrong? i think problem method access page. try send form (using post method) , use get route. should change: route::get('/apply/submit', 'applycontroller@submit'); into route::post('/apply/submit', 'applycontroller@submit'); because send form , not run route manually in browser using http://localhost/yourproject/apply/submit

android - how to show list view record in textview on setOnItemClickListener -

i have created simple list view,what want when user click on list view,selected record should show in text view in code work properly,but problem when user again click want show record in second text view,please give me idea/code how this..please please me...i new in android.. public class mainactivity extends activity { string item[]=new string[]{"rk","kk","kk","ll","mm","uu"}; textview tv,tv1,tv2,tv3,tv4; listview li; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); li=(listview)findviewbyid(r.id.listview1); tv=(textview)findviewbyid(r.id.settext);\ tv1=(textview)findviewbyid(r.id.settext1); tv2=(textview)findviewbyid(r.id.settext2); tv3=(textview)findviewbyid(r.id.settext3); tv4=(textview)findviewbyid(r.id.settext4); arrayadapter<string> adapter=new arrayadapter<string> (t

c++ - Access violation writing location 0xCCCCCCC? -

when try push_back element, gives me error "unhandled exception @ 0.x00d644ab in project.exe: 0xc000005: access violation writing location 0xccccccc." i've tried looking solution, can't seem find 1 relates me. tons. sdal(){ t* list = new t(50); size1=50; numberofelements=0; } void push_back( const t& element ) { numberofelements++; if(numberofelements>=size1-1){ expandarray(); } list[numberofelements-1]=element; } the error points "list[numberofelements-1]=element;" when debug it. the full code here: template <typename t> class sdal { private: int size1; int numberofelements; t* list; public: sdal(){ t* list = new t[50]; size1=50; numberofelements=0; } sdal(int x){ t* list = new t[x]; size1=x; numberofelements=0; } void expandarray(){ int tmpsize = size1;

gson - OutOfMemoryError when try to store big data in SharedPreferences, Android -

problem: want store huge map of objects (1000 contacts) sharedpreferences. i have cordova application 1st time load contacts , convert photos base64 string. generally process might take 30 sec. reason goal store contacts string sharedpreferences load after quickly. i use gson library no matter do, get: java.lang.outofmemoryerror @ java.lang.string.<init>(string.java:354) @ java.lang.string.<init>(string.java:171) @ java.io.bytearrayoutputstream.tostring(bytearrayoutputstream.java:137) this method convert map bytearrayoutputstream exception in last line: out.tostring() public static string getstrfromgroupslistjsonobject(concurrenthashmap<string, wmcontactimage> contactmap){ gson gson = getinstance(); outputstream out = new bytearrayoutputstream(); try { jsonwriter writer = new jsonwriter(new outputstreamwriter(out, "utf-8")); iterator<string> = contactmap.keyse

Equivalent to python's set.pop() for C++'s unordered sets -

does c++ have equivalent python's set.pop() ? i've been looking @ documentation unordered_set s here , there doesn't seem way 1. access arbitrary element, and/or 2. access + remove arbitrary element (popping). note c++ standard library intentionally designed various container specifications not include "get , remove" function: e.g. vector , have back() returns value @ end, , have pop_back() removes value @ end, not return it. the reasons content of separate question. so want method obtain element (e.g. begin() suggested in comments), , remove once you've gotten (e.g. erase(iterator) mentioned in other answer).

Save multiple results of foreach loops in R -

suppose have following simple for loops simulation , ols estimation: set.seed (12345) m <- rnorm(20, 0, 1) n <- 10 b1 <- 0.5 b2 <- 2 model1_b <- matrix(nrow=n, ncol=2) model2_b <- matrix(nrow=n, ncol=2) error <- matrix(nrow=20, ncol=n) (a in 1:2){ (b in 1:4){ x <- (m+a)/b (r in 1:10){ repeat { e <- rnorm(20, 0, 0.5) # error term error[,r] <- e # ols estimation of model_1 y=b1 + b2*x + e # true model 1 model_1 <- lm (y~x) model1_b[r,]=model_1$coef # ols estimation of model_2 y=b1 + b2*(x^2) + e # true model 2 model_2 <- lm (y~x) model2_b[r,]=model_2$coef if (model_1$coef[1]!=0 & model_2$coef[1]!=0) {break} } # end of repeat{} loop } # end of for(r){} loop } # end of for(b){} loop } # end of for(a){} loop error model1_b model2_b i want convert these nested for loops nested foreach loops, such parallel computing. can see t

php - preg_replace is replacing matches including content contained within -

i using preg_replace replace html comment tags empty space seems replacing whole html comment empty space. echo preg_replace('/<!--(.*?)-->/','',$r->pagecont); where $r->pagecont database entry containing html, example: <div class="col-lg-12"> <p>the year is:</p> <!-- <?php echo date(y); ?> --> </div> in above example, html comment tags stripped away leaving php code echo year. said, happening entire html comment being stripped away. can recommend pattern use? appreciate input. edit: updated question reflect code using. it seems you're trying replace comment line php code present inside that. if yes, need put replacement string $1 refer group index 1. echo preg_replace('/<!--(.*?)-->/', '$1', $r->pagecont); demo

c# - Cannot open Pdf files from website server -

i doing mvc asp.net website in have integrate fedex shipping. have open pdf @ end of process creating in shipping process. it's not opening in website server. it's working in local. code given below. please me private static void savelabel(string labelfilename, byte[] labelbuffer) { // save label buffer file filestream labelfile = new filestream(labelfilename, filemode.create); labelfile.write(labelbuffer, 0, labelbuffer.length); labelfile.close(); // display label in acrobat displaylabel(labelfilename); } private static void displaylabel(string labelfilename) { system.diagnostics.processstartinfo info = new system.diagnostics.processstartinfo(labelfilename); info.useshellexecute = true;`enter code here` info.verb = "open"; system.diagnostics.process.start(info); } it work on website. system.diagnost

mySQL: Not wanted cast to integer in search query -

today found issue in 1 search query , can't find easy solution. we have query: select invoice_id, firstname, lastname table email = '24assets@example.com' or firstname = '24assets@example.com' or lastname = '24assets@example.com' or invoice_id = '24assets@example.com' the problem here have search invoice_id - int(10) unsigned. mysql automatically cast 24assets@example.com integer: 24 , show results row invoice_id = 24 the solution found check number or not before send sql query , if not number execute query not containing invoice_id inside. this example query, real query have 3 join's invoice_id its surprised see result: 24 when execute query first time: select invoice_id table invoice_id = '24aaa@aaa.aa' i didn't know cast before, because not searching stings in integer column read in google that. i think work think handling in code (php assume?) clearer. complex workaround

objective c - iOS8 Xcode6 UICollectionView sizeForIndexPath: does not get called on rotation -

my project has uicollectionview custom cell used work on iphone , ipad before ios8. in ipad on first load cells perfect on rotation - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout*)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath does not called. problem rotation logic goes , that's why uicollectionview twitches. here solved it: added bottom line didrotatefrominterfaceorientation: method -(void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation{ [super didrotatefrominterfaceorientation:frominterfaceorientation]; [self.collectionview performbatchupdates:nil completion:nil]; }

c - Create a program that generate a Unity3D application -

i'm trying develop simple program should create unity3d application. read unity manual in section of command line arguments , wrote simple c program in user can choose operating system , execute unity command. tried use command create new project , build application target device , saw works. designed 3d model using sketchup , generate .obj file import in unity. i've import model in unity using command line arguments, don't know how can import .obj file. know how can solve problem? i've found in unity manual . using unityengine; using unityeditor; public class importasset { [menuitem ("assetdatabase/importexample")] static void importexample () { assetdatabase.importasset("assets/textures/texture.jpg", importassetoptions.default); } } massive assumption, given learncocos2d comment. if commandline can run editor scripts, 1 of, might able try above out part of build process.

x86 - Find and display greatest common divisor from 2 input numbers in nasm -

good day, i have been trying write program following: accept 2 ascii numbers user (i haven't bothered trying check values yet) convert ascii numbers decimal values. find greatest common divisor 2 numbers display result i feel though i've done steps 1-3, although i'm not entirely sure. here code: bits 16 org 0x100; jmp main ; number1_str: db 3,0,0,0,0,'$' number2_str: db 3,0,0,0,0,'$' num1_hex: dw 2 num2_hex: dw 2 prompt1: db 'please enter first number (from 1 50): ','$' prompt2: db 'please enter second number (from 1 50): ','$' cr_lf: db 13,10,'$' ; carriage return , line feed ; ;displays string in dx ; disp_str: mov ah,09 ; int 0x21 ; ret ; ; ; converts ascii string of digits decimal number, , puts result ; in ax, , passes address dx. if error occurs, al set 'e'. ; str_to_num: xor ax,ax ; initial value of ax =

sql - Slow mysql query when additional select criteria added -

i'm having issues sql query going extremely in innodb mysql table. there's 32,000 rows , conditions in clause indexed , either bits or bigints. wouldn't have expected speed issue @ queries take 2 mins complete. it's difficult tell because of caching appears if remove of select criteria query except id query executes in milliseconds. the rows large store email html row 1mb. when query runs computer uses lot of harddrive resource appears source of speed slowdown. far know though database shouldn't need use additional resource when select criteria added, first finds rows , pulls out information needs rows. can correct me if i'm wrong or let me know if other setting explain behaviour. as requested here query: select aplosemail0_.id id4353_, aplosemail0_.active active4353_, aplosemail0_.deletable deletable4353_, aplosemail0_.editable editable4353_, aplosemail0_.persistentdata persiste5_4353_, aplosemail0_.datecreated datecrea6_4353_, aplosemail0_.date

asp.net mvc - MVC4 load data into partial views -

my main (myprofile) view contains links when user clicks on link partial view loads in div existing data db can updated user. @ajax.actionlink("update 1", "update1", new { email = @viewbag.email }, new ajaxoptions() { httpmethod = "get", updatetargetid = "divcurrentview", insertionmode = insertionmode.replace }) @ajax.actionlink("update 2", "update2", new { email = @viewbag.email }, new ajaxoptions() { httpmethod = "get", updatetargetid = "divcurrentview", insertionmode = insertionmode.replace }) <div id="divcurrentview"> </div> partial views: example: _update1: @model viewmodels.update1 @using (html.beginform()) { @html.antiforgerytoken() @html.validationsummary(true) @html.hiddenfor(model => model.id) @html.labelfor(model => model.name) @html.textboxfor(model => model.name) <input type="submit" value="

How can I pass a token generated on one PHP form to a form that processes it? -

i'm trying secure forms csrf attacks generating unique token on each one. have hidden field on form generates unique token so: public static function generatetoken() { return $_session['token'] = md5(uniqid(mt_rand(), true)); } i know md5 depreciated , should not used because isn't random like: base64_encode(openssl_random_psuedo_bytes(32)); but don't have ssl installed , take care of this. main question is, after generation of token stored session user in so: $_session['token'] = $_post['token']; it grabs value of field has generated token in it. have token stored session, need figure out away send processing file. have lot of fields on form bit weird check every single thing in 1 if() statement. guess i'm trying is, how can check token on form processes data , if token isn't same token generated on form, can reject data? use die() kill processing script? i'm wondering if need - i've read on csrf suppose w

Writing to docker volume from Dockerfile does not work -

please consider following dockerfile: from phusion/baseimage volume ["/data"] run touch /data/hello run ls -ls /data problem: "/data" directory not contain "hello" file. moreover, other attempts write volume directory (via echo, mv, cp, ...) unsuccessful - directory empty. no error messages shown. i not find in documentation or on stackoverflow regarding problem. is well-known or new? docker version returns: client version: 1.2.0 client api version: 1.14 go version (client): go1.3.1 git commit (client): fa7b24f os/arch (client): linux/amd64 server version: 1.2.0 server api version: 1.14 go version (server): go1.3.1 git commit (server): fa7b24f each step of dockerfile run in it's own container discarded when step done, , volumes discarded when last (in case only) container uses them deleted after it's command finishes. this makes volumes poorly suited use in dockerfiles because loose contents half way through. docker files

preg replace - PHP hiding multiple phone numbers -

i trying replace phone numbers [hidden] , show them on click. works great when there 1 number. when there more, hides it, problem returns same number both hidden fields. $check ='111 111 1111 / 222 222 2222'; preg_match('/[(]*\d{3}[)]*\s*[.\- ]*\d{3}[.\- ]*\d{4}/', $check, $phone_matches); echo sizeof($phone_matches); //returns 1, why not 2?? pretty much, if can me sizeof($phone_matches) show correct amount, should there! edit: for($i=0; $i<sizeof($phone_matches[0]); $i++){ $check = preg_replace('/[(]*\d{3}[)]*\s*[.\- ]*\d{3}[.\- ]*\d{4}/', '<span class="hide">'.$phone_matches[0][$i].'</span><span class="show">show phone</span>', $check); } echo $check; you want use preg_match_all , not preg_match preg_match_all('/[(]*\d{3}[)]*\s*[.\- ]*\d{3}[.\- ]*\d{4}/', $check, $phone_matches); print_r($phone_matches); but note sizeof($phone_matches) still 1, since

cordova - Unable to download pdf using phonegap app -

i have created 1 app. in want feature download pdf my app redirects following url when http://www.premah.com.au/monthly-updates/ now, when redirect app mobile's browser.i can download pdf when click on of pdf's poster. when using phonegap build this.unable download pdf have tried following : 1. inappbrowser using window.open _blank,_system. 2. have tried using file-transfer plugin downloading absolute url of server ex: http://www.premah.com.au/wp-content/uploads/2013/04/apr-2014-gen-f.pdf if have 100% working solution inappbrowser or file-transfer plugin please put code. many in advance. source = http://www.premah.com.au/wp-content/uploads/2013/04/apr-2014-gen-f.pdf fpath = your_file_path; //use filesystem file path. downloadbook: function(source, fpath) { var filetransfer = new filetransfer(); filetransfer.download(source,fpath,function(entry) { }, function(error) { console.log("download error target &qu

Reading XML file containing SQL statements that require variables from VB.NET program -

i have program written in vb.net , wrote sql statements hard-coded program. wanted try store queries externally in xml file changes can made sql (if needed) without having go code , rebuild program every single time. the part complicating things sql statements require variables added run properly. for example: select name_first, name_last, email_id & eventname with eventname being variable in program. when set xml file, tried both of following: <data> <loadsaves> <sqlstatement><![cdata[select name_first, name_last, email_id &eventname&]]></sqlstatement> </loadsaves> </data> and <data> <loadsaves> <sqlstatement><![cdata["select name_first, name_last, email_id from" & eventname]]></sqlstatement> </loadsaves> </data> i needed cdata because without it, special characters make act

openmp - Telling GCC to *not* link libgomp so it links libiomp5 instead -

i need figure out compiler/linker directive can feed gcc won't automatically link libgomp when -fopenmp specified. the reason i'm trying build against intel's mkl blas. mkl requires adding separate intel library handle multithreading (e.g., libmkl_intel_thread or libmkl_gnu_thread). library linking mkl against libgomp, however, not available on every operating system, including mine. forces me link libmkl_intel_thread, in turn must link against libiomp5. while able build package, binaries linked against both libgomp , libiomp5. i'm not positive causing problems, there have been few crashes, linkage-combination suspicious, , if isn't causing crashes terrible inefficiency. i'm trying gcc 4.9.1. avoiding -fopenmp is, unfortunately, not option. reason compiling rather large package comprised of several sub-packages, makefiles not in greatest shape, , additional packages other sources (plug-ins) may compiled later. forcing universal compiler/link

group by - Access query: TOP 1 with TOTALS is doubling up my SUM -

when run simple query in ms access, single table, doubles sum column. select top 1 data.item, reference.[proposed new category] type, sum(data.[qty sold]) [nbr sold] data inner join reference on data.item = reference.[item name] data.[month date] = [type 1st of month want - aug 2013, type 8/1/2013] group data.item, reference.[proposed new category] order sum(data.[qty sold]) desc; yes, saw both of these, please don't muss thread referring them unless it's constructively explain why applicable. neither of them addressed situation (one self-join , other 1 joins - have no self joins). cumulative totals being doubled access 2010 doubling sum in query why doubling inherent in query, , how can avoid it?? want top 1 item sum of qty sold descending...sounds simple. i'd avoid doing bunch of typical "access junk", make table queries etc., there way around it? one thing cause if join many-to-many relati

php - What does \\x80-\\xFF refer to? -

in process of looking solutions sanitise output, came across code following. preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $some_url) now, think it's trying remove other above mentioned characters. doesn't \\x80-\\xff refer form of non-printable ascii characters ? if so, why code possibly trying not remove them ? any indications/pointers/help appreciated. thanks. okay, answers given far lead me in right direction , allowed me find following in documentation . after \x, 2 hexadecimal digits read (letters can in upper or lower case). in utf-8 mode, \x{...} allowed, contents of braces string of hexadecimal digits. interpreted utf-8 character code number given hexadecimal number. original hexadecimal escape sequence, \xhh, matches two-byte utf-8 character if value greater 127. so, summary :- i) '\x' allows hexadecimal escape sequence, after which, 2 hexadecimal digits read ii) '\xhh&

symfony - How return an array from a symfony2 controller action? -

in symfony2 project need call same action in many controllers , action should return simple php array passed twig template these controllers. how can it? a pratical example can explain situation better. 1.shared controller // acme/demobundle/controller/metascontroller class metascontroller extends controller { public function metasaction() { $myarray= array(); return $myaarray; } } page render controller // acme/demobundle/controller/pagecontroller class pagecontroller extends controller { protected $property = "test"; public function indexaction() { $metas= $this->forward('acmedemobundle:metas:metas'); return $this->render('acmedemobundle:page:index.html.twig', array('property'=>property, 'metas'=>$metas)); } } when error: controller must response array given. you should create service // acme/demobundle/controller/m

reporting services - SSRS Filter not working -

Image
i asked time ago, i'm still having same problem, can help. i have table, data similar found in linked image: http://i.stack.imgur.com/bwfwf.png i want add subtotal before product total online, however, when adding following filter (see link), table above results. https://imagizer.imageshack.us/v2/1073x527q90/902/xjthws.png what confuses me further if make filter offline, totals everything, therefore makes me think ssrs thinks words "offline" , "online" 1 , same... any here appreciated, has defeated me month. thanks. follow step given below: i think work you...

java - Change Data inside byte array Without corrupting byte array -

����sr��java.util.vectorٗ}[�;���i��capacityincrementi��elementcount[��elementdatat��[ljava/lang/object;xp��������������ur��[ljava.lang.object;��x�s)l����xp������t��918983123456@s.whatsapp.nett��91704056789@s.whatsapp.netx i have 1 byte[] , inside byte[] have above data. want change mobile numbers byte[] array. without corrupting byte array data. i tried, first create string byte array new string(byte[]), after replace mobile number after again created byte array replace string using getbytes() after print new byte array showing data replacing new mobile number byte array corrupted. guyz, please me & thankx in advance. you need initialize new string(bytes[] b) proper encoding second argument. for instance: string foo = new string(mybytesarray, "utf-8"); same applies getbytes method. instance: byte[] mybytearray = "foo".getbytes("utf-8");

php - Fields with accents are not saved in ocomon mysql database -

i downloaded recommended desk application called ocomon , use wamp . i installed everything. database uses utf8_general_ci , application in portuguese (br) when try put data accents, record saved, columns accentuated text not saved. anyone knows doing wrong? example of code error: $qry = "update configusercall set ". "conf_user_opencall= ".$_post['useropencall'].", ". "conf_ownarea = ".$_post['ownarea'].", ". "conf_scr_msg = '".nohtml($_post['msg'])."' conf_cod = 1 ";

javascript - How can I refresh a table that contains JQuery mobile buttons without losing formatting -

i have created function generates table of jquery mobile buttons; using javascript (this called in document ready function), using following code - works fine: function renderbuttons() { console.log(coaches); var coachbuttonshtml = ""; coachbuttonshtml += "<table align='center' class='full_width_table'>" + "<tr>" + "<td class='cellpadding'><div id='0' data-role='button' data-position-to='window' data-mini='true' onclick='coachselect(this.id)'>coach " + "(" + coaches[0].value + ")" + "</div></td>" + "<td class='cellpadding'><div id='1' data-role='button' data-position-to='window' data-mini='true' onclick='coachselect(this.id)'>coach b " + "(" + coaches[1].value + ")" + "</div></td

java - Is it right to create a new object to avoid a null pointer exception? -

i don't want pass null value view tier, if like: public list<object> getlistobjfoo(){ list<object> listobj = datasource.getall(); return listobj != null ? listobj : new arraylist<object>(); } it should considered or bad practice? , use of "optional" in "guava" google better doing this? why? your code bad practice because allocates new instance. try use collection.emptylist() instead. drawback: if consumer of code wants change list, need make copy of list. practice since many frameworks return immutable lists , consumer, can never sure unless api says allowed result. returning null bad because exports implementation detail of code consumer. or put way around: if change implementation , find want return null , need add checks in places api used. hampers ability evolve code , api. for other (non-collection) types, should @ "optional" pattern described here: https://stackoverflow.com/a/16218718/34088

javascript - Which browsers and browser versions does window.openDialog support and is it in danger of being deprecated or phased out? -

there code analyzing uses window.showmodaldialog . don't yell @ me; it's not code. job replace it. needs vanilla js, no frameworks. showmodaldialog deprecated. replaced window.open , support browsers, including ie versions 7+. i found link below discusses window.opendialog . https://developer.mozilla.org/en-us/docs/web/api/window.opendialog i prefer window behave dialog window. great. problem don't know window.opendialog . standardized html5 or be? in danger of being phased out? browser , browser versions support it? i have no problem using window.open . if can use window.opendialog instead , not worry being deprecated or phased out, preferred. thank help. see: https://developer.mozilla.org/en-us/docs/web/api/window.opendialog#specification "dom level 0. not part of standard." meaning it's not officially supported anywhere.

javascript - Change width of selectbox if no value -

can me please creating little script in jquery make select box width bigger when there no value? here code selectbox <td class="value"> <select> <option value=""> select 1 </option> <option value="100-g" selected='selected'> 100 g </option> <option value="200-g" > 200 g </option> </select> </td> and need make this: .summary table.variations .value { width: 300px; } lot. http://jsfiddle.net/oxydesign/2qn0d7rg/ js $(document).ready(function(){ $('select').on('change',function(){ var select = $(this), cell = select.closest('td'); if(select.val()){ cell.removeclass('large'); }else{ cell.addclass('large'); } }); }); is want ?

jquery - unable to push values into global array inside $.post() method -

i trying push returned data $.post method global array...please me how return entire array var retval =[]; function returnoptionlist(optname){ $.post('getlisttypes',{"key":optname},function(data) { if (data.listnames == optname){ for(var i=0; i<data.values.length;i++){ retval.push(data.values[i]); } } }); return retval; } use callbacks return data ajax call, not return function returnoptionlist(optname, callback){ $.post('getlisttypes',{"key":optname},function(data) { if (data.listnames == optname){ for(var i=0; i<data.values.length;i++){ retval.push(data.values[i]); } } callback(retval) }); } and call: returnoptionlist(optname, data) { console.log(data); //your array })

javascript - Check values of nested items of object -

i trying check week object's minutes , hours , cannot figure out doing wrong. week object can contain variations of day1 - day7 dont want check them specifically. want check nested hours/minutes. don't want use jquery , has work ie8. appreciated. week = { day1: { hours: 6, minutes: 20 }, day2: { minutes: 45 }, day3: { hours: 8, minutes: 15 } }; hoursinvalid = false; minutesinvalid = false; (var item in week) { if (week.hasownproperty(item)) { (var = 0; < week[item].length; i++ ) { if (week[item][i].hours > 6) { hoursinvalid = true; break; } if (week[item][i].minutes > 20) { minutesinvalid = true; break; } } } } i don't see need internal for

Looking for more efficiency in Javascript -

i'm writing web app/game has ton of clickable .png images glow when hover on them , change further momentarily when clicked. code have want do, i'm noticing there lot of redundancies going out , getting elements id. i'm wondering if maybe more javascript savvy me knows of better way write this. naturally, in root folder there 3 .png files every "button", each representing pic in different states...(i.e. inventorypic.png, inventorypicglow.png, , inventorypicdown.png image files changed in , out of dom depending on status of "inventorypic" element.) function glowtext(element) { var glowpicname = element.id + "glow.png"; element.src = glowpicname; } function normaltext(element) { var normalpicname = element.id + ".png"; element.src = normalpicname; } function downtext(element) { var downpicname = element.id + "down.png"; element.src = downpicname; } document.getelementbyid("inventorypic&quo

How to open spotify links in both android and ios device? -

i did google search opening spotify urls/uris on native app, , found following uri scheme open links in native app. spotify://spotify:artist:12chz98phfmpjeknjqmwvi this above link seems working fine on ios devices, not able open on android device(htc one). suggestions ? have tried entering spotify:artist:12chz98phfmpjeknjqmwvi in android. believe spotify:// may directing towards app, think android directs apps different command. also, in case same android, need have app installed on phone if dont have directing command work properly.

android - Change Fragment's container height dynamically -

Image
i want change container's height (which pageviewer ) fragment class on scroll event of listview . what have tried already :- 1.layoutparams viewgroup.layoutparams params = view1.getlayoutparams(); params.height = mcontainerheight+ math.max(a,b); view1.requestlayout(); here view1 container. 2.getting container directly fragment class(by findviewbbyid) failed, because view in different(parent) layout , couldn't views different layout. and many more tweaks based on above implementations. i may doing wrong, tell want achieve. container's height should increase fill empty space between actionbar , listview . when scroll container height should increase. what's happening . action bar moving container isnt. i appreciate help. edit 1 code awesomecardfragment class public class awesomecardfragment extends fragment { private int mactionbartitlecolor; private int mactionbarheight; private int mheaderheight;