Posts

Showing posts from March, 2014

python - getting a list of coordinates from a 2D matrix -

let's have 10 x 20 matrix of values (so 200 data points) values = np.random.rand(10,20) with known regular spacing between coordinates x , y coordinates defined by coord_x = np.arange(0,5,0.5) --> gives [0.0,0.5,1.0,1.5...4.5] coord_y = np.arange(0,5,0.25) --> gives [0.0,0.25,0.50,0.75...4.5] i'd array representing each coordinates points shape of array (200,2), 200 being total number of points , dimension representing x , y such as coord[0][0]=0.0, coord[0][1]=0.0 coord[1][0]=0.0, coord[1][1]=0.25 coord[2][0]=0.0, coord[2][1]=0.50 ... coord[19][0]=0.0, coord[19][1]=5.0 coord[20][0]=0.5, coord[20][1]=0.0 coord[21][0]=0.5, coord[21][1]=0.25 coord[22][0]=0.5, coord[22][1]=0.50 ... coord[199][0]=4.5, coord[199][1]=4.5 that easy thing double loop, wonder if there more elegant solution using built-in numpy (or else) functions. ? i think meant coord_y = np.arange(0,5,0.25) in question. can do from numpy import meshgrid,column_stack x,y=meshgrid(co...

javascript - Toggling menu and click counter reset -

Image
i started learn js , jquery, , i'm trying achieve toggling menu resets clicks counter on other menu when being opened. and here js code // javascript document var toggleclicks = $('.toggle').data('clicks'); var menuclicks = $('.toggle-menu').data('clicks'); $(document).ready(function() { //wrapper// $('.toggle').click(function() { ++toggleclicks; if (toggleclicks%2 === 0) { // clicks $('.wrapper').css({'margin-top': '-260px'}); $('.icon-menu, .icon-bell').css({'color': '#ababab'}); $('.toggle-menu').data('clicks',0) } else { // odd clicks $('.wrapper').css({'margin-top': '0'}); $('.icon-bell').css({'color': 'red'}); $('.contact, .diet, .hours, .classes, .gym').css({'margin-bottom': '-300px'...

Query much slower in SQL Server 2012 compared to SQL Server 2005 -

recently moved our database sql server 2005 sql server 2012. since experiencing performance problems when use following query: select dbo.candidates.candidateid candidates_candidateid, dbo.candidates.datecreated candidates_datecreated, dbo.candidates.gender candidates_gender, dbo.titles.titlename titles_titlename, dbo.addresses.cityname addresses_cityname, dbo.countries.countryname candidates_countryname, dbo.candidates.phonenumber candidates_phonenumber, dbo.candidates.mobilephonenumber candidates_mobilephonenumber, dbo.candidates.birthdate candidates_birthdate, dbo.vwconcatenatedbranchespercandidate.branches_branchename, dbo.states.statename states_statename, dbo.substates.substatename substates_substatename, dbo.candidates.statedate candidates_statedate, dbo.candidates.nationality candidates_nationality, dbo.candidates.availablefromdate candidates_availablefromdate, dbo.candidates.availableunti...

python - Pass extra values along with urls to scrapy spider -

i've list of tuples in form (id,url) need crawl product list of urls, , when products crawled need store them in database under id. problem can't understand how pass id parse function can store crawled item under id. initialize start urls in start_requests() , pass id in meta : class myspider(spider): mapping = [(1, 'my_url1'), (2, 'my_url2')] ... def start_requests(self): id, url in self.mapping: yield request(url, callback=self.parse_page, meta={'id': id}) def parse_page(self, response): id = response.meta['id']

cmsmadesimple - CMS Made Simple - adding extra editing fields to Global Content Blocks possible -

i spoiled in using advanced custom fields wordpress. using cms made simple since client has it. i have global content block suits me nicely – but there 1 field - , have multiple fields there make more functional. is there way this, or there better module install making this? thank you. have googled, not found way through on one. i believe listit2 module great choice layout. listit2 enables show complex design within website but, in end, have editor presented simple list structure in can edit text , re-order items. , can add fields images , text. check out module @ http://dev.cmsmadesimple.org/projects/listit2

php - Class documentation outside declaration -

is possible document methods, properties etc. outside of class declaration ? <?php // lib/classa.php class classa { public function __call($method, $args) { if ($method == 'testa') return $method; else if ($method == 'testb') return $method; } } as can see above class has undocumented functionality ide not notice of. <?php // app/index.php /** * @method string classa::testa() * @method string classa::testb() */ $classa = new classa(); classa->testa(); # ^ # | # \_____code suggestions here i wounder of possibility hint ide missing features. me out missing documentation in libraries or document classes generated framework still used in actual project. if use phpdoc it's impossible. should read docblock . @method used way: /** * @method string testa() * @method string testb() */ class classa { public function __call($method, $args) { if ($method == 'testa') ...

c++ - How to load side by side same name DLLs (Visual Studio) -

i have question side-by-side assemblies . here's situation: i have executable, app.exe , loads plugins searching plugins directory. app.exe depends on a.dll . i'm developing plugin depends on older, customized version of a.dll has same name. updating older, customized version newer version impossible, thought might able load 2 a.dll files simultaneously. here's directory structure: \bin app.exe a.dll (newer version) \plugins myplugin.dll both versions of a.dll depend on huge number of other dlls, have similar version problems. (i should mention i'm working 64-bit application, if makes difference.) how set in visual studio such can load both a.dll libraries @ same time, myplugin.dll uses older version, whereas app.exe uses newer version? since these plugins, load them calling loadlibrary , or similar. in case can pass full path dll in order load it.

