Posts

Showing posts from February, 2013

Android Logcat: Why does logging come through in bursts? -

i find logcat real nuisance no matter device (or development tool) use. there seems delay between when programs , when logcat sees program did - 10-20 seconds or so. why this? there logcat buffering or flushing configuration can set either on device or logcat stop happpening? i see debug - not seconds later. have seen problem using eclipse, android studio , logcat rabbit. xcode shows debug ios devices immediately. surely android devices should capable of doing same? the problem caused error. have flood of "called unimplemented opengl es api" errors being logged continuously logcat , using filter app. these floods of errors causing delays in debug appearing. problem solved fixing flood of errors.

java - Getting "ClassNotFoundException: ResteasyBootstrap" and "ClassNotFoundException:SpringContextLoaderListenerexception" -

i getting following exception: java.lang.classnotfoundexception: org.jboss.resteasy.plugins.server.servlet.resteasybootstrap @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1711) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1556) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:525) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:507) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:124) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4715) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5273) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1566) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1556

javascript - Moment not formatting this date May 04, 2016 -

Image
the server giving me date format may 04, 2016 var month = moment('may 04, 2016', 'mm-dd-yyyy').format('m') month gives me 4 , may should 5 , it's giving me day seems, , not month. how format date server gives me determine month using moment.js? edit: not sure why downvoted tried answer below , still get when give moment 2 string arguments, the documentation says second meant format of first. mm-dd-yyyy not format of may 04, 2016 . format of may 04, 2016 mmm dd, yyyy : console.log(moment("may 04, 2016", "mmm dd, yyyy").format("m")); <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>

php - Issue integrating the Open Graph meta tag -

i trying integrate open graph , twitter card on site. works fine until add meta tag: <meta property="og:image" itemprop="image primaryimageofpage" name="twitter:image" content="my-site-name.com/resources/images/logo.png" /> at stage, headers sent error. however, if trim down length of image url, logo.png , error disappears. is there doing wrong? there maximum length value content attribute of meta tags? try changing content="my-site-name.com/resources/images/logo.png" to this: content="http://my-site-name.com/resources/images/logo.png"

office365api - Is there a way to programatically edit Office 365 Excel documents? -

Image
i have update spreadsheet looks this. it's not hard @ all. go last line , enter need in appropriate columns. i'd automate this. first thing tried selenium webdriver results slow , hit , miss. next thing checked api it looks like there nothing excel. i use selenium download file , use c# app modify excel file , reupload it. @ point though i'm wondering if google docs has easier solution. so there way programatically modify excel online spreadsheet? i'm aware of 4 options programmatically modify excel online via javascript or rest: office add-ins platform: https://dev.office.com/docs/add-ins/overview/office-add-ins excel services javascript api - ewa excel web access namespace (not updated in couple years): https://msdn.microsoft.com/en-us/library/hh315812(v=office.14).aspx excel services rest api (via sharepoint online): https://msdn.microsoft.com/en-us/library/ee556842(v=office.14).aspx microsoft graph rest api (excel objects in beta): https

input - Why isn't my file opening, C++? XCode and Visual Studio -

this happening in both visual studio , xcode #include <fstream> #include <iostream> using namespace std; int main() { ifstream input; input.open ("matrices.txt"); if (!input.is_open()) { cout << "not open!"; } else { cout << "open!"; } input.close(); return 0; } my file not opening. text file matrices.txt in same directory. what "same directory" in context? for file open this, has in working directory of executable when run in debugger. for xcode; means adding files copy files build phase (accessible editing executable's target); , adding products directory , selected dropdown.

c++ - Reading a binary file incrementally -

i made question parsing binary file, , sort of got work here. https://stackoverflow.com/questions/37755225/need-help-reading-binary-file-to-a-structure?noredirect=1#comment62983158_37755225 but face new challenge , in need of help, please bare me. my binary file looks much longer... st.........¸.°Ý.ø...0.œ...........esz4 1975..........iyh.testdbdbdbdbst...........°Ý.ø...................dbdbdbdbst.........p.´Ý.ø...0.œ...........esz4 1975..........htc.testdbdbdbdbst.........‹‚´Ý.ø...................dbdbdbdbst.........ƒd.Þ.ø...0.œ...........esz4 1975..........arm.testdbdbdbdbst.........«e.Þ.ø...................dbdbdbdb basically, every message starts 'st' , ends 'dbdbdbdb'. goal parse each message , store message data structure. in addition, every message different depending on type, , different type of message have additional members. the problem having is, have no idea how iterate through binary file... if regular file, can while(getline(file,s)), bina

json - Throwing out same response on login check PHP AND SWIFT -

i trying try , learn swift want backend server php , need convert php json app now want put email , password in fields on app , send post request php server side , php validates details , sends response let me decide response. i have managed post server side success think when response in xcode gives same output weather details correct or in-correct,i have looked every , followed tutorials keep getting same problem i'm guessing way check details in php file error , not success. could help? login.php $email = addslashes(strip_tags($_post['email'])); $password = addslashes(strip_tags($_post['password'])); $password = md5($password); $returnvalue = array(); $sql = "select email, user_password `accounts` `email` = '$email' , user_password = '$password' limit 1"; $fetchuser = mysqli_query($db_connect, $sql); $row = mysqli_num_rows($fetchuser); if($row = mysqli_num_rows($fetchuser) == 0){ $returnvalue["status"] = "

