Posts

Showing posts from September, 2013

multithreading - Block thread while uploading picture to Amazon S3 on Android -

is there way block current thread , wait while picture uploaded s3? my code uploading s3 running in android service in doinbackground() method (with other network calls have in specific order), it's off main ui thread. want know when uploading done, can dismiss notification , show user uploaded/done. i'm using sdk v2, this: transferutility transferutility = new transferutility(s3, ctx); transferobserver obs = transferutility.upload( s3bucketnamephototest, imageid + ".jpg", file, new objectmetadata()); obs.settransferlistener(new uploadlistener(dbhandler, ctx, imageid)); where uploadlistener class implementing transferlistener, in onstatechanged() method can detect when upload finished: public void onstatechanged(int id, transferstate state) { if (state == transferstate.completed) { //do here! } } that's not need, because service call long done when onstatechange() callback fires. but loo

javascript - How to make sure that the element is not visible and proceed with the next conditions in protractor -

i testing element when user selects radiobutton, loading image appear in middle, , invisible after few seconds. when loading image disappears, should show login screen , other conditions. below protractor code: it('displays small login screen', function () { var loadpanel = element(by.id("loadingimage")); var el = loadpanel; browser.driver.wait(protractor.until.elementisnotvisible(el)); smalllogin = element(by.id('loginscreen')); browser.wait(ec.presenceof(smalllogin), 30000); expect(smalllogin.ispresent()).tobe(true); element(by.id('dropdown')).click(); this doesn't work, passes. want loading image hidden , until visible, small login condition should not executed. happens executes small login condition , dropdown click well, while image still visible. thanks. the expected condition want use invisibilityof : var ec = protractor.expectedconditions; // select radiobutton var loadpanel = element(by.id(

c - What is TpCallbackMayRunLong()? -

i gettign segmentation fault in function have no idea does,why segfaults, or code calls it. can shed light? c code in windows using netbeans ide , mingw toolchain. [update] normally, @joachimpileborg suggetsed, when teh segmentation fault happens, call stack not include code. in fact, reads ntdll!tpcallbackmayrunlong () ?? () ntdll!tpcallbackmayrunlong () ?? () and ?? () evaluate zero! i guess, form name, tpcallbackmayrunlong() being called during idle time, system, , not code. i never did find out causing this, name of function guessed didn't blocking wait ( timeout = zer0 ), set timeout 20 seconds , works fine. i know sender transmit constantly, 20 seconds enough time synch startup of sender & recevier. ymmv

mysql - PHP Script runs fine in browser but not through Command Line -

i'm using xampp on windows 7. have following simple script <?php require("classes/autoloader-class.php"); $query=new login(); $query->query("insert poupdate(`po`, `fval`, `nr`, `fsa`, `act`, `doctype`, `usr`) values ('po','fval','nr','fsa','act','doctype','user')"); ?> script runs fine in browser , records inserted in database when try through following php command no records inserted d:\xampp\php\php.exe -c -f d:\xampp\htdocs\mytest\test.php when echo output text in command line; think there problem mysql no error. please note -c being used load libraries php.ini how can troubleshoot ? in advance [following command helped me in executing command] d:\xampp\htdocs\mytest>d:\xampp\php\php.exe -c -f test.php just thought. directory working path when execute via command line? is: "standing" when execute command? try moving mytest folder first. >

Line plot with R with categorical data -

i have dataset variables; subject, group, gender, pretest, posttest, fu_6_month, fu_12_month subject group gender pretest posttest fu_6_month fu_12_month 1 2 2 118.826601098386 93.7242226833558 45.9022982619128 87.5922938477103 2 2 2 61.076151378316 37.4269190073656 74.0550780537479 125.065288560879 3 2 2 57.5102273980161 77.8629614597533 75.57281055525 47.6327188844442 4 2 2 70.7363734703855 9.66991124269437 89.3449482258492 108.293657994293 5 2 2 9.86907880058945 -10.3608782428914 -37.5688442618089 -75.0331616314858 6 2 2 64.5157954624921 16.5509079527419 41.8441716919839 62.281296652626 7 2 2 63.2566934190156 55.7464724092843 19.0693261189747 59.9351530137349 8 2 2 109.093548562172 31.718921929317 39.6937442573627 52.4519409887752 9 2 2 140.693405017245 140.524720621573 77.5230524280486 134.207295832318 10 2 2 93

c - Split string into tokens and save them in an array -

how split string tokens , save them in array? specifically, have string "abc/qwe/jkh" . want separate "/" , , save tokens array. output such that array[0] = "abc" array[1] = "qwe" array[2] = "jkh" please me #include <stdio.h> #include <string.h> int main () { char buf[] ="abc/qwe/ccd"; int = 0; char *p = strtok (buf, "/"); char *array[3]; while (p != null) { array[i++] = p; p = strtok (null, "/"); } (i = 0; < 3; ++i) printf("%s\n", array[i]); return 0; }

java - How do I selectively reset an array's dimensions? -

this question has answer here: abstracting dimensionality of arrays in java 6 answers i have abstract class sprite , which, in constructor, creates array individual sprites. constructor takes path of spritesheet, spritesheet type enum, , individual sprites' widths , heights. constructor takes path spritesheet, loads bufferedimage, , grabs individual sprites image load them array. here class: package exosoft.zerfall; public abstract class sprite extends main { bufferedimage spritesheet = null; bufferedimage[] sprites; int spritewidth = 0; int spriteheight = 0; public enum sheettype { single, horizontal, vertical, rectangular } public sprite(sheettype type, string sheetpath, int spritewidth, int spriteheight) { try { spritesheet = imageio.read(new file(sheetpath)); } catch (

asp.net - How can i attach my datasource from the database inside a gridview? -

i`m making mumbai local train timings project class project.. how can attach datasource database inside gridview?? sqlcommand cmd; protected void page_load(object sender, eventargs e) { } protected void button1_click(object sender, eventargs e) { con.open(); cmd = new sqlcommand("select * @d where(select * @c source = @a , destination = @b)",con); cmd.parameters.addwithvalue("@d", dropdownlist3.selectedvalue); cmd.parameters.addwithvalue("@c",dropdownlist3.selectedvalue); cmd.parameters.addwithvalue("@a",dropdownlist1.selectedvalue); cmd.parameters.addwithvalue("@b",dropdownlist2.selectedvalue); //int = cmd.executenonquery(); //if (i > 0) //{ gridview1.datasource = //what shud put here in datasource?? gridview1.databind(); //} } just thing this: con.open(); sqlcommand cmd = new sqlcommand("select * @d where(select * @c source = @a , destination = @b)"

java - Is it possible to omit some annotation attributes but not all? -

in java tutorials - annotations part, question 3 ( https://docs.oracle.com/javase/tutorial/java/annotations/qande/questions.html ), annotation expected used below: @meal("breakfast", maindish="cereal") i tried define annotation below not allow above usage. public @interface meal { string value(); string maindish(); } is possible omit first attribute name question suggested? no, shortcut works if specify value attribute , nothing else. otherwise must explicitly write value= , correct version @meal(value = "breakfast", maindish = "cereal")

bash - How to use detect failure in command substitution -

as know set -e useful discover failure when command executed. found delicate use , don't know how use in following scenarios: ==============first example================================ set -e function main() { local x1="$(exp::notdefined)" echo "will reach here : ${lineno}" x2="$(exp::notdefined)" echo "will not reach here : ${lineno}" } main ==============second example================================ set -e function exp::tmp() { echo "now '$-' "$-" : ${lineno}" false return 0 } function main() { x1="$(exp::tmp)" echo "will reach here : ${lineno}. '\$x1' : ${x1}" x2="$(set -e ; exp::tmp)" echo "will not reach here : ${lineno}" } main =============================== the first example shows that, if use command substitution on local variable, not fail if command substituted

css - How to center align a specific character throughout an entire page? -

i'm trying center align specific characters in body of text website. center things have "[], *" , roman numerals. there way can center these without having manually set div tag every single one? example, "[e]" here centered on page: [e] the house red thanks! :) i believe not possible since both css , html doesn't have "if" statements, can tell when condition met. you may use < center > tag in html or text-align:center css instead.

JavaFX: How to highlight certain Items in a TreeView -

i trying implement search function treeview in javafx. want highlight matches when user hits enter key. added boolean ishighlighted treeitem , in treecell s updateitem , check whether item ishighlighted , if apply css. works fine items/cells not visible @ moment of search -- when scroll them, highlighted. problem is: how can "repaint" treecells visible @ search reflect whether item ishighlighted ? controller not have reference treecells treeview creates. this answer based on this one , adapted treeview instead of tableview , , updated use javafx 8 functionality (greatly reducing amount of code required). one strategy maintain observableset of treeitems match search (this useful other functionality may want anyway). use css pseudoclass , external css file highlight required cells. can create booleanbinding in cell factory binds cell's treeitemproperty , observableset , evaluating true if set contains cell's current tree item. register liste

android - Take multiple images with camera and insert into multiple diffefent imageViews -

public void onclick(view v) { // todo auto-generated method stub switch (v.getid()) { case r.id.image1: = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(i, cameradata); break; case r.id.image2: ii = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(ii, cameradata); } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); if (resultcode == result_ok) { bundle extras = data.getextras(); bmp = (bitmap) extras.get("data"); view1.setimagebitmap(bmp); view2.setimagebitmap(bmp); } } i take 2 images camera , display these images 2 separate imageviews .i took picture shows same image in both imageviews .please i'm stuck. you can try like: public void oncli

javascript - Recursive Function not working correctly -

i have recusive function supposed loop through json object , output expression. however, recusion seems off because it's outputting field1 != '' , field3 == '' when should outputting field1 != '' , field2 == '' , field3 == '' i've tried couple different things , way can work creating global variable outstring instead of passing function. off? when step through it, see correct result once stack reverses, start resetting outstring , stack again leaves out middle (field2). jsfiddle function buildstring(json, outstring) { var andor = json.condition; (var rule in json.rules) { if (json.rules[rule].hasownproperty("condition")) { buildstring(json.rules[rule], outstring); } else { var field = json.rules[rule].id; var operator = json.rules[rule].operator; var value = json.rules[rule].value == null ? '' : json.rules[rule].value; ou

python 3.x - Reading from subdict in python3 -

i have 2 dict. 1 local player data , 1 listing players subdictionaries: class gamedata: def __init__(self): self.player = {'id' : 1453339642, 'positionx' : 123, 'positiony' : 0 } self.players = {1453339642: {'name' : "admin"} } gamedata = gamedata() then print out check if works: x in gamedata.player: print (str(x),':',gamedata.player[x]) print("\n\n") x in gamedata.players: print (str(x)) y in gamedata.players[x]: print (' ',y,':',gamedata.players[x][y]) print("\n\n") this results in: id : 1453339642 positiony : 0 positionx : 123

SSRS allows to access a secured web service as data source? -

am trying access secured xml web service data source ssrs rdl.but giving error "failed prepare web request specified url". am not sure whether ssrs allows access secured web service data source? thanks ssrs allows https basichttpbinding. in wcf service using wshttpbinding thats why failing.now using basichttpbinding access data source in ssrs report.

xslt - Is it possible to call a function inside an attribute? -

i can't find out how 1 can call extension function in code that: <xsl:if test='string-length(normalize-space(body)) &gt; 100'> <a href='/photo/{id}-'> &gt;&gt;&gt;</a><br/> </xsl:if> i need add call foo:translit(human_url) function after '{id}-' result read '/photo/{id}-{transliterated_part}' , there seems no syntactical correct way so! yes, possible. casually call function wrapped in curly braces, : <a href='/photo/{id}-{foo:translit(human_url)}'> &gt;&gt;&gt;</a> here demo using user-defined function foo:upper-lower() , return upper-case , lower-case version of received parameter, separated underscore : <?xml version="1.0" encoding="utf-8" ?> <xsl:transform exclude-result-prefixes="foo xs" xmlns:foo="bar" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xsl="http://www.w3.org/199

Can you pull network status information from the Softlayer API? -

we interested in using api information found on network > status > local page. does api allow this? thank you yes possible, there no single api call returns result. need routers in account. here code (it using python client) """ network status local script displays same information https://control.softlayer.com/network/status/local page. important manual pages https://sldn.softlayer.com/reference/services/softlayer_account/ https://sldn.softlayer.com/reference/services/softlayer_account/getobject https://sldn.softlayer.com/reference/datatypes/softlayer_hardware """ import softlayer import json def getracks(networkhardware, routerstatus): """retrieves racks information. :param softlayer_hardware networkhardware: network hardware downstream. :param softlayer_hardware routerstatus: routers in account contains network incidents. """ racks = [] if 'downstreamnetworkh

HP Filter Using R -

Image
i loading gdp data r fred , using hp filter find cycle component. struggling add date on x axis. tried converting data numeric or dataframe keep getting "cannot coerced" error message. doing wrong? library(mfilter) library(quantmod) getsymbols('gdp',src='fred') plot(hpfilter(log(gdp),freq = 1600)) you can mimic output of plot.hpfilter : library(mfilter) library(quantmod) getsymbols('gdp',src='fred') hpf <- hpfilter(log(gdp),freq = 1600) out <- xts(cbind(hpf$x, hpf$trend, hpf$cycle), index(gdp)) colnames(out) <- c("x", "trend", "cycle") par(mfrow = c(2, 1), mar = c(3, 2, 2, 1)) plot(out[,"x"], t= "n", main = paste(hpf$title, "of", hpf$xname)) lines(out[,"x"], col = "steelblue") lines(out[,"trend"], col = "red") legend("topleft", legend = c(hpf$xname, "trend"), col = c("steelblue", "r

wpf - Error on calling method in dowork event (background worker) -

i have in code 2 same , big pieces of code, create method , put there. call method 2 times in code, first time , second time want call dowork event (background worker). problem when executes (in dowork) program stops responding... question is.how can call method dowork event? edit: code private void parsehtmlfile(string file) { // here parse html file , fill arraylists. } // event call method on click private void menuitem_newpr(object sender, routedeventargs e) { parsehtmlfile(file);// in case program works well. } // work worker.dowork += (s, e) => { var file = e.argument string; parsehtmlfile(file);// in case program stop responding. } edit 2: changed thing in method , doesn't crash, have problem now. dowork method doesn't executes code exists below method call statement. put breakpoint there , never goes there...

Android Studio doesn't work fine with gradle 2.10 and gradle plugin 2.0.0-alpha5 -

i use com.android.tools.build:gradle:2.0.0-alpha3 , gradle 2.8 before update android studio 2.0 preview 5. works fine. after update 2.0 preview 5,it tells me update com.android.tools.build:gradle:2.0.0-alpha5 , gradle 2.10. i can't build , run app now. uses old copy of code though have changed code , costs more time build. if turn com.android.tools.build:gradle:2.0.0-alpha3 , gradle 2.8.it become right. android studio version ( http://tools.android.com/recent ) android gradle plugin version ( http://tools.android.com/tech-docs/new-build-system ) android studio preview 6 posted on jan 21, 2016. android studio preview 7 posted on jan 23, 2016. you can see android studio preview updates frequently. if don't want deal kinds of bugs, better use stable version. if want use more features, should keep latest version avoid bugs. your problem instant run, because if project builds , apk installs, can't gradle issue. instant run still under development

excel - Check spreadsheet "X.xls" is open? -

is there simple way check whether particularly-named spreadsheet open in current excel session, vba? dim wbook workbook 'check summary worksheet available update. on error goto errhandler set wbook = workbooks("committedsummary.xls") if wbook nothing msgbox("not open") else 'it open msgbox("the 'committedsummary.xls' workbook in use , cannot updated. please try again when workbook available", _ vbcritical, "committed request edit") : exit sub end if errhandler: msgbox("workbooks open"):exit sub

phalcon - How to change recognized file type in PhpStorm 10? -

Image
i did mistake recognizing *.volt file type xml . it's supposed twig file types. i've read on many sources opening menu on "settings->editor->file types". can't find "file types" menu in version nor plus button add file types. must then? know silly question, still make me frustated. thanks soft solution: open settings->editor->file types go xml , find *.volt there. remove it. hard solution: navigate .webide100/config directory , find file content volt . xml file. can remove extention , restart phpstorm.

ios - How to add launch screen for iPhone 5 using Xcode 7 -

i'm trying make launch screens app target ios 9.2 in xcode 7.2. new way of making launch screen iphones 6 , 6s use launch files doing. support iphone 5 , 4s well. apple says in guide 2 phones need use images specified requirements: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/mobilehig/iconmatrix.html i tried use asset catalog add images older iphones. templates not based on iphone model 5 or 4s, based on ios version ios 8, 7, , 6. don't know template use iphone 5 , 4s. in other words ios target right choice phones. thanks! if want support devices , deployment target ios 8.0 or later, need single launch screen file. not need launch images. the launch screen file signal ios app supports iphone sizes , if universal app (or ipad app) signals ios supports ipad sizes.

mysql - Separate 30 into three batches -

Image
there 30 students in classroom. want separate them 3 batches using mysql query in jsp. initially did using below query connection = drivermanager.getconnection(connectionurl, "root", "student"); string querystring = "update student set batch=?,exam=? studentid='"+studentid+"' "; pstatement = connection.preparestatement(querystring); pstatement.setstring(1, batch); pstatement.setstring(2, exam); i don't have privileges comment check if ui sending second student info correctly. query looks ok me.

Rails: How to filter results? -

in index action of users controller, able capture users belonging same city current_user in activerecord::relation object @users . in view able iterate through @users , display results. i'd give current_user further options filter results. want add form , filter button in view, allow current_user select filters, such as: minimum age , maximum age (drop down) religion (drop down of checkboxes) diet (drop down of checkboxes) and on. once current_user makes selections , clicks on filter, results filtered based on criteria selected. want know how build query this? it's relatively simple without library creating scope methods in user model. example: class user def self.filtered_by_age(opts = {}) min = opts[:min] max = opts[:max] user = user.arel_table if min && max self.where(:age => min..max) elsif min && !max self.where(user[:age].gt(min)) elsif max && !min self.where(us

javascript - Using Twilio JS client, how can I call to a number entered in the texbox? -

in order make outbound call browser, followed " https://www.twilio.com/docs/quickstart/php/client/outgoing-calls " link, , can make outbound browser call particular number(which hardcoded behind). but if entering number in text-field, make call number, how can this? please me. for reference have attached screen-shot. screen make outbound call thanks twilio evangelist here. the outgoing calls sample code includes client side javascript grab phone number input field in webpage , include parameter in connect() function: function call() { // phone number connect call params = {"phonenumber": $("#number").val()}; twilio.device.connect(params); } specifically code: $("#number").val() gets value input field named number . one server side, twilio take collection of parameters provide connect function , forward url have specified twiml application url simple form-encoded values. can use php's $_request gl

jsp - Flowgear Sage Evolution How To Add User Define Fields in Document Module -

my question how add multiple user define/custom field sage evolution node in flowgear. [i try add user define field in document module]. in sage evolution node there document module provide userdefinedfields not know how add multiple userdefinedfields. please help. the userdefinedfields element (shown in xml schema) supports number of child userdefinedfieldelements. provide multiple fields, this: <userdefinedfields> <userdefinedfield> <field>udffieldname1</field> <value>value1</value> </userdefinedfield> <userdefinedfield> <field>udffieldname2</field> <value>value2</value> </userdefinedfield> </userdefinedfields>

How can I apply two different rotations to the same Blender object? -

Image
i'm trying build object multiple gears. 1 of gears attached larger gear, when larger gear rotates smaller gear moves too, around center of larger gear. simultaneously, smaller gear rotating - rotation around own center, independent of larger gear. so: larger gear rotates around center smaller gear moves around center of larger gear rotation smaller gear rotating independently i can 1 , 2 animating larger gear's rotation , grouping both gears, can't figure out how smaller gear rotate around own axis it's going around larger gear. any ideas appreciated. the key parenting . create first gear , rotating. create second gear next , animate one. select second gear shift select first gear , press ⎈ ctrl p , select object. now first gear rotates, second follow it's rotation while keeping it's own rotation. if want outer gear rotate opposite way inner gear can place empty @ same location inner gear , use copy rotation constraint , se

javascript - calling parent page function through content script in extension -

my webpage follows: <body> <div class="row"> <button type="button" class="btn btn-primary" id="manual-dial" onclick="dial()";>dial</button> </div> </body> /* dial() function written in js of parent web page */ content.js follows: var phone=document.getelementbyid("manual-dial"); phone.addeventlistener("click",dial, false);/*want call dial function of webpage*/ chrome.runtime.sendmessage(/*send response dial() background.js*/); background.js chrome.runtime.onmessage.addlistener(function(response,sender,sendresponse) { alert(response); }); i want call dial() function of web page extension. how can ?

c++ - Human-readable duration between two UNIX timestamps -

i'm trying calculate difference between 2 unix timestamps (i.e. seconds since 1970). want e.g. "3 years, 4 months, 6 days, etc" don't know how account leap years , months of different durations. surely solved problem..? this different other questions want express approximate duration in 1 unit has fixed/homogeneous duration (e.g. 3 hours, or 7 weeks, etc.). results 1. jan 1. feb "1 month" , results 1. feb 1. mar "1 month" though number of days different. i want express complete duration precisely in years/months/days/hours/minutes. solutions in c++ appreciated! for older date, use leap year formula start counting number of days unix start date, jan1st 1970, first timestamp (for leap seconds, dunno if need precise, out-of-scope?) leap year calculated constraining date after 1600ad , algorithm gregorian calendar from: http://en.wikipedia.org/wiki/leap_year of if year modulo 400 0 is_leap_year else if year modulo 100

How to debugging in chrome on iPad? -

i have been trying debugging chrome on ipad , tried these solutions didn't worked out. nodejs weinre this link might you. afaik need remote. https://developers.google.com/web/tools/chrome-devtools/debug/remote-debugging/remote-debugging

javascript - get and set an text element in a table with a script in indesign -

i looking indesign scripts , have not found topic, think important. here question: - how modify text frame in table in indesign cs6 javascript ? i have try instruction : app.activewindow.activepage.textframes[0]; but doesn't work. thanks in advance! pages have text frame, contains table. tables must anchored within text frame far know. if there text frame within table, need access it: var doc = app.activedocument; doc.pages[0].textframes[0].tables[0].textframes[0]; in other words, need reference text frame twice. 1 text frame contains table , text frame within table.

ios - textViewDidChange Calling two times while Chinese keyboard -

shouldchangetextinrange method working fine while english text not working when chinese keyword entered , because of use textdidchange method chinese text when chinese text enter textdidchange calling 2 times, each string 2 times. what should chinese text? know can chinese text using textview.text use html string in textview, if string using textview.text can't html string. suggest me solution can html string textview both english , chinese text. thanks. try this: [self.pwebview evaluatejavascript: @"document.body.innertext" completionhandler:^(id _nullable result, nserror * _nullable error) { nsstring *astring = result; }];

c - Edit Window stops displaying text after certain limit. (Windows) -

i have developed udp client server application in server continuously reads data 40 different clients , displays on edit window. have automatic scroll enabled on mmy edit window well. code working fine , server continuously receiving data well, after displaying amount of data on edit window, server stops displaying data. apparently looks maximum capacity of edit window full, not sure why happening. can guide might problem be? there limit uptil edit window can display data? waiting :( standard edit controls default max limit of 32767 characters. use em_limittext message set different max limit needed.

php - How to set font face for internet explorer in WordPress? -

i setting font face internet explorer in wordpress all of fonts located inside root directory of child theme. this code in ie-only.css @media screen , (-ms-high-contrast: active), (-ms-high-contrast: none) { @font-face { font-family: 'open_sansregular'; src: url('opensans-regular-webfont.eot'); src: url('opensans-regular-webfont.eot?#iefix') format('embedded-opentype'), url('opensans-regular-webfont.woff2') format('woff2'), url('opensans-regular-webfont.woff') format('woff'), url('opensans-regular-webfont.ttf') format('truetype'), url('opensans-regular-webfont.svg#open_sansregular') format('svg'); font-weight: normal; font-style: normal; } .text-highlight { border: 1px solid red; font-family:open_sansregular; } } do know proper address locate font family in root directory of child theme? any apprecia

c++ - return and call dynamic string array -

i created class: data::data(char szfilename[max_path]) { string sin; int = 1; ifstream infile; infile.open(szfilename); infile.seekg(0,ios::beg); std::vector<std::string> filerows; while ( getline(infile,sin ) ) { filerows.push_back(sin); } } after created this: std::vector<std::string> data::filecontent(){ return filerows; } after call filecontent() somewhere, this: data name(szfilename); messagebox(hwnd, name.filecontent().at(0).c_str() , "about", mb_ok); but doesnt work... how call this? std::vector<std::string> filerows; while ( getline(infile,sin ) ) { filerows.push_back(sin); } does not work because declare filerows in constructor, once constructor ends filerows destroyed. what need move filerows declaration outside of constructor , make class member: class data { ... std::vector<std::string> filerows; }; then shared functions in class.

php - Please help out of this error if i am using union than got a error me -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers $sql_new=$sql1. union .$sql2; this expression gives following error notice: use of undefined constant union - assumed 'union' in php $sql_new=$sql1 . " union " . $sql2; you have put strings quotes php knows it's string.

iphone - Set text to textfield of table Cell in objective c outside UITableView delegate methods -

i new objective c,and have made demo app. in app having uitableview contains textfield.when taps button(sign in using facebook), after login facebook come tableview screen,at time want set values came facebook response uitableview's textfields, unable tableview's delegate method calling once. can please me set text tableview's textfield outside delegate method? code nsstring *cellidentifier = [[signintabledata objectatindex:2] objectforkey:@"cellidentifier"]; signupcustomcell *cell = (signupcustomcell *)[signuptable dequeuereusablecellwithidentifier:cellidentifier]; //nslog(@"=====my username cell====%@",indexpath); if(cell == nil) { cell = (signupcustomcell *)[[signupcustomcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } cell.backgroundcolor = [uicolor clearcolor]; cell.tablefield.delegate = self; cgrect frmtxt = cell.tablefield.frame; frmtxt.size.width = signuptable.frame.size.width +

java - why local timeZone String is getting appended in the UTC date? -

i want date object in utc time zone converting first string returing me correct utc date string when again parsing date object local time zone string(ie. ist) getting appended in date instead of utc. date date = new date(); dateformat timeformat = new simpledateformat("mm/dd/yyyy hh:mm:ss"); timeformat.settimezone(timezone.gettimezone("utc")); string esttime = timeformat.format(date); date = new simpledateformat("mm/dd/yyyy hh:mm:ss", locale.english).parse(esttime); a date doesn't have timezone, represents moment in time. holds time in milliseconds. you can't have date format, doesn't work way. if need show date in gui, console or anywhere else, that's when use simpledateformat did change string in format want.

php - Should an API contain front datas? -

our tech team works on 1 website main product of our company. have office website used work on product efficiently. we'd make website better , create middle earth between office , front product since share same datas. want create mobile application that'll share (again) same datas. we thought making api containing of business model. now what's consistent , effective use ? should api contain crud models ? logic isn't shared across domains... should contain every end logic possible ? wouldn't dead code on 1 side or 1 ? should contain front end code ? mean generated html templates it'll fill data ? problem got last question : page a. need model x display basic properties. api sends it. need use method 1 on x display data. can't because don't have access x methods now. an api should deliver data need work with. also, should contain business logic, except things sorting or this. so have webpage example, works data. complete layout, des

machine learning - word2vec: Is there any implementation in java to work with phrases? -

i ask if know implementation of word2vec in java being able work phrases , not single words. the existing java implementation http://deeplearning4j.org/word2vec.html works single words. this 1 written in c , archived: https://code.google.com/p/word2vec/

android - RecyclerView onItemTouchListener conflicts when onScroll and onLongPress case -

here problem, have recyclerview must handle both long press , scroll , move events. want intercept long press when user scrolls. , when long press occured want intercept scrolling continue actions on action_move after long pressed. have far recyclerview.setonitemtouchlistener(new recyclerview.onitemtouchlistener() { @override public boolean onintercepttouchevent(recyclerview rv, motionevent ev) { final int action = motioneventcompat.getactionmasked(ev); if (action == motionevent.action_cancel || action == motionevent.action_up) { // release scroll. misscrolling = false; gesturedetectorcompat.ontouchevent(ev); return false; } if(action == motionevent.action_move) { // when user scrolls comes here return true; // handle scroll on ontouchevent } } public void onrequestdisallowintercepttouchevent(boolea

objective c - call a function written in iOS module from titanium -

in xcode viewproxy wrote code below: -(void) hideselecteddate { nslog(@"[info] in hide selected date proxy"); [self performselectoronmainthread:@selector(hideselecteddate) withobject:nil waituntildone:no]; } when call titanium, "in hide selected date proxy" written in console, app crashes after it. how can use : [self performselectoronmainthread:@selector(hideselecteddate) withobject:nil waituntildone:no]; "hideselecteddate" trying call in in view

java - Floating button setOnClickListener not gets called in Android -

i want integrate movable floating button same "whatsapp" application when open, displays hike floating button motion. , working click event. i used default ontouch event it's working can't apply click event on floating button. how can apply both click , touch event ? thanks in advance! home.xml <relativelayout android:id="@+id/rl_parent_floating" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="visible"> <relativelayout xmlns:fab="http://schemas.android.com/apk/res-auto" android:id="@+id/rl_floating_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparentbottom="true" android:layout_margin="10dp&q