Friday, 15 April 2011

cassandra - Adding tor to the Thrift / Astyanax API -



cassandra - Adding tor to the Thrift / Astyanax API -

im trying add together tor on-top of thrift astyanax , im wondering if has tried or come accross similar projects. extensive googling (and bing searching) has lead me nowhere. stared looking through astyanax's source code in effort find actual connection between client , cassandra takes place , ended @ this class. far can tell plays little part need find if api uses inputstream , outputstream object send , receive info , overload connection.

this question might closed localised, im hoping cassandra / astyanax gurus can point me in right direction.

you need find cassandra builds bridge between client machine , server. class (or collection of classes) provide means of connection using socket uses input/output streams send , receive data.

update: key classes thrift api (libthrift) used in hector , astyanax

org.apache.thrift.transport.tsocket - creates socket used connect cass. org.apache.thrift.transport.tiostreamtransport - handles in/out stream , info added (what u send/receive)

the next steps should take divert socket connect cassandra through tor rather tcp/ip.

cassandra thrift astyanax

css - Expand parent div height to childs -



css - Expand parent div height to childs -

i have problem footer positioning. doesn't go bottom/last.

so, have container div has 3 divs - float:right , float:left , center 1 (which has position:absolute) comes between two floated divs.

the center 1 must have fixed width , height because it's image.

in center div have div lot of content.

the problem is, because center div has fixed width , height, doesn't take childs div height.

so problem how set footer comes lastly (after container)?

note - jquery set width of floated divs because take 100%-980px width.

this how looks like.

i tried putting center div overflow:auto,overflow:overlay,margin-left:auto;margin-right:auto;.

after reading question 1 time again again come conclusion , create below fiddle using code , embed sample image desired size.

please allow me know if wrong while understanding question. can work around according needs.

fiddle: http://jsfiddle.net/ah3nr/6

demo: http://jsfiddle.net/ah3nr/6/embedded/result/

my approach:

i have remove position:absolute center div , added new div image , relate them both using css layer techniques.

updated css:

.sectiondowncontainer { width: 980px; /*height:270px;*/ border:1px solid red; /*position: absolute;*/ position:relative; top: -32px; z-index: 1; } /*.sectiondownmenu { margin-left: 50px; margin-top: 1px; display: block; } */ #image_container { position:relative; width:980px; height: 270px; margin-top:-2px; z-index:2; } .sectiondowncontent { width: 640px; margin-top: -190px; margin-left: 50px; position: relative; z-index:5; color:#000; font-weight:bold; }

screenshot:

css

html - java applet program errors -



html - java applet program errors -

i finished making tic-tac-toe game in java, though received lots of errors, main errors 'else' without 'if' , ';' expected didn't need be. code:

import java.awt.*; import java.awt.event.*; import java.applet.applet; public class tictactoe extends applet implements actionlistener button squares[]; button newgamebutton; label score; int emptysquaresleft = 9; public void init (){ this.setlayout(new borderlayout()); this.setbackground(color.cyan); font appletfont = new font("monospased", font.bold,20); this.setfont(appletfont); newgamebutton = new button ("new game"); newgamebutton.addactionlistener(this); panel toppanel = new panel(); toppanel.add(newgamebutton); this.add(toppanel, "north"); panel centerpanel = new panel(); centerpanel.setlayout(new gridlayout (3,3)); this.add(centerpanel,"center"); score = new label ("your turn!"); this.add(score,"south"); squares = new button[9]; for(int i=0;i<9;i++){ squares[i] = new button(); squares[i].addactionlistener(this); squares[i].setbackground(color.orange); } } public void actionperformed(actionevent e){ button thebutton = (button) e.getsource(); if (thebutton == newgamebutton){ (int i=0; i<9;i++){ squares [i].setenabled (true); squares [i].setlabel(""); squares[i].setbackground(color.orange); } emptysquaresleft = 9; score.settext("your turn!"); newgamebutton.setenabled(false); return; } string winner = ""; (int i=0; i<9; i++){ if (thebutton == squares[i]){ squares[i].setlabel("x"); winner = lookforwinner(); if(!"".equals(winner)){ endthegame (); } else { computermove(); winner = lookforwinner(); if(!"".equals (winner)){ endthegame(); } } break; } } if (winner.equals("x")){ score.settext("you won!"); } else if (winner.equals("o")){ score.settext("you lost!"); } else if (winner.equals ("t")){ score.settext ("it's tie!"); } } string lookforwinner() { string thewinner = ""; emptysquaresleft--; if (emptysquaresleft == 0){ homecoming "t"; } if (!squares [0].getlabel().equals("") && squares[0].getlabel().equals(squares[1].getlabel()) && squares[0].getlabel().equals(squares[2].getlabel())){ thewinner = squares[0].getlabel(); highlightwinner(0,1,2); } else if (!squares [3].getlabel().equals("") && squares[3].getlabel().equals(squares[4].getlabel()) && squares[3].getlabel().equals(squares[5].getlabel())){ thewinner = squares[3].getlabel(); highlightwinner(3,4,5); } else if (!squares [6].getlabel().equals("") && squares[6].getlabel().equals(squares[7].getlabel()) && squares[6].getlabel().equals(squares[8].getlabel())){ thewinner = squares[6].getlabel(); highlightwinner(6,7,8); } else if (!squares [0].getlabel().equals("") && squares[0].getlabel().equals(squares[3].getlabel()) && squares[0].getlabel().equals(squares[6].getlabel())){ thewinner = squares[0].getlabel(); highlightwinner(0,3,6); } else if (!squares [1].getlabel().equals("") && squares[1].getlabel().equals(squares[4].getlabel()) && squares[1].getlabel().equals(squares[7].getlabel())){ thewinner = squares[2].getlabel(); highlightwinner(1,4,7); } else if (!squares [2].getlabel().equals("") && squares[2].getlabel().equals(squares[5].getlabel()) && squares[2].getlabel().equals(squares[8].getlabel())){ thewinner = squares[2].getlabel(); highlightwinner(2,5,8); } else if (!squares [0].getlabel().equals("") && squares[0].getlabel().equals(squares[4].getlabel()) && squares[0].getlabel().equals(squares[8].getlabel())){ thewinner = squares[2].getlabel(); highlightwinner(0,4,8); } else if (!squares [2].getlabel().equals("") && squares[2].getlabel().equals(squares[4].getlabel()) && squares[2].getlabel().equals(squares[6].getlabel())){ thewinner = squares[2].getlabel(); highlightwinner(2,4,6); } homecoming thewinner; } void computermove() { int selectedsquare; selectedsquare = findemptysquare("o"); if (selectedsquare == -1){ selectedsquare = findemptysquare("x"); } if ((selectedsquare == -1) && (squares[4].getlabel().equals("")) ) { selectedsquare = 4; } if (selectedsquare == -1){ selectedsquare = getrandomsquare(); } squares [selectedsquare].setlabel("o"); } int findemptysquare(string player) { int weigh[] = new int[9]; (int i=0; i<9; i++){ if(squares [i].getlabel().equals("o")) weight[i] = -1; else if (squares[i].getlabel().equals("x")) weight[i] = 1; else weight[i] = 0; } int twoweights = player.equals("o") ? -2:2; if (weight [0] + weight[1] + weight[2] == twoweights){ if(weight[0]==0) homecoming 0; else if (weight [1] == 0) homecoming 1; else homecoming 2; } if (weight [3] + weight[4] + weight[5] == twoweights){ if(weight[3]==0) homecoming 3; else if (weight [4] == 0) homecoming 4; else homecoming 5; } if (weight [6] + weight[7] + weight[8] == twoweights){ if(weight[6]==0) homecoming 6; else if (weight [7] == 0) homecoming 7; else homecoming 8; } if (weight [0] + weight[3] + weight[6] == twoweights){ if(weight[0]==0) homecoming 0; else if (weight [3] == 0) homecoming 3; else homecoming 6; } if (weight [1] + weight[4] + weight[7] == twoweights){ if(weight[1]==0){ homecoming 1; else if (weight [4] == 0) homecoming 4; else homecoming 7; } if (weight [2] + weight[5] + weight[8] == twoweights){ if(weight[2]==0) homecoming 2; else if (weight [5] == 0) homecoming 5; else homecoming 8; } if (weight [0] + weight[4] + weight[8] == twoweights){ if(weight[0]==0) homecoming 0; else if (weight [4] == 0) homecoming 4; else homecoming 8; } if (weight [2] + weight[4] + weight[6] == twoweights){ if(weight[2]==0) homecoming 2; else if (weight [4] == 0) homecoming 4; else homecoming 6; } homecoming -1; } int getrandomsquare(){ boolean gotemptysquare = false; int selectedsquare = -1; { selectedsquare = (int) (math.random() * 9); if (squares[selectedsquare].getlabel().equals("")){ gotemptysquare = true; } } while (!gotemptysquare) homecoming selectedsquare; } void highlightwinner(int win1; int win2; int win3) { squares [win1].setbackground(color.cyan); squares [win2].setbackground(color.cyan); squares [win3].setbackground(color.cyan); } void endthegame (){ newgamebutton.setenabled(true); for(int i=0;i<9;i++){ squares[i].setenabled(false); } } } }

in adition @mika's suggestion,

also in line 213 forgot close bracket:

if(weight[1]==0){ homecoming 1; else if (weight [4] == 0) homecoming 4;

should be

if(weight[1]==0){ homecoming 1; } else if (weight [4] == 0) homecoming 4;

in declaration of

void highlightwinner(int win1; int win2; int win3) {

you have ; instead of , (don't know language comes from) need:

void highlightwinner(int win1, int win2, int win3) {

in getrandomsquare() forgot semi-colon after do while:

} while (!gotemptysquare)

should

} while (!gotemptysquare);

typo in findemptysquare() (forgot t)

int weigh[] = new int[9];

should

int weight[] = new int[9];

extra } @ end of file

squares[i].setenabled(false); } } } }

