Posts

Showing posts from June, 2014

Highcharts tooltip is hidden behind other charts -

when putting multiple charts tooltips upper charts hidden behind others. i found tips on how nothing helped. there anyway keep tooltips on top of charts? the example here: http://jsfiddle.net/zw3um/ thanks lot! this pure html : div element loaded after ( meaning appearing after on html page) in front. in order first chart tooltip in front of second : load second in first , set y position on page using absolute or relative position in css : i've change order, putting container2 in first in html: <div id="container2" style="height: 200px"></div> <div id="container1" style="height: 200px"></div> then set position of container2 under first 1 (thanks top style attribute) : div[id="container2"] { position:absolute; top:200px; } here result : http://jsfiddle.net/zw3um/3/

Wordpress AJAX request returning extra HTML tags -

Image
i using knews plugin subscribing website. working except ie8: in ie 8 error or success message not showing. think since ajaxed form getting ajax response unnecessary html tags. please see screenshot. provide in backend: <span class="error_subscription">please check e-mail address</span> but getting response on screenshot: <span class="error_subscription">please check e-mail address</span></p></div>

https - Can a hacker access the data in my first request even if SSL cert is invalid? -

this question in context of web-services. if invoke web-service on ssl alongwith required data service; ssl error, if ssl cert invalid, , wont make further requests. happened data sent in first request ? transmitted attacker ? can decrypt ? in typical website scenario hardly arises, our request server has hardly got private data - once server sends form, proceed confidenial data. thanks. ssl/tls established before data sent. consequently if there error, nothing sent , data safe.

ruby on rails 3 - Active record query relationship -

i have models called project , gold_task , submissions . relationship goes this: project has_many gold_tasks gold_tasks has_many submissions how can submissions of gold_task through project id. i tried in below way p.gold_tasks.joins(:submissions) here i'm getting gold_tasks need submissions. thanks in advance. i believe question right here "how can submissions of gold_task through project id?" if have set rails associations correctly, should able this: @project = project.find(1) @gold_tasks = @project.gold_tasks rails automatically rows in gold_tasks table rows project id of 1 , return array of finds. furthermore, building objects easy well. let's assume have project row again: @project = project.find(1) @gold_task = @project.gold_task.build(hash) this build new gold_task parameter hash , assign @project id it. check out guide: http://guides.rubyonrails.org/association_basics.html

is there a panorama or pivot UI control on android similar to the ones on windows phone 7? -

does know if there ui widget out there android windows phone 7 panorama or pivot controls? if not, there tutorial guide me down right path in implementing own? any appreciated. thanks. yes, interested in pivot controls also. here's best working resource i've found pivot-like functionality: http://viewpagerindicator.com/ or, if see official android developers' guide this, called viewpager: http://developer.android.com/reference/android/support/v4/app/fragmentpageradapter.html

jquery - How to make image fit in the edge? html5 canvas javascript -

Image
http://i.stack.imgur.com/4oayt.png this original when not insert image. has blank image http://i.stack.imgur.com/aupwr.png i want know how make image curve fit edge (in red circle image fit in edge). what framework can this? raphaeljs fabricjs kineticjs thank me. sorry bad english. best regard. around square corner you can use shearing transforms give illusion rectangular image being shaped around corners. shearing transforms how put rectangular logo image on rectangular “3d” box. “shearing” effects can use of libraries mention…or use canvas itself. , shearing effects give sharp creased edge transforms rather curved transforms. here’s example: http://www.createjs.com/#!/easeljs/demos/transform around curved corner but curved transforms, need webgl or image processing library perspective transforms. check out server based imagemagick tool , in particular @ 3d boxes, perspective layering section on page: http://www.imagemagick.org/usage/distort

JQuery simplemodal autoposition fails when focused on a textbox in webkit -

i'm using simplemodal 1.4.4 , has strange behavior when open page on ipad. the modal has autoposition set true. when loads, shows modal centered successfully. inside modal, have textboxes user , password. when focused on user textbox, virtual keyboard opens, shrinking viewport, modal continues on position, , that's ok. actually, problem when type something. strange behavior occurs, modal "moves" pixels up. , textbox becomes hidden. i found common behavior, if scroll page see texbox hidden, clear texbox , enter new value, moves or down "same" amount of pixels scroll i've made. summing up: looks autopositioning modal every time enter value on textbox, , calculation based on scroll made: if make small scroll, , enter new value on textbox, popup moves little. if make long scroll, , enter new value on textbox, popup moves far away. if disable autoposition, doesn't happen, popup becomes invisible due css values has default. my option

osx mountain lion - Won't save changes to an EKEvent that has recurrenceRules -

