Posts

Showing posts from February, 2012

android - Exception java.lang.ArrayIndexOutOfBoundsException only on Panasonic P-02E -

this question has answer here: why arrayindexoutofboundsexception occur , how avoid in android? [closed] 4 answers i gather crashes firebase apps. 1 of them reported following error, weird, on device panasonic p-02e. have no idea part of code reponsible this, seem problem of panasonic only, not application. idea how fix this? exception java.lang.arrayindexoutofboundsexception: src.length=8192 srcpos=1 dst.length=8192 dstpos=0 length=-1 java.lang.system.arraycopy (system.java) org.kxml2.io.kxmlparser.fillbuffer (kxmlparser.java:1489) org.kxml2.io.kxmlparser.skip (kxmlparser.java:1574) org.kxml2.io.kxmlparser.parsestarttag (kxmlparser.java:1049) org.kxml2.io.kxmlparser.next (kxmlparser.java:369) org.kxml2.io.kxmlparser.next (kxmlparser.java:310) com.android.internal.util.xmlutils.readthismapxml (xmlutils.java:578) com.android.internal.util.xmlutils.readthisvaluexml

java - jmeter GUI setting https.use.cached.ssl.context=false -

i new jmeter i'm not sure how this. in jmeter docs i want set in jmx file https.use.cached.ssl.context=false how can in jmeter gui? if want property set in of scripts, change commented-out #https.use.cached.ssl.context=true in jmeter.properties https.use.cached.ssl.context=false . if want my_test.jmx , copy jmeter.properties my_test.properties , make change there. when start jmeter command line, can specify file -p . alternatively, can specify property -j . see here jmeter command line options. as redline13 , looks like use -j , i'm not familiar them.

Rails 5 - how to implement ajax flash message for devise -

i making rails5 blog app devise. in comments controller, check if user exists using "before_action :authenticate_user!". so, if user logged in create comment method gets executed , server response gets send client via ajax. however, if user not logged in "before_action :authenticate_user!" check creates 401 authentication error in response ( can seen in browser log). i want display flash message above comment box or somewhere on page user knows he/she can not enter comment without logged in. there many similar questions have found seem confusing , none of solutions worked me. of them talk changing devise confg (e.g. config.http_authenticatable_on_xhr = false) or override authenticate_user method etc. can explain possible show flash message warning user login add comment (ajax call). don't want automatic redirect ajax calls. create flash method catch unauthorized error in jquery , show flash message : @flash = (content, type) -> conte

php - Change Redirect Path -