swift - Attaching value to array isn't impossible, how to add a value to a button/array/image? -

i started coding, don't know things. want make simple game. explain shortly: when user pressed "click start" game button, 7 out of 52 cards in card deck revealed. did creating several buttons hold image of of card. when user clicks button, 7 cards opened random card. first off, created array add photo names view controller, this: var masterallcards = ["2_of_clubs", "2_of_spades", "2_of_diamonds", "2_of_hearts", "3_of_clubs", "3_of_spades", "3_of_diamonds", "3_of_hearts", "4_of_clubs", "4_of_spades", "4_of_diamonds", "4_of_hearts", "5_of_clubs", "5_of_spades", "5_of_diamonds", "5_of_hearts", "6_of_clubs", "6_of_spades", "6_of_diamonds", "6_of_hearts", "7_of_clubs", "7_of_spades","7_of_diamonds","7_of_hearts", "8_of_clubs&quo

OpenGl: 2D particle simulation to 3D? -

right have working particle simulation program can render several hundred thousand particles smoothly. way have used cuda compute positions of particles in parallel. then, since i'm not familiar cuda-opengl interop, cpu used put particles on screen using opengl. my problem convert program 3d can give shadows. right now, i'm putting particles screen gl_points, using following command: gldrawarrays(gl_points, 0, numparticles); i have tried converting points spheres using glusolidsphere. however, result slow - @ 10k, program crying uncle. able render smoothly @ least 100k. any advice useful. thanks. best fake 3d particles they're far / small enough not visible in detail. depending on size , distance of particles viewer, plot them either point, textured quad sprite (or point sprite), or full rendered sphere close enough see details. and shadow can same , draw them shadow texture either point or sprites depending on size.

python - Amend column values according to timedelta and index -

i change data in pandas dataframe. the data collect needs assigned step value. conditions of triggers step change time or high pressure or temperature values. cannot past first step: when row on pressure (1100 psi) , under temp (40 c), "dilution" phase. when attempting change value with: df.ix[(df['press'] > 1100) & (df['temp'] < 40),'proc'] = 'dilute'; i seem modify top 2 rows. items[0].head() out[37]: time mass temp press proc time 00:00:00 10:58:07 21.947102 23.306101 1.830506 dilute 00:00:01 10:58:08 22.076259 23.306101 57.274142 dilute 00:00:02 10:58:09 22.094710 23.306101 196.000203 pressurize 00:00:03 10:58:10 22.113161 23.306101 293.318991 pressurize 00:00:03 10:58:10 22.094710 23.306101 361.161415 pressurize items[0].tail() out[38]: time mass temp

MongoDB query filters using Stratio's Spark-MongoDB library -

i'm trying query mongodb collection using stratio's spark-mongodb library . followed this thread started , i'm running following piece of code: reader = sqlcontext.read.format("com.stratio.datasource.mongodb") data = reader.options(host='<ip>:27017', database='<db>', collection='<col>').load() this load whole collection spark dataframe , collection large, it's taking lot of time. there way specify query filters , load selected data spark? spark dataframe processing requires schema knowledge. when working data sources flexible and/or unknown schema, before spark can data, has discover schema. load() does. looks @ data purpose of discovering schema of data . when perform action on data , e.g., collect() , spark read data processing purposes. there 1 way radically speed load() , that's providing schema , obviating need schema discovery. here example taken the library documentation : import org.

python - How can these javascript links be traversed with Selenium or BeautifulSoup? -

i’ve opted selenium since links’ hrefs generated dynamically, although method via bs4 preferred. i'm using phantomjs have tried firefox well when attempting click link, nothing happens. for instance, url = 'http://www.achema.de/de/ausstellung/aussteller-und-produkte.html' driver.get(url) resultsbox = driver.find_element_by_css_selector('div[id="ix_result"]') tr in resultsbox.find_elements_by_tag_name('tr'): link = tr.find_element_by_tag_name('a') link.click() # i've tried: # actionchains(driver).move_to_element(link).click(link).perform() as orenthal indicated, found link being clicked. however, page loaded dynamic, sleep of @ least 2 seconds needed occur before attempting extract link.

javascript - Change Background Image in a loop -

to me, seems simple idea- when click div, background image of div changes. far, i've tried colors (put color names in array, change "box.style.backgroundimage" "box.style.backgroundcolor") works fine colors, not images. idea why? javascript: var box = document.getelementbyid('box'), imgs = ['/image.jpg', '/image2.jpg']; box.onclick = function () { img = imgs.shift(); imgs.push(img); box.style.backgroundimage = img; }; html: <div id='box'></div> css: #box { background: url("https://priteshgupta.com/wp-content/uploads/2011/06/html-ipsum.png"); width:200px; height:200px; margin:50px; } you still need url("...") : box.style.backgroundimage = 'url("' + img + '")';

Test php file does not output to stdout from CLI on server (works locally) -

