Posts

Showing posts from August, 2012

android.accounts.AuthenticatorException: bind failure -

i getting following exception; know not go on, there seems little no working documentation out there. suffice say, have tried examples on implementing own authenticator. i have found proposed answer here fix manifest-file (declaring service). had done that, problem persisting. my initial solution based on this example: write-your-own-android-authenticator w/system.err﹕ android.accounts.authenticatorexception: bind failure w/system.err﹕ @ android.accounts.accountmanager.converterrortoexception(accountmanager.java:2024) w/system.err﹕ @ android.accounts.accountmanager.access$400(accountmanager.java:144) w/system.err﹕ @ android.accounts.accountmanager$amstask$response.onerror(accountmanager.java:1867) w/system.err﹕ @ android.accounts.iaccountmanagerresponse$stub.ontransact(iaccountmanagerresponse.java:69) w/system.err﹕ @ android.os.binder.exectransact(binder.java:446) bro , had same situation. searched everywhere no luck. there few resources , tutorials android aut

c# - Determine Azure Web Role's instance IP address -

the ip address looking not vip, nor private ip address given role instance, public ip address can assign each instance using configuration: <networkconfiguration> <addressassignments> <instanceaddress rolename="webrole1"> <publicips> <publicip name="public" /> </publicips> </instanceaddress> </addressassignments> </networkconfiguration> using powershell cmdlets, 1 able find ip address given each instance this: ps c:\> get-azureservice -servicename "rr-testservice" | get-azurerole -instancedetails which output results, this: instanceerrorcode : instancefaultdomain : 0 instancename : webrole1_in_0 instancesize : small instancestatedetails : instancestatus : readyrole instanceupgradedomain : 0 rolename : webrole1 deploymentid

ios - How to change values of variables when navigating from one view controller to another? -

in project have main page,with 4 buttons. first 3 define game level user wants play: button 1-level 1 button 2-level 2 button 3-level 3 button 4 - start game when 1 of them clicked int value saved in order know level user wants play. when clicking forth button depending on int value given user goes appropriate game level page. when gets page can hit button anytime go main view controller. issue when goes back,how return button's values default value? (that no button/level chosen). you can use viewwillappear method reset button states default. viewwillappear method called every time when viewcontroller going visible, best place house keeping stuff.

.net - ICommand - Who invoke the Execute? -

as per topic, invokes execute? in code, bind command button click. (for reason, not allow me put xaml codes here...) i'm curious how/what goes behind triggers execute(). stack, seems calling: 1. button.onclick 2. primitives.buttonbase.onclick 3. commands.commandhelpers.criticalexecutecommandsource 4. actioncommand.execute even after looking @ trace, still don't quite it. can explain me?

generics - What does this syntax mean (<T=Self>) and when to use it? -

i see things <t=self> or t=() in generic structs/traits. suspect has default types generic type t . couldn't find documentation though. my questions are: what mean? what variations possible (maybe crazy <t=self: 'static >)? when useful (examples)? this syntax can used in 2 situations: default type parameters, , associated types. see difference , le use, lets have @ add trait, used define + operator: pub trait add<rhs = self> { type output; fn add(self, rhs: rhs) -> self::output; } default type parameters here, type parameter rhs has default value: self . means that, whenever use trait, value of type parameter default self if omit it. example: impl add foo { /* ... */ } is same as impl add<foo> foo { /* ... */ } likewise, fn foo<t>(t: t) t: add { /* ... */ } is same fn foo<t>(t: t) t: add<t> { /* ... */ } associated types the trait add has associated type : output . type chos

vb.net - Access a dynamically created textbox text from another sub. And I also want to be user-configurable and access the user-configured text -

textbox.text want access. , want user-configurable before want access altered text. dim qbox new textbox qbox.size = new size(20, 20) qbox.location = new point(90, 10) qbox.parent = addtocart qbox.name = "quarts" qbox.text = "ss"** how dynamically add inside series of other dynamic controls: tile.controls.add(addtocart) flpp.controls.add(tile) tile.controls.add(plabel) tile.controls.add(nlabel) addtocart.controls.add(qbox) how tried access it: qb.text = ctype(me.controls("flpp").controls("tile").controls("addtocart").controls("qbox"), textbox).text i generated textbox @ runtime. of course it's dynamic. i'm new vb , i'm experimenting school project. wanted textbox text configurable , access configured value. i've been brain-cracking days this. when run thing, "getobject reference not set instance of object." und

