Monday, 15 July 2013

spring xd - SpringXD stream with Tail source reads ALL the lines in file again and again instead of just last n lines -



spring xd - SpringXD stream with Tail source reads ALL the lines in file again and again instead of just last n lines -

stream create --name tailtest --definition "tail --name=/users/name/documents/springxd/poc/input/try.txt --outputtype=text/plain --lines=1 |file --name=output --dir=/users/name/documents/springxd/poc/output --mode=append" --deploy

here see whether give --lines=1 or 2 or 0 there additional line entered in try.txt , saved, reading entire try.txt , dumping output file. 1 time again when add together line try.txt same reads entire file content rather lastly line , appends @ end of previous content in output, thought going wrong here, why tail not read lastly 1 (or specified n) lines set come in @ end of each line in input file?

it sounds replacing file when "and saved".

tail follows existing file and, yes, expects newline terminate new message.

i ran test , works fine...

xd:>stream create --name foo --definition "tail --lines=1 --name=/users/foo/documents/foo.txt | log" --deploy

logs lastly line of file,

23:15:58,925 info simpleasynctaskexecutor-1 sink.foo - sdsd

then

$ echo foo >> ~/documents/foo.txt

(which appends foo\n file)

results in

23:17:07,744 info simpleasynctaskexecutor-1 sink.foo - foo

the lines=1 applies existing file; if replace file new one, whole file used - log rotation.

tail spring-xd

How the IP address is recognized in the Internet in multicast? -



How the IP address is recognized in the Internet in multicast? -

i referring "broadcasting multiple recipients" oracle java tutorial:

both server , client utilize grouping identifier identify belong same group. grouping id duplicate in net (and goolged , said grouping identifier not need unique)

then how come client on other side of net can know belongs same grouping of server? give me links describe process?

if server mutlicasts sound streams, server b multicasts video streams. server uses grouping id 203.0.113.0:4446 server b happens uses grouping id 203.0.113.0:4446. how come clients in net knows differences? since server not know existence of server b @ all, not know how take unique grouping id, uniqueness in ip address.

it seems cross articles, talking adding mac address. in oracle java tutorial, coding client not mention mac address @ all.

i don't know mean 'reorganized' in title, client doesn't 'know belongs same grouping [as] server'. knows belongs grouping defined ip address. if there multiple hosts sending ip address receive of them.

multicast

couchdb - Status of a filtered pull replication with Couchbase Lite -



couchdb - Status of a filtered pull replication with Couchbase Lite -

how reliably check filtered pull replication has completed couchbase lite?

the replication status set stopped on completion or on fatal error. a alter listener fires on incoming changes can't used monitor connection status. you can find seq number of database not lastly seq of grouping of filtered changes.

the replication object lasterror property. guide says if set nil, there has not been error since replication started. check when see replication status go stopped.

http://docs.couchbase.com/couchbase-lite/cbl-ios/#working-with-replications

couchdb couchbase database-replication

java - mysql query in clause at playframework -



java - mysql query in clause at playframework -

in below 2 sql query sql1 not selecting row, , sql2 selecting 1 111@k2.com

var ids="'111@k2.com','222@k2.com','333@k2.com','444@k2.com','555@k2.com','666@k2.com'" val sql1 = sql("select id,point,privacy `pointtable` state=1 , id in ({users})").on("users" -> ids) sql1().map { row => val point = if (row[boolean]("privacy")) { row[double]("point").tostring } else { "0" } println(write(map("id" -> row[string]("id"), "point" -> point))) } val sql2 = sql("select id,point,privacy `pointtable` state=1 , id in (" + ids + ")") sql2().map { row => val point = if (row[boolean]("privacy")) { row[double]("point").tostring } else { "0" } println(write(map("id" -> row[string]("id"), "point" -> point))) }

in phpmyadmin when run query manualy returns 6 rows why not working here. using play framework 2.2 scala 2.1

that's not going work. passing users though on going escape entire string, it's going appear one value instead of list. anorm in play 2.3 allows pass lists parameters, here you'll have work around that.

val ids: list[string] = list("111@k2.com", "222@k2.com", "333@k2.com") val indexedids: list[(string, int)] = ids.zipwithindex // create bunch of parameter tokens in clause.. {id_0}, {id_1}, .. val tokens: string = indexedids.map{ case (id, index) => s"{id_${index}}" }.mkstring(", ") // create parameter bindings tokens val parameters = indexedids.map{ case (id, index) => (s"id_${index}" -> toparametervalue(id)) } val sql1 = sql(s"select id,point,privacy `pointtable` state=1 , id in (${tokens})") .on(parameters: _ *)

java mysql sql scala playframework

JavaScript create csv column names -



JavaScript create csv column names -

i generating csv file in javascript:

var csvcontent = "data:text/csv;charget=uft-8,data1, data2, data3 /n data1, data2, data3";

i wondering how add together column names? info appearing properly. looking add together column names. possible?

javascript csv

php - Unable to retrieve serialized data from database -



php - Unable to retrieve serialized data from database -

i'm able update using serialize info database not able retrieve properly. echoing array when seek unserialize , retrieve database.

here how update using serialize:

$query ="update dashboard_widget_users set dashboard_widget_users.configuration='".serialize($tmp)."' dashboard_widget_users.dsnr_yw_user =12 , dashboard_widget_users.dsnr_dashboard_widget=1";

result:

a:4:{i:0;s:30:""anzahl_fahrzeuge_ohne_bilder"";i:1;s:22:""fahrzeuge_ohne_preis"";i:2;s:23:""fahrzeuge_mit_fehlern"";i:3;s:19:""herausforderungen"";}

this how tried unserialize() , retrieve database not getting output properly:

$config= unserialize($row['configuration']); echo $config['configuration'];

here code:

