Posts

Showing posts from June, 2011

android - Okhttp infinite loop on change connection status -

i have simple code making request okhttp lib: request request = new request.builder() .url(url) .build(); log.d("tag", "start"); response response = httpclient.newcall(request).execute(); log.d("tag", "stop"); everything works well, unless try change connection, while execute request. ex, if try connect without wifi (with slow internet connection), , turn on wifi while it's in progress execute infinitely. if stay slow mobile internet or stay wifi (without changing connection type) works fine. same story when turn off connections, start execution , turn on connection. tried use timeout, doesn't help. edit. there no other valuable code: private class downloadxmltask extends asynctask<string, void, void> { private asynccallback<reader> callback; private downloadxmltask(asynccallback<reader> callback) { this.callback = callback; } @override p

Excel Date formatting replace "." with "/" -

i have entered date in excel 19.04.2015 want "." in these dates replaced "/", output should 19/04/2015 does know formula this? tutorial change date format . way should change data type date on fields date modify date display format.

class - How do I use the outcome of my actionPerformed method to effect the main method - java -

i have class called screen containing actionperformed method. want different outcome different menu items: random, aggressive , human. this outcome effects main method, unsure how link two... public class screen extends jframe implements actionlistener { actionlistener listener; jmenuitem random = new jmenuitem("random"); jmenuitem aggressive = new jmenuitem("aggressive"); jmenuitem human = new jmenuitem("human"); public screen(board board){ //menubar items menu.add(random); random.addactionlistener(this); menu.add(aggressive); aggressive.addactionlistener(this); menu.add(human); human.addactionlistener(this); .... //sets board of buttons , adds actionlistener each. .... } public void actionperformed(actionevent e) { if(e.getsource() == random){ } if(e.getsource() == aggressive){ } if(e.getsource() == human){ } //code board buttons - nothing menu. //

android - What is the meaning of this Eclipse icon? -

Image
i don't know meaning of icon. i'm using eclipse luna, , unfortunately didn't find meaning in help . i'm working on android app ndk , i've noticed icon after removed obj/ folder git tracking. can tell me meaning of icon, ad can in order fix problem/ so far, seam application running fine, i'm worried anyway. this image describes possible states: check each file names. explains there own current state. basically esteric (*) refers staged - resource has changes added index. not adding index possible @ moment on commit dialog on context menu of resource. solution: as obj folder tracked , that's why in spite of removing the git tracking removed local repo not remote repository. can clear cache using following command , restage project. git rm --cached please take backup of project safe. for detail: check doc .

Need help to explain seats at a cinema program made in java -

can please me understand going on here? find hard understand whats going on these multidimentional arrays. if explain me in detail program does. i'm supposed find first available seat @ movie theatre. program terminate first seat. public class cinema { private boolean[][] seats = {{ true, true, false, false, false, true, true false}, { true, true, true, true, true, true, true, true}, { true, true, true, true, true, true, true, true}} public void findavailable() { boolean found = false; int row = 0; while (!found && row < seats.length) { int seat = 0; while (!found && seat < seats[row].length) { if (seats[row][seat]) { found = true; system.out.println("row = " + row + " seat = " + seat); } seat++; } row++; } } a movie theater way explain 2 dimensional array.

javascript - phaser js undefined variable within loading function -

i'm starting out using phaser js game dev have come across odd issue need on. let me show code , explain things going wrong: class simplegame { game: phaser.game; csvtm: string; constructor (csvtm: string) { this.csvtm = csvtm; this.game = new phaser.game(800, 600, phaser.auto, 'content', { preload: this.preload, create: this.create }); } test() { console.log("map test: " + this.csvtm); } preload() { console.log("map preload: " + this.csvtm); this.game.load.image('logo', 'empty_room.png'); this.game.load.tilemap("itsthemap", this.csvtm, null, phaser.tilemap.csv); this.game.load.image("tiles", "concrete.png"); } create() { console.log("map create: " + this.csvtm); var map = this.game.add.tilemap('itsthemap', 32, 32); map.addtileseti

c++ - std::initializer_list within constexpr (lookup tables) -

this relates problem i'm trying solve has been addressed couple of times lookup table constexpr ; constexpr array , std::initializer_list i have constexpr function that's slow use run time, purposes want use lookup table, , ideally want use same function @ run time , compile time. i came this template<template<size_t>class f, size_t... values> struct lookup_table{ static constexpr auto lookup(size_t i){ auto my_table = {f<values>::value...}; return *(my_table.begin() + i); } }; template<size_t n> class some_function{ // terrible way calculate exponential static constexpr auto slow_exponential(size_t x){ double y = 1 + ((double)x / 1000000.0); double retval = 1; (int = 0; < 1000000; i++) retval *= y; return retval; } public: static constexpr double value = slow_exponential(n); }; int main(int, char**){ using my_table = lookup_table<some_function, 0,1,2,3,4,5,6,7,8,9>; // test co

c - Why can't my shell start firefox? -

i'm writing small shell exercis learn c. can execute custom commands ls , date when try run firefox doesn't start. why? session $ ./a.out minishell>> ls ls a.out digenv2.c~ digenv.c.orig minishell.c readme.md test digenv digenv.c digenv.old.c minishell.c~ smallshell.c digenv2.c digenv.c~ license minishell.c.orig smallshell.c.orig minishell>> date date tue may 12 09:38:27 cest 2015 minishell>> firefox firefox minishell>> my program is #include <sys/stat.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <dirent.h> #include <errno.h> #include <stdarg.h> #include <stdlib.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #define buffer_len 1024 #define buffersize 1024 pid_t foreground = -1; int mystrcmp(char const *, char const *); struct command { char * const *argv; }; void err_syserr(char *fmt, ..

java - Replace Every 5th Character Of The Input (SPACES COUNT) -

i trying write program accept input , present input every 5th character replaced x (count spaces also). example: input: "hello name mario" outpu: "hellx xame xi maxio" i manage replace specific letters, e.g every "m" letter. any help? here code you: string test = "hello name mario"; string result = ""; int c = 1; (int = 0; < test.length(); i++) { if (c++==5) { result += "x"; c = 1; } else { result += test.charat(i); } } system.out.println("result = " + result);

javascript - jQuery hide() and show() not immediately run when reversed later in the function -

i'm using jquery's .hide() , .show() functions show loading message while potentially long synchronous webservice call executes. when clicking button in below snippet, expect text "some data" replaced "loading..." , go "some other data" after 5 seconds. as can see, not happens: function run_test() { $('#test1').hide(); $('#test2').show(); long_synchronous_function_call() $('#test2').hide(); $('#test1').show(); } function long_synchronous_function_call() { $('#test1').html('<p>some other data</p>'); var date = new date(); while ((new date()) - date <= 5000) {} } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="test1"> <p>some data</p> </div> <div id="test2" style="display:none">

batch file - start multiple java programs (multiple JVM) from one command -

i want start multiple java programs (multiple jvm) 1 command. ex: have 2 different application(lets , b) solve job independently. instead of running these 2 application separately in form of 2 jvm want bundle these 2 application or module (lets cc). if start c should start , b in 2 separate window or jvm can release or deploy 1 module c in stead of , b separately. please guide me how that. thanks santosh from comments, windows question, , using batch file start app, use start command in batch file (check this question more details): start java yourclassa arg1 arg2 ... start java yourclassb arg1 arg2 ... if using linux/unix write shell script , add & end of java startup lines, (check this question details): java yourclassa arg1 arg2 & java yourclassb arg1 arg2 & you can create java class c uses processbuilder start 2 other programs (apparently overkill problem). check this question if want that.

Extra property is returned when using jsonview in Spring mvc4 -

i using spring mvc(4.x) , met strange problem: @requestmapping("/xx") class controller{ @requestmapping(produce="application/json") public resource list(@requestparameter string key, @requestparameter page page){ arraylist list=..... return new resource(list,page); } } class page{ int page; int size; ... } class resource<t>{ private list<t> list; private page page; //getter , setter omitted } once call: http://.../xx/?key=key&page=1&size=10 i got json result,however looks this: { page:... resource:{ list:... page:... } } i wonder why page property @ root returned?

jquery - Display Text File -

i wondering how display contents of textfile in terminal output because have no idea how go it. want work "more [filename]" files in same directory html script. here current code*: http://pastebin.com/in4axus9 *i used pastebin formatting messing when pasted here. thanks try: var c = $.terminal.splitcommand(cmd); if (c.name == "more") { $.get(c.args[0], function(file) { term.echo(file); }); } it display whole file @ one, if want similar more command need split file pages. maybe this: var export_data = term.export_view(); $.get(c.args[0], function(file) { var = 0; var lines = file.split('\n'); term.clear().echo(lines.slice(i, i+term.rows()).join('\n')); term.push($.noop, { keydown: function(e) { if (e.which == 32) { i++; term.clear().echo(lines.slice(i, i+term.rows()).join('\n'));

vba - Creating an empty collection of Outlook.Items -

i have vba macro code in this: dim myfounditems outlook.items set myfounditems = mycalendars.restrict("[customuserproperty] = '" & sid & "'") where customuserproperty user property adding in macro (few lines after restriction). on first run of macro error property doesn't exist. thinking setting error handler set myfounditems empty collection. cannot achieve in way! i've tried using below code, causes error! set myfounditems = new collection maybe know how set myfounditems empty collection or better way check if userproperty created? you can't create new items instance using new keyword. instead, have use items property of folder class. the cause of issue can't reference user property using name in filter query. instead, have use dasl query following 1 (vba): criteria = "@sql=" _ & chr(34) & "http://schemas.microsoft.com/mapi/string/" _ & "{00020329-0000-0000-c000-0

php - Which one is best mysql or mysqli or $wpdb for wordpress plugin -

i have created plugin in wordpress after updated latest version of php mysql_connect not work. shows error php fatal error occurred: call undefined function mysql_close() i know php version problem need migrate mysqli have doubt 1 best $wpdb query or mysqli query and refered need use mysqli query above php ver 4.1.3 , should check if(phpversion()>=4.1.3){ //use mysqli } else { //use mysql } can use or there other way? better use $wpdb wordpress plugin simple , short: mysql_query() = faster! $wpdb->get_results() = safer! but in cases since $wpdb global object , in memory using be fast mysql_query() . will affect performance? it can affect better performance changes minor changes not worth it. https://codex.wordpress.org/class_reference/wpdb http://php.net/manual/en/mysqli.overview.php

jquery - Bootstrap Form Validation Plugin Recommendation -

can recommend (and free) form validation plugin using bootstrap. i've been using form found here: https://github.com/1000hz/bootstrap-validator - it's limited in doesnt support validation on textareas. thanks! i recommend jquery validation plugin .

Apache Camel FTP - How to start the route manually -

this camel route should start reading files ftp-server: from("sftp://user@...") now, don't want start automatically, or polling, or similar. should started manually (externally, jmx). have other routes being triggered via mbean, , use direct label: from("direct:myroute1") which best way same , starting first action ftp-read functionality? like: from("direct:myroute2") .from("sftp://user@...") .autostartup(false) ? not working. after manual-jmx-trigger no file being ftp-read. guess 2 "from" starting route work in parallel , therefore starting "direct:myroute2" not trigger ftp. kann put ftp-uri in component, other "from", start ftp-read after from("direct:myroute2")? btw: individual route, no connection other routes. thanks what need poll enrich: from("direct:myroute2") .pollenrich("ftp://localhost") .to("mock:result"); now trigger direct (

Php MySQL case sensitive -

i know question has been asked before. nothing seems work me. so have code below. trying search in database table product_description , column name (this part far works).the column name's collation utf8_general_ci $searchword1 = "squirl"; $existingword1 = "banana"; $replacerword1 = "orange"; i have 3 products: name: squirl banana pie name: squirl banana pie name: squirl banana pie i want search squirl,the search should grab both squirl , squirl. same goes banana $existingword1 banana , should search banana $sql1 = "update product_description set name = replace(name, '$existingword1', '$replacerword1') name '%$searchword1%';"; if ($conn->query($sql1) === true) { echo "<h1>everything worked planned</h1>"; } else { echo "error updating record: " . $conn->error; } i read several posts on stackoverflow , nothing helped me far. i don

php - mPDF - get position of element -

can current position (x,y) of element on page? for example, have this: $mpdf = new mpdf('', 'a4', 9, 'arial', 7, 7, 8, 18, 0, 6); $mpdf->writehtml('<div id="audit_list"><table>'); $mpdf->writehtml('<tr><td>text 1</td></tr>'); var_dump($mpdf->y); // otput 8 $mpdf->writehtml('<tr><td>text 2</td></tr>'); var_dump($mpdf->y); // otput 8 $mpdf->writehtml('<tr><td>text 3</td></tr>'); var_dump($mpdf->y); // otput 8 $mpdf->writehtml('<tr><td>text 4</td></tr>'); var_dump($mpdf->y); // otput 8 $mpdf->writehtml('</table></div>'); var_dump($mpdf->y); // otput 28.425833333333 why output of table elements <tr><td> 8? thank much. $mpdf->x $mpdf->y x = horizontal , y = vertical you can use built-in methods if have older

Laravel Query Builder error >7000 record -

Image
i have many record in table name ae_mkt (7500 record , more in future) and use query builder $query = db::table('ae_mkt')->get(); so error see on image: and config @ .htaccess header set cache-control "max-age=290304000, public" header append cache-control s-maxage=600 "expr=%{request_status} == 200" header set connection keep-alive but still error when need query large records

javascript - Typescript & Jquery: what is the best practice to call a class into Jquery onclick function? -

i don't want instantiate class in each function. how to? should best practice organize in typescript syntax? $(".container_dettaglio .varianti .variante a").click(function (event) { event.preventdefault(); var pr = new prodotto($(this).data('variante')); pr.cambiavariante(); }); $(".meno").on('click',function(e){ e.preventdefault(); var pr = new prodotto($(this).data('variante')); pr.rimuoviquantita(); }); $(".piu").on('click',function(e){ e.preventdefault(); var pr = new prodotto($(this).data('variante')); pr.aggiungiquantita(); }); the best workaround (i think) can restructure class return functions desires. example of mean: var myclass = function(){ return { set: function(a, b, c){ return [a, b, c].tostring(); }, modify: function(a){ return + ' .)'; } } }; $(function(){ var mc =

VirtoCommerce thumbnails not found in Azure -

i've deployed virtocommerce 1.13 source code azure , i'm getting problems thumbnails. url.imagethumbnail(foo) in item view returning url .thumb. image, doesn't exist. the main image being saved storage , thumbnails saved metadata, frontend trying thumb image image file doesn't exists. what i'm missing here? is issue appears every image try upload blob storage? had issue if generated thumb image more 8kb size. fixed there no releases fix. here fix commit change

c# - Migrate project from .MDF database to .SDF -

i ran stupid problem. i started developing windows forms application in c# must stand-alone (work absolutely no installation) , needs database. being genius didn't read , used sql server express .mdf database. now works perfectly, linq , it's perks (data context, designer , on) didn't know client machine need sql server installed work database. program potentially deployed 200-250 pcs , installing sql server on of pcs not option. is there way use sql server ce database instead of .mdf ? or have rewrite half program? first, read sql localdb . still requires installation , requires administrator rights installation. it supports silent installs, installer size 33mb, , supports majority of features of full-blown sql. if cannot afford any installs @ all, yes, sql ce might option you. whether you’ll need rewrite half program depends on how use database. if rely on stored procedures, views, raw sql, other advanced features yes, might need rewrite half of pr

while sending email getting following error - java 6 tomcat 6 -

javax.mail.messagingexception: exception reading response; nested exception is: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target javax.mail.messagingexception can occur due many reasons. since have not posted code , virtually impossible correctly caused this. looking @ second part of error "pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target" now again cannot 100% certainty probable these kind of error related certificate . ie java runtime doesn’t trust certificate. normally java verifies certificates through standard chain of trust mechanism. if chain terminates certificate java doesn’t trust, java complain in way described above. the solution if case 1. download certificate remote smtp s

c - trying to install valgrind but stuck at make valgrind, how? -

this might silly question, have started it. following tutorial lcthw and trying install valgrind, author specifies steps: 1) download (use wget if don't have curl) curl -o http://valgrind.org/downloads/valgrind-3.6.1.tar.bz2 use md5sum make sure matches 1 on site md5sum valgrind-3.6.1.tar.bz2 2) unpack it. tar -xjvf valgrind-3.6.1.tar.bz2 cd newly created directory cd valgrind-3.6.1 3) configure it ./configure 4) make it make 5) install (need root) sudo make install i stuck @ step 4, make here? should command like? have made c programs before specific file in here need specify? this when run make: blackbeard@pc-dev-a179:~/valgrind-3.6.1$ make make: *** no targets specified , no makefile found. stop. edit: as pinted out user43250937, ./configure not working properly, following: $ ./configure checking bsd-compatible install... /usr/bin/install -c checking whether build environment sane... yes checking thread-safe mkdir -p... /bin/mkdir

javascript - filter object in javacscript -

Image
i have object contains child object well. want filter them. have written filter code stuck between how create new object same relation. fiddle var x = 0 var newobj; function loop(obj, type1, type2) { (i in obj) { if (obj[i].shape == type1 && obj[i].health == type2) { $('div').append(obj[i].shape + '-' + obj[i].health + '<br>') if (!x) { newobj = obj[i]; } else { newobj.children = obj[i] } x++ } loop(obj[i].children, type1, type2) } } function filter() { loop(obj, 'circle', 'red') } filter() console.log(newobj) edit edited fiddle small , clear data , expected result given below { "shape": "circle", "health": "red", "children": [ { "shape": "circle", "health": "red&

javascript - Using helpers inside a keypath with ractivejs -

i have function called on click of element , comparing 2 arrays. first array printed out dom expression filters array. handlebars: {{#each search(~/budgets, searchvalue, 'accountname'):i}} <p on-click="comparevalues">{{accountname}}</p> {{/each}} js: ractive.on('comparevalues', function(target) { if(ractive.get(target.keypath + '.accountname') === ractive.get(target.keypath.replace('budgets', 'accounts') + '.accountname') { console.log(true); } else { console.log(false); } }); an example target.keypath "${search(budgets,searchvalue,"accountname")}.4" . i able compare resulted array array go through expression tried use replace switch arrays being used in expression. is possible use expression on array has gone through expression , has result getting undefined when changing array? you may able use event context grab current item in array:

c# - ListViewItem Checked vs. Selected -

for actions should use checkbox vs. selecteditem of listviewitem ? can't think comes down personal preference, again, still don't know . a checked item won't loose "check" if select other items. selected items can grouped using control/shift, when click on item without shift/control, other items deselected. i think safe assume checked items more persistent experience. can undone physically "un" checking it.

json - File upload using angular js in lotus notes html form -

i using lotus notes form .html files , sending values server json using angular js. want upload files now. how can send files server , extract using lotus script? can please me someone? like below post. done in asp.net . want same using lotus notes. file uploading angular js asp .net index.html <span ng-if="quests.type == '17'"> <input type="file" file-upload multiple id='{{quests.id}}'/> </span> <button type="button" ng-click="submitform();">submit</button> the above button trigger below code executed. angular code post server var email=document.getelementbyid("email").value; var message={"requesttype": "saveform","email": emailid,"username": username}; $http.post("http://test.com/ajaxprocess?openagent", message).success(success).error(failure); the above mentioned agent(lotusscript) parse above json , save document sh

Stop background audio on android app -

im working on simple audio application have major problem because audio wont stop when user press home button or move app background i tried use onpause() not work me please can ? import android.media.mediaplayer; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final button button1 = (button) findviewbyid(r.id.btn1); final mediaplayer angry = mediaplayer.create(mainactivity.this, r.raw.angry); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(angry.isplaying()) { angry.pause(); button1.se

python - How to extend django abstract base model by inheritance? -

i'm trying extend django abstract base model via inheritance, django model's behavior automatically sets abstract = true abstract = false on subclasses of abstract models bothering me. so situation is from django.db.models import model django.db.models.base import modelbase class timestampedmodel(model): created_time = datetimefield() modified_time = datetimefield() class meta: abstract = true ordering = ('created_time',) get_latest_by = 'created_time' class recordmodelmetaclass(modelbase): # not implemented yet pass class recordmodel(timestampedmodel): __metaclass__ = recordmodelmetaclass recording_model = notimplemented recording_fields = notimplemented where abstract timestampedmodel base model abstract recordmodel. the problem django 's metaclass modelbase automatically converts recordmodel's abstract = true abstract = false when recordmodel defined in import time. i

javascript - convert an object to array with property names too -

i have object like: obj { property1: "8898" property2: "2015-04-27 08:03:39.041" property3: "27" property4: "c10" } i need convert array. my code: var results=[]; (var property in obj) { if (obj.hasownproperty(property)) { results.push(obj[property]) } } here getting values. need have following result ["property1":1,"property2":2] instead of [1,2] i tried append property name did not have desired result. var obj = { property1: "8898", property2: "2015-04-27 08:03:39.041", property3: "27", property4: "c10", }; var results = []; (var property in obj) { if (obj.hasownproperty(property)) { var str = property +':'+ obj[property]; results.push(str) } } alert(results); demo

Extract string part from text in r -

i have text string such this: stoli 2.0 intel pav uma, phelps 1.0 intel pav_baytrail x360 , need extract part stoli 2.0 first 1 , phelps 1.0 second one. could give me sufficient solutio, how that, please? thank in advance. you can use gsub function need: > x <- c("stoli 2.0 intel pav uma", "phelps 1.0 intel pav_baytrail x360") > gsub("(^.* [0-9]*\\.[0-9]*).*", "\\1", x, perl = t, ) [1] "stoli 2.0" "phelps 1.0"

How do I Import a library from github in Android Studio? -

[i'm newbie] want include git library in android studio -> https://github.com/florent37/materialviewpager tried this. new-> import module -> downloaded file address it's giving errors. you dont have import module . put path in build.gradle dependencies , use described. e.g: dependencies { compile ('com.github.florent37:materialviewpager:1.0.3.2@aar'){ transitive = true } }

osx - NSMenu initializer or didLoad equivalent? -

i'm trying build menubar application on os x nsmenu being shown when menubar icon clicked having custom amount of nsmenuitems. amount specified in settings window , thought best way of carrying number on save nsuserdefaults , sending nsnotificationcenter notification when value has changed, controller in charge of setting , holding data nsmenu can load value defaults when notification received. the problem i'm experiencing here though i'm unsure how tell menu controller subscribe notifications. since subclassed nsmenu don't have initializer can done. or equivalent didload method nswindowcontrollers have. another option maybe have menu controller singleton , speak directly without going through notification center. or have reference in app delegate amount same thing here. or maybe i'm overthinking entirely , there's easier way of working this? thanks , tips! of course nsmenu has initializer. classes do. probably, instantiated menu in nib.

java - DatePickerDialog crash -

i'm android newbie... this code: final button taskdatebutton = (button)findviewbyid(r.id.tasktimebutton); taskdatebutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { datepickerdialog datepickerdialog = new datepickerdialog(taskactivity.this, new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { taskdatecalendar.set(calendar.year, year); taskdatecalendar.set(calendar.month, monthofyear); taskdatecalendar.set(calendar.day_of_month, dayofmonth); taskdate = taskdatecalendar.gettime(); setdatebuttonswithdates(); timepickerdialog timepickerdialog = new timepickerdialog(taskactivity.this, new timepickerdialog.ontimesetlistener() { @override public void ontimeset(timepicker view, int

java - I want to split string with only 2 space although the next string is space -

i want split string 2 space , want next string although next string space ex. [red blue green orange yellow ] and result want [red,blue,green, ,orange,yellow, ] what have do? try this: string str = "red blue green orange yellow "; string[] result = arg.split(" "); (int = 0; < result.length; i++) system.out.println(result[i]+','); this output: red, blue, green, , orange, yellow, edit: if don't want take space of "orange", str.split(" "); , take items (strings) bigger 1, taking words ignoring blank spaces, couldn't double space string. other way reach want said @ first , use str[i].trim() in loop, again, won't able take double space string. anyway, should give more info , details question, did tried before.

jquery - How can I get the id of div which is currently being hovered? -

suppose have multiple div same class different id. how can id of div being hovered user. <div class='same_class' id='differnt_id_1'></div> <div class='same_class' id='differnt_id_2'></div> <div class='same_class' id='differnt_id_3'></div> <div class='same_class' id='differnt_id_4'></div> let user hover div having id different_id_1 yet don't know id of element, know user has hovered element. how can id of hovered element using jquery. in advance. you can user this reference inside hover event handler. $('.same_class').on('hover', function() { console.log($(this).attr('id')); }); $(this) inside event handler element on event occured.

java - How to fill the treeTableView correctly -

Image
i have record in database being must in tree table view. here filling method: private void updategoods(){ goodspane.setcenter(goodtreetableview); list<good> goodandfolderslist; try { goodandfolderslist = goodsservice.getgoods();//database query }catch (sqlexception e){ goodandfolderslist = new arraylist<>(); log.log(level.error, e.getmessage()); } list<good> goods = new arraylist<good>();//list roots list<good> roots = new arraylist<good>();//list goods (good : goodandfolderslist) { if (good.isis_folder()) { roots.add(good); } else { goods.add(good); } } treeitem<good> rootitem = new treeitem<>();//the main root (good root : roots) { long folderid = root.getid(); treeitem<good> roo

How to realize this custom popup menu with Material Design Android? -

Image
i want realize custom popup menu twitter in android example item , picture don't know what's component used that. in material design website, google present this solution . think, there native solution achieve this. i tried popup menu , can't find how customize layout of view that. you can use listpopupwindow , submitting custom adapter, through can control layout of every single row of listpopupwindow . normal popupwindow have provide anchor view , additionally have call setcontentwidth on instance of listpopupwindow , sets width of popup window size of content. small price have pay, small dataset not big deal. have utility method retrieve max width of row: public int measurecontentwidth(listadapter adapter) { int maxwidth = 0; int count = adapter.getcount(); final int widthmeasurespec = measurespec.makemeasurespec(0, measurespec.unspecified); final int heightmeasurespec = measurespec.makemeasurespec(0, measurespec.unspecified);

Error using native smiles of Android in text field (Unity3d) -

Image
i make application unity3d , build android , when write in input field android native smiles - got error in line (invalid utf-16 sequence @ 1411555520 (missing surrogate tail)): r.font.requestcharactersintexture(chars, size, style); chars contains string contains native android smiles. how may support native smiles? use own class input field. unfortunately, supporting emojis unity hard. when implemented feature, took month finish it, custom text layout engine , string class. so, if requirement not particularly important, suggest axing feature. the reason behind particular error unity gets characters input string 1 one, , updates visual string every character. layman point of view, makes complete sense. however, doesn't take account how utf-16 encoding, used in c#, works. utf-16 encoding uses 16 bits per single unicode characters. enough characters use. (and, every developer knows, "almost all" red flag lay dormant long time , explode , destroy love.

css - HTML table to bootstrap div - columns -

i found bunch of links same question every questions depend on design. want change/convert these table bootstrap columns , div word same looks in table... seems going out of hand, link demo demo-fiddle . div.page_wrapper { margin-top: 10px; border: 1px solid #cccccc; } td.page_cat { background: #eeeeee; padding: 6px 6px 6px 9px; font-weight: bold; font-size: 13px; } td.page_label { padding: 3px 5px 3px 5px; color: #aaaaaa; font-size: 9px; text-transform: uppercase; border-top: 1px solid #dddddd; } td.page_list0, td.page_list0a { padding: 8px 5px 8px 10px; border-top: 1px solid #dddddd; } td.page_list1, td.page_list1a { padding: 8px 5px 8px 5px; border-top: 1px solid #dddddd; } td.page_list0, td.page_list1 { background: #f5f5f5; } div.page_list_title { font-size: 12px; font-weight: bold; padding-top: 4px; } div.page_list_desc { font-size: 11px; clear: both; } div.page_list_mod { font-size: 11px; color: #88

Lotus Domino 9: Unable to register user without creating ID file using Java client API -

on id vault configured domino setup, when register user using admin console, his/her id file gets uploaded id vault. in addition admin can chose create id file on other specified location . that is, admin able perform registration in 2 ways: option a: admin chose create file in id vault. option b: admin specify path id file created in addition id vault. i using lotus notes java client api perform registration against same setup. issue not able perform registration using option see above). the method call registration of user has mandatory parameter id file path. when executed, method create id file on specified path in addition 1 uploaded in id vault. i have requirement perform registration option a. things have tried: sending null/blank value parameter causes run-time exception. giving file name creates id file in lotus installation directory. setup details: lotus domino 9 id vault configured client api details: lotus notes java client api (ncso.jar)

Trying to write a basic C Program in XCode, but i keep getting an error saying 'Expected expression' -

so program's meant read in water temp, in kelvin, convert celsius , fahrenheit, display whichever of 2 requested, state. but whatever reason, when ever try , call c or f , fails build because wants before int in these 2 lines of code. case 'c': case 'c': convertnumberc(int n); checkstate(int n); break; case 'f': case 'f': convertnumberf(int n); checkstate(int n); break; in code, change convertnumberc(int n); to convertnumberc(n); because, while calling function, don't need specify data type. simmilarly, you've correct occurrences.

embedded - Led on/off using PIC 16f777a -

i doing exercise using push button. when button pressed once led starts blinking , when pressed again stops. when tried led blinking on 1st press not stopping on 2nd. using pic16f877a mcu hitech c compiler. code : #include<pic.h> #define _xtal_freq 20000000 void main() { trisb = 0x01; portb = 0x00; while(1){ if(rb0 == 1){ while(1){ portb = 0xff; __delay_ms(250); portb = 0x00; __delay_ms(250); if(rb0 == 1){ break; } } } } } i think "too short" loop. using double while catch input causes both if can valid thousand of times until release pushbutton. a suggest manage on release of button, means trigger push of button , valid push when button released. a simple solution can be: #include <pic.h> #include <stdint.h> #define _xtal_freq 20000000 void main() { unit8_t pressed = 0; bool blink = 0; trisb = 0x01

excel - Obtain web data after logging into website -

i'm trying data website requires log in user , password. i've followed this tutorial , managed log website, reason it's not getting table. here's code: sub gettable() dim ieapp internetexplorer dim iedoc object dim ietable object dim clip dataobject 'create new instance of ie set ieapp = new internetexplorer 'you don’t need this, it’s debugging ieapp.visible = true 'assume we’re not logged in , go directly login page ieapp.navigate "https://accounts.google.com/servicelogin" while ieapp.busy: doevents: loop until ieapp.readystate = readystate_complete: doevents: loop set iedoc = ieapp.document 'fill in login form – iedoc.forms(0) .email.value = "email@email.com" .passwd.value = "password" .submit end while ieapp.busy: doevents: loop until ieapp.readystate = readystate_complete: doevents: loop 'now we’re in,

php - Memory Leak or Connection not closed -

i having 3 files index.php, db_function, db_connect connect through mysql server. response slow , task running according hosting server people. index.php if (isset($_post['tag']) && $_post['tag'] != '') { // tag $tag = $_post['tag']; // include db handler require_once 'db_functions.php'; $db = new db_functions(); // response array $response = array("tag" => $tag, "success" => 0, "error" => 0); // check tag type if ($tag == 'login') { // request type check login $email = $_post['email']; $password = $_post['password']; // check user $user = $db->getuserbyemailandpassword($email, $password); if ($user != false) { // user found // echo json success = 1 $uservalue= $user["userid"]; $usercal = $d