Posts

Showing posts from August, 2013

workflow foundation 4 - Using OutArgument in Definition of another Activity -

i'm creating workflow can call custom activity called post webrequest , return response xmldoc. tried return dynamic didn't work. want take specific value in xml doc , add post dada of next post call chain calls together. can't figure out how response data first post post data of second post. appreciated. variable<xmldocument> output1 = new variable<xmldocument>(); activitybuilder ab1 = new activitybuilder(); ab1.name = "customworkflow"; ab1.implementation = new sequence { activities = { new post() { postdata = "<xml></xml>", endpoint = "www.test.co

doctrine2 - ZF2 - set selected value on Select Element -

i've problem dropdown list zend framework 2 & doctrine. put "selected" attribute on dropdown list options pass selected my code : controller : public function editaction() { // error message during addaction $this->layout()->setvariable("messageerror", $this->flashmessenger()->geterrormessages()); $auth = $this->getauthservice(); if ($auth->hasidentity()){ $builder = new annotationbuilder(); // id of staticcontent $id = (int)$this->getevent()->getroutematch()->getparam('id'); if (!$id) { $this->flashmessenger()->adderrormessage("aucun plan choisi !"); return $this->redirect()->toroute('admin/plans'); } $plan = $this->getentitymanager()->getrepository("admin\entity\plan")->find((int)$id); $form = $builder->createform($plan); // find options localite list (<

symfony - filters in twig call -

