Posts

Showing posts from January, 2012

In Camel how can i split a route using xpath on a header -

as title suggests, have route header contains xml similar following snippet string; <files> <image_file1>image.png</image_file1> <image_file2>image.png</image_file2> </files> what i'm trying do split via xpath using following. following suggests when xml part of body, runs fine:- from(myincomingqueue) .convertbodyto(string.class, "utf-8") .split(xpath("//*[local-name()='files']/*")) .setheader("filepropertytoretrieve", xpath("local-name(//*)").stringresult()) .to(myfiledownloadqueue) .routeid("common-con-attachment_router-id"); i found solution using following:- from(myincomingqueue) .setbody(header("myheaderwithxml")) .convertbodyto(string.class, "utf-8") .split(xpath("//*[local-name()='files']/*")) .setheader("filepropertytoretrieve", xpath("local-name(//*)").stringresu...

jquery - Scroll for overflow-x by mousewheel -

scroll overflow-x mousewheel hi every body have div width overflow-x div main div overflow-x work , when use mousewheel nothing happen how can use mousewheel scroll element .main{ display:block; margin: 0; padding: 0; overflow-x:scroll; overflow-y: hidden; } .main should have content overflowing along x able scroll. see demo #two { border: 5px solid black; height: 200px; width: 20000px; } #one { border: 1px solid red; height: 200px; width: 200px; overflow-y: hidden; overflow-x:scroll; } <div id="one"><div id="two"></div></div>

ruby - Loading custom classes in Rails 4 -