if($param['aktion'] == 'save-widget-vehicle') { $page['register-fahrzeuge'] = array( 1 => array( 'fahrzeug','aktiv',$page['script'],''), 0 => array( 'edit-fahrzeug','enabled',$page['script'],'',''), ); $opts = !empty($param['filteropts']) ? $param['filteropts'] : array(); $tmp = array(); foreach ($opts $opt) { $tmp[] = '"'.$opt.'"'; } $data = array(); $query ="update dashboard_widget_users w set w.configuration=\"".mysql_real_escape_string(serialize($tmp))."\" w.dsnr_yw_user =12 , w.dsnr_dashboard_widget=1"; $result = mysql_query($query, $myconnection); $html = '<table width="538" cellspacing="0" cellpadding="0" border="0"> <tr> <td> <div>'.createregister($page['register-news']).'</div> '.createmessage().' <div class="cont-liste-verlauf register"> <table id="fahrzeuge"> <tr> <td> </td> </tr> </table> </div> </td> </tr> </table>'; $return = array( 'status' => 1, 'html' => $html ); echo json_encode($return); die(); $param['aktion'] = 'get-widget-vehicle'; } if($param['aktion'] == 'get-widget-vehicle') { $page['register-fahrzeuge'] = array( 1 => array( 'fahrzeug','aktiv',$page['script'],''), 0 => array( 'edit-fahrzeug','enabled',$page['script'],'',''), ); $data = array(); $opts = !empty($param['filteropts']) ? $param['filteropts'] : array(); $tmp = array(); foreach ($opts $opt) { $tmp[] = '"'.$opt.'"'; } $query ='select dashboard_widget_users.configuration dashboard_widget_users inner bring together yw_user on dashboard_widget_users.dsnr_yw_user = yw_user.intern inner bring together dashboard_widget on dashboard_widget_users.dsnr_dashboard_widget = dashboard_widget.id dashboard_widget_users.dsnr_yw_user =12 , dashboard_widget.id =1'; $result = mysql_query($query, $myconnection); /*while ($row = mysql_fetch_assoc($result)) { if($row['name'] == 'anzahl_fahrzeuge_mit_und_ohne_bilder') { $sql = 'select * amo_bilder_live l left bring together afzdaten on l.dsnr_afzdaten = a.dsnr l.dsnr_afzdaten null'; $sql_result=mysql_query($sql); //get result... // $row['number'] = $result } $data[] = $row; }*/ $html = '<table width="538" cellspacing="0" cellpadding="0" border="0" > <tr> <td> <div>'.createregister($page['register-fahrzeuge']).'</div> '.createmessage().' <div class="cont-liste-verlauf register"> '; while ($row = mysql_fetch_assoc($result)) { $config= unserialize($row['configuration']); //$config= $row['configuration']; $html .= '<table id="fahrzeuge"> <a href="amo_fahrzeuge.php"> '. $config .'</a> </table>'; } $html .= '</div> </td> </tr> </table>'; $return = array( 'status' => 1, 'html' => $html ); echo json_encode($return); die(); }

you escape string depending on going utilize mysqli_real_escape_string() on value before putting into database - not when retrieving database:

$row=mysqli_fetch_assoc($result); $config=unserialize($row['config']);

you've tagged jsonserializer - using php serialization here.

php mysql serialization

How do I prevent Fiddler from blocking random websites? -



How do I prevent Fiddler from blocking random websites? -

i using fiddler2 telerik , running weird issue programme blocking websites. here's illustration of randomly blocking www.slacker.com.

now when comes can close fiddler , refresh page , come without problem. however, since updated fiddler latest version it's started doing this:

why in world fiddler , how stop breaking random websites?

i found post on stackoverflow suggested using custom onbeforerequest rule this:

if (osession.fullurl == "http://slacker.com"){ osession["ui-hide"] = "do not want see"; }

i've tried adding custom rules did not seem prepare anything. have tried setting fiddler hear traffic ie since ie want see traffic from.

is there setting somewhere within fiddler prepare or need find different program?

edit: additional information: i'm running version v4.4.8.4 of fiddler.

this isn't fiddler.

the problem tcp/ip stack on computer, why chrome cannot connect site either.

are running firewall software? on managed corporate network, or home isp?

if type prefs show fiddler.network.egress.ip , nail come in within black quickexec box below web sessions list, see?

fiddler

how to use Websphere datasource in Spring batch -



how to use Websphere datasource in Spring batch -

i need utilize websphere info source in spring batch,

i tried utilize

<bean id="wasdatasource" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jndiname" value="jdbc/testdb" /> <property name="lookuponstartup" value="false" /> <property name="cache" value="true" /> <property name="proxyinterface" value="javax.sql.datasource" /> </bean>

sql state [null]; error code [0]; dsra9110e: resultset closed.; nested exception com.ibm.websphere.ce.cm.objectclosedexception: dsra9110e: resultset closed.

also

<bean id="wasdatasource" class="org.springframework.jdbc.datasource.webspheredatasourceadapter"> <property name="targetdatasource"> <bean class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jndiname" value="jdbc/testdb"/> </bean> </property> <property name="lookuponstartup" value="true" /> <property name="proxyinterface" value="javax.sql.datasource"/> </bean>

specified 'targetdatasource' not websphere wsdatasource: com.ibm.ws.rsadapter.jdbc.wsjdbcdatasource@4f68bc63

sorry, reply not straight related websphere, using datasources under jboss. since got no specific answers, thought help jboss experience...

we define datasource follow:

<jee:jndi-lookup id="sampleds" jndi-name="java:jboss/datasources/sampleds" expected-type="javax.sql.datasource" lookup-on-startup="false" cache="true" />

and works nicely...

in order utilize jee tag, must include xmlns:jee="http://www.springframework.org/schema/jee" <beans> declaration , http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd xsi:schemalocation.

hope helps.

regards,

bob

spring-batch

android - regCount error when instrumenting apk with soot -



android - regCount error when instrumenting apk with soot -

i instrumenting apk file using soot. when add together next statement before running soot.main (without creating body transformer), regcount error. (the same error appears in different methods different apk files.)

scene.v().addbasicclass("myscheduler"); // packmanager.v().getpack("jtp").add(new transform("jtp.myinstrumenter", new mybodytransformer())); soot.main.main(args);

the error is:

transforming android.support.v4.view.viewconfigurationcompat$froyoviewconfigurationversionimpl... exception in thread "main" java.lang.runtimeexception: regcount not match number of arguments of method @ org.jf.dexlib.code.format.instruction35c.checkitem(instruction35c.java:160) @ org.jf.dexlib.code.format.instruction35c.<init>(instruction35c.java:69) @ soot.todex.instructions.insn35c.getrealinsn0(insn35c.java:96)

thanks in advance.

my problem caused class code tried add. subtle point: utilize arraylist of "long"s, of methods adding/removing variables of type "long". although java performs boxing , had no problems executing java code, such discrepancy problematic in intermediate languages.

android instrumentation soot

c++ - Function initialization with int& argument by int&& -



c++ - Function initialization with int& argument by int&& -

i have next code:

#include <type_traits> struct ttype { int = 0; bool operator() (int&) { homecoming true; } }; int main() { static_assert(std::is_same<decltype(std::declval<ttype>()(std::declval<int>())), bool>::value, "wtf?"); homecoming 0; }

if seek compile g++-4.8.2 receive error:

main.cpp:321:82: error: no match phone call ‘(jetplane) (int)’ static_assert(std::is_same<decltype(std::declval<jetplane>()(std::declval<int>())), bool>::value, "wtf?"); ^ main.cpp:265:8: note: candidate is: struct jetplane ^ main.cpp:279:7: note: bool jetplane::operator()(int&) bool operator() (int&) ^ main.cpp:279:7: note: no known conversion argument 1 ‘int’ ‘int&’

i don't understand note: no known conversion argument 1 ‘int’ ‘int&’ line. question is: why g++ interprets homecoming type of std::declval<int>() int , not line int&& though std::declval declaration looks like:

template< class t > typename std::add_rvalue_reference<t>::type declval();

i understand it's prohibited bind int&& int. why compiler doesn't print: note: no known conversion argument 1 ‘int’ ‘int&’ line. may don't understand , compiler changes somehow homecoming type of std::declval<int>() int&& on int in std::declval<ttype>()(std::declval<int>())?

thank help!

the problem is, cannot bind xvalue non-const lvalue reference.

let's @ expression

std::declval<int>()

the homecoming type of std::declval<int> indeed int&&. hence above look xvalue look of type int. note in c++ look never has reference type.

but operator

bool operator() (int&)

takes argument non-const lvalue referenece. if alter perameter type const int&, i.e.

bool operator() (const int&)

everything should work fine.

c++ c++11

Unable to install oracle adf mobile extension in jdeveloper -



Unable to install oracle adf mobile extension in jdeveloper -

i have tried means install adf mobile extension maintain getting error:

jul 9, 2013 4:09:24 pm org.netbeans.core.startup.nbevents logged info: turning on modules: jul 9, 2013 4:09:24 pm org.netbeans.core.startup.nbevents dumpmoduleslist info: org.openide.util.lookup [8.3.1 201007282301] org.openide.util [8.6.2 201103231602] org.openide.modules [7.17.2 201008301741] org.openide.filesystems [7.38.2 201007282301] org.netbeans.bootstrap/1 [2.33.5 201104201301] org.netbeans.core.startup/1 [1.25.5 201103231602] org.netbeans.libs.osgi [1.1.1 201007282301] org.netbeans.core.netigso [1.4.5 201011191627] oracle.ide_osgi [11.1.2 11.1.2 org.netbeans.core.dynamicconfig [1.0 130507] org.apidesign.netbinox [1.16.10 110502] com.oracle.jdeveloper.nbbridge [1.1 130507] jul 9, 2013 4:09:24 pm oracle.ideimpl.webupdate.webupdateaddin loadhookclass severe: cannot load extension oracle.adf.mobile

oracle-adf-mobile

javascript - DRY swipe navigation in JQuery Mobile -



javascript - DRY swipe navigation in JQuery Mobile -

i putting jquery swipe navigation on project developed jquery mobile. can work no worries not dry implementation , know i'm going have issues updating in future. have series of html pages swipe navigate other html pages in same folder. here illustration of html code:

<div id="point2" class="tpb" data-role="page" data-title="baby section - talking point 2"> <header data-role="header" data-theme="f" data-position="fixed"> <a href="#" data-rel="back" data-theme="h" data-icon="arrow-l" data-direction="reverse">back</a> <a href="../activities.html" data-theme="h" data-icon="baby">activities</a> <h1>0-12 months</h1> </header> <div data-role="content" class="content" data-theme="a"> <h1>mother&rsquo;s voice</h1> <p>babies larn recognise mother&rsquo;s voice in utero. birth babe has preference voice on other sounds. babies begin larn difference between sounds not long after birth.</p> <p>talk babe , birth. utilize name, talk whatever doing , repeat words many times. babies need hear words lots of times before understand , utilize them.</p> <p><img src="../../img/baby/baby-tp2-mothers-voice.jpg" class="insert" /></p> </div> <script type="text/javascript"> $("#point2").on('swipeleft', function (event, ui) { if(event.handled !== true){ $.mobile.changepage('point3.html', {transition: "slide", reverse: false}, true, true); event.handled = true; } homecoming false; }); $("#point2").on('swiperight', function (event, ui) { if(event.handled !== true){ $.mobile.changepage('point1.html', {transition: "slide", reverse: true}, true, true); event.handled = true; } homecoming false; }); </script> </div>

now have tried follow jquery mobile documentation doing dry way , docs create no sense me @ all. appears though sample swap div has different background image. http://demos.jquerymobile.com/1.3.0/docs/examples/swipe/swipe-page.html

i confident can dry working if pages in single html file loads dom (single page app) working separate files? wondering if can set array pick sequential pages in folder , maintain order? js skills not great i'm looking working illustration pick apart can understand implementation. please allow me know if have implementations this. want dry!!

javascript jquery jquery-mobile

iphone - Xcode 5.1.1 Thread 1: signal SIGABRT -



iphone - Xcode 5.1.1 Thread 1: signal SIGABRT -

when run app, after while stops working , thread 1: signal sigabrt. says on code:

#import <uikit/uikit.h> int main(int argc, char *argv[]) { nsautoreleasepool *pool = [[nsautoreleasepool alloc] init]; int retval = uiapplicationmain(argc, argv, nil, nil); [pool release]; homecoming retval; }

it says on line:

int retval = uiapplicationmain(argc, argv, nil, nil);

sigabrt means exception triggered. console log print exact exception message, , need @ (post here).

the problem in uiapplicationmain method

iphone xcode

including from document root in PHP -



including from document root in PHP -

i've read in book way include paths root using $_server['document_root'].'subdirectory'. improve using '../php/db/connection.php'? difference?

it's not of thought have server-side executed files under document root. short whoops of misconfiguration may cost trade secrets or worse.

anyway, it's improve utilize "absolute" paths because referencing file may move around without need adjust paths.

php document-root

assembly - Homework - TICTACTOE - addressing issue -



assembly - Homework - TICTACTOE - addressing issue -

hey guys having problem understanding behavior of program. trying store address homecoming to, keeps beingness overwritten somehow. homework don't give me easy answers! perhaps explantion how jal might overwriting $s0 register. don't quite understand how possible. set comments in code can see loop occuring.

2.

.data # info segment variables , strings # these strings need outputted console title: .asciiz "tic-tac-toe!\n\n" oprompt: .asciiz "o player: please come in row/col, 1 per line:\n\n" xprompt: .asciiz "x player: please come in row/col, 1 per line:\n\n" invposstr: .asciiz " invalid position. seek again.\n\n" owinstr: .asciiz "o won game,\n\n exiting. . ." xwinstr: .asciiz "x won game,\n\n exiting. . ." catstr: .asciiz "cat game,\n\n exiting. . ." border: .asciiz "\n\n _ _ _ \n" # initialze board 9 bytes board: .byte 'x','x','x','x','x','_','x','_','_' .text # text segment instructions main: # begin main func li $v0, 4 #set v0 print string la $a0, title #set string print (in $a0) title syscall #execute li $s1, 0 #use s1 game counter (up 9 turns) playerx: #player x go first li $v0, 4 #prepare print string la $a0, xprompt #load move prompt syscall jal get_valid_move #go valid move address # having problem returning here li $t0, 'x' #load asciiz code x sb $t0, ($v0) #store x board address addi $s1, 1 #increment game counter next turn jal print_board #after getting move, print board status # , here playero: #player o go sec li $v0, 4 #prepare print string la $a0, oprompt #load move prompt syscall jal get_valid_move #go valid move address # , here li $t0, 'o' #load asciiz code o sb $t0, ($v0) #store o board address addi $s1, 1 #increment game counter next turn jal print_board #after getting move, print board status # , here j playerx #go player x turn # store current homecoming address below (first time) print_board: #function print status of board move $s0, $ra #save recent homecoming address la $t1, board #load board address li $v0, 4 #set v0 print string la $a0, border #set string print (in $a0) prompt syscall #execute li $t0, 0 #use counter loop loop: #use loop print 1 row @ time li $v0, 11 #prepare print char li $a0, 124 #asciiz code | syscall lb $a0, ($t1) #load next byte board li $v0, 11 #prepare print char syscall addi $t1, $t1, 1 #increment address of board next byte/char addi $t0, $t0, 1 #increment loop counter beq $t0, 3, rowend #go print special stuff @ end of row beq $t0, 6, rowend #go print special stuff @ end of row beq $t0, 9, rowend #go print special stuff @ end of row j loop #go top rowend: li $a0, 124 #asciiz | li $v0, 11 #prepare print char syscall li $a0, 10 #ascizz newline li $v0, 11 #prepare print char syscall blt $t0, 9, loop #unless @ lastly row, loop li $a0, 10 #ascizz newline li $v0, 11 #prepare print char syscall jr $ra #return gameplay in main entry_address: #function transform user input (row, col) board address move $t0, $a1 #make re-create of row utilize move $t1, $a2 #make re-create of col utilize addi $t0, $t0, -1 #use n-1 accessing storage address addi $t1, $t1, -1 #use n-1 mul $t0, $t0, 3 #mul row 3 la $v0, board #load base of operations address of board add together $v0, $v0, $t0 #add row offset add together $v0, $v0, $t1 #add col offset #v0 holds right board position address jr $ra #now go check if valid move valid_position: li $v0, 1 #assume valid blt $a1, 1, inv #if row less 1 bgt $a1, 3, inv # or if row greater 3 blt $a2, 1, inv # or if col less 1 bgt $a2, 3, inv # or if col greater 3 alter validity jr $ra #go get_valid_move @ lastly instruction inv: li $v0, 0 #since branched, alter inv jr $ra #go get_valid_move @ lastly instruction # store current homecoming address s0 below (the 2nd time) get_valid_move: move $s0, $ra #save recent homecoming address li $v0, 5 #prepare read row int syscall move $a1, $v0 #copy read int argument passed li $v0, 5 #prepare read col int syscall move $a2, $v0 #copy read int argument passed jal valid_position #go create sure pos valid beq $v0, 0, invalid #go tell user if valid_position returned false jal entry_address #position go entry_address # jr statement below looping here # need homecoming lastly instruction in main thought stored in $s0 li $t0, '_' #use underscore comparing lb $t1, ($v0) #load byte entry_address bne $t0, $t1, invalid #if entry taken, move jr $s0 #since move valid go gameplay in main invalid: li $v0, 1 #prepare print int move $a0, $a1 #load row numb syscall li $v0, 11 #prepare print char li $a0, 44 #load comma asciiz syscall li $v0, 1 #prepare print int move $a0, $a2 #load col numb syscall li $v0, 4 #prepare print string la $a0, invposstr #load invalid pos message syscall j get_valid_move #repeat user input loop check_all_match: print_winner_and_exit: row_winner: col_winner: diag_winner: check_for_win: # after printing results, can exit programme exit: li $v0, 10 # set v0 exit syscall # execute exit

assembly mips

c++ - Tiles shifting to the right -



c++ - Tiles shifting to the right -

i'm working on map editor accompany game i've been working on time; when effort load map game, however, shifted 2 or 3 tiles right.

a friend of mine suggested might addressing error, though i've never seen evidence of such.

here's loading function (it's called before main loop):

const int savegame_version=0x1100; void engine::load(bool pause) { tcodzip zip; engine.gui->menu.clear(); engine.gui->menu.additem(menu::new_game,"new map"); if ( tcodsystem::fileexists("map.atm")) { zip.loadfromfile("map.atm"); int version = zip.getint(); if ( version == savegame_version ) { engine.gui->menu.additem(menu::continue,"load"); } } engine.gui->menu.additem(menu::exit,"exit"); menu::menuitemcode menuitem=engine.gui->menu.pick( pause ? menu::pause : menu::main); if ( menuitem == menu::exit || menuitem == menu::none ) { // exit or window closed exit(0); } else if ( menuitem == menu::new_game ) { // new game engine.term(); engine.init(); } else { // go on saved game engine.term(); // load map level=zip.getint(); int width=zip.getint(); int height=zip.getint(); map = new map(width,height); map->load(zip); // player player=new actor(0,0,0,null,tcodcolor::white); actors.push(player); player->load(zip); // other actors int nbactors=zip.getint(); while ( nbactors > 0 ) { actor *actor = new actor(0,0,0,null,tcodcolor::white); actor->load(zip); actors.push(actor); nbactors--; } // message log gui->load(zip); } }

and map->init function (which called engine::init , sets map's dimensions new game):

void map::init(bool withactors) { tcodzip zip; if ( tcodsystem::fileexists("map.atm")) { zip.loadfromfile("map.atm"); //rng = new tcodrandom(seed, tcod_rng_cmwc); tiles=new tile[width*height]; map=new tcodmap(width,height); (int i=0; < width*height; i++) { tiles[i].canwalk=zip.getint(); //tcodbsp bsp(0,0,width,height); //bsp.splitrecursive(rng,8,room_max_size,room_max_size,1.5f,1.5f); //bsplistener listener(*this); //bsp.traverseinvertedlevelorder(&listener,(void *)withactors); } } }

c++ loading tiling

automation - Wordpress new post -



automation - Wordpress new post -

on default wordpress installation, happens when click publish?

i know there's new entry added posts table, else happens - there else updated such tables, automatically telling search engines them, updating sitemaps etc?

sorry if wrong sort of question ask!

save_post action triggered whenever post created or updated, means code within core, themes, or plugins hooked action launched.

wordpress automation

jquery - kinetic shapes resize following video resize -



jquery - kinetic shapes resize following video resize -

first of im not web developer , job 3d im doing web myself asking web , google , finished need set active areas buttons click , view things of web...

http://thisismarc.com/

this web, see video background resizing , trying maintain menu of letters below if create window little vertically , reddish circles testing kinetic shapes create active areas buttons , when works create them invisible, thing resizing not bad not , can help it? way seek this? or theres other way easier? im using fill_resize.js resize video...... optiona resize , think complicated

the optionb give video witdh:100% resize , getting letter box on sides maybe more easy resize kinetic elements should set witdh:100% in kinetic follow same way?

ok reading! days , weeks stuck in lastly buttons thing resizing

jquery css video canvas resize

Unhandled Exception: EventArgs in vb.net missing property "handled" -



Unhandled Exception: EventArgs in vb.net missing property "handled" -

i used next code:

sub appstartup() addhandler appdomain.currentdomain.unhandledexception, sub(sender object, args unhandledexceptioneventargs) dim e = ctype(args.exceptionobject, exception) showmessage("oops...", handleerr(e), messageboximage.error) end sub end sub

and don't property handled although appears link supposed his

your link points @ xaml article, question winforms.

are starting within vs? please note exception first handled vs, , handler. when run standalone executable, should work expected. don't need set e.handled anything.

vb.net

android - Saving a counter in libGDX -



android - Saving a counter in libGDX -

i developing game in libgx android. have counter on screen increment when touch something. in game can die, want save highest score player had. don't know begin with. new android game development. method when u die.

if (player.getbounds().overlaps(rock.getbounds()){ system.out.println("game over"); }

and here increment counter

if (player.getbounds().overlaps(food.getbounds()) { system.out.println("food"); counter++; }

thankyou

it sounds need preferences. provide platform independent way of saving little amounts of data. ideal stuff high scores.

call loadprefs() load storage , saveprefs() save them back.

public static preferences prefs; public static int counter; // variable want save //save shared preferences public static void saveprefs(){ prefs = gdx.app.getpreferences("game-prefs"); // name of prefs files prefs.putinteger("counter", counter); //counter counter wish save. "counter" name of varable saved in shared preferences prefs.flush(); //save preferences } //load shared preferences public static void loadprefs(){ prefs = gdx.app.getpreferences("game-prefs"); counter = prefs.getinteger("counter",0) //load counter, default 0 if not found }

android libgdx screen overlap bounds

sql - Issue with Oracle regex -



sql - Issue with Oracle regex -

select regexp_substr('select count(distinct empno), count(distinct deptno) emp', 'count\(distinct.*\)') dual;

for above query want output count(distinct empno), ".*" in above query taking lastly occurrence of ")" , not first occurrence.

can please tell how output want?

the * operator 'greedy' default. you're allowing characters between distinct , ), in quantity. , including first ) itself.

as eatÃ…peach suggested, can create non-greedy ?:

a greedy operator matches many occurrences possible while allowing rest of match succeed. create operator nongreedy, follow nongreedy modifier (?)

so here, .*? instead of .*:

select regexp_substr( 'select count(distinct empno), count(distinct deptno) emp', 'count\(distinct.*?\)') dual;

or can specify should character except ) [^)]* instead of .*.

select regexp_substr( 'select count(distinct empno), count(distinct deptno) emp', 'count\(distinct[^)]*\)') dual;

sql regex oracle oracle11g

css - bootstrap 2.3.2 rows not inline -



css - bootstrap 2.3.2 rows not inline -

i don't understand why not inline:

http://jsfiddle.net/dugfresh/dukz4/

<div class="btn-group" data-toggle="buttons-checkbox"> <div class="row"> <div class="span7"><button type="button" class="btn btn-primary">sun</button></div> <div class="span7"><button type="button" class="btn btn-primary">mon</button></div> <div class="span7"><button type="button" class="btn btn-primary">tue</button></div> <div class="span7"><button type="button" class="btn btn-primary">wed</button></div> <div class="span7"><button type="button" class="btn btn-primary">thu</button></div> <div class="span7"><button type="button" class="btn btn-primary">fri</button></div> <div class="span7"><button type="button" class="btn btn-primary">sat</button></div> </div> </div>

is you're looking ??

fiddle : http://jsfiddle.net/dukz4/3/

html :

<div class="btn-group" data-toggle="buttons-checkbox"> <button type="button" class="btn btn-primary">sun</button> <button type="button" class="btn btn-primary">mon</button> <button type="button" class="btn btn-primary">tue</button> <button type="button" class="btn btn-primary">wed</button> <button type="button" class="btn btn-primary">thu</button> <button type="button" class="btn btn-primary">fri</button> <button type="button" class="btn btn-primary">sat</button> </div>

doc : http://getbootstrap.com/2.3.2/components.html#buttongroups

update after comment:

you can customize css space :

.btn-group .btn{ margin-right:5px; }

and create like

<div class="btn-group row-fluid" data-toggle="buttons-checkbox"> <button type="button" class="btn btn-primary span1">sun</button> <button type="button" class="btn btn-primary span1">mon</button> <button type="button" class="btn btn-primary span1">tue</button> <button type="button" class="btn btn-primary span1">wed</button> <button type="button" class="btn btn-primary span1">thu</button> <button type="button" class="btn btn-primary span1">fri</button> <button type="button" class="btn btn-primary span1">sat</button> </div>

here result (responsive) : http://jsfiddle.net/dukz4/4/

css twitter-bootstrap twitter-bootstrap-2

jni - Android: Passing Java surface to native -



jni - Android: Passing Java surface to native -

i working on hardware decoder displays decoded frames on native window using libstagefright.so. when tried create jni interface native functions passing surface(from surfaceview) using "javac" command, next error

\custom_decoder.java:3: error: bundle android.view not exist import android.view.surface; error: cannot find symbol symbol: class surface

what should avoid error?

update :

as per suggestion of alex barker tried next same result

d:\android_workspace\2014\6june\ofi_vc_omx_codec_test\src>javac -cp d:\android_datas\android-sdk_r20.0.3-windows\android-sdk-windows ofi\ofi_vc_omx_codec_test\custom_decoder.java :3: error: bundle android.view not exist import android.view.surface; ^ ofi\ofi_vc_omx_codec_test\custom_decoder.java:15 : error: cannot find symbol private native int set_display_surface(surface disp_surface); ^ symbol: class surface location: class custom_decoder

based on info provided, have simple classpath issue. add together -cp flag javac command , pass sdk location.

android jni surfaceview

java - Hide list item based on boolean true false jsp -



java - Hide list item based on boolean true false jsp -

i have slide menu in jsp page , after login, checking whether user allowed view element or not parameters stored in database. need hide items based on whether user allowed view or not.

my jsp

<ul style = "display:none"> <li><a href="servletname">myfirstsubmenu</a></li> <li><a href="servletname1">myfirstsubmenu1</a></li> </ul>

my dao:extract:

public boolean userallowed(username, itemid){ .......................... homecoming true; }

my servlet extract:

if(userallowed(username, itemid)){ session.setattribute("userallowed", true); request.getrequestdispatcher("/mypage.jsp").forward(request, response); }else{ request.getrequestdispatcher("/mypage.jsp").forward(request, response); session.setattribute("userallowed", false); }

how can write javascript function able hide elements based on user permissions?

you may this:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <c:if test="${true == sessionscope.userallowed}"> <ul> <li><a href="servletname">myfirstsubmenu</a></li> <li><a href="servletname1">myfirstsubmenu1</a></li> </ul> </c:if>

java javascript jsp

android - Path on Canvas sometimes isn't visible -



android - Path on Canvas sometimes isn't visible -

i'm overriding imageview, , in ondraw method draw path on top of it. imageview view shown in listview.

on first render, image there, path isn't. if scroll down, images have paths, , when scroll up, first imageviews didn't show paths. know ondraw beingness called first imageviews, because set break in there.

the thing can think of maybe path beingness drawn before image? doesn't work way in code though. in fact, phone call setimagebitmap set image, in turn calls invalidate, in turn schedules ondraw. , ondraw calls super first.

disabling hardware acceleration has no effect.

well sense little dumb, figured out. here's reply in case makes same error did.

for reason, overriding onmeasure set dimensions of path i'll drawing. obviously, needs go in onlayout. first time view drawn it's size 0 when measured, path bunch of points on 0,0 coordinate. subsequent renders using recycled views, the listview, did have width , height when measured.

android

c# - ImageButton in Xamarin Studio -



c# - ImageButton in Xamarin Studio -

i using xamarin studio, , have problem when seek utilize imagebutton.the problem whaterver image utilize dosen't fit button. image big or small. if seek resize button image dont stretch @ same size button. p.s. sorry bad english, i'm romania

couple of questions start - version of xam.android using (stable, beta, alpha) , can post code you're using?

this solution may help in case : fit image in imagebutton in android

c# android image xamarin imagebutton

batch file - How can I read and split a reg_multi-sz value in the Windows registry? -



batch file - How can I read and split a reg_multi-sz value in the Windows registry? -

i'm trying read , split reg_multi_sz entry in registry in order list instances of sql server installed in local , of course, it's not working, nil displayed.

here code :

@echo off setlocal enabledelayedexpansion set key_name=hklm\software\microsoft\microsoft sql server set value_name=installedinstances set strtemp= /f "usebackq skip=2 tokens=3" %%a in (`reg query "%key_name%" /v "%value_name%" /se #`) ( set strtemp=%%a :nextvar /f "tokens=1* delims=#" %%b in ("%strtemp%") ( set strtemp=%%c echo %%b ) if defined %strtemp% goto nextvar )

do have ideas of error ?

thank ;-)

sorry bad spelling.

you can't utilize goto within loop , need delayed expansion implemented set, alter , use variable within loop.

windows batch-file registry

html5 - IText Object above Overlay Image -



html5 - IText Object above Overlay Image -

in canvas have overlay image using setoverlayimage method fabric.js canvas library.

i have need place itext object above set overlay image, itext object appear behind overlay image.

is there way accomplish using fabric.js?

that's not possible. "overlayimage" overlay on other objects.

why need that? can utilize "backgroundimage" instead?

html5 canvas html5-canvas fabricjs

php - Set Option Value Based on Multiple Variables -



php - Set Option Value Based on Multiple Variables -

here scoop. making product calculator has 5 different options, value need apply initial variable dependent on 2 separate variables determine right value multiply by.

so logically, have value need multiply variable b, however, value of b dependent on input variables c , d. value b absolute value. add together insult injury, if value less 12, need subtract .5 or .25 depending on value of variable c original value before b applied. lost here.

here original equation excel spreadsheet given me adapt:

=if(and(b9="option_1",b11="horizontal"),d6+k6+1-0.00515464*(d6+k6),if(and(b9="option_1",b11="vertical"),d6+k6+1-0.0064433*(d6+k6),if(and(b9="option_2",b11="horizontal",d6>12),d6+k6-0.5+1-0.010417*(d6+k6),if(and(b9="option_2",b11="vertical",d6>12),d6+k6-0.25+1-0.005208*(d6+k6),if(and(b9="option_2",b11="horizontal",d6<12),d6+k6-0.25+1-0.010417*(d6+k6),if(and(b9="option_2",b11="vertical",d6<12),d6+k6+1-0.005208*(d6+k6),if(and(b9="option_3",b11="vertical",d6>12),d6+k6-0.5+1-0.010417*(d6+k6),if(and(b9="option_3",b11="horizontal",d6>12),d6+k6-0.25+1-0.005208*(d6+k6),if(and(b9="option_3",b11="vertical",d6<12),d6+k6-0.25+1-0.010417*(d6+k6),if(and(b9="option_3",b11="horizontal",d6<12),d6+k6+1-0.005208*(d6+k6),if(and(b9="option_4",b11="vertical"),d6+k6+1-0.03125*(d6+k6),if(and(b9="option_4",b11="horizontal"),d6+k6+1-0.02083*(d6+k6),if(and(b9="option_5",b11="vertical"),d6+k6+1-0.0625*(d6+k6),if(and(b9="option_5",b11="horizontal"),d6+k6+1-0.052083*(d6+k6)))))))))))))))

thanks!

the reply question should provide sort of guidance on how sort of code you've provided (a long string of spreadsheet ternary if functions quite hard understand) in php more concise, , perhaps more readable.

i don't know if i'm plenty @ explaining sort of thing help you, think of import steps take in process to;

reformat code

putting each status on line of it's own, , each resulting output block on line of it's own, can hugely helpful understanding logic you've got. means can see patterns downwards through code.

group mutual logic

once code formatted nicely, , can perhaps see patterns emerging, should able grouping statements fewer blocks.

having taken these steps myself on code provided, function should provide same output given values of d6, k6, b9 , b11 getting in spreadsheet;

function calculatevalue($d6, $k6, $b9, $b11) { $modifiers = array( 'option_1' => array('horizontal' => 0.00515464, 'vertical' => 0.0064433), 'option_2' => array('horizontal' => 0.010417, 'vertical' => 0.005208), 'option_3' => array('horizontal' => 0.005208, 'vertical' => 0.010417), 'option_4' => array('horizontal' => 0.02083, 'vertical' => 0.03125), 'option_5' => array('horizontal' => 0.052083, 'vertical' => 0.0625), ); $x = $d6 + $k6; $y = $modifiers[$b9][$b11]; $sub = 0; if ($b9 == "option_2") { if ($b11 == "horizontal") { $sub += 0.25; } if ($d6 > 12) { $sub += 0.25; } } else if ($b9 == "option_3") { if ($b11 == "vertical") { $sub += 0.25; } if ($d6 > 12) { $sub += 0.25; } } homecoming $x - $sub + 1 - $y * $x; }

hopefully makes logic seem more readable , understandable well.

php logic

java - Out of memory when chaning orientation on activity showing an drawable -



java - Out of memory when chaning orientation on activity showing an drawable -

that's oncreate method:

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_foto); imageview myimageview = (imageview)findviewbyid(r.id.imageview); drawable d = drawable.createfrompath("/mnt/sdcard/pictures/mycameraapp/temp.jpg" ); myimageview.setimagedrawable(d);}

so, i've tried google it, , found lot of informaton on realeasing bitmaps, none realeasing drawables memmory. how realease drawable memmory, , should implement it: onpause or ondestroy?

you getting outofmemoryexception because app using(or needing) more memory granted. happens while loading big bitmaps(images) in memory or showing many bitmaps. have @ developer site showing bitmaps efficiently. utilize next code prevent oom exception:

bitmap scaledbitmap = getresizedbitmap(bitmapfactory.decodefile("/mnt/sdcard/pictures/mycameraapp/temp.jpg"),3,3); public bitmap getresizedbitmap(bitmap bm, int newheight, int newwidth) { int width = bm.getwidth(); int height = bm.getheight(); float scalewidth = ((float) newwidth) / width; float scaleheight = ((float) newheight) / height; // create matrix manipulation matrix matrix = new matrix(); // resize bit map matrix.postscale(scalewidth, scaleheight); // "recreate" new bitmap bitmap resizedbitmap = bitmap.createbitmap(bm, 0, 0, width, height, matrix, false); homecoming resizedbitmap;

}

java android out-of-memory

android - How to determine during the build which exactly version of dependency is used -



android - How to determine during the build which exactly version of dependency is used -

i want display exact versions of app's dependencies in "about" screen. in build.config i'm using wildcards compile 'com.google.guava:guava:16.0.+' dependencies, exact version used be, say, 16.0.1. there way dependencies listed actual versions and, example, set them buildconfig file can read them in app's runtime?

it sounds looking dependencyreport task project reports plugin

otherwise this:

task buildconfig << { new file("$builddir/buildconfig").withwriter { out -> configurations.runtime.resolvedconfiguration.resolvedartifacts.each { dep -> out.writeline(dep.moduleversion.id.tostring()) } } }

android gradle

linux - git fetch - missing commits -



linux - git fetch - missing commits -

i running etckeeper on 2 different machines, boxa , boxb. os, etckeeper repository , all, on boxb copied boxa in january. in order apply setup changes made on boxa boxb, added repository on boxa remote repository on boxb intention of doing cherry picking, eg:

git remote add together boxa ssh://boxa/etc git fetch boxa git cherry-pick xxxx # never got far

the problem recent commits not available on boxa, commits until late february. far have tried:

doing git show 1 of missing commit numbers - not problem git log not showing commits.

copying total /etc on boxa boxb , adding/fetching via path - not issue somehow introduced ssh (to complicate things using script via git_ssh environment variable avoid creating root login).

git fsck on both repositories (no problems found).

running next command on copied version of both repositories (after doing git remote remove boxa on boxb , before readding):

git -c gc.reflogexpire=0 -c gc.reflogexpireunreachable=0 \ -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneexpire=now gc \ --aggressive

how can git fetch retrieve of commits?

so problem here turned out there detached head in repository on boxa after incomplete prepare of botched rebase. when happens output of git branch follows:

# git branch * (no branch) master

the fix create branch on boxa , merge it:

git branch temp git checkout master git merge temp git branch -d temp

after commits on branch master (or @ to the lowest degree thought branch master) available after doing git fetch.

linux git

objective c - SKSpriteNode showing up in iOS 8, not in iOS 7 -



objective c - SKSpriteNode showing up in iOS 8, not in iOS 7 -

i have skspritenode named ship, it's created :

ship = [skspritenode spritenodewithtexture:[sktexture texturewithimagenamed:@"spaceship"]]; ship.physicsbody = [skphysicsbody bodywithedgeloopfromrect:ship.frame]; ship.xscale = .5; ship.yscale = .5; ship.alpha = 1.0f; ship.position = cgpointmake(self.view.frame.size.width/2, self.view.frame.size.height/2); [self addchild:ship];

the ship shows fine on ios 8 simulator , on iphone 5 running ios 8, invisible on ios 7.

in update method set these logs :

nslog(@"ship : %@", ship); nslog(@"image : %@", ship.texture); nslog(@"alpha : %.2f", ship.alpha); nslog(@"parent : %@", ship.parent);

and output :

ship : <skspritenode> name:'(null)' texture:[<sktexture> 'spaceship' (100 x 100)] position:{160, 284} size:{25, 25} rotation:0.00 image : <sktexture> 'spaceship' (100 x 100) alpha : 1.00 parent : <skscene> name:'(null)' frame:{{0, 0}, {320, 568}}

everything there seems in order, , same log gets repeatedly called every update until ship, not visible @ all, flies off screen , code called remove , else.

without user interaction, on ios 8, happens ship appears in middle of screen, moves up, when exits frame game over. far can tell, exact same thing happening on ios 7, except ship invisible. frame's correct, responds user interaction, it's not showing up.

xcode 6 in beta right now. perchance issue. should seek running same code on xcode 5 ios 7 simulator or device.

also, can file bug study apple here.

ios objective-c sprite-kit xcode6

actionscript 3 - AS3 how to do a string to attribute -



actionscript 3 - AS3 how to do a string to attribute -

how attribute string? like, want utilize "this.a" "this" 's x position.

var a:string="x" trace(this.x,this.a)

use bracket notation:

trace( this['x'] );

or:

var a:string = 'x'; trace( this[a] );

string actionscript-3 attributes

java - When is @Autowired invoked for a bean? -



java - When is @Autowired invoked for a bean? -

for bean :

@autowired private mybean mybean;

is bean autowired before :

@requestmapping("view") public string showview { //mybean null here }

reason i'm asking mybean set null. other beans have

@rendermapping("normal") public string rendernormal{ //mybean not null here }

mybean seems autowired correctly.

is @requestmapping("view") causing mybean not wired or beingness invoked before spring autowires mybean ? if how can configure spring wire mybean before entering method showview ?

update : missing <context:annotation-config /> in spring context file, question provides detail on utilize : difference between <context:annotation-config> vs <context:component-scan>

the lone @requestmapping annotation doesn't create class spring bean.

usually, @requestmapping goes hand-by-hand @controller annotation (which extends @component annotation) it's considered spring bean , (according javadoc)

represent component receives httpservletrequest , httpservletresponse instances

java spring

javascript - Canvas generated by canvg is blurry on retina screen -



javascript - Canvas generated by canvg is blurry on retina screen -

i'm using raphael draw object, transferring html canvas element canvg can utilize todataurl save png. when utilize canvg, resulting image blurry. code below, example, produces (raphael on top, canvg on bottom):

<html> <head> <script src="lib/raphael-min.js"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/stackblur.js"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script> <script src="lib/raphael.export.js"></script> </head> <body> <div id="raph_canvas"></div><br> <canvas id="html_canvas" width="50px" height="50px"></canvas> <script language="javascript"> var test=raphael("raph_canvas",50,50); var rect=test.rect(0,0,50,50); rect.attr({fill: '#fff000', 'fill-opacity':1, 'stroke-width':1}) window.onload = function() { var canvas_svg = test.tosvg(); canvg('html_canvas',canvas_svg); var canvas_html = document.getelementbyid("html_canvas"); } </script> </body> </html>

the blurriness evident in png created todataurl well. thought going on here? don't think has re-sizing. i've tried setting ignoredimensions: true , other things.

another datapoint. if utilize raphael output text , utilize canvg, not blurry wrong font!

and here test.rect(0.5,0.5,50,50) suggested. still blurry:

so took me while, dawned on me. illustration images twice size code claims should be. you're on sort of hdpi device (retina macbook pro ect...) svg great because resolution independent, canvas on other hand not. issue you're seeing has how canvas renders. prepare this, need prep canvas drawing done @ resolution of screen.

http://jsbin.com/liquxiyi/3/edit?html,js,output

this jsbin illustration should great on screen.

the trick:

var cv = document.getelementbyid('box'); var ctx = cv.getcontext("2d"); // svg resolution independent. canvas not. need create our canvas // high resolution. // lets resolution of our device. var pixelratio = window.devicepixelratio || 1; // lets scale canvas , alter css width/height create high res. cv.style.width = cv.width +'px'; cv.style.height = cv.height +'px'; cv.width *= pixelratio; cv.height *= pixelratio; // high res need compensate our images can drawn //normal, scaling pixelratio. ctx.settransform(pixelratio,0,0,pixelratio,0,0); // lets draw box // or in case parsed svg ctx.strokerect(20.5,20.5,80,80); // lets convert dataurl var ur = cv.todataurl(); // result should canvas when using png (default) var result = document.getelementbyid('result'); result.src=ur; // need our image match resolution of canvas result.style.width = cv.style.width; result.style.height = cv.style.height;

this should explain issue you're having, , point in direction prepare it.

javascript canvas svg raphael canvg

Jersey Restful failed with error "java.lang.NoSuchMethodException: Could not find a suitable constructor" -



Jersey Restful failed with error "java.lang.NoSuchMethodException: Could not find a suitable constructor" -

the simple restful code based on jersey

class="lang-java prettyprint-override">import javax.ws.rs.applicationpath; import javax.ws.rs.core.application; import com.yakima.core.webservice.resource.userresource; import org.glassfish.jersey.jettison.jettisonfeature; import org.glassfish.jersey.server.resourceconfig; import java.util.hashset; import java.util.set; import java.util.logging.logger; @applicationpath("/") public class servlet extends resourceconfig{ logger log = logger.getlogger(servlet.class.getname()); public servlet() { registerclasses(userresource.class); register(new jettisonfeature()); packages("com.yakima.core.webservice"); log.info("--------------registered--------"); } }

resource class

class="lang-java prettyprint-override">import javax.persistence.*; import javax.ws.rs.*; import javax.ws.rs.core.context; import javax.ws.rs.core.mediatype; import javax.ws.rs.core.uriinfo; import org.codehaus.jettison.json.jsonexception; import org.codehaus.jettison.json.jsonobject; import java.util.list; import java.util.logging.logger; @path("/") public class userresource { logger log = logger.getlogger(userresource.class.getname()); @persistenceunit(unitname = "dev") entitymanagerfactory emf; @context uriinfo uriinfo; public userresource() { } @get @path("ping") @produces(mediatype.text_plain) @suppresswarnings("unchecked") public string getheathcheck() { log.info("getheathcheck"); homecoming "pang"; } }

web.xml

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>my rest service</display-name> <servlet> <servlet-name>jersey rest service</servlet-name> <servlet-class>org.glassfish.jersey.servlet.servletcontainer</servlet-class> <init-param> <param-name>jersey.config.server.provider.packages</param-name> <param-value>com.yakima.core.webservice</param-value> </init-param> <init-param> <param-name>unit:dev</param-name> <param-value>persistence/dev</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey rest service</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> <persistence-unit-ref> <persistence-unit-ref-name>persistence/dev</persistence-unit-ref-name> <persistence-unit-name>dev</persistence-unit-name> </persistence-unit-ref> </web-app>

persistence.xml

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="dev" transaction-type="jta"> <provider>oracle.toplink.essentials.persistenceprovider</provider> <properties> <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/dev"/> <property name="toplink.jdbc.user" value="root"/> <property name="toplink.jdbc.driver" value="com.mysql.jdbc.driver"/> <property name="toplink.jdbc.password" value="password"/> <property name="toplink.ddl-generation" value="drop-and-create-tables"/> </properties> </persistence-unit>

error shows below after deploy

class="lang-java prettyprint-override"> jun 26, 2014 1:59:18 org.glassfish.jersey.internal.errors logerrors warning: next warnings have been detected: warning: hk2 service reification failed [com.yakima.core.webservice.resource.userresource] exception: multiexception stack 1 of 2 java.lang.nosuchmethodexception: not find suitable constructor in com.yakima.core.webservice.resource.userresource class. @ org.glassfish.jersey.internal.inject.jerseyclassanalyzer.getconstructor(jerseyclassanalyzer.java:189) @ org.jvnet.hk2.internal.utilities.getconstructor(utilities.java:183) @ org.jvnet.hk2.internal.clazzcreator.initialize(clazzcreator.java:129) @ org.jvnet.hk2.internal.clazzcreator.initialize(clazzcreator.java:182) @ org.jvnet.hk2.internal.systemdescriptor.internalreify(systemdescriptor.java:649) @ org.jvnet.hk2.internal.systemdescriptor.reify(systemdescriptor.java:604) @ org.jvnet.hk2.internal.servicelocatorimpl.reifydescriptor(servicelocatorimpl.java:417) @ org.jvnet.hk2.internal.servicelocatorimpl.narrow(servicelocatorimpl.java:2099) @ org.jvnet.hk2.internal.servicelocatorimpl.access$900(servicelocatorimpl.java:119) @ org.jvnet.hk2.internal.servicelocatorimpl$8.compute(servicelocatorimpl.java:1051) @ org.jvnet.hk2.internal.servicelocatorimpl$8.compute(servicelocatorimpl.java:1046) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture$1.call(lruhybridcache.java:115) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture$1.call(lruhybridcache.java:111) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture.run(lruhybridcache.java:173) @ org.glassfish.hk2.utilities.cache.lruhybridcache.compute(lruhybridcache.java:292) @ org.jvnet.hk2.internal.servicelocatorimpl.internalgetdescriptor(servicelocatorimpl.java:1135) @ org.jvnet.hk2.internal.servicelocatorimpl.getservice(servicelocatorimpl.java:636) @ org.jvnet.hk2.internal.servicelocatorimpl.getservice(servicelocatorimpl.java:626) @ org.glassfish.jersey.internal.inject.injections.getorcreate(injections.java:172) @ org.glassfish.jersey.server.model.methodhandler$classbasedmethodhandler.getinstance(methodhandler.java:185) @ org.glassfish.jersey.server.internal.routing.pushmethodhandlerrouter.apply(pushmethodhandlerrouter.java:74) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:112) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage.apply(routingstage.java:94) @ org.glassfish.jersey.server.internal.routing.routingstage.apply(routingstage.java:63) @ org.glassfish.jersey.process.internal.stages.process(stages.java:197) @ org.glassfish.jersey.server.serverruntime$1.run(serverruntime.java:261) @ org.glassfish.jersey.internal.errors$1.call(errors.java:271) @ org.glassfish.jersey.internal.errors$1.call(errors.java:267) @ org.glassfish.jersey.internal.errors.process(errors.java:315) @ org.glassfish.jersey.internal.errors.process(errors.java:297) @ org.glassfish.jersey.internal.errors.process(errors.java:267) @ org.glassfish.jersey.process.internal.requestscope.runinscope(requestscope.java:297) @ org.glassfish.jersey.server.serverruntime.process(serverruntime.java:252) @ org.glassfish.jersey.server.applicationhandler.handle(applicationhandler.java:1025) @ org.glassfish.jersey.servlet.webcomponent.service(webcomponent.java:372) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:382) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:345) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:220) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:744) multiexception stack 2 of 2 java.lang.illegalargumentexception: errors discovered while reifying systemdescriptor( implementation=com.yakima.core.webservice.resource.userresource contracts={com.yakima.core.webservice.resource.userresource} scope=org.glassfish.jersey.process.internal.requestscoped qualifiers={} descriptortype=class descriptorvisibility=normal metadata= rank=0 loader=null proxiable=null proxyforsamescope=null analysisname=null id=144 locatorid=2 identityhashcode=701724234 reified=false) @ org.jvnet.hk2.internal.systemdescriptor.reify(systemdescriptor.java:615) @ org.jvnet.hk2.internal.servicelocatorimpl.reifydescriptor(servicelocatorimpl.java:417) @ org.jvnet.hk2.internal.servicelocatorimpl.narrow(servicelocatorimpl.java:2099) @ org.jvnet.hk2.internal.servicelocatorimpl.access$900(servicelocatorimpl.java:119) @ org.jvnet.hk2.internal.servicelocatorimpl$8.compute(servicelocatorimpl.java:1051) @ org.jvnet.hk2.internal.servicelocatorimpl$8.compute(servicelocatorimpl.java:1046) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture$1.call(lruhybridcache.java:115) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture$1.call(lruhybridcache.java:111) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ org.glassfish.hk2.utilities.cache.lruhybridcache$originthreadawarefuture.run(lruhybridcache.java:173) @ org.glassfish.hk2.utilities.cache.lruhybridcache.compute(lruhybridcache.java:292) @ org.jvnet.hk2.internal.servicelocatorimpl.internalgetdescriptor(servicelocatorimpl.java:1135) @ org.jvnet.hk2.internal.servicelocatorimpl.getservice(servicelocatorimpl.java:636) @ org.jvnet.hk2.internal.servicelocatorimpl.getservice(servicelocatorimpl.java:626) @ org.glassfish.jersey.internal.inject.injections.getorcreate(injections.java:172) @ org.glassfish.jersey.server.model.methodhandler$classbasedmethodhandler.getinstance(methodhandler.java:185) @ org.glassfish.jersey.server.internal.routing.pushmethodhandlerrouter.apply(pushmethodhandlerrouter.java:74) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:112) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage._apply(routingstage.java:115) @ org.glassfish.jersey.server.internal.routing.routingstage.apply(routingstage.java:94) @ org.glassfish.jersey.server.internal.routing.routingstage.apply(routingstage.java:63) @ org.glassfish.jersey.process.internal.stages.process(stages.java:197) @ org.glassfish.jersey.server.serverruntime$1.run(serverruntime.java:261) @ org.glassfish.jersey.internal.errors$1.call(errors.java:271) @ org.glassfish.jersey.internal.errors$1.call(errors.java:267) @ org.glassfish.jersey.internal.errors.process(errors.java:315) @ org.glassfish.jersey.internal.errors.process(errors.java:297) @ org.glassfish.jersey.internal.errors.process(errors.java:267) @ org.glassfish.jersey.process.internal.requestscope.runinscope(requestscope.java:297) @ org.glassfish.jersey.server.serverruntime.process(serverruntime.java:252) @ org.glassfish.jersey.server.applicationhandler.handle(applicationhandler.java:1025) @ org.glassfish.jersey.servlet.webcomponent.service(webcomponent.java:372) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:382) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:345) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:220) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:744) libs ls -l /var/lib/tomcat7/webapps/webservice/web-inf/lib/ total 6648 -rw-r--r-- 1 tomcat7 tomcat7 14787 jun 17 17:35 aopalliance-repackaged-2.3.0-b05.jar -rw-r--r-- 1 tomcat7 tomcat7 159444 jun 17 17:35 hk2-api-2.3.0-b05.jar -rw-r--r-- 1 tomcat7 tomcat7 162326 jun 17 17:35 hk2-locator-2.3.0-b05.jar -rw-r--r-- 1 tomcat7 tomcat7 82770 jun 17 17:35 hk2-utils-2.3.0-b05.jar -rw-r--r-- 1 tomcat7 tomcat7 714194 jun 17 17:35 javassist-3.18.1-ga.jar -rw-r--r-- 1 tomcat7 tomcat7 26366 jun 17 17:35 javax.annotation-api-1.2.jar -rw-r--r-- 1 tomcat7 tomcat7 5942 jun 17 17:35 javax.inject-2.3.0-b05.jar -rw-r--r-- 1 tomcat7 tomcat7 112758 jun 17 17:35 javax.ws.rs-api-2.0.jar -rw-r--r-- 1 tomcat7 tomcat7 151913 jun 17 17:35 jersey-client-2.9.jar -rw-r--r-- 1 tomcat7 tomcat7 722711 jun 18 13:41 jersey-common-2.9.1.jar -rw-r--r-- 1 tomcat7 tomcat7 15719 jun 18 23:25 jersey-container-servlet-2.9.1.jar -rw-r--r-- 1 tomcat7 tomcat7 54943 jun 18 12:16 jersey-container-servlet-core-2.9.1.jar -rw-r--r-- 1 tomcat7 tomcat7 962867 jun 17 17:35 jersey-guava-2.9.jar -rw-r--r-- 1 tomcat7 tomcat7 46504 jun 18 12:07 jersey-media-json-jettison-2.9.1.jar -rw-r--r-- 1 tomcat7 tomcat7 915852 jun 18 13:37 jersey-server-2.9.1.jar -rw-r--r-- 1 tomcat7 tomcat7 81899 apr 29 11:37 jettison-1.3.5.jar -rw-r--r-- 1 tomcat7 tomcat7 20235 jun 17 17:35 osgi-resource-locator-1.0.1.jar -rw-r--r-- 1 tomcat7 tomcat7 53842 jun 17 17:13 persistence-api-1.0.2.jar -rw-r--r-- 1 tomcat7 tomcat7 26514 aug 1 2013 stax-api-1.0.1.jar -rw-r--r-- 1 tomcat7 tomcat7 2370900 jun 18 12:15 toplink-essentials-1.0.jar -rw-r--r-- 1 tomcat7 tomcat7 63777 jun 18 12:03 validation-api-1.1.0.final.jar