how call function function filter filter? eg public function getfilters()      {          return array (              'test' => new \ twig_filter_method ($this, 'test'),              'test1' => new \ twig_filter_method ($this, 'test1', array('is_safe' => array('html')))          );      } public function test($test) { return; } public function test1($test) { // how test call? } thanks , sorry english from twig template can this: {{ 'some string'|test|test1('argument')}} inside twig extension class can call test function regular php object function: public function test1($test) { // code $testresult = $this->test($test); }

c# - ASP.net WebApi Parameter Binding to complex type from URI -

i want create rest webservice using asp.net webapi on .net 4.5 urls should of format this: /values?age=55&height=176&race=1&weight=80&gender=male&id=800001 the associated controller looks this: [httpget] public string get(int id, [fromuri]demographics demographics) { // etc.} where demographics custom object dto properties. however, contains 1 property has type of custom enum: enum gender { female = 0, male } the default mapping works fine if url of above format. however, of course need check whether parameters provided url correct. asp.net webapi (afaik) per default tries map each parameter based on assumed type (or if can converted type). if can't find matching value in uri appears assume 0. now takes me unfortunate situation 0 definition still valid value gender demographics.gender (0 ~ gender.female). the simplest solution change enum 0 "indeterminate" state check for. however, can not change enum. create own overload demo

c++ - glm translate matrix does not translate the vector -

i have crossed simple error while started using glm (in vs2010). have got short code: glm::mat4 translate = glm::translate(glm::mat4(1.f), glm::vec3(2.f, 0.f, 0.f)); glm::vec4 vector(1.f,1.f,1.f,0.f); glm::vec4 transformedvector = translate * vector; the result of transformedvector same original value (1.f, 1.f, 1.f, 0.f). not know missing here. have tried rotation matrix , working fine, point transformated correctly. glm::mat4 rotate = glm::rotate(glm::mat4(1.f), 90.f, glm::vec3(0.f, 0.f, 1.f)); glm::vec4 vector(1.f, 1.f, 1.f, 0.f); glm::vec4 transformedvector = rotate * vector; ok, have found out problem. translate vertex not vector, in case had set w value 1. you're forgetting projective coordinates. last component of glm::vec4 vector should 1. correction doing this: glm::mat4 translate = glm::translate(glm::mat4(1.f), glm::vec3(2.f, 0.f, 0.f)); glm::vec4 vector(1.f,1.f,1.f,1.f); glm::vec4 transformedvector = translate * vector; this due way project

How do I Design and Interface (OOP kind) in Java so that I can either use direct database access or use web services? -

at moment have query database not own has web service, provide get. since in house (sort of), might able direct access in future can better data in query. i don't want have write again , again. if did in java write interface (programming kind, think implements interface, oop)? how this? or write whole new class , "plug in." this regular client/server architecture. http request, server calls servlet or jsp, returns data. i'm not sure if idea correct design or not. definitely sounds should use interface different implementations here. like: public interface dataaccess { data getdata(); } then can code against api , plugin/inject different implementation needed. have this: public class directdataaccess implements dataaccess { public data getdata() { //use jdbc, orm, or similar } } or this: public class webservicedataaccess implements dataaccess { public data getdata() { //call web service } } but lon

Using PHP file_get_contents with xml -

i'm not sure if xampp setup causing issue have got php page creating sample xml data seen below: $xml = new simplexmlelement('<product/>'); $xml->addchild("price", "us dollars"); $xml->addchild("test","123123"); header("content-type: text/xml; charset=utf-8"); echo $xml->asxml(); this renders xml onscreen perfectly. when come read page using following: $xml = simplexml_load_file("api.xml"); echo $xml->price; so have checked file firstly using file_get_contents("xml.php"); but returns php code rather output of code. have resolved using xml.php write file called feed.xml works fine wondering why file_get_contents("xml.php"); returned code rather parsed output. have used wrong method check file contents or setup issue xampp? thank in advance. the reason isn't working file_get_contents is: ...the preferred way read contents of file string. it d

java - JAAS - How to authenticate user in web tier? -

i'm trying understand how secure java ee applications using jaas. actually understand how work rules in ejbs, however, don't understand how authenticate user in web tier, example create simple jsf page login form, check given user name & password using db , in case of success how set principal user inside application. what common way doing this? i'd have as-independent solution possible. jaas not universal standard this. in fact, jaas login modules little ill-suited java ee authentication. full jaas model created java applications running locally, shielding code bases each other (e.g. specific jar allowed read file system). it's rare java ee server run untrusted code, of functionality jaas offers not used. two articles topic following: jaas in enterprise whatever happened jaas? what common way doing this? unfortunately common using specific thing. terminology "thing" specific too. can called "realm", "securi

How to query for the number of shares of a Facebook event URL? -

one of facebook apps allows users share url facebook event using default facebook sharer. under impression can query number of times such url got shared on facebook. however, when query graph api popular events on facebook results show me 0 shares, likes , comments. e.g. select click_count, comment_count, comments_fbid, commentsbox_count, like_count, normalized_url, share_count, total_count, url link_stat url = 'http://www.facebook.com/events/385623724876261' returns { "data": [ { "click_count": 0, "comment_count": 0, "comments_fbid": null, "commentsbox_count": 0, "like_count": 0, "normalized_url": "http://www.facebook.com/events/385623724876261", "share_count": 0, "total_count": 0, "url": "http://www.facebook.com/events/385623724876261" } ] } how can query facebook real nu

c# - ASP.NET Mvc Best Way to get List<SelectListItem> From EntityContext? -

i using entityframework dataaccess view dropdownlist of countries enduser in asp.net mvc webapplication. it not hard thing achieve have little struggle find looking way. but first of code: <td> @html.dropdownlistfor(x => x.parentid, repos.getparents(@model.parentid) </td> somewhere deep in real code: class dummy { public string text { get; set; } public int value { get; set; } } private selectlist _parents; public selectlist parents { { if (_parents == null) { var parents = entities.instance.partners.select(x => new dummy() { text = x.name, value = x.id }).orderby(x => x.text).tolist(); parents.insert(0, new dummy()); _parents = new selectlist(parents, "value", "text"); } return _parents; } } public selectlist getparents(int? parentid) { if (parentid

Cell arrays in MATLAB -

i know cell array is. came following line: cell_array = cell([], 1); what mean? how can read above line? thanks. so makes 0x1 empty cell array. in literally 0 rows , 1 column. make 0x0 cell array this: cell_array = {} which makes sense me. if can't preallocate before loop, it's useful concatenate onto or go cell_array(end) = ... in loop. i don't know why you'd prefer 0x1 this question shows how differs 0x0. mean, if weird reason running loop on empty array know run @ least once :/ that's scraping barrel reason. think stick = {} . edit: as @radarhead points out, 1 way preset number of columns if plan on concatenating new rows in loop.

sql server - Cannot get hours to total over 24, eg 48 hours in hh:mm:ss output -

i running query find out total amount of time user has been browsing for. each browsing session stored in db seconds , sum total seconds , convert hh:mm:ss. problem when i'm converting seconds hh:mm:ss . want display example '78:20:00' dont know how code total this. when gets past 24 hrs hrs column goes 00 because day. the query run convert time can seen below: select username, convert(varchar(12),dateadd(second,totaltimeinseconds,0),108) totalhours #totalsessiontime select username, cast(totaltimeinseconds / (60 * 60) varchar) + ':' + cast(totaltimeinseconds % (60 * 60) / 60 varchar) + ':' + cast(totaltimeinseconds % (60) varchar) totalhours #totalsessiontime if want minutes , seconds 2 digits, you'll have left pad them, make ugly example, work fine.

graph - Using findpeaks and minpeakdistance in MATLAB to find peaks separated by distance rather than index -

Image
i'm trying x-coordinates of peaks in matlab figure (example attached). i've been using findpeaks , doesn't seem fact i'm plotting points rather lines. i won't have 2 peaks. i'll have three, i'll have one. multiple peaks separated @ least 1/4 of range of x, , peaks @ least twice noise level. here's expect work: [pks,locs] = findpeaks(ydata,... 'sortstr','descend',... 'minpeakdistance',floor(range(xdata)/4),... 'minpeakheight',floor(max(ydata)/2)... ) instead of getting 2 peaks, 4 bundled around first peak: >> locs locs = 6774 166785 326792 486799 >> xdata(locs) ans = -96780.787939025 -96770.1800919265 -96770.8959353367 -96771.6117787468 i assume minpeakdistance working on in xdata indices rather data itself. how use distances between peaks instead of distance betwe

java - Adjust Fairness in Multithreading -

how can adjust fairness between given k threads generate output? in other words imagine have k threads printing "1" , n threads printing "2". how can put fairness between threads each thread print(for example "1") as other (k - 1) print(for example "1").and same n thread printing "2". before create threads, create array[0..numthreads-1] of empty semaphores, 1 each thread going create. signal each thread on creation incrementing semaphore index, 0..numthreads-1. in thread function, have wait on semaphore[index], print something, signal [(index+1) mod numthreads] semaphore, loop round wait on semaphore[index] again. once have done that, nothing should happen @ all. throw in 1 semaphore unit, anywhere.

web crawler - Google Apps Script Bot repeatedly crawling website each minute -

just hour ago, started tailing apache log file (access logs), , since then, ve noticed weird user agent, (couldnt find google's official docs). i m feeling suspicious it, since couldnt find on google's site user agent, ("mozilla/5.0 (compatible; googleapps script; +http://script.google.com/bot.html)) it has crawling login page of our site, every minute, whole day. here's log snippet: 72.14.199.55 - - [07/aug/2013:16:06:28 +0000] "get / http/1.1" 302 639 "-" "mozilla/5.0 (compatible; googleapps script; +http://script.google.com/bot.html)" 72.14.199.55 - - [07/aug/2013:16:06:28 +0000] "get /accounts/login/ http/1.1" 200 3780 "-" "mozilla/5.0 (compatible; googleapps script; +http://script.google.com/bot.html)" and has been same ip. , still is, is common see pattern of crawling? google apps scripts allow users write javascript based code , set them run @ specified intervals google'

xslt - Wmic /format switch invalid XSL? -

Image
i have quick question, should relatively simple have more experience in wmi-command processor (and since i'm absolute beginner thats not hard :-) ) i fail understand why wmic /format switch works way does. open cmd.exe , type wmic process list brief /format:htable > processlist.html this want , no bothers further on. whereas if go wmic processor, , try execute same command above... wmic:root\cli>process list brief /format:htable > processlist.html i receive error tag: "invalid xsl format (or) file name." here goes screenshot. note have copied xsl files wbem sys32 dir can explain me why these 2 commands me same, difference 1 executed outside wmic environment , other 1 inside, latter 1 doesn't work? fail understand it. please advise can comprehend bit better! :-) you attempting use cmd.exe > redirection while within interactive wmic context. can't work. you can use wmic /output:filename switch while in interactive mode.

c++ - virtual member functions are good or bad for locality in modern CPUs? -

considering new cpus new instructions moving , new memory controllers, if in c++ have vector of derived objects derived composed of virtual member functions, or bad thing locality ? and if have vector of pointers base class base* store references derived objects 1-2-3 level base ? basically dynamic typing applies both cases, 1 better caching , memory access ? i have preference between 2 see complete answer on subject. there new consider ground-braking hardware industry in last 2-3 years ? storing derived rather base * in vector better because eliminates 1 level of indirection , have objects laid out «together» in continuous memory, in turn makes life easier hardware prefetcher, helps paging, tlb misses, etc. however, if this, make sure don't introduce slicing problem. as virtual dispatch in case, not matter exception of adjustment required «this» pointer. example, if derived overrides virtual function calling , have pointer devied * , «this» adjustmen

ruby on rails - Displaying Png image using Barby Barcode generator -

i using barby , png outputter. have gotten compile fine, not sure how can display image. here code.. controller: @barcode = barby::code128b.new(@num) @blob = barby::pngoutputter.new(@barcode).to_png #raw png data file.open('barcode.png', 'w'){|f| f.write @blob } application helper: require 'barby' require 'barby/barcode/code_128' require 'barby/outputter/png_outputter' view: <%= @blob %> since @blob image data, can't "print" regular string. need use image_tag instead, , give path image. like: <%= image_tag("barcode.png") %>

need to create multiple dynamic arrays in c++ -

i need create number of arrays of object number need dependent on separate variable best way explain psudo code example: int num = 4; for(int i=0;i<num;i++){ object_type arrayi [dynamic size]; } so need 4 arrays each names array0,array1,array2, , array3 , must dynamic arrays. there anyway in c++? std::array<std::vector<object_type>, 4> array; (auto & v : array) v.resize(dynamic_size); the names array[0] , array[1] , etc... instead of array1 , array2 , etc... cares? if absolutely must have names, cassio's answer best bet. pre c++11 alternative: std::vector<object_type> array[4]; (size_t i=0; i<4; ++i) array[i].resize(dynamic_size); if want variable number of arrays, can use vector of vectors, , actually, initialization easier. doesn't require loop, can in constructor. std::vector<std::vector<object_type>> array(num, std::vector<object_type>(dynamic_size));

ruby - Kernel# gets stuck and Kernel#system does not when issuing gzip without any options -

long story short, i've been working on project , noticed when use: 1.9.3p392 :001 > `gzip` irb::abort: abort interrupt! (irb):1:in `call' (irb):1:in ``' (irb):1 /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `<main>' it wait indefinitely until ctrl + c. although, when use: 1.9.3p392 :047 > system('gzip') gzip: compressed data not written terminal. use -f force compression. help, type: gzip -h => false it continue without me using ctrl + c why using backticks stop process continuing? the backticks operator implicitly redirects standard output of resulting subshell (which capture subshell's output) while system doesn't. can observe same hang using system follows: system('gzip > /tmp/foo') this explicitly captures standard output , hang in same way. when gzip has output redirected wait input until eof or other signal received. without output redirection issue error message me

matlab - segmenting human point cloud into 6 main parts -

i have point cloud of human , want segemnt 6 main parts including: hands, feet, head, ... how can using opencv or pcl library or matlab? segmentation or clustring algurithm can use? i think, graph cut algorithms may intresting you, try search phrase: "graph cut mesh segmentation". , here: http://people.cs.umass.edu/~kalo/papers/labelmeshes/

android - changed closed error while doing git push -

i trying push changes git project , had amend changes local commits, rebased onto merged change 400918 (otherwise wouldn’t allow me set edit option, not sure if there other way) ,made changes , when try push running following error,i tried rebase on changes,its still not working,any inputs here? user{90}> git push ssh://company.com:29418/project head:refs/for/branch counting objects: 43020, done. delta compression using 32 threads. compressing objects: 100% (4374/4374), done. writing objects: 100% (5359/5359), 6.22 mib | 8.17 mib/s, done. total 5359 (delta 1534), reused 2435 (delta 863) remote: resolving deltas: 100% (1534/1534) remote: processing changes: refs: 1, done ssh://company.com:29418/project ! [remote rejected] head -> refs/for/branch (change 400918 closed) use $git stash to reset code previous head. please take backup of code somewhere else because undo changes since last commit. after running git stash; repo

python - Dictionaries containing the biggest values -

i have scipy csr_matrix: (0, 12114) 0.272571581001 (0, 12001) 0.0598986479579 (0, 11998) 0.137415042369 (0, 11132) 0.0681428952502 (0, 10412) 0.0681428952502 (1, 10096) 0.0990242494495 (1, 10085) 0.216197045661 (1, 9105) 0.1362857905 (1, 8925) 0.042670696769 (1, 8660) 0.0598986479579 (2, 6577) 0.119797295916 (2, 6491) 0.0985172979468 (3, 6178) 0.1362857905 (3, 5286) 0.119797295916 (3, 5147) 0.270246307076 (3, 4466) 0.0540492614153 (4, 3810) 0.0540492614153 (4, 3773) 0.0495121247248 and find way create (in case 4) dictionaries each dictionary contains 2 biggest values each row.. so example, row 0 dictionary be: dict0 = {12114: '0.27257158100111998', 11998: '0.137415042369'} and row 1: dict1 = {10085: '0.216197045661', 9105: '0.1362857905'} since csr_matrix not have sort() method, convenient transform row need array first: a = m[i,:].toarray().flatten() to positions of sorted columns: arg

c# - Get the value of the checked item inside the gridview -

i have gridview defined <asp:gridview id="gv1" runat="server" autopostback="true" onselectedindexchanged="gv1_selectedindexchanged"> <columns> <asp:templatefield> <itemtemplate> <asp:checkbox id="chk1" runat="server" /> <asp:boundfield datafield="name" headertext="name" sortexpression="name" readonly="true" /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> the code handled protected void gv1_selectedindexchanged(object sender, eventargs e) { foreach(gridviewrow row in gv1.rows) { checkbox check1 = (checkbox)row.findcontrol("chk1"); if(check1 != null && check1.checked) { label1.text = row.cells[1].text; } } } the desired column @ index 1 however, value

javascript - Add custom image to items on Ext.tab.Panel -

i want add customs images on navigation items on ext.tab.panel . i know, there few images available if use iconcls . items: [ { title: 'home', iconcls: 'home', html: 'home screen' }, { title: 'contact', iconcls: 'user', html: 'contact screen' } ] how can proceed? there image property or else, or have write own css classes? css way, or use of icons included in core, there lot :) view: iconcls: 'mytab' css: .mytab { background-image: url("resources/images/mytab.png"); }

php - Merging an array with DataProvider data items -

i have 2 tables in yii application; category , item . category - id - name item - id - category_id - name what list of items in category table , subsequently count number of items of each category in item table. i'm using cactivedataprovider retrieve list of items in the category table , subsequently use for-loop count number of items in each category. however, can't seem figure out how merge array dataprovider data items. here code far. public function actionindex() { $dataprovider = new cactivedataprovider('category', array( 'criteria' => array( 'select' => 'id, name, slug', 'order' => 'name asc', ), )); $dataprovider->setpagination(false); $count = array(); foreach($dataprovider->getdata() $categorydata) { $count[] = item::model()->count("category_id = :categoryid", array("categoryid" => $categorydata-&

plot - 'x' and 'y' lengths differ in R -

i trying plot horizontal line in r, giving me error. code: w <- seq(1, 99, by=1) alpha <- 0.1 beta <- 0.001 u <- alpha*w -(beta/2)*w*w uprime <- alpha -(beta)*w udprime <- -beta utprime <- 0 plot(w,udprime,type = "l",main = "graph of u(w) versus wealth",xlab = "wealth",ylab = "utility function") when plot function out, error: error in xy.coords(x, y, xlabel, ylabel, log) : 'x' , 'y' lengths differ why so? need guidance. to plot horizontal line second derivative of wealth utility function, you'll need make sure udprime has point every point w . there's 2 ways this: shortcut: plot(cbind(w, udprime)) more "true math": udprime = -beta * w^0

java - Trim trailing space in jasypt EncryptablePropertyPlaceholderConfigurer -

we using spring along jasypt encryptablepropertyplaceholderconfigurer read application.properties file. the problem happen if of properties value contain white-spaces in end, on reading value using @value(${}) tag, trailing space in end creates problems. now class encryptablepropertyplaceholderconfigurer final can't extended , searched lot figure out if way properties after trimming of white-spaces around string value. can suggest how handle scenario? you can create encryptablepropertyplaceholderconfigurer custom stringencryptor passed in constructor. in customstringencryptor.decrypt() trim(). (in case don't know property decrypting) you can bypass final delegation: class customstringencryptor implements stringencryptor{ private stringencryptor delegate; public customstringencryptor(standardpbestringencryptor delegate){ this.delegate = delegate; } string decrypt(string encryptedmessage){ string message = this.delegate.decrypt(encrypte

testing - Providing a third party with testable web services -

the applications follows, seen point of view: the application making (lets call app1), , 2 third parties, app2 , app3. app2 : wants consume simplified web services app1 app1 : i'm at. services app3 handled nicely here already, nice, clean internal api easy usage. app3 : third party service provider. complex services. important point: has no test environment, ever against done production data (although separate test account). if screw here, things happen real people in real world. lack of real test environment not in control. app3 provides application, app1, web services. app2 wants me "forward" services in simpler manner, don't have reimplement complexities i've handled. app2, consuming web services, needs have testable version of services use while implementing side, handle different use cases themselves. how can implemented smooth possible? internally, relevant parts of existing application looks this: presentation + web services (web applic

Grep --exclude-dir (root directory only) -

i'm trying setup grep command, searches current directory, excludes directory, if it's root directory. so following directories, want #1 excluded, , #2 included 1) vendor/phpunit 2) app/views/vendor i started below command grep -ir --exclude-dir=vendor keywords * i tried using ^vendor, ^vendor/, ^vendor/ , ^vendor , nothing seems work. is there way grep? looking try 1 grep call, if have to, can pipe results second grep. with pipes: grep -ir keywords * | grep -v '^vendor/' the problem exclude-dir is, tests name of directory , not path before going it, not possible distinguish between 2 vendor directories based on depths.

c# - Border.IsMouseOver in RichTextBox ( InlineUIContainer in RichTextBox does not respond to event/trigger ) -

say have following: <grid> <grid.resources> <style targettype="{x:type border}"> <style.triggers> <trigger property="border.ismouseover" value="true"> <setter property="background" value="black" /> <setter property="borderbrush" value="red" /> <setter property="borderthickness" value="2" /> <setter property="cornerradius" value="7,2,10,2" /> </trigger> <trigger property="border.ismouseover" value="false"> <setter property="background" value="black" /> <setter property="borderbrush" value="royalblue" /> <setter property=&quo

vb.net - String variable shows as empty but length shows it to not be -

i'm using vb.net visual studio 2008 test fixture, writing , reading 4 usb virtual serial ports using serialport class. the odd thing that's happening that, looking @ code below, receivedstring shows, on mouseover, "" or empty yet receivedstringlength says 37. how possible? both variables declared locally in private sub. has encountered situation , bug in visual studio 2008? receivedstring = serialportmaestro.readexisting receivedstringlength = len(receivedstring) .net uses bstrings , length-prefixed , null-terminated. if first character in recievedstring null character ( '\0' ), not printed, since strings end @ first null character.

c# - HTTP POST with Facebook Captcha -

i'm trying facebook captcha image in c# , display in app , send response facebook. app works fine communicates facebook after while asks captcha. incorporated functionality entering captcha , when send facebook using webclient sens captcha in response. have double checked temperdata inn firefox i'm setting correct header information , fields, still i'm not being redirected right page. matter of fact in response header 1 field see missing compare temperdata. req = (httpwebrequest)webrequest.create("https://www.facebook.com/recover/initiate"); req.host = "www.facebook.com"; req.cookiecontainer = cookies; req.method = "get"; req.useragent = "mozilla/5.0 (windows nt 6.2; wow64; rv:22.0) gecko/20100101 firefenter code hereox/22.0"; req.keepalive = true; resp = req.getresponse(); streamreader = new streamreader(resp.getresponsestream()); s = streamreader.readtoend().trim(); inde

sql - MySQL MD5 hash to base64 -

i have mysql db stores users info (username, pass, etc). building ldap server back-sql , works fine except password field. passwords basic md5 hashes so select md5('testpass01') returns 428a65ed9de7dbf8ef7d08f884528440 apparently hexpair representation of binary value. ldap understand base64 encoded string this {md5}qopl7z3n2/jvfqj4hfkeqa== i found perl script conversion #!/usr/bin/perl use mime::base64; use strict; @md5 = split "",$argv[0]; @res; (my $i = 0 ; $i < 32 ; $i+=2) { $c = (((hex $md5[$i]) << 4) % 255) | (hex $md5[$i+1]); $res[$i/2] = chr $c; print $c; } print "{md5}".encode_base64(join "", @res); #-------------------------------------------# my question is: possible conversion using sql through stored procedure? cannot install mysql server 5.6 includes base64 encode , decode functions thanks it works perfectly. using function in comments produce base64 password ldap accept. select base64_encode(

java - How to use the URL http://localhost:8080/appcontext/META-INF/index.html? -

i have example application running locally http://localhost:8080/appcontext (the context /appcontext ). now when http://localhost:8080/appcontext/meta-inf/index.html accessed in browser want display text hello, world! . code servlet mappings this how tried map servlet /meta-inf url. didn't work: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" > <servlet> <servlet-name>myservlet</servlet-name> <servlet-class>com.example.mapmetainf.myservlet</servlet-class> </servlet> <!-- <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>/meta-inf/index.html</url-pat

Code crashed after upgraded from Meteor Windows 0.5.4 to Meteor 0.6.4.1 -

i upgraded windows meteor 0.5.4 0.6.4.1. on windows 7. after upgrade working code crashed following error messages: errors prevented startup: exception while bundling application: typeerror: cannot read property 'raw' of undefined @ c:\program files (x86)\meteor\packages\meteor\package.js:15:15 @ _.extend.add_file (c:\program files (x86)\meteor\app\lib\bundler.js:201:5) @ self.api.add_files (c:\program files (x86)\meteor\app\lib\bundler.js:102:16) @ array.foreach (native) @ function. .each. .foreach (c:\program files (x86) \meteor\lib\node_modules\underscore\underscore.js:78:11) @ self.api.add_files (c:\program files (x86)\meteor\app\lib\bundler.js:101:11) @ array.foreach (native) @ function. .each. .foreach (c:\program files (x86) \meteor\lib\node_modules\underscore\underscore.js:78:11) @ object.self.api.add_files (c:\program files (x86)\meteor\app\lib\bundler.js:100:9) @ null.on_use_handler (c:\program files (x86)\m

cocoa touch - When I "ctrl click and drag" in xcode interface builder, it says "File Owner" rather than my custom UIView -

when did earlier uilable, "referencingoutlet" custom uiview (called locdebugview). when now, either original uilabel or new one, says "file's owner". when try run code "file's owner", crashes, saying "his class not key value coding-compliant key npcsview.'" or whatever try name new variable. what happened? changed? how can fix it? okay, have no idea changed, figured out how fix it. when click , drag on onto objective c class , click "object" drop down can select correct object rather apparent default of "file's owner" didn't work.

crystal reports 2008 - Browse field data shows value, but displays another value -

i have formula written field in crystal reports. when refresh report, different value formula. required value last value in browse field data dialog formula. isnt formula supposed have 1 value output? why multiple values shown in browse field data dialog.? there way retrieve last value of browse file data dialog? my formula looks below: whilereadingrecords; numbervar codtotal; if {xxx.yyy} = 1 ( codtotal := codtotal + {xxx.zzz}; ); codtotal; browse field data shows values "codtotal" acquires result of formula , displays random value amongst assigned value. please me out. amateur in crystal reports. any highly appreciated. ~regards. first observation should have placed formula (details, footer.. etc). why multiple values shown in browse field data dialog.? browse field shows data present in table in case applying "if" condition of filed. can possible there 1 record satisfies condition. i suggest run report without codition, check r

uri - How to start new activity by clicking Link in TextView -

i have viewactivity textview in wich set spanned text resource txt file. viewactivity: spanned textsp = android.text.html.fromhtml(text); tvtv = (textview)findviewbyid(r.id.tvtv); tvtv.settext(textsp); linkify.addlinks(tvtv, linkify.web_urls); i create link id information written in article handle textview link click in android app . necessary clicking on link, download secondacitvity (with other textview) of application (not browser). secondactivity: protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.statya); //пытаемся перейти со ссылки uri data = getintent().getdata(); string data2 = data.getlastpathsegment(); textview tvstatya = (textview)findviewbyid(r.id.tvstatya); tvstatya.settext(data2); } } put onclick in xml this <textview android:id="@+id/name" android:layout_width="

r - Error when plotting HoltWinters graph -

the following r code giving me error when trying plot holtwinters graph done here : # init x x11() # data mydata = read.csv("lookup.csv", header=true, stringsasfactors=false) # data post-proc mydata = as.data.frame(mydata) mydata$time = as.posixlt(mydata$time, format='%d.%m.%y %h:%m:%s') # create time series - hourly data -> 8765 hours/year datatimeseries <- ts(mydata$close, frequency=8765) dataforecasts = holtwinters(datatimeseries, beta=false, gamma=false) # output plot.ts(dataforecasts) message("press return continue") invisible(readlines("stdin", n=1)) the error i'm getting is: $ rscript simple_forecast.r error in xy.coords(x, null, log = log) : (list) object cannot coerced type 'double' calls: plot.ts -> plotts -> xy.coords execution halted i'm quite perplexed, since print(dataforecasts) prints correct data. can plot datatimeseries withou

playframework - play logging level for logback -

i'm trying set logging level debug in play application. i able create logger.xml file , place in conf directory , see debug statements printed out after run sbt run , clicks on app, run through code debug statements. on other hand, when package app sbt dist , don't see output application when code debug logging executed. i can see, logger.xml on classpath, part of 1 of jars in lib directory. what need set able configure logging packaged application? interesting, we've never tried running our apps logger file baked in. we've run having logger settings file on box , passing in param when starting app using -dlogger.file option described here: http://www.playframework.com/documentation/2.1.3/settingslogger you don't happen have passing argument in @ runtime overriding 1 on classpath? per doc ( http://www.playframework.com/documentation/2.1.3/configuration ) , accepted java standard, passed in property take priority on compiled with. you m

java - JDeveloper Heap Out of Memory -

i getting following error when open particular project in jdeveloper uncaught exception java.lang.outofmemoryerror: java heap space j.util.arrays.copyof(arrays.java:2882) j.lang.abstractstringbuilder.expandcapacity(abstractstringbuilder.java:100) j.lang.abstractstringbuilder.append(abstractstringbuilder.java:390) j.lang.stringbuffer.append(stringbuffer.java:224) org.tmatesoft.svn.core.svnerrormessage.getfullmessage(svnerrormessage.java:257) org.tmatesoft.svn.core.internal.wc.svnerrormanager.error(svnerrormanager.java:58) org.tmatesoft.svn.core.internal.wc.admin.svnadminareafactory.open(svnadminareafactory.java:163) org.tmatesoft.svn.core.internal.wc.admin.svnwcaccess.doopen(svnwcaccess.java:364) org.tmatesoft.svn.core.internal.wc.admin.svnwcaccess.open(svnwcaccess.java:272) org.tmatesoft.svn.core.internal.wc.admin.svnwcaccess.open(svnwcaccess.java:265) org.tmatesoft.svn.core.internal.wc.admin.svnwcaccess.openanchor(svnwcaccess.java:145) org.tmatesoft.svn.c

ios - How can I make a simple pull to refresh control without any libraries? -

i'm using core animation make moon-orbiting-earth animation, , use activity indicator of sorts in pull-to-refresh controller on uitableview. the problem is, cannot make custom activity indicator core animation- sequences of images allowed. since cannot use subclassed/modified uiactivityindicatorview, can't use apple's uirefreshcontrol (pull refresh) , need make own. i aware uitableview has header property using, not sure how load view header upscreen, make elastic effect, , monitor/change table position programmatically callback.

html - will_paginate pagination controls are not horizontally aligned -

i'm using sample code , css provided will_paginate gem provide nicely formatted pagination control on page. however, controls won't align horizontally. instead, stacked vertically , centered on page. how can them on 1 horizontal line? the sample code from: http://mislav.uniqpath.com/will_paginate/ html is: <div class="apple_pagination"> <div class="page_info"> <%= page_entries_info @feeds %> </div> <%= will_paginate @feeds, :container => false %> </div> css is: .apple_pagination { background: #f1f1f1; border: 1px solid #e5e5e5; text-align: center; padding: 1em; cursor: default; li { list-style: none; } } .apple_pagination a, .apple_pagination span { padding: 0.2em 0.3em; } .apple_pagination .disabled { color: #aaaaaa; } .apple_pagination .current { font-style: normal; font-weight: bold; background-color: #bebebe; display: inline-block; width: 1.4em; height: 1.4

java - Count tables in H2 Database with OrmLite -

is there way number of tables in h2 database when using ormlite? i'm looking like: mysql> show tables; for ormlite. is there way number of tables in h2 database when using ormlite? ormlite has pretty online manual. if have looked in index under "raw queries" have found following: http://ormlite.com/docs/raw-queries there lot of detail there can following using dao.queryraw(...) method . genericrawresults<string[]> results = dao.queryraw("show tables;");

msiexec - Programatically install Python msi application from a Python script -

how can programmatically install python msi that's on location: x:\install\python-3.3.2.msi i know can use subprocess.call() or popen() that, don't know how make other parameters automatically set. make program available users, etc. what trying run msi application python script every time run script, installs python-3.3.2.msi on machine script ran for. now new question whether python msi installer supports silent installation. want installation to, in fact, silent, i.e. installer "knows" parameters command line call , no user interaction necessary @ all. please @ viktor kerkez's comment below , let me know if that's how too. is possible tell necessary parameters via command line? normally every designed msi can installed silently. given standard command line should tried out, other optional parameters maybe targetdir directory etc. the msiexec parameters "/quiet" , "/qn" same, don't use them both. the main

html - PHP/MYSQL Averaging each row -

i have form x amount of columns labeled c1, c2, c3..to cx. have column labeled "average" , labeled "target". "average" column finds average of each row in columns c1 - cx. possible "average" column dynamically change while user filling in form? if so, how? if not possible, how have "average" column update value upon submitting form edited c1-cx values? just looking tips on how deal averages. have working c1-cx columns pre-defined fields save mysql database. add event handler triggers when of cx form field values have been changed (e.g. user changing value in it) , re-calculate average , display in average column. probably following, assuming cx forms inputs: document.getelementbyid("c1").addeventlistener("input", function(){ // time user changes value in form 'c1', // function called can re-calculate // new average , stuff... });

c# - How to change the text in the Clear Button from the SearchDisplayController on iPad with Xamarin.iOS? -

Image
i need change text shown "clear" button in search results shown in picture. the language set on ipad spanish, button text remains in english, that's why need change it. here same kind of question: remove or override "clear button" on uisearchdisplaycontroller in uipopovercontroller on ipad? here in answer, explained how add custom button in place of clear button. hope helps

java - How to see if a something in Graphics2D is off the frame -

i have paint method have draw rectangle , move across screen , want when rectangle goes off screen move start of jframe. assume if(rectangle.isoffthescreen){ put on screen } don't know how that. also, want know if can rect jframe frame = new jframe(); , rectangle. i'm sorry if confusing. @madprogrammer here @ far public class main extends jpanel { public static int place = -350; public rectangle rect; public int xdelta; public main() { rect = new rectangle(0, 75, 50, 50); xdelta = 4; timer timer = new timer(40, new actionlistener() { @override public void actionperformed(actionevent e) { rect.x += xdelta; if (rect.x + rect.width > getwidth() - 1) { rect.x = getwidth() - rect.width; xdelta *= -1; } else if (rect.x < 0) { rect.x = 0; xdelta *= -1; } repaint();

image processing - ArcPy Python script - Runtime Error: ERROR 010240: could not save raster dataset to C:\L_B2dpy with output format GRID -

i m working on script python , arcpy process landsat satellite images. near end of script of error @ same location each time. error occurs after 1 successful run of code (i.e. error occurs on second occurrence of same task) print "starting rt_b2dpy (2 of 4)" if arcpy.exists(rt_b2dpy): arcpy.delete_management(rt_b2dpy) rt_b2dpy = rt2 - 1 rt_b2dpy.save("rt_b2dpy") print "rt_b2dpy has been created" i have env.overwriteoutput set true not problem. i gave code friend run , got process 4 occurrences of block of code output blank. used there modified script (change path entries)and got error @ same location first one: exceptions.eoferror:[errno 10054] existing connection forcibly closed remote host this error crashed python , editor. the script produces grid first run, second 1 creates grid unreadable in arcgis. i m working windows virtual machine (parallels) on mac 8 gb of ram. virtual machine using 4 gb of ram. i have not clue going

MySQL rank calculation with all entries at 0 -

i have following sql script ranks set of users in leaderboard table. update leaderboard join (select f.winnings , if (@lastpoint <> f.winnings, @currank := @currank +1, @currank) rank, @lastpoint := f.winnings leaderboard f join (select @currank := 0, @lastpoint := 0) r f.competition =5 order f.winnings desc ) ranks on (ranks.winnings = leaderboard.winnings) set leaderboard.rank = ranks.rank leaderboard.id =89; however when users have rank of 0 not rank them 1 (i.e equal) behaviou occurs 0. winnings rank 0 0 0 0 0 0 would know how this..? winnings rank 0 1 0 1 0 1 sql fiddle http://sqlfiddle.com/#!2/53c3a/1 the <> test fails update leaderboard join (select f.winnings , if (@lastpoint <> f.winnings, @currank := @currank +1, @currank) rank, @lastpoint := f.winnings leaderboard f join (select @currank :=0, @lastpoint

javascript - How to display content depending on dropdown menue user selection -

i have dropdown menu @ bottom of form 6 different options. need display different content on div below menu depending on option selected. no additional content should visible until user select 1 of options , once user select 1 of options content associated specific option should visible. i need create functionality using javascript knowledge of javascript limited , don’t seem find need online. i believe need create 6 different divs(one each option) , toggle class makes them visilble once respective title selected. here dropdown menu have: <div class="field"> <label for="rolebox" data-label="i_am">{% trans %} main.i_am_title {% endtrans %}</label> <div class="f-wrapper"> <select class="cbx" tabindex="50" name="role"> <option value="student">a student</option> <option value="educator">an educat

audio - Record/capture internal sound playback of Android app and export mp3? -

is possible record internal sound generated app? my app allows create , play musical sequences. soundpool.play(soundids[i], 1f, 1f, 1, 0, constants.time_rate); i'd able record sequence , export mp3. i've looked audio capture setaudiosource (int audio_source) seems accept mic recording. thanks no, there's no api getting audio output, own app (actually that's not entirely true, because can through visualizer api, of such low quality doubt of use you). if want kind of functionality you'll have implement yourself. is; start playback of sounds, mix them , write result file well. if sounds compressed you'll have take case of decoding them yourself. note there's no mp3 encoder included android, you'd have supply own mp3 encoder anyway if that's format want export in.