the question not "how fix error" "how output shown on server, on local install?" i run php file this php test.php locally error , warning outputs. on server operated devops, no output of same file. guess php.ini value set different? knows how undo that? in both cases file execution fails. file <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); require(__dir__ ."/../../../bootstrap.php"); ?> teststring <?php die("bye"); ?> now running on server no output. nothing. running on local computer get: notice: undefined index: http_host in /var/www/html/myapp/wp-includes/ms-settings.php on line 38 call stack: 0.0009 392912 1. {main}() /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:0 0.0010 395888 2. require('/var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php') /var/www/html/myapp/wp-content/themes/

linux - bash script if statement not displaying true -

i trying quick script check file system prior running resize2fs. #!/bin/bash var2=$(dumpe2fs -h /dev/mapper/mylv | grep "filesystem state:") var1=test echo $var1 echo $var2 if [ "$var2" = "filesystem state: clean" ]; echo "clean" else echo "dirty" fi my results server1:~ # ./filesystest.sh dumpe2fs 1.38 (30-jun-2005) test filesystem state: clean dirty it seems though var2 in fact "filesystem state: clean" still shows false. you have characters (maybe spaces) in var2 . instead of saying: if [ "$var2" = "filesystem state: clean" ]; say: if [[ "$var2" =~ "filesystem state: clean" ]]; edit: in fact, entire script can written as: dumpe2fs -h /dev/mapper/mylv | grep -q "filesystem state: clean" && echo "clean" || echo "dirty"

web applications - BuildError while using routing with variables -

from flask import flask, render_template app = flask(__name__) @app.route('/') def home(): return render_template("home.html") @app.route('/about/<name>') def about(name): return render_template('about.html') if __name__ == '__main__': app.run(debug=true) when go to: http://localhost:5000/about/abc this code gives me: builderror: not build url endpoint 'about'. did forget specify values ['name']? what doing wrong ? the solution add name=name in layout.html about.html inherits. don't understand whats happening here. <li><a href="{{ url_for('about', name=name) }}">about</a></li> it sounds failed create about.html in templates folder. make sure folder called templates , in same directory python code.

jquery - issue on Node.js - the app hangs on 0.0.0.0:8080, not on localhost -

i'm using blueimp fileuploader node.js back-end. app seems run - output test data console.log, when doesn't seems hang on right ip. http://d.pr/i/iqyw also complicated fact run node.js through vagrant-virtualbox linux virtual machine (on windows, can't use pure linux @ moment). would appreciate kind of help.

oop - What is encapsulation in context of JavaScript? -

what encapsulation in context of javascript? i'm confused after reading statement in mozilla web-site( link ): encapsulation in previous example, student not need know how person class's walk() method implemented, still can use method; student class doesn't need explicitly define method unless want change it. called encapsulation, every class inherits methods of parent , needs define things wishes change. i've understood encapsulation hiding class members, in example on mozilla site seems simple inheritance. it means don't have able build tools you're using use them. it's makes programming lot less stressful when can abstract things away. have ever used alert() method in javascript? i'm sure you'd feel bit overwhelmed if had care how alert communicates browser, , how browser communicates display , layers in-between. you don't want worry bezier curves used render fonts or how implement ok button

ios - PrepareForSegue Swift -