the following code works non-recurring events, changes startdate , enddate saved fine. bool success = [theeventstore saveevent:event span:ekspanfutureevents commit:yes error:&error]; but whenever try edit event has recurrancerules, returns success == yes, nothing saved, , changes startdate/enddate or recurrancerules reverted original values. (using span:ekspanthisevent works, of course not want do. also, code works on ios, not on osx.) eventwithidentifier returns first occurrence of recurring event. when change on event ekspanfutureevents, change occurrences. eventsmatchingpredicate returns every event occurrence matches predicate. ekspanfutureevents change each occurrence occurrence used. if event detached doesn't matter, if take ekspanthisevent or ekspanfutureevents. don't code supposed do.

android - Checking if a Touch point is inside box collider in Unity -

Image
please see below images. in first image can see there box collider. second image when run code on android device here code attached play game (its 3d text) using unityengine; using system.collections; public class playbutton : monobehaviour { public string leveltoload; public audioclip soundhover ; public audioclip beep; public bool quitbutton; public transform mbutton; boxcollider boxcollider; void start () { boxcollider = mbutton.collider boxcollider; } void update () { foreach (touch touch in input.touches) { if (touch.phase == touchphase.began) { if (boxcollider.bounds.contains (touch.position)) { application.loadlevel (leveltoload); } } } } } i want see if touch point inside collider or not. want because right if click on scene application.loadlevel(leveltoload); called. i want called if click

asp.net mvc 3 - MVC3 Deploying a Web Application Project Using One-Click Publish -

i stuck. trying deploy mvc3 web application dbfirst (if makes difference) shared hosting server. i have gone through configuration steps per instructions here: http://msdn.microsoft.com/en-us/library/dd465337(v=vs.100).aspx when try , publish thing , validate connection error: 'could not load file or assembly 'microsoft.web.deployment, version 9.0.0.0, culture=neutral, publictokenkey=31bf385ud364e35' or 1 of dependencies. system cannot find file specified.' the web hosting company says problem web.config file. any ideas? first time have ever done please excuse ignorance. in case, installed web deploy 3.5 package on dev station. http://www.iis.net/downloads/microsoft/web-deploy i restarted visual studio 2010, reloaded project, hit publish, tried "validate connection" button again , got rid of missing assembly error.

android - Detect if power cable unplugged even when no power -

is there way detect if power cable gets unplugged if it's not plugged power source? example, plug in phone it's power cable prior plugging wall outlet. i know can detect power-state-change, - don't think there change power state when happens. i believe exists headphone jack, hoping available power jack. (i realize strange request) no, there no way detect simple cable changes usb port. you can detect power changes because, well, cause change in power state of device, , can detect electrical energy. you can headphone jacks because jack completes small circuit within device (i think. i'm not audio circuitry expert, don't take word it).

javascript - Is there a way in EmberJS to simply specify a model on an INPUT field - - like ng-model="prop" (not via views)? -

i'm new emberjs , hate writing views in following manner: {{view ember.textfield placeholder="placeholder text" valuebinding="title" }} instead write : <input type="text" ng-model="title" /> the second 1 above angularjs i've seen this: <input type="text" {{bindattr value="title"}}></input> but when change text value, not update model value (or bound value other elements) is there way in emberjs specify model in text field - ng-model="..." ?

ios - Getting EXC_Bad_Access while scrolling tableview -

i getting exc_badaccess error message while scrolling tableview. the following code have done in cellforrowatindexpath. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier=@"customcellhistory"; customcellhistory *cell=(customcellhistory*)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *toplevelobjects=[[nsbundle mainbundle]loadnibnamed:@"customcellhistory" owner:self options:nil]; (id currentobject in toplevelobjects) { if ([currentobject iskindofclass:[uitableviewcell class]] ) { cell=(customcellhistory*)currentobject; break; } } } cell.lb11.text=[cellarray1 objectatindex:indexpath.row]; cell.lbl2.text=[cellarray2 objectatindex:indexpath.row]; return cell; } i can sense problem arising due mistake in above code. i used

python - flask application timeout with amazon load balancer -

i'm trying use flask application behind amazon load balancer , flask threads keep timing out. appears load balancer sending connection: keep-alive header , causing flask process never return (or takes long time). gunicorn in front processes killed , new ones started. tried using uwsgi , exposign flask app directly (no wrapper). result in flask process not responding. i see nothing in flask docs make ignore header. i'm @ loss else can flask fix problem. curl , direct connections machine work fine, via load balancer causing problem. load balancer doesn't appear doing wrong , use several other stacks. the solution have using gunicorn wrapper around flask application. worker_class using eventlet several workers. combination seems stable , responsive. gunicorn configured https. i assume defect in flask causes problem , effective workaround.

login - PHP PDO connect -