c# - Binding from parents Viewmodel -

i have view has listbox in it. have listbox bound collection of listboxviewmodel property of mainviewmodel. have datatemplate listbox in im binding properties of listboxviewmodel. view contains listbox has datacontext set mainveiwmodel. how can bind properties of mainviewmodel in datatemplate of listbox has itemsource bound collection of listboxviewmodels? this combobox in listbox datatemplate has itemsoucrce bound collection of listboxviewmodels. notice im trying bind mainviewmodel properties listboxviewmodel properties in datatemplate <listbox itemsource="{binding path=collectionoflistboxviewmodelsinmainviewmodel}" <datatemplate> ..... <combobox margin="6" width="300" iseditable="true" itemssource="{binding path=mainviewmodelproperty}" //binding not working ...

c++ - How to structure solution for client server in visual studio -

i new networking , trying make basic client , server app. know how can structure solution in visual studio this. what have 2 projects - 1 client, 1 server. however, both client , server use code source files 'shared' if would. common purpose functions, etc. since both applications need code compiled, need copy these source files in both client , server project, or there another, perhaps better way?

make wordpress posts change content dynamically -

is there way customise wordpress blog post changes based on user? eg. when showing post around salary , bonuses on company blog, i'd customise of text based on employee level (director, executive etc) - example: a paragraph of text pension contribution should appear directors reading page the bonus amount should change based on employee level. i don't want create several pages per category (eg. 1 page directors, 1 execs etc) - have 1 blog post variable fields? the codex has great function outlined, current_user_can http://codex.wordpress.org/function_reference/current_user_can as wp_user_query http://codex.wordpress.org/class_reference/wp_user_query you can use both of these accomplish goal.

ruby - Adding a scope to a has_many through association in Rails -

i have project , user models joined membership model. want retrieve project's members except 1 user. project.members.where.not(id: current_user) like answer , want use scope: class user < activerecord::base scope :except, ->(user) { where.not(id: user) } end but doesn't work. p.members.except(user.find(1)) user load (1.0ms) select "users".* "users" "users"."id" = $1 limit 1 [["id", 1]] user load (0.4ms) select "users".* "users" inner join "memberships" on "users"."id" = "memberships"."user_id" "memberships"."project_id" = $1 [["project_id", 2]] as can see results in 2 queries, not one. , returns members, not taking account exclusion. why doesn't work? try renaming scope else, except_for or all_except . name except used active_record http://api.rubyonrails.org/classes/active...

python - How to make a chain of function decorators? -