javascript - AngularJS won't update view but $scope does -

i'm using ionic framework build app. have item list (productos.html) . each of them <a> tag href detail (producto.html) . can sell product there registrarventa method. callback calls listarproductos method, retrieve updated products list (the sold product not there). method transitions app.productos state, have show $scope.productos list. $scope.productos updated, ng-repeat productos not! cant use $scope.$apply() function. ideas? ps: excuse me english, native languge app.js angular.module('starter', ['ionic', 'ngcordova', 'starter.controllers', 'starter.services', 'starter.filters', 'starter.factories']) .run(function($ionicplatform) { $ionicplatform.ready(function() { // hide accessory bar default (remove show accessory bar above keyboard // form inputs) if (window.cordova && window.cordova.plugins.keyboard) { cordova.plugins.keyboard.hidekeyboarda

java - spring injection without constructor and setter -

i have question. if class has dependency like: public class test { public depend depend; //here methods } and does not have setter depend property or constructor depend argument, , has no annotation spring has xml config like: <bean id="depend" class="xxx.depend"></bean> <bean id="test" class="xxx.test"> <property name="depend" ref="depend" /> </bean> is possible inject depend test using such config (actually config not work. wonder - can change smth make work not using annotations or setter/constructor)? it not possible without using annotations. your current configuration needs simple changes make work. annotate depend field @autowired , enable component scanning. here's detailed explanation: http://www.mkyong.com/spring/spring-auto-scanning-components/

mysql - How to select only last entries based on a especific column value keeping the current table order -

i have table keeps track of last changes applied students in student catalog. want return data table every minute can sincronize necessary entries java app. it happens need last event_type entry per id. i've created small art graphically explain want site doesnt let me post because of reputation being low yet. i'll try post link though: what have +---------------------+------------+------------+ +---------------------+------------+------------+ | event_time | event_type | student_id | | event_time | event_type | student_id | +---------------------+------------+------------+ +---------------------+------------+------------+ | 2015-08-16 11:42:08 | 1 | 37 | | 2015-08-16 11:44:30 | 1 | 37 | | 2015-08-16 11:42:29 | 1 | 37 | | 2015-08-16 11:45:47 | 2 | 37 | | 2015-08-16 11:43:51 | 2 | 37 | | 2015-08-16 12:21:40 | 1 |

ruby on rails - Link method argument to a variable -

i have program user able receive popular "vacation spots". al have enter continent (which bring them dictionary) , enter country/state (which key in hash) , find corresponding value. i have required file (dict.rb) hash module using arrays. but issue have small. assigned user input 2 variables, continent_select , country_select here's code: require './dict.rb' #create new dictionary called northamerica northamerica = dict.new dict.set(northamerica, "new york", "new york city") dict.set(northamerica, "new jersey", "belmar") puts "welcome vacation hub" puts "what continent interested in?" print '> ' continent_select = $stdin.gets.chomp.downcase continent_select.gsub!(/\a"|"\z/, '') puts "which state go in #{continent_select}" print '> ' country_select = $stdin.gets.chomp.downcase #puts "you should go #{dict.get(northamerica, "#{c

php - Implementing captcha to my dynamically generated forms -

i have functions generate articles on page + comments associated them: function comment_form($id) { // generates comment box form every article on page global $user_data; if (logged_in() === true) { echo " <form method='post' action='' class='comments_form'> <input type='text' name='username' placeholder='your name... *' id='name' value='{$user_data['username']}'> <div class='captcha'>" . create_captcha() . "</div> <textarea name='comments' id='textarea' placeholder='your comment... *' cols='30' rows='6'></textarea> <input type='hidden' name='blog_id' value='$id'> <input type='submit' name='submit' id='post' value='post'> </form> <hr c

java - How do I set up IntelliJ IDEA to redeploy changed resources? -

i use intellij idea , want class should redeployed after make changes. eclipse can this. how work in idea? i know in run configuration there "on frame deactivation" , set "update classes , resources", not work. do hit "redeploy" button every time made change in class? there limitations class reload, in java project. depends on you're using perform reload (if you're using servlet container, etc). by default, intellij uses hotswap reloading. there limitations though: at moment due original limitations of java sdk hotswapping possible if method body altered. in other cases (like changing method or class signature), class reload impossible , corresponding error message appears. that said, instructions configuring application reload can found here . to configure reloading behavior on main menu, choose file | settings , , expand debugger node. open hotswap page. click 1 of radio buttons in group reload cla

Concatenate pairs of consecutive sublists in a list using Python -

how combine sublists within list pairs? example with: list1 = [[1,2,3],[4,5],[6],[7,8],[9,10]] the result be: [[1,2,3,4,5],[6,7,8],[9,10]] you use zip_longest fill value (in case list has odd number of sublists) zip iterator on list1 . running list comprehension on zip generator object allows concatenate consecutive pairs of lists: >>> itertools import zip_longest # izip_longest in python 2.x >>> x = iter(list1) >>> [a+b a, b in zip_longest(x, x, fillvalue=[])] [[1, 2, 3, 4, 5], [6, 7, 8], [9, 10]]

email - magento new order send mail not work -

magento can send new user mail confirmation, newsletter subscription, invoice , shipment success can't send new order mail , send order email customer in admin panel. in database core_email_queue full of not sent emails also did: sudo crontab -u www-data -e and add: * * * * * /bin/sh /home/salar/public_html/cron.sh this aoe scheduler: http://i.stack.imgur.com/oiycw.png as of magento 1.9, emails queued , sent via cron job. if haven't set up, can manually run pointing browser file, e.g. http://www.yoursite/cron.php . after run this, should receive emails the extension aoe_scheduler can in confirming magento cronjob has been configured correctly , running.

sql - Error 1064 on Mysql trigger -

i'm writing trigger in mysql take log of table updates. log table called individuo_storico , target table called individuo. when individuo updated, want check if idqualifica , idlivello changed, if yes record in individuo_storico inserted. i write down code #1064 error, where's syntax error? use ore; create trigger individuo_update after update on individuo each row begin if ( new.idlivello <> old.idlivello or new.idqualifica <> old.idqualifica) insert individuo_storico(idindividuo, idqualifica, idlivello) values (new.idindividuo, new.idqualifica, new.idlivello); end if; end; 1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 6 please wrap trigger creation monikers necessary db engine not choke on it. 3 areas: 1) line 1 2) right after end; 3) , reset default delimiter. same concept typical stored proc creations. delimiter $$ create trigger indi