hello trying login pdo faced problems. kazkas blogai message. actually, don't know code problems. here example of php code: <?php session_start(); $user = "asgasgasg"; $pass = "jhgjkghjghj"; /* pirmas etapas */ if(isset($_post['accept'])){ try { $connect = new pdo('mysql:host=localhost;dbname=abba_sql', $user, $pass); $connect->exec("set character set utf8"); $name=$_post['name']; $pass=$_post['pass']; $iname=htmlspecialchars($name); $ipass=htmlspecialchars($pass); /* antras etapas */ $sql = $connect->prepare("select * foo name = :name , pass = :pass"); $sql->execute(array(':name' => $iname, ':pass' => $ipass)); $rows = $sql->fetchall(); $rowcount = count($rows); if($rowcount > 0){ $_session['login'] = "1"; echo 'viskas ciki'; } else

android - Increasing Activity loading time -

i have 2 activities , b. activity start activity b. doing ui initialization, db query , local storage read operation in oncreate of activity b. problem activity b takes long time come visible. because of such operations in oncreate? want @ least ui changes visible first. please guide me in oncreate perform heavy tasks in different thread/handler/asynctask. example public void oncreate(bundle b){ super.oncreate(b); setcontentview(r.layout.yourlayout); // other gui initialization handler h = new handler(); h.post(new runnable{ public void run(){ // heave tasks } }); }

php - Voting System (Multiple sites), solution for a toplist that has no callback -

hello everyone i have vote system, , ill explain how work. there websites called toplists contains top 100 items in (depending on vote count). okay i've made voting system , have 5 different buttons, linking different toplists. some toplists have callback (a callback), , doesn't. i want trick client, make sure vote, know impossible 100% guarantee, possible trick client cheating. my idea: when user clicks on 1 of links, have wait 8 seconds before clicking 'submit' button, voting points. first result in head: javascript. and that's how planning this: (just example, not actual code!) #buttonid.click (function() { var time = **current_time + 8 seconds** }); #submit.click(function() { if (current_time < time) { return error 1 } else { process... }); this little example of how thought of doing this, variable time = current time when clicked on button, + 8 seconds . so when clicks submit, checks if current time less variable time secon

timeout - NHibernate command_timeout does not work with batches -

today experienced issue timeouts. i have following configuration used create sessionfactory: <property name="adonet.batch_size">50</property> <property name="command_timeout">600</property> i not store in web.config in xml file manually passed configuration: configuration.configure(cfgfile) thus can have multiple session factories (per database) independent configurations. but command_timeout seems effective when nhibernate not using batches. if sql commands batched large batches get: nhibernate.exceptions.genericadoexception: not execute batch command. [sql: sql not available] ---> system.data.sqlclient.sqlexception: timeout expired. timeout period elapsed prior completion of operation or server not responding. while googling solution, found article explains why happening: http://ronaldrosiernet.azurewebsites.net/blog/2013/04/20/timeout_in_nhibernate_batched_sessions the cause of problem sql batching nhibernate u

.htaccess - Htacces mod_rewrite sub directory -

i'm having problem .htaccess mod_rewrite. i've made simple custom cms , i've put in sub directory of domain; http://www.example.com/cms i've got following situations: cms/index.php?page=modules/pages/index.php convert to cms/modules/pages/index and cms/index.php?page=modules/pages/edit.php?id=1 convert to cms/modules/pages/edit/1 i've got working subdomain, when use example.com/cms doesn't anything i've made .htaccess couldn't working... rewriteengine on options +followsymlinks rewritebase / rewritecond %{request_filename} -f [nc,or] rewritecond %{request_filename} -d [nc] rewriterule ^(.*?)$ $1 [l] rewriterule ^/cms/([^/]*)/$ cms/index.php?page=$1 [l,qsa] rewriterule ^/cms/([^/]*)$ /cms/index.php?page=$1 [l,qsa] rewriterule ^/cms/pages/([^/]*)/$ /cms/index.php?page=pages/$1 [l,qsa] rewriterule ^/cms/pages/([^/]*)$ /cms/index.php?page=pages/$1 [l,qsa] rewriterule ^/cms/modules/([^/]*)/([^/]*)/$ /cms/index.php?page=modules/$1/$2 [l

symfony - Include then block on a Twig template -

none of previous questions seem have information , day , half of random google searches turns nothing. what trying this, have base.html.twig template , folder several ui elements (slideshows, navigation menus, etc). idea being should able this: page.html.twig contains {% extends 'onmylemoncommonbundle::base.html.twig' %} {% block content %} {% include 'onmylemoncommonbundle::features.html.twig' %} {% block features %} <h2>featured articles</h2> <li><a href="#">article 1</a></li> <li><a href="#">article 2</a></li> {% endblock %} {% endblock %} features.html.twig contains <div class="row"> <div class="large-12 columns"> <div class="row"> <div class="large-4 small-6 columns"> {% block features %}{% endblock %} </div> <div class="large-4 small-6 c

java - Singleton Action versus Multi instance Action -

i have dude how implement actions in swing. my idea create class each action of application extending abstractaction can use in many components must have same behavior. finaly have as: public class actionexample extends abstractaction { @override public void actionperformed(actionevent arg0) { system.out.println("do something"); } } well, when want use have 3 options in mind: public void makeui1() { jbutton btn = new jbutton(new actionexample("do it")); jmenuitem mi = new jmenuitem(new actionexample("do it")); } public void makeui2() { action = new actionexample("do it"); jbutton btn = new jbutton(a); jmenuitem mi = new jmenuitem(a); } or use singleton (also changing actionexample): public void makeui2() { jbutton btn = new jbutton(actionexample.getinstance()); jmenuitem mi = new jmenuitem(actionexample.getinstance()); } public class actionexample extends abstractaction {

Update two tables concurrently in Rails -

i have 2 tables: products , recommendations. first 2 million records on both tables contain same data, , differ 100k records. tables contain product ids, , need write script calls api update each products/recommendations attributes (title, price...etc). possible update attributes on both tables @ same time rather updating product models attributes, , using same script update recommendation model? api parser: def get_item_info(id) url_raw = uri.parse("url_id=#{id}") url = net::http.get_response(url_raw).body if url.empty? @title = "product unavailable via api" @prod_url = "url" @cover_img = "image" @price = "product unavailable via api" else begin @response1 = json.parse(url) @title = @response1["productname"] @prod_url = "#{@response1["producturl"]}" @cover_img = @response1["imagepath"].gsub("75x75.gif&q

ruby on rails 3 - Accessing to an image instance with carrierwave and fog -

i'm trying use this solution dimensions of image. in development works great, in staging (using fog) img = ::magick::image::read(@file.file).first throws me: private method 'file' called #<carrierwave::storage::fog::file:0x00000008fe28d0> how can retrieve file fog? update: i'm using carrirwave_backgrounder process images asynchronously. part of code: # uploader def geometry @geometry ||= get_geometry end def get_geometry if(@file) img = ::minimagick::image.open(@file.file) @geometry = {width: img[:width], height: img[:height]} end end # model mount_uploader :image, imageuploader process_in_background :image before_save :set_dimensions def set_dimensions geometry = self.image.geometry self.width = geometry[:width] self.height = geometry[:height] end i've figured out error appears when update model, not when created, i've changed callback before_create :set_dimensions , works fine. suppose because when i'm updati

python - Continue the batch script commands when using scrapy crawl command in a batch file -

i using scrapy crawling information webpage. have written spider code works fine. have other python code files refine crawled data. to put together, have batch file in first use "scrapy crawl" command, , after run python file refine crawled information. the problem batch script stops @ end of "scrapy crawl" command, , not proceed executing lines after in batch file. how can solve problem? contents of batch file: cd "spiders_folder" scrapy crawl myspider -o outputdata.json -t json python refinedata.py the batch file logic handles calls other programs subroutines , returns there originating batch file after execution finished. afaicr exception rule if 1 batch file calls batch file. in case execution not handled subroutine given on other batch file. unless use call call second batch file. (i might mistaken, long ago me, please don't hit me hard if i'm wrong.) if guess correct , reason trouble, because scrapy batch file

asp.net - multiple SiteMap nodes with same URL with querystring parameters -

in sitemap control using, want 2 or more of nodes point same page. <sitemapnode url="~/default.aspx" title="home" description="home page"> <sitemapnode url="~/sectionlist.aspx" title="by section" description="list of sections"> <sitemapnode url="~/browsepublications.aspx" title="publications of section" description="publications of section"/> </sitemapnode> <sitemapnode url="~/officers.aspx" title="by responsible officer" description="list of officers"> <sitemapnode url="~/browsepublications.aspx" title="publications of officer" description="publications of officer"/> </sitemapnode> </sitemapnode> i have grid show, grid can filtered in many ways. each filter page user clicks entry , gets redirected page showing grid data relevant entry. using query string parame

visual c++ - How do I remove the extra decimals when I divide change by 25 I get 3.48 and I need a whole number any ideas? -

#pragma once namespace vendingmachine { using namespace system; using namespace system::componentmodel; using namespace system::collections; using namespace system::windows::forms; using namespace system::data; using namespace system::drawing; /// <summary> /// summary form1 /// </summary> public ref class form1 : public system::windows::forms::form { public: form1(void) { initializecomponent(); // //todo: add constructor code here // } protected: /// <summary> /// clean resources being used. /// </summary> ~form1() { if (components) { delete components; } } private: system::windows::forms::label^ label1; private: system::windows::forms::textbox^ textbox1; protected: private: system::windows::forms::button^ butto

PHP/MySQL Statements. How do I turn this into a prepared statement? -

$query = 'insert user_answer (facebook_id, answer_id) values (' . $i . ',' . $randanswer . ')'; $dbh->exec($query); i have code, , required turn prepared statement using pdo::bindvalue() , maybe pdo::prepare(). looking @ examples, i'm not sure how go this. :name come , why putting in bindvalue part? in case this: $st = $dbh->prepare("insert user_answer (facebook_id, answer_id) values (:facebook_id, :answer_id)"); $st->execute(array('facebook_id' => $i, 'answer_id' => $randanswer)); you might want read a tutorial or 2 idea how use pdo effectively. pdo documentation pretty good. the general idea here put in things :name name value goes, , pass in array defines name maps to.

memory - Arrays implementation in erlang -

my question is, how arrays implemented in erlang, opposed lists. with immutable types doing things like, move ([x | xs], ys) -> [x | ys]. ls = move([1,2,3], [2,3,4]) would take constant mem in heap, since reference work. but same stuff in arrays move (a1, a2) -> array:set(0, array:get(0,a1),a2). a1 = array:from_list([1,2,3]). a2 = array:from_list([0,2,3,4]). a3 = move(a1,a2). will move here use size proportional a2 or able in constant space arrays? to (hopefully) clear things little. remember in erlang all data immutable! profoundly affects how manipulate data. the array module builds structure of nested tuples array slots containing data @ same level. size of each tuple 10 array access have o(lg10(n)). using nested structure common in languages immutable data. could keep array in flat tuple give fast reads, writes become slow , memory hogging large arrays/tuples every write entail creating new tuple. using tree structure means less data

c++ - Vertex shader fails to compile, but no message from Info Log -

i'm trying set simple vertex shader. when compile it, fails (according gl_compile_status), info log empty, leaving me nothing work debugging standpoint. here code: gluint vertexshader, fragmentshader; char *code = "void main(void)\ {\ vec4 = gl_vertex;\ a.x = a.x * 0.5;\ a.y = a.y * 0.5;\ gl_position = gl_modelviewprojectionmatrix * a;\ }"; int length = strlen(code); vertexshader = glcreateshader(gl_vertex_shader); //fragmentshader = glcreateshader(gl_fragment_shader); glshadersource(vertexshader, 1, &code, &length); glcompileshader(gl_vertex_shader); glint compiled; glint loglength; glgetshaderiv(vertexshader, gl_compile_status, &compiled); glgetshaderiv(vertexshader, gl_info_log_length , &loglength); if (loglength > 1) { glchar* compiler_log = (glchar*)malloc(loglength); glgetshaderinfolog(vertexshader, loglength, 0, compiler_log); printf("%s\n", compiler_log); free (compiler_log); } i'm

jquery - Return "success" message after form submit -

i trying return "thank you" message after successful jquery email validation , form submission. want show "thank you" message , prevent page redirecting action url still process data server side. while researching think jquery callback sounds right need more direction examples found bit on place. can provide input? $("#emailsignup_form").validate(); }); $('#submitemail').click(function() { app.ajax.load({ reqname : 'emailsubmit', url: "$httpurl('bronto-optin')$?email=" + $('#email').val(), selector : '#emailbox', callback: function(responsetext, textstatus) { } return false; } }); <form id="emailsignup_form" method="post" action="$httpurl('bronto-optin', 'fid', 'information')$"> <input id="cemail" name="email" size="25" class="required email" /> <

regex - Extract a specific word from string in PostgreSQL -

i using pgadmin version 1.16.1 , need extract words 'login' , 'logout' result column url "http:/login-v1.abcd.com/service/abc/integration" "http:/xxxxxxxxlogout" "https:/login-v1.abcd.com/service" result url action "http:/login-v1.abcd.com/service/abc/integration" login "http:/xxxxxxxxlogout" logout "https:/login-v1.abcd.com/service" login how can this? use substring() regular expression: with t(txt) (values ('http:/login-v1.abcd.com/service/abc/integration') ,('http:/xxxxxxxxlogout') ,('https:/login-v1.abcd.com/service') ) select txt, substring(txt '(login|logout)') action t

javascript - Using jQuery to get descdent nodes in DOM -

could tell me jquery equivalent of be? var shapes=document.getelementsbytagname("shapes")[0]; thiscircle=shapes.getelementsbytagname("circle")[index]; there few ways it. here's how i'd write it: $('shapes').first().find('circle').eq(index)

mysql - Apply SELECT LEFT() on the total characters from multiple columns combined -

i wanted limit characters retrieved mysql database , know left() function use. query select id, left(heading, 80) heading, left(article, 20) article news order stamp desc limit 5; but want limit total number of characters retrieved 'heading' , 'article' columns combined... in other means; want total 100 chars both columns priority 'heading'... so, mr. sql, show 'heading' while can (within 100 chars range) , omit 'article' wish, if needed omit 'heading' reach 100 chars condition. i.e. 'heading' gives 80 chars , 'article' gives 120 chars, therefore, delete 100 chars 'article'. 'heading' gives 110 chars , 'article' gives 500 chars, therefore, delete 500 chars article , 10 chars 'heading' select id, left(heading, 100) heading, if(length(heading)>=100, '', left(article, 100-length(heading))) article news order stamp desc limit 5; obviously if don't

php - Not understanding working filesize() function -

$path = "/////////."; echo filesize( $path ); result 4096 what ... fail this? whence 4096 ? answer: $path = "/////////."; although looking weird, path refers root of filesystem, same / , directory. on filesystems directory takes at least 4096 bytes store (what size of 1 sector of harddisk, smallest allocation unit filesystems). size can bigger if there many files stored in directory. in system root there standard system directories, therefore 4096.

scala - Warning in Play 2.0.4 -

when compile application securesocial plugin gives me warning: [info] compiling 21 scala sources , 8 java sources /home/mario/tegik-play/target/scala-2.9.1/classes... [warn] /home/mario/tegik-play/app/controllers/templatesplugin.scala:21: imported `application' permanently hidden definition of object application in package controllers [warn] import play.api.{logger, plugin, application} [warn] ^ [warn] 1 warning found i'm new scala, have pointer this? when using application , compiler choose 1 got in current package, controllers , instead of play.api.application ; means importing latter useless. in other words: definition of controllers.application hides definition of play.api.application . to silence warning, don't import play.api.application , , use full name: import play.api.{logger, plugin} ... val foo = play.api.application.bar

sql - Sum(column) and group by date but get all ID's for that date? -

i have following sql query: select date(created_at), sum(duration) total_duration "workouts" "workouts"."user_id" = 5 , "workouts"."category" = 'all' group date(created_at) order date(created_at) asc but want query id of workout, tried this: select id id, date(created_at), sum(duration) total_duration "workouts" "workouts"."user_id" = 5 , "workouts"."category" = 'all' group id, date(created_at) order date(created_at) asc however, results in group date clause not working (i.e not summing duration workouts on specific date). think because cannot have 1 id date has multiple records. there way return id specific record returned has multiple workouts associated it? for example, if had done 3 workouts yesterday, each lasted 40 minutes in duration, query return 120 minutes (sums durations given date) returns each id workouts on date? or should not in query ,

Fixing a CSV using Python -

i trying clean formating on csv file in order import database, , i'm using following edit it: f1 = open('visit_summary.csv', 'r') f2 = open('clinics.csv', 'w') line in f1: f2.write(line.replace('calendar: ', '')) f1.close() f2.close() this works fine if there 1 edit make, however, have repeat code 19 times in order make changes required; opening , closing each file several times , having multiple placeholder fiels in order use intermediate steps ebtween first , last edit). there simpler way this? tried adding more "f2.write(line.replace"... lines, however, creates final file duplicated lines each of has 1 edit. think see problem (i writing each line multiple times each edit), however, cannot seem find solution. new python , self teachign myself help, or direction better resources appreciated. there's no reason can't lots of things line before write it: with open('visit_summary.csv'

security - Unique identifying a user after federated Authentication -

i have started experimenting wif new application i'm writing. far have managed localsts working , setup web.config enable federated authentication against localsts. plan use localsts , worry implementing custom sts later. i use federated authentication authenticate user, , once authenticated, authorize them perform various actions internally. so, sts authenticate, , application authorize internally. to this, need store authorized actions each user (possibly hundreds of unique actions) in app database, , read , cash them once user starts new session. what wondering is, how map user authenticated using federated authentication unique user id exists in db, while still keeping application agnostic sts use (be adfs, open auth etc.)? nameidentifier token seems candidate, read saml 2 replaces different token. am approaching wrong way? missing something? any appreciated. name candidate email, upn or "unique number" good. point - there no ultimate candidat

javascript - Ember unable to find template -

i trying render view dynamically in ember.js resume.itemview = em.view.create({ click: function(){ var view = em.view.create({ templatename: 'my_exp'}); view.append(); }, }); i have in /templates my_exp.hbs but get uncaught error: assertion failed: specified templatename my_exp <ember.view:ember261>, did not exist. is there better approach trying this? can suggest resources? a recent update ember removed defaultcontainer looking templates. people manually creating views has created issues. to achieve want need use createchildview . resume.itemview = em.view.create({ click: function(){ var view = this.createchildview(ember.view, { templatename: 'my_exp' }); view.append(); }, }); (see fiddle )

sqlite - Call R functions from sqldf queries -

is there way call r functions sqldf queries? e.g. sqldf("select paste('hello', 'world')") or, there way define custom functions or stored procedures within sqlite engine behind sqldf? (i using sqldf plain old in-memory r data frames; i'm not connecting actual databases.) 1) existing functions first make sure function want not available. example code in question directly supported in sql already: > sqldf("select 'hello' || ' ' || 'world' ") 'hello' || ' ' || 'world' 1 hello world 2) rsqlite.extfuns 1 has sql functions sqlite's version of sql plus large number of user defined functions out of box in rsqlite.extfuns package (which automatically loaded sqldf). 3) other loadable extensions functions in existing sqlite loadable extensions can loaded via sqlite sql function load_extension() . e.g. see these extensions 4) custom functions custom fun

Entity framework DBcontext add child row -

as understand, add child row, can either do parent.children.add(child); or child.parents= parent then can mycontext.savechanges(); somehow second solution doesn't insert work @ all. here's code: countmaster countmaster = (from b in pmdatacontext.countmasters b.reportdate == reportdate && b.department == dept select b).singleordefault(); countdetail countdetail = new countdetail { categoryid = 1, statusid = 1 }; //countmaster.countdetails.add(countdetail); countdetail.countmaster = countmaster; pmdatacontext.savechanges(); when adding entity collection navigation property or setting reference navigation property of tracked entity ef add entity context in entitystate.added state. due objectstatemanager detecting changes made tracked entity. if working other way around, is, starting untracked entity , setting/adding tracked entiti

css internet explorer hacks -

im using rockettheme template , have edited of css code using custom css file. i have managed how want on firefox , chrome ie looks werid. navigation low (the buttons) , header low. the website link found below. http://www.colmanprint.co.nz/rfloorings/ as can see on link menubar down low , header. at moment im using css code edit .rt-menubar {padding: 0px !important; margin-left:210px;} when remove margin-left:210px; fixes problem menu goes behind logo on chrome , firefox. so pretty need keep margin-left:210px chrome , firefox have margin-left:0px internet explorer any ideas great! for versions of internet explorer ie9, use conditional comments differentiate between ie , other browsers. here's quick example: <!--[if ie]> <link rel="stylesheet" type="text/css" href="ie9-and-below.css" /> <![endif]--> then in ie9-and-below.css apply style such as: #ieparagraph.rt-menubar { margin-left:0px; }

ranking - Get current rank using mysql -

i've got query rank of rows, order field set @rank=0; select @rank:=@rank+1 rank, id, ammopacks users group id order ammopacks desc; how getting rank of "x" id, without ranking them before? don't want know users rank, 1 id. is possible? thanks in advance you can subquery: select count(*) rank users u u.ammopacks >= (select ammopacks users u2 u2.id = x) this doesn't same thing. real ranking, users same value of ammopacks have same rank. original give different users different sequential values in case. to effect, can do: select count(*) rank users u u.ammopacks > (select ammopacks users u2 u2.id = x) or (u.ammopacks = (select ammopacks users u2 u2.id = x) , u.id <= x )

excel - VLook-Up Match first 3 characters of one column with another column -

i'm trying match list of words column against list of words in column b. need first 3 characters of words in column match first 3 characters of words in column b. result same value in column b. possible? here i'm using: =vlookup(left(a1,3),b$2:b$22, 2,true) but, keep getting #n/a. can help? try using wildcard this =vlookup(left(a1,3)&"*",b$2:b$22,1,false) so if a1 "barry" formula return first value in b2:b22 starts "bar"

file io - Leading zero in Matlab's scientific notation -

in matlab, when printing using e such fprintf('%10.5e\n', pi/100) 1 result 3.14159e-02 . however, if want number have leading 0 such 0.314159e-1 ? how can manage matlab? the reason ask trying print file need have leading zeros. otherwise, not care. thanks. i don't think there clever way it: your_number = pi; ['0.' strrep(sprintf('%10.5e',your_number*10), '.', '')] >> ans = 0.314159e+01

ios - Remove (not exact) duplicates of NSDictionaries from array -

i have nsmutablearray of many nsdictionaries contain keys "title". in cases there duplicates of dictionaries same "title" differences in other keys. how can remove dictionaries have same "title" key , leave 1 in array? thanks sort array using nssortdescriptor on key path 'title'. next, loop on array , build new array: nsstring *lasttitle = nil; nsmutablearray *result = [nsmutablearray array]; (nsdictionary *d in array) { nsstring *testtitle = [d objectforkey:@"title"]; if (![testtitle isequaltostring:lasttitle]) { [result addobject:d]; lasttitle = testtitle; } } now result contains filtered list. it's important sort array first algorithm work.

python - Am I using Gio GFile monitor_file wrong? -

i'm using gio monitor_file this. def callback(*args): print 'ok' gio_pointer = gio.file.new_for_path(os.environ['home']+'/temp') monitor = gio_pointer.monitor_file(gio.filemonitorflags.none, none) monitor.connect("changed", callback) nothing happens modified file. gio works other file operations creation, read, , write. am using wrong, or system problem? my environment: gtk graphics, python, linux ubuntu 12.10, regular pc. it failing because gobject's main loop required in order signals work. the following complete example works me: import os gi.repository import gtk, gio # allows ctrl+c exit program import signal signal.signal(signal.sigint, signal.sig_dfl) def callback(m, f, o, event): # without check, multiple 'ok's printed each file change if event == gio.filemonitorevent.changes_done_hint: print ('ok') gio_file = gio.file.new_for_path(os.environ['home']+'/temp'

java - threadid=1: thread exiting with uncaught exception error -

i'm recieving error of threadid=1... don't @ point in app @ sometime. not sure specific error is. i've check line 164 , don't see cause result. maybe need add manifest? here logcat. 05-08 17:19:28.796: w/dalvikvm(8683): threadid=1: thread exiting uncaught exception (group=0x40e37438) 05-08 17:19:28.806: e/androidruntime(8683): fatal exception: main 05-08 17:19:28.806: e/androidruntime(8683): java.lang.nullpointerexception 05-08 17:19:28.806: e/androidruntime(8683): @ com.example.speech.mainactivity$speechlistener.onresults(mainactivity.java:164) 05-08 17:19:28.806: e/androidruntime(8683): @ android.speech.speechrecognizer$internallistener$1.handlemessage(speechrecognizer.java:442) 05-08 17:19:28.806: e/androidruntime(8683): @ android.os.handler.dispatchmessage(handler.java:99) 05-08 17:19:28.806: e/androidruntime(8683): @ android.os.looper.loop(looper.java:137) 05-08 17:19:28.806: e/androidruntime(8683): @ android.app.activitythread.main(activi

phpmyadmin - SQL: set the possible values of a field to the contents of another field -

so need set possible values field dev_id contents of table containing computer hostnames. any ideas? i think referring foreign key constraint. type of constraint that checks value in field (such dev_id ) in 1 table valid key in table (such table of computer hostnames). typically, set in first table when create it, using syntax such as: constraint foreign key (dev_id) references hostnames(devid) (this mysql syntax.)

statistics - Choice of statistical test (in R) of two apparently different distributions -

i have following list of data each has 10 samples. values indicate binding strength of particular molecule. what want show 'x' statistically different 'y', 'z' , 'w'. if @ x has more values greater 0 (2.8,1.00,5.4, etc) others. i tried t-test, of them shows insignificant difference high p-value. what's appropriate test that? below code: #!/usr/bin/rscript x <-c(2.852672123,0.076840264,1.009542943,0.430716968,5.4016,0.084281843,0.065654548,0.971907344,3.325405405,0.606504718) y <- c(0.122615039,0.844203734,0.002128992,0.628740077,0.87752229,0.888600425,0.728667099,0.000375047,0.911153571,0.553786408); z <- c(0.766445916,0.726801899,0.389718652,0.978733927,0.405585807,0.408554832,0.799010791,0.737676439,0.433279599,0.947906524) w <- c(0.000124984,1.486637663,0.979713013,0.917105894,0.660855127,0.338574774,0.211689885,0.434050179,0.955522972,0.014195184) t.test(x,y) t.test(x,z) you have not specified in way

ios - Getting Max ID from core data & sqlite -

i have table users , have bunch of columns in core data model. 1 of column user_id , trying highest user_id , add + 1 , pass next object inserted. followed apple developer guide , implemented suggested. here code trying execute. issue : account_id value being returned being set weird number doesn't exists in database. "account_id" = 139784529; supposed 1 since have saved in core data. nsfetchrequest *request = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"users" inmanagedobjectcontext:self._managedobjectcontext]; [request setentity:entity]; // specify request should return dictionaries. [request setresulttype:nsdictionaryresulttype]; // create expression key path. nsexpression *keypathexpression = [nsexpression expressionforkeypath:@"account_id"]; // create expression represent function want apply nsexpression *expression = [nsexpression expressionforfunction:@"max:"

PHP Regex to match words with dash right infront and save to array? -

i'm wondering kind of regex use extract words have dash infront of them in given string. i'm going using allow users omit words search results of website. for example, have $str = "this search -test1 -test2"; i'm trying have save "test1" , "test2" array because have dash right infront. could me out use following pattern /\-(\w+)/ . example: $string = 'this search -test1 -test2'; $pattern = '/\-(\w+)/'; if(preg_match_all($pattern, $string, $matches)) { $result = $matches[1]; } var_dump($result); output: array(2) { [0] => string(5) "test1" [1] => string(5) "test2" } explanation: /.../ delimiter chars \- dash (must escaped has special meaning in regex language (...) special capture group. stores content between them in $matches[1] \w+ @ least 1 ore more word characters