i'm rewriting 1 old app - rails 1.2.6 :)) - in rails 4... can imagine information overload. it's going quite far i'm struggling 1 task should pretty obvious lacks proper documentation , there many blogs different solutions issue. i have custom class custom text conversion functionality (using redcloth, autolinker, sanitize etc.), let's call textilize class. it's used in models controllers guess best solution create gem it. want attack gem creation later though since it's simple one-file class. so added textilize.rb file /lib directory , added config.autoload_paths += %w(#{config.root}/lib) . it works fine , can use in app without requiring in models , controllers. is practice in rails 4? thread-safe? if not, there way refactor without creating complete gem now? thanks! "is practice?" think is. "is thread-safe?" don't know any other way? use solution if lib crossing model , controller , simple. if rather comp...

java - how to search encrypted data in grails -

i have domain 3 field cardno, cardname , account class card { string cardno string cardname account account static constraints = { cardno(blank:false, unique:true) cardname(blank:false) account(blank:false) } the cardno must encrypted when saved, used encryptionutil java encrypt it. on list screen, want make search fiture, can search cardno , cardname. possibe if search data encrypted create cretiria in grails?? if can't use create criteria, best way search encrypted data?? need help. before :) i can give advice: avoid store card numbers in database. use payment services it.

java - maintaining cache state in different servers -

this may dumb question, not getting google even. have server fetches data db, caches data , when ever request involves data, data fetched cache instead of db.there reducing time taken serve request. cache can modified, i.e may key can added or deleted or updated. change occurs in cache happen on db. problem due heavy rush in traffic want add load balancer infront of server. lets add 1 more server. 2 servers have 2 different cache. if thing gets added in first server cache, how should inform second server cache refreshed?? if decide move cache outside main webserver process, take @ consistent hashing . alternative replicated cache. the problem replicated caches, scale inversely proportional number of nodes participating in cache. i.e. performance degrades add additional nodes. work fine when there small number of nodes. if data replicated between n nodes (or need send eviction messages n nodes), every write requires 1 write cache on originating node, , n-1 writes other no...

javascript - How do you use the revealing module pattern with jQuery's document.ready? -

i have following (albeit) small 'revealing module pattern' implementing code: (function (ckspace, $, undefined) { ckspace.getloanvalues = function () { var url = "/home/updateapr"; $.get(url, { amount: $("#slider").slider("value"), length: $("#slider2").slider("value") }, function (data) { $("#loanamount").html("£"+data.loanadvance); $("#totaltorepay").html("£" + data.loangrossrepayable); $("#representative").html(data.loanapr); $("#monthlyrepayterm").html(data.loanterm); $("#monthlyfee").html("£" + data.loaninstalment); }); } } (window.ckspace = window.ckspace || {}, jquery)); i under impression using window.ckspace able access ckspace globally root namespace of public members. however, when used in conjunction $(document).ready() unable access c...

How to build Net-SNMP library for use in iOS development? -

i need use net-snmp in 1 of ios applications. want use library in xcode. how can build library? i tried following, did not work me: http://latenitesoft.blogspot.jp/2008/10/iphone-programming-tips-building-unix.html i following error: configure: error: c compiler cannot create executables by way, i'm targetting ios 5 , 6. help/leads appreciated! some additional links i've looked at: https://gist.github.com/j0sh/895945 here's github project found based on snmp++: https://github.com/zchander/mobile-snmp-plusplus

git - Is merging branch A into B same as merging B into A? -

in git repository, merging branch a b same merging b a ? no, if merge b, in end branch have a's changes, , b have both a+b changes. if merge b a, have both a+b changes, , b have b's changes. start: /a1-a2-a3 x \b1-b2-b3 a b merge commit: /a1-a2-a3 x \b1-b2-b3-a*(1,2,3) a b fast forward: /a1-a2-a3 x \a1-a2-a3-b1'-b2'-b3' b merge commit: /a1-a2-a3-b*(b1,b2,b3) x \b1-b2-b3 b fast forward: /b1-b2-b3-a1'-a2'-a3' x \b1-b2-b3

html - Forward slash in class name -

this question has answer here: which characters valid in css class names/selectors? 8 answers is valid use / in class name in html/css? // html <div class="/10"></div> // css ./10{ float:left; } you can use unicode characters in both class , id attributes in html. this means can indeed use / in classname in html, run problems when trying select ./10 in css, you've found out yourself. if escape slash, you're golden! :) .\/10 { float:left; } check out http://mathiasbynens.be/notes/html5-id-class , http://mathiasbynens.be/notes/css-escapes

php - Hide specific posts from category list in wordpress -

i'm having trouble displaying list of posts wordpress category exclude number of post based on custom field using advance custom fields. here's current code i'm using hides nicely: while ( have_posts() ) : the_post(); $is_taken = get_field('taken_check', $this_id); if ($is_taken!=1) { get_template_part( 'basket_selection' ); } endwhile; however, hides post still considers post on "posts_per_page" function. for example, there 20 posts in total , i've set limit 10 posts per page. if hide 3 posts code above, display 7 posts in page 1 , 10 posts in page 2. is there way ignore hidden posts , not count "post"? try this: apply custom fields parameters in get_post query itself. $posts = get_posts(array( 'posts_per_page' => 10, 'post_type' => '<your_post_typ>', 'meta_key' => 'taken_check', 'meta_value' => '<d...

mongodb - Do we need to delete the collection named system.indexes to make new indexes apply on the collection -

i have question indexes in mongodb. i using mongodb version 1.6.5. modifying collection indexes. when used show collections command in mongodb shell, showed 1 of collections system.indexes stocks options do need drop collection system.indexes make new indexes on collections apply? thew system.profile collection not there however, no not. profile collection output of profiler, nothing more. indexes still apply. edit since question says 2 things, no not need drop system.indexes either, mongodb handle updating records in there you. dropping might damage database.

How can I retrieve the namespace to a string C# -

i writing program needs namespace of program cant seem figure out how retrieve it. end result in string. i able find msdn page topic proved unhelpful myself. http://msdn.microsoft.com/en-us/library/system.type.namespace.aspx any appreciated. program written in c#. edit: sorry guys, not console application. this should work: var mytype = typeof(myclass); var n = mytype.namespace; write out console: type mytype = typeof(myclass); console.writeline("namespace: {0}.", mytype.namespace); setting winform label: type mytype = typeof(myclass); namespacelabel.text = mytype.namespace; or create method in relevant class , use anywhere: public string getthisnamespace() { return gettype().namespace; }

ios - Pattern for determining if object is fully or partially loaded -

the question not strictly tied ios, since encountered in ios app speak in terms of objective-c. my ios app client, gets data server. data server json, , mapped classes. problem appears when server send necessary part of object. lets full object is { "a" : 1, "b" : 2, "c" : 3 } my class mapped is @class myobject { int a, b, c; } @property (nonatomic) int a, b, c; -(id) initfromdictionary:(nsdictionary*)dict @end @implementation myobject -(id) initfromdictionary:(nsdictionary*)dict { self = [super init]; if (self) { = [dict[@"a"] intvalue]; b = [dict[@"b"] intvalue]; c = [dict[@"c"] intvalue]; } return self; } @end the server can send { "a" : 1, "c" : 3 } for request getaandc , { "a" : 1, "b" : 2 } for - getaandb (these requests not dependent, thing similar object use). not need information b in first 1 , c ...

Javascript - search a string from beginning -

hello have part of code developed want edits: $('#target').keydown(function(event) { if (event.which == 13) { var users = ["dennis lucky","lucy foo","name lastname","billy jean"]; var match = 0; var str = $('#target').val(); for(i=0;i<users.length;i++) { if ( users[i].tolowercase().indexof(str.tolowercase()) > -1 ) { match++; name = users[i]; } } if(match == 1) { $('#target').val(''); $('#chatbox').append('<span style="color:blue;">'+name+'</span>&nbsp;'); console.log(name); } else if (match >= 2) { console.log("many entries"); } }}); the idea if type , hit enter if partial string exists in users becomes blue color.with code have problem if write "lu" 2 results, "dennis lucky" , "lucy...

Proper use of NULL in mysql query from php -

$eta_time = strtotime($arrivals[$i]["operationaltimes"]["estimatedgatearrival"]["datelocal"]); if (!$eta_time) { $eta = 'null'; } else { $eta = strftime("%y-%m-%d %h:%m:%s", $eta_time); } $sta_time = strtotime($arrivals[$i]["operationaltimes"]["scheduledgatearrival"]["datelocal"]); if (!$sta_time) { $sta = 'null'; } else { $sta = strftime("%y-%m-%d %h:%m:%s", $sta_time); } $ata_time = strtotime($arrivals[$i]["operationaltimes"]["actualgatearrival"]["datelocal"]); if (!$ata_time) { $ata = 'null'; } else { $ata = strftime("%y-%m-%d %h:%m:%s", $ata_time); } $query="insert `schedule` (`eta`,`sta`,`ata`) values('".$eta."','".$sta."','".$ata."');"; $result=run_query($query); the related mysql db table: create table `schedule` ( `id` sma...

Finding Null space of a large sparse matrix in MATLAB -

over course of finite difference discretization of elliptic equation , application of neumann bcs on sides of 2d domain have large sparse matrix. need find null space of transpose enforce consistency condition on either side. computational domain of 50x50 , 100x100 able available ram of 32 gb in mathematica , matlab available full matrix commands of nullspace , null respectively. if computational domain 500x250 (which of order of have in general) ram required storage of matrix of size (500x250)x(500x250) 125 gb , highly prohibitive. use sparse matrices store super-matrix , don't have have space constraint anymore. can't use 'null" command on full matrices. matlab suggests use "svds" command on sparse matrices. svds(a) gives first 6 singular values , singular vectors. there command svds(a,k,sigma) gives "k" singular values , vectors around scalar singular value of "sigma". when use sigma=0 find singular vector corresponding the...

Varnish with Nginx for a Rails application (issue with Devise authentication) -

i have following configuration varnish. when access application, doesn't ask login, login. i'm doing wrong? default.vcl backend default { .host = "127.0.0.1"; .port = "80"; } sub vcl_recv { if(req.url ~ "sign_in" || req.url ~ "sign_out" || req.request == "post" || req.request == "put" || req.request == "delete") { return (pass); } return (lookup); } sub vcl_fetch { if(req.url ~ "logout" || req.url ~ "sign_out"){ unset beresp.http.set-cookie; } if (req.request == "get") { unset beresp.http.set-cookie; set beresp.ttl = 360m; } if (req.url ~ "images/" || req.url ~ "javascripts" || req.url ~ "stylesheets" || req.url ~ "assets"){ set beresp.ttl = 360m; } } /etc/default/varnish daemon_opts="-a 192.241.136.37:80 \ -t localhost:6082 \ -f /etc/varnish/default.vcl \ ...

java - How to make a byte[1] from a byte? -

is there better way byte[1] byte this? byte given_byte = 0x12; byte[] wanted_byte = new byte[1]; wanted_byte[0] = given_byte; i have given_byte . seems unnecessary use 2 lines define wanted_byte . try this: byte[] wanted_byte = new byte[]{given_byte}; or holger said: byte[] wanted_byte = {given_byte};

wordpress - Problems with Like button -

i use site www.spazio-psicologia.com facebook plugin have social integration facebook platform. have 1 problem: button seems work proprely collecting click of likes articles, sometimes, without reasons, clears click collected , restart counting zero. how can fix problem? thanks laura the best way put button in site: https://developers.facebook.com/docs/reference/plugins/like/ just click get code , put in template. facebook rest.

haskell - Why does `hoist` constrain the type parameter of this monad? -

i have function composes 2 monads: comp :: monad m => m -> m b -> m b and 2 instances of such monads, on "inside" mfunctor , ms :: monad m => m string ms = undefined tma :: (monad m, mfunctor t) => t m tma = undefined now if try compose ms tma : tmas = hoist (\ma -> comp ma ms) tma i getting error: not deduce (a ~ [char]) context (monad m, mfunctor t) bound inferred type of comp :: (monad m, mfunctor t) => t m b @ coroutine.hs:607:1-40 `a' rigid type variable bound type expected context: m -> m @ coroutine.hs:607:8 expected type: m actual type: m string which states a in ms has of arbitrary type: ms :: monad m => m a . why , there way compose tma monads of specific parameters. i can see signature of hoist is: hoist :: (monad m, mfunctor t) => (forall a. m -> n a) -> t m b -> t n b but cannot picture how forall affecting trying do, if has effec...

php - Twitter - get a specific tweet from returned data? -

i'm getting latest tweets , results come so: [{ "created_at": "wed aug 28 11:50:22 +0000 2013", "id": 372687598952919040, "id_str": "372687598952919040", "text": "\"i fear we'll ourselves involved in endless conflict\" - ukip's @nigel_farage on uk's #syria decision http:\/\/t.co\/3imlo9bhks", "source": "<a href=\"http:\/\/www.bbc.co.uk\/news\/\" rel=\"nofollow\">bbc news<\/a>", "truncated": false, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "user": { "id": 612473, "id_str": "612473", "name": "bbc news (uk)", "scree...

photo feeds from facebook api for android -

how feeds(photos only) of facebook page via facebook api android? is there straight forward method that. exactly need activity shows feeds of photos page. why think doesn't require login' in. can that? , how? try using graph api http://graph.facebook.com/pagename?fields=photos.fields(images) for more options check docs

sql - ADO.Net c# 0x80131904 must declare scalar variable/function -

i'm trying use function via sql connection i've done everywhere else in application (only here give error, not rest of application). when searched error code meant responses found it's error when 1 can't connect sql server? doesn't give solution. here c# code sqlconnection connection = database.getconnection(); datatable dt = new datatable("crc"); sqlcommand cmd = new sqlcommand("select dbo.calcrentalcharge(@rentalstartdatetime,@rentalenddatetime,@cartypeid)", connection); try { connection.open(); using (sqldatareader dr = cmd.executereader()) { cmd.commandtype = commandtype.text; cmd.parameters.add("@rentalstartdatetimetext", sqldbtype.datetime).value = rentalstartdatetimebox.text; cmd.parameters.add("@rentalenddatetimetext", sqldbtype.datetime).value = rentalenddatetimebox.text; ...

c# - SendKeys CaretSign not sendable -

Image
anyone have experience sendkey methode? my problem when want send ^ sign have read had send brackets this. {^} but when & sign? do know why? if make {^ 2} && wont ^ :) edit: sorry misunderstanding! first comment way , wont work this. from msdn: the plus sign (+), caret (^), percent sign (%), tilde (~), , parentheses () have special meanings sendkeys. specify 1 of these characters, enclose within braces ({}). example, specify plus sign, use "{+}". specify brace characters, use "{{}" , "{}}". brackets ([ ]) have no special meaning sendkeys, must enclose them in braces. so correct syntax caret is: sendkeys.send("{^}"); evidence works:

c# - Visual Studio 2012 express for Web doesn't run unit tests -

i have c# project created in vs2010 , imported 2012 express (web). when build it, however, unit tests don't run. going test explorer gives me option hit "run all", causes build run again without tests. thinking may caused import created, in 2012, new project in solution unit test project, simple test (asserting true==false). shows in solution explorer correct icon. however, no amount of building/rebuilding/cleaning has yet caused test run either. i have update 3 installed, , have changed nothing knowledge affect tests. know what's wrong? edit: created new solution containing nothing single unit test (for true==false ) runs expected, not vesion of vs problem, don't know other configuration options cause fail in way. found there configuration files in solution directory causing problems. deleting them fixed issue.

c - U-Boot: Unexpected problems porting code -

i want extend u-boot spl code fuzzy extractor logic adding code {u-boot_sources}/arch/arm/cpu/armv7/omap-common/hwinit-common.c . u-boot shall used on pandaboard es (omap4460 soc). thus, first implemented code on x86 pc , porting arm-based pandaboard. complete code can found here (as side note "main" function s_init()): http://pastebin.com/iaz13yn9 however, expecting dozens of unexptected effects, results in either stopping during execution of code, stopping u-boot after reading u-boot.img or not sending output (and not booting) @ all. for example, want call 2 functions ( computesyndrome , decodeerrors ) inside for -loop, part of function golaydecode . for first problem please ignore code below multiline comment starting /* >>>> these lines of code below totally break u-boot . function computesyndrome in conjunction calling function golaydecode important. the issue: if comment out both functions computesyndrome , decodeerrors works fine ...

Objective-C NSString isEqualToString not getting match -

if have array created so: nsarray* arritems = [[nsarray alloc] initwithobjects:@"one", @"two", @"three", nil]; and have class nsstring property: myclass.myclassstring = @"one"; shouldn't isequaltostring work if this: nsstring* strtocheck = myclass.myclassstring for(int i=0; i<arritems.count; i++) { nsstring* strthisitem = [arritems objectatindex:i]; if ([strthisitem isequaltostring:strtocheck]) { nslog(@"okley dokley!"); } } edit: real world results: in app not getting match - log out put both strings , length - @ safety marketing matching - there should "ok" logged here. 2013-08-28 09:20:02.339 oer[3081:c07] aldahol_7::safety marketing_16 2013-08-28 09:20:02.341 oer[3081:c07] aldahol_7::acecide-c marketing_19 2013-08-28 09:20:02.341 oer[3081:c07] aldahol_7::aldahol marketing_17 2013-08-28 09:20:02.342 oer[3081:c07] aldahol_7::oer-pro service marketing_25 2013-08-28 09:20:0...

sql - Some stored procedures are not displayed -

i have wired issue of stored procedures on database. not displayed in object explorer. tried using filter search name , still not appears!!! thing when try create missing ones says stored procedure exists. , tried altering sp , worked. cannot see yet. any idea regarding this? i've had conundrum before , because trying create stored procedure in master database. believe default, in ssms, database selected default. if using ssms, ensure database selected dropdown list (usually top left on query window toolbar) correct database.

jQuery append is invisible? -

i using append add text div container when link clicked. new text appended link. when new text link clicked jquery event have attached event not happen. if paste appended code straight html event caught, it's if appended html cannot seen. have mis-understood how jquery append function works? thanks, alan. edit ** code: $(function(){ $('.tab-link').click(function(){ alert('hello'); }); $('.tab-copy').click(function(){ var next=$(this).data("next"); $('#tabs-row-left').append('<div class=\"tab-folder\" id=\"idtab'+next+'\"><a href=\"#\" class=\"tab-link\" id=\"tab'+next+'\" data-strategyid='+(next+1)+'>test</a></div>'); }); }); here js fiddle: http://jsfiddle.net/m6wcj/ if click plus sign see new text appear, should clickable exisiting text , should alert 'hello' doesn't. weird!...

Can Java glob several JAR files in a CLASSPATH directory with an asterisk (*)? -

i'd reference several jars @ once in classpath. can use asterisk this? yes. java -cp "lib/*" mainclass note quotes mandatory, see this question additional details.

html5 - how can i get the id of a item or a menu in typoscript? -

i have 3 different menus in typoscript. if click 1 item of them, want menu shown on next page (template), showing 1 item or according element clicked. i need this: (lib.menu_right < lib.menu1) or (lib.menu_right < lib.menu2) or (lib.menu_right < lib.menu3) but don`t know how current clicked page. edited: menu1 structure is: ## menu 1 [begin] lib.menu1 = hmenu lib.menu1.special = list lib.menu1.special.value = 6933, 6918, 6917, 6916, 6915 lib.menu1.1 = tmenu lib.menu1 = hmenu lib.menu1.entrylevel = 0 lib.menu1.wrap = <ul class="lista_sin_estilo margen_top_medio tam_bloque1>|</ul> lib.menu1.1 = tmenu lib.menu1.1.no { allwrap = <li class="lista_primero">| <hr class="linea_separadora"></li> } lib.menu1.1.act = 1 lib.menu1.1.act { allwrap = <li class="lista_primero">|<hr class="linea_separadora"></li> } ## menu 1 [end] you can conditions like [globalva...

mysql - Get reference to master select row in nested select -

i want db return row under 1 of 2 conditions: the row contains specific value "val" , of type "sometype" there other row, have type "sometype" , same name checked row. for purpose, made folowing query: select c.name, c.value, c.type `table` c c.type='sometype' , c.value='val' or c.type='othertype' , 0<(select count(*) `table` d d.name=c.name , c.name='sometype') unfortunately, return rows of ' othertype '. want these, have friend same name , type 'sometype'. think problem is, don't know how reference values in curently checked row (which believed c.fieldname ). believed d.name = c.name return rows have same name checked row. nested select >0 . i think should work doing: select c.name, c.type, c.value test c inner join (select name, type test type = "type1" , value = 3) d on c.name = d.na...

MySQL CREATE FUNCTION result with multiple records gives error #1172 -

i have following 3 tables: table "name" --------------- id name --------------- 1 book 2 pen table "color" ------------------ id color ------------------ 1 red 2 yello 3 green 4 pink table "both" ------------------------ id name color ---------------------- 1 1 1 2 1 2 3 1 3 4 2 2 and have following function: delimiter // create function get_word(n varchar(20)) returns varchar(10) reads sql data deterministic begin declare b varchar(20); select `color`.`color` b `name` left join `both` on `name`.`id`=`both`.`name` left join `color` on `color`.`id`=`both`.`color` `name`.`name`=n; return b; end// delimiter ; now when run select get_word('pen') returns yellow expect. but wh...

sql - Alternatives to the EAV model vs Hybrid Strategy vs simplifying and improving builds -

i've been doing ton of research on database design upcoming project. this classic inner platform problem , our client wants infinite customization , ability create forms , attributes on entity, collect them values end users, , able display collected information on graphs. in used clinicians monitor patients, , why using eav thought we'll need collect different information different trial runs. might ate day. others might blood sugar, or blood pressure(which 2 numbers), , othertimes might multiple questions (how pain today 1-10?), idea we'll never know in advance end client asking for, or accepted values be. we'll graphing data consistently throughout program, , generating larger reports on less regular basis. ideally i'd able hard code of possible, using sql, , sticking relational database best practices simplify both database design , application design (both of i'm writing). we're doing few trial runs, , first inclination information possible...

javascript - EaselJS tick event delta property not propagating to children -

i starting out easeljs , running first hurdle. have extended container object create new class called egg: (function() { var egg = function(color, x, y, cy) { this.initialize(color, x, y, cy); } var e = egg.prototype = new createjs.container(); // inherit container e.container_initialize = e.initialize; e.initialize = function(color, x, y, cy) { this.container_initialize(); this.circle = new createjs.shape(); this.circle.graphics.beginfill(color).drawcircle(0, 0, 10); this.circle.x = x; this.circle.y = y; this.addchild(this.circle); this.changey = cy; this.addeventlistener("tick", this.handletick); } e.handletick = function(event) { console.log(event.delta); // undefined! } window.egg = egg; }()); and initializing this: var stage, timecircle; function init() { stage = new createjs.stage("gamecanvas"); timecircle = new createjs.shape(); createjs.ticker.useraf = true; createjs.ticker.setfps(30); createjs.ticker.add...

java - Use a variable for the name in Hi {name} and get first name in it?` -

i have send mail around 100 of users in office , using microsoft outlook. i have keep them in bcc. and mail format : hi {name} ///// //// regards thinker so want {name} should replaced first name of every person in bcc. is possible? thanks. it sounds looking use mail merge. check out link how-to: http://office.microsoft.com/en-ca/word-help/use-mail-merge-to-send-personalized-e-mail-messages-to-your-e-mail-address-list-ha101990822.aspx?ctt=1 i no expert on subject, looks pretty straightforward.

api - Javascript: Soundmanager2 and Soundcloud event callback -

i'm trying build own soundcloud media player, using options provided both soundmanager2 , soundcloud. here current code: sc.stream('/tracks/' + this.media.mediaid, function(audio){ audio.load({ onload : function(){ var duration = this.duration; }, onfinish : function(){ self.updateplaybutton(); console.log('finished'); }, onresume : function(){ self.updateplaybutton(); console.log("resumed"); }, onstop : function(){ self.updateplaybutton(); console.log("stopped"); }, onpause : function() { self.updateplaybutton(); console.log('paused'); }, whileplaying : function() ...

c# - Lambda Statements in Linq -

is possible following in linq? list<group> groupscollection = new list<group>(); groups.select( g => { string id = g.attributes["id"].value; string title = g.attributes["title"].value; groupscollection.add( new group(id, title) ); } ); this example. know foreach loop sufficient querying whether possible or not. i tried it, , it's saying: cannot convert lambda expression type system.collections.ienumerable<csquery.idomobject> because it's not delegate type edit: group custom class. groups collection of csquery dom objects. can think of them collection of html anchor elements. ienumerable. i think you're looking this: groupscollection = groups.select(g => new group(g.attributes["id"].value, g.attributes["title"].value)).tolist(); explanation: select() projects each element of sequence new form. (from msdn ) it's transformation function takes 1 ienu...

Retaining logs from Hadoop job after it's executed -

i'm wondering if there's easy way grab job logs / task attempt logs of particular run, , persist them somewhere (hdfs, perhaps)? i know logs on local filesystem @ /var/log/hadoop-0.20-mapreduce/userlogs particular job's task attempts, , write script ssh each of slave nodes , scoop them up. however, i'm trying avoid if makes sense - perhaps there's built-in function of hadoop i'm not aware of? i did find this link , old, contains helpful information -- did not include answer i'm looking for. mapreduce.job.userlog.retain.hours set 24 default, job's logs automatically purged after 1 day. there can besides increasing value of retain.hours parameter these persist? i don't know of out of box exists, have done similar manually. we set cron jobs run every 20 minutes new logs task attempts, pumps them hdfs specific directory. modified files names hostname coming appended. then, had mapreduce jobs try find issues, calculate stats runt...

xpath - Selenium Python: find_element_by_css_selector() using :contains() -

in selenium on python, i'm trying select element using driver = webdriver.firefox() driver.find_element_by_css_selector("td:contains('hello world')") which gives me error: >>>> selenium.common.exceptions.webdriverexception: message: u'an invalid or illegal string specified' i can select elements using many different css selectors way, using :contains() seems throw error. note: same error when try use: driver.find_element_by_xpath("//td[contains(text(),'hello world')]") please advise. thanks! edit: solved! problem solved! thank help! had 2 significant mistakes: 1.) thought :contains() accepted css3 selector (turns out not part of current spec, why couldn't select way) 2.) xpath selector have been fine except using parser assumed xpath never have spaces in it, split arguments spaces. therefore, when passed in xpath selector //td[contains(text(),'hello world'] the parser truncated @ space...

bash - Picking values from a variable -

i have variable in shell script looks this: dir="home_x_y_z"; it represents directory name. imagine have multiple directories named this: home_1_2_z/ home_9_a_z/ home_3_5_z/ etc... the values change located @ position x , y . there regular expression use (maybe sed or awk) peel values out? want able used them independently elsewhere in script. so able have 2 more variables: x_value=""; y_value=""; thanks this easy pure bash: ifs='_' read x_value y_value z_value <<< "${dir#*_}" explanation: so, ${dir#*_} going remove shortest match beggining of string. see parameter expansion cheat sheet more stuff that. echo ${dir#*_} # returns x_y_z after have change default ifs _ , read our values.

facebook - Some pictures not showing in application feed -

i'm in process of taking feed group & displaying on web page . when logged in facebook, group time line shows images have posted. when put 1396648167216137/feed graph api explorer, see "picture" data associated posts. have used following php code pull group feed website: // create our application instance $facebook = new facebook(array( 'appid' => '454419257989387', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', )); // application access token $t = $facebook->getaccesstoken(); // group id 10mostinvolved $gid = "1396648167216137"; // go fetch feed $feed = $facebook->api("$gid/feed?access_token=$t"); the pictures posts don't show & dump of json array reveals "picture" data isn't being provided in $feed. odd thing 2 other members of group have posts images, "picture" data being provided in $feed. that appears suggest setting on account. having looked @...

How to obfuscate JavaScript using PHP? -

for example, how obfuscate sample code from: /* code below write heading , paragraph, , represent start of homepage: */ document.getelementbyid("myh1").innerhtml="welcome homepage"; document.getelementbyid("myp").innerhtml="this first paragraph."; into form: var _0xcc34=["\x69\x6e\x6e\x65\x72\x48\x54\x4d\x4c","\x6d\x79\x48\x31","\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x42\x79\x49\x64","\x57\x65\x6c\x63\x6f\x6d\x65\x20\x74\x6f\x20\x6d\x79\x20\x48\x6f\x6d\x65\x70\x61\x67\x65","\x6d\x79\x50","\x54\x68\x69\x73\x20\x69\x73\x20\x6d\x79\x20\x66\x69\x72\x73\x74\x20\x70\x61\x72\x61\x67\x72\x61\x70\x68\x2e"];document[_0xcc34[2]](_0xcc34[1])[_0xcc34[0]]=_0xcc34[3];document[_0xcc34[2]](_0xcc34[4])[_0xcc34[0]]=_0xcc34[5]; using php? i know can using http://javascriptobfuscator.com/ need inside php file, because dynamically changes. ok. on theory how obsfucate. you need k...

python - getattr on class objects -

class a: def foo(self): print "foo()" getattr(a, foo) # true a.foo() # error getattr(a(), foo) # true a().foo() # prints "foo()" that being said, here problem: i wish store test case meta information attributes of test case class objects themselves, not on instances of them. have list of attribute names extract, if there instance method of same name, getattr(class_obj, attr) return true, getattr(class_obj, attr)() raises error. is there way tell getattr not include attributes of instantiated class , of class object itself? edit: tried accessing class_obj.__dict__ directly (which understand bad practice), not include attributes __name__ edit: rephrase of question. there way differentiate between methods of class obj , methods of instance of class? is enough? import types class test(object): @staticmethod def foo(): print 'foo' def bar(self): print 'bar' in combination with: ...

android - Using a background drawable selector on custom button -

i extending "button" create custom button adding functionality -- , currently, background drawable not changing on touch. here sample code shows doing: /src/custombutton.java public class custombutton extends button { public custombutton(final context context) { this(context, null); } public custombutton(final context context, final attributeset attrs) { this(context, attrs, 0); } public custombutton(final context context, final attributeset attrs, final int defstyle) { super(context, attrs, defstyle); } } /res/layout/myview.xml <com.blah.controls.custombutton android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@drawable/b_gradient_states" android:text="button" /> /res/drawable/b_gradient_states <?xml version="1.0...

Session variables get lost when redirecting -PHP -

i new using php , trying build content management site. i started developing login pages , @ start session variables kept normal , working without issues when using redirect page after login confirmed. but 2 days ago tried develop forgot password functionality , since , changing output buffering enabled have issue. session variables not carried on redirected page , login doesn't work. my code below: <?php include("../includes/session.php"); ?> <?php require_once("../includes/db_connection.php"); ?> <?php require_once("../includes/functions.php"); ?> <?php require_once("../includes/validation_functions.php"); ?> <?php $username = ""; if (isset($_post['submit'])) { // process form // validations $required_fields = array("username", "password"); validate_presences($required_fields); if (empty($errors)) { // attempt login $username = $_...

ios - Refresh using UIRefreshControl depending on current URL -

i have dropped ios 5 support app , went using uirefreshcontrol. i't set , working perfectly. goal thread have refresh if current url in website, or if it's on site youtube, have reload , refresh site. make sense? so far have tried doing without success. went youtube, , nslog showed current site. confused it's not. any appreciated. -(void)handlerefresh:(uirefreshcontrol *)refresh { nsstring *string = @"mysite.com"; if ([string rangeofstring:@"mysite"].location == nsnotfound) { // reload data nsstring *fullurl = @"http://www.mysite.com/"; nsurl *url = [nsurl urlwithstring:fullurl]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; [webview loadrequest:requestobj]; [(uiwebview *)[self.view viewwithtag:999] reload]; [overlay postmessage:@"reloading" duration:1 animated:yes]; //set title while refreshing refresh.attributedtitle = [[nsa...

php - css + jQuery style.css switcher for new jQuery version -

i have been following kevin luck example of javascript css switcher. http://www.kelvinluck.com/assets/jquery/styleswitch/index.html i got work on local projects. problem / question is, when use old javascript kevin luck uses, works. when try update jquery version, break. how can update example use newest 1.10.2 jquery? the index page looks (relevant part) <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>public identity</title> <link rel="stylesheet" type="text/css" href="css/collegestyles.css" title="college" media="screen" /> <link rel="alternate stylesheet" type="text/css" href="css/corporatestyles.css" title="corporate" media="screen" /> <!-- google cdn jquery --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/j...

html - border-radius gets weird when property has different values for corners on IE lte 8 -

Image
i'm applying border-radius few elements on page, , in order make work on ie 6-8, i'm using pie . check out so can see, corners without values (or values different each other) border-radius, effect gets weird. here's code: .cotacao { -webkit-border-radius: 1px 20px 1px 20px; -moz-border-radius: 1px 20px 1px 20px; border-radius: 1px 20px 1px 20px; border: 10px solid #fff; } and specific code ie .cotacao { behavior:url(/assets/css/common/pie.htc); position: relative !important; } what's going on? bug related border thickness? and, if is, there known workaround? thanks! this bug in pie 1.0 code. see https://github.com/lojjic/pie/issues/11 it's fixed in 2.0 beta if you're willing try that.

android - How get getTime and battery level In my graph? -

i'm working create chart of battery usage.. i'm using graphviews library , i'm studing how works. right in original example code there part: exampleseries1.resetdata(new graphviewdata[] { new graphviewdata(0, getrandom()) , new graphviewdata(2, getrandom()) , new graphviewdata(2.5, getrandom()) // frequency , new graphviewdata(3, getrandom()) , new graphviewdata(4, getrandom()) , new graphviewdata(5, getrandom()) what need instead like: exampleseries1.resetdata(new graphviewdata[] { new graphviewdata(gettime(), getlevel()) , new graphviewdata(gettime(), getlevel()) , new graphviewdata(gettime(), getlevel()) // frequency , new graphviewdata(gettime(), getlevel()) , new graphviewdata(gettime(), getlevel()) , new graphviewdata(gettime(), getlevel()) because need battery level , time(current time) , result like: graphviewdata((new graphviewdata...