i have nsuserdefault set in viewcontroller , part of in viewdidload if (txt1totaldefault.valueforkey("textfield1total") != nil){ textfield1total = txt1totaldefault.valueforkey("textfield1total") as! double let t1total = nsstring(format: "textfield1total: %i", textfield1total) } then have segue @ bottom of code override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { var destviewcontroller : secondviewcontroller = segue.destinationviewcontroller as! secondviewcontroller destviewcontroller.totalmoneylabel.text = t1total} but not work because not recognise t1total, how recognise or out of if statement can read value correctly t1total should class variable. in case method variable, because of t1total not accessible in prepareforsegue method. pseudo code class yourclass { var t1total = "" override func viewdidload() { if (txt1totaldefaul

Exception in thread java programming error -

i trying run java program find if number palindrome or not @ time of compilation getting error message - exception in thread "main" java.lang.error: unresolved compilation problem: method must return result of type boolean. below program code : package testing; import java.util.scanner; public class palindromenumber { public static void main(string[] args) { system.out.println("enter number check if palindrome or not :"); int number1 = new scanner (system.in).nextint(); if(palindromecheck(number1)) { system.out.println("number " +number1+ " palindrome."); } else { system.out.println("number " + number1 + " not palindrome."); } } public static boolean palindromecheck(int number) { int palindrome = number; int reverse = 0; while (palindrome !=0) { int remainder = palindrome % 10; reverse = reverse * 10 + remai

http - REST server file browser with resume capability -

i want develop rest server file manager resume capability using .net core webapi. have: get api/filemanager/path/to/directory: returns json content of directory (subdirectories , files) get api/filemanager/path/to/file.txt: download file resume capability (e.g. range: bytes=0-1023) head api/filemanager/path/to/file/or/directory: returns empty 200 if file or directory exists, if not returns empty 404 put api/filemanager/path/to/file.txt (with file content in body): upload file delete: delete file or directory if exists now struggling other functions such rename or compress questions: how can implement "rename" (which includes move case) file or directory function rest? put or patch? thinking input have contain new full name of file/directory how can implement "compress"? client send json body containing files , directories added zip file. none of verbs sounds suitable, example, if use post, not able differentiate file upload am missing in impleme

php - Why query column return zeros when connect with ODBC connection to MS SQL? -

i want values cloud server on mssql running. use odbc connection in php data. numeric field called balance in cloud return 0 values in myside have non 0 values. have check the datatype return cloud, , float.here code fetch data. <?php $select_total_outstanding = "select custcode,custname,balance as_vwcustomer"; $result = odbc_exec($conn1, $select_total_outstanding); ?> <table> <tr> <th>custcode</th> <th>custname</th> <th>balance</th> </tr> <?php while (odbc_fetch_row($result)) { echo '<tr>'; $field1 = odbc_result($result,1); $field2 = odbc_result($result,2); $field3 = odbc_result($result,3); echo '<td>'.$field1.'</td>'; echo '<td>'.$field2.'</td>'; echo '<td>'.$field3.'</td>'; echo '</tr>

ios - getting Firebase Cloud messaging running swift -

i following google's instructions on setting firebase https://www.firebase.com/docs/ios/quickstart.html suspect problem may because legacy version. deprecated should not read error, @ least have found apple deprecations. following code: import uikit import firebase class firstviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() var myrootref = firebase(url:"https://<your-firebase-app>.firebaseio.com") // write data firebase myrootref.setvalue("do have data? you'll love firebase.") // additional setup after loading view, typically nib. } gives following error cannot call value of non-function type 'module<firebase>' from link, exact same code prescribed. have installed pods firebase , firebase cloud messaging. cannot call value of non-function type 'module' the error saying imported module named firebase here: import uikit import firebase and trie

amazon web services - React Native upload to S3 with presigned URL -

been trying no luck upload image s3 react native using pre-signed url. here code: generate pre-signed url in node: const s3 = new aws.s3(); const s3params = { bucket: bucket, key: filename, expires: 60, contenttype: 'image/jpeg', acl: 'public-read' }; return s3.getsignedurl('putobject', s3params); here rn request s3: var file = { uri: game.picturetosubmituri, type: 'image/jpeg', name: 'image.jpg', }; const xhr = new xmlhttprequest(); var body = new formdata(); body.append('file', file); xhr.open('put', signedrequest); xhr.onreadystatechange = () => { if(xhr.readystate === 4){ if(xhr.status === 200){ alert('posted!'); } else{ alert('could not upload file.'); } } }; xhr.send(body); game.picturetosubmituri = assets-library://asset/asset.jpg?id=a282a2c5-31c8-489f-9652-7d3bd5a1faa4&ext=jpg signedrequest = https://my-bucket.s3-us-west-1.amazonaws.

javascript - nyromodal doesn't pass text area val() in afterShowCont callback -

i trying provide character count of text area after modal box pops , unable work no matter counter library use. if move textarea outside of nyromodal counter works expected. after debugging bit appears inside jqeasycounter library there call .val() of textarea ('comment') in example , value returns 0. think not using callback correctly, or need pass on additional. $('.nyromodal').nyromodal({ callbacks: { aftershowcont: function(nm) { $('#comment').jqeasycounter(); } } }); u may have imported jquery file more once may <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> and may have included like <script type="text/javascript" src="js/jquery.min.js"></script> so work when remove lower 1 ... dont remove upper 1 because nyromodal working on version ... hope work ... let me know i

git - Accessing TortoiseSVN file:// repository with http:// or https:// -

i have lot of existed local svn repositories on windows pc , tortoisesvn on it. use netbeans ide developing. have problems svn after updates of netbeans , tortoisesvn . as see projects configured use file:// access repositories, , looks problems connected using such way of repository path. can somehow use http:// ( https:// ) oriented paths existed local repositories? or can't , must install visualsvn , create new repositories? in best case need solution resolve problem existed repositories , not create new repos. yes, should install http(s) capable subversion server such visualsvn server able access repositories on http(s) locally or remotely.

css - Image resizing issue when keyboard open in android mobile -

Image
thanks reading, new in cordova developing, use framework7 develop hybrid app using cordova. putting background on login form, in mobile when open keyboard writing background image resized. want fix position of image not resized when open android keyboard. please see image below thanks try these configuration index.html <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width, height=device-height"> config.xml <preference name="android-windowsoftinputmode" value="adjustpan" /> <preference name="fullscreen" value="false" />

graph databases - Duplicate Vertices and Edges in OrientDB -

i making code fetch data remote database , store in orientdb server. example if vertex not present should created else should overwritten. similar support needed edges. using java api this(graph api) . can tell me best method this.thanks advance. i found easy way this: iterable<vertex> vv=graph.getvertices("name", "c++"); iterator it=vv.iterator(); if(it.hasnext()) { result="exists"; } else result="not exists"; it checks iterator size.

path - Python Import From Specific Location (Multiple Libraries Installed) -

i have installed library (mylib) default installation directory /usr/bin/... , then, installed same library different folder using: python setup.py install --prefix=/tmp/python/ so, right now, have 2 same library installed on different folders. however, don't want delete either of them. want call version /tmp/python/mylib, how in python script. #pseudo code mypath = "/tmp/python/" import mypath.mylib ... you do: import sys sys.path.insert(0, '/tmp/python/') import mylib or change environment variable path when run script: $ path=/tmp/python/ you_script but better use virtualenv . , virtualenvwrapper maybe.

Ruby 2 syntax, $ ` -

i've sound chunk of code, , can not understand syntax. , can not make search. code is keys.map { |k| k =~ /\./; $` } what mean $` ? tried play in console, did not understood how works when using regex match string, $` matches string before current match. so: irb> "hello world".match(/world/) => #<matchdata "world"> irb> $` => "hello " i should add ruby doc reference: http://ruby-doc.org/core-2.0.0/doc/globals_rdoc.html more info: if use 'english' library , ` can replaced word prematch: irb> "hello world".match(/world/) => #<matchdata "world"> irb> $` => "hello " irb> $prematch => nil irb> require 'english' => true irb> $prematch => "hello " irb>

python copy all files larger than x then rename all new files -

i need script copy files larger 5mb given folder new folder script needs create on desktop. needs rename files in increasing order changing extension. example files: slides.ppt, math.doc, essay.docx to:lec1.doc, lec2.doc, lec3.doc i got script work , lists files larger 5mb: import os # directory interested in mypath = "c:\asd" # min size of file in bytes mysize = '5000000' # file paths stored in list fileslist= [] path, subdirs, files in os.walk(mypath): name in files: fileslist.append(os.path.join(path, name)) in fileslist: # getting size in variable filesize = os.path.getsize(str(i)) # print files meet condition if int(filesize) >= int(mysize): print("the file: " + str(i) + " is: " + str(filesize) + " bytes") now prints out list , list correct how can go here? looked os , glob i'm having hard time figuering out. thank guys helping out. dany try shutil package. han

json curl in php displaying http error 500 -

i have below json output: {"productname":"provision items","items":[ {"tea":"milo","price1":1242,"price2":1500}, {"milk":"cowmilk","price1":8031,"price2":8922}, {"sugar":"st. louis","price1":9062,"price2":9852}]} here trying post data make updates using code below. displays error: the mysite.com page isn’t working mysite.com unable handle request. http error 500. i think error lies within content of items properties. can me fix that. thanks code $data = array("productname" => "new updates of provision items", "items" =>[{"tea":"milo","price1":1242,"price2":1500}, {"milk":"cowmilk","price1":8031,"price2":8922}, {"sugar":"st. louis","price1":9062,"price2":9

python - How to access parse.com REST API after migrating to local server? -

i have been using parse project server , have migrated data local server, made dashboard work; cannot find way access api.parse.com/1/ api. i used use python make rest requests , establishes socket connection api.parse.com @ port 443 . trying connect localhost @ port 1337 parse-server instance running. however, have not been able access api same before. one thing note can curl basic json response requests curl -x -h ... http://localhost:1337/parse/classes/_user the question connection replaces api.parse.com locally held parse-server instances? ahh found out answer: you make socket connection address , port parse-server running, , instead of doing conn.request("get", "/1/login?%s"%...) you do: conn.request("get", "/parse/login?%s"%...) hope helps.

mysql - How to execute this LOAD XML INFILE SQL query? -

i have table in place i'm trying populate using data external xml file. i'm using load xml infile function it, using query below. i'm getting #1290 - mysql server running --secure-file-priv option cannot execute statement , query unable execute. can please enlighten me needs done can execute it? here's query reference. load xml infile 'c:\\users\shubham\desktop\part_info.xml' table dbtest.part_no rows identified '<row>'; i'm answering own question found answer myself. for specifics, i'm working on windows , installed mysql in-part general wamp installation. i tried solution @miket (in comments above) suggested. workaround mentioned was to move file want import directory specified secure-file-priv brought sql query show variables "secure_file_priv"; however error (for me atleast) still persisted. error resolved (again, me atleast) using forward-slashes instead of backslashes using file path, indicate

java - Linked List sort -

i saw response https://stackoverflow.com/questions/37538652/adding-an-element-to-a-sorted-list-and-keeping-it-sorted-in-ascending-order-jav thread. how find position of inserting element? i'm school student trying linked lists first time can understand @ beginning or end how find right position when have sequence? public void insertfirstposition(int newelement) { listofnversion03 temp = new listofnversion03(thisnumber); temp.next = next; next = temp; thisnumber = newelement; } many thanks. i expect list have sorted ... then iterate loop 1 link next. while iterating store previous node. when find first node worst node want insert. change previous node next inserting node , inserting node references current node. // pseudocode node previousnode = root; while (previousnode.next != null) { node current = previousnode.next; // check current node if (current.value < insert.value) { previousnode.ne

java - Sqlite group dates by day -

i'm trying retrieve list of different days table. stored in integer. cal.gettime().gettime() returns number of milliseconds since january 1, 1970, 00:00:00 gmt represented date object. what i've written select strftime('%d-%m-%y'," + date_clmn + ") " + table_name +" group strftime('%d-%m-%y'," + date_clmn + ")" next, convert these values tostring. get: 24-11--471 and after when try make query strftime('%d-%m-%y',date_clmn)=24-11--471 i nothing. what's wrong? will run in trouble timezone using way? if there other ways make it, i'll glad hear you. thanks in advance. update tried "date(" + date_clmn+ ",'unixepoch')" retrieved value "1970-01-01" since not storing date in table, need change field. try code: "select strftime('%d-%m-%y'," + date_clmn + "/1000,'unixepoch') " + ta

How to do git squash commits with given commit messages -

i have several "save point" commits , squash them have more readable timeline. here situation: > git log 29a94be3d2d4f added feature 9bf0f2730234e savepoint << pushed here 240e1ce8893e9 add ignore rule 01462e889d416 savepoint 6238e3b775027 fixed << pushed here 0d485486a42a9 update version ...... 06ad9e4fc5f64 savepoint 1462e57657434 initial commit and have 29a94be3d2d4f added feature 240e1ce8893e9 add ignore rule 6238e3b775027 fixed 0d485486a42a9 update version 1462e57657434 initial commit is there way script this, can say: git squash -commits-with-log="savepoint" ~from_initial_commit update: seems trick in git_sequence_editor variable

c++ - Converting a uint8_t to its binary representation -

i have variable of type uint8_t i'd serialize , write file (which should quite portable, @ least windows, i'm aiming at). trying write file in binary form, came accross working snippet: uint8_t m_num = 3; unsigned int s = (unsigned int)(m_num & 0xff); file.write((wchar_t*)&s, 1); // file = std::wofstream first, let me make sure understand snippet - takes var (which unsigned char, 1 byte long), converts unsigned int (which 4 bytes long, , not portable), , using & 0xff "extracts" least significant byte. now, there 2 things don't understand: why convert unsigned int in first place, why can't like file.write((wchar_t*)&m_num, 1); or reinterpret_cast<wchar_t *>(&m_num) ? ( ref ) how serialize longer type, uint64_t (which 8 bytes long)? unsigned int may or may not enough here. uint8_t 1 byte, same char wchar_t 2 bytes in windows, 4 bytes in linux. depends on endianness. should avoid wchar_t if porta

Google Drive AppData Folder is not the same on different devices -

i have problem syncing data on google appdatafolder. install identical app on 2 of devices , check in log file. show driveids of app data folder not same. , because folder ids different, different.therefore 2 devices not communicate data each others, use same google email account login on both. is correct google drive appdata folder? or have done sth wrong data not synced? wonder if re-flash device different firmware, appdata folder id still same? if it's different, google drive solution waste of time.

windows - Batch scripting failed string comparison -

debugging script below "rpmbuild.bat". note: contains bugs, not complete . command line: rpmbuild.bat -bb --target "noarch-pc-windows 7" --buildroot d:\mypath\myapp\buildroot --define "_topdir d:\mypath\myapp" myapp.spec the idea take above ".bat" cmd parameters, modify them , redirect (via cygwin) unix tool same name (rpmbuild). have smth like: bash -c "rpmbuild -bb --target ""noarch-pc-windows 7"" --buildroot /cygdrive/d/mypath/myapp/buildroot --define ""_topdir /cygdrive/d/mypath/myapp"" myapp.spec" for transforming paths proper way, there utility cygpath . below source of rpmbuild.bat . fails compile on line string comparison proposed here setlocal enableextensions enabledelayedexpansion pushd . set param_count = 0 %%p in (%*) ( set /a param_count += 1 set params[param_count] = %%p if param_count gtr 1 if params[param_count-1]=="--buildroot" ( r

Invoke JavaScript function using "onclick" in php -

this question has answer here: call php function javascript 5 answers on clicking text, js function should executed. in html : <html> <body> <a href="#" onclick="clickthis();">table 1</a> </body> </html> in php : <?php require 'dbconnect.php'; function clickthis(){ $search_table = "select `table1` `booktable` `table1`='booked';" $query = mysqli_query($dbconnect,$search_table); if(mysqli_num_rows($query)==0){ "insert `booktable` (table1`) values(`booked`)"; echo'table booked successfully.'; ?> have placed onclick function correctly in html ? whenever click on text table 1 , clickthis() function should executed how can achieve result using php, javascript & html . p.s. i don't want use button click & dbconnect.php external php file.

ruby - Can't install rails-assets-tether -

when try install rails-assets-tether , error. retrying fetcher due error (2/4): bundler::fetcher::certificatefailureerror not verify ssl certificate http://rails-assets.org/. there chance experiencing man-in-the-middle attack, system doesn't have ca certificates needed verification. information openssl certificates, see http://------/ruby-ssl. connect without using ssl, edit y our gemfile sources , change 'https' 'http'. this part of gemfile: # bootstrap gem 'bootstrap', '~> 4.0.0.alpha3' source 'https://rails-assets.org' gem 'rails-assets-tether', '>= 1.1.0' end changing https http didn't work me. i'm using windows 10 here solution of problem https://gist.github.com/fnichol/867550

database - How to import a MySQL db to OpenShift? -

i've been working on jsp project , want host in on openshift. set except database. added mysql 5.5 cartridge , phpmyadmin 4.0 , edited credentials in project shown below. how can upload database data application? constants in project apparently, key replace variables in db url the openshift variables .

formatting - How to do form block letter printing? -

Image
i want print in block letters in jasper print. e.g. have bank format , want name come in boxes. how 1 that? name: [f][i][r][s][t][ ][n][a][m][e] option1 - print cell cell ${first_name}.charat(x) - unsustainable option2 - add spaces between characters changes based on font size option3 - add padding spaces end of text. stretch text full width available , characters distributed equally - how 1 this? this normal achieved using monospaced font . if achieve other fonts or spacing large can use subreport (that called every time need fixed space) example main report (i'm using parameter test) call subreport datasource contains each letter, i'm using $p{testtext}.split("") , since char[] not allowed in jrbeanarraydatasource . note: split give empty first string in java7 not in java8 <?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xs

parse.com - Parse server setup -

i have setup parse server on local machine, following instruction guide, should next step how use send push notification. suggest ways use parse sever, can see functionality of parse server setup on machine take @ how implement push notifications parse-server : https://github.com/parseplatform/parse-server/wiki/push

azure - How to update existing AzureRm virtual network using PowerShell? -

context i have existing rm virtual network, , add new subnet using powershell: # create subnet config: $besub = new-azurermvirtualnetworksubnetconfig -name $besubname -addressprefix $besubprefix # vnet $vnet = get-azurermvirtualnetwork -name $vnetname -resourcegroupname $vmresourcegroup # add subnet: add-azurermvirtualnetworksubnetconfig -name $besubname -addressprefix $besubprefix -virtualnetwork $vnet all commands run no subnet added virtual network. what i've try far: originally i've thought there should update-azurermvirtualnetwork , there no such command. i've searched new-azurermvirtualnetworksubnet, has -virtualnetwork $vnet parameter no success. question how can add new rm subnet existing rm virtual network? you close. you're creating config not getting applied. script below you. # vnet $vnet = get-azurermvirtualnetwork -name $vnetname -resourcegroupname $vmresourcegroup # add subnet config vnet: add-azurermvirtualnetwork

java - How to write a recursive method to promote a String to all possible combinations, With no loops or arrays? -

public password(int length)//a constructor creates random password in given length public boolean ispassword(string st)//retruns true if string equals password. i need make recursive method... crack password... contains lower-case letters. can use: ispassword(),(charat, equals, length, substring) no loops, no arrays... this ive done far, got "a" string right length: /** * recursive method, cracks , return * right string of password p. * @param p password object crack. * @param length length of password. * @return string combination of password. */ public static string findpassword(password p,int length) { string astring;//to store "aaa.." string in length of p string password;//to store password astring = findpassword("a",length);//recursion method, gets string of in length password = findpassword(astring, p, 0);//recursion method, finds password return password; } public static string findpassword(string startstring,

c++11 - What does this c++ function mean? -

template <typename r, typename t> deferred<future<r>()> defer(const pid<t>& pid, future<r> (t::*method)()) { return deferred<future<r>()>([=]() { return dispatch(pid, method); }); } what (t::*method) mean? know what's t here. never seen *method . preceding * has got me confused. the function body seems pretty complicated. love understand syntactically breaking down each part. looks me lambda though. what (t::*method) mean? know what's t here. never seen *method . preceding * has got me confused. future<r> (t::*method)() is member function pointer parameter named method . it's expected address of member function of t signature future<r> func(); . the function body seems pretty complicated. love understand syntactically breaking down each part. looks me lambda though. it lambda function call, yes. lambda body calls dispatch() , passes on pid , method parameters.

ios - What is the best practice to add validation code on a Back button action in a UIViewController? -

i have uiviewcontroller created via instantiateviewcontrollerwithidentifier. in controller, user may enter text need validate before saving. there button user clicks , trigger save. if there error, not allow user go back. best practice this? read stackoverflow , solution seems overriding uinavigationcontroller, think sort of hack. cannot put code in willmovetoparentviewcontroller since there no return of true or false. still proceed. you can use extension. this answer seems solve problem.

android - Spinner with default icon + arrow -

Image
assuming spinner , how set default icon? currently, mine shows icon of first item (bluetooth) i believe specific example shareactionprovider , special sublcass of actionprovider if adding actionprovider in xml menu can treat menu item , add icon. from actionprovider documentation: <item android:id="@+id/my_menu_item" android:title="title" android:icon="@drawable/my_menu_item_icon" android:showasaction="ifroom" android:actionproviderclass="foo.bar.someactionprovider" /> since haven't used these don't know enough know if actionprovider s have spinner corner triangle... guess yes? upadte: i thinking how spinneradapter works , there way this. if using custom subclass of spinneradapter in spinner have 2 methods , following: @override public view getdropdownview(int position, view convertview, viewgroup parent) { // return view display when looking @ dropdown, // textview and/o

ruby on rails - "heroku logs" gives me "Not found" -

on latest deployment heroku rails app, i'm getting error page when trying access webpage. nothing spectacular this, when try @ logs command heroku logs i message not found this has never happened me before. can restart app, can migrations not see logs - clues going on? try doing heroku logs -a my-heroku-app-name replacing my-heroku-app-name whatever heroku app's name is. can found in heroku web interface.

javascript - Videojs flash api currentTime -

how can set currenttime in videojs when browser not support html5 use flash. if browser support html5 code good: player.on("loadeddata", function(){ player.currenttime(current_video.sec1); player.play(); }); any ideas?

javascript - Disadvantage of having inline JS -

i wondering paragraph meant? it taken website disadvantages inline scripts poor accessibility : when comes inline javascript code, such in above example, it’s applied element doesn’t have built-in fallback interaction handler link: https://robertnyman.com/2008/11/20/why-inline-css-and-javascript-code-is-such-a-bad-thing/ <div style="width: 800px; margin: 1em auto; font: bold 1em/1.2 verdana, arial, helvetica, sans-serif"> <div style="float: left; width: 400px; padding: 1em 2em; font-size: 0.9em"> <span id="get-shit" onclick="callsomefunction()">news</span> </div> </div> he saying in above function if callsomefunction, redirects page other page... reason(due network error can't load) callsomefunction isn't loaded in page, dead link nothing, rather should implemented in such way without javascript should work reasonably... even browser provides configuration

objective c - how can I retrieve values from NSMutableArray having object with multiple values -

i have nsmutablearray has 4 objects, , each object has further elements in it, want retrieve elements i.e. object @ index 0 has 15 values( ns strings) same rest of 3 objects i don't know syntax of how can read values below syntax have tried gives me error: for(int i=0 ; i<[array count] ; i++) { (int j=0 ; j<[array[i] count] ; j++) { /// reading code here } } very simple example 2 inner arrays containing 3 items respectively , fast enumeration: nsarray *array = @[@[@"1", @"2", @"3"], @[@"4", @"5", @"6"]]; (nsarray *subarray in array) { (nsstring *item in subarray) { nslog(@"%@", item); } }

mongodb - mongo - $inc incrementing by 2 instead of 1 using meteor methods -

meteor method:- incrementcount: function(toperson){ meteor.users.update({'emails.0.address': toperson}, {$inc: {'profile.notificationcount': 1}}); } meteor method call:- meteor.call("incrementcount", message.to); the issue on first load notificationcount increments 2, loads afterwards increment accurately 1. i have searched docs mongodb solutions did not have success. thank in advance responses.

PHP: search comma separated string in mysql? -

i have mysql query looks mysql find like strings , displays result. within same mysql query, have 2 like . 1 single string , other 1 can single , multiple strings separated commas. when use code, no results @ though have fields in mysql database , have search strings in columns. this code: $area = 'london'; $res = 'santandar, hsbc, rbs, '; $sql = "select * banks location '%$area%' , name '%$res'"; i tried preg_match , didn't return anything: $sql = "select * banks location '%$area%' , name '".preg_match($res)."'"; if remove second , code looks below, works fine: sql = "select * banks location '%$area%'"; so issue starts when try search using comma separated string. could please advise on issue? edit: the php varibles posts can in each post. they so: $area = $_post['area']; $res = $_post['res']; you going need blow out separate l

javascript - Start/stop fixed position HTML JS -

i have div positioned: relative , when scrolled down become fixed. however, start can't seem code work in way start 1 point , stop @ point. here example airbnb. https://www.airbnb.co.uk/rooms/13402355?s=9usqc8q_ (right handside booking) maybe of have done already? appreciate help! jsfiddle https://jsfiddle.net/cyfb6s8t/1/ thank time! you adding class called "fixed". that's not in css linked. also, consider using .css() make few modifications: .css("position": "fixed", "top": "0", "left": "0") i believe work.

xpages - Does anyone know a way to get rid of sticky tooltips in Domino Designer 9.0 w/o restarting the application? -

Image
i don't know if me, have issue tooltips sticking on screen. these tooltips activated hovering in domino designer 9.0. problem don't go away, not everytime, far often. can't figure out how make them go away short of restarting designer. annoying. see example of stuck tooltip still visible in chrome while typing in question. btw, have 8gb ram, , optimized memory per instuctions in matt white/tim clark presentation. am alone here? has figured out workaround? i thought me use designer through rdp (ah joys of having mac.) of times can hit esc , remove dialog. please let me know if works you.

java - How to upload a file to a specific folder in struts 2 -

i want upload file struts action. need in action path folder: i tried using string contextpath = request.getcontextpath(); but i'm getting java.lang.nullpointerexception either store in catalina parent folder project folder string rootpath = system.getproperty("catalina.home"); file dir = new file(rootpath + file.separator + "yourfoldername"); if (!dir.exists()) dir.mkdirs(); // create file on server java.util.date date= new java.util.date(); string path = dir.getabsolutepath() + file.separator + (new timestamp(date.gettime())).tostring().replace(":", "").tostring().replace(".", ".").tostring().replace(" ","").tostring().replace("-","").tostring()+".pdf"; or make folder in project , store there. if (!file.isempty()) { //filter checking file extewnsion if(file.getcontenttype().equalsignorecase(&q