anything wrong? appreciate help

jersey resource instantiation expects parameterless constructor. may should create no-arg constructor base of operations class inherited classes.

java jersey

compilation - Compile error OSX -



compilation - Compile error OSX -

i'm trying compile programme called pear enter link description here , seems there wrong @ step.

i have xcode installed.

thanks help, bernardo

bernardos-macbook-pro:pear-0.9.0-src bernardo$ create /applications/xcode.app/contents/developer/usr/bin/make -c src gcc -c -wall -fomit-frame-pointer -o3 -lm pear-pt.c -o pear-pt.o clang: warning: -lm: 'linker' input unused gcc -c -wall -fomit-frame-pointer -o3 -lm reader.c -o reader.o clang: warning: -lm: 'linker' input unused reader.c:670:1: warning: unused function 'do_cpuid' [-wunused-function] do_cpuid(uint32_t selector, uint32_t *data) ^ 1 warning generated. gcc -wall -fomit-frame-pointer -o3 -lm pear-pt.o args.o statistics.o reader.o -lm -lpthread -o pear ld: warning: ignoring file args.o, file built unsupported file format ( 0x7f 0x45 0x4c 0x46 0x01 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) not architecture beingness linked (x86_64): args.o ld: warning: ignoring file statistics.o, file built unsupported file format ( 0x7f 0x45 0x4c 0x46 0x01 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) not architecture beingness linked (x86_64): statistics.o undefined symbols architecture x86_64: "_decode_switches", referenced from: _main in pear-pt.o "_stat_test2", referenced from: _assembly_forward_longer in pear-pt.o _assembly_reads_equal in pear-pt.o _assembly_reverse_longer in pear-pt.o _assembly in pear-pt.o "_usage", referenced from: _main in pear-pt.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make[1]: *** [pear] error 1 make: *** [all] error 2

