Posts

Showing posts from June, 2013

Getting a 503 error from Workfront API when running bulk updates or create despite being under limit -

i've been trying debug or understand issue i'm seeing bulk updates or creates workfront. here scenario, generate list of 50 objects update. submit them api , 503 error following message "service unavailable - 0 size object" - "the server temporarily unable service request". now if delete 20 30 elements list goes through fine. example, test has 50 elements , fail (replaced subdomain cl01) https://cl01.preview.workfront.com/attask/api/v6.0/task?method=post&apikey={{ apikey }}&updates=[{"plannedstartdate": "2017-12-01", "name": "this task number 0", "projectid": "5998ce3c000207f18bf4a2022563c656"}, {"plannedstartdate": "2017-12-01", "name": "this task number 1", "projectid": "5998ce3c000207f18bf4a2022563c656"}, {"plannedstartdate": "2017-12-01", "name": "this task number 2", "project...

heroku - Rails memory bloat caused by too many records loaded? What can I do? -

i have views in heroku app load multiple records has_many associations within has_many associations. some requests taking on 50mb of dyno memory (leading out of memory errors) , i'm not sure best way resolve problem. i using pagination cut down on records loaded. @items = @section.items.order(priority: :desc).paginate(page: params[:page], :per_page => 20) inside view, looping through associations display data. @items.sizes.where(active: true).order(priority: :desc).each .. end @items.addons.where(active: true).order(priority: :desc).each .. end @items.addons.sides.where(active: true).order(priority: :desc).each .. end on big page, loading 20+20*3+20*4+20*4*20 = 1760 records assuming don't mind slow speed, reason why each request taking memory? , if so, doesn't garbage collector clean up? in heroku metrics, see memory bloat increasing.. you sort of answered own question there mate :) why should keep type of logic in controller using incl...

javascript - Three.js: Unable to Set Maximum and Minimum Zoom Level -

i using example webgl panorama cube: https://threejs.org/examples/?q=pano#webgl_panorama_equirectangular i want zoom in , out within limits, i.e. set maximum , minimum zoom level, not infinitely code provides default. infinite zoom, later reverses view if scrolled much, function example above looks this: function ondocumentmousewheel( event ) { camera.fov += event.deltay * 0.05; camera.updateprojectionmatrix(); } to address issue tried update fov when inside allowed range: function ondocumentmousewheel( event ) { var fovmax = 95; var fovmin = 5; var newfov = camera.fov + event.deltay * 0.05; if (newfov > fovmin && newfov < fovmax) { camera.fov = newfov; camera.updateprojectionmatrix(); }; } please note fov 90: camera = new three.perspectivecamera( 90, window.innerwidth / window.innerheight), 0.1, 100 ); this seems have worked maximum zoomed-in level - ...

python - Combine dicts in a list if they have the same key -

i have dict looks this: {'item1': [{'name1': 3}, {'name2': 4}, {'name1':7}], 'item2': [{'name7': 44}, {'name2': 3}, {'name6':9}, {'name6':2}] } i want combine dictionaries in list attached key such if there multiple dicts same key, can combine them (sum) , leave others are. the output like: {'item1': [{'name1': 10}, {'name2': 4}], 'item2': [{'name7': 44}, {'name2': 3}, {'name6': 11}] } i can't figure out how in python elegantly list/dict comprehension. this uses collections.counter . elegant come with, because of convoluted structure of input - list of 1-length dictionaries indeed better implemented single dictionary, comments suggest. code transforms to, although have provided more possible tranformations if direly need old data structure. if do, recommend using tuples key-value pairs rather single-length dicts, seen in tuple_outp...

html - Mobile Slideshow Not Centering -