how can make 2 decorators in python following? @makebold @makeitalic def say(): return "hello" ...which should return: "<b><i>hello</i></b>" i'm not trying make html way in real application - trying understand how decorators , decorator chaining works. check out the documentation see how decorators work. here asked for: def makebold(fn): def wrapped(): return "<b>" + fn() + "</b>" return wrapped def makeitalic(fn): def wrapped(): return "<i>" + fn() + "</i>" return wrapped @makebold @makeitalic def hello(): return "hello world" print hello() ## returns "<b><i>hello world</i></b>"

Uncaught error: Illegal arguments running Dart compiled to js in Safari -

ok, not sure how easy going to here goes... so there dart code dealing uses polymer, , perhaps relevant detail there lot of futures in it. when accessing web page (you can see here yourself: http://trommons.org/ ) loads fine in chrome , firefox, new versions @ least, in safari latest version "task stream" dart component (content directly under "translation tasks" header) doesn't work , hence displays configured text "loading..." while not doing anything. this work-related pretty much, internship part of undergrad degree, thankfully due nature of project open source free share code. the taskstream dart source , html (for polymer element , such) can seen on our github repo here . so, following stack trace in safari console when project built dart2js in debug mode (did on "dev server" have @ work site testing, not built in debug mode on live site linked): illegal argument(s) zone.dart:711 (anonymous function) zone.dart:711 callb...

mailto - Add an email to user's address book using javascript/html -

is there way use javascript/html add email address visitors address book? i'm looking function similar "mailto" anchor, opens users email client , opens new message tab, instead of opening mail client new message, open , go "add contacts" tab i've read javascript intent's unsupported browsers , far know, don't allow adding contacts. unfortunately, there no function "mailto" create contacts-- closest can create vcard , have user download , open it.

Setting precision in PHP -

i have installed php 5.5 on laptop, who's running windows. i'm accessing smartsheet api, , supposed column id number 18 digits(or 17). scientific number: 1.5441916385627e+15, not 1544191638562692 i ran script, in ubuntu server environment, , see 1544191638562692. same, ran in os x maverick environment, , it's same integer format. i searching matter, , seems precision. if i'm setting in php, precision 14 os x maverick environment this: echo (float)$col->id; //1.5441916385627e+15 i scientific number. can me idea? as has been mentioned in comments, sounds issue running 32-bit php. smartsheet provide sample php code started working api. in samples, documentation recommends treat ids strings in 32-bit php: https://github.com/smartsheet-platform/samples/tree/master/php/1-hellosmartsheet#dependencies

ios - Add custom cordova plugin to IBM Worklight 6.1 -

i trying add custom cordova plugin ios platform, , having issues when compare process add plugin on cordova. the plugin trying use here https://github.com/phonegap-build/statusbarplugin with cordova used use command line c ordova plugin add com.phonegap.plugin.statusbar first, tried modify in native folder, noticed if so, works erased next time deploy again ios platform. second, tried add files (plugin js file , cordova_plugins.js file.) under apps/myapp/iphone, or apps/myapp/common, causes issue : cordova_plugins.js file format seems become not ok. instead of having working format: cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { "file": "plugins/org.apache.cordova.battery-status/www/battery.js", "id": "org.apache.cordova.battery-status.battery", "clobbers": [ "navigator.battery" ] }, , { ...

ios - How to get all allocated instances of specific class in Objective C? -

i trying implement component possibility apply different skins views , controllers @ runtime without reinitialising these controls. want use such logic: declare protocol methods applying skins. all necessary classes implements protocol. when user selects skin instances of classes conform protocol receive message apply skin. so know how necessary classes conform specific protocol using objc_getclasslist , class_conformstoprotocol functions. how allocated instances of these classes sending message them? i know implemented internal logic of every class storing instances in static storage , returning array class method. isn't elegant solution. i'm finding more universal solution can add new skinnable controls in easy way. it sounds you're reinventing <uiappearance> . should @ least start there. it's it's for. see peter steinberger's writeup discussion of adding custom properties. to basic question, there not runtime call enumera...

javascript - How do I mock a service that returns promise in Angularjs Jasmine unit test? -

i have myservice uses myotherservice, makes remote call, returning promise: angular.module('app.myservice', ['app.myotherservice']) .factory('myservice', [myotherservice, function(myotherservice) { function makeremotecall() { return myotherservice.makeremotecallreturningpromise(); } return { makeremotecall: makeremotecall }; } ]) to make unit test myservice need mock myotherservice , such makeremotecallreturningpromise() method returns promise. how it: describe('testing remote call returning promise', function() { var myservice; var myotherservicemock = {}; beforeeach(module('app.myservice')); // have inject mock when calling module(), // , module() should come before inject() beforeeach(module(function ($provide) { $provide.value('myotherservice', myotherservicemock); })); // however, in order construct mock // need $q, can give me promise ...

c# - What's the best alternative to an empty interface -

i apologise essay wanted set context of why i'm asking empty interfaces. i on oop course , interesting debate arose around use of empty interfaces - team divided on whether or not code smell. to set background, had design app valet parking service - customer brings car attendant , attendant parks car in carpark , gives customer ticket. customers can return attendant ticket , attendant retrieve car carpark. when designing solution, anticipated carpark may used park bikes, vans, cars , potentially obscure shipping container. drove me create interface - iparkable . way, instead of carpark containing list of cars, have list of iparkable objects. my car , bike classes implemented iparkable interface both parked in carpark, interface empty - fyi @ time of doing this, hadn't heard of marker pattern. my argument using interface meant objects in carpark kept hold of type - car still car , bike still bike. also, makes incredibly easy if new type needs ability parked - ...

asp.net - Problems implementing a recursive find extension method -

i attempting implement recursive extension method in vb.net find objects property set can call so... dim camp new campaignstructure 'populated full structure of course dim lstfounditems list(of categorystructure) = camp.categories.findrecursive((function(c) c.found = false), 3) my vb.net classess , modules this imports system.runtime.compilerservices namespace mystructure public class categorystructure public property categoryid integer = nothing public property name string public property rank integer public property found boolean = false public property children new list(of categorystructure) end class public class campaignstructure public property campaignid string = nothing public property categories list(of categorystructure) end class public module controlextensions <extension()> _ public function findrecursive(cs list(of categorystructure), predicate func(of categorystructure, boolean), depthlimit integer) list(of catego...

mysql - How to select the latest record of each hour in a day -

Image
i want select latest record of each hour in given date, based on datetime column 'reading_on'. have executed below query hourly_max = inverterreading .where("date(reading_on) = ? , imei = ?", date.today, "770000000000126") .group("hour(reading_on)") .having("max(hour(reading_on))") hourly_max.group_by(&:id).each { |k,v| puts v.last.reading_on } in above query not getting required result. proper way select latest record of each hour in day. below table structure select hour(a.reading_on) hr, max(a.id),a.reading_on inverterreadings left join inverterreadings b on year(a.reading_on)=year(b.reading_on) , month(a.reading_on)=month(b.reading_on) , day(a.reading_on)=day(b.reading_on) , hour(a.reading_on)=hour(b.reading_on) , a.reading_on < b.reading_on b.reading_on null group a.reading_on; demo : http://sqlfiddle.com/#...

Find word with 2 different currly braces into html paragraph using php regex -

my question is. want solution ... below html para <p>hello <b>{$customername}</b>,</p> <p>admin posted additional message on:</p> <p>kindly review , respond.</p> <p>sincerely,<br />\nsite adminstrator</p> <p>please click here more details <a href="{$link}">click here</a></p> <p>^ please click here set password {$restpasslink} ^</p> <p>^ please use forgot password link access ur account {$forgotpasslink}.^</p> now need sentence between [^] set dynamically. @ time 1 line should append para. if need {$forgotpasslink} line {$restpasslink} line should removed para. if need {$restpasslink} line {$forgotpasslink} line should removed para. set dynamically put both sentence between "^" special character. i tried lots make possible. not getting exact solution. if can me how can this. possible regx (preg_replace) or other solution. ...

jquery - Alignment issues with masonry -

Image
i know these masonry questions tend specific , cumbersome. time stuck , can't figure out why bottom row isn't floated 1 row. what got without masonry (just float left): what masonry: what expect: html <ul class="js-tiles tiles"> <li class="js-tiles-item tiles-item"><a href="#" class="tiles-link"><img src="http://lorempixel.com/300/190/" class="tiles-img"></a></li> <li class="js-tiles-item tiles-item"><a href="#" class="tiles-link"><img src="http://lorempixel.com/300/400/" class="tiles-img"></a></li> <li class="js-tiles-item tiles-item"><a href="#" class="tiles-link"><img src="http://lorempixel.com/300/400/" class="tiles-img"></a></li> <li class="js-tiles-item tiles-item"><...

Google App Engine Data Protection -

i know few things how google handles data withing google app engine: where data located - possible find out? how long data stored? , happens data gets deleted? can backup lost data or broken data? kind of security added protect data? you can find of answers here . more on acid where? google data centers across globe for how long? forever say, let's long need data there. if data gets deleted? if delete it'll propagated within sensible timeframe infrastructurally speaking if there accidental errors on google's side, data replicated , backed. to protect against accidental errors on side can use datastore admin console data data secured on google's side. if need transfer sensitive information, app engine enabled ssl custom domains recently. if don't want go through hassle of buying , registering certificates can use ssl through custom app engine domain free. more here

tokenize - Elasticsearch Facet Tokenization -

i using terms facet top terms in elasticsearch server. tags "indian-government" not treated 1 tag. treated "indian" "government" . , so, used tag "indian" . how can fix this? should change tokenization? 'settings': { 'analysis': { 'analyzer': { 'my_ngram_analyzer' : { 'tokenizer' : 'my_ngram_tokenizer', 'filter': ['my_synonym_filter'] } }, 'filter': { 'my_synonym_filter': { 'type': 'synonym', 'format': 'wordnet', 'synonyms_path': ...

.net - How to lazy load in C#? -

i'm developing emulator game. have object named "map", contains map's id, , other various information it. game contains lot of map objects (about 10,000). data located inside sql table, i'm using load it. i have class named cachedmaps inherits keyedcollection of int , map. identifier map's id. unfortunately, takes 5 seconds load maps. not maps visited, anyway. friend suggested use "lazy loading", i'm not sure how - like, load map's data or object when user enters it. how possible? thank you. public class cachedmaps : keyedcollection<int, map> { public cachedmaps() : base() { // loading code. // this.add(new map(....)); } } you should use lazy generic class purpose that. use example msdn : (the "large object" map): lazylargeobject = new lazy<largeobject>(() => { largeobject large = new largeobject(thread.currentthread.managedthreadid); // perform ad...

javascript - Set view finder in nvd3 line chart to specific time on x scale -

i can't figure out how initialize view finder in nvd3 linewithfocuschart exmaple last 3 days. have timestamp stored in 'data'. chart looks fine, don't know how set focus on specific time (example. have data 1 year period , @ last month @ page load). trying add brushextent without results. function drawlinechart(id, data, width, height){ var ch = nv.addgraph(function() { var chart = nv.models.linewithfocuschart() .width(width) .height(height) .x(function(d){return d.x}) .y(function(d){return d.y}); data = [ { key: "waga", values: [] } ]; for(var i=0; i<data.data.trackers[0].measurements.length; i++){ // parse data fit line chart structure data[0].values.push({x: data.data.trackers[0].measurements[i].date, y: parsefloat(data.data.trackers[0].measurements[i].value)}); } chart.xaxis.tickformat(function(d) { return d3.time.format('%x')(new date(d * 1000)) }); chart.x2axis.tickformat(func...

html5 - Raw image data conversion in javascript -

i raw image data server, best options draw on canvas , how do it? please give insight new html , javascript. want know how convert raw data , draw on canvas in html , javascript, if know width , height of raw image.basically dont know format of raw image need conversion. you can use context.createimagedata create imagedata object can fill rgba data server: example code demo: http://jsfiddle.net/m1erickson/xtatb/ // test data fill 30x20 canvas red pixels // test width/height 30x20 var canvaswidth=30; var canvasheight=20; // resize canvas canvas.width=canvaswidth; canvas.height=canvasheight; // create test data (you can use server data in production) var d=[]; for(var i=0;i<canvaswidth*canvasheight;i++){ // red & alpha=255 green & blue = 0 d.push(255,0,0,255); } // create new imagedata object specified dimensions var imgdata=ctx.createimagedata(canvaswidth,canvasheight); // data property of imagedata object // array filled test data var data=im...

php - Facebook Comments section gets truncated -

i have issue facebook comments on page of website: http://www.twisted-perfectionism.com/social-media-network-comparison/ the comment section gets truncated. can see 1 comment , 3/4. there more coments below, don't appear. what cause of this? don't :( please help! here code single.php: <?php get_header(); ?> <div id="page-<?php the_id(); ?>" class="panel box"> <div class="in"> <?php while ( have_posts() ) : the_post();?> <?php $format = get_post_format(); get_template_part( "formatz/".$format ); if($format == "") get_template_part( "formatz/standard" ); echo do_shortcode('[shareaholic app="share_buttons" id="xxx"]'); do_action('seo_facebook_comments'); ?> <?php endwhile; ?> </div>...

json - NelmioApiDoc Bad Request 400 with RestApi -

Image
the nelmio working in project error 400 bad request when want insert date in nelmio !! the type used date . i guess transaction details not needed parameters have defined in url of request. in case of being data, have specify {"transaction":{}} in content box on right.

networking - Use of Loopback interface in iBGP -

as understand loopback interface(127.0.0.1) used route packets source. how used talk ibgp neighbors? understand goal ensure interface doesn't go down, using emulated/software interface ensures that, how packets go out of host on loopback interface (and isn't against definition of loopback interface?). in advance. ibgp uses interior routing protocol route packet between ibgp nodes. doesn't/can't use loopback interface. uses whatever physical interface , leads destination.

php - textbox array only dispalying 1st word of a string from database -

i having subject table in mysql database value retrieving in php page textbox array. while retrieving showing 1st word of string in textbox. example -- subject name "intro c" in textbox showing "intro". pls see code reference -- <table width="400" border="1"> <tr> <td colspan="4" valign="top"><div align="center" class="style4">subject(s) details</div></td> </tr> <tr> <td width="87"><strong><span class="style1">select </span></strong></td> <td width="87"><strong><span class="style1">subject id </span></strong></td> <td width="270"><strong><span class="style1">subject name </span></strong></td> </tr> <?php $i=0; $result = mysql_qu...

java - error: String.format is not accepting event.getActionCommand() [as object] -

i writing basic gui program in java using event handler. code working fine except little error @ string s = string.format("field 1 %s", event.getactioncommand()) error the method format(string, object) of type string not applicable arguments format(string, string)`'. so event.getactioncommand()) returning string. format method not accepting that. i doing code in eclipse (kepler) using 1 of famous tutorial on internet. code worked not mine. quite beginner in java. please me in finding silly error. here code. package tushar_gui; import java.awt.flowlayout; import java.awt.event.actionlistener; import java.awt.event.actionevent; import javax.swing.jframe; import javax.swing.joptionpane; import javax.swing.jtextfield; import javax.swing.jpasswordfield; public class tush extends jframe{ private jtextfield textbox1; private jtextfield textbox2; private jtextfield textbox3 ; private jpasswordfield textbox_pass1; public tush(){ super("title...

sql - PostgreSQL simple query optimization -

postgresql 8.4; 3 tables - store (~100k, pk id, fk supplier_id & item_id), supplier(~10 pk supplier_id), item(~1000 pk item_id); i created following query data need: select store.quantity, store.price, x.supplier_name store natural join (select * item natural join supplier) x store.price > 500 , store.quantity > 0 , store.quantity < 100 , x.item_name = 'somename'; the query plan: nested loop (cost=20.76..6513.55 rows=8 width=229) -> hash join (cost=20.76..6511.30 rows=8 width=15) hash cond: (store.item_id = item.item_id) -> seq scan on store (cost=0.00..6459.00 rows=8388 width=23) filter: ((price > 500::numeric) , (quantity > 0) , (quantity < 100)) -> hash (cost=20.75..20.75 rows=1 width=8) -> seq scan on item (cost=0.00..20.75 rows=1 width=8) filter: ((item_name)::text = 'somename'::text) -> index scan using supplie...

javascript - Google Maps address form integration sending white screen -

i have website build in php smarty + added bootstrap. problem when add script integrating google maps, white screen. if remove inline script (here above script) blank screen disappears. tried removing each function 1 one inline script , still got blank screen. did not work until removed functions. <script type="text/javascript"> var placesearch, autocomplete; var componentform = { street_number: 'short_name', route: 'long_name', locality: 'long_name', administrative_area_level_1: 'short_name', country: 'long_name', postal_code: 'short_name' }; function initialize() { autocomplete = new google.maps.places.autocomplete( (document.getelementbyid('autocomplete')), { types: ['geocode'] }); google.maps.event.addlistener(autocomplete, 'place_changed', function() { fillinaddress(); }); } function fillinaddress() { var place = autocomplete.getplace(); (var ...

playframework - Custom view directories for Play Framework 2.x not working -

i'm new using play framework (2.2.x) , having tough time figuring out how render views not located in \app\views directory. my project organized such each section (directory) of app has it's own views, controllers, services, repositories... etc. it's structure i'd keep. looks this: \app\game\views \app\game\controllers \app\game\services \app\game\repositories \app\players\views \app\players\controllers \app\common\views \app\common\repositories ... etc views, can see above, in sub-directories in each app section. view locations vary 1 sub-directory deep many more. looks this: \app\game\views \app\game\views\sports.scala.html \app\game\views\dates.scala.html \app\game\views\invites.scala.html \app\common\views\layouts \app\common\views\layouts\default.scala.html \app\common\views\partials \app\common\views\partials\headers\default.scala.html \app\common\views\partials\headers\onboarding.scala.html ... etc if follow default 'play' way of render...

inheritance - When will scala ever return Any? -

i following scala course coursera taught martin odersky. giving brilliant examples return types , 1 thing puzzled me: if(true) 1 else false // return anyval closest subtype of both primitive types i assume following: if(true) tweet.comment("hello") else string("hello") // assume code return anyref however when scala ever return any? ever return any? i don't know scala, based on examples, if(true) 1 else "hello" should trick.

html - How to use absolute position relative to parent element -

html report contains rows elements should printed in same line. absolute left positions specified @ design time. each row should appear in next line after previous row without explicit top attribute like row1 field1 row1 field2 row2 field1 row2 field2 according http://www.tutorialspoint.com/css/css_paged_media.htm , absolute positioning , parent element absolute position parent relative element position. so must work: <!doctype html> <html> <head> <style> .row { position: relative; } .field { position: absolute; } </style> </head> <body> <div class='row'> <div class='field' style='left:5cm'>row1 field1</div> <div class='field' style='left:16cm'>row1 field2</div> </div> <div class='row'> <div class='field' style='l...

appcelerator - Appceleartor - prevent Android keyboard from appearing when clicking on a TableView row -

i in process of building app appcelerator alloy , cannot figure out how prevent android keyboard appearing when click on tableview row - or perhaps when resulting $.mywindow.open() event fires. here alloy xml: <alloy> <tabgroup title="testing"> <tab title="news"> <window id="newswindow" class="container" title="news"> <tableview id="tableview"/> </window> </tab> <tab title="photos"> <window class="container" title="photos"> <label>testing</label> </window> </tab> </tabgroup> here xml of row injected tableview: <alloy> <tableviewrow id="rowview"> <imageview id="image"/> <view id="postview" layout="vertical"> <label id="articlelabel"/> ...

Python casting int("string", integer) -

what logic behind int("string", integer) for example: int("220", 3) yields 24 the optional integer numeric base use in converting string (defaults base 10). 220 base 3 = 2 * (3**2) + 2 * (3**1) + 0 * (3**0) = 2*9 + 2*3 + 0*1 = 18 + 6 + 0 = 24

java - JOption call method from String text? -

i'm not sure how ask question here is. please @ code (which abbreviated convenience, , don't worry "sam" temporary) public class jeopardygui_main11 extends javax.swing.jframe { /** * creates new form jeopardygui_main */ public jeopardygui_main11() { initcomponents(); setdefaultcloseoperation( jframe.exit_on_close ); } public void info(){ string[] = new string[25]; string[] sp = new string[25]; string[] mu = new string[25]; string[] spe = new string[25]; string[] tv = new string[25]; string[] mo = new string[25]; string[] ama = new string[25]; string[] spa = new string[25]; string[] mua = new string[25]; string[] spea = new string[25]; string[] tva = new string[25]; string[] moa = new string[25]; am[0] = "sam";ama[0] = "sam"; am[1] = "sam";ama[1] = "sam"; ... am[23] = "sam";ama[23] = "sam"; am[24] = "sam";ama[24] = "s...

ios - How to redraw view layout on rotation -

i have .h file using thought project, #import file use #define vars layout views correctly. this screensize.h file looks like. #import <foundation/foundation.h> #define screenwidth ((int) [uiscreen mainscreen].bounds.size.width) #define screenheight ((int) [uiscreen mainscreen].bounds.size.height) @interface screensize : nsobject @end i know when user browsing page , lays out correctly decide rotate how update screenwidth , screenheight correct values.. , update current view thats being rotated? any appreciated. this better implemented static methods, rather #defines: +(cgfloat)screenwidth { if(uiinterfaceorientationisportrait([uiapplication sharedapplication].statusbarorientation)){ return [uiscreen mainscreen].bounds.size.width; }else{ [uiscreen mainscreen].bounds.size.height; } } +(cgfloat)screenheight { if(uiinterfaceorientationisportrait([uiapplication sharedapplication].statusbarorientation)){ return [uiscre...

How to use left join of sql in Rethinkdb ReQL with secondary index? -

i have 2 table a , b i use left join in sql means content of , common content of b. tried use outer join like: r.table("a").outerjoin(r.table("b"),function(a,b){ return a("id")==b("anotherfield")("joinfield") }) but query slow there no index in table b . how can use secondary index when querying outerjoin ? equivalent sql select * left join a.id = b.other_field_join you can map here: r.table('a').map(function(row) { return {left_row: row, right_rows: r.table('b').getall(row('id'), {index:'idx'})}; })

javascript - jQuery animate() Buggy in Firefox -

this question has answer here: jquery animations choppy , stutter in firefox 3 answers i've written simple timer application changes color of background timer progresses, giving visual indication of how close being out of time are. seems work fine in chrome, encounters serious issues in firefox. instead of sliding cleanly across page, background flickers , jumps until gets close end, @ point behaves expected. edit: issue did, in fact, turn out problem css. javascript/jquery correct. the page: andrewcombs13.com/mystuff/timer/ relevant html: <div id="slider"></div> relevant css: #slider { position: fixed; top: 0px; bottom: 0px; left: 0px; right: 100%; z-index: fixed; background-color: red; } relevant javascript: var sliderpercent = (window.time * 100 / window.timeset); if(sliderpercent > (window.lastsliderpercent + 75)) { ...

sungridengine - Sun Grid Engine : How to check the machine that a job was run on? -

is there flag make sge output machine dispatched job run on ? looked through man couldn't pinpoint anything. there several possibilities: 1: while job running, use qstat -g t nodes, job(s) is/are running. 2: after job has finished, qacct -j [jobid] shows information each node, job running on. 3: on linux execute command hostname (or mpirun hostname ) print respective nodes.

php - Zend\File\Transfer\Adapter\Http on receive : error "File was not found" with jQuery File Upload -

here 2 questions problem zf2 file upload jquery file upload - file not found can't blueimp / jquery-file-upload , zf2 running without ansers. , i'm create issue on zf2 code examples. github.com/zendframework/zf2/issues/6291 and have request developer on email question, how implement jquery file upload zf2. github.com/blueimp/jquery-file-upload so, there real problem many peple, , no manuals, no answers. please, before send me read documentation, notice, i'm spend many hours on problem , read documentation , not i'm have problem. please, write manual code examples, how implement it. or answer, why have error , how resolve it? there i'm copy example zf2 issue. i'm try use jquery-file-upload copy standard tpl, include css , scrypts , it's work, send files controller. controller doesn't work. here code public function processjqueryaction() { $request = $this->getrequest(); $response = $this->getresponse(...