java - Why am I getting this error "Expected resource of type raw" in Android Studio? -

Image
i trying set default wallpaper using button reason when set inputstream in oncreate method, error "expected resource of type raw". referencing drawable folder , using icon.png image in drawable folder. following tutorials in newboston series , seems work fine travis reason mine doesnt work in android studio. error? thanks camera.java: package com.example.user.cameraapplication; import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.os.bundle; import android.provider.mediastore; import android.view.view; import android.widget.button; import android.widget.imagebutton; import android.widget.imageview; import android.widget.switch; import java.io.ioexception; import java.io.inputstream; /** * created user on 16-08-2015. */ public class camera extends activity implements view.onclicklistener{ imageview iv; button b1,b2; imagebutton img; intent i; final stat

c++ - Calculating position in view space from depth buffer texture in DirectX 11/HLSL -

Image
i want reconstruct position in view space depth buffer texture. i've managed set depth buffer shader resource view shader , believe there's no problem it. i used formula calculate pixel position in view space each pixel on screen: texture2d textures[4]; //color, normal (in view space), depth buffer (as texture), random samplerstate objsamplerstate; cbuffer cbperobject : register(b0) { float4 notimportant; float4 notimportant2; float2 notimportant3; float4x4 projectioninverted; }; float3 getposition(float2 texturecoordinates) { //textures[2] stores depth buffer float depth = textures[2].sample(objsamplerstate, texturecoordinates).r; float3 screenpos = float3(texturecoordinates.xy* float2(2, -2) - float2(1, -1), 1 - depth); float4 wpos = mul(float4(screenpos, 1.0f), projectioninverted); wpos.xyz /= wpos.w; return wpos.xyz; } , gives me wrong result: i calculate inverted projection matrix way on cpu , pass pixel shader: con

javascript - How to set a timeout for Firefox OS TCP Sockets -

Image
i working on firefox-os app tries connect list of ip's in sequence through tcp socket api . however, close socket if doesn't connect within few seconds, , if connection inactive more few seconds. example: var socket = navigator.moztcpsocket.open(ip, port); //would set timeout connection here socket.onopen = function(event){ var servicerequest = new object(); servicerequest.type = "myservice"; var sendstr = json.stringify(servicerequest); sendstr+="\n"; sendstr = sendstr.tostring('utf-8'); socket.send(sendstr); //and timeout receiving data here socket.ondata = function(event){ //etc } } there no way specify timeout far know. if want specify timeout, should use usual javascript settimeout , store id. use onopen event on tcpsocket object cancel timeout. if timeout triggered. can call close method on socket. var socket = navigator.moztcpsocket.open(ip, port); var timeout = settimeout

Css doesn't load at all in Ionic App -

this index.html <link href="../../myapp/www/lib/ionic/css/style.css" rel="stylesheet"> and css: body{ background: darkcyan; } and here's in console : failed load resource: server responded status of 404 (not found) what missing ?

How to use Array in Ruby? -

Image
i newbie in ruby. trying write simple interactive game in ruby stuck. need proceed. below concept: money = [100, 200, 300, 400] beneficiaries = ["john", "sam", "mary"] cost1 = [50, 25, 30, 75, 18] cost2 = [120, 150, 200, 250] gift1 = [" crayon ", " pencil ", " biro "] gift2 = [" bag ", " shoe ", " radio "] cashowned = [50] = money.sample b = cost1.sample c = cost2.sample d = gift1.sample e = gift2.sample f = cashowned puts " hi, name? " puts name = gets.chomp puts puts " #{name} nice name." puts puts "#{name} have #{f} in bank account." puts puts "roll dice , let's see how earned." puts gets.chomp.to_i dice1 = puts "#{name} earned: #{dice1}" puts gets.chomp.to_i cashowned = dice1 + f puts "your account balance : #{cas

javascript - What is wrong with my ajax call to php file in data section? -

so able php value javascript variable don't think script.js finding it. there of course alot of files missing sake of keeping question clean problem script.js schoolid undefined instead of actual value when console.log schoolid value of "1"(first page has id 1 works). header.php : <?php //gets current page id $schoolofficialid = $specificschool[0]["id"]; ?> <head> <script type="text/javascript" src="js/script.js"></script> </head> <body> <input type="hidden" id='schoolofficialid' value="<?php echo $schoolofficialid;?>"/> <script type="text/javascript"> var schoolid = $('#schoolofficialid').val(); </script> </body> script.js: ajax call here note: in ajax know data having trouble finding schoolid header.php send php file. // execute ajax query push id of page load_more.php $.ajax({

c++ - 'Undefined reference' in Atmel Studio 6.2 -

it's first atmel studio project. i've set ide , made work example code provided new project. now i'm trying run simple code using pcf8574: #include <arduino.h> #include <wire.h> #include <pcf8574.h> /* constants */ const int static serial_speed = 57600; /* functions */ void setup(); void loop(); /* variables */ pcf8574 expander = pcf8574(); void setup() { serial.begin(57600); expander.begin(0x20); } void loop() { expander.digitalwrite(1, high); delay(1000); expander.digitalwrite(1, low); delay(1000); } but keep getting these errors: undefined reference 'pcf8574::begin(unsigned char)' undefined reference 'pcf8574::digitalwrite(unsigned char, unsigned char)' undefined reference 'pcf8574::pcf8574()' i've added pcf8574 compiler directory (properties > toolchain > avr c++ compiler > directories) , i'm sure compiler 'sees' .h file - otherwise throw 'no such file or

mapreduce - Nutch on Hadoop | Input path does not exist: -

i getting error input path not exist when run command nutch inject crawldb urls in nutch/logs got error in hadoop.log 2015-08-16 16:08:12,834 info crawl.injector - injector: starting @ 2015-08-16 16:08:12 2015-08-16 16:08:12,834 info crawl.injector - injector: crawldb: crawldb 2015-08-16 16:08:12,835 info crawl.injector - injector: urldir: urls 2015-08-16 16:08:12,835 info crawl.injector - injector: converting injected urls crawl db entries. 2015-08-16 16:08:13,296 warn util.nativecodeloader - unable load native-hadoop library platform... using builtin-java classes applicable 2015-08-16 16:08:13,417 warn snappy.loadsnappy - snappy native library not loaded 2015-08-16 16:08:13,430 error security.usergroupinformation - priviledgedactionexception as:hdravi cause:org.apache.hadoop.mapred.invalidinputexception: input path not exist: file:/home/hdravi/urls 2015-08-16 16:08:13,432 error crawl.injector - injector: org.apache.hadoop.mapred.invalidinputexception: input path not e

function - How do you return non-copyable types? -

i trying understand how return non-primitives (i.e. types not implement copy ). if return i32 , function creates new value in memory copy of return value, can used outside scope of function. if return type doesn't implement copy , not this, , ownership errors. i have tried using box create values on heap caller can take ownership of return value, doesn't seem work either. perhaps approaching in wrong manner using same coding style use in c# or other languages, functions return values, rather passing in object reference parameter , mutating it, can indicate ownership in rust. the following code examples fails compilation. believe issue within iterator closure, have included entire function in case not seeing something. pub fn get_files(path: &path) -> vec<&path> { let contents = fs::walk_dir(path); match contents { ok(c) => c.filter_map(|i| { match { ok(d) => { let val = d.pa

Javascript - create array between two date objects -

question i attempting build array between 2 js objects. appears objects being created correctly, , in fact code below running. the unexpected behavior every object in output array transforming match last date looped through. i.e. if loop, whatever todate_dateobj is, entire array of value. i have debugging wrt actual start/end dates being correct, can handle -- i'm stymied behavior described above. i new javascript. imagine issue mutation? guidance appreciated. i left console logs in because why take them out? code function build_dateobjs_array(fromdate_dateobj, todate_dateobj) { // return array of dateojects fromdate todate var current_date = fromdate_dateobj; var return_array = [] while (current_date <= todate_dateobj) { return_array[return_array.length] = current_date; // have read faster arr.push() var tomorrow = new date(current_date.gettime() + 86400000); console.log('tomorrow: ', tomorrow); current

security - How to use SSE-S3 on Amazon S3? -

Image
i want enable sse-s3 on amazon s3. click properties , check encryption box aes-256. says encrypting, done. can still read files without providing key, , when check properties again, shows radio buttons unchecked. did correctly? encrypted? confusing. you're looking @ view of bucket in s3 console shows more 1 file, or shows 1 file file isn't selected. radio buttons allow set items select values select in radio buttons, radio buttons remain blank whenever multiple files shown, because they're there let make change -- not show values of existing object. click on individual file , view properties , you'll see file stored server-side-encryption = aes256. yes, can download file without needing decrypt it, because feature server-side encryption of data @ rest -- files encrypted s3 prior storage on physical media s3 runs on. done compliance purposes, regulatory restrictions or other contractual obligations require data encrypted at rest . the encryption

lexical scope - passing model parameters to R's predict() function robustly -

i trying use r fit linear model , make predictions. model includes constant side parameters not in data frame. here's simplified version of i'm doing: dat <- data.frame(x=1:5,y=3*(1:5)) b <- 1 mdl <- lm(y~i(b*x),data=dat) unfortunately model object suffers dangerous scoping issue: lm() not save b part of mdl , when predict() called, has reach environment b defined. thus, if subsequent code changes value of b , predict value change too: y1 <- predict(mdl,newdata=data.frame(x=3)) # y1 == 9 b <- 5 y2 <- predict(mdl,newdata=data.frame(x=3)) # y2 == 45 how can force predict() use original b value instead of changed one? alternatively, there way control predict() looks variable, can ensure gets desired value? in practice cannot include b part of newdata data frame, because in application, b vector of parameters not have same size data frame of new observations. please note have simplified relative actual use case, need robust general solution

Summary shown in R is short, many terms shown as "Other" -

how can display complete output summary, without classifying values "other"? summary(d) date.of.sale city department product 1/18/2015 : 149 a:5290 footwear mens : 538 13245 : 255 1/25/2015 : 149 b:2078 home furnishing:1937 15350 : 255 11/23/2014: 149 c:5088 infant w-wear : 992 15352 : 255 11/30/2014: 149 ladies lower :1735 15353 : 255 12/14/2014: 149 ladies upper :1805 15355 : 255 12/21/2014: 149 mens lower :2039 15356 : 255 (other) :11562 mens upper :3410 (other):10926 sale predicted.sale flag 0 :3963 0 :3279 forecast: 1341 not available:1341 1 :1951 history :11115 1 :1145 2 : 946 2 : 797 3 : 700 3 : 557 4 : 572 4 : 498 5

Ruby - Parse txt file to json -

how should parse txt file below format read json in ruby? thank you. {"sales": "52,000,000", "id": 12, "comp_name": "friedfood"} {"sales": "51,000,000", "id": 1, "comp_name": "copley"} {"sales": "54,000,000", "id": 2, "comp_name": "tony's"} {"sales": "52,000,789", "id": 3, "comp_name": "j&j"} parse each line json object, this: require 'json' items = file.open('tmp.json', 'r').each_line.map { |l| json.parse(l) } puts items.to_s edit: modified use map, based on comment below.

events - Javascript directly call modal? -

with below code can pop modal when click logo. how same thing instead call directly within event listener? <div class="logo-brand header sidebar rows"> <div class="logo"> <h1><a href="#fakelink" class="md-trigger" data-modal="logout-modal"><img src="assets/img/logo.png" alt="logo"> sample name</a></h1> </div> </div> i want call within listener: var marker = new google.maps.marker({ position: location, map: map, }); marker.addlistener('click', function() { // want dialog show here... }); thanks!

ios - Cropping image with Swift and put it on center position -

in swift programming , how crop image , put on center afterwards? this i've got far ... i've crop image want put on center after imgview.image = origimage var masklayer = cashapelayer() masklayer.frame = imgview.frame masklayer.path = path.cgpath masklayer.fillcolor = uicolor.whitecolor().cgcolor masklayer.backgroundcolor = uicolor.clearcolor().cgcolor imgview.layer.mask = masklayer uigraphicsbeginimagecontext(imgview.bounds.size); imgview.layer.renderincontext(uigraphicsgetcurrentcontext()) var image = uigraphicsgetimagefromcurrentimagecontext() imgview.image = image uigraphicsendimagecontext(); update : let rect: cgrect = cgrectmake(path.bounds.minx, path.bounds.miny, path.bounds.width, path.bounds.height) // create bitmap image context using rect let imageref: cgimageref = cgimagecreatewithimageinrect(image.cgimage, rect) imgview.bounds = rect imgview.image = uiimage(cgimage: imager

string - C++ editing text file using ofstream -

i trying manipulate text of text file (without using vectors): (this assignment engineering paper, , i'm not allowed use vectors) variable numrows can integer (i chose 3 example) , square matrix of elements in output text file 'example.txt' here code: #include <iostream> #include <fstream> using namespace std; int main () { int numrows = 3; ofstream myfile ("example.txt"); if (myfile.is_open()) { (int = 0; < numrows; i++) { (int j = 0; j < numrows; j++) { myfile << "test\t"; } myfile << "\n"; } myfile.close(); } else cout << "unable open file"; return 0; } the text file follows: test test test test test test test test test my question is, once i've done of - how open again , edit it? eg. wanted edit row 2, column 2 "hello": test test test test hello test test test te

Python Error - TypeError: input expected at most 1 arguments, got 3 -

can explain why can not use your_name in goal variable? my_name = "bryson" my_age = 29 your_name = input ("what name? ") your_age = input ("what age? ") print ("my name is", my_name,", , am", my_age, "years old.") print ("your name is", your_name,", , are", your_age,".") print("thank buying book,", your_name,"!") goal = input ("what favorite part of book,", your_name, "?") print("awesome!") the error is: goal = input ("what favorite part of book,", your_name, "?") typeerror: input expected @ 1 arguments, got 3 you got error because in fact gave 3 arguments input function when expecting 1 (namely, string prompt). in input ("what favorite part of book,", your_name, "?") ---------------------------------------- , ---------, --- the underlined parts comma-separated arguments: st

html - Set element onclick from JavaScript string -

i have code generates html this: function foo(onclick:string):htmlelement { return parsehtml('<input type="button" onclick="' + escapehtml(onclick) + '" />'); } which want migrate code this: function foo(onclick:string):htmlelement { var input = document.createelement('input'); input.type = 'button'; input.onclick = onclick; // <= correct? return input; } besides fact should using real javascript function instead of string of code, correct way set onclick attribute using passed javascript string works same way did when generating html onclick attribute? edit: the input.onclick property code above setting supposed real javascript function object, not string of javascript (according mozilla docs ) code above not correct. i trying change implementation of foo() without needing change usages. need able continue passing in string of javascript. the solution turned out to convert ja

mysql - Putting an array into a table with SimpleXMLobject using php -

array ( [0] => array ( [title] => simplexmlelement object ( [0] => aa ) [pubdate] => simplexmlelement object ( [0] => aa ) [link] => simplexmlelement object ( [0] => aa ) ) [1] => array ( [title] => simplexmlelement object ( [0] => bb ) [pubdate] => simplexmlelement object ( [0] => bb ) [link] => simplexmlelement object ( [0] => bb ) ) i want put table has (title, pubdate, link) columns. confused how put mysql table when there simplexmlelement object , [0] in way. if not in way, able put table, because there , have

java - Crash on native packaged Mac JavaFX application -

i've got javafx application i'm working on, runs on windows , mac, i'm seeing issue on mac. i'm using jre version 1.8.0_51. basically, when i'm not doing anything, , application in background, it'll crash following stack trace: 0 libsystem_kernel.dylib 0x00007fff8e26d286 __pthread_kill + 10 1 libsystem_c.dylib 0x00007fff90d4d9b3 abort + 129 2 libjvm.dylib 0x00000001098d714f os::abort(bool) + 25 3 libjvm.dylib 0x00000001099f7c2c vmerror::report_and_die() + 2250 4 libjvm.dylib 0x00000001098d8d7a jvm_handle_bsd_signal + 1131 5 libjvm.dylib 0x00000001098d5057 signalhandler(int, __siginfo*, void*) + 47 6 libsystem_platform.dylib 0x00007fff9889df1a _sigtramp + 26 7 libglass.dylib 0x00000001e30295dd glassscreendidchangescreenparameters + 157 8 com.apple.corefoundation 0x00007fff8fe5f45c __cfnotificationcente

ios9 - In App Purchase Issue in iOS 9 -

i using in app purchase in app,which working fine on ios version except ios 9.the purchase showing successful control not return in delegate function.the following text printing in command: hangtracer interval 0, forcing 1s, while using contact framework

Laravel validation errors are appearing randomly in my view -

when submit form validation works randomly, mean appears , not, found out validation object returned controller not looped in view always. here code in view: @if ($errors->any()) <ul class="alert alert-danger"> <ul> @foreach ($errors->all() $error) <li>{{ $error }}</li> @endforeach </ul> </ul> @endif it randomly shows this: object(illuminate\support\viewerrorbag)#651 (1) { ["bags":protected]=> array(1) { ["default"]=> object(illuminate\support\messagebag)#643 (2) { ["messages":protected]=> array(12) { ["province_code"]=> array(1) { [0]=> string(36) "the province code field required." } ["district_code"]=> array(1) { [0]=> string(36) "the district code field required." } ["training_provider"]=> array(1) { [0]=> string(40) "the training provider

php - Load your custom classes in MODx Revolution -

i trying make simple class in modx getting 500 server error, ie example. i created plugin , call on webpageinit plugin class foo { function helloworld() { echo 'hello world'; } } and created snippet , try snippet $foo = new foo; but getting internal server error 500, proper way this, or there autolader custom class? i think documentation can give deeper explanation, making custom back-end programming. https://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/developing-an-extra-in-modx-revolution