osx compilation

r - Custom CSS for highlighting in knitr -



r - Custom CSS for highlighting in knitr -

related:

code styling black , white documents

i want utilize simple custom css code highlighting in knitted .rnw/.tex/.pdf documents. select few rules seem implemented upon knitting.

for moment focusing on colorless highlighting, consequently manipulate rules such text-decoration, font-weight, font-style , - grays - color; cf. theme "print" here. but, simplest examples, can few implemented, e.g., color , font-style; specifically, i've found font-weight nothing, nor text-decoration. e.g.:

.background { color:#f6f6f6; } ... .kwc {/* e.g., parameters */ font-weight:100; color:#8c8c8c; } .kwd {/* e.g., methods */ text-decoration:underline; } ... .com {/* comments */ font-style:italic; } ...

(the sets of 3 dots indicate css file contains more illustration above.)

with above in style sheet, in output pdf code block background , parameters colored accordingly , comments italicized, parameters not have font weight of 100 nor methods underlined.

is there sort of limitation rules custom knitr themes may use? else may problem here?

n.b.:

mac 10.9.3 knitr v1.6.3.

i have css in same directory rnw document , pass knitr in chunk @ origin of document via:

theme <- knit_theme$get('./my_css.css') knit_theme$set(theme)

css r latex knitr rnw

spring - Using ClassPathXmlApplicationContext to load beans -



spring - Using ClassPathXmlApplicationContext to load beans -

this interface

public interface personneservice { public void add(personne personne); public void delete (int personneid); public personne getpersonne(int personneid); public list getallpersonne(); }

this class main

import static org.junit.assert.*; import java.util.list; import org.junit.afterclass; import org.junit.beforeclass; import org.junit.test; import org.springframework.context.support.classpathxmlapplicationcontext; import com.test.model.personne; public class personneservicetest { private static classpathxmlapplicationcontext context; private static personneservice personneservice; @beforeclass public static void setupbeforeclass() throws exception { context= new classpathxmlapplicationcontext("applicationcontext.xml"); personneservice=(personneservice) context.getbean("personneservice"); } @afterclass public static void teardownafterclass() throws exception { context.close(); }

this error

org.springframework.context.support.abstractapplicationcontext preparerefresh infos: refreshing org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a: display name [org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a]; startup date [mon jun 23 11:03:13 west 2014]; root of context hierarchy juin 23, 2014 11:03:13 org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions infos: loading xml bean definitions class path resource [applicationcontext.xml] juin 23, 2014 11:03:14 org.springframework.context.support.abstractapplicationcontext obtainfreshbeanfactory infos: bean mill application context [org.springframework.context.support.classpathxmlapplicationcontext@1b10f9a]: org.springframework.beans.factory.support.defaultlistablebeanfactory@648a34

here error while doing sample project in spring. application-context.xml in src doesn't work:

java.lang.noclassdeffounderror: org/antlr/runtime/recognitionexception

spring

bouncycastle - Java and error in Cast programming--AttrCertExample? -



bouncycastle - Java and error in Cast programming--AttrCertExample? -

when run program, console gives me error:

java.lang.noclassdeffounderror: org/bouncycastle/x509/examples/attrcertexample

what's problem?

did check create sure classpath set correctly? error means java can't find .class file class. link explains more classpath. if you're using eclipse, can click on project in project tree , go file->properties->java build path edit paths.

java bouncycastle

c# to f# - Parameterless lambda expressions in F# -



c# to f# - Parameterless lambda expressions in F# -

i looking way define parameterless lambda expressions in f#, much next c# example.

var task = () => { int x = 3; dosomething(x); }

i tried following

let task = fun _ -> allow x = 3 dosomething x

it compiles gives me task : ('a -> unit) looking task : (unit -> unit)

the msdn documentation not talk this. missing here ?

it's just

let task = fun () -> // whatever need

you illustration be:

let task = fun () -> allow x = 3 dosomething(3)

assuming dosomething of type int -> unit - if returns else need

let task = fun () -> allow x = 3 dosomething(3) |> ignore

to type unit -> unit

remark: don't write let task = fun () -> ... let task() = ...

the thing missed: if write fun _ -> () saying want take parameter don't mind - f# take general (being named 'a here) - include unit! () value of type unit (more or less void c# ... true type in f#)

f# c#-to-f# unit-type

javascript - Jade template won't output right html when using href -



javascript - Jade template won't output right html when using href -

i'm having next problem when using jade template:

p a(href="https://{{ provider }}.com/{{ nickname }}")(target='_blank') {{ nickname }} | {{> chat_box_text }}

it outputs next html:

<p><a href="<a href=" https:="" twitter.com="" mateusgff"="" target="_blank">https://twitter.com/mateusgff</a>" target="_blank">mateusgfftesting<span class="date">4:41 pm</span></p>

if utilize # instead of https://{{ provider }}.com/{{ nickname }} works great. why happening?

try following

p a(href='https://{{ provider }}.com/{{ nickname }}', target='_blank') {{ nickname }} | {{> chat_box_text }}

i believe shouldn't have double quotations have them singular ones, e.g. '

javascript html node.js jade

jQuery mouseleave not working -



jQuery mouseleave not working -

ok basically, ive got smaller div (overlay) thats hidden shows/hides when mouse hovers on main div (box). when mouse hovers , overlay div slides up, when mouse leaves box div overlay remains , not slide down.

css

.box {border:1px reddish solid; width:250px; height:230px; position:relative; overflow:hidden} .overlay {position:absolute; background-color:red; width:100%; height:50px; bottom:-60px}

html

<div class="box"><div class="overlay">content</div></div>

js

$('.box').hover(function(){ $('.overlay').animate({top:"180px"}); }); $('.box').mouseleave(function(){ $('.overlay').animate({bottom:"180px"}); });

your mouseleave should goto opposite value of initial animate:

$('.overlay').animate({top:"-180px"});

http://jsfiddle.net/s4dsk/

jquery

php - Error displaying table from database -



php - Error displaying table from database -

i'm trying display table, t2d_10 database, chr10 using php. table has 5 columns rs1, rs2, rs3, rs4, rs5. code:

<?php // set database server access variables: $host = "localhost"; $user = "root"; $pass = ""; $db = "chr10"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("unable connect!"); // select database mysql_select_db($db, $connection) or die ("unable select database!"); // create query $query = "select * t2d_10"; // execute query $result = mysql_query($query) or die ("error in query: $query. ".mysql_error()); // see if rows returned if (mysql_num_rows($result) > 0) { // yes // print them 1 after echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>".$row['rs1']."</td>"; echo "<td>".$row['rs2']."</td>"; echo "<td>".$row['rs3']."</td>"; echo "<td>".$row['rs4']."</td>"; echo "<td>".$row['rs5']."</td>"; echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "no rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?>

error:

notice: undefined index: rs1 in c:\wamp\www\ch\run_db.php on line 28 notice: undefined index: rs2 in c:\wamp\www\ch\run_db.php on line 29 notice: undefined index: rs3 in c:\wamp\www\ch\run_db.php on line 30 notice: undefined index: rs4 in c:\wamp\www\ch\run_db.php on line 31 notice: undefined index: rs5 in c:\wamp\www\ch\run_db.php on line 32

i'm new php. can please help me this? in advance.

mysql_fetch_row() indexed array only.

either utilize mysql_fetch_array() or mysql_fetch_assoc()

check this: difference between mysql_fetch_array , mysql_fetch_row?

php database

c++ - manual grayscale in opencv is too slow -



c++ - manual grayscale in opencv is too slow -

note: have manually don't suggest me utilize library function cvtcolor().

i'm new opencv , trying grayscale color image formula

(r,g,b) = (r,g,b)/((r+g+b)/3)

here method(c++) converting grayscale:

mat dst = src.clone(); (int i= 0; i<src.rows; ++i) { (int j = 0 ; j < src.cols; ++j) { vec3b myvec = dst.at<vec3b>(i,j); uchar temp = (myvec[0]+myvec[1]+myvec[2])/3; vec3b newpoint(temp,temp,temp); dst.at<vec3b>(i,j) = newpoint ; } }

because want grayscale video utilize method grayscale each of frame. slow in comparing using cvtcolor(src,dst,cv_rgb2gray). (i waitkey(1) not problem of waitkey)

i have 2 questions

i wonder if there way manually grayscale image fast cvtcolor. if not guy know how optimize above code grayscale video appears smoother. the above 1 approach grayscale. (r,g,b) = (r,g,b)/((r+g+b)/3) can guy tell me other approaches grayscale color image?

any reply appreciated. in advance.

i can tell ::at function slow.

i utilize struct , pointer here rgb example:

#pragma pack(push, 2) struct rgb { //members in "bgr" order! uchar blue; uchar green; uchar red; };

and acces pixels of image this:

rgb& rgb = image.ptr<rgb>(y)[x]; //y = row, x = col

change pixel values (for rgb image) this:

image.ptr<rgb>(y)[x].value[0] = 142; image.ptr<rgb>(y)[x].value[1] = 255; image.ptr<rgb>(y)[x].value[2] = 90;

you can translate grayscale problem pretty easy. thing is, fast because scanline of cv::mat image not split in memory pixels of 1 scanline next each other in memory.

c++ opencv optimization grayscale

excel - How do I read csv with large numbers (probably scientific notation) in R? -



excel - How do I read csv with large numbers (probably scientific notation) in R? -

i have 13-digit numbers in xls file , utilize excel generate csv file because need process in r. when r read csv file, cannot recognize big numbers. example, 1329100082670 appear 1.329e+12 in r , lost precision. i've tried format big numbers text in excel , save csv didn't work!

thanks in advance!

the numbers there, default r doesn't aways show them. see

> a<-1329100082670 > [1] 1.3291e+12 > dput(a) 1329100082670

the dput() shows digits retained if display on screen in scientific notation. can discourage r using scientific notation setting scipen option. like

options(scipen=999)

will turn off scientific notation. really, looks on screen shouldn't of import hopefully.

r excel csv

emacs - 'Symbol's function definition is void: nil' which symbol? -



emacs - 'Symbol's function definition is void: nil' which symbol? -

i'm getting next error when starting emacs: (as shown messages buffer):

c-font-lock-fontify-region: symbol's function definition void: nil

how track downwards causing error in function? debug-on-error true, still doesn't give more info here.

the symbol nil. not name function.

generally speaking, debug error, need set debug-on-error t , @ *backtrace* buffer. if no *backtrace* buffer appears (which case here), means caller of function signals error catches error. need chase code looking condition-case , disable it. luck :-(

looking @ c-font-lock-fontify-region definition in progmodes/cc-mode.el, see there

(funcall (default-value 'font-lock-fontify-region-function) new-beg new-end verbose)

which can cause error if (default-value 'font-lock-fontify-region-function) nil.

emacs elisp

c++ - Casting unsigned byte array to array of Structs -



c++ - Casting unsigned byte array to array of Structs -

using c++ (gcc specifically, should have set sooner), i'm storing raw texture info in array of unsigned bytes, in rgba format, 32 bits per pixel (8 bits per color value alpha, on , forth...). thing is, want write function returns raw info array of colors, color struct defined following:

struct color { uint8 r; uint8 g; uint8 b; uint8 a; };

plus functions , whatnot, variables in struct. thinking since each color 4 bytes long, can somehow cast raw byte array color array 1/4 of original size (in "length" of array, not in absolute size). think reinterpret_cast looking for, cannot find after google search confirms 100% can convert array of structs instead of 1 struct.

so guess asking either confirm indeed possible reinterpret_cast, or if there different cast or way this. thanks.

edit: wording little weird, arbitrary illustration i'd somehow cast array of 16 unsigned bytes array of 4 colors.

edit: know it's kind of little late, cant seem find how cast little portion of array @ specific place single struct using reinterpret_cast, if possible, without copying smaller array , casting that. help problem appreciated.

as arbitrary illustration i'd somehow cast array of 16 unsigned bytes array of 4 colors.

like this:

#pragma pack(push, 1) struct color { uint8 r; uint8 g; uint8 b; uint8 a; }; #pragma pack(pop)

uint8 bytearray[16]; ... color *colorarray = reinterpret_cast<color*>(bytearray);

then can things this:

for (int idx = 0; idx < 4; ++idx) { color &c = colorarray[idx]; // utilize c.r, c.g, c.b, c.a needed... }

c++ pointers c++11 struct casting

Rails 4 uninitialized constant Admin::Category -



Rails 4 uninitialized constant Admin::Category -

i have generated admin namespaced controllers default models follows:

rails g scaffold_controller admin/categories name:string slug:string description:string icon_xlarge:string icon_large:string icon_medium:string icon_small:string status:integer

this generated next files:

harshas-macbook-pro:nomad harshamv$ rails g scaffold_controller admin/categories name:string slug:string description:string icon_xlarge:string icon_large:string icon_medium:string icon_small:string status:integer plural version of model detected, using singularized version. override --force-plural. create app/controllers/admin/categories_controller.rb invoke erb create app/views/admin/categories create app/views/admin/categories/index.html.erb create app/views/admin/categories/edit.html.erb create app/views/admin/categories/show.html.erb create app/views/admin/categories/new.html.erb create app/views/admin/categories/_form.html.erb invoke test_unit create test/controllers/admin/categories_controller_test.rb

app/model/category.rb

class category < activerecord::base extend friendlyid friendly_id :name, use: :slugged has_and_belongs_to_many :venues end

app/controller/admin/categories_controller.rb

class admin::categoriescontroller < applicationcontroller before_action :set_admin_category, only: [:show, :edit, :update, :destroy] # /admin/categories def index @admin_categories = admin::category.all end # /admin/categories/1 def show end # /admin/categories/new def new @admin_category = admin::category.new end # /admin/categories/1/edit def edit end # post /admin/categories def create @admin_category = admin::category.new(admin_category_params) if @admin_category.save redirect_to @admin_category, notice: 'category created.' else render :new end end # patch/put /admin/categories/1 def update if @admin_category.update(admin_category_params) redirect_to @admin_category, notice: 'category updated.' else render :edit end end # delete /admin/categories/1 def destroy @admin_category.destroy redirect_to admin_categories_url, notice: 'category destroyed.' end private # utilize callbacks share mutual setup or constraints between actions. def set_admin_category @admin_category = admin::category.find(params[:id]) end # allow trusted parameter "white list" through. def admin_category_params params.require(:admin_category).permit(:name, :slug, :description, :icon_xlarge, :icon_large, :icon_medium, :icon_small, :status) end end

app/view/admin/categories/index.html.erb

<h1>listing admin_categories</h1> <table> <thead> <tr> <th>name</th> <th>slug</th> <th>description</th> <th>icon xlarge</th> <th>icon large</th> <th>icon medium</th> <th>icon small</th> <th>status</th> <th colspan="3"></th> </tr> </thead> <tbody> <% @admin_categories.each |admin_category| %> <tr> <td><%= admin_category.name %></td> <td><%= admin_category.slug %></td> <td><%= admin_category.description %></td> <td><%= admin_category.icon_xlarge %></td> <td><%= admin_category.icon_large %></td> <td><%= admin_category.icon_medium %></td> <td><%= admin_category.icon_small %></td> <td><%= admin_category.status %></td> <td><%= link_to 'show', admin_category %></td> <td><%= link_to 'edit', edit_admin_category_path(admin_category) %></td> <td><%= link_to 'destroy', admin_category, method: :delete, data: { confirm: 'are sure?' } %></td> </tr> <% end %> </tbody> </table> <br> <%= link_to 'new category', new_admin_category_path %> my attempts

i edited controller below

# /admin/categories def index @admin_categories = category.all end # /admin/categories/1 def show end # /admin/categories/new def new @admin_category = category.new end # /admin/categories/1/edit def edit end # post /admin/categories def create @admin_category = category.new(admin_category_params) if @admin_category.save redirect_to @admin_category, notice: 'category created.' else render :new end end

when go localhost/admin/categories , click "new category", next error now:

my routes file:

rails.application.routes.draw # admin routing namespace :admin resources :categories, :cities, :countries, :lists, :oauths, :regions, :tags, :users, :user_groups, :venues, :venue_photos, :venue_reviews end end

you have resources :categories defined under namespace :admin in routes.rb,so line in views/admins/categories/_form.html.erb

<%= form_for(@admin_category) |f| %>

should be

<%= form_for([:admin, @admin_category]) |f| %>

for more info,refer api

update

the sec error because of line

params.require(:admin_category).permit(:name, :slug, :description, :icon_xlarge, :icon_large, :icon_medium, :icon_small, :status)

it should be

params.require(:category).permit(:name, :slug, :description, :icon_xlarge, :icon_large, :icon_medium, :icon_small, :status)

ruby-on-rails ruby-on-rails-4 rails-generate