Thursday, 15 March 2012

javascript - isNaN not firing until 2 characters are typed in -



javascript - isNaN not firing until 2 characters are typed in -

my html code is:

<input onkeypress="validatea(this.value)" type="text" id="aaa" name="aaa" size="10" placeholder="a"> <span id="aspan" class="validate"> </span>

and javascript is:

function validatea(valueofaaa) { if (isnan(valueofaaa)) { document.getelementbyid('aspan').innerhtml="please come in numerical value."; } else { document.getelementbyid('aspan').innerhtml=""; } }

to clarify, question is:

why innerhtml="please come in numerical value." not firing until 2 letters or numbers typed input box?

change onkeypress() onkeyup() because when keypress triggered, actual value of input not captured yet.

javascript

c# - Dynamic Grouping Using LINQ -



c# - Dynamic Grouping Using LINQ -

please have @ below example. grouping clause has dynamic. can please guide me how can achieved. i.e. row { r.portfolio, r.datatype } has contructed dynamically.

not sure how can tweek solution given @ blog http://jonahacquah.blogspot.com/2012/02/groupby-multiple-columns-using-dynamic.html

public class decisionsupportdata { public string portfolio { get; set; } public string bucketname { get; set; } public string datatype { get; set; } public string childportfolio { get; set; } } public void populatedata() { list<decisionsupportdata> lstalldecsupp = decisionsupportdatabindingsource.datasource list<decisionsupportdata>; list<decisionsupportdata> lstrmgamt = (from r in lstalldecsupp.asenumerable() r.datatype == "p" grouping r new { r.portfolio, r.datatype } gg select new decisionsupportdata { datatype = gg.key.datatype, portfolio = gg.key.portfolio, }).tolist(); }

thx help.

the dynamiclinq library appear solve issue, mentioned in scott gu's original blog. utilize groupby extension method string value.

or dig expressionparser class , see it's doing.

c# linq dynamic group

Add a space between ul and li element created by JavaScript -



Add a space between ul and li element created by JavaScript -

been struggling problem now.

i have list behaves quite weird, , couldt find problem until firebugd , saw entire file prints out in 1 row.

something this.

<div class="clock-content-wrapper"><ul class="clock-digit-wrapper hour"><li class="clock-digit-one"></li><li class="clock-digit-three"></li></ul><ul class="clock-digit-wrapper minute"><li class="clock-digit-three"></li><li class="clock-digit-seven"></li></ul><ul class="clock-digit-wrapper second"><li class="clock-digit-zero"></li><li class="clock-digit-zero"></li></ul></div>

there no spaces between elements.

now didn't know problem started prepare elements in firebug this.

<div class="clock-content-wrapper"> <ul class="clock-digit-wrapper hour"> <li class="clock-digit-one"></li> <li class="clock-digit-three"></li> </ul> <ul class="clock-digit-wrapper minute"> <li class="clock-digit-three"></li> <li class="clock-digit-seven"></li> </ul> <ul class="clock-digit-wrapper second"> <li class="clock-digit-zero"></li> <li class="clock-digit-zero"></li> </ul> </div>

and notice if have </ul> element under </li> script works @ supposed to.

is there way construction file javascript ? have jsfiddle, can se differens between tree created in html , 1 javascript. http://jsfiddle.net/xk49c/

i dont want alter in css . since both html , js application using same css .

the problem is, when create elements using html, indent or separate elements 1 or more spaces, or new lines. html renders these spaces 1 single space , see space between elements.

to add together spaces between elements created javascript, either ll have add together padding left minute , second class, or insert text node between each ul

hours = createelementwithclass('ul', 'clock-digit-wrapper hour'); clock_toolbar_wrapper_close.appendchild(hours); clock_toolbar_wrapper_close.appendchild(document.createtextnode(' ')); // add together minutes = createelementwithclass('ul', 'clock-digit-wrapper minute'); clock_toolbar_wrapper_close.appendchild(minutes); clock_toolbar_wrapper_close.appendchild(document.createtextnode(' ')); // ,

javascript

javascript - Multiple fancybox google map -



javascript - Multiple fancybox google map -

how set popup fancybox different content in different markers? i've managed set fancybox can see same content 2 markers. find way set different content in fancybox each maker.

<script type='text/javascript'>//<![cdata[ $(function(){ function initialize() { var mapoptions = { zoom: 4, disabledefaultui: true, center: new google.maps.latlng(45.35, 4.98), maptypeid: google.maps.maptypeid.terrain } var map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); addmarkerwithwindow("lemans", new google.maps.latlng(48.006922, 0.20874), map); addmarkerwithwindow("paris", new google.maps.latlng(48.856291, 2.352705), map); } function addmarkerwithwindow(name, coordinate, map) { $.fancybox({ content: url }); var image = 'rss.png'; var marker = new google.maps.marker({ map: map, icon: image, position: coordinate }); var styles = [ { featuretype: "all", stylers: [ { saturation: -15 }, { lightness: -10 }, ] }, ]; map.setoptions({styles: styles}); <!-- ne pas utiliser --> var url= "http://www.fancyapps.com/fancybox/"; <!-- ne pas utiliser --> var div = document.createelement('div'); div.innerhtml = 'hello'; google.maps.event.addlistener(marker, 'click', function() { $.fancybox({ maxwidth : 800, maxheight : 600, href : "rssddd/feedek_demo.html", type : 'iframe' }); }); } initialize(); });//]]> google.maps.event.adddomlistener(window, 'load', initialisation); </script>

démo : http://ps3land.franceserv.com/

pass 4th argument addmarkerwithwindow() , e.g:

addmarkerwithwindow("lemans", new google.maps.latlng(48.006922, 0.20874), map, 'http://lemans.org'); addmarkerwithwindow("paris", new google.maps.latlng(48.856291, 2.352705), map, 'http://parisinfo.com');

make argument accessible within function:

function addmarkerwithwindow(name, coordinate, map, href) { //your code }

and utilize href-option fancybox:

$.fancybox({ maxwidth : 800, maxheight : 600, href : href, type : 'iframe' });

javascript jquery html google-maps-api-3 fancybox

url rewriting - Convert AWS URL to something shorter (without database) -



url rewriting - Convert AWS URL to something shorter (without database) -

we're serving bunch of images on our website hosted on aws, , they're named 0e261dda-cbb7-4b99-b863-6d7640dc2fd8.jpg. maintain simple path these images via our website keeping same name image - strip out dashes create little bit shorter.

but since we'll sharing path these images via twitter we'd love string shorter still, don't want utilize database url shortening (either rolling our own or using else's). rather have lossless compression scheme on string.

given fact aws name apparently using hexadecimal characters, seem converting ascii (after removing dashes) @ to the lowest degree bit of compression , easy lookup actual path on server.

anybody have/seen little bit of code can spit out url-safe ascii equivalent aforementioned hex string?

use higher base. hexidecimal base of operations 16. utilize number of higher base of operations (36 mutual in url shortners, go 62 (10 digits, 26 upper case letters 26 lower case letters)

your base of operations 16 string:

0e261ddacbb74b99b8636d7640dc2fd8

in base of operations 36:

u5lc6fos2f9e70ww3kat3kk8

in base of operations 62 (bit less reliable, case sensitive):

qhjl1gbuzhsyjoiq3ia0u

url-rewriting amazon-web-services hex ascii

php - Hash value lengths -



php - Hash value lengths -

when referring length of hash value such sha1 or md5 in php, right interpret size of hash in memory rather number of characters nowadays in literal?

it's minimum number of bits required store hash unambiguously.

>>> len(hashlib.md5('foo').digest()) * 8 128 >>> len(hashlib.sha1('foo').digest()) * 8 160 >>> len(hashlib.sha512('foo').digest()) * 8 512

php encryption

html - Why is there still blank space? -



html - Why is there still blank space? -

this question has reply here:

small margin / gap @ top of document 1 reply

this html code of site's skeleton:

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="css/base.css" rel="stylesheet" type="text/css" > </head> <body> <div id="center"> </br> </br> </div> </body> </html>

and how base.css looks like:

#center{ border:0px; margin:0px auto; width:960px; background-color: #66ffff; padding:0px; }

the problem there still blank space upon website, here picture: http://s4.postimage.org/6fagq090d/untitled.png (red arrow points space thought disappear putting border, margin , padding on 0).

"auto" on margin i've set aligns on center, i'm not getting why can't move space. i've tried deleting space between , didn't help. i'm making mistake?

you need remove margin around html , body :

html, body { margin:0; padding:0; }

html css

git - Push to Github Fails under Windows -



git - Push to Github Fails under Windows -

i unable force github windows (dos) command prompt bash worked.

if ran git force origin master got:

permission denied (publickey). fatal: not read remote repository. please create sure have right access rights , repository exists.

if ran ssh-add got:

could not open connection authentication agent.

everything worked fine under bash (msysgit) - how be?

the solution realise ssh (under windows) looking files called id_rsa in %useprofile%\.ssh folder files there names github_rsa.

solution:

rename %userprofile%\.ssh\github_rsa id_rsa rename %userprofile%\.ssh\github_rsa.pub id_rsa.pub

hey presto, pushing , pulling works without entering bash!

possible explanation: previous install of github windows generated github_rsa files.

weirdly, after rename git push still works under bash!

git github ssh

mysql - Accessing the value of a table and comparing it with a string in sql -



mysql - Accessing the value of a table and comparing it with a string in sql -

i facing problem comparing value in table 1 against string here ive tried..

delimiter $$ drop trigger if exists comment_trigger$$ create trigger comment_trigger after insert on post_comments each row declare @var_post_id varchar(20); begin if (new.post_id 'rmdid%') set @var_post_id=select post_id recommendations recommendation_id=new.post_id; if(@var_post_id 'recid%') update cooking_category set last_activity=new.comment_time post_id=new.post_id; end if; end if; end$$ delimiter ;

can help me please.

you can assign variable straight in select statement:

select @var_post_id = post_id recommendations recommendation_id=new.post_id;

this preferred, syntax work if set parentheses around select statement:

set @var_post_id=(select post_id recommendations recommendation_id=new.post_id);

mysql sql triggers

html - Javascript Countdown with Twitter Bootstrap Progress Bar -



html - Javascript Countdown with Twitter Bootstrap Progress Bar -

i working twitter bootstrap. need redirect page after 30 seconds. want utilize twitter bootstrap progress bar indicate how long till page redirects (so page redirects when bar @ 100%). please help me javascript , html code this.

thanks ;)