i have responsive site slideshow. have set slideshow 100% width of browser window, , working fine. problem is, slideshow shifted bit right, if there padding left of image. result user having scroll right see entire slideshow. have tried playing around attributes of div , slideshow itself, no luck. issue appreciated. here css , html code: css html { background-color:#000000; } body { margin:0auto; padding:0; width:100%; } #header { margin:0auto; padding-top:0.5%; text-align:center; } #logo { margin:0auto; max-width:186px; max-height:123px; padding-top:1%; padding-bottom:15%; text-align:center; } #banner { width:100%; } #home_content { width:100%; padding-top:0.25%; } #history_content { width:100%; padding-top:0%; } #home_slideshow { padding-top:1%; display:flex; justify-content:center; } #home_slideshow { padding-top:1%; display:flex; justify-content:center; } hr { border-color:#1bb7f2; width:100%; padding:0%; } #home_footer { width:100%; margin-top:60%; } #history_fo...

python - str.replace starting from the back in pandas DataFrame -

i have 2 columns so: string s 0 best new york cheesecake new york ny new york 1 houston public school houston houston i want remove last occurrence of s in string . context, dataframe has hundreds of thousands of rows. know str.replace , str.rfind , nothing desired combination of both, , i'm coming blank in improvising solution. thanks in advance help! you can use rsplit , join : df.apply(lambda x: ''.join(x['string'].rsplit(x['s'],1)),axis=1) output: 0 best new york cheesecake ny 1 houston public school dtype: object edit: df['string'] = df.apply(lambda x: ''.join(x['string'].rsplit(x['s'],1)),axis=1).str.replace('\s\s',' ') print(df) output: string s third 0 best new york cheesecake ny new york 1 1 houst...

ruby on rails - Dual relationship to model with one polymorphic -

i have scenario have 2 models "group" , "motion". group may have many motions , every motion related group. motion may related 1 of various models of group may one. so have has_many relationship between group & motion , polymorphic relationship between motion & group. class group < applicationrecord has_many :motions has_many :motions, as: :motionable end class motion < applicationrecord belongs_to :group belongs_to :motionable, polymorphic: true end whilst appears work new record in motions creates polymorphic relationship whereas require has_many relationship: 2.4.1 :010 > group.first.motions.new group load (1.5ms) select "groups".* "groups" order "groups"."id" asc limit $1 [["limit", 1]] => #<motion id: nil, group_id: nil, motionable_type: "group", motionable_id: 1> i have working using following: class group < applicationrecord has_m...

Sublime REPL bug while runing Swift in Linux -

i have set sublime repl work swift, facing problems. note below code runs without errors in terminal. the following code: import foundation func execcommand(command: string, args: [string]) -> string { if !command.hasprefix("/") { let commandfull = execcommand(command: "/usr/bin/which", args: [command]).trimmingcharacters(in: characterset.whitespacesandnewlines) return execcommand(command: commandfull, args: args) } else { let proc = process() proc.launchpath = command proc.arguments = args let pipe = pipe() proc.standardoutput = pipe proc.launch() let data = pipe.filehandleforreading.readdatatoendoffile() return string(data: data, encoding: string.encoding.utf8)! } } let commandoutput = execcommand(command:"file-roller", args:["hello, here!"]) print("command output: \(commandoutput)") causes errors in repl, in turn complains found...

camera - How to convert stream video recorded -

i'm using camera ip lg lnu3220r computer vision programming. recorded video tool of lg provide "dat" format, , tool support convert avi. after convert avi, windows media player can play, others player can not. tried using codec pack, vlc player,... still not play. tried use converter format factory, error when convert. could please me how convert video? thank

powershell v4.0 - Extract substring delimited with a double quotes -

this powershell script: ((invoke-webrequest "http://www.gsmarena.com/battery-test.php3").allelements | class -eq "lalign").innerhtml produced following output: <a href="lenovo_p2-8319.php">lenovo p2</a> <a href="gionee_marathon_m5-7259.php">gionee marathon m5</a> <a href="xiaomi_mi_max_2-8582.php">xiaomi mi max 2</a> <a href="asus_zenfone_max_zc550kl-7476.php">asus zenfone max zc550kl</a> <a href="xiaomi_redmi_note_4-8531.php">xiaomi redmi note 4</a> <a href="samsung_galaxy_a7_(2017)-8335.php">samsung galaxy a7 (2017)</a> <a href="samsung_galaxy_s6_active-7114.php">samsung galaxy s6 active</a> <a href="xiaomi_mi_max-8057.php">xiaomi mi max</a> <a href="samsung_galaxy_j7_(2017)-8675.php">samsung galaxy j7 (2017)</a> <a href="xiaomi_redmi_3-7862.php"...

php - Converting date to timestamp based on timezone -

i'm fetching emails using php imap , example of object: array ( [0] => stdclass object ( [subject] => email subject [from] => sender <sender@domain.com> [to] => me@domain.com [date] => sat, 19 aug 2017 20:09:33 +1000 [message_id] => <80d657c74967c8dc56138ca9552f0a2e@anyweb.apca.local> [size] => 1881518 [uid] => 703 [msgno] => 527 [recent] => 0 [flagged] => 0 [answered] => 0 [deleted] => 0 [seen] => 0 [draft] => 0 [udate] => 1503137430 ) ) although have udate wanted double check if matches timezone, did: date_default_timezone_set('australia/melbourne'); $str = 'sat, 19 aug 2017 20:09:33 +1000'; echo strtotime($str); // 1503137373 ?? even tried: $date = new datetime($str, new datetimezone('aus...

java - how to add loading dialog while media player is in preparing in service (android) -

i built app play audio internet, use service play audio in background, question how show loding dialog while media player in preparing posision in service(background) hire code. activity package com.uqifm.onlineradio; ....... public class mainactivity extends appcompatactivity { button b_play; boolean started = false; @override protected void oncreate(bundle savedinstancestate) { requestwindowfeature(window.feature_no_title); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); b_play = (button) findviewbyid(r.id.b_play); b_play.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { if(started){ started = false; stopservice(new intent(mainactivity.this,myservice.class)); b_play.settext("play"); }else{ started = t...

PHP type hinting: bool and int -

i debugged php 7.1 code in wp plugin function returning 0 or 1 when expected various other ints. realized i'd forgotten remove (bool) cast earlier. but made me wonder, because function had return type of int . here's simplified version: function get_foo(): int { $val = get_option('foo'); // returns string can parsed int return (bool) $val; } $foo = get_foo(); test code here. it's easy cast between bool , int , of course, why didn't throw typeerror ? there 3 scenarios typeerror may thrown. ... second value being returned function not match declared function return type. you need add strict_types directive type hinting work properly quoting php 7 new features to enable strict mode, single declare directive must placed @ top of file. means strictness of typing scalars configured on per-file basis. directive not affects type declarations of parameters, function's return type (see return type declarations, built-in ...

python - Matplotlib, live plot not responsive -

i have following code below: the idea have csv file gets updated every few seconds recent price of stock read data program , make ohlc plot updated live after each minute passes. when run code works fine , plot updates every minute , nicely displays new bar. issue matplotlib figure unresponsive , lags. example if try maximize window freezes , stalls. i imagine there better way plotting figures responsive , there less lag. how can fix code accomplish this? i have looked issue , have seen similar live plotting dilemmas solved using ‘blitting’, see here: https://matplotlib.org/api/animation_api.html unsure how work in case candlestick2_ohlc plotting function. import matplotlib.pyplot plt import matplotlib.animation animation matplotlib.finance import candlestick2_ohlc import csv import time o=[] h=[] l=[] c=[] def barplot(ticker_symbol): data_current_minute=[] plt.ion() fig, ax = plt.subplots() open(tick+".csv", 'r') my_file: reader = csv.read...

python - Twitter - streaming API to get user tweets not working -

twiiter api giving me hell. restrictive. i tweets given user, so: import json twython import twython twython import twythonstreamer #where store credentials open('creds-twitter.txt') f: creds = json.load(f) class tweetstreamer(twythonstreamer): def on_success(self, data): if 'text' in data: print data['text'].encode('utf-8') def on_error(self, status_code, data): print status_code self.disconnect() streamer = tweetstreamer(creds['consumer_key'], creds['consumer_secret'], creds['access_token'], creds['access_token_secret']) thom_yorke = '110509537' print streamer.statuses.filter(follow=thom_yorke) 1) on first try, no results. script stalls there, waiting response. 2) halt process and, on second try, use argument track , so: streamer.statuses.filter(track = 'radiohead', follow=thom_yorke), it filters radiohead , not ...

php - How can I filter values from an array and then sort them by a custom order? -

i parsing json file , have filtered out values wanted based on key loop through create variables other key values want. have sorted not sure how order displays in order want. there simplified way filter , order in 1 quick function or need order separately , if best approach? here snippet code filtering array based on "event" key before loop. order below order in want them displayed when output too. $str = file_get_contents($url); // put contents of file variable $o=json_decode($str,true); $features=$o['features']; // lets filter response values want $filtered = array_filter($features,function($el){ $alerts = array('tornado warning', 'severe thunderstorm warning', 'hurricane warning', 'tropical storm warning', 'flash flood warning', 'flood warning', 'tornado watch', 'severe thunderstorm watch', 'hurricane watch', 'tropical storm watch', 'flash flood watch'); return...

Custom Filter Datatables using yajrabox package in laravel 5 -

excuse me, have problem when wan't make custom filter in datatables. wan't show data based on selected input. data has not changed expected. here view code <div class="panel-body"> <div class="row"> <div class="col-md-10"> {!! form::open(['method'=>'post','class'=>'form-horizontal','role'=>'form','id'=>'filter-form']) !!} <div class="form-group{{ $errors->has('filter') ? ' has-error' : '' }}"> {!! form::label('filter', 'filter:', ['class'=>'col-md-1 control-label']) !!} <div class="col-md-3"> {!! form::select('filter', ['all'=>'semua waktu','bulanan'=>'per bulan ini','tahunan'=>'per tahun ini','tanggal...

command line arguments - How to convert character to integer in fortran? -

how manipulate command line argument? example te.f90 program print_ integer :: character(len = 32) :: arg = 1 call get_command_argument(i, arg) if ( len_trim(arg) == 0) exit write(*,*) trim(arg) write(*,*) trim(arg)**2 = + 1 end end program print_ te.sh #!/bin/bash (( x = 1; x <=3; x++ )) ./te $x done i pass $x arg has type character , want manipulate arg number, when execute ./te.sh , got error promotion operands of binary numeric operator '**' @ (1) character(1)/integer(4) . what do? you'll need convert string (arg) integer. program print_ integer :: i, iarg character(len = 32) :: arg = 1 call get_command_argument(i, arg) if ( len_trim(arg) == 0) exit write(*,*) trim(arg) read(arg,"(i)") iarg write(*,*) iarg**2 = + 1 end end program print_

sorting - How to sort a 2d array based on one row in java -

how sort 2d array using arrays.sort in java example array have 1 2 3 4; 8 2 4 9 sorted array should like 2 3 1 4; 2 4 8 9 sorting can done on basis of row. searched google , stack overflow of them giving answers sorting on basis of 1 column. tried writing comparator function failed. requirement wanted use both binarysearch function sort function of arrays. as per example columns linked i.e. 1, 8 , 2, 2 , 3, 4 , 4, 9 , better create object linked data. putting them in object ensure stay together. check example sort based on column. public class arraycolumnsortexample { public static void main(string[] args) { int rowsize = 2; arrayrow[] arr = new arrayrow[4]; arr[0] = new arrayrow(rowsize); arr[1] = new arrayrow(rowsize); arr[2] = new arrayrow(rowsize); arr[3] = new arrayrow(rowsize); arr[0].row[0] = 1; arr[0].row[1] = 8; arr[1].row[0] = 2; arr[1].row[1] = 2; arr[2...

k means - Normalising Data to use Cosine Distance in Kmeans (Python) -

i solving problem have use cosine distance similarity measure kmeans clustering. however, standard kmeans clustering package (from sklearn package) uses euclidean distance standard, , not allow change this. therefor understanding normalising original dataset through the code below. can run kmeans package (using euclidean distance) , same if had changed distance metric cosine distance? from sklearn import preprocessing # normalise existing x x_norm = preprocessing.normalize(x) km2 = cluster.kmeans(n_clusters=5,init='random').fit(x_norm) please let me know if mathematical understanding of incorrect?

php - laravel store files and access them -

i store files using code: $files = $request->file('files'); if($request->hasfile('files')) { foreach($files $file) { $file->store('files')); } } the files in example saved under storage/app/files/ , fine since not publicly accessible (which neither supposed to). however, if want provide users download option of these files, how access them? thought of php reading file , 'render' user. however, i'm new laravel , bit lost @ point. any ideas? there's 3 main ways send files responses: file download (uses content disposition: attachment) return response()->download(storage_path("app/files/filename.ext")); //where filename.ext file want send inline file (uses content disposition: inline) return response()->file(storage_path("app/files/filename.ext")); there's falling symfony's streamed response large files.

c++ - Profiling NDK app with intel Vtune analyzer -

i developing android app heavily uses ndk , uses external shared libraries compiled c++. android apk built latest android studio uses cmake build native libs instead of ndk-build. works fine , able run apk on target device well. the problem comes when try profile apk intel vtune analyzer. profiler shows test apk in dropdown menu of module not show dependency shared native library has been statically linked. the apk code runs fine , in logcat results can see debug traces of shared native lib well.. not able understand why vtune profiler not include dependency shared lib of test ndk app. any on appreciated , !

node.js - Why Reactjs mqtt client url return wss? -

This summary is not available. Please click here to view the post.

type conversion to integer in ruby -

i using latest ruby version[ruby 2.4.1p111] i getting result of '123'.to_i +12 171 irb(main):021:0> '123'.to_i + 12 => 135 irb(main):022:0> '123'.to_i +12 => 171 irb(main):023:0> 123 + 12 => 135 irb(main):024:0> 123 +12 => 135 can me understand second operation here. you ended calling unary plus operator in second example, which returns receiver’s value and ended (essentially): '123'.to_i 12 and since, to_i takes argument, base , ended converting '123' integer in base 12, is, apparently, 171.

python - Loading .ui files in PyQt5 causes delays -

Image
i'm developing project pyqt5, , i'm having problems ui. created interface qt designer, generated .ui file, imported code, , showed window wanted on screen. however, have problem. there second delay in displaying window on screen. here .ui file: <?xml version="1.0" encoding="utf-8"?> <ui version="4.0"> <class>form</class> <widget class="qwidget" name="form"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>461</width> <height>320</height> </rect> </property> <property name="windowtitle"> <string>form</string> </property> <widget class="qlabel" name="label"> <property name="geometry"> <rect> <x>20</x> <y>20</y> <width>47</width> ...

crash - GTK# installer crashes -

i new site, hope have time , knowledge me or notice this. problem accidently deleted gtk# pc , can't install it. installer something, launches cmd , says "there problem windows installer package. program run part of setup did not finish expected. contact support personnel or package vendor.", rolls installation , quits. can me solve problem or give working installer? reading.

javascript - Auto click function continuously clicking on submit button -

i have put auto click function on form. want auto click submit button once. code continuously clicking on submit button. due page continuously auto reloading. i want click once on button. how can that? <form action="" method="post"> <input type="text" size="80" name="url" value="https://drive.google.com/file/d/<?php echo $_get['id']; ?>/view"/> <input type="submit" id="btn" value="play" name="submit" /> </form> <script> window.onload = function(){ document.getelementbyid('btn').click(); } </script> the 2 answers given good, users can manipulate , mess these stored session items , therefore allows manipulation of validation. to avoid users messing validation can check if form has been posted in php. important when dealing sensitive user information. <?php if(!isset($_post['submit...

mysql - mysql_tzinfo_to_sql ORDER BY Error -

i need run utility mysql_tzinfo_to_sql project , whenever try run first command : mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql i following error: error 1105 (hy000) @ line 46426: order ignored there user-defined clustered index in table 'time_zone_transition' my understanding because order by not processed won't go further in updating timezones, though have never touch base, not sure how can best solve issue. also when trying run: mysql_tzinfo_to_sql tz_file tz_name | mysql -u root -p mysql i following error: mysql_tzinfo_to_sql: can't create/write file 'tz_file' (errcode: 2 "no such file or directory") problems zoneinfo file 'tz_file' edit: running on macos sierra (10.12.6) , trying because of that: https://docs.djangoproject.com/en/1.10/ref/databases/#mysql-time-zone-definitions i have answer think should safe , should around error having. documentation, believe table time_zone_transition...

javascript - How to write php include inside div with jquery -

i need write <?php include $this->_ script('admin/test.phtml'); ?> using jquery within <div> works. i have researched , in responses recommend using load("file.php") , not work in case, because framework , because of routes not work. i tried , did not work, include inside script instead of doing in div: <script> $('.btn-group').on('click', '#btn-edit', function(e) { e.preventdefault(); var id = $(this).attr('data-id'); $('#mymodal').modal({ backdrop: 'static' }); <?php $_get['id'] = id;?> var php = "<?php include $this->_script('admin/teste.phtml') ?>"; $('.modal-body').html(php); }); </script> i tried code , did not work: <script> $('.btn-group').on('click', '#btn-edit', function(e) { e.preventdefault(); var id = $(this).attr('data-id'); ...

r - Impute NA's with data.table from other values within a group -

consider following data table library(data.table) dt <- data.table(sys_id = 1:9, = c(11, 12, 12, 13, 14, 15, 15, 18, 18), b = c(2, 1, 2, 1, 2, 1, 2, 1, 2), age = c(13, na, 13, na, 11, na, 12, na, 12)) which gives following data table: sys_id b age 1: 1 11 2 13 2: 2 12 1 na 3: 3 12 2 13 4: 4 13 1 na 5: 5 14 2 11 6: 6 15 1 na 7: 7 15 2 12 8: 8 18 1 na 9: 9 18 2 12 the goal replace na's within groups of variable (1 or 2 rows per group) other value of age within same group. can done when group (of a) consists of 2 rows 1 na in 1 of 2 rows of group. value of age in row 4 can remain na. did following works: dt[, age := unique(age[!is.na(age)]), = a] dt this last code gave me following data table: sys_id b age 1: 1 11 2 13 2: 2 12 1 13 3: 3 12 2 13 4: 4 13 1 na 5: 5 14 2 11 6: 6 15 1 12 7: 7 15 2 12 8: 8 18 1 12 9: 9...

java - Not showing google maps from android device -

i want add google maps. works on device. not work on other devices want work on devices. how can it? use viewpager , fragment. have apikey developersgoogle not understand how not work fragmenta.java public class fragmenta extends fragment { mapview mmapview; private googlemap googlemap; view view ; textview textview; recyclerview recyclerview ; arraylist<onemlidepremler> onemlidepremler; sondepremrecycleradapter sondepremrecycleradapter; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.son_deprem_custom, container, false); recyclerview = rootview.findviewbyid(r.id.son_recycler); linearlayoutmanager layoutmanager=new linearlayoutmanager(getactivity()); layoutmanager.setorientation(linearlayoutmanager.vertical); layoutmanager.scrolltoposition(0); recyclerview.setlayoutmanager(layoutmanager); onemlidepremler=new arraylist<onemlidepremler...

How to migrate a .NET PCL Project to .NET Standard 2.0 -

i have solution pcl , .net core 1.0 projects. once updated vs 2017 15.3, when navigate project properties have "application" page .net core 1.0 projects can change 1.0 2.0. unfortunately pcl projects shows standard "library" page "learn more" link navigates me ".net standard" web page no option migrate .net standard 2.0. rest same , allows me change usual targets. no reference else related .net standard. do have recreate projects .net standard 2.0 myself?

aframe - Make camera follow height map terrain using raycaster -

i'm trying make camera follow contours of heightmap landscape. i've added raycaster points down, not reporting changes in intersection. i've had detach raycaster camera, camera rotate raycaster. can tell me i'm doing wrong here? how distance raycaster terrain? full code: live demo - blue vertical line raycaster <script> // custom follow terrain component // // idea use raycaster pointing down work out distance between camera , terrain // , adjust camera's z value accordingly aframe.registercomponent('collider-check', { dependencies: ['raycaster'], init: function () { var myheight = 2.0; var cam = this.el.object3d; this.el.addeventlistener('raycaster-intersected', function (evt) { // i've got camera here , intersection, should able adjust camera match terrain? var dist = evt.detail.intersection.distance; ...

c# - SQLiteDataReader error, near "table": syntax error -

i have simple sqlite db table in c# project database screenshot here code using retrieve data db: sqliteconnection dbconnection; dbconnection = new sqliteconnection("data source=./new.db;"); dbconnection.open(); if (dbconnection.state == system.data.connectionstate.open) richtextbox3.text = "conn"; string sqlcommand = "select age table index=1"; sqlitecommand command = new sqlitecommand(sqlcommand, dbconnection); sqlitedatareader result = command.executereader(); if(result.hasrows) { while (result.read()) { richtextbox1.text = result.getint32(0) + " "+ result.getstring(1) + " " + result.getint32(2); } } maybe while loop incorrect problem syntax error near table. as @rohit mentioned table keyword in sqlite if still want use can change query below: surrounding table name [table] string sqlcommand = "select age [table] index=1"; it works in sqlserver

android - How to get the context in react-native -

i want make react-native applicaiton rtl. as mention in https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html job: i18nutil sharedi18nutilinstance = i18nutil.getinstance(); sharedi18nutilinstance.setallowrtl(context, true); how ever context used below: sharedi18nutilinstance.allowrtl(getapplicationcontext(),true); but nullpointerexception caused by: java.lang.nullpointerexception: attempt invoke virtual method 'android.content.context android.content.context.getapplicationcontext()' on null object reference @ android.content.contextwrapper.getapplicationcontext(contextwrapper.java:106) @ com.nativestarterkit.mainactivity.getmaincomponentname(mainactivity.java:18) @ com.facebook.react.reactactivity.createreactactivitydelegate(reactactivity.java:48) @ com.facebook.react.reactactivity.<init>(reactactivity.java:32) @ com.nativestarterkit.mainactivity.<init>(mainactivity.java:8) @...

php - auto assign dynamic textbox with value from database based on typed word in another dynamic text box -

i have dynamic inputs first 1 under 'name' column, fetching data mysql , displaying suggestions user types (am making use of bootstrap typeahead). problem comes in when value typed user matches database, cost of respective item must displayed under 'unit cost' column. here html table. <table class="table table-bordered table-hover" id="make_sales_table"> <thead> <tr class="bg-gray"> <th>no.</th> <th>name</th> <th>qty</th> <th>unit cost</th> <th>total cost</th> </tr> </thead> <tbody> <?php $d_q = $conn->prepare('select * products_tbl order prod_name asc'); ...

ios - Suddenly giving error when Converting foundation object in json data -

my code working fine before , giving error like cannot convert value of type nsdata type data in coercion. can explain why happing? do { if let postdata: nsdata = try jsonserialization.data(withjsonobject: parameter, options: jsonserialization.writingoptions.prettyprinted) nsdata? { let json = nsstring(data: postdata data, encoding: string.encoding.utf8.rawvalue)! nsstring print("parameters --->>> \(json)") } } catch { print(error) }

Wordcloud from Numpy Array in Python -

i'm having trouble generating wordcloud using numpy array column 1 = terms , column 2 = frequency. given documentation on wordcloud available here: wordcloud documentation use .generate_from_frequencies need dictionary. i've attempted in code below, results in: typeerror: unsupported operand type(s) /: 'numpy.string_' , 'float' does know how can overcome this? have been stuck on hours , pulling hair out haha. from wordcloud import wordcloud, stopwords # create array documents classifed "0" cluster best performing kmeans cluster_1 = np.empty((0,4613)) cluster_1_fw = terms n in range (0,737): if euclidean_best[n] == 0: cluster_1 = np.vstack([cluster_1,x[n,:]]) # sum frequencies of words in cluster cluster_1_f = np.sum(cluster_1,axis=0) print(cluster_1_f.shape) cluster_1_fw = np.vstack([cluster_1_fw,cluster_1_f]) cluster_1_fw = np.transpose(cluster_1_fw) d = {} a, q in cluster_1_fw: d[a] = q print(cluster_1_...