Posts

Showing posts from March, 2013

ruby - Heroku Production Rails(3.2.3) Active admin(0.5) NoMethodError in create & update -

as working on active admin(0.5) rails 3.2.3 using multilingual support using globalise 3 . when running application on local under development & production environment works great. but when deployed on heroku production mode throwing me error same code using on local. when click on create new page giving me below error: nomethoderror in admin::hometemplatescontroller#new undefined method `build_app_page' nil:nilclass rails.root: /app application trace | framework trace | full trace app/admin/home_templates.rb:16:in `new' please find below code activeadmin.register hometemplate menu false config.clear_action_items! form :partial => "form" controller protect_from_forgery :except => :sort def new # @home_template =hometemplate.new # if !!current_ability.attributes_for(:create, hometemplate)[:app_instance_id] # @valid_parents = apppage.where("app_instance_id = ? , parent_id null", cur

c# - How to serialize IEnumerable<char> as string & Confusing Deserialization error -

lets have following simple class: [xmlroot] [xmltype("string")] public partial class estring : ienumerable<char> { string asstring {get;set;} public ienumerator<char> getenumerator() { return this.asstring.tochararray().tolist().getenumerator(); } ienumerator ienumerable.getenumerator() { return this.asstring.tochararray().getenumerator(); } public void add(char character) { this.asstring += character; } } also namedvalue class: [xmlroot] public partial class enamedvalue: keyvaluepair<estring,object> {...} and finally, [xmlroot] public partial class elist<t>: list<enamedvalue> {...} now, serialize elist or class inherits elist using following xml serializer: public static xdocument serialize<t>(this t obj) t: new() { type tt = obj.gettype(); xmlserializer xssubmit = new xmlserializer(tt); stringwriter sww = new stringwriter();

Scala SBT refresh error -

when trying add akka dependency using sbt getting below error, error:error while importing sbt project: ... @ sbt.mainloop$$anonfun$runwithnewlog$1.apply(mainloop.scala:66) java hotspot(tm) 64-bit server vm warning: ignoring option maxpermsize=384m; support removed in 8.0 @ sbt.using.apply(using.scala:25) @ sbt.mainloop$.runwithnewlog(mainloop.scala:66) @ sbt.mainloop$.runandclearlast(mainloop.scala:49) @ sbt.mainloop$.runloggedloop(mainloop.scala:33) @ sbt.mainloop$.runlogged(mainloop.scala:25) @ sbt.standardmain$.runmanaged(main.scala:57) @ sbt.xmain.run(main.scala:29) @ xsbt.boot.launch$$anonfun$run$1.apply(launch.scala:109) @ xsbt.boot.launch$.withcontextloader(launch.scala:129) @ xsbt.boot.launch$.run(launch.scala:109) @ xsbt.boot.launch$$anonfun$apply$1.apply(launch.scala:36) @ xsbt.boot.launch$.launch(launch.scala:117) @ xsbt.boot.launch$.apply(launch.scala:19) @ xsbt.boot.boot$.runimpl(boot.scala:44) @ xsbt.b

encryption - Assistance in Decrypting Lua script that is obfuscated with Base64 > SSL -

can on here me on decrypting ssl encryption protects lua script linked @ end of topic? encoded base64 ssl, have no idea how ssl portion. used program called bot of legends, , told me possible break encryption dumping decryption function of said program , using ssl key, have no clue start on that. these scripts work connecting authentication server coded script, , have gotten few on own sniffing traffic auth server network packets server link , created own auth server apache, redirected network traffic goes server own script script validated response. scripts have stronger encryption, not easy , have source code remove coding runs auth server checks. until few days ago had no knowledge on how lua coding worked , how compute how auth server checks possible coding in simple text file due lua obfuscation. bear me, if can chime in , give me idea on can do. regards, chris *** pastebin link script in question in raw format: http://pastebin.com/raw.php?i=bg0vqqgw the base64 section

javascript - Trying to setup tests with mocha, babel & es6 modules -

i'm trying leverage grunt & babel load es6 source dependency given test. i've been running actual src , compiling app fine via browserify: module.exports = function (grunt) { // import dependencies grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-contrib-jshint'); grunt.loadnpmtasks('grunt-browserify'); grunt.initconfig({ browserify: { dist: { files: { 'www/js/bundle.js': ['src/app.js'], }, options: { transform: [['babelify', { optional: ['runtime'] }]], browserifyoptions: { debug: true } } } }, jshint : { options : { jshintrc : ".jshintrc", }, dist: { files: { src: ["src/**/*.js"] } } }, watch: { scripts: { files: ['src/**/*.js'], tasks: ['jshint', 

android - How to pass data to fragment when click on cardview in onBindViewHolder? -

here adapter code , want pass data "particularfragment" note : particularfragment extends fragment public class topicsadapter extends recyclerview.adapter<topicsadapter.viewholder> { private context context; private arraylist<quoteitems> itemlist; public topicsadapter(context context, arraylist<quoteitems> itemlist) { this.context = context; this.itemlist = itemlist; } @override public topicsadapter.viewholder oncreateviewholder(viewgroup viewgroup, int i) { view v = layoutinflater.from(viewgroup.getcontext()).inflate(r.layout.adapter_topics_recycler_view_items, viewgroup, false); viewholder viewholder = new viewholder(v); return viewholder; } @override public void onbindviewholder(final topicsadapter.viewholder viewholder, int i) { final quoteitems quoteitems = itemlist.get(i); viewholder.txtquote.settext(quoteitems.getquote()); viewholder.cardvi

naming - Is it ok to use dashes in Python files when trying to import them? -

basically when have python file like: python-code.py and use: import (python-code) the interpreter gives me syntax error. any ideas on how fix it? dashes illegal in python file names? you should check out pep 8 , style guide python code: package , module names modules should have short, all-lowercase names. underscores can used in module name if improves readability. python packages should have short, all-lowercase names, although use of underscores discouraged. since module names mapped file names, , file systems case insensitive , truncate long names, important module names chosen short -- won't problem on unix, may problem when code transported older mac or windows versions, or dos. in other words: rename file :)

ios - AsyncDisplayKit CellNode setting highlighted color -

i'm using async display kit display cell nodes in astableview. how can set custom color cell node's selected state. normal tableview cells override (void)sethighlighted:(bool)highlighted animated:(bool)animated in cell implementation, method doesn't exist on ascellnodes. has else encountered problem , how did solve it? assuming you've subclassed ascellnode create own cells, add own sethighlighted method. e.g. - in ascellnode subclass - (void)sethighlighted:(bool)highlighted { if (highlighted) { self.backgroundcolor = [uicolor bluecolor]; } else { self.backgroundcolor = [uicolor whitecolor]; } } - in delegate implementation - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { mynodesubclass * node = (mynodesubclass *)[(astableview *)tableview nodeforrowatindexpath: indexpath]; [node sethighlighted: yes]; } note: you'll need maintain own state in regards cells

asp.net mvc - Orchard CMS: How to display a content-item field inside a separate widget? -

i'm new orchard cms, , have been dealing creating custom theme far. i've run across issue , i'm not sure know right concepts yet want do... here goes: i following: add custom field "page" content type, called "parent title." on pages, display content of parent title field inside "before main" widget zone. so author creates new page in cms fill out fields, example: page title: "company abc hiring" parent title: "careers @ company abc" etc. and rendered markup orchard (slightly simplified brevity): <div id="layout-before-main"> <div class="zone zone-before-main"> careers @ company abc </div> </div> ... <div id="content"> <div class="zone zone-content"> <article class="page content-item"> <header><h1>company abc hiring</h1></header> <p&

html - jQuery fadeout won't work with links? -

<a target="_blank" href="http://bc.vc/gq4qse"> <img class="bcvc_ad1" src="http://bdeas.com/wp-content/uploads/2015/08/ad1.jpg" alt="ad1" width="80" height="80" /> </a> <script> $( ".bcvc_ad1" ).click(function() { $( ".bcvc_ad1" ).fadeout( "slow", function() { // animation complete. }); }); </script> link seems not fadeaway when clicked. problem? you have specify image id, not class name. that's error. fadeout works ids can see in following link for more information, here .

r - How to fill geom_polygon with different colors above and below y = 0? -

Image
considering following polygon plot: ggplot(df, aes(x=year,y=afw)) + geom_polygon() + scale_x_continuous("", expand=c(0,0), breaks=seq(1910,2010,10)) + theme_bw() however, want fill 2 different colors. example red black areas above 0 , blue black areas below 0 . unfortunately, using fill=col doesn't fill correct areas. i tried following code (i added geom_line in order illustrate border of fill should be): ggplot(df, aes(x=year,y=afw)) + geom_line() + geom_polygon(aes(fill=col), alpha=0.5) + scale_x_continuous("", expand=c(0,0), breaks=seq(1910,2010,10)) + theme_bw() which gives: as can see, it's filling lot more it's supposed do. how can solve this? the data: df <- structure(list(year = c(1901, 1901, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936,

mysql - How to use value from two different rows of a table in another table -

i have mysql table following structure , data: increments id emp_id starting_salary increment_rate increment_frequency 2 340 5000 250 1 3 340 5000 250 4 i need have aliases, a , b hold value based on following formula: starting_salary + (increment_rate * increment_frequency) to precise, want a = 5250 (based on a = (5000 + (250 * 1)) ) , b = 6000 (based on b = (5000 + (250 * 4)) ) now have table following data: payslips id employee_id salary_month arrear 173824 340 '2015-06-01' 2350 i want join a , b got table increments table payslips . , want use a , b in following way: ((a * 8) / 30 + (b * 22) / 30) my alias basic_salary . basic_salary hold value above calculation: basic_salary = ((a * 8) / 30 + (b * 22) / 30) = ((5250 * 8) / 30 + (6000 *22) / 30) = (1400 + 4400) = 5800

jsp - <c:choose> not interpreted, all <c:when> and <c:otherwise> bodies are evaluated -

i wanna show state of user when logged in web site. found out better use el tags. didnt work. please me. <c:choose> <c:when test="${null}" > ${"welcome unknown user"} </c:when> <c:otherwise> <c:out> ${"welcome dear"} ${sessionstateuser} </c:out> </c:otherwise> </c:choose> i don't think c:choose -> c:when block constructed correctly. also, why texts referenced variables? it should more this: <c:choose> <c:when test="${sessionstateuser == null}" > welcome unknown user </c:when> <c:otherwise> welcome dear <c:out value="${sessionstateuser}"/> </c:otherwise> </c:choose> i don't see reason need line: var= "test" value = "${sessionstateuser}" - in case, naming variable test confusing because jsp test attribute.

javascript - I think i have a wrong pattern of AngularJS email or what? -

this video i put spaces in front @ mark submit button doesn't disappear, why? still wrong mistake value , want submit button disapear. my code this <html> <head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min.js"></script> </head> <body ng-app="ctrljs"> <form name='myform' ng-controller='formctrl'> <input type='email' name='email' ng-model='email' required ng-pattern="/^[a-za-z0-9._%+-]+@[a-za-z0-9.-]+\.[a-za-z]{2,4}$/"> <span ng-show='myform.email.$error.email'> <font color='red'>invalid email</font></span> <input type='submit' value='submit' ng-hide="!myform.$valid"></input> </form> &l

apache spark - Save sparkR dataframe with HiveContext using saveAsTable command -

how save sparkr data frame when working hivecontext using saveastable command df_5 <- loaddf(sqlcontext, "report02_cashier_hourly_total_trans_july30.parquet", "parquet") /*i loaded parquet file dataframe*/ sqlcontext <- sparkrhive.init(sc) /*initialized hive context*/ sql(sqlcontext, "create table report2_cashier_hourly (location_code int, business_date date, cashier string, hour string, store_no string, region string, city string, zone string, total_trans int)") /*created table report2_cashier_hourly*/ how use saveastable(df, tablename, source, mode, ...) save df_5(data frame) hive table report02_cashier_hourly .

php - set form autocomplete off in codeigniter global -

in codeigniter module. have around 75 pages forms, need add auto complete attributes globally. example, set autocomplete off attribute on view pages i think, need use jquery in less complex manner. you can use code: $('form').attr('autocomplete', 'off'); it assign autocomplete attribute forms.

ios - Scroll UITableViewCell visible and highlight it -

i have following setup: uitableview leads (when user selects cell) uipageviewcontroller , user can scroll same items presented in uitableview without going , selecting item. when user go back, want scroll last viewed item in uipageviewcontroller , highlight it, user knows better (s)he is. using tableview:scrolltorowatindexpath:atscrollposition:animated: can scroll last viewed cell, , tableview:selectrowatindexpath:animated:scrollposition: , tableview:deselectrowatindexpath:animated , can highlight cell. haven't figured out nice, clean way both @ same time, is, first scroll , highlight cell. here current working, hacky solution, break down: if let visible = tableview.indexpathsforvisiblerows { if !visible.contains(indexpath) { // cell not visible, scroll required tableview.scrolltorowatindexpath(indexpath, atscrollposition: .middle, animated: true) // highlight cell after 0.4 seconds (aka after scroll animation) let delaytime = di

python - If statement check list contains is returning true when it shouldn't -

i have list contains values: ['1', '3', '4', '4'] i have if statement check if values contained within list output statement: if "1" , "2" , "3" in columns: print "1, 2 , 3" considering list doesn't contain value "2", should not print statement, is: output: 1, 2 , 3 can explain why case? way python reads list making occur? it gets evaluated in order of operator precedence : if "1" , "2" , ("3" in columns): expands into: if "1" , "2" , true: which evaluates ("1" , "2") leaving with: if "2" , true finally: if true: instead can check if set of strings subset of columns : if {"1", "2", "3"}.issubset(columns): print "1, 2 , 3"

regex - Javascript replacing characters using replace() -

this question has answer here: javascript replace method, replace “$1” 2 answers i have piece of code <html> <head> <title>javascript string replace() method</title> </head> <body> <script type="text/javascript"> var re = /(\w+)\s(\w+)/; var str = "zara ali"; var newstr = str.replace(re, "$2, $1"); document.write(newstr); </script> </body> </html> can explain please , how it's read? var re = /(\w+)\s(\w+)/; also in str.replace(re, "$2,$1); , $2 & $1? refer link in comment posted above learn regular expressions. explain code posted does... var re = /(\w+)\s(\w+)/; regular expression. leading , trailing / delimiters , don't have replacement going on other telling interpret

php - Get date from timestamp in laravel -

how can date "2015-07-31 06:03:21" using laravel query builder? in normal query using date() can date easily, don't know how use date() in laravel query builder. please check code sample given below , correct me? normal query select date('2015-07-31 06:03:21'), customer_id customer_histories laravel query builder $customerhistory = customerhistory::where('customer_id', 1) ->select('freetext', 'date(created_at)') ->get(); you can db::raw() , though if selecting it, why not take created_at complete? default, eloquent convert created_at , updated_at columns instances of carbon can handle in code: $customerhistory = customerhistory::where('customer_id', 1) ->select('freetext', 'created_at') ->get(); dd($customerhistory[0]->created_at->todatestring());

excel - Power Query Transform a Column based on Another Column -

i keep thinking should easy answer evading me. in excel power query, transform value in each row of column based on column's value. example, assume have table1 follows: column | column b ------------------- x | 1 y | 2 i transform values in column based on values in column b, without having add new column , replace original column a. have tried using transformcolumns input can target column's value - can't access other field values in row/record within transformcolumns function. like able this: =table.transformcolumns(table1, {"column a", each if [column b]=1 "z" else _ }) which result in: column | column b ------------------- z | 1 y | 2 i know there ways this, i'm trying find 1 least amount of steps/transformations. example, know use table.addcolumn add new column based on function looks @ column b, have remove original column , replace new column requires multiple additional steps. here ho

javascript - How do I display a popup showing feature attributes from a Geoserver WMS layer in a leaflet map? -

i'm pretty new leaflet , i'm trying pretty basic (or thought) functionality on webmap. in short, have many (179) wms layers hosted on geoserver , user able click feature , display popup showing information feature. i have 179 layers each representing polygon footprints of paper map sheets map library work for. each of layers represents 1 "series" of maps in collection. attribute fields each layer identical. of features stacked on top of 1 (multiple records different editions of same map). give idea of i'm interested in creating, here link pilot application (showing 3 of layers) made in arcgis online. forgive elementary html, example show needed do. i have created leaflet map displaying 2 of layers , add other layers once figure out functionality. is possible make popup can show information multiple features multiple layers? can control attributes displayed in popup? would easier kind of "info window" rather popups? really, suggest

Google maps API usage limits -

i have used google map api unfortunately have discovered have usage limits want know there anyway o google map api without usage limits, , if not how can license? google maps api usage , limits do need api key? answer: in days of google maps did not require api key (it still possible not have 1 due backwards compatibility) however, today, recommended generate api key google maps v3. also, have in mind features not available without api key. if want inform self more api key, here official page tell how started , how include project, url: https://developers.google.com/maps/documentation/javascript/tutorial what usage limits? answer: if site gets 25 000 map loads or more every single day, more 90 days in row, google team in touch (they aware of google maps usage). if don't think google maps generate such amount of traffic following: modify application usage less 25 000 map loads per day. enroll automated billing of excess map loads in google

c# - How to find the second word in a string -

Image
when run code, it's purpose obtain first, second, , third word in 3 word sentence , have each of words display in text box. sentence use 'kerry tells stories', @ pic see mean, the problem however, when run it, third word 'stori', happened 'es' making 'stories' var tbt = textbox.text; var firstword = tbt.substring(0, tbt.indexof(" ")); var indexword = tbt.indexof(" "); var indexnumber = indexword +1; string mystring = indexnumber.tostring(); var secondword = tbt.substring(indexnumber, tbt.indexof(" ")); var indexword2 = tbt.indexof(" ", indexnumber); var indexnumber2 = indexword2 + 1; string mystring2 = indexnumber2.tostring(); var thirdword = tbt.substring(indexnumber2, tbt.indexof(" ")); var indexword3 = tbt.indexof(" ", indexnumber2); var indexnumber3 = indexword3 + 1; string mystring3 = indexnumber3.tostring(); textbox6.text = firstword; textbox7.text = secondword

xcode - How To apply css properties in react native by using refs dynamically -

here instance need login div , hide using refs how achieve ? var text=react.createclass({ componentdidmount:function(){ console.log(this.refs.login.getdomnode()); }, render:function(){ return (<view ref="login"> <text>abc</text> <text>123</text> </view>) } })` you this: render: function() { if(this.props.show) { return (<view ref="login"> <text>abc</text> <text>123</text> </view>) } else { return null; } }

java - BuildConfig.class for all flavors -

i'm trying run robolectric constant buildconfig.class looks not available flavors generated gradle. there command have gradle make file of them? the buildconfig automatically generated based on build flavor select. in android studio, click on build variants on left of ide window. select build flavor, clean project , buildconfig generated according selected flavor. can show gradle file?

angularjs - Sending POST request from NODE server to payment gateway -

in current implmentation mean stack, customers opting online payment, have created hyperlink this. <div> <a class="btn btn-pram-primary btn-block" href="node/public/orders">online payment</a> </div> and intercept url in node fallowing code. var sendrequesttopayu = function( req, res, next ) { console.log('in sendrequesttopayu' ); var post_data = querystring.stringify({ 'txnid': '1', 'amount': '100', 'productinfo' : 'abcd', 'firstname' : 'username', 'email' : 'user@user.com', 'phone' : '9876543210' }); request({ url: 'https://test.payu.in/_payment', //url hit method: 'post', headers: { 'content-type': 'mycontenttype', 'content-length': post_data.length }, body

Can we record screen video of android devices? -

is source code or sample project allows record video of running screen of application. have make application has ability record video of application screen in android devices. search this, haven't find anything. i have developed it. for have make background service , programmatically capture screenshot on every second , after combine images , make video using ffmpeg. i hope work you. let me know if need more in same.

perl - Not able to use 'copy_perm' option in Net::SFTP::Foreign module -

i want copy file remote host local host preservation of file permission, hence tried use 'copy_perm' option per documentation of net::sftp::foreign mentioned below - my $sftp = net::sftp::foreign->new( host => $host, key_path => $ssh_key_path, copy_perm => 1, more => [ -o => 'compression yes' ] ); but getting below error - invalid option 'copy_perm' or bad combination of options @ test.pl @ line 101. the line 101 net::sftp::foreign object creation mentioned above. did miss or has faced same issue before? that's because copy_perm isn't option new method. use in get , put .

How to compare enum with associated values by ignoring its associated value in Swift? -

after reading how test equality of swift enums associated values , implemented following enum: enum cardrank { case number(int) case jack case queen case king case ace } func ==(a: cardrank, b: cardrank) -> bool { switch (a, b) { case (.number(let a), .number(let b)) == b: return true case (.jack, .jack): return true case (.queen, .queen): return true case (.king, .king): return true case (.ace, .ace): return true default: return false } } the following code works: let card: cardrank = cardrank.jack if card == cardrank.jack { print("you played jack!") } else if card == cardrank.number(2) { print("a 2 cannot played @ time.") } however, doesn't compile: let number = cardrank.number(5) if number == cardrank.number { print("you must play face card!") } ... , gives following error message: binary operator '==' cannot applied operands of type 'cardrank'

hadoop - Unable to write file on HDFS -

Image
i have installed hadoop-2.6.0 , checked hadoop daemons running. able create or copy directory in hdfs not able copy file hdfs. command: bin/hadoop fs -copyfromlocal /home/130853/hadoop_data/abc /trial/abc it's giving following exception: exception in thread "main" java.lang.unsatisfiedlinkerror: org.apache.hadoop.util.nativecrc32.nativecomputechunkedsumsbytearray(ii[bi[biiljava/lang/string;jz)v @ org.apache.hadoop.util.nativecrc32.nativecomputechunkedsumsbytearray(native method) @ org.apache.hadoop.util.nativecrc32.calculatechunkedsumsbytearray(nativecrc32.java:86) @ org.apache.hadoop.util.datachecksum.calculatechunkedsums(datachecksum.java:430) @ org.apache.hadoop.fs.fsoutputsummer.writechecksumchunks(fsoutputsummer.java:202) @ org.apache.hadoop.fs.fsoutputsummer.flushbuffer(fsoutputsummer.java:163) @ org.apache.hadoop.fs.fsoutputsummer.flushbuffer(fsoutputsummer.java:144) @ org.apache.hadoop.hdfs.dfsoutputstream.close(dfsoutputst

java - JSTL accessing c:set variable and convert into SimpleDateFormat -

i have following sourcecode: <c:set var="runtimeend" value="${content.valuelist.promotion[0].value.runtimeend}"/> which number in jsp , stands date example: 1425769140000 how access variable in java? imean when following wont load page anymore: <% out.println(${runtimeend}); %> i insert variable following java code display date <% simpledateformat simpledateformat = new simpledateformat("dd mmmmmmmmm yyyy"); out.println(simpledateformat.format(${runtimeend})); %> why want use scriplets? work jstl library if have started it. jstl format date library seems need. example: <c:set var="runtimeend" value="${content.valuelist.promotion[0].value.runtimeend}"/> <fmt:formatdate pattern="yyyy-mm-dd" value="${runtimeend}" /> p.s. print variable using jstl library, use <c:out value="this printed" /> tag. scriplets approach: printing: <%=pag

bash - Extracting MAC Address from arp table using grep regex -

i trying extract mac address arp table without returning empty line. i tried use command: arp -a | grep eth1 | grep '^\a(([0-9a-fa-f]{2}):){5}([0-9a-fa-f]{2})$\z' the 'arp -a' command return: ? (192.168.36.20) @ 80:e0:1d:43:b0:60 [ether] on eth1 ? (192.168.0.1) @ 34:4b:50:b7:ef:08 [ether] on usb0 ? (172.17.140.200) @ 10:c3:7b:c4:82:04 [ether] on eth0 thanks solved using: arp -a | grep eth1 | grep -o -e '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'

conditional rewrite or try_files with NGINX? -

i'm having trouble setting conditional rewrite, , i've been trying use if directive (despite sources indicating it's "evil") -f switch check presence of file, it's not working. believe issue/case best explained example, here goes: directory structure workspace/ myapp/ webroot/ index.php assets/ baz.js hello/ foo.js modules/ hello/ assets/ foo.js bar.js expected results / => /workspace/myapp/webroot/index.php /assets/hello/foo.js => /workspace/myapp/webroot/assets/hello/foo.js /assets/hello/bar.js => /workspace/myapp/modules/hello/assets/foo.js /assets/baz.js => /workspace/myapp/webroot/assets/baz.js in summary: foo.js present in modules/hello/assets folder , gets delivered there. bar.js present both in webroot/assets/hello , modules/hello/assets , gets delivered webroot . (it hides/overrides file in modules )

Manage Selenium Grid queue -

i have 1 grid hub server , 3 selenium nodes. execute multiple test suite against one grid hub server. each test suite executed on 3 servers , rest of test suits (pending) wait till current test suite finish execution. can grid hub manage queue of test suits? if no, there workaround or solution? tldr; - yes. grid can manage. long answer selenium hub doesn't care whether requests coming 3 different test suites or one. think in way - hub process requests comes it. when request comes, hub see if there node has capability execute request. if there 1 available , free, send command node. if there node can execute request busy now, send command queue. if there no nodes has requested capability, request marked failed. hub doesn't check source of request anywhere in above flow.

virtualbox - Unable to install devstack in Virtual Box -

i followed steps below, i'm getting error. install virtual box (version 5.0.0) running on windows 7 host machine. install ubuntu server version 14.04.02 on it. git clone https://github.com/openstack-dev/devstack.git cd devstack; cp samples/local.conf . after ran ./stack.sh came error after running approx 30 minutes: 2015-07-21 20:04:18.841 | error (connectionrefused): unable establish connection 10.0.2.15:8774/v2/c199aa06389a4c8c85dffddad18fce1b/flavors/… 2015-07-21 20:04:20.433 | + exit 1 deb@devstack:~/devstack$ please me in resolving issue try re-running stack. thats best hack found devstack debugging.

jquery - Uploading files Formdata and JSON data in the same request with Angular JS -

how combine 2 $http.post single http post? $scope.mymethod = function(){ var fd = new formdata(); angular.foreach($scope.files, function(file){ fd.append('file', file); }); $http.post('my_url', fd, { transformrequest: angular.identity, headers: {'content-type': undefined} }).success(function(result){ console.log(result); }); $http.post('my_url', {imgx: $scope.imgx, imgy: $scope.imgy, imgh: $scope.imgh, imgw: $scope.imgw}).success( function(data){ console.log(data); }); } any appreciated, thank you try this: $scope.mymethod = function(){ var fd = new formdata(); angular.foreach($scope.files, function(file){ fd.append('file', file); }); var data = {}; data.fd = fd; data.otherdata = {imgx: $scope.imgx, imgy: $scope.imgy, imgh: $scope.imgh, imgw: $scope.imgw}; $http.post('my_url', fd, { transformre

ios - UICollectionView cell.ViewWithTag returning nil for UILabel -

this label seems return nil, though have reuseidentifier , tag set properly. override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { var identifier: string = "collectioncell" var cell: uicollectionviewcell = collectionview.dequeuereusablecellwithreuseidentifier(identifier, forindexpath: indexpath) as! uicollectionviewcell // configure cell //save till later, when images present //var cellitem1 = hostmanager[indexpath.row * 2] let label:uilabel = cell.viewwithtag(1) as! uilabel return cell } the program breaks label set = viewwithtag. have no custom class set cell, prototype. tag set on storyboard. getting error "exc_bad_instruction...". appreciated, thanks! try removing line viewdidload: self.collectionview!.registerclass(uicollectionviewcell.self, forcellwithreuseidentifier: reuseidentifier)

php - Timezone specific "Open Now" function -

i need 'is open now' php function on site building. looking @ previous question , have built mysql table: hours_id int not null, loc_id int not null, dow tinyint not null, open_time time not null, close_time time not null, then using: "select open_time, close_time opening_hours dow=dayofweek(curdate()) , loc_id=:loc_id" i can work out if open or not. product building global , need 'open now' related timezone location in, not server location or viewers location. i storing country code , lat/lng of location in related db, thoughts obtain timezone that, or provide method user select one, , modify sql somehow. am heading in right direction? method be? read time zone support in mysql , , ensure mysql database configured current time zone tables. update regularly. associate each location named iana/olson time zone, such "america/los_angeles" , or "europe

I need to receive data from server in JSON format in my Android app -

here json { "keys": [ "10_ultimate", "20_yemensoft" ] } when hit directly in url getting correct response not android. have seen in jsonlint json format correct. getting following message: org.json.jsonexception: unterminated array @ character 11 of [b@41c16df8 when hit url http://192.168.0.103:8080/androidrest/financial/finlist i getting correct json response validated in jsonlint.com { "keys" : [ "10_ultimate", "20_yemensoft" ] } when try deserialize android saysorg.json.jsonexception: unterminated array @ character 11 @override public void onsuccess(int statuscode, header[] headers, byte[] response) { jsonobject jsnobj = new jsonobject(); string res = response.tostring(); try { jsonobject json = new jsonobject(res); jsonarray jsnarry = json.getjsonarray("keys");

ios - In Swift, how can I quickly set my instance variables? -

public class user { var id: int var fb_id: string? var first_name: string? var last_name: string? var age: int? var distance: int? var login_at_pretty: string? var login_at: int? var profile: profile? init(id: int, fb_id: string?, first_name: string?, last_name: string?, age: int?, distance: int?, login_at_pretty: string?, login_at: int?, profile: profile?){ self.id = id if let fb_id = fb_id { self.fb_id = fb_id } if let first_name = first_name { self.first_name = first_name } if let last_name = last_name { self.last_name = last_name } if let age = age { self.age = age } if let distance = distance { self.distance = distance } if let login_at_pretty = login_at_pretty { self.login_at_pretty = login_at_pretty } if let login_at = login_at { self.login_a