very basic example:

var bar = document.getelementbyid('progress'), time = 0, max = 5, int = setinterval(function() { bar.style.width = math.floor(100 * time++ / max) + '%'; time - 1 == max && clearinterval(int); }, 1000);

code wrapped in function:

class="snippet-code-js lang-js prettyprint-override">function countdown(callback) { var bar = document.getelementbyid('progress'), time = 0, max = 5, int = setinterval(function() { bar.style.width = math.floor(100 * time++ / max) + '%'; if (time - 1 == max) { clearinterval(int); // 600ms - width animation time callback && settimeout(callback, 600); } }, 1000); } countdown(function() { alert('redirect'); }); class="snippet-code-css lang-css prettyprint-override">body {padding: 50px;} class="snippet-code-html lang-html prettyprint-override"><link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet"/> <div class="progress"> <div class="bar" id="progress"></div> </div>

javascript html twitter-bootstrap

wordpress - foreach only once -



wordpress - foreach only once -

i'm using metabox plugin wordpress, there 1 php command:

<?php $images = rwmb_meta( 'pw_project_photos', array('type'=>'plupload_image','size'=>'thumbnail') ); foreach ( $images $image ) { echo "<img src='{$image['url']}' alt='{$image['alt']}' />"; } ?>

what want to echo once, possbile?

for example, have upload 2 images 1 post, want show first image, not 2 images.

plz help me, thx lot!

you don't need loop through array if want echo 1 item.

simply do:

<?php if ( isset( $images[0] ) ) { $image = $images[0]; echo "<img src='{$image['url']}' alt='{$image['alt']}' />"; } ?>

wordpress foreach

android - Datepicker: How to popup datepicker when click on edittext -



android - Datepicker: How to popup datepicker when click on edittext -

i want show datepicker popup window. have found examples not getting properly. have 1 edittext , want when click on edittext datepicker dialog should popup , after setting date, date should show in edittext in dd/mm/yyyy format. please provide me sample code or links.

try this:

calendar mycalendar = calendar.getinstance(); datepickerdialog.ondatesetlistener date = new datepickerdialog.ondatesetlistener() { @override public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { // todo auto-generated method stub mycalendar.set(calendar.year, year); mycalendar.set(calendar.month, monthofyear); mycalendar.set(calendar.day_of_month, dayofmonth); updatelabel(); } }; edittext.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub new datepickerdialog(classname.this, date, mycalendar .get(calendar.year), mycalendar.get(calendar.month), mycalendar.get(calendar.day_of_month)).show(); } }); private void updatelabel() { string myformat = "mm/dd/yy"; //in need set here simpledateformat sdf = new simpledateformat(myformat, locale.us); edittext.settext(sdf.format(mycalendar.gettime())); }

android

scala - Error using Specs2 with FluentLenium Api -



scala - Error using Specs2 with FluentLenium Api -

i utilize scala 2.10, specs2 13.1-snapshot , fluentlenium api provided play2 framework 2.1.

i have line of code in integrationspec file, finding kid element (according fluentlenium spec):

browser.find(".myclass").find("#mysubelement") must havesize(1)

that line leads next compilation error:

error: type mismatch; found : org.fluentlenium.core.domain.fluentlist[_ <: org.fluentlenium.core.domain.fluentwebelement] required: org.fluentlenium.core.domain.fluentlist[?0(in value $anonfun)] type ?0(in value $anonfun) <: org.fluentlenium.core.domain.fluentwebelement note: org.fluentlenium.core.domain.fluentwebelement >: ?0, java-defined class fluentlist invariant in type e. may wish investigate wildcard type such `_ >: ?0`. (sls 3.2.10)

is kind of...incompatibilty scala/java due generics?? or normal behaviour didn't figure out?

this line (omitting matcher), compiles:

browser.find(".myclass").find("#mysubelement")

the havesize matcher require element beingness matched have org.specs2.data.sized typeclass in scope. corresponding typeclass java collections is:

implicit def javacollectionissized[t <: java.util.collection[_]]: sized[t] = new sized[t] { def size(t: t) = t.size() }

i suspect type inference here issue , seek tame next ugly code:

browser.find(".myclass"). find("#mysubelement"). asinstanceof[fluentlist[fluentwebelement]] must havesize(1)

or maybe

browser.find(".myclass"). find("#mysubelement"). asinstanceof[collection[_]] must havesize(1)

or

import scala.collection.convert.javaconverters._ browser.find(".myclass"). find("#mysubelement"). asscala must havesize(1)

scala webdriver playframework-2.0 specs2

html5boilerplate - Bootstrap and Boilerplate IE9 Demo page broken? -



html5boilerplate - Bootstrap and Boilerplate IE9 Demo page broken? -

well, trying test bootstrap , boilerplate http://www.initializr.com/ non of templates demo works in ie9? shouldn't working?

or need modifications?

win7 ie9 standard(even reset) screenshot:

https://www.dropbox.com/s/pg9611rxe4hfbeo/initilizr_try.jpg

check screenshot , working fine on comp.

twitter-bootstrap html5boilerplate

jquery - When a DIV comes into view add class -



jquery - When a DIV comes into view add class -

i'd add together class element, div on img, h1, etc. when comes viewport when user scrolls.

how calculate whether or not element in viewport or not?

in pseudo: if #swing has entered viewport add together classes 'animated bounceoutleft' (play animation using css3). when animation finish remove classes 'animated bounceoutleft'.

i don't know start other know code add together class want:

$('#star').addclass('animated bounceoutleft');

progress edit

thanks @bibhas i'm trying implement onscreen plugin, think i've done because dev tools says classnames there these classnames css3 transitions aren't playing, problem??

$(function() { setinterval(function() { $("#star") // <h2>s .filter(":onscreen") // <h2>s on screen .addclass('animated bounceoutleft'); }, 1000) // repeat every sec })

apparently wrote little jquery plugin that. code -

function isonscreena(elem) { var $window = $(window) var viewport_top = $window.scrolltop() var viewport_height = $window.height() var viewport_bottom = viewport_top + viewport_height var $elem = $(elem) var top = $elem.offset().top var height = $elem.height() var bottom = top + height homecoming (top >= viewport_top && top < viewport_bottom) || (bottom > viewport_top && bottom <= viewport_bottom) || (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom) }

the source code hardly 20 lines. can read , learn. - https://github.com/benpickles/onscreen

jquery css viewport addclass

Using one ? to contain several variables in PHP MySQLi prepared INSERT statement -



Using one ? to contain several variables in PHP MySQLi prepared INSERT statement -

trying grips prepared statements insert query. supposed add together new user database:

$statement = $mysqli->prepare("insert users (email,passwordhash) values (?)"); $statement->bind_param('s', "'$email','$passwordhash'"); $statement->execute();

is right utilize single ? , fill 2 values in way?

the way mysqli doing need bind variables separately

$statement = $mysqli->prepare("insert users (email,passwordhash) values (?,?)"); $statement->bind_param('ss', $email,$passwordhash); $statement->execute();

but if want way (say, have array ready , want insert using 1 placeholder) need helper class translate custom placeholder right sql statement:

$data = array('email'=>$email, 'passwordhash'=>$passwordhash); $db->query("insert users set ?u");

and shorter raw mysqli yet much more - error handling, profiling , such.

also maintain in mind when have variable number of fields insert, mysqli turned nightmare.

php insert mysqli

string - What's the fastest/most efficient way to count lines in Rebol? -



string - What's the fastest/most efficient way to count lines in Rebol? -

given string string, fastest/most-efficient way count lines therein? take best answers flavour of rebol. i've been working under assumption parse [some [thru]] combination fastest way traverse string, don't know certain, hence turning so:

count-lines: func [string [string!] /local count][ parse/all string [ (count: 1) [thru newline (count: count + 1)] ] count ]

or:

count-lines: func [string [string!] /local count][ count: 0 until [ count: count + 1 not string: find/tail string newline ] count ]

and how counters? how efficient repeat?

count-lines: func [string [string!]][ repeat count length? string [ unless string: find/tail string newline [ break/return count ] ] ]

update: line count goes text editor principle:

an empty document still has line count of one. so:

>> count-lines "" == 1 >> count-lines "^/" == 2

count-lines: func [ str /local sort-str ][ sort-str: sort bring together str "^/" 1 + subtract index? find/last sort-str "^/" index? find sort-str "^/" ]

string performance newline rebol

collections - In Scala, member of a class is not found when its instance is accessed from a list [Class] -



collections - In Scala, member of a class is not found when its instance is accessed from a list [Class] -

i have feeling problem facing has type erasure of scala, newbie can't set fingers on it. need help here.

first, code:

class c (val i: int) { def mkstring() = { println("c.i =" + this.i) } object c { implicit val cordering = new ordering [c] { def compare (a: c, b: c)= { a.i compare b.i; } }

then, create class holds collection of class 'c' thus:

class containerofc [c] (s:int) (implicit ordering: cordering[c]) { var internalcollection = new treeset[c]() def + (c:c): containerofc [c] = { this.internalcollection += c } def mkstringofelems () = { val y = this.internalcollection.tolist println (y.head.i) // <--- problem here } }

this repl tells me:

error: value not fellow member of type parameter c println(y.head.i) ^

i have checked type of 'y' out there: list[c]. if so, why not allowed access 'i'? construction parameter alright, val , hence, can treated fellow member variable, can't be?

i have gone through few of other related posts in forum, , manifests , typetags possible ways out here. but, not sure if need go level simple use-case.

this have unusual , familiar feeling of "been there, done that".

how seek alter this:

class containerofc [c] (s:int) (implicit ordering: cordering[c]) { ... }

to without type parameter c in declaration :

class containerofc(s:int) (implicit ordering: cordering[c]) { ... }

the code showed created class , specific type c. when later write class containerofc[c], c type parameter named other identifier. same defining class containerofc[a] a not have relation class/type c defined in before code. in illustration type parameter c shadow name of class defined earlier... error message indicating c not have value i , that's because compiler not referring same c thinking of.

edit: know if on same page without getting bogged downwards in other compilation errors, here few edits create code compile , using more commonly used indentation , brace style:

class c(val i: int) { def mkstring() = println("c.i =" + this.i) } object c { implicit val cordering = new ordering[c] { def compare(a: c, b: c) = a.i compare b.i } } class containerofc(s: int)(implicit ordering: ordering[c]) { var internalcollection = new collection.mutable.treeset[c]() def +(c: c): containerofc = { this.internalcollection += c } def mkstringofelems() = { val y = this.internalcollection.tolist println(y.head.i) } }

scala collections types type-erasure

c++ - std::vector::erase with equal arguments -



c++ - std::vector::erase with equal arguments -

is safe phone call iterative methods such stl container erase (the override taking 2 iterators), e.g. in case std::vector::erase(), both arguments beingness vec.end()? made experiment , looks phone call nothing, want sure can utilize safely in code, otherwise have test iterators , avoid erase() if they're equal.

c++ standard (n3337), 23.2.3, sequence containers, table 100 ('sequence container requirements) - row a.erase(q1,q2):

effects: erases elements in range [q1,q2).

this means a.erase(q,q) safe because nothing.

loki astari's reply this question has list of drafts of c++ standard. official re-create not freely available unfortunately, using n3337, seems closest c++11.

c++ stl

Is D3.js the right choice for real-time visualization of Neo4j Graph DB data -



Is D3.js the right choice for real-time visualization of Neo4j Graph DB data -

i cs research pupil @ uw, , grouping @ point of trying visualize specific network traffic set neo4j graph db in real time.

i have read many different tools such gephi, cytoscape, rickshaw (based on d3.js), others, , d3.js.

we far going forwards d3.js, wanted community opinion. can't utilize cytoscape because of neo4j, , sense d3.js work best semi-large info in fast real-time environment.

suggestions?

perhaps question, sense free input: best way implement neo4j? java, ruby, node.js?

thank you!

my understanding: gephi doesn't real-time updates; it's used on static data.

one major consideration - visualization wish present? directed graph? cyclic? weighted? additional labels?

some toolkits 'fixed' in can display, create easy nowadays graph. others (like d3) extensible, create anything.

for purposes of stackoverflow format, might improve answers if can pin downwards limitations , needs of scheme (actual info rate, thin/thick client, type of viz, etc)

d3.js visualization neo4j graph-databases graph-visualization

c++ - Private class variable requiring pointer? -



c++ - Private class variable requiring pointer? -

i'm putting c++ class, i'm running error can fix, don't quite understand.

i'm trying utilize next header (main.h):

#include <git2.h> class test { public: private: git_repository gitrepo; };

and next file (main.cpp):

#include "main.h" int main(int argc, char *argv[]){ test test; }

but giving me "test::gitrepo' uses undefined struct 'git_repository'". struct isn't undefined though, because if utilize pointer struct instead of struct itself...

git_repository * gitrepo;

...it compiles fine.

the type declaration git_repository follows:

typedef struct git_repository git_repository;

i grepped entire include tree, , that's typedef or struct definition in code. suggest actual struct definition hidden within of actual library implementation, not included in header?

because compiler see's git_repository incomplete type. compiler cannot see definition of construction git_repository treats incomplete type. means cannot inquire compiler operation needs compiler know size or layout of structure. can still declare pointer construction because pointers structures have same size irrespective of construction is.

if need create instance of construction compiler must see definition of construction , must include header defines type.

c++ qt

Environment variables not working in Perl -



Environment variables not working in Perl -

i trying set environment variables in perl @ origin of program, maintain receiving errors unless set them in bash script calls perl script.

#!/usr/bin/perl -w $env{'oracle_home'}='path'; $env{'ld_library_path'}='path';

this not work, shell script does:

#!/bin/bash export oracle_home=path export ld_library_path=path ./perlscript.pl

i setting these paths in order dbi module work. ideally, set paths in perl script , not utilize bash script.

error:

install_driver (oracle) failed: can't load /some/path/ module dbd:oracle: libclntsh.so.11.1: cannot open shared object file: no such file or directory @ /some/path/dynaloader.pm line 230

code use dbi; $dbh = dbi->connect("dbi:oracle:host=something;port=something;sid=something"); $sth = $dbh->perepare($query); $sth->execute(); $sth->finish();

iirc, it's because c library makes own re-create of environment and/or because ld_library_path used when executable loaded. workaround:

#!/usr/bin/perl -w if (!$env{oracle_home}) { $env{oracle_home} = 'path'; $env{ld_library_path} = 'path'; exec($^x, '--', $0, @argv); } ...

in case i'm wrong, seek next first. makes sure environment vars set before modules utilize them loaded.

#!/usr/bin/perl -w begin { $env{oracle_home} = 'path'; $env{ld_library_path} = 'path'; } ...

perl variables environment dbi dbd

ruby on rails - Is it good practice to send in multiple mail methods in an ActionMailer Model action, or should that logic be kept outside of the Mailer action? -



ruby on rails - Is it good practice to send in multiple mail methods in an ActionMailer Model action, or should that logic be kept outside of the Mailer action? -

which preferred?

class mailer < actionmailer::base # this? def bid_end_notify_failed_bidders(job) @job = job bidders = @job.bidders bidders.delete(@job.winner) bidders.each |t| mail(:to => t.email, ....) end end # or this? def notify_failed_bid(bidder) mail(:to => bidder ...) end end

i suggest method #2, because want agile in way send email.

the regular way of using is:

declare instance declare relations need instance pass instances mailer::base method deliver

example:

user = user.first

bets_won = user.bets_won

mailer.send_congrats(users, bets_won).deliver!

now utilize info it's beingness served no logic has done mailer class approach allow reuse method easily.

ruby-on-rails ruby-on-rails-3 coding-style actionmailer

cmake suppress finding package and set path manually -



cmake suppress finding package and set path manually -

i'm automating installation process multiple instances of application. application uses cmake building , uses libraries no findmodule.cmake files exist. since i'm find illustration how generate findmodule.cmake file existing libraries illustration opencascade. when setting buildprocess manually 1 can adapt include , lib path in ccmake. since want automate i'm looking way passing options cmake on command line. here how seek accomplish opencascade:

cmake -docc_found:internal=true -docc_include_dir:path=/usr/include/opencascade -docc_library:filepath=/usr/lib/libtkernel.so -dcmake_build_type:string=release ..

unfortunately doesn't work. since alternative building build-depended, passing configured cmakecache.txt file not working. suggestions accomplish i'm trying do.

cmake include-path

java - Does EasyMock do a object injection to JUnit code? -



java - Does EasyMock do a object injection to JUnit code? -

i'm new both junit , easymock. need inject few of classes junit test.

private static themanager themanager; public static void setupbeforeclass() throws exception { themanager = easymock.createmock(themanagerimpl.class); themanager.init(); }

will instantiate object of "themanagerimpl"? figured not calling code within implementation. how can inquire easymock me?

easymock not create instance of themangerimpl, mock instance of it. thought if want test class uses themanagerimpl should not worry how themanager implemented, logic in class a. in case create mock themanager, inject instance of class , specify in test how class supposed phone call themanager (what method, parameters , themanager supposed return).

java junit easymock

iphone - Create a Slideshow similar Collectionview -



iphone - Create a Slideshow similar Collectionview -

i created uicollectionview custom cells in horiztontally swipe diretcion (image 1). costumer wants see next cells on left end right side of display (image 2).

has idea?

you have adjust size of cells. in case showing images

iphone ios objective-c uicollectionview uicollectionviewcell

Hiding wordpress message using CSS -



Hiding wordpress message using CSS -

i want hide wordpress "please notify site administrator" message dashboard. message is:

wordpress 3.5.1 available! please notify site administrator.

html code:

<div class="update-nag"><a href="http://codex.wordpress.org/version_3.5.1">wordpress 3.5.1</a> available! please notify site administrator.</div>

so, have added css hide message not working!here css:

.update-nag{ display: none;}

any idea?

you can sue module found prijm enable module, job: hide update reminder message

css wordpress wordpress-theming

How to update a table, delete entries from the table asynchronously using jquery, ajax, php, and mysql? -



How to update a table, delete entries from the table asynchronously using jquery, ajax, php, and mysql? -

okay, have page builds table base of operations on mysql table using php:

tables.php

$page .='<form method="post" action="processing.php">'; $page .= "<table> \n"; $page .= "<tr>\n"; $page .= "<th>id</th> \n <th>first name</th> \n <th>last name</th> \n <th>phonenumber</th> \n <th>email</th> \n"; //loops through each contact, displaying info in table according login status $sql2="select cid, firstname, lastname, phonenum, email contact oid=".$_get['orgid']; $result2=mysql_query($sql2, $connection) or die($sql1); while($row2 = mysql_fetch_object($result2)) { $page .= "<tr>\n"; $page .= "<td>".$row2->cid."</td>\n"; $page .= "<td>".$row2->firstname."</td>\n"; $page .= "<td>".$row2->lastname."</td>\n"; $page .= "<td>".$row2->phonenum."</td>\n"; $page .= "<td>".$row2->email."</td>\n"; //will display these buttons if logged in $page .= '<td><input type="checkbox" name="checkeditem[]" value="'.$row2->cid.'"></input></td>'."\n"; $page .= "<td>".makelink("addeditcontact.php?cid=".$row2->cid, "edit")."</td>\n"; $page .="</tr>"; } $page .= "</table>"; //two buttons sending processing.php decide selected values there $page .= '<input name="addtocontacts" type="submit" value="add selected contacts contact list" />'."\n" ; $page .= '<input name="deletecontacts" type="submit" value="delete selected contacts" />'."\n"; $page .= "</form>\n"; mysql_close($connection);

so base of operations on checkboxes, can take add together contacts table, or delete contacts off of table first sending info of form processing.php page decides button click , redirects proper php script:

processing.php:

if(!empty($_post['checkeditem'])) { //because addtocontacts , deletecontacts take in instead of post convinience, needs take of checkitems , implode $var=$_post['checkeditem']; ksort($var); $joinedstring= implode(',',$var); //since there 2 buttons in orgdetail, checks pushed , sends right page if(!empty($_post['addtocontacts'])) { header('location: addtocontacts.php?cid='.$joinedstring); } else if($_post['deletecontacts']) { header('location: deletecontacts.php?cid='.$joinedstring); } } else { //error not selecting items $page .= makep("you have not checked off items. please click ".makelink( $currentpage, "here")." homecoming previous page"); }

and since interested in delete contact case right now. here deletecontacts.php

$explodedstring=explode(',',$_get['cid']); foreach($explodedstring $estring) { $sql1="delete contact cid='".$estring."'"; mysql_query($sql1, $connection) or die($sql1); } header('location: '. $currentpage);

so here gets complicated. works fine when want page work synchronously. bounces around php scripts , well. if want delete straight tables.php using jquery. mean that, run mysql query delete entries actual db, , after update table view in tables.php reflect change; done asynchronously?

(please ignore fact sql queries aren't escaped strings, realize , i'll have prepare later)

thanks in advance.

if need back upwards table without javascript working first

your way maintain table date without javascript enabled refresh page , redraw table on each load.

php jquery mysql asynchronously

c# - Awesomium javascript-related crash/freeze -



c# - Awesomium javascript-related crash/freeze -

i'm wondering if has encountered problems awesomium relating webview goes unresponsive lite bluish screen if there problem js in loaded script.

i'm developing in c# , awesomium 1.7 rc3. if underlying javascript can't executed due syntax error example, entire page render blank. outside of awesomium, renders html , displays page. i'm handling crashed event, it's not beingness called. app, nor webview crashing. i've tried using both windowed webview instance , webcontrol instance, issue remains.

i've searched thoroughly experiencing similar problem, seems i'm one. ideas appreciated.

same problem me !! don't understand

edit : seems loadhtml function limited in size, page breaks !

i load minimum on loadhtml , execute more script in documntready event, executejavascript function.

it seems work me larger data.

ex :

helper.projecttimeline.webcontrol.documentready += (object s, urleventargs ee) => { helper.projecttimeline.webcontrol.executejavascript("window.source = " + dynamicjson.serialize(source)); helper.projecttimeline.webcontrol.executejavascript("start();"); };

c# javascript winforms awesomium

Highcharts:column drill down:JSON -



Highcharts:column drill down:JSON -

i trying create drill downwards highcharts column graph. can utilize examples , create work long info hardcoded. can illustration working info mysql database.

what need know how phone call in series.

example:

/// needs info mysql (a total sum) of x-data name = 'browser brands', info = [{ y: 55.11, color: colors[0], ////// drill downwards needs breakdown of info drilldown: { name: 'msie versions', categories: ['msie 6.0', 'msie 7.0', 'msie 8.0', 'msie 9.0'], data: [10.85, 7.35, 33.06, 2.81], color: colors[0] } ///////// need drill show breakdown of info 1 time again } /// needs info mysql (a total sum) of y-data name = 'browser brands', info = [{ y: 55.11, color: colors[0], ////// drill downwards needs breakdown of info drilldown: { name: 'msie versions', categories: ['msie 6.0', 'msie 7.0', 'msie 8.0', 'msie 9.0'], data: [10.85, 7.35, 33.06, 2.81], color: colors[0] } ///////// need drill show breakdown of info 1 time again }

so in theory how can have chart 1 first series show total x,y,z when either clicked, shows break downwards of data, when either of next columns clicked show yet 1 time again farther breakdown of data.

i understand there multiple mysql queries, multiple arrays. don't understand how phone call them when needed

take @ part:

click: function() { var drilldown = this.drilldown; if (drilldown) { // drill downwards this.series.chart.settitle({ text: drilldown.name }); setchart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color, drilldown.level); } else { // restore setchart(name, categories, data, null, level); } }

just utilize $.getjson() there, , within $.getjson() utilize setchart() method info ajax. (not tested):

click: function() { var drilldown = this.drilldown; if (drilldown) { // drill downwards var chart = this.series.chart; $.getjson(...., function(data){ chart.settitle({ text: data.name }); setchart(data.name, data.categories, data.data, data.color, data.level); }); } else { // restore setchart(name, categories, data, null, level); } }

highcharts

database - How can I copy records between tables only if they are valid according to check constraints in Oracle? -



database - How can I copy records between tables only if they are valid according to check constraints in Oracle? -

i don't know if possible, want re-create bunch of records temp table normal table. problem records may violate check constraints want insert possible , generate error logs somewhere else invalid records.

if execute:

insert normal_table select ... temp_table

nothing inserted if record violates constraint. create loop , manually insert 1 one, think performance lower.

ps: if possible, i'd solution works oracle 9

from oracle 10gr2, can utilize log errors clause:

execute dbms_errlog.create_error_log('normal_table'); insert normal_table select ... temp_table log errors reject limit unlimited;

in simplest form. can see errors got:

select ora_err_mesg$ err$_normal_table;

more on create_error_log step here.

i think approach works 9i, don't have instance available test on, run on 11gr2 update: tested , tweaked (to avoid pls-00436) in 9i:

declare type t_temp_table table of temp_table%rowtype; l_temp_table t_temp_table; l_err_code err_table.err_code%type; l_err_msg err_table.err_msg%type; l_id err_table.id%type; cursor c select * temp_table; error_array exception; pragma exception_init(error_array, -24381); begin open c; loop fetch c mass collect l_temp_table limit 100; exit when l_temp_table.count = 0; begin forall in 1..l_temp_table.count save exceptions insert normal_table values l_temp_table(i); exception when error_array j in 1..sql%bulk_exceptions.count loop l_id := l_temp_table(sql%bulk_exceptions(j).error_index).id; l_err_code := sql%bulk_exceptions(j).error_code; l_err_msg := sqlerrm(-1 * sql%bulk_exceptions(j).error_code); insert err_table(id, err_code, err_msg) values (l_id, l_err_code, l_err_msg); end loop; end; end loop; end; /

with real columns instead of id, i've done demo purposes:

create table normal_table(id number primary key); create table temp_table(id number); create table err_table(id number, err_code number, err_msg varchar2(2000)); insert temp_table values(42); insert temp_table values(42);

then run anonymous block above...

select * normal_table; id ---------- 42 column err_msg format a50 select * err_table; id err_code err_msg ---------- ---------- -------------------------------------------------- 42 1 ora-00001: unique constraint (.) violated

this less satisfactory on few levels - more coding, slower if have lot of exceptions (because of individual inserts those), doesn't show constraint violated (or other error details), , won't retain errors if rollback - though phone call autonomous transaction log if issue, uncertainty here.

if have little plenty volume of info not want worry limit clause can simplify bit:

declare type t_temp_table table of temp_table%rowtype; l_temp_table t_temp_table; l_err_code err_table.err_code%type; l_err_msg err_table.err_msg%type; l_id err_table.id%type; error_array exception; pragma exception_init(error_array, -24381); begin select * mass collect l_temp_table temp_table; forall in 1..l_temp_table.count save exceptions insert normal_table values l_temp_table(i); exception when error_array j in 1..sql%bulk_exceptions.count loop l_id := l_temp_table(sql%bulk_exceptions(j).error_index).id; l_err_code := sql%bulk_exceptions(j).error_code; l_err_msg := sqlerrm(-1 * sql%bulk_exceptions(j).error_code); insert err_table(id, err_code, err_msg) values (l_id, l_err_code, l_err_msg); end loop; end; /

the 9i documentation doesn't seem online more, in new-features document, , lots of people have written - it's been asked here before too.

database oracle check-constraints

php - GROUP BY and ORDER BY clause coming after prepare statement (mysqli) -



php - GROUP BY and ORDER BY clause coming after prepare statement (mysqli) -

i have query below dynamic clause having issue placing grouping , order clause. don't think beingness triggered @ because prepare statement ahead of clauses. not allow me place clause line above prepare statement or gives me error stating undefined questions in different line. question should grouping , order clause correctly placed?

code:

$selectedstudentanswerqry = " select sa.studentid, studentalias, studentforename, studentsurname, q.sessionid, ... pupil st ... "; // empty $where = array('q.sessionid = ?'); $parameters = array($_post["session"]); $parametertypes = 'i'; //check if post empty // check whether specific pupil selected $p_student = empty($_post["student"])?0:$_post["student"]; // if $_post['student'] either 0 or empty $p_student 0 echo $p_student; switch($p_student){ case 0: //dont' add together filters break; default: $where[] = 'sa.studentid = ?'; $parameters[] .= $_post["student"]; $parametertypes .= 'i'; } // if added $where in of conditionals, need clause in // our query if(!empty($where)) { $selectedstudentanswerqry .= ' ' . implode(' , ', $where); global $mysqli; $selectedstudentanswerstmt=$mysqli->prepare($selectedstudentanswerqry); // need phone call bind_param 1 time if (count($where) == 1) { $selectedstudentanswerstmt->bind_param($parametertypes, $parameters[0]); } else if (count($where) == 2) { $selectedstudentanswerstmt->bind_param($parametertypes, $parameters[0], $parameters[1]); } } $selectedstudentanswerqry .= " grouping sa.studentid, q.questionid order studentalias, q.sessionid, questionno ";

move prepare statement , if statements containing bind_param() underneath grouping by/order clause. have closing } above $selectedstudentanswerqry can moved above if (count($where) == 1)

php mysqli

c# - Processing incoming messages from UdpClient.BeginReceive() -



c# - Processing incoming messages from UdpClient.BeginReceive() -

okay, first stack overflow question please sense free suggest improve ways inquire or should include next time. of time can google answers 1 little trickier...

i writing windows application in c# listens on udp port , process incoming udp messages. more specifically, using udpclient class , listening using beginreceive method. receive callback in turn firing it's own message received event , resetting udp client again. "messagereceived" event subsequently handled processor object.

i thought pretty smart until manager posed questions me such as:

how many messages can receive @ 1 time? happens if more that? are messages queued or lost if processing takes long? what happen if processing takes long?

we cannot losing messages because lastly 1 still processing, , can't building until scheme crashes because it's out of memory either. hear (and rightfully so) sort of verification there deterministic way deal "storm" of messages. unfortunately, have no thought go answer. have included think relevant code below.

so:

does know answers questions above? where research find these answers and/or patterns follow sort of thing? what kind of tools utilize watch processing debugging/performance profiling?

if have made huge error in design, should sort out (i.e. introduce queue, utilize thread pool etc)?

public void receivecallback(iasyncresult ar) { //cast item listener udplistener listener = (udplistener)ar.asyncstate; //if supposed listening, info socket //listen false during shutdown if (listen) { //the seek grab placed within hear loop if there error in processing //recover , hear again. may cause more exceptions can sure not // stop listening without knowing seek { //address , port external scheme ipendpoint ep = listener.endpoint; //get info async read byte[] receivebytes = listener.client.endreceive(ar, ref ep); //reset socket hear 1 time again listener.client.beginreceive(new asynccallback(receivecallback), listener); //execute event pass external components message heartbeateventargs hea = new heartbeateventargs(datetime.now, ep, receivebytes); onheartbeatreceived(hea); //ack external scheme heartbeatacknowledgement(new ipendpoint(ep.address, ep.port), receivebytes); } grab (exception e) { log.error(e.message); //reset socket hear 1 time again } } }

listner wrapper around udpclient. follows:

#region udpclient wrapper (udplistener) /// <summary> /// udplistener used command asynchronous processing of udpclient object. /// </summary> public class udplistener { /// <summary> /// ipendpoint on take connection. set "any". /// </summary> public ipendpoint endpoint { get; set; } /// <summary> /// socket based client object used communication /// </summary> public udpclient client { get; set; } public udplistener(int port) { endpoint = new ipendpoint(ipaddress.any, port); client = new udpclient(endpoint); } } #endregion

thanks,

dinsdale

if losing messages concern, udp isn't you. udp guarantees if message arrives, complete. not guarantee message order or delivery. in other words, if client sends 2 messages, might receive them out of order, or first, or lastly (or none @ all). if need guarantee delivery , order, utilize tcp instead (tcp comes it's own set of guarantees , gotchas).

with regard how many messages can process, have upper limit. if aren't processing messages faster arriving, queued, either in application layer or in udp networking layer. 1 time network buffers full, network interface begin throwing away messages.

c# asynchronous .net-4.5 udpclient

c# - StreamReader with tab delimited text file -



c# - StreamReader with tab delimited text file -

i have similar requirement post... populate gridview @ runtime using textfile

where want read text file streamreader , populate datatable info in file, i'm not sure how implement split() tab.

could point me in right direction, please?

you can seek this:

datatable table = new datatable(); table.columns.add("col1"); table.columns.add("col2"); table.columns.add("col3"); var lines = file.readalllines(@"data.txt").tolist(); lines.foreach(line => table.rows.add(line.split((char)9)));

i presumed rows delimited newline (if that's case readalllines method can used). number 9 ascii value horizontal tab character , used splitting line. foreach method can used on generic lists, there instead of foreach loop.

c# asp.net split streamreader tab-delimited-text

ios - Unable to add text from UITextField to an Array -



ios - Unable to add text from UITextField to an Array -

currently have custom view table cell , text field above it. want text uitextfield , set nsmutablearray.

pseudocode:

string text = _textfield.text; [array addobject:text]; nslog{array}

in header file have created textfield , array.

i receive error : 'customtableview:[340:11303] array: (null)' when nslog.

i not sure why text textfield not getting added array. if 1 able help appreciated.

note - textfield above custom cell not in it. have tried adding string array straight , logging , same error. assume array.

did initialize array.take mutablearray , initialize it.

nsmutablearray *array=[nsmutablearray alloc]init];

ios arrays uitableview uitextfield gettext

ext4 - Ext 4.1 form panel loadRecord -



ext4 - Ext 4.1 form panel loadRecord -

i have grid actioncolumn. on click of actioncolun shows menu edit , delete items. when click on edit should display modal-popup window form panel. row info should displayed in fields. i'm able accomplish above thing using loadrecord method.

the code i'm using

actioncolumn.on('click', function (grid, td, rowindex, eve, e) { var rec = grid.getstore().getat(rowindex); if (!this.menu) { this.menu = ext.create('ext.menu.menu', { width: 100, height: 70, plain: true, floating: true, items: [{ text: 'edit', icon: 'images/edit.png', handler: function (a, b, c, d) { var view = ext.widget('userwindow'); view.down('baseform').loadrecord(rec); } }

}

but problem when i'm clicking on edit sec time form panel displaying info loaded first time.

can help

thanx in advance

i achieved above setting record separate variable like

actioncolumn.on('click', function (grid, td, rowindex, eve, e) { actioncolumn.rec = grid.getstore().getat(rowindex); if (!this.menu) { this.menu = ext.create('ext.menu.menu', { width: 100, height: 70, plain: true, floating: true, items: [{ text: 'edit', icon: 'images/edit.png', handler: function (a, b, c, d) { var view = ext.widget('userwindow'); view.down('baseform').loadrecord(actioncolumn.rec); } }

regards url

ext4

extjs - Sencha Touch 2 : Not able to add the tabpanel as an item in the panel -



extjs - Sencha Touch 2 : Not able to add the tabpanel as an item in the panel -

i trying add together tabpanel item in panel not work expected.

i have defined tabpanel separate view below.

ext.define("wu.view.wutabpanel", { extend: "ext.tab.panel", alias: "widget.wutabpanel", config: { tabbar: { docked: 'bottom' }, items: [ { title: 'home', iconcls: 'home', html: 'home screen', }, { title: 'send money', iconcls: 'favorites', html: 'contact screen', } ] }, });

this main view trying add together tabpanel within panel.

ext.define('wu.view.wuhomepage', { extend : 'ext.panel', requires : [ 'ext.toolbar', 'ext.titlebar', 'ext.dataview.list', 'ext.ajax', 'ext.data.proxy.ajax' ], xtype : 'homepage', alias : 'widget.wuhomepageview', config : { fullscreen : true, title : 'mainmenu', // iconcls : 'mainmenuhome', disabledcls : 'mainmenuhome', items : [ { xtype : 'titlebar', title:'main menu', items : [ { text : 'back', ui:'back', id : 'homepageback', align : 'left', handler : function(btn) { console.log('homepaga >> login'); this.up('homepage').fireevent('backbuttoncommand', this,'homepage'); } } ] }, { xtype : 'list', id : 'mainlist', title : 'sample', height : '100%', }, itemtpl : '<div class = mainlist>' '<div class = listarrowimage><img class= marrowimage src={arrow}></img></div>' </div>', }, { xtype: 'wutabpanel', }, ], }, });

when mainpage rendered,the tab bar not appeared in bottom , leave hollow space in bottom.

is there issue configuration? improve ideas on how accomplish part? in application, there 7-8 views , have same tabbar in bottom.

thanks.

you seem trying set titlebar, height 100% list, , tabpanel 1 fullscreen component. titlebar fine i'm sure (if docked toolbar), list trying take height , leaving none tabpanel. remember tabpanel not tabbar, it's both. if want bottom bar command main views hen set list 1 of tabpanel items.

extjs sencha-touch sencha-touch-2

java - Access to jsp path with .action postfix in struts2 -



java - Access to jsp path with .action postfix in struts2 -

i have project using struts 2.1.8. project configured annotation using struts2-convention-plugin. here struts config in web.xml:

<filter> <filter-name>struts2filter</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2filter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts2filter</filter-name> <url-pattern>/struts/*</url-pattern> </filter-mapping>

struts.xml:

<constant name="struts.convention.default.parent.package" value="borrow-default" /> <constant name="struts.convention.package.locators" value="action" /> <constant name="struts.convention.package.locators.basepackage" value="com.abc.action" /> <constant name="struts.convention.result.path" value="/" />

a.java:

@namespace("/regist") public class extends actionsupport{ @action(value="/a", results = {@result(location = "/a/test.jsp")}) public string execute(){ homecoming success; } }

here problem, can access test.jsp in url http://localhost:8080/a/test.jsp , http://localhost:8080/regist/a.action, can still visit same page in url http://localhost:8080/a/test.action. don't know why happens, what's wrong in config or code?

i tried other url, seems namespace doesn't take effect.

in web.xml url pattern like:

<url-pattern>/struts/*</url-pattern>

but placed jsp , getting /a/test.jsp 1 time check it...

java struts2 namespaces

c++ - Win32 API to enumerate dll export functions? -



c++ - Win32 API to enumerate dll export functions? -

i found similar questions no reply looking for. here goes:

for native win32 dll, there win32 api enumerate export function names?

dumpbin /exports pretty much want, that's developer tool, not win32 api.

loadlibraryex dont_resolve_dll_references heavily cautioned against, happens useful particular case – heavy lifting of mapping dll memory (but don't need or want utilize library), makes trivial read header: module handle returned loadlibraryex points right @ it.

#include <winnt.h> hmodule lib = loadlibraryex("library.dll", null, dont_resolve_dll_references); assert(((pimage_dos_header)lib)->e_magic == image_dos_signature); pimage_nt_headers header = (pimage_nt_headers)((byte *)lib + ((pimage_dos_header)lib)->e_lfanew); assert(header->signature == image_nt_signature); assert(header->optionalheader.numberofrvaandsizes > 0); pimage_export_directory exports = (pimage_export_directory)((byte *)lib + header-> optionalheader.datadirectory[image_directory_entry_export].virtualaddress); assert(exports->addressofnames != 0); byte** names = (byte**)((int)lib + exports->addressofnames); (int = 0; < exports->numberofnames; i++) printf("export: %s\n", (byte *)lib + (int)names[i]);

totally untested, think it's more or less correct. (famous lastly words.)

c++ windows winapi dll

mysql - SEC_TO_TIME time error -



mysql - SEC_TO_TIME time error -

i testing out queries create sure giving proper results. noticed getting wrong time. 1 of timestamps

2013-02-07 07:26:04

and subtract :

2013-02-07 07:18:23

from first time stamp

and giving me difference of twelve or minutes. i'm not math genius can 18 - 12 = 6... not 12... knew there problem query. removed sec_to_time , gave me right time diff of :

+------------+-----------+--------------+----------------+--------+----------+ | session_id | anum | first | lastly | why | time | +------------+-----------+--------------+----------------+--------+----------+ | 220 | b00000000 | testing | thisout | other | 00:07:41 | +------------+-----------+--------------+----------------+--------+----------+ query : select session.session_id, session.anum, student.first, student.last, session.why, (timediff(t.fin, session.signintime)) time session inner bring together pupil on session.anum = student.anum left bring together (select support.session_id, max(support.finishtime) fin back upwards grouping support.session_id) t on t.session_id = session.session_id session.status = 3

the problem comes when add together sec_to_time before timediff.

why happen?

now show guys result of query sec_to_time :

+------------+-----------+--------------+----------------+--------+----------+ | session_id | anum | first | lastly | why | time | +------------+-----------+--------------+----------------+--------+----------+ | 220 | b00000000 | testing | thisout | other | 00:12:21 | +------------+-----------+--------------+----------------+--------+----------+ 2 rows in set (0.00 sec)

any explanation lovely.

00:07:41 = 741 seconds = 00:12:21 how sec_to_time sees it. function takes number of seconds , converts format h:m:i. have h:m:i, makes no sense utilize sec_to_time here.

mysql datetime select

ios - Starts landscape orientation in iPad? -



ios - Starts landscape orientation in iPad? -

i have tried ipad application landscape orientation changes in info.plist are

appdelegate.m

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.window.backgroundcolor = [uicolor whitecolor]; [self.window makekeyandvisible]; cgrect screenbound = [[uiscreen mainscreen] bounds]; nslog(@"screenbound:%@",nsstringfromcgrect(screenbound)); homecoming yes; }

then screen resolution cgrect screenbound:{{0, 0}, {768, 1024}} want {{0, 0}, {1024, 768}}, how this? please help me

thanks in advance

in .plist instead uiinterfaceorientation utilize uisupportedinterfaceorientations, , create landscape orientaation first 1 in uisupportedinterfaceorientations list.

ios xcode ipad orientation landscape

node.js - Nginx + Express + Socket.IO workarounds -



node.js - Nginx + Express + Socket.IO workarounds -

as know @ time nginx stable version can't proxy tcp connections. if express , socket.io work on same port need utilize other proxy solution.

but there other ways bypass problem:

what if set socket.io hear different port, express listens. example: nginx proxies 80 port 8000 port, express listens on 8000 port, socket.io listens 8001 port , client connects socket.io straight 8001 port. using nginx_tcp_proxy_module can proxy tcp connections, can't utilize http on same port. utilize such solution: nginx proxies 80 port 8000 port , 81 port (for websockets) 8001, express listens on 8000 port, socket.io listens on 8001 port , client connects socket.io 81 port.

what advantages , disadvantages these approaches have?

i prefer utilize haproxy in front end , have 1 public open port. "rooting" done per path.

the config looks (you can find many tutorials/resources)

frontend 0.0.0.0:80 acl is_websocket path_beg /websocket/ use_backend nodejs if is_websocket default_backend nginx backend nodejs server srv_node 127.0.0.1:16852 backend nginx balance roundrobin server srv_static 127.0.0.1:8080

node.js nginx express socket.io

retrieve php server session timeout -



retrieve php server session timeout -

i want retrieve value of session.gc_maxlifetime php server settings ( time after session expires after no activity ). of import : not want alter it, wish retrieve value ( maybe value different server server ) , want utilize php script made warn users properly, depending on settings of server.

thank you.

that's ini_get function comes in hand:

$maxlifetime = ini_get("session.gc_maxlifetime");

from manual read:

session.gc_maxlifetime integer session.gc_maxlifetime specifies number of seconds after info seen 'garbage' , potentially cleaned up. garbage collection may occur during session start (depending on session.gc_probability , session.gc_divisor).

php session

mysql - Ordering SQL results by the field where they are found -



mysql - Ordering SQL results by the field where they are found -

we have search query allows users come in string , searches 3 separate fields via '%string%'. fields are:

name description type

when homecoming results , right order them arbitrarily. prefer results ordered first results found in name field, sec items found in description field, , lastly in type field. because have paging , sorting associated this, want returned in 1 record set. possible?

thanks in advance.

in mysql, next should work:

select * atable name '%string%' or description '%string%' or type '%string%' order case when name '%string%' 1 when description '%string%' 2 when type '%string%' 3 end ;

mysql sql

ajax - InputNumber submit -



ajax - InputNumber submit -

i have problem inputnumber primefaces extensions. have inputnumber component on form , when come in value in form , right after press come in button page submitted without value in inputnumber field. works when field loses focus. checked in showcase there same problem. in case, field required , when press come in button, value gone , validation message says value missing shown. help?

set input required="true" grab "enter" key , alter focus otherinput below; run on .xhtml page between <script type="text/javascript"> </script> tags.

$( 'form' ).bind('keypress', function(e){ if ( e.keycode == 13 ) { document.getelementbyid('input10_input').focus(); } });

it works showcase.

good luck!

ajax jsf primefaces primefaces-extensions

c# - Starting process only works in console application -



c# - Starting process only works in console application -

i trying launch external exe web application (running on visual studio development server). when run code below console application works fine, when run web page application crashes. presume must permissions issue, have tried few things , not been able working.

private void runexe(string pythonoutputfilenameandlocation) { var process = new process { startinfo = getprocessstartinfo(pythonoutputfilenameandlocation) }; // application crashes process.start(); // ...do more things here } private processstartinfo getprocessstartinfo(string pythonoutputfilenameandlocation) { var startinfo = new processstartinfo { createnowindow = true, useshellexecute = false, redirectstandardoutput = true, redirectstandardinput = true, filename = _exefilelocation, windowstyle = processwindowstyle.hidden, arguments = string.format("--hideui --runscript {0}", pythonoutputfilenameandlocation) }; homecoming startinfo; }

what asking why code work console application, not visual studio web server?

i using windows 7 , visual studio 2010.

edit:

as requested here problem details beingness caught windows:

problem event name: bex application name: application version: 2.2.2.2909 application timestamp: 507bf285 fault module name: msvcr100.dll fault module version: 10.0.40219.325 fault module timestamp: 4df2be1e exception offset: 0008af3e exception code: c0000417 exception data: 00000000 os version: 6.1.7601.2.1.0.256.48 locale id: 2057 additional info 1: c5a0 additional info 2: c5a0d9e876212c0d3929ba8445f002dc additional info 3: 5e93 additional info 4: 5e93e44f8aa24f99d37e055f533d1658

i can't debug external application don't have code it. don't have stack trace not getting exception. external process crashing.

thanks

ronnie, might running uac , security access issue. seek disabling uac , trying again. also, consider on real webserver process started asp.net or web user permissions. these accounts limited on purpose security reasons. means application trying start may fail because cannot access files needs. reason starting external exe web server not recommended. however, can check stackoverflow question running applications admin credentials. how run c# application admin creds?

c# process permissions

innodb - MySQL search TEXT field for matching text, for absolute on a multiline -



innodb - MySQL search TEXT field for matching text, for absolute on a multiline -

okay, have table in innodb. has column called "spellings" text field (not varchar). in column, have multiple ways spell something, each way separated line break. instance 1 of rows follows:

soulcalibur soul calibur

then have row information

soulcalibur ii soulcalibur 2 soul calibur ii soul calibur 2

now lets want find rows contain "soul calibur", using:

select * games spellings '%soul calibur%'

the problem returns both rows, because technically sec row have "soul calibur". there way in mysql query query soul calibur show fields contain soul calibur on line. exact match after parsing line breaks.

if remove %, doesnt work because first row technically soulcalibur\nsoul calibur

i think need utilize char(10) line breaks. seek concat('%soul calibur', char(10), '%')

mysql innodb

php - Navigate to a $_FILE array to get particular array of files with different name[] -



php - Navigate to a $_FILE array to get particular array of files with different name[] -

overview

i have multi-part form has 4 file upload fields , 3 of these dynamically added (using javascript).

<input type="file" name="onecertificate" /> <input type="file" id="multiplecertificate[1] "name="multiplecertificate[]" /> <input type="file" id="multiplecertificate[2] "name="multiplecertificate[]" /> // more if add together button pressed

here output of var_dump($_files):

["onecertificate"]=> array(5) { ["name"]=> string(6) "de.pdf" ["type"]=> string(15) "application/pdf" ["tmp_name"]=> string(24) "c:\xampp\tmp\php37c2.tmp" ["error"]=> int(0) ["size"]=> int(103845) } // **notice attributes in own arrays** ["multiplecertificate"]=> array(5) { ["name"]=> array(2) { [0]=> string(6) "de.pdf" [1]=> string(6) "de.pdf" } ["type"]=> array(2) { [0]=> string(15) "application/pdf" [1]=> string(15) "application/pdf" } ["tmp_name"]=> array(2) { [0]=> string(24) "c:\xampp\tmp\phpd941.tmp" [1]=> string(24) "c:\xampp\tmp\phpd942.tmp" } ["error"]=> array(2) { [0]=> int(0) [1]=> int(0) } ["size"]=> array(2) { [0]=> int(103845) [1]=> int(103845) } } // , on...

below how upload each file:

function upload_file($field_name) { // timestamp name: http://stackoverflow.com/questions/7457152/did-not-select-a-file-to-upload-when-uploading-using-codeigniter $the_date= date('y/n/j h:i:s'); $replace = array(":"," ","/"); $new_name = str_ireplace($replace, "-", $the_date); $config['upload_path'] = './uploads/'; $config['file_name'] = $new_name; $config['allowed_types'] = 'pdf|jpg|jpeg|png'; $this->load->library('upload'); $this->upload->initialize($config); // onecertificate normal way since have 1 file content if ( $field_name == 'onecertificate' ) { if ( ! $this->upload->do_upload($field_name)) { homecoming array('error' => $this->upload->display_errors()); } else { $file_data = array('upload_data' => $this->upload->data()); } // method multiplecertificate } else { ($i = 0; $i < count($_files[$field_name]['name']); $i++) { if ( ! $this->upload->do_upload($_files[$field_name]['name'][$i])) { $file_data = array('error' => $this->upload->display_errors()); } else { $file_data = array('upload_data' => $this->upload->data()); } } // end loop } homecoming $file_data; } the problem

i noticed format of onecertificate works since all of info in single array compared multiplecertificate has each attribute in own array.

the first manages upload file latter throws you did not select file upload.

how transform and/or retrieve form of multiplecertificate onecertificate?

note: form need since assign arrays created $onecertificate , $multiplecertificate database insertion.

for had problem mine regarding how $_files handles file arrays, hohner's comment above solved problem.

here link answer.

basically "looping inner arrays of $_file array" goes this:

function do_upload($file_name) { $this->load->library('upload'); $this->total_count_of_files = count($_files[$file_name]['name']); // timestamp name: http://stackoverflow.com/questions/7457152/did-not-select-a-file-to-upload-when-uploading-using-codeigniter $date_timestamp = date('y/m/j h:i:s'); $replace = array(":"," ","/"); $new_name = $file_name.'-'.$this->session->userdata('accreditno').'-'.str_ireplace($replace, '', $date_timestamp); for($i = 0; $i < $this->total_count_of_files; $i++) { // userfile arbitrary, not reflect on final array $_files['userfile']['name'] = $_files[$file_name]['name'][$i]; $_files['userfile']['type'] = $_files[$file_name]['type'][$i]; $_files['userfile']['tmp_name'] = $_files[$file_name]['tmp_name'][$i]; $_files['userfile']['error'] = $_files[$file_name]['error'][$i]; $_files['userfile']['size'] = $_files[$file_name]['size'][$i]; $config['file_name'] = $new_name.'-'.$i; $config['upload_path'] = "./uploads/$file_name"; $config['allowed_types'] = 'pdf|jpg|jpeg|png'; $config['max_size'] = '0'; $this->upload->initialize($config); if ( ! $this->upload->do_upload()) { $file_data = array('error' => $this->upload->display_errors()); } else { $file_data = array("file_{$i}" => $this->upload->data()); } } homecoming $file_data; }

file info contain assembled attributes of 1 file inserted database! (how want in case)

php arrays codeigniter file-io

c - detecting end of http header with \r\n\r\n -



c - detecting end of http header with \r\n\r\n -

using recv want http header can parse content length. i'm having problem detecting line break. or have observe line break or first time read buffer finish header (assuming have long plenty buffer).

this written in c.

edit: looking @ of related questions 1 of things worried "...the "\r\n" of header break might pulled buffer 2 different calls recv() prevent code recognizing header break."

you should phone call recv() repeatedly , each time gives x bytes increment buffer-pointer give x bytes (and decrease cb allowed write x bytes). until buffer either contains \r\n\r\n or full, in case close socket , ignore malicious client on. buffer-size should 3000 bytes.

but: ignores general problem server seems polling-server. if have experience should seek create epoll-server instead.

c http

c# - What am I doing wrong with this regular expression? -



c# - What am I doing wrong with this regular expression? -

(?!^\*)\w{1,20}

i'm trying ensure input between 1 , 20 characters long , doesn't begin '*'. other character under sun allowed though.

the look doesn't work in c# seem work using tester:http://www.regexplanet.com/advanced/java/index.html

what need change?

thanks insight on this.

edit: request, here c# code:

system.text.regularexpressions.regex tempregex = new system.text.regularexpressions.regex(@"(?!^\*)\w{1,20}"); homecoming tempregex.ismatch(_inputstring);

not sure trying first capturezero-width negative lookahead assertion, next regular look seem match requirement:

@"^[^\*]\w{0,19}$"

"^...$" portion forces matching of whole string. first character "[^\*]" (anything star) counted against [1-20] restriction, range {0,19}.

c# regex

wix - Adding script maps during installation of web application IIS -



wix - Adding script maps during installation of web application IIS -

has added iis script maps wix installation. have been using this:

<customaction id="addhandlers_cmd" property="addhandlers" value="&quot;[systemfolder]inetsrv\appcmd&quot; set config -section:system.webserver/handlers /+&quot;[\[]name='gsoap',path='*.dll', verb='*',modules='isapimodule',scriptprocessor='[bin]mod_gsoap.dll',resourcetype='file', requireaccess='execute'[\]]&quot;" execute="immediate"/> <customaction id="addhandlers" binarykey="wixca" dllentry="caquietexec" execute="deferred" return="check" impersonate="no"/>

however 404 errors web application , when add together script map manually after installing application works perfectly. appreciate if share how done this.

i haven't worked gsoap handler, used asp.net isapi extention. suppose has same level of integration. post code asp.net , hope won't have problem changing gsoap. have huge risk of changing incorrectly , create examples unusable you, allow better.

here code register extention if isn't

<component id="iis6configextentions" guid="{guidhash({productid}-1822e4f3-5850-47d5-9281-d1e0e20c77d4)}" keypath="yes" permanent="yes"> <condition><![cdata[installed or (iismajorversion , (iismajorversion = "#6"))]]></condition> <iis:webserviceextension id="extensionasp4" group="asp.net v4.0.30319" allow="yes" file="[frameworkroot]v4.0.30319\aspnet_isapi.dll" description="asp.net v4.0.30319"/> </component>

and adding concrete site need utilize webapplicationextention, @yan mentioned:

<iis:webapplication id="iis6webapp" name="[site_app_name]" webapppool="apppool" > <iis:webapplicationextension verbs="get,head,post" checkpath="no" script="yes" executable="[frameworkroot]v4.0.30319\aspnet_isapi.dll" /> </iis:webapplication>

the checkpath="no" required on iis 6 because utilize asp.net mvc doesn't map urls files on disk. might need since service address doesn't map physical file.

update:

looks not possible straight in wix (at to the lowest degree in 3.5 version). going in right direction - custom action using appcmd. provided custom actions aren't finish or need: first 1 sets property value command need execute , sec 1 calls dll custom action wasn't provided.

what i'd seek execute is:

<customaction id="addgsoaphandler" directory="targetdir" impersonate="no" execute="deferred" return="check" execommand="[systemfolder]inetsrv\appcmd.exe set config -section:system.webserver/handlers /+&quot;[\[]name='gsoap',path='*.dll', verb='*',modules='isapimodule',scriptprocessor='[bin]mod_gsoap.dll',resourcetype='file', requireaccess='execute'[\]]&quot; /commit:apphost" />

please pay attending path attribute of handler configuration. it limit handler usage url's ends ".dll" - copied code not sure if you've done intentionally or copied example @ microsoft site. might have led 401 error if handler registered successfully.

also added /commit:apphost argument. not sure if need this, utilize explicitly specify need configure application's config.

update 2:

if need set configuration single application, should specify application object argument of appcmd instead of 'config' means global configuration. please seek this:

<customaction id="addgsoaphandler" directory="targetdir" impersonate="no" execute="deferred" return="check" execommand="[systemfolder]inetsrv\appcmd.exe set app "mysite/app1" -section:system.webserver/handlers /+&quot;[\[]name='gsoap',path='*.dll', verb='*',modules='isapimodule',scriptprocessor='[bin]mod_gsoap.dll',resourcetype='file', requireaccess='execute'[\]]&quot; /commit:apphost" />

for more details can read this tutorial.

iis wix

Using multiple viewModels within knockout.js -



Using multiple viewModels within knockout.js -

i'd maintain knockout script more organized, moreover, i'd avoid naming 2 functions same thing accident. wondering if nest viewmodels in same function (i kept real simple): fiddle

here's html

<p>first name: <strong data-bind="text: other.firstname">todo</strong></p> <p>last name: <strong data-bind="text: other.lastname">todo</strong></p> <p>full name: <strong data-bind="text: other.fullname">todo</strong></p>

and js:

function appviewmodel() { var self = this; self.other = { firstname: ko.observable("bert"), lastname: ko.observable("bertington"), /*fullname: ko.computed(function(){ homecoming this.firstname + " " + this.lastname; }, this)*/ } }

this works fine, if uncomment ko.computed it'll crash. there way organize knockout in way, why computed crashing, there way write ko.computed function work?

edit: problem #2

if have form form this:

<form data-bind="submit: other.othersubmit" data-ajax="false"> <button type="submit">submit</button> </form>

and add together handler submit so:

// simple *viewmodel* - javascript defines info , behavior of ui function appviewmodel() { var self = this; self.other = new function(){ var self = this; self.firstname = ko.observable("bert"); self.lastname = ko.observable("bertington"); self.fullname = ko.computed(function(){ homecoming self.firstname() + " " + self.lastname(); }); self.othersumbit = function(){} } } // activates knockout.js ko.applybindings(new appviewmodel());

why error console homecoming this:

the value submit binding must function

can seek this:

// simple *viewmodel* - javascript defines info , behavior of ui function appviewmodel() { var self = this; self.other = new function(){ var self = this; self.firstname = ko.observable("bert"); self.lastname = ko.observable("bertington"); self.fullname = ko.computed(function(){ homecoming self.firstname() + " " + self.lastname(); }); } } // activates knockout.js ko.applybindings(new appviewmodel());

knockout.js

java - JOptionPane.showOptionDialog not working -



java - JOptionPane.showOptionDialog not working -

i trying create little popup game. have added story , worked fine, untill added piece of code:

object[] choices = null; object[] options = { "caitlyn", "warwick", "teemo", "olaf", "ashe" }; int select = joptionpane.showoptiondialog(null, "who want fighting against?", "champion selection", joptionpane.closed_option, joptionpane.question_message, null, options, action );

now, these options appear on every optiondialog appears. how prepare this?

this code

object[] choices = null; object[] options = { "caitlyn", "warwick", "teemo", "olaf", "ashe" }; int select = joptionpane.showoptiondialog(null, "who want fighting against?", "champion selection", joptionpane.closed_option, joptionpane.question_message, null, options, action ); switch (select) { case 0: int cait = 0; cait++; joptionpane.showmessagedialog(null, "you fighting against next champion:" + " " + caitlyn.champion + " " + "\n level" + " " + caitlyn.level + " " + "\n , " + caitlyn.type + "-champion"); joptionpane.showmessagedialog(null, "you have started 2000hp, caitlyn has 1700hp."); // health newchamp.health = 2000; caitlyn.enemyhealth = 1700; //begin object[] choices1 = null; object[] options1 = { "criticals", "pure damage", "heal 300 points", "flee" }; int action = joptionpane.showoptiondialog(null, "what do?", "action", joptionpane.default_option, joptionpane.question_message, null, options, options[0]); switch (action) { case 0: int criticals = (int) (math.random()*500); criticals++; caitlyn.enemyhealth = (caitlyn.enemyhealth-criticals); joptionpane.showmessagedialog(null, "caitlyn has" +" " + caitlyn.enemyhealth + "hp left"); break; case 1: int puredamage = (int) (math.random()*300); puredamage++; caitlyn.enemyhealth = (caitlyn.enemyhealth-puredamage); joptionpane.showmessagedialog(null, "caitlyn has" + " " + caitlyn.enemyhealth + "hp left"); break; case 2: int heal = 300; heal++; newchamp.health = (newchamp.health+heal); joptionpane.showmessagedialog(null, "you have"+ " " + newchamp.health + "hp points!"); break; case 3: string flee; joptionpane.showmessagedialog(null, "you failed flee battle, improve luck next round!"); break; } joptionpane.showmessagedialog(null, "it's caitlyn's turn now!"); joptionpane.showmessagedialog(null, "caitlyn used damaging attack!"); int enemydamage = (int) (math.random()*350); newchamp.health = (newchamp.health - enemydamage); joptionpane.showmessagedialog(null, "you have" + " " + newchamp.health +" "+ " hp left"); joptionpane.showmessagedialog(null, "it's turn again!"); object[] choices2 = null; object[] options2 = { "criticals", "pure damage", "heal 300 points", "flee" }; int action1 = joptionpane.showoptiondialog(null, "what do?", "action", joptionpane.default_option, joptionpane.question_message, null, options, options[0]); switch (action1) { case 0: int criticals = (int) (math.random()*700); criticals++; caitlyn.enemyhealth = (caitlyn.enemyhealth-criticals); joptionpane.showmessagedialog(null, "caitlyn has" +" " + caitlyn.enemyhealth + "hp left"); break; case 1: int puredamage = (int) (math.random()*300); puredamage++; caitlyn.enemyhealth = (caitlyn.enemyhealth-puredamage); joptionpane.showmessagedialog(null, "caitlyn has" + " " + caitlyn.enemyhealth + "hp left"); break; case 2: int heal = 300; heal++; newchamp.health = (newchamp.health+heal); joptionpane.showmessagedialog(null, "you have"+ " " + newchamp.health + "hp points!"); break; case 3: string flee; joptionpane.showmessagedialog(null,"you have failed flee battle, improve luck next round!"); break; } joptionpane.showmessagedialog(null, "it's caitlyn's turn again!"); joptionpane.showmessagedialog(null, "caitlyn nail critical!"); int enemydamage1 = (int) (math.random()*650); newchamp.health = (newchamp.health - enemydamage); joptionpane.showmessagedialog(null, "you have" + " " + newchamp.health +" "+ " hp left"); if (caitlyn.enemyhealth < newchamp.health){ joptionpane.showmessagedialog(null, "caitlyn injured strength go on battle. victorious!"); } else joptionpane.showmessagedialog(null, "you injured go on battle. defeated."); break; case 1: int war = 0; war++; joptionpane.showmessagedialog(null, "warwick still beingness made. window exit program."); break; case 2: int teem = 0; teem++; joptionpane.showmessagedialog(null, "teemo still beingness made. window exit program."); break; case 3: int ola = 0; ola++; joptionpane.showmessagedialog(null, "olaf still beingness made. window exit program."); break; case 4: int ash = 0; ash++; joptionpane.showmessagedialog(null, "ashe still beingness made. window exit program."); break; } } }

did note part of code

object[] choices2 = null; object[] options2 = { "criticals", "pure damage", "heal 300 points", "flee" }; int action1 = joptionpane.showoptiondialog(null, "what do?", "action", joptionpane.default_option, joptionpane.question_message, null, **options**, options[0]);

the ** indicate probable issue. shouldn't options2 ? (there other place same probable mistake)

java swing joptionpane

java - Could not find or load main class , environment variables -



java - Could not find or load main class , environment variables -

i know has come number of times, previous responses don't seem help. environment variables :

classpath c:\program files\java\jre7\lib;c:\program files\java\jdk1.7.0_15\bin; path c:\program files\java\jdk1.7.0_15\bin;

when moving directory follows c:\users\oli\my documents\java can compile using javac, cannot runt programme using java. know got environment variables cannot work. p.s error "could not find or load main class"

any help appreciated.

unset classpath , utilize default 1 provided jvm. here link java tutorial covers environment variables.

java class load find main

Codeigniter select_max and return other row fields -



Codeigniter select_max and return other row fields -

i'm trying select max bid amount on particular item , homecoming more info row max bid found in.

at moment have

$item_id = $this->input->post('item_id'); $this->db->from('bids'); $this->db->where('item_id', $item_id); $this->db->where('outbid_alert', '1'); $this->db->select_max('bid_amount'); $query = $this->db->get(); homecoming $query->result();

this returns max bid item , that's far have gotten. what's best way rest of fields row? run query or utilize subquery?

thanks!

if want homecoming fields row highest bid_amount, order bid_amount , select first row.

$item_id = $this->input->post('item_id'); $this->db->from('bids'); $this->db->where('item_id', $item_id); $this->db->where('outbid_alert', '1'); $this->db->select('*'); $this->db->order_by('bid_amount', 'desc'); $this->db->limit(1); $query = $this->db->get(); homecoming $query->result();

codeigniter

show only values in my second array php -



show only values in my second array php -

i have 2 arrays comparing. comparing working follows:

$tmp = array_diff_key($arr1, $arr2); $echo $tmp;

however, want display values exist in array 2 don't exist in array 1.

edit: ok give thanks everyone's help. how ever still unable create work.

i using

$tmp = array_diff($arr2, $arr1); var_dump($tmp);

which prints out following:

array(1) { [0]=> array(3) { [0]=> string(4) "cars" [1]=> string(4) "vans" [2]=> string(6) "people" } }

so, i'll explain little.

array 1 has cars, vans (this pulled database).

array 2 has cars, people (this entered form).

i'm trying show values not in database thought $tmp echo people cars in database , vans in $arr1

i hope thats clear confusing me writing ;)

if var_dump both array individually get

array(3) { [0]=> null [1]=> string(4) "cars" [2]=> string(4) "vans" } array(1) { [0]=> array(2) { [0]=> string(6) "people" [1]=> string(5) "tanks" } }

$tmp = array_diff_key($arr2, $arr1); $echo $tmp;

echo $tmp output 'array' think, have loop on (perhaps foreach) display each individual value, or utilize var_dump.

array_diff_key works keys, array_diff values (you mention "values" in question).

php arrays