so building web application in laravel framework (version 5.3) , want change redirect path whenever user fails login, far i've tried piece of code in logincontroller.php protected $loginpath = "/my-given-path"; but doesn't seem work, tried inspecting authenticatesusers trait , got file , redirectusers trait , there no such function revolving around $loginpath exists, $redirectto exists. alright came authenticatesusers trait , inspected couple of functions see :- public function login(request $request) { $this->validatelogin($request); // if class using throttleslogins trait, can automatically throttle // login attempts application. we'll key username , // ip address of client making these requests application. if ($lockedout = $this->hastoomanyloginattempts($request)) { $this->firelockoutevent($request); return $this->sendlockoutresponse($request); } $credentials = $this->credentials($

What is the proper level of indent for hanging indent with type hinting in python? -

what proper syntax hanging indent method multiple parameters , type hinting? align under first parameter def get_library_book(self, book_id: str, library_id: str )-> book: indent 1 level beneath def get_library_book( self, book_id: str, library_id: str ) -> book: pep8 supports indent 1 level beneath case, not specify if align under first parameter allowed. states: when using hanging indent following should considered; there should no arguments on first line , further indentation should used distinguish continuation line. pep8 has many ideas in it, wouldn't rely on decide kind of question whitespace. when studied pep8's recommendations on whitespace, found them inconsistent , contradictory. instead, @ general principles apply programming languages, not python. the column alignment shown in first example has many disadvantages, , don't use or allow in of p

url - HTML position:fixed page header and in-page anchors -

if have non-scrolling header in html page, fixed top, having defined height: is there way use url anchor (the #fragment part) have browser scroll point in page, still respect height of fixed element without of javascript ? http://foo.com/#bar wrong (but common behavior): correct: +---------------------------------+ +---------------------------------+ | bar///////////////////// header | | //////////////////////// header | +---------------------------------+ +---------------------------------+ | here rest of text | | bar | | ... | | | | ... | | here rest of text | | ... | | ... | +---------------------------------+ +---------------------------------+ i had same problem. solved adding class anchor element topbar height padding-top value. <h1

c - How to handle multiple retransmission timers for UDP protocol? -

i have manage multiple timers udp file transfer application, after timeout server had resend packets client, there more 1 packet time cause timeout. so have manage timer each packet. how can this? i can't use alarm because cancelled previous timers , works seconds. you need keep array of structs containing timeouts each packet want keep track of. each array element should contain starting time , expected ending time each timeout. when it's time set timer, check entries in array see 1 expected time out first. subtract time current time timeout value select . when socket read times out, go through list again , each packet timeout time prior current time, handle timeout packet. take @ source of multicast file transfer application wrote called uftp example of how can implemented. specifically, @ getrecenttimeout function in client_loop.c.

angularjs - How to call correct this in Angular Service in TypeScript -

i have typescript angular project , want refactor use services. problem call in service @ runtime not service class expected controller class. how can call functions inside service service itself? here relevant code fragments: helper service export interface ihelperservice { log(msg: string): void; getmodel(model: string): array<any>; } export class helperservice implements ihelperservice { public getmodel(model: string): array<any> { return this.getmodelenum(model); } private getmodelenum(model: string): array<any> { ... } } let module: angular.imodule = angular.module("myapp", ["ngtouch"]); module.service('helpersvc', helperservice); controller constructor($scope: angular.iscope, $http: angular.ihttpservice, helpersvc: ihelperservice) { this.scope.getmodel = helpersvc.getmodel; } html <select ng-model="ae.scope.model" ng-options="type.id type.value type

.net - Dynamically Resolve Dependency at Runtime in C# DLL -

i have wpf dll project contains custom controls, themes, styles, etc., built anycpu. i have dependency on open source web browser control doesn't have native anycpu support, have separate x86/x64 assemblies. in exe, simple. can handle appdomain.currentdomain.assemblyresolve event check 64 bit process , assembly.loadfile proper assemblies. how dynamically resolve dependency @ runtime in dll project? it turns out, overthinking issue. in wpf dll, have custom control class using open source web browser control. in static constructor of custom control, setup handler appdomain.currentdomain.assemblyresolve event. and handler: private static assembly resolver(object sender, resolveeventargs args) { if(args.name.startswith("cefsharp")) { string assemblyname = args.name.split(new[] { ',' }, 2)[0] + ".dll"; string archspecificpath = path.combine(appdomain.currentdomain.setupinformation.a

entity framework - Why can't I create a callback for the List Find method in Moq? -

i created extension method lets me treat list dbset testing purposes (actually, found idea in question here on stack overflow, , it's been useful). coded follows: public static dbset<t> asdbset<t>(this list<t> sourcelist) t : class { var queryable = sourcelist.asqueryable(); var mockdbset = new mock<dbset<t>>(); mockdbset.as<iqueryable<t>>().setup(m => m.provider).returns(queryable.provider); mockdbset.as<iqueryable<t>>().setup(m => m.expression).returns(queryable.expression); mockdbset.as<iqueryable<t>>().setup(m => m.elementtype).returns(queryable.elementtype); mockdbset.as<iqueryable<t>>().setup(m => m.getenumerator()).returns(queryable.getenumerator()); mockdbset.setup(d => d.add(it.isany<t>())).callback<t>(sourcelist.add); mockdbset.setup(d => d.find(it.isany<object[]>())).callback(sour

ios - Delete operation via lambda functions -

let calcium = set([ ":calcium" ]) if (editingstyle == uitableviewcelleditingstyle.delete) { // handle delete (by removing data aws) let lambdainvoker = awslambdainvoker.defaultlambdainvoker() let jsonobject: [string: anyobject] = [ "tablename": "diafitmessages", "operation": "update" , //import email other view controller -> public variable "key": ["email": email], "updateexpression": "delete #date :responses", "expressionattributenames": [ "#date": currentdate ], "expressionattributevalues": [ ":responses": calcium ], "returnvalues": "none" ] let task = lambdainvoker.invokefunction("handlerdiafit", jsonobject: jso

Horizontally combine two 2D arrays in java -

i trying combine 2 2d arrays a, b horizontally such if: a = [[1, 1], [1, 1]] b = [[2, 2], [2, 2]] then merged array c should like: c = [[1, 1, 2, 2], [1, 1, 2, 2]] it simple vertically combine this: d = [[1, 1], [1, 1], [2, 2], [2, 2]] but want horizontally combine them. idea on how accomplish 2 2d arrays have same dimension? if dimensions of arrays , b same (i.e. positive integers x , y): int[][] = new int[x][y]; int[][] b = new int[x][x]; then create new array as: int[][] c = new int[2*x][y]; and use nested loops fill-in corresponding elements: public class main { public static void main(string[] args) { int[][] = {{1,1},{1,1}}; int[][] b = {{2,2},{2,2}}; int[][] c = new int[2*a.length][a.length]; for(int = 0; < 2*a.length; i++) { (int j = 0; j < a.length; j++) { if (i < a.length) { c[i][j] = a[i][j];

angularjs - TokenMismatchException in VerifyCsrfToken in Laravel 5.1 + angular -

i have laravel 5.1 + angular form sending json request when user want send mail website feedback form. i did form according documentation here https://laravel.com/docs/master/csrf , anyway error message tokenmismatchexception in verifycsrftoken.php line 53: i found lot of topics on stackoverflow, no real solution. there? in header of layout have <meta name="csrf-token" content="{!! csrf_token() !!}"> <script> $.ajaxsetup({ headers: { 'x-csrf-token': $('meta[name="csrf-token"]').attr('content') } }); </script> then in form have this <form name="callback" ng-controller="callbackcontroller" role="form" class="" enctype="multipart/form-data"> {!! csrf_field() !!} ... ... <button type="submit" class="btn btn-primary pull-right" ng-click="submit(callback.$v

Visual Studio 2015 + Windows Dark Theme -

Image
i'm using windows 10, when change theme hight contrast (dark) in os display settings visual studio 2015 shows code monocromatically follows: visual studio doesn't allows me change "color theme" in menu options > environment > general. i've tried delete visual studio's user settings problem persists. how fix problem?

angularjs - Social Login with protractor -

i'm trying login in app google , protractor. can't find error. seems element not present element working fine in test. please me this. here test's code browser.getallwindowhandles().then(function (handles) { var popuphandle = handles[1]; browser.switchto().window(popuphandle); var email = browser.driver.findelement(by.name('email')); var signin = browser.driver.findelement(by.name('signin')); email.sendkeys(browser.params.login.user || process.env.google_user); signin.click(); browser.driver.sleep(2000); var password = browser.driver.findelement(by.name('passwd')); password.sendkeys(browser.params.login.password || process.env.google_pass); var login = browser.driver.findelement(by.css('.rc-button')); login.click(); browser.driver.sleep(10000); browser.driver.switchto().window(handles[0]); }); and here error 16:30:05.655 i

javascript - Conditional Observable chaining in angular 2 -

i working in angular 2, , making series of async calls service. of calls need made conditionally in call chain. initial call chain looks following: pseudo code this.post().flatmap( () => this.put() ).flatmap( () => this.get() )..etc. then need conditionally attach additional async calls chain based on variable array. i'm using kind of approach: pseudo code ...flatmap( () => return this.additionalcallsfunction(callarray) ) .flatmap( () => this.finalpostrequest() ).subscribe(...) additionalcallsfunction(callarray){ if(callarray.length === 0) return observable.empty() else { return this.get().concatmap( (res) => this.put(res).flatmap( () => { callarray.removefirstitem() return this.additionalcallsfunction(callarray) }); } i'm new angular , observables, i'm not sure i'm approaching correctly. whether or not additional calls array empty or not i'm seeing initial calls happen, neither additional calls, nor final post r

R tm package will not load to R studio -

i have been trying load tm text mining package onto r studio number of hours now. have tried have come across online doesnt appear work. started install.packages('tm', dependencies = true) and given following error installing package ‘d:/users/byrne/documents/r/win-library/3.2’ (as ‘lib’ unspecified) warning in install.packages : dependencies ‘slam’, ‘rcampdf’, ‘rgraphviz’, ‘rpoppler’, ‘tm.lexicon.generalinquirer’ not available trying url 'https://cran.rstudio.com/bin/windows/contrib/3.2/tm_0.6-2.zip' content type 'application/zip' length 710948 bytes (694 kb) downloaded 694 kb when try load package using library(tm) i error loading required package: nlp error in loadnamespace(i, c(lib.loc, .libpaths()), versioncheck = vi[[i]]) : there no package called ‘slam’ error: package or namespace load failed ‘tm’ i have loaded nlp , tried load 'slam'. tells me not available on r version 3.2.3. updated 3.2.5 , still gives me same message

java - Using multiple tables to get data SQLitedatabase -

i have 3 tables in database: category, words, , wordimgs. i'm trying implement listgetallcategories , problem need retrieve data 3 tables in order this. suppose join 3 tables? not quite sure how accomplish this. each category contains name , arraylist of words. each word contains name arraylist of images. statements used create tables: public void oncreate(sqlitedatabase db) { final string sql_create_category_table = "create table " + categories_table + " (" + _id + " integer primary key autoincrement," + title + " text not null " + ");"; final string sql_create_words_table = "create table " + words_table + " (" + _id + " integer primary key autoincrement," + title + " text not null, " + belongs_to + " integer not null, " + "foreign key (" + belongs_to + ") references " + cat

lua - How to get Protocol column value in Wireshark dissector? -

i have wrote plugin analyze (translate different protocol name) packet in wireshark lua apis. needed analyze packets shows udp or tcp in wireshark. using following code protocol value: pinfo.cols.protocol analyze packets show tcp or udp in protocol column. sometime retrains value in protocol column (e.g. tcp, ssh, or ...) of time returns "(protocol)". how can fix it? there way possible can figure out? thanks

javascript - Ignore if-else ladder and implements strategic design pattern -

i trying implement strategic design pattern . i have simple if-else ladder below: if(datakeyinresponse === 'year') { bsd = new date(moment(new date(item['key'])).startof('year').format('yyyy-mm-dd')) nestedbed = new date(moment(new date(item['key'])).endof('year').format('yyyy-mm-dd')); } else if(datakeyinresponse === 'quarter') { let tempdate = new date(moment(new date(item['key'])).add(2, 'months').format('yyyy-mm-dd')); // nestedbed = new date(moment(new date(item['key'])).add(3, 'months').format('yyyy-mm-dd')); nestedbed = new date(moment(tempdate).endof('month').format('yyyy-mm-dd')); } else if(datakeyinresponse === 'month') { nestedbed = new date(moment(new date(item['key'])).endof('month').format('yyyy-mm-dd')); }

Introductory Java Student assigning an existing variable to another -

my apologies if seems simple question, new computer science student , question has me stumped. suppose car variable billscar exists , refers car object. write statement assigns billscar's unused capacity double variable amtleft. below source code: public class car{ // car attributes string make; // manufacturer double fuelcapacity; double fuelamount; // car constructor public car(string what, double cap, double amt){ make = what; fuelcapacity = cap; fuelamount = amt; } // car methods public string getmake(){ return make; } public double getcapacity(){ return fuelcapacity; } public double getfuel(){ return fuelamount; } public void setfuel(double amt){ fuelamount = amt; } public double unusedcap(){ return (fuelcapacity - fuelamount); } } the answer block begins double amtleft = ; proper way of assigning billscar unused capacity (a varible not know) double variable amtleft? change unusedcap() this? public doub

ios - How to add Image to video using GPUImage in Swift -

i have codes add image video using gpuimage, somehow doesn't work thought. have searched solution, , still have problem. i'm trying merge image when recoding done. output video not image. here's code. override func viewdidload(){ super.viewdidload setupcamera() } func setupcamera(){ let myboundsize: cgsize = uiscreen.mainscreen().bounds.size camerasubpreview = gpuimageview(frame: cgrectmake(0, 0, myboundsize.width, myboundsize.height)) camerainput = gpuimagevideocamera(sessionpreset: avcapturesessionpreset1280x720, cameraposition: .front) camerainput.horizontallymirrorfrontfacingcamera = true camerainput.outputimageorientation = .portrait camerainput.addtarget(mainvideofilter) mainvideofilter.addtarget(camerasubpreview) camerapreview.addsubview(camerasubpreview) camerainput.startcameracapture() } func setupfilter(){ let logoimageforgpu = gpuimagepicture(image: logoimageview.image) logoimageforgpu.addtarget(t

Error using Gadfly package in Julia -

i new julia. have tried sample code posted in julia site uses gadfly demonstrate plotting. however, gives me below error. believe dependent packages installed. code: pkg.add("gadfly") using gadfly draw(svg("output.svg", 6inch, 3inch), plot([sin, cos], 0, 25)) error got is: error: pyerror (:pyobject_call) <type 'exceptions.valueerror'> valueerror('third arg must format string',) file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/pyplot.py", line 2987, in plot ret = ax.plot(*args, **kwargs) file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/axes.py", line 4137, in plot line in self._get_lines(*args, **kwargs): file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/axes.py", line 317, in _grab_next_args seg in self._plot_args(remaining, kwargs): file "/system/librar

C# HTML Agility Pack XPath Issues -

i honest new html agility pack, have hit stump in road. goal parse data out of html page, when iterate through of divs need , time pull data each div keeps checking whole document instead of inside div. sorry if dumb question, come regex , having issues , lot of questions regarding parsing html. (lol used parse html regex). thing, if guys kind post below sites you'd recommend helping me learn html agility fantastic! edit : forgot mention, below when select individual nodes did try // instead of ., had no luck @ all... edit 2 : removed html page because know fact i'm able access data, issue wondering how instead of searching whole document, search in element this code below, , below html parsing! // grab daily bulletin foreach (htmlnode hn_post in hd.documentnode.selectnodes("//div[@class='newspostitem']")) { htmlnode hn_post_title = hn_post.selectsinglenode(".div[@class='newsposttitle']"); htmlnode hn_post_date = hn_p

angularjs - Changing state without changing browser history in angular ui-router -

assume have logic this: from state a, change state b. whenever arrive state b, app redirect state c calling $state.go(statec) now in state c my question how go state state c (given fact state can state don't know @ run-time, meaning user can access state b other states) use location option value "replace" ... $state.go(statec, null, { location: 'replace' }) see https://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#methods_go location - {boolean=true|string=} - if true update url in location bar, if false not. if string, must "replace" , update url , replace last history record .

haskell - GADT type argument not being used for typeclass resolution -

consider following code data foo f foo :: foo int class dynfoo t dynfoo :: foo f -> foo t instance dynfoo int dynfoo foo = foo obsfoo :: (dynfoo t) => foo f -> foo t obsfoo = dynfoo usedynfoo :: foo f -> int usedynfoo (obsfoo -> foo) = 1 the pattern match in usedynfoo should constrain use of obsfoo have type foo f -> foo int , should cause search instance of dynfoo int . however, instead searches instance of dynfoo t unknown t , , naturally fails. no instance (dynfoo t0) arising use of ‘obsfoo’ type variable ‘t0’ ambiguous however, if change definition of usedynfoo to usedynfoo :: foo f -> int usedynfoo (obsfoo -> (foo :: foo int)) = 1 then works, though type signature redundant. so, why happening, , how can use obsfoo without having give type signature? it's clearer if write out explicit case (view patterns pretty obscuring wrt type-information flow): usedynfoo :: foo f -> int usedynfoo foof = case obsfo

javascript - AJAX async true returns undefined or null reference error in IE 11 -

using ajax call async set true causes following function (see below) fail undefined error. because ajax call not getting return value before browser attempts use it. if async set false ajax function works. missing? function ajaxcmd(cmd) { var txtretval; //alert(cmd); $.ajax({ type: "post", url: "/telligent/rpjquery-functions.asp", data: "cmd=" + cmd, datatype: "html", //async not supported in ie8 or ie9 11082014 cache: false, async: true, success: function(data) { //alert("success"); txtretval = data; }, error: function (request, status, error) { //alert(request.responsetext); txtretval = false; }, failure: function() { //alert("failure"); txtretval = false; } }); //return callback( txtretval ); if (txtretval == "not authenticated") { jqt.goback("#"); location.reload(true); alert(txtretval);

algorithm - What is the efficiency of dividing N positive integers by a given power of 2? -

for example: let's n = 128 . want divide each positive integer , including n , say, 8 . perform integer division for: 1/8 2/8 3/8 ... 127/8 128/8 in looking up, see bit shift operations way go , compiler automatically way in first place. nonetheless, can't seem find big o function type of algorithm. to sum up: given positive integer n , , number y power of 2 , efficiency of algorithm divides each of numbers 1,2,3,...,n y ?

angularjs - How to respond to an md-slider while it is being dragged? -

i've got md-slider , controller correctly updates volume when drag event has finished; when ng-model changed. this code in controller watches volume property/attribute. $scope.$watch( function () { return $scope.volume; }, function (newvalue, oldvalue) { $scope.changevolumevianumberinput(); } ); this html renders slider. <div> <label class="body">volume</label> <md-slider md-discrete aria-label="volume" ng-model="volume" min="0" max="100"> </md-slider> </div> what have add enable controller respond drag event? it resolved removing md-discrete. <div> <label class="body">volume</label> <md-slider aria-label="volume" ng-model="volume" min="0" max="100"> </md-slider> </div>

android - How to ask for permissions in MiUi pre - Marshmallow? -

int permissioncheck = contextcompat.checkselfpermission(mactivity, manifest.permission.receive_sms); activitycompat.requestpermissions(this, new string[]{manifest.permission.read_contacts}, permission_request_code); log.d(tag, permissioncheck + ""); the permission check returns permission_granted in os (miui) app doesn't have permissions. test device : redmi note 3 pro (miui 8) for permissions i'm using such approach: private boolean permissionsactivated = (build.version.sdk_int < build.version_codes.m); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //.... requirepermissionsifneeded(); //.... } @suppresslint("newapi") private void requirepermissionsifneeded() { // todo auto-generated method stub if (build.version.sdk_int >= build.version_codes.m) { if (!canall()) {

python - How to impute each categorical column in numpy array -

there solutions impute panda dataframe. since working numpy arrays, have create new panda dataframe object, impute , convert numpy array follows: nomdf=pd.dataframe(x_nominal) #convert np.array pd.dataframe nomdf=nomdf.apply(lambda x:x.fillna(x.value_counts().index[0])) #replace nan frequent in each column x_nominal=nomdf.values #convert pd.dataframe np.array is there way directly impute in numpy array? we use scipy's mode highest value in each column. leftover work nan indices , replace in input array mode values indexing. so, implementation - from scipy.stats import mode r,c = np.where(np.isnan(x_nominal)) vals = mode(x_nominal,axis=0)[0].ravel() x_nominal[r,c] = vals[c] please note pandas , value_counts , choosing highest value in case of many categories/elements same highest count. i.e. in tie situations. scipy's mode , lowest 1 such tie cases. if dealing such mixed dtype of strings , nans , suggest few modifications, keeping last step unchange

algorithm - Expression Trees C# for calculating logic equivalence -

recently have programmed recursion function constructing expression tree since expression ((a|b)^c). not problem, problem when time evaluate it, since final tree expression given in next form: ^ / \ | c / \ b and problem raised when time evaluate applying corresponding logic equivalence(in case, distributive law). tried using algorithm evaluating tree if arithmetic expression tree: evaluate(node) { if(node has children){ left_val = evaluate(node->left); right_val = evaluate(node->right); // find operation symbol node , use // val = left_val operation right_val return val; } else { return node_value; } } but didn't succeed @ all, because couldn't values joined in distributive law's form. result, i'd decided better

php - My SilverStripe module overrides other modules display -

i'm writing subscribe module plugin silverstripe blog module. far have yml as: --- name: subscription after: 'framework/*','cms/*' --- blog: extensions: - subscription page_controller: extensions: - subscriptionwidget and subscriptionwidget.php: <?php class subscriptionwidget extends dataextension { public function subscriptionwidget() { $controller = subscriptionwidget_controller::create(); $form = $controller->subscriptionwidget(); return $form; } } class subscriptionwidget_controller extends controller { private static $allowed_actions = array('subscriptionwidget'); public function subscriptionwidget () { $form = form::create( $this, __function__, fieldlist::create( textfield::create('email', 'email'), textfield::create('name', 'name') ), fieldlist::creat

php - mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables -

i developing class mysql query main purpose run query (select, insert, update) if it's select should return result data, , if it's updata or insert should return number of rows affected. but following code throws error error in line if($stmt->bind_param($types, $escaped)) <?php class sqli{ public $mysqli; public function __construct($host, $username, $password, $dbname){ $this->mysqli = new mysqli($host, $username, $password, $dbname); if($this->mysqli->connect_errno){ echo $this->mysqli->connect_error; die("could not connect mysql database"); } } public function query($qry,$types,$array){ if(!empty($qry)){ if($stmt = $this->mysqli->prepare($qry)){ if(count($array)>0 &&!empty($array)){ $escaped = array(); foreach($array $value){ $value= $this

How to use resources and files in C# -

i have program consists of images. want put images in folder , show content of folder dynamically. program should portable. should do? tried following code did not work: string path = "resources/location.txt"; string path2 = "/iconimagesfordummies/icon"; observablecollection<iconimagesfordummies> icons = new observablecollection<iconimagesfordummies>(); string[] lines = null; if (file.exists(path)) lines = file.readalllines(path, encoding.unicode); if (lines != null) { (int = 0; < lines.length; ++i) { string str = path2 + @"/" + lines[i]; if (file.exists(str)) icons.add(new iconimagesfordummies() { name = str }); } } else throw new exception("the location.txt stores location of icons missing"); if (icons.count == 0) throw new exception("there no icon image"); location.txt contains name of images. problem program not find location.txt. have inserted location.txt in resou

python - pelican make serve error with broken pipe? -

i trying make blog pelican, , in step of make serve had below errors. searching online looks web issue ( i'm not familiar these @ ) , didn't see clear solution. shed light on? running on ubuntu python 2.7. thanks! python info: python 2.7.6 (default, jun 22 2015, 17:58:13) [gcc 4.8.2] on linux2 error info: 127.0.0.1 - - [13/sep/2016 13:23:35] "get / http/1.1" 200 - warning:root:unable find / file. warning:root:unable find /.html file. 127.0.0.1 - - [13/sep/2016 13:24:31] "get / http/1.1" 200 - ---------------------------------------- exception happened during processing of request ('127.0.0.1', 51036) traceback (most recent call last): file "/usr/lib/python2.7/socketserver.py", line 295, in _handle_request_noblock self.process_request(request, client_address) file "/usr/lib/python2.7/socketserver.py", line 321, in process_request self.finish_request(request, client_address) file "/u

html - Placing a png image in a table -

Image
hi know simple question. unable it. want place images in table. working fine in new html file. when trying insert table in project file, images getting overlapped.they not fitting in table. mistake doing? kindly @ image attached. table,td,th {border: 3px solid black;padding: 15px} <table> <tr><th>choose icons</th></tr> <tr><td ><img src='http://www.freeiconspng.com/uploads/smiley-icon-1.png' width='20%'/></td></tr> <tr><td ><img src='http://www.freeiconspng.com/uploads/smiley-icon-1.png'width=20%/></td></tr> </table> try: table, td, th { border: 3px solid black; padding: 15px } img.icon { width: 20%; height: auto; } <table> <tr> <th>choose icons</th> </tr> <tr> <td> <img src='heart1.png' class="icon"

command line - CMake fails to generate Makefiles with Sun Studio 12.5 -

i'm working on solaris 11.3 sun studio 12.5. when attempt configure cmake out-of-tree, cmake finishes configuration errors , not produce makefiles. in-tree may broken, too. our procedures build out-of-tree, that;' do. i have no cmake experience. others contributed the cmake files, , struggle tasks related them. i'm not sure if doing wrong, if our cmake files broken, or if cmake not tested under solaris. what going on cmake, , how fix it? here links cmake files. can copy/paste them, takes bunch of space. files hosted on github should available. cmakefilelist.txt cryptopp-config.cmake here solaris' cmake version, prior me installing 3.6.2: $ cmake --version cmake version 2.8.6 below solaris cmake version 2.8.6. cryptopp-build$ export cxx=/opt/developerstudio12.5/bin/cc cryptopp-build$ export cxxflags="-dndebug -g2 -o2 -d__sse2__ -d__sse3__ -d__ssse3__ -d__sse4_1__ -d__sse4_2__ -d__aes__ -d__pclmul__ -d__rdrnd__ -d__rdseed__ -d__avx__ -d__av

magento 1.9 - Edit tax percent on edit order page -

Image
how can edit tax percent on edit order page admin panel->sales->orders->view->orderview->edit order as can see in screenshot i've made tax percent field editable want when admin clicks 'update items , qty`s' button tax percent (which made editable) updated ref. order , grand total of order calculated updated tax percent. will appreciate suggestion achieve that. thanks.

php - How to delete settings in Wordpress on plugin uninstall? -

i'm developing first wordpress plugin , register plugin settings on admin_init hook: register_setting( 'option_group', 'option_name', 'sanitize_callback' ); it works, great. on deactivating (register_deactivation_hook) set: unregister_setting( 'option_group', 'option_name' ); it works. how delete settings on plugin uninstall? when put delete_option( 'option_name' ); in uninstall.php can't delete plugin plugins page (wp shows "deletion failed: sure want this? please try again." notification). why? fixed. 1 of security checks used interfere delete_option: check_admin_referer

angular - How do I import from a `.d.ts` file? -

this line works in project uses angular2 rc4 import * maptypes '../../../../node_modules/angular2-google-maps/core/services/google-maps-types.d.ts'; what's happening? now trying new seed file rc6 , same line gives me error error ts2691: import path cannot end '.d.ts' extension. consider importing '../../../../node_modules/angular2-google-maps/core/services/google-maps-types' instead. but if make suggested change, cannot find module '../../../../node_modules/angular2-google-maps/core/services/google-maps-types' the .d.ts file looks this: /** * angular2-google-maps - angular 2 components google maps * @version v0.12.0 * @link https://github.com/sebastianm/angular2-google-maps#readme * @license mit */ export declare var google: any; export interface googlemap { constructor(el: htmlelement, opts?: mapoptions): void; panto(latlng: latlng | latlngliteral): void; setzoom(zoom: number): void; addlistener(eventname: s

Android FileProvider Causing Camera/Gallery to Crash at Random -

goodday. using gotten developers guide, able app's photo capture working. activity involves capturing 1 or more images(something in photogrid camera collage app). works of time, , on devices, except on own device(android 5.0.1). issue is, camera/gallery app crashes, giving me security permission denial error in stack trace, , i've searched solutions , implemented them, no avail. crash random, more occur when: 1. i'm taking second photo 2. camera settings on highest resolution :13mp (hardly ever happens on lower resolutions) it occurs in other cases though, occurrence drives me crazy. here's code: fragment private void dispatchtakepictureintent(boolean isquestionimage) { intent takepictureintent = new intent(android.provider.mediastore.action_image_capture); if (takepictureintent.resolveactivity(getactivity().getpackagemanager()) != null) { file photofile = null; try { photofi

ios - Callback Method if user declines Push Notification Prompt? -

my problem want show loading screen initial push notification prompt "the app wants send push notifications." so if user hits yes can proceed , start app in invoked delegate methods: - (void)application:(uiapplication*)application didregisterforremotenotificationswithdevicetoken:(nsdata*)devicetoken { [self hideloadingscreen]; } - (void)application:(uiapplication*)application didfailtoregisterforremotenotificationswitherror:(nserror*)error { [self hideloadingscreen]; } however if user hits no , none of these methods called, makes sense. question is, there different delegate method gets fired if declines? my problem if no selected, loading screens never disappear. somehow need know when user done selection. in ios 7, when system's push notification prompt appears, app becomes inactive , uiapplicationwillresignactivenotification fires. when user responds prompt (pressing either yes or no), app becomes active again , uiapplicationdidbecomeactiven

javascript - How to check if all select boxes has selected option using jquery? -

i have 7 simple select boxes: <select> <option selected disabled>choose something</option> <option>some text</option> <option>some more text</option> <option>and more , more</option> </select> <select> <option selected disabled>choose something</option> <option>some text</option> <option>some more text</option> <option>and more , more</option> </select> <select> <option selected disabled>choose something</option> <option>some text</option> <option>some more text</option> <option>and more , more</option> </select> <select> <option selected disabled>choose something</option> <option>some text</option> <option>some more text</option> <option>and more , more</option> </select> how can check if select boxes have

opengl - SCNProgram - video input -

how can attach video input scnprogram in scenekit? without using custom program, do: func set(video player: avplayer, on node: scnnode) { let size = player.currentitem!.asset.tracks( withmediatype: avmediatypevideo).first!.naturalsize let videonode = skvideonode(avplayer: player) videonode.position = cgpoint(x: size.width/2, y: size.height/2) videonode.size = size let canvasscene = skscene() canvasscene.size = size canvasscene.addchild(videonode) let material = scnmaterial() material.diffuse.contents = canvasscene node.geometry?.materials = [material] } which renders video skscene , uses input scnmaterial . i'd use scnprogram on node, not figure out attach player input. don't mind if solution doesn't uses skscene intermediate rendering. sounds better if it's possible without. have tried using avplayerlayer , subclass of calayer ? can feed calayer contents property of scnmaterialproperty .

ios - DTDeviceKit: Could not start house arrest service for app identifier XXX -

i'm using xcode 7.3.1 , executing xctest via command-line on device, "iphone 1", iphone 6 running ios 9.3.5: xcodebuild \ -scheme todo \ -project todo.xcodeproj \ -destination "platform=ios,name=iphone 1"\ clean build test the build succeeded, failed after compiling test files: 2016-09-13 14:51:32.604 xcodebuild[79689:2064116] dtdevicekit: not start house arrest service app identifier com.example.todo [error domain=com.apple.dtdevicekit code=-402653093 "too many instances of service running." userinfo={nslocalizedfailurereason=too many instances of service running., com.apple.dtdevicekit.stacktrace=( 0 dtdevicekitbase 0x000000010fead3cb dtdkcreatenserror + 113 1 dtdevicekitbase 0x000000010feadb09 dtdk_amderrortonserror + 791 2 dtdevicekitbase 0x000000010febf2f5 __70-[dtdkremotedeviceconnection starthousearrestserviceforappidentifier:]_block_invoke + 100 3

xcode - Autolayot aspect ratio iOS -

Image
i can not set perfect autolayout login , facebook login button below forgot password. disappear screen after setting autolayout. here have attached project link. i want expand object proportionally same using autoresizeing i have suffering problem expand objects aspect ratio. 2 simple view login https://drive.google.com/file/d/0b5mabdphydhzdlljyzy0czvrbfk/view?usp=sharing try constraint type: first screen: second screen: your storyboard file: https://drive.google.com/open?id=0b_hnpywgmhtvtkjqqzd0qwlnzvu

sql server - Count distinct by multiple columns takes a long time -

i'm trying perform count distinct in sql server, 2 fields. i've tried 2 different ways. the first 1 concatenation: select count (distinct concat ([ucid],[callsegment])) ivr_lines ucid in (select ucid [epmtest].[dbo].[ivr_lines] module = 'hozlap' , event_name = 'a3' , event_value in ('1','2','3') , date> 20160911) , event_name = 'a6' or event_name = 'a7' while the second 1 using sub-query: select count(*) from( select distinct ucid,callsegment ivr_lines ucid in (select ucid [epmtest].[dbo].[ivr_lines] module = 'hozlap' , event_name = 'a3' , event_value in ('1','2','3') , date> 20160911) , event_name = 'a6' or event_name = 'a7' )a they take same running time (more 10 seconds, due inner query itself). however, know - 1 more efficient? method should choose? thanks i think wrong queries first date > 20160911 should give error, try

php - How should I make changes to a live Magento site with 4000+ products -

i want make changes magento website without going down or having problems. changes include database changes , file changes. what best way this? my current solution is: move whole website directory , make changes while write changes step step solve problems , make sure good, then; make changes step step production site, faster can me better solution? if you're making change database, should write setup scripts run queries you. benefits are: they're versioned - separate scripts modules , order should run in. you commit them version control system - minimal chance of running accident, or making typo when run them. the server runs them @ once when needs to/when tell - speed. this has obvious benefits on suggested approach of doing manually. if "as possible" never beat server running series of commands you've told do. you can "dry run" deployment staging or development environment before go live, , can measure how long se