should

squares[i].setenabled(false); } } }

after these corrections code compiles

dont know if want, question compilation errors, not errors in logic.

i recomment start using ide netbeans (it free), help debug programme self.

also improve compile programme , test after every couple of lines add, don't end screen total of errors when first compile.

good luck!

java html applet void

javascript - Load external html file to div and use its js functions -



javascript - Load external html file to div and use its js functions -

i have div:

<div id='dialog'></div>

now want load div external html file , utilize js functions.

i know can load using jquery.load() , works fine, problem want utilize html js functions.

the main problem have several divs load html file them , want when i'm activating js function work on specific div.

pass parameter view loading indicate container of loaded view:

jquery.load(url, { containerid: 'dialog' })

javascript jquery html

python - Find all matchings of two differently sized arrays -



python - Find all matchings of two differently sized arrays -

so, have 2 different lists, say:

list1 = [a,b,c,d] list2 = [e,f,g]

and goal find out minimum difference between these 2 lists. have defined function d(x,y) gives difference between 2 elements, x , y. match such: each element in list1 matches either 1 or 0 elements in list2. unmatched elements have "difference" given d(a).

i'm not sure best algorithm doing is, or how i'd go it. if it's relevant, i'm working in python.

i think want matching in bipartite graph: http://en.wikipedia.org/wiki/matching_(graph_theory)#maximum_matchings_in_bipartite_graphs should go matching algorithm. if can't lastly resort utilize integer programming. pulp suitable python bundle integer programming. integer programming bundle much slower perhaps easier code.

if take go integer programming, constraints variable aij represents connection between list1[i] , list2[j]. aij = 1 or 0. (connection either on or off). sum(aij on i) = 1. (one connection per element in list1). sum(aij on j) = 1 (one connection per element in list2). want maximize/minimize objective function sum(d(list1[i], list2[j])*aij). don't forget if length list1 != length list2, must add together variables allow variables connect cost d(x) , add together objective function.

python algorithm dynamic-programming

java - Servlet catch unique constraint exception -



java - Servlet catch unique constraint exception -

i'm trying insert info table named rmas.

the table format is

|rcode|rname|vcode|vanme

here, set primary key rcode.

when i'm inserting record existing rcode, displays ora-0000-1 unique constraint violated..

if i'm using next code, displays message in case of other errors.

