Posts

Showing posts from June, 2012

apache - What is the most efficient way to generate a UUID in PHP? -

is there significant overhead (cpu, memory and/or io) in making repeat calls following function: public function getuuid() { return `uuidgen -r`; # -r = version 4 } versus using all php implementation of generating uuid (v4)? if matters project using apache (prefork mpm) 2.2.22 , php 5.3.10 (with apc ). my initial feeling benefit of doing generation of uuid in c library instead of in php more make system call overhead. additionally uuidgen being part of util-linux package inherently trust more php library generate uuids correctly, i'm keen input. i'd suggest profile problem. shell_exec() php function spawns shell, might not come cheap think. php class mention seems call subprocesses. did tests (on os x) , generate 10.000 uuids php class in minute, opposed 40 seconds shell_exec('uuidgen') . the php class seems call ifconfig in addition shell_exec() , might reason bigger overhead. also results vary hash algorithm choose.

arrays - php foreach sort before results -

i have searched forums not able solve problem: i have selection displays manufacturers names. working correctly, names not in sort-order. this code: <select name="manufacturer_id" id="manufacturer_id" data-inline = "true" style="width: 8.4em;"> <option <?php if(!isset($brand)) { echo 'selected="yes"' ; } ?> ></option> <?php foreach ($manufacturers $manufacturer) { ?> <?php if ($manufacturer['manufacturer_id'] == $manufacturer_id) { ?> <option value="<?php echo $manufacturer['manufacturer_id']; ?>" selected="selected"><?php echo $manufacturer['name']; ?></option> <?php } else { ?> <option value="<?php echo $manufacturer['manufacturer_id']; ?>"><?php echo $manufacturer['name']; ?></op

php - Mysql query for searching keyword -

i have search keyword , searching keyword using 2 tables. the search keyword 'patient' table - default_pages id type_id parent_id status 68 16 0 draft 70 17 68 live 227 17 44 live 262 1 31 live table - default_search id title entry_id 1 patient status 70 2 patient check 227 3 patient health 262 my query "select s.title, p.id, p.type_id sqem default_search s left join default_pages p on p.id=s.entry_id s.title '%patient%' having sqem not null" the above query returns 3 results ids default pages 70, 227, 262 problem id 70, it's parent id 68 , status of id 68 draft want exclude row result set , stuck. any highly appreciated. in advance. check status in default_pag

css - Autosize very long text inside jumbotron class -

i have long string ( e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 , similar) need shown inside col-md-8 jumbotron class of bootstrap 3. problem last few characters of string outside jumbotron box. nothing inside css changed, bootstrap used out of box... my question is, how make text (that can longer) fit inside jumbotron box? the best thing use word-break property , make word wrap onto 2 lines: p.whatever { word-break: break-all; } these vendor prefixes if need them: -ms-word-break: break-all; word-break: break-all; // non standard webkit word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto;

java - ActionListeners JMenuItems - Cross classes -

i'm making poor attempt @ actionlisteners here. i'm trying use actionlisteners run code in class (addform.java) once jmenuitem (in mainmenu.java) clicked. first, here's code: mainmenu.java package carparksystem; import javax.swing.jframe; import javax.swing.*; import java.awt.event.actionlistener; import java.awt.event.actionevent; import java.awt.*; import java.awt.event.*; public class mainmenu extends jframe { public mainmenu() { jmenubar mainmenu = new jmenubar(); jmenu main = new jmenu("menu"); mainmenu.add(main); jmenuitem addcar = new jmenuitem("add car"); addcar.setactioncommand("add"); main.add(addcar); //addcar.addactionlistener(); jmenuitem removecar = new jmenuitem("remove car"); removecar.setactioncommand("remove"); main.add(removecar); jmenuitem searchcars = new jmenuitem("search cars"); searchcars.setactioncommand("search");

c++ - OSX: ld: warning: bad symbol action: for core libraries -

building qt app on mac, number of warnings: ld: warning: bad symbol action: $ld$install_name$os10.5$/system/library/frameworks/applicationservices.framework/versions/a/applicationservices in dylib /system/library/frameworks//coregraphics.framework/coregraphics ld: warning: bad symbol action: $ld$install_name$os10.5$/system/library/frameworks/applicationservices.framework/versions/a/applicationservices in dylib /system/library/frameworks//coretext.framework/coretext ld: warning: bad symbol action: $ld$install_name$os10.5$/system/library/frameworks/applicationservices.framework/versions/a/applicationservices in dylib /system/library/frameworks//imageio.framework/imageio ld: warning: bad symbol action: $ld$install_name$os10.5$/system/library/frameworks/coreservices.framework/versions/a/coreservices in dylib /system/library/frameworks//cfnetwork.framework/cfnetwork i have placed qt frameworks bundle , used install_name_tool create dependencies dylibs , executable, within qt framewo

python - Regular expressions in Django -

i new django , having problems views. urls extension .html go view ...app.views.test i have: url(r'^\. html$',views.test) just check ending: url(r'\.html$', views.test) note dot needs escaped backslash since dot has special meaning : '.' (dot.) in default mode, matches character except newline.

How to return null pointer for list member c++? -

i need return pointer member in list, , if required member not there null pointer (or other indication) list<links>::iterator find_link(list<links> &link, char* id) { list<links>::iterator link_index; links link_i; link_index = link.begin(); (int = 0; < link.size(), i++) { link_i = *link_index; if (!strcmp(link_i.id, id)) { return link_index; }; link_index++; }; cout << "node outsession not exist " << id; return nullptr; // error (nullptr not same type list<links>::iterator) }; i added error message ( cout << "node outsession not exist " << id; ) indicate if link not found, need indicate caller function. how can ? thanks nullptr not iterator, can't return in function returns iterator value std::find(begin(), end(), value) returns iterator , returns end() if value not found. check say: std::list<int> l; ... auto found

javascript - Uncaught SyntaxError with day countdown script -

so have script got website, modified best of limited js knowledge. surprisingly did not work, gave error on line i'll highlight. here's script put inside of html: <script> var before = "event before" var current = "today date set in countdown" var montharray = new array("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec") function countdown(yr, m, d) { var today = new date() var todayy = today.getyear() if (todayy < 1000) todayy += 1900 var todaym = today.getmonth() var todayd = today.getdate() var todaystring = montharray[todaym] + " " + todayd + ", " + todayy var futurestring = montharray[m - 1] + " " + d + ", " + yr var difference = (math.round((date.parse(futurestring) - date.parse(today

ember.js - Ember JS getting data from a API url -

i have been given task using ember js can't find documentation or direction point myself in in regards getting feed api url - can curl in php. i no possibly have store in ember data. can give me brief example of should doing - great emberjs functions differently in how contact api in curl or php. for starters - in emberjs contacting api's straight client (and matters, because there cases people use backend code such php call third api secure, org-level api token. type of thing should not ever handled ember or single page web app . keep in backend code! now exciting part ember - ember data. ember data in own right rather complex subject. simplify, ember stores data in known data store, or ds. ds api rather large , worth getting familiar with. store backed models , these models can form relationships directed graphing database would. the store operates, of ember know, on principle of convention on configuration. thus, store receives data efficie

compiler construction - register allocation for x86 -

i attempting simple register allocation x86. using linear register allocator have few questions on simple things not finding information about. int main() { int a, b, c; = 10; b = 20; c = 2; = + b; b = b * 5; c = c * b + a; return c; } for simple code, ignoring constant propagation, g++ & msvc generate similar code pushes temporaries on stack , uses eax, ebx etc alu ops. clang generates following code o0. main: # @main movl $0, -4(%rsp) movl $10, -8(%rsp) movl $20, -12(%rsp) movl $2, -16(%rsp) movl -8(%rsp), %eax addl -12(%rsp), %eax movl %eax, -8(%rsp) imull $5, -12(%rsp), %eax movl %eax, -12(%rsp) movl -16(%rsp), %eax imull -12(%rsp), %eax addl -8(%rsp), %eax movl %eax, -16(%rsp) movl -16(%rsp), %eax ret as evident, temporaries on stack. question based on same thing. at point, should in eax/ebx etc used i

javascript calculation using jsfiddle -

i created script when can buy shirts, pants, etc.... problem having when run script on website works perfectly. however, when run using jsfiddle, doesn't work @ all. don't understand dong wrong , have other scripts on fiddle work fine. appreciate if can take @ , tell me made mistake. thank you. js fiddle - http://jsfiddle.net/rissandimo/lo6jsuvu/ my website - http://omidnassir.com/programs/shirts/shirts.html it working now. problem jsfiddle setting. i set no wrap - body. setting different , on load @ time element not present js function not bind @ time.

rendering crowds in OpenGL with VBOs -

i'm trying render large number of copies of same mesh in opengl. know can use small vertex buffer index buffer, each copy have it's own transformation matrix. want pass each matrix shader, vertices belonging same copy use same matrix. therefore, matrix buffer shorter vertex buffer. the mesh has 4 vertices, need somehow send new matrix every 4 vertices. ideas? you use instanced rendering: https://www.opengl.org/sdk/docs/man/html/gldrawarraysinstanced.xhtml or https://www.opengl.org/sdk/docs/man3/xhtml/gldrawelementsinstanced.xml you can create vbo filled transformation matrices each index. set divisor 4 matrix changes after 4 vertices have been sent: https://www.opengl.org/sdk/docs/man3/xhtml/glvertexattribdivisor.xml you can use gl_instanceid in vertex shader figure out instance being rendered, , can generate transformation matrix way rather sending every transformation matrix shaders.

javascript - How to print array repeatedly with a specified number of times -

i have array example: var arr = ['a','b','c','d']; now ask user insert number example: 6 or 7 or 10 or number. lets take example user has enter: 10 now output should be: b c d b c d b total of 10 values should print using array values in order. but main problem there should no if condition you need make use of modulus operator (%). docs here pseudo code: loop index output yourarray[i % yourarray.length] end loop

javascript - How do I submit this PHP poll form on click of a radio button? -

Image
i'm using css tricks' how design , create php powered poll tutorial create own poll. i'm trying poll submit when user clicks 1 of radio button options, instead of submitting when click "vote" button. poll.php: <?php require_once('connections/conn_vote.php'); ?> <?php if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? "'" . $thevalue . "'" : "null"; break; case "long": case "int": $thevalue = ($thevalue != "") ? intv

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo

ios - How to rename the class name in swift? -

i trying rename class name in swift gives me error can't refector swift code . want know best way rename file reflect in whole project currently can't refactor in swift. however, can find menu > find , replace in project. (carefully) edit: xcode 9 allows refactor. highlight property/function , choose editor menu -> refactor -> rename wait second or 2 xcode 9 scan project occurrences , type new name.

java - How to do indexing in hibernate3 -

i newbie hibernate framework.to increase performance of searching in project want index tables columns.as per research,hibernate automatically indexes when performing crud operations via criteria.so way tune search faster in hibernate , creating index externally increase performance of search? any idea appreciated!!! url: http://hibernate.org/search/documentation/getting-started/#define-which-entities-need-to-be-indexed can give details on indexing n hibernate. below snippet link. furter reading, please refer link. the annotation @indexed marks book entity needs indexed hibernate search. package example; ... @entity @indexed public class book { @id @generatedvalue private integer id; @field(index=index.yes, analyze=analyze.yes, store=store.no) private string title; @field(index=index.yes, analyze=analyze.yes, store=store.no) private string subtitle; @field(index=index.yes, analyze=analyze.no, store=store.yes) @datebridge(resolution=resolut

jface - How to display an custom editor inside a form page? -

Image
is possible display or embed custom editor inside form page(form toolkit)? have created eclipse plugin need embed custom editor inside multi - page form editor. is possible? if possible, how? am newbie in eclipse plugin, question may easy people. please this. have searched lot in internet couldn't find perfect solution. updated :

javascript - How to modify html string using jQuery -

i try use jquery modify html template. for example: var d = '<div class="a"><div class="b"></div><div class="c"></div></div>'; var html = $(d).find(".b").html("bbbbb"); console.log(d); // want new html in above, want '<div class="a"><div class="b">bbbbb</div><div class="c"></div></div>' how can implement case? please suggest. so here code: var d = '<div class="a"><div class="b"></div><div class="c"></div></div>'; var html = $(d).find(".b").html("bbbbb").end()[0].outerhtml; console.log(html); note key use .end() , pop off context of <div class="b"> created .find() operation , return $(d) , allows full html using .outerhtml on raw dom node.

diff - Csh how to compare the content of two files in different sequence? -

need in comparing contents of 2 files (in different sequence , spacing) , output difference in csh. tried diff -w file1 file2, somehow doesn't work. file1 cat white 123 dog brown 234 duck black 567 rat grey 345 fish blue 456 file2 fish blue 456 rat grey 345 dog brown 234 output cat white 123 duck black 567 thanks in advance. you solve problem 2 steps: squeeze spaces , sort lines perl -w -ne 's/\s+/ /g; say' file1.txt | sort > file1.sorted.txt perl -w -ne 's/\s+/ /g; say' file2.txt | sort > file2.sorted.txt find out common lines in them comm -3 file?.sorted.txt

getting the number of day in quarter Teradata -

i trying day of quarter when give current date. for example if give 01/25/2012 output should 25. since 25th day of quarter. similarly if give 02/01/2012 should give 32 output. i able first day of quarter not able day in quarter. platform teradata. calendar not have option day_of_quarter looking for. given date, require know number of day of quarter. please help. thank in advance. trunc(datecol) returns first day of quarter, date1 - date2 returns number of days between: select (datecol - trunc(datecol, 'q')) + 1 day_of_quarter you might put calculation sql udf or add column existing calendar table.

linux - delete directories according to directory name date -

the following command line delete directories older 180 days find /path/to/base/dir -type d -ctime +180 -exec rm -rf {} \; but syntax looking on directory time stamp for example if time stamp of directory jan 2 08:17 then directory deleted but want remove directory according directory date name for example directories date names: drwxr-xr-x 2 root root 4096 dec 2 08:17 01012014 drwxr-xr-x 2 root root 4096 dec 2 08:17 01022014 drwxr-xr-x 2 root root 4096 dec 2 08:17 01032014 should deleted because older 180 days according date name please advice how implemente in bash script remark - dir name daymonthyear try doing this: find /path/to/base/dir -type d -exec bash -c ' cd ${1%/*} dir=${1##*/} day=${dir:0:2} month=${dir:2:2} year=${dir:4:4} [[ $dir =~ [0-9]{8} && $year$month$day < 20140605 ]] && echo rm -rf "$1" ' -- {} \; find can execute external command, here yield bash -exec switch c

c++ - arrays not being assigned properly -

void sort(int* a,int l) { int j; int b[l]; for(int i=0;i<l;i++) { j = largest(a,l); b[l-i-1] = a[j]; a[j] = -1; } = b; } int main() { . int c[3] = {x,y,z}; ... sort(c,3); cout<<c[0]<<c[1]; } output coming -1-1 if assign a[0] = b[0] , on, getting right answer. ps: i've tried using *a = *b, giving first element correct. when assign a = b , re-assign local variable holds pointer first element of array. assignment not change in main . in particular, contents of a not affected. you must copy elements b a after have finished sorting: void sort(int *a, int l) { int j; int b[l]; // sort temporary array b (int = 0; < l; i++) { j = largest(a, l); b[l - - 1] = a[j]; a[j] = -1; } // copy temporary array b result array (int = 0; < l; i++) a[i] = b[i]; } but if @ it, amol bavannavar right: don't have check whole arr

asp.net - Restful API: implement version handling -

i have deference version of api in same domain , want manage putting version number in url below mydomain.com/api/v1/user/getall mydomain.com/api/v1/user/add mydomain.com/api/v2/user/getall mydomain.com/api/v2/user/add imagine scenario: user in both version has same functionality add changed in v2. wanna implement versioning, found tow approach aim. use v1 , v2 in routing , manage versioning in application (u.e : sdammann webapi versioning ) manage versioning source controllers , web servers ( each version exists branch , in case of asp.net(iis) create sub-application each version) in first approach think have copy controller s , action, if found bug example in user action must change in both action ( redundancy ) in second approach if happened bug must checkout old branch, fix , merge new version branch. dose exists better approach manage , implementation of api versioning ? branching different service versions lead deployment nightmare , because need mai

ember.js - Testing Emberjs app using QUnit and Karma fails due to `ReferenceError: Faye is not defined` -

i testing emberjs application qunit , karma runner , working good. had integrate faye application went on running test suite, shows following error , crashes: referenceerror: faye not defined the error thrown where, defining client in emberjs client = new faye.client(uri); though works in development, staging not in testing. overhere, uri = "http://localhost:9292/faye" faye.js included in vendor.js(single js file have js plugins including ember.js , ember-data.js itself) loaded before app.js(file above line exists) the reason of weird behavior related following lines in faye: if (typeof module !== 'undefined') module.exports = faye; else if (typeof window !== 'undefined') window.faye = faye; source: https://github.com/faye/faye/blob/master/javascript/faye.js#l143 if module not undefined(meaning defined) module.exports set object, if not, window.faye set. if use debugger , set breakpoint on line module actually defined ,

css - HTML div alignment using margins -

i aligning divs using margin properties the css goes this #top { width:1000; height:150; } #left { margin-left:0; margin-top : 150; width:200; height:500; } #right { text-align:center; margin-left:200; margin-top:150; } i want top div @ top of page, left div towards left , right div towards right. there wrong here. right div way below left div. for right , left div s use: float:left; fiddle link: http://jsfiddle.net/7fjk3wxs/ css: div { border: 1px solid #000; } #top { width:100%; height:150; } #left { float: left; text-align:center; width: 20%; } #right { float: left; text-align:center; width: 79%; }

php - how to email all data into a single email? -

i mailing data mysql table in php using below code, works perfectly,but problem sends each row of data single mail, want send row of data in 1 mail, how merge rows of data , send single mail? please me!! <?php include('header.php'); session_start(); ?> <html> <head> <title>sending email using php</title> </head> <body> <?php $sql="select * products"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $to = "xyz@gmail.com"; $subject = "d2dn-viewcart"; $id_s = $row["id"]; $name_s = $row["description"]; $price_s = $row["price"] ; $message = $id_s . " " . $name_s . " " . $price_s." "; $header = "from:d2dn"; $retval = mail ($to,$subject,$message,$header); } if( $retval == true ) { echo "message sent successfully..."; } else { echo "m

excel vba - How to freeze a range in VBA Custom function? -

i want use udf function in excel freeze range when user drag formula. code here: public function division(rng1 range, rng2 range, rng3 range) division = application.worksheetfunction.sum(rng1) / application.worksheetfunction.sum(rng2) * rng3 end function i want lock rng1 , rng2 in vba, not in excel sheet dollar sign. how can lock range.

php - Repeated file withc PHPEXCEL -

i have next code on php using phpexcel export. problem users download data of users sometimes. check user wrong. i think session problem user load fine. <? if(is_file("import.php")) { require_once("import.php"); }else { echo "no se encuentra import.php <br />"; } if(is_file("funciones.php")) { require_once("funciones.php"); }else { echo "no se encuentra funciones.php <br />"; } $user = jfactory::getuser(); $userid = $user->get('id'); $name = strtolower($user->get('name'));//uso esta funci?n para cambiar minusculas todo el texto. $username = strtolower($user->get('username')); if ($userid== 0){ print "no estas logueado en el sistema"; $pantalla=$usuario['username']; print "$pantalla"; } else{ $input = new jinput; $tablas= $username.'s'; $tablad= $username.'d'; $link = mysql_connect("localhost","",""

java - Login across browsers? -

i have requirement. if user login application in 1 browser(ie) if user tries open same application in browser (ff) ff should not prompt credentials because has logged in , kept ie open. is possible in java/html/jquery? for possible, require different browsers share information (e.g. session id, cookie value). since web storage introduced in html5 not shared across browsers, can't without assistance of browser plugins (note: java applet, require users approval share information other browsers e.g. via files). the check ip of client, , @ server side tell if there logged in user same ip know ip can same many users behind proxy server example, solution not satisfactory could sufficient in limited cases e.g. if web application used local network (and ip uniqueness can guaranteed).

scala - Is it possible to define dynamic projections in Slick? -

i have query joining many tables. i'd able parametrize fields should retrieved (sometimes complex sql postgis functions). let's initial query built this: def buildquery() = { c <- coffees if c.price > 9.0 s <- c.supplier } yield (c.name, s.name) now want 1 of yielded values dependent on parameter, example become: val param = true def buildquery() = { c <- coffees if c.price > 9.0 s <- c.supplier } yield (c.name, if (param) s.name else null) such code won't work, slick internals throw nullpointerexception. there reasonable way dynamically build yield part based on input parameters? as far know use slick's "case dsl": https://github.com/slick/slick/blob/master/src/main/scala/scala/slick/lifted/case.scala

ios - Check if user has selected another annotation in map -

i have map annotations performing following actions: - (void)mapview:(mkmapview *)mapview diddeselectannotationview:(mkannotationview *)view{ [self methoda];} - (void)mapview:(mkmapview *)mapview didselectannotationview:(mkannotationview *)view{ [self methodb];} both method , b remove or add views in mapview.superview. all works fine when dealing 1 annotation. the problem when have more 1 annotation , select two, 1 after other . if click anywhere else in map works fine. when click in second annotationview after first one, performs "diddeselectannotationview" , "didselectannotationview" calls both methods , b, , not want. detect clicking in annotation , ignore both methods. i have researched haven't found solution yet. i have tried add global variable , play identifying user touches: -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [touches anyobject]; // specific point touched cgpoint point = [touch locati

c++ - crash when reading from a file -

first of all, i'd u know im college student (our syllabus in programming not advanced yet)(btw im not asking answers assignments etc, im practicing). ok have 2 problems some function in code changes value of array (when dont want to) i have no idea, seems getting values file store array crashes program, furthermore, after fiddling bit code (i have no idea changed), no longer crashes during said part, still crashes @ end of code execution.. i hope u guys me, i've been searching whole day long. #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; /* run program using console pauser or add own getch, system("pause") or input loop */ void readfile (float x[], int &y) { ifstream load; string filename; cout << "enter name of file: "; cin >> filename; load.open(filename.c_str()); while (!load.eof()) { load >> x[y]; y++;

unix - Replace new lines character which are in quotas in file using sed -

i have been exported file open office csv. long text in cell have new line characters. rows cell text looks in csv ;;;;ddsfaads;;dsfaadsfdas;" dfsafdas fdadfsdaf fddsfaadfs fdsfadsadsfadf " how it? you can use way , sed '/"/{:a;n;/\n.*"/{s/\n/ /g;p;d;t};s/\n/ /g; t a};' filename

postgresql - nested joins statement in rails app -

in rails appi have 4 models( a, b, c, d, e , f) a belongs b b has many cs c belongs d d belongs e , f i trying build query follows scope = a.joins(:b, { b: [:cs, {cs: [:d, {d: [:e,:f] } ] } ] }) but not working. error message schema cs (plural of c) not exist . i using postgresql . well, seems you're missing b reference ( b_id ) in c model. c needs know b belongs. after that, can simplify query this: a.joins(b: {cs: {d: [:e, :f]}})

html - Rendering (display) a part of a web page in an android application -

this question not android programmers , whom interested in web pages design . i make android app renders some parts of specific web pages (not part of them) . i heard jsoun library tool task my main problem is:- how can choose correct link web page's source render part of web page ?. for example let take famous website forbes how can render list of richest men name , rank,name net worth,change,age,source,country of citizenship appearthere excluding other parts of web page. here example of application accomplishes task you may have suggestion. you need screen-scrape html. i'm not sure android libraries doing this, build restful service return data needed. service heavy lifting of scraping webpage , converting data json sent device. on server side use library beautiful soup scraping. easy enough use once have installed. create beautifulsoup object html , make calls myobject.gettitle() return title of html. can use tags in html drill down eleme

javascript - addEventListener keyup Keydown with Keycode not working -

this.element.addeventlistener('keydown', function(e) { if ((e.keycode || e.which) == 32) { self.space_down(e); } }, true); this.element.addeventlistener('keyup', function(e) { if ((e.keycode || e.which) == 32) { self.space_up(e); } }, true); this not working, why?, iv'e similar code watch mouse events , works fine, there solution? try bind event document or window . if element not focusable , not focused, keyboard events won't dispatch it, instead dispatch document root( <body> ).

c# - Image is not displayed in browser when uploaded to server in ASP.NET -

i have project works fine in local server.the project when uploaded in real server, runs , shows no error displays broken image.the image in product folder inside img folder in webroot. i inspected image , provided image path root directory , works when image path taken inside folders img/product/image.jpg, shows broken image. any much appreciated. edit: i checking result inspect elements. image tag <img width="100%" src="/img/product/hs6.jpg"> the image hs6.jpg exists why won't displayed. if use image root, display <img width="100%" src="career.jpg"> the above 1 working good. when copy image location shows http://sajilobazar.com/img/product/l7.jpg .you can check in browser. i solved error last night.there nothing wrong in path.i changed folder name img myimg , built solution , uploaded in server , working good. the error guess due use of img folder img predefined tag or keyword.

sql server - T-SQL how to create a update trigger to update a column after a row is updated? -

i have table below. , want update [updatetime] column automatically when row's [content] column update. create table [dbo].[filecontent] ( [fileid] int not null primary key, [content] nvarchar(max) not null , [updatetime] datetime not null default getdate() ) what's best way write trigger? use this. for more information triggers refer link . create trigger sample on [dbo].[filecontent] update begin if update([content]) begin declare @nfieldid int select @nfieldid = [fileid] inserted update [dbo].[filecontent] set [updatetime] = getdate() [fileid] = @nfieldid end end

php - using Carbon to know if a time falls under two points of time or not -

i using laravel. have come across carbon there in vendors folder. did quick search , found great extension php date time. somewhere in application, needed logic check if given time falls between 2 points of time. lets say, want check if 10:00 falls under time time 9:55 , 10:05. surely, falls how should use logic of carbon. by default carbon::now() return date , time in 2014-12-02 14:37:18 format. thinking if extract time part i.e 14:37:18 can compare 2 times know whether time under testing falls under 2 points of time or not. if directly check 2 carbon objects, try check year well. need time part only. and matter of fact, not sure if times (h:m:s) can directly can compared or not through carbon. yes there way in carbon, take on documentation here . to determine if current instance between 2 other instances can use aptly named between() method. third parameter indicates if equal comparison should done. default true determines if between or equal boundaries.

html5 - Can I make a Dart function "wait" for a set amount of time or input? -

i'm trying make simple rpg in dart. need show text on screen in div, , need make program wait user input before displaying next piece of text. for example: void main() { showtext("hello, adventurer! welcome land of dartia! (press enter continue...)"); print("showtext has finished"); } "showtext has finished" should not display until text has been displayed , player presses enter. here's (pretty ugly in opinion) code have far: void showtext(string text) { var textbox = queryselector("#sample_text_id") ..text = ""; var timer; var out; out = ([int = 0]) { textbox.text += text[i]; if (i < text.length - 1) timer = new timer(const duration(milliseconds: 10), () => out(i + 1)); }; out(); } the timer runs out() function asynchronously, don't want do. ideally write this: void showtext(string text) { var textbox = queryselector("#sample_text_id")

c# 6.0 - Unable to use primary constructor parameter -

i playing new features of c# 6.0 i have following line of code public class circle(int radius) { public double circumference => 2 * 3.14 * radius; } above code doesn't work , gives error "the name radius doesn't exist in current context" but when use public class circle(int radius) { int radius = radius; public double circumference => 2 * 3.14 * radius; } code works fine. sort of bug vs ctp or wrong code. believe should able use parameter of primary constructor inside constructor whithout setting other variable. well , may doesn't answer question directly primary constructor has been withdrawn c# 6.0. see: changes language feature set , question: primary constructors no longer compile in vs2015 you trying code in visual studio 2014 ctp. need download , install new version of visual studio 2015 preview . (but first have un-install visual studio 2014 ctp) you may see latest: languages features in c# 6 , vb 14

repositorylookupedit - Devexpress RespositoryLookUpEdit in grid , the value disaper -

i have devexpressgridcontrol. want use in 1 column of grid : repositorylookupedit. fill repositorylookupedit database question. question return 3 columns : idperson , name , idcity. colums : idperson , name have data idcity have set in appication. so - in gridcontrol column idcity has fildename : idcity, , columnedit : repositorylookupedit. - repositorylookupedit has displayvalue : cityname, , valuemember: idcity. and question is: when choose in grid in 1 row value of city , go row, value first row disaper. what doing wrong? give me advise? i use devexpress 9.2. this.gvperson = new devexpress.xtragrid.views.grid.gridview(); this.repluecity = new devexpress.xtraeditors.repository.repositoryitemlookupedit(); this.repluecity.columns.addrange(new devexpress.xtraeditors.controls.lookupcolumninfo[] { new devexpress.xtraeditors.controls.lookupcolumninfo("idcity", "idcity", 20, devexpress.utils.formattype.none, "", false, devexpress.ut

java - How to get the text in array and compare the value with data in excel in Selenium Webdriver -

code used: int n = 0; int a[10] = null; for(int i=1;i<n;i++) { a[i] = driver.findelement(by.xpath(".//*[@id='steplist']/li[n]")).gettext(); system.out.println("/userid ="+a[i]); } please me convert string , int , , how can values of li , store in n ? you can elements have same xpath using findelements instead of findelement can this: webelement elements = driver.findelements(by.xpath(".//*[@id='steplist']/li")) for(webelement elem: elements) { a.add(elem.gettext()); } for excel can use jexcelapi

java - JAXB Moxy mixed whitespace lost -

i have problem while unmarshalling xml mixed content. space gets lost. xml looks this: <text>rooms in <g>the</g> <g>eldorado hotel</g> on broadway have jacuzzi</text> this unmarshalled to: "rooms in " (with final space) a object value 'the' a object value 'eldorado hotel' " on broadway have jacuzzi" (with initial space) everything fine i'm missing space between 2 tags. need preserve space! the simplified mapping like: @xmltransient public abstract class abstracttext { private list words; @xmlmixed @xmlelementrefs({ @xmlelementref(type = wordgroup.class, required = false), // <g> tag @xmlelementref(type = word.class, required = false) }) public list getwords() { if (words == null) words = new arraylist(); return words; } public void setwords(list words) { this.words = words; } } @xmlroot public class text e

Python to C and Garbage Collector -

i have following problem in python (problem variable ref or val in c) my c code: #define non_allocated 0 #define allocated 1 #define max_stack 100 typedef struct myobject { int istatus; int isize; double pdtab; } static myobject globatab[max_stack] myobject *allocateatab(int isize) { myobject *pxtab = null; int i; int ifound = 0; while(i < max_stack && !ifound) { if (globatab[i].istatus = non_allocated) ifound = 1; break; } if (i < max_stack) { pxtab = globatab + i; pxtab->istatus = allocated; pxtab->pdtab = (double *)calloc(isize, sizeof(double)); } return pxtab; } int freeatab(myobject *pxtab) { if (pxtab) { pxtab->istatus = non_allocated; if (pxtab->pdtab) free(pxtab->pdtab); } } myobject *scalar(double dvalue) { myobject *pxtab = allocateatab(1000) (int isize = 0; isize < 1000; isize++) pxtab->pdtab[i

oracle adf - Input text validation when is empty -

i have 3 dependent text boxes. is, department, class , subclass. when department fill class of inputtext enable , when preecho class subclass enable. make process not had difficulties. however, can not make reverse process when delete, example, value of department should put disable class , delete value. not because events, when empty not trigger new event , therefore not enter else if. text boxes have autosuggest behavior , class depends on chosen department , subclass of class. class , subclass have associated partialtriggers. my code of input text department (with valuechangelistener setdepartment()): public void setdepartment(valuechangeevent valuechangeevent) { dciteratorbinding dc2 = (dciteratorbinding)evaluteel("#{bindings.scpclassview1iterator}"); viewobject vo2 = dc2.getviewobject(); vo2.applyviewcriteria(vo2.getviewcriteriamanager().getviewcriteria("scpclassviewcriteria")); if (it7.getvalue() == null) {

java - Jackson custom date serializer -

i need set format class' date serialization. have version of jackson, doesn't have @jsonformat. that's why wrote custom class: public class cdjsondateserializer extends jsonserializer<date>{ @override public void serialize(date date, jsongenerator jsongenerator, serializerprovider provider) throws ioexception { simpledateformat dateformat = new simpledateformat("mm/dd/yyyy"); string datestring = dateformat.format(date); jsongenerator.writestring(datestring); } } and used it: @jsonserialize(using = cdjsondateserializer.class) private date startdate; but, have fields have different date's formats , don't want create classes serialization. can add needed formats constants cdjsondateserializer class , set needed format annotation @jsonserialize ? this: @jsonserialize(using = cdjsondateserializer.class, cdjsondateserializer.first_format) . after answer below: it works after corrections. i've changed way of getting ann