Posts

Showing posts from February, 2012

android - How can I do the user select a picture in his gallery ? (xamarin forms) -

i try open gallery of devices in order user select photo , path...but stream returns null and, then, have exception because of that... don't know wrong can me? xamarin forms project, , testing using android. my main activity [activity(label = "neofly_montana", icon = "@drawable/icon", theme = "@style/maintheme", mainlauncher = false, configurationchanges = configchanges.screensize | configchanges.orientation)] public class mainactivity : global::xamarin.forms.platform.android.formsappcompatactivity { protected override void oncreate(bundle bundle) { tablayoutresource = resource.layout.tabbar; toolbarresource = resource.layout.toolbar; base.oncreate(bundle); global::xamarin.forms.forms.init(this, bundle); //inicializa imagecircle imagecirclerenderer.init(); //inicializa o mapa global::xamarin.formsmaps.init(this, bundle); loadapplication(new app()); }

php - Record is added but category id is 0 in mysql database -

this code when submit button clicked; adds records in database, category id 0; although there categories in category table $db = new database(); $query = "select * categories"; $categories = $db->select($query); if (isset($_post['submit'])) { //assign variables $title = mysqli_real_escape_string ($db->link,$_post['title']); $body = mysqli_real_escape_string ($db->link,$_post['body']); $category = mysqli_real_escape_string($db->link,$_post['category']); $author = mysqli_real_escape_string ($db->link,$_post['author']); $tags = mysqli_real_escape_string ($db->link,$_post['tags']); //validate not empty if ($title == '' || $body == '' || $category = '' || $author == '' || tags == '') { $error = 'please fill out fields'; } else { $query = "insert posts (title,body,category,author,tags) values ('

python - AWS Lambda unable to GET a file from S3 -

hi have lambda (python3.6) below unable read file s3, though lambda in role has unfettered permissions s3 (iam policy below). the lambda attempts retrieve file s3 , write temporary location. blocks on calling s3.bucket() , times out (even timeout in minutes). what's weird it's timing out without exception, , not rejecting call s3.bucket() kind of permission error. this pretty basic, i'm @ loss sorted out. import boto3 botocore import exceptions def lambda_handler(event, context): key = event['image'] bucket = event['bucket'] tempfile = '/tmp/%s-%s' % (bucket, key) print('(p) bucket: %s::%s' % (bucket, key)) print('(p) tempfile: %s' % tempfile) s3 = boto3.resource('s3') print('(p) resource intiialized') try: b = s3.bucket(bucket) print('(p) bucket info: %s [%s]' % (b.name, b.creation_date)) b.download_file(prefixed_key, tempfile) print('(p} file downloaded %s&

http - How to handle unexpected exception for Transfer-Encoding: chunked -

our server needs send stream based response client. using http 1.1 chunked encoding. how should handle case when able send normal streaming data first several chunks encountering error later on server side while processing data. from client point of view, http status response 200 because successful chunks have been delivered.

Why does translating this code snippet from C# to C++ degrade performance? -

i more familiar c# c++ must ask advice on issue. had rewrite code pieces c++ , (surprisingly) ran performance issues. i've narrowed problem down these snippets: c# public class suffixtree { public class node { public int index = -1; public dictionary<char, node> children = new dictionary<char, node>(); } public node root = new node(); public string text; public suffixtree(string s) { text = s; (var = s.length - 1; >= 0; --i) insertsuffix(s, i); } public void insertsuffix(string s, int from) { var cur = root; (int = from; < s.length; ++i) { var c = s[i]; if (!cur.children.containskey(c)) { var n = new node() { index = }; cur.children.add(c, n); return;

powershell - CodeDeploy on programically created EC2 Instance -

i have auto-scaling-group setup. when there no running instances per group , application deploys, auto-scaling-group spin instance , deploy. fantastic. ... sorta... if there more 1 instances in auto-scaling-group, scripts might point 1 instance or another. how deploy specific instance without having setup codedeploy application, deployment-group, send new revision, yada, yada, yada... or, have take of steps each time? how track deployments? surely there's better way this? ideally, create instance based on ami, associate instance auto-scaling-group, deploy instance. can't create-deployment instance, deployment-group. this maddening.

asp.net - Share user authentication with different sites on same domain -

i have asp.net mvc site runs on www.company.com , has user registration , login pages etc. use identity 2.0 user management. i start migrating site angular application asp.net core web api on app.company.com i'm not sure how manage user authentication / authorization. the user login www.company.com, , parts of site (seamlessly user, aside url change) go app.company.com how can have seamless sign on experience app.company.com? app.company.com need know authenticated user is, though user authenticated against www.company.com? i have had same situation in 1 of project. our solution use identityserver sso. can configure identityserver use existing user database.

c# - MVCCheckBoxList catering for a 1 to Many relationship -

i have class has 1 many relationship class. use class car , class gears. need create form, registers car , user needs specify choice of gears. public class car { public int id { get; set; } public string desc { get; set; } public list<gear> gears { get; set; } } public class gear { public int gid { get; set; } public int gname { get; set; } } using asp.net mvc 5, have create form, have scaffolded car model, , within form, wish have checkboxlist of gears, i have viewmodel have provided checkboxlist below: public class gearsviewmodel { public gear _gear {get; set; } public bool _ischecked {get; set;} } controller looks like: gears fetched db context "gearr","gear1","gear2","gear3","gear4","gear5","gear6","gear7" public action create() { viewbag.gears = new selectlist(db.gears, "gid","gname"); list<gearviewmodel> _gears= ne

ionic framework - how to use cordova inappbrowser plugin -

i developing mobile app apache cordova. simple app loads responsive website. now, using html tag load page, want use cordova inappbrower purpose. this www/index.html file: <!doctype html> <html> <head> <title>title</title> </head> <body style="width: 100%;height: 100%;overflow: hidden;"> <iframe style="width: 100%;height: 100%; border: none;" height="100%" src="http://www.mywebsite.com/"></iframe> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> </body> </html> this www/js/index.js file: var app = { initialize: function() { document.addeventlistener('deviceready', this.ondeviceready.bind(this), false); }, ondeviceready: function() { var networkstate = navigat

enterprise integration - Do Apache Camel Interceptors work on a Routing Slip EIP? -

i using camel's spring boot integration, , trying set route use routing slip eip , have wide open intercept defined on routebuilder - see interceptor called once before routingslip. not intercept endpoints in slip? @component public class myroute extends routebuilder { private final myservice myservice; @autowired public myroute(myservice myservice ) { this.myservice = myservice; } @override public void configure() throws exception { /* * adds interceptor try save state between each slip of route */ intercept() .bean(myservice); /* * route, assumes routingslip comma separated list of bean names have registered */ from("direct:start") .routingslip(header("myslip")); } }

convert TSQL query to MySQL -

i need convert tsql query mysql query version 5.7.14 tried declare parameter following syntax declare @commissiontype int; but reached dead end , need convert query create procedure myproc @chainid int begin declare @commissionmethod int declare @commissiontype int declare @value decimal(18,2) set @commissionmethod = 1 set @value = 200000 set @commissiontype = (select commissiontype commissionrules chainid = @chainid ) if(@commissionmethod = 1) begin print('alert') select (fixed * @value) / 100 commissionrules chainid = @chainid end end this pretty literal conversion. check logic. doesn't make sense. v_commissionmethod 1 , v_commissiontype not being used after selecting value. delimiter // create procedure myproc ( p_chainid int) begin declare v_commissionmethod int; declare v_commissiontype int; declare v_value decimal(18,2);

Gitlab CE remote postgres ssl_mode -

i'm trying set gitlab omnibus remote postgresql database. connection between gitlab , postgres should encrypted i'm having trouble configuration. gitlab_rails['db_adapter'] = "postgresql" gitlab_rails['db_encoding'] = "utf8" gitlab_rails['db_collation'] = nil gitlab_rails['db_database'] = "gitlabhq_production" gitlab_rails['db_pool'] = 10 gitlab_rails['db_username'] = "gitlab" gitlab_rails['db_password'] = "mypassword" gitlab_rails['db_host'] = "db.example.com" gitlab_rails['db_port'] = 5432 # gitlab_rails['db_socket'] = nil # gitlab_rails['db_sslmode'] = nil gitlab_rails['db_sslrootcert'] = "/usr/local/share/ca-certificates/cacert-class3.crt" gitlab_rails['db_prepared_statements'] = true gitlab_rails['db_statements_limit'] = 1000 with configuration gilab-ctl reconfigure fails with: pg::c

javascript - Trying to understand how to use clearInterval with JS -

this question has answer here: how correctly use setinterval , clearinterval switch between 2 different functions? 5 answers i using javascript , trying write function make colors blink problem when click on toggle blink button not stop blinking when click stop toggle end button. trying implement clearinterval make stop no luck. appreciated. function main() { $('.select-color').on('click', function() { var selectedcolor = $(this).attr('class'); switch (selectedcolor) { case 'select-color cyan not-selected': colorclass = 'cyan'; break; case 'select-color yellow not-selected': colorclass = 'yellow'; break; case 'select-color magenta not-selected': colorclass = 'magenta'; break; } $(this).removeclass('not-selected'); $(this).siblings().a

android - Gradle plugin cache my .aar -

i have aar team builds me.. the first time build fine. when team updates aar, gradle cache still caching old aar , although still builds. android studio doesn't recognize of new classes add. and reason after clean entire cache. gradle refuses ever generate cache ever. entire android studio filled red errors. (but still builds) how should deal situation??

fastcgi - lighttpd can not change the server port -

when use lighttpd+fastcgi, try change lighthttpd's port ,but failed, succeed when using default 80 port, try many times ,still failed. you. here's configure. server.document-root = "/var/www" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "www-data" server.groupname = "www-data" server.port = 80

Angularjs pagination only display 1 -

i cant paginate data return $http display 1 page. follow plunker still dont know problem why dont paginate. this script $scope.currentpage = 1; $scope.numperpage = 2; $scope.maxsize = 5; $scope.maketodos = function() { $scope.todos = response.data; //return of $http } $scope.maketodos(); $scope.$watch('currentpage + numperpage', function() { var begin = (($scope.currentpage - 1) * $scope.numperpage); var end = begin + $scope.numperpage; $scope.names = $scope.todos.slice(begin, end); console.log($scope.todos.slice(begin, end)); }); this inside of response.data {"id":"1","name":"name 1","description":"description 1","field3":"field3 1","field4":"field4 1","field5 ":"field5 1"}, {"id":"2","name":"name 2","description":"description 1","field3":"field3 2

PHP Replace EM Dash REGEX -

i trying replace character http://www.fileformat.info/info/unicode/char/2014/index.htm regular dash , have yet cant seem work? $dataold = "9am – 5pm"; // ms word doc $data = mb_ereg_replace("[\xe2 \x80 \x94]", " - ", $dataold); print_r($data); why bother octal unicode format? why not... replace n-dash $dataold = "9am – 5pm"; // ms word doc $data = mb_ereg_replace(" – ", " - ", $dataold); print_r($data); replace m-dash $dataold = "9am — 5pm"; // ms word doc $data = mb_ereg_replace(" — ", " - ", $dataold); print_r($data); your original code works fine, except sample text string has n-dash , you're testing m-dash. (and have spaces in regex). try this... $dataold = "9am — 5pm"; // ms word doc $data = mb_ereg_replace("[\xe2\x80\x94]", " - ", $dataold); print_r($data);

java - how to handle imports with jEdit? -

having problems netbeans; not able login jedit forum. there plugin configure handle auto-imports netbeans ctrl-shift-i ? (probably i'll try eclipse, try jedit.) see also: how add jar library jedit? some points: it jedit, not jedit distributed login on community page not work, sourceforge servers not support outbound network traffic, need account on comunity page login looking through http://plugins.jedit.org , lazyimporter seems after jedit in opinion 1 of best , flexible text editors, ever aimed be. programmers text editor integrated syntax highlighting many languages, no ide. can add many ide-like functionality plugins available , configure jedit suitable ide small projects. if not happy jedit ide, i'd recommend intellij idea. best java ide under sun, netbeans , eclipse pita compared it. use intellij idea develop jedit. :-)

javascript - use property value as property key using map -

this question has answer here: using variable key in javascript object literal 5 answers i want return new array take property value become property name. const temp = [ {name: 'james'}, {name: 'ally'} ] const new = temp.map(obj => ({ `${obj.name}`: null })) obviously doesn't work way. clue? https://jsfiddle.net/qg8ofom1/ const temp = [ {name: 'james'}, {name: 'ally'} ]; const newobj = temp.map(obj => ({ [obj.name]: null })); console.log(newobj);

python - Transform 2D array to a 3D array with overlapping strides -

i convert 2d array 3d previous rows using numpy or native functions. input: [[1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15]] output: [[[7,8,9], [4,5,6], [1,2,3]], [[10,11,12], [7,8,9], [4,5,6]], [[13,14,15], [10,11,12], [7,8,9]]] any 1 can help? have searched online while, cannot got answer. approach #1 one approach np.lib.stride_tricks.as_strided gives view input 2d array , such doesn't occupy anymore of memory space - l = 3 # window length sliding along first axis s0,s1 = a.strides shp = a.shape out_shp = shp[0] - l + 1, l, shp[1] strided = np.lib.stride_tricks.as_strided out = strided(a[l-1:], shape=out_shp, strides=(s0,-s0,s1)) sample input, output - in [43]: out[43]: array([[ 1, 2, 3], [ 4, 5, 6], [ 7, 8, 9], [10, 11, 12], [13, 14, 15]]) in [44]: out out[44]: array([[[ 7, 8, 9], [ 4, 5, 6], [ 1, 2, 3]], [[10, 11, 12], [ 7, 8, 9], [ 4, 5,

php - I would like to access DataTables **cell** with click function in Laravel 5.4 -

i have laravel 5.4 application working on. contains, off course, forms have input fields next search button. when user clicks on search button modal windows appears datatable content fetched database. now, achieve once click on cell of table, picks specific data in cell , fetch input field close modal window using jquery. here code. datatable: $('#mere-table').datatable({ processing: false, serverside: true, ordering: false, ajax:'http://127.0.0.1:8000/nouveau_ne/data_meres', columns :[ {data : 'nnid', name:'t_individus.nnid', classname:"nnid_mere"}, {data : 'nom', name:'t_individus.nom'}, {data : 'postnom', name:'t_individus.postnom'}, {data : 'prenom', name:'t_individus.prenom'}, ] }); jquery pick data cell , fetch inputfield nnid_mere $('#mere-ta

javascript - How can we subtract bill amount from account balance in a same table onclicking pay button -

this image has table having account balance , bill amount , pay button. on clicking pay button values should subtracted , final account balance should updated in table. offhand i'd want write like: account_balance -= bill_amount; ...and display new account_balance. you might need modify syntax of depending on whether you're doing in java, javascript, or jsp. might done on server side , require page refresh, or maybe in ajax call... or maybe it's few lines of javascript update what's being displayed on page. possibilities endless.

sql server 2014 - Transaction Replication messed up -

i have setup sql server transaction replication setup in our environment. sql version: sql server 2014 server1 publisher server2 subscriber1 server3 subscriber2 both subscribers pull type 1 way (transaction) replication. question: when delete 100000 rows @ publisher, deletes same no of rows @ subscriber1, @ subscriber2, deletes more 100000 rows. to stop have cleanup distribution , stop deletion. what can issue?

ios - Pouchdb work with cordova-plugin-wkwebview-engine plugin? -

i have installed cordova-plugin-wkwebview-engine plugin in ionic v2 app. , install pouchdb plugin. working fine. have installed pouchdb, not installed sqlite plugin not set adapter. i have tested in ios 10.2 - ipad but ios 9 not working. show white screen. this pouchdb code this._db = new pouchdb('test'); this.remote = 'http://192.168.53.150:5984/test'; let options = { live: true, retry: true }; this._db.sync(this.remote, options); ionic info cli packages: (/usr/local/lib/node_modules) @ionic/cli-utils : 1.9.1 ionic (ionic cli) : 3.9.1 global packages: cordova cli : 7.0.1 local packages: @ionic/app-scripts : 2.1.3 cordova platforms : ios 4.4.0 ionic framework : ionic-angular 3.6.0 system: ios-deploy : 1.9.1 node : v6.11.0 npm : 4.5.0 os : macos sierra xcode : xcode 8.3.2 build version 8e2002 packagejson: { "name": "listtest", "vers

To find a file name with some similar characters as another file in unix -

i have 2 files similar string in name, want search second file correspondent file in unix for eg:- filename1: - abc.flag.1502624856 filename2:- abc.n.1502654789 my doubt when find flag file how find correspondent n file. man agrep : name agrep - search file string or regular expression, approxi‐ mate matching capabilities let's try it: $ ls | grep -v abc.flag.1502624856 > file # remove searched file $ agrep -b -y abc.flag.1502624856 file agrep: 1 word matches within 8 errors abc.n.1502654789 since it's approximate pattern matching there might false positives.

csv - Using Typescript unable to assign a value to the Class level variable inside fs.createReadStream -

i new typescript , have scenario in need read data csv file , assign values class level map<> variable. following code trying out facing below issues:- a) vs code intellisence doesn't prompt me name of class level map<> variable when try this.nameofmapvariable inside fs.createreadstream function b) if ignore intellisence thingy , try , write code assigning value, @ runtime error:- cannot read property set of undefined code snippet of csvhelper.ts file:- import * csvparse 'csv-parser'; import fs = require('fs'); var parse = csvparse.parser; export class csvhelper { public testspecificdata = new map<string, string>(); public fetchtestspecificdata(clsname: string, mthdname: string): map<string, string> { fs.createreadstream('../testdata/testspecificdata.csv').pipe(csvparse()).on('data', function (data) { if (data.testclass == clsname && data.testmethod == mthdname) this.te

optimization - How to minimize my nasty function using scipy.minimize? -

i trying minimize function using scipy.minimize. columns of text file imported integers. codes work except last 2 lines. from sympy.abc import * import sympy s import numpy n scipy.optimize import minimize h0,mo,e,z,g = s.symbols('h0 mo e z g') dz = ((1+z)/h0)*(s.integrate(s.nsimplify((6/h0)/(g+(6-g)*(1+z)**3),z),z)).doit() mt = 5*s.log(10**(5)*dz)+25 c1 = ((mt-mo)**2)/e**2 c2 = s.lambdify((h0,g,z,mo,e),c1,"numpy") c3 = n.vectorize(c2) data = n.genfromtxt('data_file_580.txt',usecols=[1,2,3]) z = data[:,[0]] mo = data[:,[1]] e = data[:,[2]] c4 = c3(z,mo,e,g,h0) c5 = n.sum(c4) def f(c5): h0,g=c5 return c5 bnds = ((65,80),(4,6)) minimize(f,(65,4),bounds=bnds) getting error valueerror: setting array element sequence. if use def f(h0,g) instead of def f(c5) in line 17, throwing error typeerror: f() missing 1 required positional argument: 'g' how resolve ?

codeigniter - How to increase id by 1 or change it completely in HTML using PHP code -

i getting results database , showing them in datatable using query $result['gettablegroup'] = $this->gettablegroup(); return $this->load->view('users/index', $result); and here code of view <table class="table"> <thead> <tr> <th>name</th> <th>group users</th> <th>status</th> <th>action</th> </tr> </thead> <tbody> <?php foreach ($gettablegroup $value) : ?> <tr> <td> <?= $value->group_name ?> </td> <td> <?php if ($value->group_status == 'on'): ?> <div class="switch"> <div class="onoffswitch"> <input type="checkbox" checked class="onoffswitch-checkbox" id="exa

ibm mobilefirst - MFP 6.3 - WL.Client.makeRequest - Deprecated -

wl.client.makerequest() function deprecated in mfp 8.0. uses of function? if document have please share me. what correct solution in mfp 8.0 after run migration command mfpmigrate scan . getting this create custom adapter provides same functionality please given document related function , alternative solution in mfp 8.0 thanks, karthik s. wl.client.makerequest() api allowed making outbound calls endpoints. in mfp 8.0, should use wlresourcerequest api instead. api documentation here .

javascript - Facing no live responce on change of class of a div element on scrolling with jquery -

i have had read many answers here , tried apply them not working in case. can't find going wrong following code (it example of problem facing):- var header = $(".top-navigation"); $(window).scroll(function() { var scroll = $(window).scrolltop(); if (scroll >= 100) { header.addclass("top-navigtion1").removeclass("top-navigation"); } else { header.removeclass("top-navigation1").addclass("top-navigation"; } }); .container { width: 600px; height: 1500px; background-color: #000000; } .top-navigation { width: 600px; height: 100px; position: fixed; background-color:transparent; z-index: 1501 ; color: #fff; } .top-navigation1 { width: 500px; height: 100px; position:relative; background-color: 'blue'; z-index: 1501; } <div class="container"> <div class="t

How do I test dictionary-equality with Python's doctest-package? -

i'm writing doctest function outputs dictionary. doctest looks like >>> my_function() {'this': 'is', 'a': 'dictionary'} when run it, fails with expected: {'this': 'is', 'a': 'dictionary'} got: {'a': 'dictionary', 'this': 'is'} my best guess cause of failure doctest isn't checking dictionary equality, __repr__ equality. this post indicates there's way trick doctest checking dictionary equality. how can this? doctest doesn't check __repr__ equality, per se, checks output same. have ensure whatever printed same same dictionary. can one-liner: >>> sorted(my_function().items()) [('a', 'dictionary'), ('this', 'is')] although variation on solution might cleaner: >>> my_function() == {'this': 'is', 'a': 'dictionary'} true

r - Write.table as text file with differing number of rows -

i want share output of analysis in r txt file. can 1 here know of: write.table(s$maininformation, file = "output.txt", row.names = false, sep = "\t", quote = false, fileencoding = "utf-8", append = true) write.table(s$annualproduction, file = "output.txt", row.names = false, sep = "\t", quote = false, fileencoding = "utf-8", append = true) write.table(s$annualgrowthrate, file = "output.txt", row.names = false, sep = "\t", quote = false, fileencoding = "utf-8", append = true) write.table(s$mostprodauthors, file = "output.txt", row.names = false, sep = "\t", quote = false, fileencoding = "utf-8", append = true) the documents combined 1 txt file. however, if want in 1 step, i.e. s rather s$ , error code, not surprisingly, argumetns imply differing number of rows. write.table(s, file = "output.txt", row.names = false, se

python - Permission denied at Customer Subuser API -

i'm trying manage subuser account limits via sendgrid web api v2, keep getting: {u'error': { u'message': u'permission denied, not allowed manage users', u'code': 401 }} what i'm doing post @ https://api.sendgrid.com/apiv2/customer.limit.json data: api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&task=retrieve docs suggest. requests.post('https://api.sendgrid.com/apiv2/customer.limit.json', data={'api_user': 'my_sg_username', 'api_key': 'my_sg_password', 'user': 'subuser_username', 'task': 'retrieve' }).json() my account has admin permissions , able changes via ui, not v2 of api. is there option somewhere i'm missing? few notes: i'm able create subusers v3 of api but i'm using v2 here, because there no account limits options in v3. i error on apiv2

How to export multiple function or packages in foreach loop in "R" -

i'm trying decrease run time of code using doparallel package in r. i'm calling function awareratesir packages used in body of function. error could not find function "vcount" and.. i know vcount function of package igraph used in awareratesir ) it's not one. how can solve problem? i've thought should pass packages name used in function awareratesir don't know how cant export multiple function in foreach or how can export multiple package name. this code: tp<-foreach(i=1:iter, .inorder = false, .export = "awareratesir", .packages = "igraph", .packages="doparallel")%dopar%{ tp <- awareratesir(graphcontact, graphcom,state) return(tp) } if don't pass these packages error states function unknown if pass packages error: error in foreach(i = 1:iter, .inorder = false, .export = "awareratesir", : formal argument ".packages" matched multiple actual arguments&

BPMN 2.0 -- How to represent a relational DB table in BPMN 2.0 format -

i relatively new bpmn 2.0 , dont carry knowledge around same. can of me in understanding how represent relational database table in bpmn 2.0 format. for example master employee , employee salary table,how can represent them in bpmn 2.0 format. regards manish if aiming implement relational model of database, choice not business process model , notation, instance uml . camunda, provider of bpmn-tools, uses uml describing internal database, see their documentation . disclosure: not affiliated camunda, use products lot.

javascript - What does it mean for Webpack to ship with runtime? -

i heard somewhere "webpack ships runtime" - , that's suppose mean webpack has own version of requiring modules. don't understand runtime means in context. mean when hit localhost has webpack running, build out code bundle.js @ moment hit localhost , figure out right , there how require , module dependencies play out? if so, why important? isn't way webpack can work? it means when webpack builds javascript, includes bit of own code executed @ runtime . result of webpack build isn't exclusively code piped in, it's code plus code webpack adds.

Unable to load from csv to mysql table? -

load data local infile 'hr.csv' table hr_analytics fields terminated '`' ignore 1 lines(no,satisfaction_level,last_evaluation,number_project,average_montly_hours,time_spend_company,work_accident,left,promotion_last_5years,sales,salary) when run above query get: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'left,promotion_last_5years,sales,salary)' @ line 1 how solve this? the problem seems left mysql key word. try this: load data local infile 'hr.csv' table hr_analytics fields terminated '`' ignore 1 lines(`no`,`satisfaction_level`,`last_evaluation`,`number_project`,`average_montly_hours`,`time_spend_company`,`work_accident`,`left`,`promotion_last_5years`,`sales`,`salary`)

jquery - Using a variable for a key in a JavaScript object literal -

why following work? <something>.stop().animate( { 'top' : 10 }, 10 ); whereas doesn't work: var thetop = 'top'; <something>.stop().animate( { thetop : 10 }, 10 ); to make clearer: @ moment i'm not able pass css property animate function variable. { thetop : 10 } valid object literal. code create object property named thetop has value of 10. both following same: obj = { thetop : 10 }; obj = { "thetop" : 10 }; in es5 , earlier, cannot use variable property name inside object literal. option following: var thetop = "top"; // create object literal var aniargs = {}; // assign variable property name value of 10 aniargs[thetop] = 10; // pass resulting object animate method <something>.stop().animate( aniargs, 10 ); es6 defines computedpropertyname part of grammar object literals, allows write code this: var thetop = "top", obj = { [thetop]: 10 }; console.log(o

javascript - Creating animated rainbows via pure js -

the code (pure js) creating animated rainbow in successive rainbows delayed bit of time. animation not consistent (slows down eventually). beginner in programming code getting lengthy too. if run code on local, animation slows down after bit of time , there no consistency in way rainbows coming out (there should time gap between each rainbow). second issue want reduce code dont have create function each , every rainbow animation. function anim() { var x,y,z,p,q,r; x = y = z = p = q = r = 2*math.pi; var c = document.getelementbyid("mycanvas"); var ctx = c.getcontext("2d"); ctx.clearrect(0,0,c.width,c.height); var id = setinterval(frame_one,1); var t = setinterval(frame_two,1); var u = setinterval(frame_three,1); var v = setinterval(frame_four,1); var w = setinterval(frame_five,1); var s = setinterval(frame_six,1); function frame_one() { if (x <=(math.pi)) { clearinterval(id); x = 2*mat

php - How to resize/crop or reduce the size of an image displayed from SQL Server query? -

i want minimize size of sql server image before gets loaded on clients. unfortunately example not implemented: resizing , displaying blob element database code: <?php include "dbconf2.php"; $sqlimage=" select f.grafik, f.knr, f.brstatus1, f.untertitel1, f.anzeigeweb1 foto f f.knr 'fhtg20900%' ;"; $stmtimage = sqlsrv_query($connvhs, $sqlimage); while ($result2=sqlsrv_fetch_array($stmtimage)) { echo "titel: ".$result2['untertitel1']."<br>"; echo "knr: ".$result2['knr']."<br>"; echo "status: ".$result2['brstatus1']."<br>"; echo "web: ".$result2['anzeigeweb1']."<br>"; echo '<img src="data:image/jpeg;base64,'.base64_encode( $result2['grafik']).'" style="max-height: 50

android - How to get a arraylist<bitmap> from gridview -

i setting shuffled arraylist in grid view after rearranging want arraylist in order there in gridview . used getchildat(position) returning view. here code: (int = 0; < smallimages.size(); i++) { // arraylist<view>bh=new arraylist<>(9); beforeshuffle.add(smallimages.get(i)); // smallimageadapter ad=new smallimageadapter(c,beforeshuffle); } collections.shuffle(smallimages); image_grid.setadapter(new smallimageadapter(this, smallimages)); // image_grid.setadapter(new smallimageadapter()); image_grid.setnumcolumns((int) math.sqrt(smallimages.size())); image_grid.setonitemclicklistener(new adapterview.onitemclicklistener() { int counter = 0; int firstclick; @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { counter++; if (counter % 2 == 0) { firstclick = position; bitmap data1 =

java - FutureTask call() refer object, result wrong -

i want result jsonobject={"key":[2,2,3]} jsonobject={"key":[2,4,3]} jsonobject={"key":[2,4,6]} but result is {"key":[2,4,6]} {"key":[2,4,6]} {"key":[2,4,6]} i dont know what's wrong. please help. thanks! how change code? object last number. code is: public class testfuturetask { public static void main(string[] args) { int[] list = {1,2,3}; executorservice executor = executors.newcachedthreadpool(); list<futuretask<string>> futuretasks = new arraylist<>(); for(int i=0;i<list.length;i++){ int[] list1 = list; list1[i] = list1[i]*2; jsonobject jsonobject = new jsonobject(); jsonobject.put("key", list1); futuretasks.add(new futuretask<string>(new queryexecutor(jsonobject))); } for(int n=0;n<futuretasks.size();n++){ executor.submit(futuretasks.get

c - Understanding registers -

i reading code else wrote , confused how defined registers code goes this: uint32 gcro; unit32 ; 7u; i don't understand second line means. code repeats different named registers , uint32 ;7u; line again. understanding appreciated. in c language, unit32 ; 7u; not one, 2 unrelated expressions, since semi-colon separates them. depending on how uint32 defined, doesn't seem valid c code. defined typedef unsigned long uint32 , in case unit32 ; won't compile. 7u; valid c, though dummy line no effect. equivalent writing (unsigned int)7;

xamarin.forms - Xamarin Form - TaskCanceledException thrown on await client.PostAsync() -

very strange problem (all code in pcl). when call await client.postasync() against webservice (api's), taskcanceledexception . few things note: this running fine on android devices. happens when run app on ios, but... ... make stranger, can make run on ios if use different (physical) server hosts api's query await client.postasync() . so, https://somedomainname.com - works fine https://someotherserver.com - not work to make more strange, both servers run same webservice , there 0 difference, difference servers on different sites different client. fault not queried webservice throwing timing out or cancelling request. both servers have valid (trusted) ssl certificate it's not ssl related issue. i stuck. have tried modernhttpclient , increaing client.timespan . i checked ex.cancellationtoken.iscancellationrequested , false, it's pretty safe assume time of "timeout". however, when run post request postman manually against api, it&#

ClassCastException in switch android -

i receiving classcastexception error while doing switch in code: private void performlogin(string email, string pass, string version, string platform) { if (viewisattached()) { getview().showprogress(); modellogin.login(email, pass, version, platform, new onstatechangelistener() { @override public void oncompleted() { if (viewisattached()) getview().hideprogress(); } @override public void onerror(apierror error) { if (viewisattached()) { switch (error.getcode()){ //error in line case 418: //update getview().openupdatedialog(); break; case http_bad_request: getview().showinvalidusererror(); break;