catch(exception e) { //out.println("rcode exists"); }

so, want grab primary key exception , display "rcode exist". possible? if yes, how?

thanks in advance

exception parent of exception. if have catch(exception e) { } block written exceptions fall category. need find exception compiler returning. if compiler returns exception sqlintegrityconstraintviolationexception next block come

catch(sqlintegrityconstraintviolationexception e) { // error message integrity constraint violation } catch(nullpointerexception e) { // null pointer exception occured. } catch(exception e) { // other error messages }

in way can have number of exception blocks. create sure more specific exception types first written , parent exceptions

java oracle exception servlets unique-constraint

Sphinx search by attribute -



Sphinx search by attribute -

could search sphinx attributes without query word

config:

sql_query = select p.id price_id, p.info, p.sort_id, p.made_id, p.category_id, 'prices' table_id cost p sql_query_info = select * cost id = $id sql_attr_uint = sort_id

...

min_word_len = 0 min_infix_len = 0 min_prefix_len = 0 enable_star = 1 docinfo = extern

code:

$search->setfilter('sort_id',[1,2]); $search->query("*","prices");

get 0 results

$search->query("","prices");

if returns no results, you've got other logic error.

tangential, why 'enable_star' infix/prefix set 0? have no effect.

sphinx

Codeigniter's index.php appears after htaccess modification -



Codeigniter's index.php appears after htaccess modification -

so here's thing, i've done tutorial thing on ci, have done modification in .htaccess remove index.php in url, in these case, when viewing records index.php doesn't appear, when seek create new record, index.php appeared, i'm confused why appeared, i've done .htaccess so,

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l]

here screenies,

viewing record:

creating new record:

after creation:

im confused why index.php appeared, i've did changes on .htaccess. missing something? please share inputs

edit followed inquire me on user guide.

create news item <?php echo validation_errors(); ?> <?php echo form_open('sample_controller/sample_create') ?> <label for="title">title</label> <input type="input" name="title" /><br /> <label for="text">text</label> <textarea name="text"></textarea><br/> <input type="submit" name="submit" value="create news item" /> </form>

change sample_controller/sample_create /sample_controller/sample_create

update:

or @cballou reply updating config avoid problem in first place.

(in config/config.php set $config['index_page'] = '')

php codeigniter

javascript - App js code (appjs.serveFilesFrom) to serve static files from a directory not working? -



javascript - App js code (appjs.serveFilesFrom) to serve static files from a directory not working? -

i'm using appjs (with nodejs + chromium) in desktop app. need include js files , phone call functions defined in files in app.js file (mainly in menu created using app.createmenu(..) ). tried include files using below code given in http://appjs.org/, http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/45736, it's not working:

var appjs = require('appjs'); // serve static files directory appjs.servefilesfrom(__dirname + '/content');

is there else need added create code working? please help me.

thanks in advance.

.servefilesfrom() nil more serve static assets in content directory. static, means css, html, , images client-side javascript.

you still have handle requests , dependency management on own. simple plenty grasp, though.

a way go start off developing app using 1 of existing starter bundle distributables, available on appjs homepage (make sure take right 1 operating system), have boilerplate code , configuration written you.

javascript appjs

windows - Variable not declared error in a Maze Game -



windows - Variable not declared error in a Maze Game -

the maze game have developed via tutorial found research doing well. step step have been debugging application windows using vb in visual studio 2012. told tutorial utilize next code:

private sub movetostart() startsoundplayer.play() dim startingpoint = panel1.location startingpoint.offset(10, 10) cursor.position = pointtoscreen(startingpoint) end sub

on line startsound.play() visual basic gives me error message saying: error correction options. click on , tells me:

'startsoundplayer' not declared. may inaccessible due security level.

what do prepare this?

declare:

private startsoundplayer = new system.media.soundplayer("c:\windows\media\chord.wav")

as tutorial says. in same class movetostart method. if still fails, declare startsoundplayer public instead of private.

windows vb.net soundplayer

c# 4.0 - Enumerating PowerPoint slides in order -



c# 4.0 - Enumerating PowerPoint slides in order -

i'm trying analyze existing powerpoint 2010 .pptx file using openxml sdk 2.0.

what i'm trying accomplish

enumerate slides in order (as appear in pptx) extracting textual bits each slide

i've started , gotten far - can enumerate slideparts presentationpart - cannot seem find way create ordered enumeration - slides beingness returned in pretty much arbitrary order...

any trick these slides in order defined in pptx file?

using (presentationdocument doc = presentationdocument.open(filename, false)) { // presentation part of document. presentationpart presentationpart = doc.presentationpart; foreach (var slide in presentationpart.slideparts) { ... } }

i hoping find slideid or sequence number or - item or property utilize in linq look like

.orderby(s => s.slideid)

on slideparts collection.

it's bit more involved had hoped - , docs bit sketchy @ times....

basically, had enumerate slideidlist on presentationpart , xml-foo slideid actual slide in openxml presentation.

something along lines of:

using (presentationdocument doc = presentationdocument.open(filename, false)) { // presentation part of document. presentationpart presentationpart = doc.presentationpart; // slideidlist var items = presentationpart.presentation.slideidlist; // enumerate on list foreach (slideid item in items) { // "part" "relationshipid" var part = presentationpart.getpartbyid(item.relationshipid); // part "slidepart" , there, can @ actual "slide" var slide = (part slidepart).slide; // more stuff slides here! } }

c#-4.0 openxml-sdk powerpoint-2010

jquery - Loading image not showing while loading html -



jquery - Loading image not showing while loading html -

i trying show loading image before html content loads, it's not appearing before html loads reason:

you can see in action here: http://www.machinas.com/wip/esprit/games/2013_spring_game/html/

click play >>> start game... loads in html.

html

<div id="loading-image"></div>

css

#loading-image{ background:url(../img/ajax-loader.gif) no-repeat 0 0; position:absolute; top:50%; left:50%; width:16px; height:16px; margin-left:-8px; display:none; }

jquery:

$('body').on('click', '.mch-ajax', function(e){ e.preventdefault(); $('#mch-overlay').fadeout(300); $( ".content" ).load("game.html", function() { $("#loading-image").show(); var mybackgroundimage = new image(); mybackgroundimage.src = "http://www.machinas.com/wip/esprit/games/2013_spring_game/html/img/bg-map.png"; mybackgroundimage.onload = function () { $("#loading-image").hide(); $( ".map" ).fadein(300); $( ".note" ).delay(400).fadein(700); $( ".route" ).delay(800).fadein(700); $( ".start-btn" ).delay(1200).fadein(700); }; }); });

the sec argument post .load() callback, executed after content has loaded. need move loading image logic before phone call .load().

$('body').on('click', '.mch-ajax', function(e){ e.preventdefault(); $('#mch-overlay').fadeout(300); $("#loading-image").show(); $( ".content" ).load("game.html", function() { var mybackgroundimage = new image(); mybackgroundimage.src = "http://www.machinas.com/wip/esprit/games/2013_spring_game/html/img/bg-map.png"; mybackgroundimage.onload = function () { $("#loading-image").hide(); $( ".map" ).fadein(300); $( ".note" ).delay(400).fadein(700); $( ".route" ).delay(800).fadein(700); $( ".start-btn" ).delay(1200).fadein(700); }; }); });

jquery ajax loader

android - Dynamic image with variable as a name -



android - Dynamic image with variable as a name -

i trying display image when have variable array (arr[r1]) matches name of picture. tried using didnt work:

imageview imageview = (imageview)findviewbyid(r.id.imageview); imageview.setimagedrawable(getresources().getdrawable(getresources().getidentifier("drawable/"+arr[r1], "drawable", getpackagename())));

any thought doing wrong?

string filepath = getactivity().getfilestreampath("myimage.png").getabsolutepath(); img.setimagedrawable(drawable.createfrompath(filepath));

android imageview

ruby on rails - How can you (and should you) access flash, session, and controller instance variables from a view? -



ruby on rails - How can you (and should you) access flash, session, and controller instance variables from a view? -

i should start of saying started helpful messages 1 when set devise (as of v. 2.2.3):

ensure have flash messages in app/views/layouts/application.html.erb example: <p class="notice"><%= notice %></p> <p class="alert"><%= alert %></p>

there @ to the lowest degree 3 ways can info view controller. can set things in session, set in flash, or set instance variable in controller. see examples both flash , session accessed bare variable in view, opens possibility of collision. example, have controller this:

class perversecontroller < applicationcontroller def index @msg = 'message 1' session[:msg] = 'message 2' # note - real concern comes in, previous page # have done anything! though here utilize flash.now illustrate point. flash.now[:msg] = 'message 3' end

then, if had next in view:

<%= msg %>

it seem of 3 values might referenced. in fact, code above in view error me (on rails 3.2). need utilize '@' or 'flash' or 'session' explicitly.

i can't find clear documentation on - books , tutorials reference flash , session afterthought, imagine might alter in future versions. but, i'd love see pointer references, , suggestion of should avoid breakage in future while keeping code clear / concise possible.

and now, want create sure integrate devise.

ruby-on-rails ruby-on-rails-3

javascript - Unusual error with string in canvas in Firefox -



javascript - Unusual error with string in canvas in Firefox -

i tried create falling snow in canvas. code works ok in chrome in ff18 nil displayed.

http://dharman.eu/flakes/

when checked in console firebug throws error: an invalid or illegal string specified var s = flakes[flake].chara; ctx.filltext(s,flakes[flake].x, flakes[flake].y);

any ideas wrong code?

also width of canvas element seems big though specified 100%. why?

var screenh = window.innerheight; var screenw = window.innerwidth; canvas.width = screenw; canvas.height = screenh;

move init(); bottom of code , work:

//... $('#canvas').dblclick(function () { runprefixmethod(canvas, "requestfullscreen"); }); //width/height 100% var screenh = window.innerheight; var screenw = window.innerwidth; canvas.width = screenw; canvas.height = screenh; init(); //<--here

because screenh not defined. (strange...)

demo: http://jsfiddle.net/derekl/jnf47/

bonus: debugging

first, know 1 of variables in ctx.filltext not defined, have find out 1 it:

console.log(s,flakes[flake].x, flakes[flake].y); //[some number], [some number], undefined)

so problem in flakes[flake].y. seems flakes[flake].y referring screenh, means screenh problem. variables have defined before phone call init(), moved bottom , works.

javascript firefox canvas

Maven install fired during Eclipse build -



Maven install fired during Eclipse build -

lately, i've noticed whenever run build in eclipse maven-install-plugin fired (copying jars in machine local artifacts repository).

i tried exclude eclipse build org.eclipse.m2e:lifecycle-mapping plugin nil changed.

is standard behavior (that never realized) or fault?

stefano

this isn't standard behaviour. see how interpret lifecycle mapping dialog box in m2e? more details on how interpret mapping.

eclipse maven maven-install-plugin

Vimeo embedding in gwt -



Vimeo embedding in gwt -

i tried embed video using gwt realized gwt doesn't allow iframe. vimeo suggests utilize kind of code embedding. there alternative way this?

supplement

after getting answers realized wanted add together <frame> code html element , not work frame works said below.

the gwt frame class wraps iframe , can find illustration utilize in javadoc link below.

gwt in 2.5 version , not 1.5. link latest frame documentation - http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/frame.html

public class frameexample implements entrypoint { public void onmoduleload() { // create new frame, , point @ google. frame frame = new frame("http://player.vimeo.com/video/"+video_id); // add together root panel. rootpanel.get().add(frame); } }

if need go 3rd party library can bst player. create utilize of vimeo gwt wrappers bst player - http://code.google.com/p/bst-player/source/browse/#svn%2ftrunk%2fvimeo-player-provider

i rather suggest stick gwt frame api , not utilize 3rd party unless need other feature provided bst player.

gwt vimeo

java - ReGex patten to match conditional variable names? -



java - ReGex patten to match <c:if > conditional variable names? -

i need conditional variable name cases in particular jsp reading jsp line line , searching particular pattern line checking 2 type of cond finds match

<c:if condition="event ='confirmation'"> <c:if condition="event1 = 'confirmation' or event2 = 'action'or event3 = 'check'" .....>

desired result name of cond variable - event,event1,event2,event3 have written parser satisfying first case not able find variable names sec case.need pattern satisfy both of them.

string stringsearch = "<c:if"; while ((line = bf.readline()) != null) { // increment count , find index of word linecount++; int indexfound = line.indexof(stringsearch); if (indexfound > -1) { pattern pattern = pattern .compile(test=\"([\\!\\(]*)(.*?)([\\=\\)\\s\\.\\>\\[\\(]+?)); matcher matcher = pattern.matcher(line); if (matcher.find()) { str = matcher.group(1); hset.add(str); counter++; } }

if understood requirement well, may work :

("|\s+)!?(\w+?)\s*=\s*'.*?'

$2 give each status variable name.

what is:

("|\s+) " or one or more spaces

!? optional !

(\w+?) 1 or more word character (letter, digit or underscore) (([a-za-z]\w*) more correct)

\s*=\s* = preceded , followed 0 or more spaces

'.*?' 0 or more characters within ' , '

second capture grouping (\w+?) retrieving variable name

add required escaping \

edit: additional conditions specified, next may suffice:

("|or\s+|and\s+)!?(\w+?)(\[\d+\]|\..*?)?\s*(!?=|>=?|<=?)\s*.*?

("|or\s+|and\s+) " or or followed 1 or more spaces or and followed 1 or more spaces. (here, assumed each look part or variable name preceded " or or followed 1 or more spaces or and followed 1 or more spaces)

!?(\w+?) optional ! followed 1 or more word character

(\[\d+\]|\..*?)? optional part constituting a number enclosed in square brackets or a dot followed 0 or more characters

(!?=|>=?|<=?) of next relational operators : =,!=,>,<,>=,<=

$2 give variable name.

here sec capture grouping (\w+?) retrieving variable name , 3rd capture grouping retrieves suffix if nowadays (eg:[2] in event[2]).

for input containing status event.indexof(2)=something, $2 gives event only. if want event.indexof(2) utilize $2$3.

java regex jsp

Can UNIX shared libraries be merged into a single library? -



Can UNIX shared libraries be merged into a single library? -

i experimenting own bsd or linux distribution. want organize scheme files in way makes sense end user. want them have access scheme without file clutter *nixes leave around.

is there way merge several dynamic libraries single file without losing dynamic linking? have access of source files.

it might system-dependent, @ to the lowest degree elf (the executable format used linux), not possible. elf, shared libraries bit executables: final product of linking process , not designed decomposed or relinked different arrangement.

if have source of components go bunch of shared libraries, suppose link them 1 giant shared library, utilize object files (*.o) or archive libraries (*.a) input produce such library.

as alluded in comments, there unlikely reason want this.

unix shared-libraries

c# - AutoMapper: Mapping child member from complex type to string[] -



c# - AutoMapper: Mapping child member from complex type to string[] -

i have destination type string[] property.

animal string[] barks;

my source object is:

animaldto list<barktypes> barks;

how map barktypes.nameofbark string[] barks?

something this:?

mapper.createmap<animaldto, animal>() .formember(dest => dest.barks, y => y.mapfrom(x=>x.??????))

you want resolveusing:

mapper.createmap<animaldto, animal>() .formember(dest => dest.barks, y => y.resolveusing(x=>x.barks .select(b=>b.nameofbark) .toarray()) )

c# automapper automapper-2

oracle - Getting an invalid number error at random -



oracle - Getting an invalid number error at random -

i using next code oracle ado.net provider (devart's dotconnect universal). funny thing works , times throws devart.data.oracle.oracleexception: ora-01722: invalid number

string sql = "select distinct b.price_tier_key,b.label, a.insert_date priceeffectivedate,b.program_key price_program_key ghx_member_tier inner bring together vha_int_price_tier b on a.src_id_value = b.price_tier_key rownum <=100"; dbproviderfactory dpf = dbproviderfactories.getfactory(system.configuration.configurationmanager.connectionstrings["con_ora_devart"].providername); dbconnection conn = dpf.createconnection(); conn.connectionstring = system.configuration.configurationmanager.connectionstrings["con_ora_devart"].connectionstring; dbcommand dbcmd = dpf.createcommand(); dbcmd.connection = conn; //dbcmd.connection = uniconnection1; dbcmd.commandtext = sql; dbcmd.commandtype = commandtype.text; dbcmd.commandtimeout = 0; datatable table = new datatable(); seek { system.data.common.dbdataadapter da = dpf.createdataadapter(); da.selectcommand = dbcmd; // fill datatable. da.fill(table); } grab (exception ex) { throw; } { if (conn != null && conn.state != connectionstate.closed) { conn.close(); conn.dispose(); } if (dbcmd != null) { dbcmd.dispose(); } }

try changing on a.src_id_value = b.price_tier_key on a.src_id_value = to_char(b.price_tier_key).

from the manual: "when comparing character value numeric value, oracle converts character info numeric value.". implicit conversion not safe, need forcefulness oracle convert number string instead.

oracle ado.net devart

windows 7 - installing ssh using cygwin for hadoop -



windows 7 - installing ssh using cygwin for hadoop -

before explain issue having, need allow know totally new cygwin , stuff this. objective of installing ssh using cygwin setup hadoop on windows 7 x64 machine. trying execute steps given on https://gist.github.com/tariqmislam/2159173. not able provide blank password. below log same. help appreciated.

$ chmod +r /etc/passwd

$ chmod u+w /etc/passwd

$ chmod +r /etc/group

$ chmod u+w /etc/group

$ chmod 755 /var

$ touch /var/log/sshd.log

$ chmod 664 /var/log/sshd.log

$ ssh-host-config

* query: overwrite existing /etc/ssh_config file? (yes/no) yes * info: creating default /etc/ssh_config file * query: overwrite existing /etc/sshd_config file? (yes/no) yes * info: creating default /etc/sshd_config file * info: privilege separation set yes default since openssh 3.3. info: however, requires non-privileged business relationship called 'sshd'. info: more info on privilege separation read /usr/share/doc/openssh/readme.privsep. query: should privilege separation used? (yes/no) no ** info: updating /etc/sshd_config file

* query: want install sshd service? query: (say "no" if installed service) (yes/no) yes query: come in value of cygwin daemon: [] info: on windows server 2003, windows vista, , above, info: scheme business relationship cannot setuid other users -- capability info: sshd requires. need have or create privileged ** info: account. script help so.

* info: appear running windows xp 64bit, windows 2003 server, info: or later. on these systems, it's not possible utilize localsystem info: business relationship services can alter user id without info: explicit password (such passwordless logins [e.g. public key ** info: authentication] via sshd).

* info: if want enable functionality, it's required create info: new business relationship special privileges (unless similar business relationship info: exists). business relationship used run these special * info: servers.

* info: note creating new user requires current business relationship * info: have administrator privileges itself.

* info: no privileged business relationship found.

* info: script plans utilize 'cyg_server'. * info: 'cyg_server' used registered services. * query: want utilize different name? (yes/no) no * query: create new privileged user business relationship 'cyg_server'? (yes/no) yes * info: please come in password new user cyg_server. please sure info: password matches password rules given on system. info: entering no password exit configuration. query: please come in password: query: please come in password: query: please come in password: ** query: please come in password:

i can recommend running hadoop in linux virtual machine or native linux. although running hadoop 0.20.0 on windows xp+cygwin , windows7+cygwin, 1 time tried setting newer version of hadoop on windows7, failed miserably due errors in hadoop. iirc hadoop security patch won't run on windows7 because of problems file permissons, etc. advice: run hadoop on linux if can, you'll avoid serious amount of problems.

windows-7 hadoop ssh cygwin

coding style - Common practice to name project directory which hold support scripts, configs, docs, etc for developers -



coding style - Common practice to name project directory which hold support scripts, configs, docs, etc for developers -

i work little set of projects lack of knowledge naming convention directory in software project file hierarchy desired hold project development.

i well-known projects (like firefox, gcc, binutils, linux, emacs, vim, etc) , collect mutual directories (comments written myself don't pretend true...):

examples or samples show practical usage of project in mini-scripts or mini-programs, or mini-configs. scripts, support - wrappers or re-create of missing scripts/utilities provide cross-environment build. tools - utilities profile or debug project. contrib - user supplied scripts, configs, etc... misc, etc - uncategorised files (if don't know right place it). config, extra - don't know...

while src/, test/, build/, dist/, lib/ , other directories naming convention dictated prog-langs/platforms/frameworks etc, directories seems mutual type of projects.

so guide (official or unofficial) naming convention directories hold back upwards files project.

most essential distinct regular project files these file isn't used in project release build, or used in rare cases.

ps. can argue not question. have real task commit several scripts (sql script dump menu db, script dump url mapping web-controllers, etc) , directory name shoud hold these files...

pps. create things right , perform work on field (for task). tips:

http://gavenkoa.users.sourceforge.net/tips-html/devel-proj-files.html

coding-style naming-conventions

javascript - Find CSS classes that are used in JS -



javascript - Find CSS classes that are used in JS -

i embarking on daunting task of cleaning existing site. i'm stripping out years worth of css added multiple developers in favour of adding new framework , own set of clear css styles.

what want reserve id js , class css. know of js need @ classes that's ok. there many times able alter class name id without issue.

the existing site has 11755 instances of class=" across 457 files can't strip them out because know js dependant on of classes.

can provide help how locate dependant classes in js? have no thought how other manually , seems crazy.

search of files next regex (you have figure out how on scheme you're using)

class=("[^"]*")

with class names within quotation marks.

you intersect list strings (in quote marks) used in javascript. intersection classnames javascript dependent on.

javascript html css code-cleanup

haskell - Unit tests of Parsec? -



haskell - Unit tests of Parsec? -

where can find tests implementation of parsec?

there aren't on parsec's darcs repository.

note: i'm not asking how write tests parsec parser, i'm looking tests of parsec library itself.

there test/benchmark suite parsec called pbench. seems lost sands of time: http://web.archive.org/web/20030818092724/http://www.cs.uu.nl/people/daan/pbench.html

there's no current unit test/regression suite parsec know of. see give-and-take here: http://permalink.gmane.org/gmane.comp.lang.haskell.libraries/14479

a test suite could built without much work leaning on 1 written attoparsec: https://github.com/bos/attoparsec/tree/master/tests

haskell parsec

linux screen - kill only if it exists (jenkins job) -



linux screen - kill only if it exists (jenkins job) -

i'm configuring complex jenkins jobs using linux screens. create new screen run:

screen -md -s jenkins_job

then goes other work , destroy existing screen run:

screen -s jenkins_job -x quit

but may happen in jenkins script fail somewhere inbetween , abort immediately. screen termination command not executed , screens kept alive. in origin of job i'd create sure screens destroyed. if utilize screen -s jenkins_job -x quit on non-existent job shell homecoming error code , jenkins script fail well.

is there way conditionally destroy screen (i.e. destroy screen if exists otherwise nothing)?

you'll want set termination code trap invocation:

trap 'screen -s jenkins_job -x quit' quit term int exit

jenkins screen kill

rake - Rails: how to run all migrations up to a certain timestamp -



rake - Rails: how to run all migrations up to a certain timestamp -

i'm trying revert database previous state. reason db:rollback isn't working (i might have flubbed 1 of down methods), instead of rolling back, wondering if there dropping database , re-running migrations. essentially, i'd run db:migrate, i'd stop @ particular timestamp.

is there rake command run migrations , including given timestamp?

rake db:migrate version=timestamp

ruby-on-rails rake

jquery tabs effects -



jquery tabs effects -

i started learning jquery, i'm beginner. need do

my goal create tabs navigation menu. made code here:

$(".tab_content").hide(); $(".tab_content:first").show(); $("ul.tabs li").click(function() { $(".tab_content").hide(); var h_active = $(this).attr("rel"); $("#"+h_active).fadein(500); $("ul.tabs li").removeclass("active"); $(this).addclass("active"); $(".v_tabs").removeclass("v_active"); $(".v_tabs[rel^='"+h_active+"']").addclass("v_active"); });

but reading on internet, realized not best.

here illustration view entire code: http://jsfiddle.net/zpavan/ese7k/1/

how can add together fadeout transition?

thank much!

$("#selectorforelement").fadeout(1000); //fadeout 1 sec

jquery tabs navigation

java - Trying to make a login with Spring -



java - Trying to make a login with Spring -

so making login our project. problem have null in our parameters , not actual value entered. know why?

controller code:

@requestmapping(value = "/user/login",method = requestmethod.post) public string login(@modelattribute("user") user user) { //random code here homecoming "redirect:/general/index.html"; }

view:

<form:form id="header_login_form" method="post" modelattribute="user" action="/projectteamf-1.0/user/login.html"> <input path="username"class="input" placeholder="email" /> <input path="password" class="input" placeholder="password" /> <label class="checkbox"> <input type="checkbox"> aangemeld blijven</label> <button type="submit" class="btn">aanmelden</button> </form:form>

you need utilize tag <form:input> instead of <input> in order spring bind user modelattribute. , replace modelattribute commandname:

<form:form id="header_login_form" method="post" commandname="user" action="/projectteamf-1.0/user/login.html"> <form:input path="username"class="input" placeholder="email" /> <form:input path="password" class="input" placeholder="password" /> <label class="checkbox"> <input type="checkbox"> aangemeld blijven</label> <button type="submit" class="btn">aanmelden</button> </form:form>

java html spring authentication login

r - Subset dataframe by most number of daily records -



r - Subset dataframe by most number of daily records -

i working big dataset, illustration can shown below. bulk of individual files have process there should more 1 day's worth of data.

date <- c("05/12/2012 05:00:00", "05/12/2012 06:00:00", "05/12/2012 07:00:00", "05/12/2012 08:00:00", "06/12/2012 07:00:00", "06/12/2012 08:00:00", "07/12/2012 05:00:00", "07/12/2012 06:00:00", "07/12/2012 07:00:00", "07/12/2012 08:00:00") date <- strptime(date, "%d/%m/%y %h:%m") c <- c("0","1","5","4","6","8","0","3","10","6") c <- as.numeric(c) df1 <- data.frame(date,c,stringsasfactors = false)

i wish left info on single day. day chosen having number of info points day. if reason 2 days tied (with maximum number of info points), wish select day highest individual value recorded.

in illustration dataframe given above, left 7th dec. has 4 info points (as has 5th dec), has highest value recorded out of these 2 days (i.e. 10).

here's solution tapply.

# count rows per day , find maximum c value res <- with(df1, tapply(c, as.date(date), function(x) c(length(x), max(x)))) # order these 2 values in decreasing order , find associated day # (at top position): maxdate <- names(res)[order(sapply(res, "[", 1), sapply(res, "[", 2), decreasing = true)[1]] # subset info frame: subset(df1, as.character(as.date(date)) %in% maxdate) date c 7 2012-12-07 05:00:00 0 8 2012-12-07 06:00:00 3 9 2012-12-07 07:00:00 10 10 2012-12-07 08:00:00 6

r data.frame subset

node.js - Render partial view with jade on select change -



node.js - Render partial view with jade on select change -

i need following,

i have <select> (a list of team names), when user selects team, relevant info re: team , display it.

how do in jade?

i'm trying following, (but i'm wrong obviously, don't see lot of documentation out there).

briefly, i'm doing include test.jade on main page, , res.render('test', {team: team_obj});

jade:

h1 #{team}.name h2 #{team}.homeground h3 #{team}.manager h4 #{team}.aka

nodejs:

collection.findone(query, function(err, team_obj){ res.render('test', {team: team_obj}); });

i'm getting info correctly in team_obj.

get next error when run app,

team not defined

now happening because test.jade getting rendered before feed team_obj.

questions:

1) doing right? include right way of partially rendering jade views? if yes, how create sure renders when user has selected option?

2) there partial views concept in jade i'm unaware of?

1) should utilize #{team.name}

2) can't alter team object 1 time selector changed. template rendered 1 time database result. - such functionality should handled client side javascript , ajax calls. partials in templates way share mutual pieces of templates, , done in jade via include.

i don't know you're rendering , including , when.. id utilize template variable #{team.name} have create sure template rendered team object.

node.js express jade

visual c++ - C++ Access Control -



visual c++ - C++ Access Control -

this question has reply here:

what access specifiers? should inherit private, protected or public? 2 answers

i want define within class variable can read other function can modified fellow member function. example, c# has property purpose. traditionally, we've defined function returns private fellow member variable. think not sophisticated.

is there other way in c++?

class { private: string m_string; public: const string& getstring() const { homecoming m_string; } __declspec(property(get=getstring)) string string; }; a; cout << a.string << endl;

still not in c#, though.

and of course of study there's c++/cli properties (for managed classes), closer c# properties:

ref class { private: string^ m_thestring; public: property string^ thestring { string^ get() { homecoming m_thestring; } } };

c++ visual-c++

CSS/HTML Intellisense VS2012 - not showing all possibilities -



CSS/HTML Intellisense VS2012 - not showing all possibilities -

i wondering, there way improve current vs2012 intellisense? i'm working on html/css it's not showing when want background-color works fine, when start type rgb doesn't show opportunity.. there add-in or can improve it? - it's nice have when exploring html/css instead of looking @ w3schools , on..

for starters, people shout @ using w3schools. has improved recently, still lists lot of erroneous , insecure examples. if want html or css reference it's much improve rely on w3.org (html, html5, css(+3)).

i'm not sure you're using visual studio 2012 for, when work on asp.net projects utilize sublime text modifying html , css. i've found vs quite clunky when comes predicting things.

either way, it's not best rely on "intellisense" code help - should utilize reference only, way you'll larn utilize language independently.

html css visual-studio-2012

using sed to remove characters from mysql -



using sed to remove characters from mysql -

i utilize next script dump mysql database names , remove unwanted chars(leading trailing | , spaces). works in removing of them though sed intended remove leading spaces.... why?

mysql -uuser -pmypass--skip-column-names -e "select schema_name information_schema.schemata schema_name not in ('linking', 'information_schema');" | sed 's/^ *//'

try :

sed 's/^ *//;s/ *$//'

mysql sed

oracle - SQL - How to use a column in a select statement without specifying it in the group by clause -



oracle - SQL - How to use a column in a select statement without specifying it in the group by clause -

i trying run query fails:

select p.product_id, p.product_name, cast(collect(coalesce(product_type, decode(product_description,null,'descr' || '-' product_description) my_type) product_type, decode(product_source_location, null, 'no_source', product_source_location) products grouping p.product_id, p.product_name

it fails because product_source_location not part of grouping clause.

i dont want include product_source_location in group by clause result becomes incorrect. there way can utilize product_source_location in decode function shown above without having include in grouping clause?

interestingly using product_type in coalesce function , not forcefulness me include product_type in grouping clause.

try doing this:

coalesce(max(product_source_location), 'no_source')

the complicated collect statement correct, because collect aggregation function. final decode using column not mentioned in group by clause. fixes problem wrapping max() around it.

and, can using decode():

decode(max(product_source_location), null, 'no_source', max(product_source_location))

but encourage larn more standard coalesce() function , case function.

sql oracle plsql oracle10g oracle11g

iphone - Error: This class is not key value coding-compliant for the key keyPath -



iphone - Error: This class is not key value coding-compliant for the key keyPath -

uistoryboard* sb = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil]; uiviewcontroller* vc = [sb instantiateviewcontrollerwithidentifier:@"settingsviewcontroller"]; [[self navigationcontroller] pushviewcontroller:vc animated:yes];

trying force viewcontroller navigationcontroller in storyboard , maintain getting error.

* terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<settingsviewcontroller 0x1f98f100> setvalue:forundefinedkey:]: class not key value coding-compliant key keypath.' * first throw phone call stack: (0x31f4a3e7 0x39c3b963 0x31f4a0d5 0x327b87d9 0x327b4543 0x31ed08a5 0x33ef5e69 0x340e5b09 0x71aa3 0x33e1b31d 0x33e9dda9 0x32859657 0x31f1f857 0x31f1f503 0x31f1e177 0x31e9123d 0x31e910c9 0x35a6f33b 0x33dad2b9 0x6567d 0x3a068b20) libc++abi.dylib: terminate called throwing exception

i got error becouse had set in "user defined runtime attributes" field in "identity inspector" tab. mystake left default keypath value key path column , caused problem.

iphone objective-c xcode

python - Proper usage of Django Mixins -



python - Proper usage of Django Mixins -

so started porting old code class based views, , still new @ that. question related django mixins, have mixin going utilize in various classes validate information. problem don't know how access info returns without getting 500 internal error.

class checktokenmixin(object): def request_token(self,request): params = {'username':settings.oauth_username,'password':hashlib.sha256(settings.oauth_password).hexdigest()} req = request(settings.remote_server+'oauth', urllib.urlencode(params)) homecoming json.loads(urlopen(req).read()) def get_valid_token(self): if datetime.datetime.now() > request.session['access_token'].creation_date + datetime.timedelta(days=1): temp = self.request_token(request) tokenobj = accesstoken.objects.all()[:1].get() tokenobj.access_token = temp['token'] tokenobj.creation_date = datetime.datetime.now() tokenobj.save() request.session['access_token'] = tokenobj homecoming request.session['access_token'] def get_context_data(self, **kwargs): ctx = super(checktokenmixin, self).get_context_data(**kwargs) ctx['access_token'] = self.get_valid_token() homecoming ctx class rateappview(loginrequiredmixin, jsonresponsemixin, ajaxresponsemixin, checktokenmixin, view): @method_decorator(csrf_protect) def dispatch(self, *args, **kwargs): homecoming super(rateappview, self).dispatch(*args, **kwargs) def post_ajax(self, request, username): u = get_object_or_404(user, pk=current_user_id(request)) city_obj = city.objects.get(id=request.post.get('city_id', none)) x = self.get_valid_token print "teste: " , x.access_token print "teste2: " , self.get_context_data.['access_token'].access_token

i want

self.get_valid_token

or

self.get_context_data.['access_token'].access_token

to access info mixin, how do proper way?

self.get_valid_token() correct. however, have several errors in method, no uncertainty causing problem: in particular, refer request without defining @ point. expect mean self.request instead.

python django mixins

Java applet with external jar cannot display whole apple application -



Java applet with external jar cannot display whole apple application -

i utilize antlr create little java applet. can run eclipse without problem, 1 time set on web-page. applet cannot display stuff. such button never displayed until utilize mouse on it.

<applet code="gui.fgg_main" width="790" height="545" archive="fgg.jar,antlrworks-1.4.3.jar,output.jar"> </applet>

can people help, , tell me happened

maybe need utilize deployjava.js. can find in this oracle tutorial. tutorial describes in detail every step neccessary.

java applet antlr japplet

Mysql SET and querying subset with PHP -



Mysql SET and querying subset with PHP -

i have basic mysql database , using php web service android application. there 21 categories in app , storing them in column mysql set in database. article can have multiple categories.

i allow users take 1 or more categories. right sending selected categories hardcoed "string" value , concatenating of them follows.

select * ........... cats '%$cat1%' or cats '%$cat2%'

as can guess low process.

what right way this?

make categories table, article table, , union table foreign keys, locate article in multiple categories.

php mysql set

c# - Unable to edit a word template 2007 using Microsoft.Office.Interop when running through ASP.NET -



c# - Unable to edit a word template 2007 using Microsoft.Office.Interop when running through ASP.NET -

i unable edit word template 2007 when trying run web application through iis using microsoft.office.interop.word .but in development environment running fine. below code sample,

using word = microsoft.office; object omissing = system.reflection.missing.value; object oendofdoc = "\\endofdoc"; /* \endofdoc predefined bookmark */ object otrue = true; object ofalse = false; //start word , create new document. word.interop.word.application oword = new word.interop.word.application(); word.interop.word.document odoc; oword.visible = true; //using template format of existing word doc object otemplate = "c:\\mytemplate.dotx"; odoc = oword.documents.add(ref otemplate, ref omissing, ref omissing, ref omissing); //get bookmark location template document word.interop.word.table wtbl = odoc.bookmarks.get_item("test").range.tables[1];

while runing through iis odoc coming null , checked oword object coming system._comobject.but incase development environment oword object coming microsoft.office.interop.word , working perfectly.

c# asp.net ms-word

android - numberpicker widget and holoeverywhere missing theme -



android - numberpicker widget and holoeverywhere missing theme -

i'm trying simons number picker work holoeverywhere. holoeverwhere requires me set android:theme="@style/holo.theme" whereas number picker requires android:theme="@style/sampletheme.light". i'm not familiar styles , themes yet, options? right number picker displays incorrectly:

ps. need backwards comp. till 2.2 , prefer keeping holo theme

there built in numberpicker in holoeverywhere.

you can test demo application.

org.holoeverywhere.widget.numberpicker

here link source code:

https://github.com/christopheversieux/holoeverywhere/blob/master/library/src/org/holoeverywhere/widget/numberpicker.java

moved to: https://github.com/prototik/holoeverywhere/blob/master/library/src/org/holoeverywhere/widget/numberpicker.java

maybe there way utilize simons widget on dark theme, should possible.

android themes android-holo-everywhere

javascript - Why Can't I Use JS Function Called 'evaluate' in HTML? -



javascript - Why Can't I Use JS Function Called 'evaluate' in HTML? -

i'm kind of curious why doesn't work

javascript:

function evaluate(){ console.log(42); }

html:

<a onclick="evaluate()">click me!</a>

is evaluate reserved keyword somewhere on html side?

document.evaluate needed parsing xmls, see the reference in mdn here.

javascript html

java - Casting Comparator to work for a subclass -



java - Casting Comparator to work for a subclass -

in practice, safe following?

public static <t> comparator<t> downcast(final comparator<? super t> orig) { @suppresswarnings("unchecked") comparator<t> casted = (comparator<t>) orig; homecoming casted; }

here's contrived illustration of usage:

public static <t> comparator<t> chaincomparators(final comparator<? super t> a, final comparator<? super t> b) { if (a == null) { homecoming downcast(b); } if (b == null) { homecoming downcast(a); } homecoming new comparator<t>() { @override public int compare(t o1, t o2) { int = a.compare(o1, o2); if (i == 0) { = b.compare(o1, o2); } homecoming i; } }; } public static comparator<integer> odd_first_comparator = new comparator<integer>() { @override public int compare(integer i1, integer i2) { boolean iseven1 = (i1.intvalue() % 2) == 0; boolean iseven2 = (i2.intvalue() % 2) == 0; homecoming boolean.compare(iseven1, iseven2); } }; public static comparator<number> abs_number_comparator = new comparator<number>() { @override public int compare(number n1, number n2) { double d1 = math.abs(n1.doublevalue()); double d2 = math.abs(n2.doublevalue()); homecoming double.compare(d1, d2); } }; public static void main(string[] args) { comparator<integer> comp = null; comp = chaincomparators(comp, odd_first_comparator); comp = chaincomparators(comp, abs_number_comparator); list<integer> list = new arraylist<integer>(); list.add(-42); list.add(-23); list.add(-15); list.add(-4); list.add(8); list.add(16); collections.sort(list, comp); system.out.println(list); // prints [-15, -23, -4, 8, 16, -42] }

i know create chaincomparators() homecoming comparator<? super t> instead of using downcast(), or alter of code not utilize or explicitly check null comparators (which removes need utilize downcast), neither of these changes seem worth effort big codebase. there reasonable situation either downcast() or chaincomparators() fail?

it should safe, because comparator consumer, means instances of t passed arguments, , never returned.

as far can see, code good.

java generics casting

javascript - Why is this grouping operator + function immediately invoked -



javascript - Why is this grouping operator + function immediately invoked -

i'am studying behaviour of immediatly invoked function expressions (iife) , while doing encounterd next situation.

(function () { document.write("bar"); }) (function () { document.write("foo"); }());

i thought first grouping operator function look within without calling it. sec grouping operator function look phone call of function.

what find unusual both invoked, why that?

(function () { document.write("bar"); }) var x = 1; (function () { document.write("foo"); }());

when break 2 inserting variable declaration in between, it's writes foo. expected.

because forgot semicolon after first function expression:

(function () { document.write("bar"); });

otherwise sec "grouping operator" interpreted function call. this:

(function a() { ... }) (function b() { ... }());

is same as:

function b() { ... } (function a() { ... })(b());

reordering makes bit easier see. remember white space characters have no meaning in javascript , ignored.

javascript iife

Choice between REST API or Java API -



Choice between REST API or Java API -

i have been reading neo4j lastly few days. got confused whether need utilize rest api or if can go java apis.

my need create millions of nodes have connection among them. want add together indexes on few of node attributes searching. started embedded mode of graphdb java api reached outofmemory indexing on few nodes thought improve if neo4j running service , connect through rest api memory management swapping in/out info underlying files. assumption right?

further, have plans scale solution billion of nodes believe wont possible single machine's neo4j installation. believe neo4j has capability of running in distributed mode. reason thought continuing rest api implementation best idea. though couldn't find out documentation how run neo4j in distributed environment.

can stuff batch insertion, etc. using rest apis well, java apis graph db running in embedded mode?

do know why getting outofmemory exception? sounds creating these nodes in same transaction, causes live in memory. seek committing little chunks @ time, neo4j can write disk. don't have manage memory of neo4j aside things cache.

distributed mode in master/slave architecture, you'll still have re-create of entire db on each system. neo4j efficient disk storage, node taking 9 bytes, relationship taking 33 bytes, properties variable.

there batch rest api, grouping many calls same http call, making rest calls still slower if embedded.

there disadvantages using rest api did not mentions, , that's stuff transactions. if going atomic operations, need create several nodes, relationships, alter properties, , if step fails not commit of it, cannot in rest api.

java api rest scalability neo4j

How to get any three rows of particular date in SQL Server -



How to get any three rows of particular date in SQL Server -

i stucking in 1 sql query.

my table format below:

acct# admitdate dos chargeamount 12366 2011-12-07 00:00:00.000 2011-12-15 00:00:00.000 25.00 12366 2011-12-07 00:00:00.000 2011-12-16 00:00:00.000 30.00 12366 2011-12-07 00:00:00.000 2011-12-17 00:00:00.000 55.00 12366 2011-12-07 00:00:00.000 2011-12-18 00:00:00.000 48.00 12366 2011-12-07 00:00:00.000 2011-12-19 00:00:00.000 25.00 12366 2012-01-08 00:00:00.000 2012-01-08 00:00:00.000 58.00 12366 2012-01-08 00:00:00.000 2012-01-09 00:00:00.000 46.00 12366 2012-01-08 00:00:00.000 2012-01-10 00:00:00.000 90.00 12366 2012-01-08 00:00:00.000 2012-01-11 00:00:00.000 52.00 12366 2012-01-08 00:00:00.000 2012-01-12 00:00:00.000 95.00 12366 2012-01-08 00:00:00.000 2012-01-13 00:00:00.000 53.20

i want top 3 dos 1 admit date , sum of chargeamount. other dos should neglact. i have no thought how this. want below desired output.

acct# admitdate chargeamount 12366 2011-12-07 00:00:00.000 128.00 12366 2012-01-08 00:00:00.000 200.00

only 2011-12-17 2011-12-19 admit date 2011-12-07 need sum , same other admit date. if have sql query please share me.

thanks in advance

try:

select top 3 acct, admitdate, sum(chargeamount) yourtable grouping acct, admitdate

edit

select acct, admitdate, sum(chargeamount) , rank() on (partition admitdate order admitdate desc) yourtable grouping acct, admitdate

sql-server-2008 sql-server-2005

c# - MSDeployTestConnection does not exist in project for VS 2012 -



c# - MSDeployTestConnection does not exist in project for VS 2012 -

i next error when seek publish site localhost. able before (just day back) , have compared version of project file, , there no change. can help me this? have looked @ similar question asked here , adding tag in project file did not help me.

edit:

added image, show what's behind dialogue:

also, when click on publish, without testing connection error:

c# wcf visual-studio-2012

python - How to increase MemCacheProtocol's MAX_KEY_LENGTH? -



python - How to increase MemCacheProtocol's MAX_KEY_LENGTH? -

i trying alter max_key_length tried next example:

from twisted.internet import reactor, protocol twisted.protocols.memcache import memcacheprotocol, default_port import string twisted.python import log import sys log.startlogging(sys.stdout) def cb(response): log.msg(response) d = protocol.clientcreator(reactor, memcacheprotocol ).connecttcp('localhost', default_port) def dosomething(proto): # here phone call memcache operations homecoming proto.set(string.ascii_letters*5, string.ascii_letters*5) memcacheprotocol.max_key_length = 1000 d.addcallback(dosomething) d.addboth(cb) d.addboth(lambda ignore: reactor.stop()) reactor.run()

i maintain getting failure:

[failure instance: traceback (failure no frames): <class 'twisted.protocols.memcache.clienterror'>: bad command line format!

i guessing not message sent memcache server , result returns failure need in order store keys length greater 250 in memcache?

you modifying late. seek this:

class mymemcacheprotocol(memcacheprotocol): max_key_length = 1000

now utilize class in clientcreator() phone call instead of original.

python twisted

java - Why use random numbers for serial version UID? -



java - Why use random numbers for serial version UID? -

this question has reply here:

why generate long serialversionuid instead of simple 1l? 9 answers

edit: random mean big computed number no semantic meaning developers

when implementing serializable interface best practice , of import specify serial version uid. in numerous places, see random numbers beingness used. e.g.

effective java (2nd edition) pg 312:

private static final long serialversionuid = 234098243823485285l;

from string class in java 6:

private static final long serialversionuid = -6849794470754667710l;

from arraylist class in java 6:

private static final long serialversionuid = 8683452581122892189l;

etc. eclipse offers alternative generate these random numbers (though primary default appears to generate serialversionuid of 1l)

why utilize random numbers? doesn't create more sense start @ 1l , increment 2l when changes sensible revision control? time can think of utilize seemingly random number if didn't specify serialversionuid begin , want (which ties in run-time autogenerated version provide backwards compatibility support).

those "random" numbers numbers would have been generated class automatically in "current" form per java object serialization specification... "current" "current @ time serialversionuid first declared".

that allow info had been serialized still deserialized - while moving forwards more explicit declaration of breaking changes in future.

java serialization

Haskell still can't deduce type equality -



Haskell still can't deduce type equality -

this question follow on question haskell can't deduce type equality. have tried implementing basic polynomial approximator using trainable type described in previous question next code:

module machinelearning.polynomial (polynomial, polynomialtrf ) import machinelearning.training import machinelearning.utils polynomialtrf :: floating n => [n] -> n -> n polynomialtrf coeff var = helper 0 coeff var 0 helper _ [] var acc = acc helper 0 (c:cs) var acc = helper 1 cs var c helper deg (c:cs) var acc = helper (deg+1) cs var (acc+(c*(var^deg))) polynomialcost :: floating n => n -> n -> [n] -> n polynomialcost var target coeff = sqcost (polynomialtrf coeff var) target polynomialsv :: (floating n) => trainable n n polynomialsv = trainable polynomialtrf polynomialcost

here sqcost sqcost b = (a-b) ^ 2. next error message compiler:

src/machinelearning/polynomial.hs:18:26: not deduce (n1 ~ n) context (floating n) bound type signature polynomialsv :: floating n => trainable n n @ src/machinelearning/polynomial.hs:18:1-53 or (floating n1) bound type expected context: floating n1 => [n1] -> n -> n @ src/machinelearning/polynomial.hs:18:16-53 `n1' stiff type variable bound type expected context: floating n1 => [n1] -> n -> n @ src/machinelearning/polynomial.hs:18:16 `n' stiff type variable bound type signature polynomialsv :: floating n => trainable n n @ src/machinelearning/polynomial.hs:18:1 expected type: [n] -> n1 -> n1 actual type: [n] -> n -> n in first argument of `trainable', namely `polynomialtrf' in expression: trainable polynomialtrf polynomialcost src/machinelearning/polynomial.hs:18:40: not deduce (n ~ n1) context (floating n) bound type signature polynomialsv :: floating n => trainable n n @ src/machinelearning/polynomial.hs:18:1-53 or (floating n1) bound type expected context: floating n1 => n -> n -> [n1] -> n1 @ src/machinelearning/polynomial.hs:18:16-53 `n' stiff type variable bound type signature polynomialsv :: floating n => trainable n n @ src/machinelearning/polynomial.hs:18:1 `n1' stiff type variable bound type expected context: floating n1 => n -> n -> [n1] -> n1 @ src/machinelearning/polynomial.hs:18:16 expected type: n -> n -> [n1] -> n1 actual type: n -> n -> [n] -> n in sec argument of `trainable', namely `polynomialcost' in expression: trainable polynomialtrf polynomialcost

my question problem coming from? how can solve it? me feels clear 2 types equal, there possibility misunderstand in type system.

i'm afraid rank 2 type

data trainable b = trainable (forall n. floating n => [n] -> -> b) (forall n. floating n => -> b -> [n] -> n)

won't help you. concentrated on type error in other question, , didn't notice floating isn't rich plenty create usable. since can't generically convert floating type other type or floating type reals (realtofrac), can't write many interesting functions of given polymorphic types in general, sorry.

the problem here above type demands functions passed trainable constructor work floating types n (whatever specified a , b), implementations polynomialtrf , polynomialcost work 1 specific floating type, 1 given (both) parameters. polynomialtrf has type floating n => [n] -> n -> n, need have type (floating n, floating f) => [f] -> n -> n eligible passed trainable constructor.

with 3rd type parameter, have

trainable polynomialtrf polynomialcost :: floating n => trainable n n n

and trainsgdfull, need type

trainsgdfull :: (floating n, ord n, mode s) => trainable b (ad s n) -> [n] -> -> b -> [[n]]

to able utilize gradientdescent.

i don't know how proper solution problem might like.

haskell

json - Use of use jQuery.getJSON() for a Url -



json - Use of use jQuery.getJSON() for a Url -

how utilize jquery.getjson() obtain info url?

http://gbrds.gbif.org/registry/organisation/a3c228d0-3110-11db-abb8-b8a03c50a862.json?op=contacts

if result in browser, result:

[{"position":"","lastname":"","phone":"+39 06 6118286","type":"technical","city":"","country":"","isprimarycontact":true,"postalcode":"","address":"","email":"m.skofic@cgiar.org","description":"","province":"","firstname":"milko skofic","salutation":"","key":"48"},{"position":"","lastname":"","phone":"39-06-6118204","type":"administrative","city":"","country":"","isprimarycontact":true,"postalcode":"","address":"ipgri, via tre denari, 472/a, 00057, maccarese, rome, italy,","email":"eurisco@cgiar.org","description":"","province":"","firstname":"ms. sonia dias","salutation":"","key":"49"}]

take @ getjson method on jquery documentation.

the sintaxe:

$.getjson(url, data, function success);

so, can seek this:

$.getjson("http://gbrds.gbif.org/registry/organisation/a3c228d0-3110-11db-abb8-b8a03c50a862.json?op=contacts", null, function(data) { // loop in result if array $.each(data, function(i, item) { // utilize data[i].property access each property of array. // sample: var p = data[i].position; var l = data[i].lastname; });​ });

jquery json

comma - Inserting string with simple apostrophe in mysql -



comma - Inserting string with simple apostrophe in mysql -

this question has reply here:

how can prevent sql-injection in php? 28 answers apostrophe during insert (mysql) 3 answers

im trying set info in info base, info text file, have next problem, there words want insert have simple apostrophe (') how know when u create insert string need couple of '' each string, when word simple apostrophe comes in got error of syntax. example:

where $player = n'zogbia

$resultado = mysql_query( "insert equipo values( '$nom_equipo', '$player' );" , $link );

how insert kind of name without modify simple apostrophe?

i utilize function addslashes or real_escape_string: http://php.net/manual/en/function.addslashes.php http://www.php.net/manual/en/mysqli.real-escape-string.php

mysql comma

multithreading - Access/Modification of Global hashmap and string inside the threads in Java -



multithreading - Access/Modification of Global hashmap and string inside the threads in Java -

i wrote programme in java reservation scheme 3 medical clinics in quebec. experimental project myself.

clients connect server through rmi (remote method invocation)

it has 3 synchronized hashmaps ,one each clinic , defined protected after whole class of server implementation starts (which means should visible other classes , ... within server implementation class.)

for checking reservation function, server creates 3 runnable threads communicate through same udp socket on specific port defined outside thread invocation , passed within communicating threads (thread 1 send timeslot(which passed client server through rmi , passed outside thread within of it) using udp socket communication , timeslot used in each server hashmap sent 2 other threads them own hashmap it.

the udp works fine , sends timeslot , receiving threads receive it, noticed if utilize popular getter , setter, or if pass whole hashset threads did passing sockets udp, hashmap not visible threads.

for example, if reserve timeslot specific patiend within hashmap of specific clinic, lets montreal clinic, if check hashmap using if(montrealclinic.containsvalue(timeslot) outside of threads, works fine , shows timeslot reserved on montrealclinic hashmap, when check within of thread, has no compile time error, returns not reserved!

also defined global string outside threads store lookup result happens within runnable thread (implements runnable) , never modification coded within of thread, , modification of outside of threads work! when access hashmap , string using getter , setter functions defined outside thread , accessed within thread.

how can access global hashmap defined outside threads within of it? , how can modify final result defined , returned outside thread within thread?

thanks alot

java multithreading hashmap global-variables runnable

ios - ARC , attach char* to label.text through stringWithFormat , the 'live bytes' grows little by little till crash -



ios - ARC , attach char* to label.text through stringWithFormat , the 'live bytes' grows little by little till crash -

i'm using arc .

.h file

@property (weak, nonatomic) iboutlet uilabel *label; - (ibaction)onbuttonclick:(id)sender;

.m file

- (ibaction)onbuttonclick:(id)sender { char *example = "testabcdef"; _label.text = [nsstring stringwithformat:@"%s",example]; }

i find 'live bytes' in instrument grows little when 'onbuttonclick' called every time , , never drop down, code in app cause app crash after hundreds of calling because of 'received memory warning, , out of memory'.

i'v been confused question 2 month. still don't know why? can help me?

ios memory automatic-ref-counting didreceivememorywarning stringwithformat

PHP - serialize a class with static properties -



PHP - serialize a class with static properties -

when user logs site, create instance of user class, fetch user-related info , store object in session.

some of info fetch database should constant throughout session , want info accessible other objects. prefer using user::$static_value_in_class $_session['static_value_in_session'] when using value within object, i'm open persuasion.

the problem is, values aren't remembered when serialize user instance session, load different page.

class definitions:

class user { public $name; public static $allowed_actions; public function __construct($username, $password) { // validate credentials, etc. self::$allowed_actions = get_allowed_actions_for_this_user($this); } } class blog { public static function write($text) { if (in_array(user_may_write_blog, user::$allowed_actions)) { // write blog entry } } }

login.php:

$user = new user($_post['username'], $_post['password']); if (successful_login($user)) { $_session['user'] = $user; header('location: index.php'); }

index.php:

if (!isset($_session['user'])) { header('location: login.php'); } blog::write("i'm in index.php! hooray!") // won't work, because blog requires user::$allowed_actions

should implement serializable , write own version of serialize() , unserialize() include static data?

should bite lip , access $_session variable within blog class?

should require valid user instance sent blog write() method?

or maybe internets has improve idea...

edit: writing real utilize case (not total code, plenty gist).

my site handles groups of users shared budget accounts. users may spend grouping money on things grouping agreed upon, , study transactions creating instances of transaction class , sending bank class database storage.

bank class:

class bank { // group-agreed reasons spend money public static $valid_transaction_reasons; public function __construct(user $user) { bank::$valid_transaction_reasons = load_reasons_for_this_group($user->bank_id); } }

user class:

class user { public $bank_id; public function __construct($username, $password) { $query = "select bank_id users username=$username , password=$password"; $result = mysql_fetch_array(mysql_query($query)); $this->bank_id = $result['bank_id']; } }

transaction class:

class transaction { public function __construct($reason, $amount) { if (!in_array($reason, bank::$valid_transaction_reasons)) { // error! users can't spend money on this, grouping doesn't cover } else { // build transaction object } } }

actual code (login.php, or something):

$user = new user($_get['uname'], $_get['pword']); $_session['bank'] = new bank($user); // shit happens, user navigates submit_transaction.php $trans = new transaction(reason_beer, 5.65); // error! bank::$valid_transaction_reasons empty!

as mentioned in comment, more software design question question how accomplish php.

a static property not part of state of object , hence not beingness serialized it.

i'll give short illustration how solve related problem. imagine have next message class, has static $id property create sure instances have unique id:

class message { public static $id; public $instanceid; public $text; /** * */ public function __construct($text) { // id incremented in static var if(!self::$id) { self::$id = 1; } else { self::$id++; } // create re-create @ current state $this->instanceid = self::$id; $this->text = $text; } }

serialization / unserialization code:

$m1 = new message('foo'); printf('created message id: %s text: %s%s', $m1->instanceid, $m1->text, php_eol); $m2 = new message('bar'); printf('created message id: %s text: %s%s', $m2->instanceid, $m2->text, php_eol); $messages = array($m1, $m2); $ser1 = serialize($m1); $ser2 = serialize($m2); $m1 = unserialize($ser1); printf('unserialized message id: %s text: %s%s', $m1->instanceid, $m1->text, php_eol); $m2 = unserialize($ser2); printf('unserialized message id: %s text: %s%s', $m2->instanceid, $m2->text, php_eol);

to create sure id unique across multiple script runs farther work nessary. you'll have create sure message::$id initialized before object creation, using value lastly script run. additionally wired when comes parallel php request on webserver.

its illustration simplest static property know: instance counter. in case so. hope see there farther work required serialize / unserialize static properties without have side effects. , depends on application needs.

this question cannot answered general tend makes no sense in case serialize static members. appreciate comments on this.

php class serialization static

ios - Sharing images in Google+ using iPhone App -



ios - Sharing images in Google+ using iPhone App -

here i'm working google+ integration in ios apps..

i have gone through guidelines @ link https://developers.google.com/+/mobile/ios/share

and have succeeded in next aspect.

-->>sharing text.

-->>sharing urls.

-->>sharing app(google+ app) icon , description [using deep linking].

but have stuck in next aspect.

-->>sharing local or url image.

so..is there possibility share image iphone app through google+.

please help me...

thanks in advance...

according these discussions not possible yet:

is possible share image on google+ using iphone app?

and

ios: possible send or post message in google plus

iphone ios objective-c xcode ipad

encryption - Methods all need to be indented one level in to indicate that they are methods of the class in python -



encryption - Methods all need to be indented one level in to indicate that they are methods of the class in python -

i'm next rsa algorithm wiki: http://en.wikipedia.org/wiki/rsa_(algorithm)

i using python 3.3.0 , i'm trying rsa encryption , ran 2 problems don't know how do.

in encryptions class, methods need indented 1 level in indicate methods of class , not global functions.

when main script asks input @ end, if nail return, exception thrown python reached unexpected eof.

how can ?

my code far:

modular.py

def _base_b_convert(n, b): if b < 1 or n < 0: raise valueerror("invalid argument") q = n = [] while q != 0: value = int(q % b) a.append(value) q =int(q / b) homecoming def mod_exp(base, n, mod): if base of operations < 0 or n < 0 or mod < 0: raise valueerror("invalid argument") = (_base_b_convert(n, 2)) x = 1 pow = base of operations % mod in range(0, len(a)): if a[i] == 1: x = (x * pow) % mod pow = pow**2 % mod homecoming x

main.py

from encryptions import encryptions def main(): enc = encryptions() message = enc.encrypt(message) print(message) print() print("decrypting message:") message = enc.decrypt(message) print(message) input("--press key end--") if __name__ == '__main__': main()

input() in python 2 not think -- rather, evaluates string inputted python code, not want. instead, utilize raw_input.

as indentation problem, that's python syntax. nil can do.

python encryption rsa

javascript - Dynamically modifying the HighChart layout options -



javascript - Dynamically modifying the HighChart layout options -

i can't find way update margintop value of created chart.

check out example:

http://jsfiddle.net/tzaev/4/

var btn = $('#btn'); btn.click(function(){ // changes });

i need alter chart.margintop value without creating chart object again. (when click on trigger button, example).

var btn = $('#btn'); btn.click(function(){ chart.optionsmargintop += 20; chart.isdirtybox = true; // makes chart redraw chart.redraw(); });

demo

javascript highcharts

visual studio 2010 - LNK 2019 unresolved symbol - FFmpeg -



visual studio 2010 - LNK 2019 unresolved symbol - FFmpeg -

i'm trying utilize ffmpeg open , read video .avi work on win7 x64 visual studio 2010

for code simple:

#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "sdl.h" #include "sdl_mixer.h" int main (int argc, char *argv[]) { avformatcontext *pfile_video; int s, videostream; avcodeccontext *pcodecctx; avcodec *pcodec; avframe *pframe; avframe *pframergb; avpacket packet; int framefinished; int numbytes; uint8_t *buffer; av_register_all(); if((avformat_open_input(&pfile_video, "ar.avi", null,null)!=0)) cout <<"cannot open video file"<<endl; //if(av_find_stream_info(pfile_video) <0) cout <<"cannot retrive stream information"<<endl; videostream =-1; for(s=0; s<pfile_video->nb_streams;s++){ if((pfile_video->streams[s]->codec->codec_type) == avmedia_type_video) videostream =s; } if(videostream ==-1) cout <<"cannot open video stream"<<endl; f(sdl_init(sdl_init_everything)< 0) cout<< "cannot initialize sdl subsystems"<<endl; if(mix_openaudio(22050,mix_default_format,2, 4096) <0) cout <<"error mixer audio"<<endl; music = mix_loadmus("ar.wav"); if(music == null) {cout <<"error loading music "<<endl; } homecoming 0; }

i linked next .lib files:

avcodec.lib avdevice.lib avfilter.lib avformat.lib avutil.lib postproc.lib swresample.lib swscale.lib

but these errors:

>msvcrtd.lib(cinitexe.obj) : warning lnk4098: la libreria predefinita 'msvcrt.lib' รจ in conflitto con l'utilizzo di altre librerie; utilizzare /nodefaultlib:libreria 1>main_video_ffmpeg.obj : error lnk2019: riferimento al simbolo esterno "int __cdecl avformat_open_input(struct avformatcontext * *,char const *,struct avinputformat *,struct avdictionary * *)" (?avformat_open_input@@yahpapauavformatcontext@@pbdpauavinputformat@@papauavdictionary@@@z) non risolto nella funzione _sdl_main 1>main_video_ffmpeg.obj : error lnk2019: riferimento al simbolo esterno "void __cdecl av_register_all(void)" (?av_register_all@@yaxxz) non risolto nella funzione _sdl_main 1>c:\users\cristina\desktop\opencv\progetti\miei_progetti_vs\video_ffmpeg\debug\video_ffmpeg.exe : fatal error lnk1120: 2 esterni non risolti

i think linker error.. haven't other .lib file ffmpeg library.

you should surround ffmpeg includes extern "c"

extern "c" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "sdl.h" #include "sdl_mixer.h" }

visual-studio-2010 ffmpeg lnk2019

objective c - Ignoring transparency for animated sprites -



objective c - Ignoring transparency for animated sprites -

i using cgpath in order ignore transparency sprites so:

path = cgpathcreatemutable(); cgpathmovetopoint(path, null, endpoint-x, endpoint-y); cgpathaddlinetopoint(path, null, 0, 250);..... cgpathaddlinetopoint(path, null, 50, 0); cgpathclosesubpath(path);

this works 1 sprite per path. problem is, sprites animated makes utilize of multiple sprites different vertices (points). question is, best way ignore transparency animated(multiple) sprites? told can utilize per frame way tedious there might easier this.

just additional info, i've tried pixel perfect collision didn't work me. please help.

objective-c cocos2d-iphone

How to remove the xml spring configuration and use annotation? -



How to remove the xml spring configuration and use annotation? -

i remove next code , utilize annotation (@configuration). don't understand how remove bean: testserviceclienttarget

<bean id="testserviceclientfactorybean" class="org.apache.cxf.jaxws.jaxwsproxyfactorybean"> <property name="serviceclass" value="br.com.test.servicews" /> <property name="features"> <util:list> <bean class="org.apache.cxf.clustering.loaddistributorfeature"> <property name="strategy"> <bean class="org.apache.cxf.clustering.sequentialstrategy"> <property name="alternateaddresses"> <util:list> <value>xxx/localhost:8080/app-teste-web/services/test</value> <value>xxx/localhost:8180/app-teste-web/services/test</value> <value>xxx/localhost:8280/app-teste-web/services/test</value> </util:list> </property> </bean> </property> </bean> </util:list> </property>

<bean id="testserviceclienttarget" factory-bean="testserviceclientfactorybean" factory-method="create" scope="prototype" lazy-init="true" /> <bean id="testserviceclient" class="org.springframework.aop.framework.proxyfactorybean"> <property name="targetsource"> <bean class="org.springframework.aop.target.commonspooltargetsource"> <property name="targetclass" value="br.com.test.servicews" /> <property name="targetbeanname" value="testserviceclienttarget" /> <property name="maxsize" value="10" /> <property name="maxwait" value="5000" /> </bean> </property>

i started configure beans testserviceclientfactorybean , testserviceclient couldn't understand how create testserviceclienttarget. specially because used @ property targetbeanname string.

could understand question?

regards.

spring configuration annotations factory-method