Posts

Showing posts from May, 2014

Python 2.7 file read error -

i struggling file access - have python 2.7 here: c:\python27 i created txt file data.txt and trying shell read , print values it. location of data.txt in same folder (c:\python27\data.txt) every time got same error msg: traceback (most recent call last): file "c:/python27/filereader.py", line 1, in <module> infile = open('data.txt', 'r') # open file reading. ioerror: [errno 2] no such file or directory: 'data' you need enter full filename data.txt instead of data only: infile = open('data.txt', 'r')

angular - Using Resolve In Angular2 Routes -

in angular 1 config looks this: $routeprovider .when("/news", { templateurl: "newsview.html", controller: "newscontroller", resolve: { message: function(messageservice){ return messageservice.getmessage(); } } }) how use resolve in angular2? @andréwerlang's answer good, if want resolved data on page change when route parameter changes , need to: resolver: @injectable() export class messageresolver implements resolve<message> { constructor(private messageservice: messageservice, private router: router) {} resolve(route: activatedroutesnapshot, state: routerstatesnapshot): observable<message> { const id = +route.params['id']; return this.messageservice.getbyid(id); } } your component: ngoninit() { this.route.data.subscribe((data: { message: message }) => { this.message = data.message; }); }

pug - How to use angular2 html binding in jade? Specifically a([router-link]=["/Default"]) -

so have issue mentioned in title. jade compiles li([router-link]=\["/listen"\]) listen to <li [router-link]="/listen">listen</li> where need <li [router-link]=["/listen"]>listen</li> i tried escaping \ won't compile. should use global mixins or there way? http://html2jade.org/ try : li([router-link]='["/listen"]') listen

javascript - Getting unexpected behaviour with firefox web console, equality for undefined not working fine -

Image
when trying write following javascript code snippet in mozilla web console getting following unexpected behaviour.please refer below image.when declared variable x undefined check evaluated true.but when defined "var a" seemingly wrong answer.i have checked chrome working fine.can please explain obscure behaviour? there's global variable named a , has value. var a; declaration doesn't create new variable. try changing code to: if (a === undefined) { console.log("undefined true"); } else { console.log("undefined false, = " + a); } so can see value of variable.

neo4j - Cant use Merge inside foreach for existed nodes -

Image
i expecting following query create nodes (only if exits) , relations given source node (1) , list(2) way: merge (p1:c9{userid: '1'}) p1, [{userid:"2"}] users foreach (user in users | merge ((p1)-[r1:follow]->(:c9 {userid: user.userid}))) thats outcome: now if executing query again switching node id's way: merge (p1:c9{userid: '2'}) p1, [{userid:"1"}] users foreach (user in users | merge ((p1)-[r1:follow]->(:c9 {userid: user.userid}))) we got this: neo4j duplicated me node id=1. want merge in case of existed nodes. i expected see 2 nodes connected each other merging existed nodes. any idea should fix? thanks, ray. i avoid foreach when can use unwind , start this: merge (p1:c9 {userid: '1'}) p1, [{userid:"2"}] users unwind users user merge (p1)-[r1:follow]->(:c9 {userid: user.userid}) sometimes want separate node creation relationship creation. if both @ same time, t

asp.net - First request in website is slow hosted in Deluxe -

i have deluxe plan in godaddy (windows plan), host websites. when check websites, request spend more 10 seconds, between sending request , receiving response. if want access site after several hours of inactivity, happen again. for problem, created console application where, each 1 minute, going visit websites. hosted application in azure web job, wasn't solution problem. what should websites respond fast?, regardless of user activity after deploying website first request takes longer, after should load quicker.

ruby - Rake test not working in Rails app -

i'm trying run minitests in rails library app, when run rake test , error saying loaderror: cannot load such file -- rake/testtask . here rakefile: require "bundler" bundler.setup require 'rake/testtask' desc 'test library.' rake::testtask.new(:test) |t| t.libs << 'lib' << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = true end below gemfile: source 'https://rubygems.org' gemspec gem 'minitest' gem 'htmlentities' gem 'aws-s3' gem 'byebug', platforms: :mri gem 'rake' rake not being loaded. add gem 'rake' gemfile

javascript - How to get radio button value from first page to second page using localstorage / ajax jquery -

currently working on local storage in first page have 2 radio buttons if user select first radio button in second page panel has hide. , if user select radio button 1 text field second page validation should not happen have no idea how use localstorage or ajax 1 best when saw got window.localstorage.setitem("key_name", "stringvalue"); kindly guide me how use : first page code <!doctype html> <html> <head> <script src="https://code.jquery.com/jquery-1.11.3.js"></script> <meta charset="utf-8"> <title>first page</title> </head> <body> <form id="first_pge" class="first_pge" action="second.page"> <input type="radio" name="radio" id="first_radio"/> <input type="radio" name="radio" id="second_radio"/> <input type="button" value="submit" id=&quo

c# - Parse JSON into an object -

i json string/object server c# client. this json: [ {"printid":1,"printref":"00000000-0000-0000-0000-000000000000","header":"header","tc":"tc","companyref":"00000000-0000-0000-0000-000000000000"}, {"printid":2,"printref":"39a10cee-7cb3-4ed3-aec2-293761eed96d","header":"header","tc":"tc","companyref":"00000000-0000-0000-0000-000000000000"}] i trying convert list of object so: public ienumerable<model.print> get() { var print = new list<model.print>(); using (var client = new httpclient()) { client.baseaddress = new uri(shared.url); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue(shared.headertype)); var response = client.getasync(route + "?" + generaltags.custo

JAVA Sum results from for loop of hashset -

i have hashset start , endtimes, in code calculate difference between them result (in minutes): 60, 30, etc. here question, how can sum of results? want 1 result sum of every result (for example 90) below code without counting thing want (verhuur verhuur : verhuur) { //begin en eindtijd in variabelen stoppen string starttime = verhuur.begintijd; string endtime = verhuur.eindtijd; simpledateformat format = new simpledateformat("hh:mm:ss"); try { //begin en eindtijd pasrsen tot juist formaat date date1 = format.parse(starttime); date date2 = format.parse(endtime); long difference = date2.gettime() - date1.gettime(); system.out.println(difference/1000/60); } catch(exception ex) { ex.printstacktrace(); } } with slight tidy up dateformat used every 1 of loops. can instantiate outside effiency the loop wouldnt compike becu

SOAP SQL switch tracking -

i have been asked company find cause of missing transactions via web-service, on reverse engineering dll's (been given permission). have found soap references in 9 scripts, , logic checking data , switch, different login/password calls. suffice say: suspicious. unfortunately circumstantial without hard proof of traffic redirect. in mind, there anyway detect different sql interactions or soap client commands being sent (expected @ least twice day). many in advance.if not place such question; appreciate recommendations.

ipython - How to define a python function -

so new python , have take class in college credits. given assignment @ home (we allowed go online etc) , part of involved defining function. i'm not @ coding/computers in general , i'm having lot of difficulty in trying so. how go defining function cos(a,b,c) = cos(a - c) - ab? i've tried everything, , wouldn't outright asking people if wasn't desperate. i know function may seem easy i'm not @ @ all. tried (don't laugh!) def np.cos(a, b, c): """ given 3 variables, rearrange them create new equation >>>np.cos(d,e,f) np.sin(d - f) - e*d >>>np.cos(1,2,3) np.cos(1 - 3) - 2*3 """ if np.cos(a, b, c): return np.cos(a - c) - b*a as can see, i'm not sure i'm doing. advice/tips appreciated. thank :) you can use math.cos() determine cosine value of in function. import math def cos(a,b,c): return math.cos(a-c) - a*b print cos(1,2,3) two things here: although have named

android - Cannot retrieve whatsapp contact's numbers -

this code getting whatsapp contacts can't getting contact numbers. code is: hatsapp it's "com.whatsapp". so: cursor c = getcontentresolver().query( rawcontacts.content_uri, new string[] { rawcontacts.contact_id, rawcontacts.display_name_primary }, rawcontacts.account_type + "= ?", new string[] { "com.whatsapp" }, null); arraylist<string> mywhatsappcontacts = new arraylist<string>(); int contactnamecolumn = c.getcolumnindex(rawcontacts.display_name_primary); while (c.movetonext()) { mywhatsappcontacts.add(c.getstring(contactnamecolumn)); } tried both contacts , contacts.data showing names . can me please?

c++ - static_assert to check value in non-template class's template constructor -

so, i'm looking way cause compile-time error if value used in declaring object equal value (don't wish use c's assert macro). yes, know why problem occurs... compiler quite clear when he/she complained expression did not evaluate constant . i don't want make entire class template. there little miracle workaround i'm missing? #include <iostream> class test { private: template<class t, class t2> using both_int = std::enable_if_t<std::is_integral<t>::value && std::is_integral<t2>::value>; private: int _a, _b; public: template<class t, class t2 = t, class = both_int<t, t2>> constexpr test(const t &a, const t2 &b = 1) : _a(a), _b(b) { static_assert(b != 0, "division zero!"); } }; int main() { test obj(1, 0); //error test obj2(0, 1); //ok std::cin.get(); } you can this: struct test { private: constexpr test(int a, int b)

multi dimensional php associative array -

i have php code $rtperdate['revenue'][$dategroupped['date']] += $telco['revenue']; $rtperdate['traffics'][$dategroupped['date']] += $telco['traffics']; which produce array array( [revenue] => array ( [2015-10-01] => 166600 [2015-10-02] => 578300 ) [traffics] => array ( [2015-10-01] => 167 [2015-10-02] => 576 ) i want make array looks this array( [0] => array ( [revenue] => 166600 [traffics] => 167 [date] => 2015-10-01 ) [1] => array ( [revenue] => 578300 [traffics] => 576 [date] => 2015-10-02 ) any appreciated. thanks edit do perhaps mean want indexed date? $rtperdate[$dategroupped['date']]['revenue'] += $telco['revenue']; $rtperdate[$dategroupped['date']]['traffics'] += $telco['traffics']; array( [

How to convert this code from Swift to Objective C -

private var distance: double { return fabs(max - min) } how define variable in objective c language. in .m file: @interface myclass () @property (nonatomic, assign, readonly) double distance; @end @implementation myclass -(double)distance { return fabs(max - min); } @end

character - R: substr() results differently in for loop and vector -

i'm using substr cut off last 3 letters string list: postal_code0 postal_code0 >[1] "n14be" "n14be" "n14be" "n14be" "n14be" "n16dd" "n16dd" "n16dd" "n16dd" "n16dd" >[11] "n11tw" "n11tw" "n11tw" "n11tw" "n11tw" "n5" "n160lu" "n2" "n200au" "n200au" >[21] "london" "n15" "n5" "" > outcode <- substr(postal_code0, 1, nchar(postal_code0)-3) > outcode [1] "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" "n1" [16] "" "n16" "" "n20&quo

Apache Spark create vertices from String -

given string val s = "my-spark-app" how can vertices created in following way spark? "my-", "y-s", "-sp", "spa", "par", "ark", "rk-", "k-a", "-ap", "app" can problem parallelized? it matter of simple sliding on string: val n: int = 3 val vertices: seq[(vertexid, string)] = s.sliding(n) .zipwithindex .map{case (s, i) => (i.tolong, s)} .toseq sc.parallelize(vertices) can problem parallelized? yes can, if single string doesn't make sense. still, if want: import org.apache.spark.rdd.rdd val vertices: rdd[(vertexid, string)] = sc.parallelize(s) .sliding(n) .zipwithindex .map{case (cs, i) => (i, cs.mkstring)}

ios - Unable to get my App id for parse -

i using www.parse.com xcode project. since not allow new sign ups, how application id following code in order use services: let configuration = parseclientconfiguration { $0.applicationid = "your_app_id" $0.server = "http://your_parse_server:1337/parse" } parse.initializewithconfiguration(configuration)

wordpress - Pagination fails with CPT and dynamic tax_query -

i have search form. choose taxonomy, , select 1 or more terms. want paginate results. here code: <?php if(isset($_post['tax_type'])) { $tax_type=$_post['tax_type']; $terms = $_post[$tax_type]; $term_list = implode("','", $terms); $term_list1 = implode(", ", $terms); $term_list = "'".$term_list."'"; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $giftfinder_args = array( 'post_type' => 'products', 'posts_per_page'=>"1", 'paged' => $paged, 'tax_query' => array( array( 'taxonomy' => $tax_type, 'field' => 'slug', 'terms'

Laravel eloquent model save error -

i getting error when trying save eloquent model follows: argument 1 passed illuminate\database\eloquent\relations\hasoneormany::save() must instance of illuminate\database\eloquent\model, string given, i have model question hasmany answeroption on other side answeroption belongsto question i have model questionrevision hasmany questionrevisionansweroption on other side questionrevisionansweroption belongsto questionrevision basically want copy answeroptions question have retrieved new instance of questionrevision (as questionrevisionansweroptions). i have saved new questionrevision ($origrev) successfully. trying add questionrevisionansweroptions go it. error argument 1 passed illuminate\database\eloquent\relations\hasoneormany::save() must instance of illuminate\database\eloquent\model, string given, i have tried saving questionrevisionansweroptions @ once array using savemany , individually same error either way. here relevant code: $original = question::findorfai

Is it okay to assign an instantiated class to a class variable in Ruby? -

is okay instantiate class , assign class variable in class b call a's methods in b? class ... end class b @@a = a.new def method_b @@a.method_a end end you can wrap methods in module , include them in class(for instance methods only) module foo def method_a p 'hello' end end class b include foo def method_b method_a end end b.new.method_b

java - PostgreSQL- getColumnName is not working, returning alias Name -

i'm trying column name below query, select category c1, forecast_2016, category, rowcount, item_number, rowcount, category, avg_demand_2014_2015, category, avg_spend_2014_2015, avg_demand_2014_2015, avg_spend_2014_2015, demand_2015 ag_instrument_portfolio_master limit 1 postgres version 9.3 , java version 1.7, java implementation below. stmt = con.createstatement(); rs = stmt.executequery(query.tostring()); resultsetmetadata columnsmetadata = rs.getmetadata(); int = 0; while (i < columnsmetadata.getcolumncount()) { i++; system.out.println("name: " + columnsmetadata.getcolumnname(i)); system.out.println("label: " + columnsmetadata.getcolumnlabel(i)); } the output name: c1 label: c1 but, expected is name: category label: c1 given comment in pgsql-jdbc mailing list here , appears you're seeing "as designed" behaviour of postgresql jdbc driver: this

ios - Draw a grid with SpriteKit -

what best way draw grid this using spritekit 2d game engine? requirements: input programatically number of columns , rows (5x5, 10x3, 3x4 etc.). draw programmatically using skspritenode or skshapenode , since using images of square this doesn't seem efficient me. the squares should have fixed size (let's each 40x40). the grid should vertically , horizontally centred in view. i'm planning use skspritenode (from image) player moving in different squares in grid. so, i'll save in 2 dimensional array central point (x,y) of each square , move player's current position position. if have better suggestion too, i'd hear it. i appreciate solution in swift (preferably 2.1), objective-c too. planning on using on iphone devices. question close to one . appreciated. i suggest implement grid texture of skspritenode because sprite kit renders grid in single draw call. here's example of how that: class grid:skspritenode { var rows:int!

OSX shell command for screenshot of the active window, or xwininfo equivalent -

i looking osx shell command equivalent of linux's scrot -u , takes screenshot of active window (please note automated script shouldn't prompt user click on desired window @ every screenshot). a possible alternative osx equivalent of xwininfo , gives coordinates , dimensions of desired window, use automated crop on full screenshot. thank you. quickgrab makes easy captures current active window without worrying window id. you use this: $ sleep 2 ; ./quickgrab -file ~/desktop/screenshot-`date '+%y%m%d-%h%m%s'`.png if use binary this pr , capture active chrome window.

Google's Python Course wordcount.py -

i taking google's python course, uses python 2.7. running 3.5.2. the script functions. 1 of exercises. #!/usr/bin/python -tt # copyright 2010 google inc. # licensed under apache license, version 2.0 # http://www.apache.org/licenses/license-2.0 # google's python class # http://code.google.com/edu/languages/google-python-class/ """wordcount exercise google's python class main() below defined , complete. calls print_words() , print_top() functions write. 1. --count flag, implement print_words(filename) function counts how each word appears in text , prints: word1 count1 word2 count2 ... print above list in order sorted word (python sort punctuation come before letters -- that's fine). store words lowercase, 'the' , 'the' count same word. 2. --topcount flag, implement print_top(filename) similar print_words() prints top 20 common words sorted common word first, next common, , on. use str.split() (no arguments) split on whitespac

html - vertical scrolling with fixed body -

here's deal. need lot of pictures in 1 line. many on whole width of site. need apply horizontal scrolling. problem header , footer. need fixed. <div style="background-color: green; height: 80%"> <div style="background-color: purple; height: 100%; width: 1000px; white-space: nowrap"> <img style="max-height: 100%" src="barum/01.jpg"> <img style="max-height: 100%" src="barum/02.jpg"> <img style="max-height: 100%" src="barum/03.jpg"> <img style="max-height: 100%" src="barum/04.jpg"> <img style="max-height: 100%" src="barum/05.jpg"> <img style="max-height: 100%" src="barum/06.jpg"> <img style="max-height: 100%" src="barum/07.jpg"> </div> </div> <div style="background-color: red; height: 10%"></div> thanks,

ios - Simple collision in Sprite Kit -

Image
i have 2 nodes. player , enemy. want enemy node follow player node once it's close enough , enemy node stop when collides player node. , enemy node goes on top of player , both nodes gets pushed. thought somehow stopping enemy node moving on collision player seems me should cleaner way. (i move enemy node changing possition on update). here's gamescene.sks: -(void)didmovetoview:(skview *)view { player = [self childnodewithname:@"character"]; enemy = [self childnodewithname:@"enemy"]; self.physicsworld.contactdelegate = self; } -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { (uitouch *touch in touches) { movetotouch = [touch locationinnode:self]; sknode *tile = [self nodeatpoint:movetotouch]; if([tile.name isequaltostring:@"tile"]) { movetotouch = tile.position; } } } -(void)update:(cftimeinterval)currenttime { [self walk:player to:moveto

r - Overlay barplot with 2 y Axis -

Image
i want barplot overlays 2 variables (2 y axis). this plot and im looking for. here data. what used make plot. ylim3 <- max(mesbar) + 2000 mesbar <- c(total_septiembre, total_octubre) barplot(mesbar, main = "month income", ylim = c(0,ylim3)) grid() > mesbar [1] 1260 12710 and want overlapp data (days worked) > dias_trabajados_sep [1] 2 > dias_trabajados_oct [1] 22 it can done. however, keep in mind playing axis ylims , viewers misleading. trick add par(new = true) , new barplot . chose add blue color trough rgb allows transparency trough alpha argument. useful when gray bars shorter blue bars. mesbar <-c(1260,12710) dias <- c(2,22) ylim3 <- max(mesbar) + 2000 #mesbar <- c(total_septiembre, total_octubre) barplot(mesbar, main = "month income", ylim = c(0,ylim3)) grid() par(new = true) barplot(dias, main = "month income", col=rgb(0,0,1, alpha=.5),xaxt = "n",yaxt="

My Excel conditional formatting formula works manually but not coded in VBA -

Image
i created formula manually in "conditional formatting" graphic interface =if(and($m7<>""specificdeparment"",not(isblank($o7))),true) it should validate 1 department accepts id, others must not have id, filling error id cell red, worked fine manually, replaced formulas rc format =if(and(rc[-2]<>""specificdeparment"",not(isblank(rc))),true) it runs , makes no difference worksheet, if let 1 condition (example: =if($rc[-2]<>""specificdeparment"",true) works , changes column fill color. here code use assigning format in vba: with .range(wrkbook.sheets("data").cells(firstrow, .range("id_marker").column), wrkbook.sheets("data").cells(lastrow, .range("id_marker").column)) .formatconditions.add type:=xlexpression, formula1:="=if(and(rc[-2]<>""specificdeparment"",not(isblank(rc))),true)" .formatconditions(.form

ios - Parse JSON to get value for key -

i trying retrieve value json not getting it. seems have difference between response in json , key. can suggest how this? nsdictionary *jsonresults = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:nil]; nslog(@"results: %@", jsonresults); /* logs console follows: results: { code = 200; error = "<null>"; response = { "insert_id" = 3861; }; nslog(@"insert_id%@",[jsonresults objectforkey:@"insert_id"]); //this logs insert_id (null) look @ output of jsonresults . curly braces indicate dictionary. , note value of "response" key. value has further curly braces. means nested dictionary. the "insert_id" key nested inside "response" key's dictionary. need: nslog(@"insert_id%@",jsonresults[@"response"][@"insert_id"]); also note use of modern syntax. it's easie

powershell - Remove lines based upon string -

i have error log file want copy lines don't match set error strings. building separate file of unrecognised errors. i define know error types # define error types need search on $error_1 = "start date must between 1995 , 9999" $error_2 = "system.contact_type" $error_3 = "duplicateexternalsystemidexception" $error_4 = "from date after date in address" $error_5 = "missing coded entry provider type category record" and doing read in file (get-content $path\temp_report.log) | where-object { $_ -notmatch $error_1 } | out-file $path\uncategorised_errors.log (get-content $path\temp_report.log) | where-object { $_ -notmatch $error_2 } | out-file $path\uncategorised_errors.log (get-content $path\temp_report.log) | where-object { $_ -notmatch $error_3 } | out-file $path\uncategorised_errors.log my input file this: 15 jul 2016 20:02:11,340 externalsystemid cannot same existing provider 15 jul 2016 20:0

php - Dropbox API v2 files_list_folder -

looking @ list_folder sandbox @ dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder i find no way return folders - ".tag" = "folder" - folders , files in 1 huge hunk have parse out "folders" there no way parse nested folders logical way can display list sub folders indented in display. such parent id's helpful match children & parent folders no sorting features, such 'name' 'created' return them in name or created asc/desc order any help? best solution come folders this. seems when perform "2/files/list_folder" specific "path" , set options false. when receive data back, iterate through looking .tag == "folder" , collect them. if find item not .tag == "folder", can stop, you've collected folders specified "path". no need perform "2/files/list_folder/continue". though doesn't solve issues, goes long way solving loading/searching tim

python - What is a good way to implement several very similar functions? -

i need several similar plotting functions in python share many arguments, differ in , of course differ in do. came far: obviously defining them 1 after other , copying code share possibility, though not one, reckon. one transfer "shared" part of code helper functions , call these inside different plotting functions. make tedious though, later add features functions should have. and i've thought of implementing 1 "big" function, making possibly not needed arguments optional , deciding on in function body based on additional arguments. this, believe, make difficult though, find out happens in specific case 1 face forest of arguments. i can rule out first option, i'm hard pressed decide between second , third. started wondering: there another, maybe object-oriented, way? , if not, how 1 decide between option 2 , three? i hope question not general , guess not python-specific, since rather new programming (i've never done oop) , first thought no

jquery - filter json by timestamp year -

i have json array objects timestamp 2015. json looks { "data": [ { "name" : "blabla", "address": testtest, "timestampt": "2015-09-01t11:58:00.0000000z" }, { "name" : "blabla2", "address": testtest2, "timestampt": "2015-10-01t11:58:00.0000000z" }, { "name" : "blabla3", "address": testtest3, "timestampt": "2014-10-01t11:58:00.0000000z" ]} is there simple way search ex 2015 using jquery or js? hope can me first, must json right - quotes around values. then, use array.filter() : var json2015 = json.data.filter(function(item) { if (new date(item.timestampt).getfullyear() == 2015) return item; }) demo -> http://jsfiddle.net/taddow3y/

php - phpMyAdmin error: I am seeing errors in user accounts -

Image
this first xampp installation. in phpmyadmin seeing following screen: ave replication state table mysql.gtid_slave_pos: 1146: @z() mysqld.exe!?do_command@@ya_npavthd@@@z() mysqld.exe!? tions','no_table_options','no_field_options','mysql323','mys see``, routine_name , routine_type ) values("ma_test_host" umm last_update in table "mysql"."innodb_table_stats" bin x_threads=501 thread_count=2 possible mysql co exe!my_security_attr_free() mysql.exe!simple_key_cache_rea abort. query (0x106e2f50): flush privileges connection id 'only_full_group_by','no_unsigned_subtraction','no_dir_in_cr iv ( host , db , user , routine_name , routine_type`) va ,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_c rror] missing system table mysql.roles_mapping; please run m b50 innodb: error: column last_update in table "mysql".&qu

iis - MVC image display works with Azure URL but not CNAME -

so, works if accessed via myazureproj.azurewebsites.net not if there via cname www.mydomain.com pointed azurewebsites. <p> <a href="http://www.smartwool.com/"> <img border="0" alt="smartwool " src="/ads/smartwool.png"> </a> </p> file local iis. found here things weren't? trying display ads event-in-progress it'd swell find quick fix.

javascript - Setting attribute on element gives error "Cannot set property '...' of undefined' with Polymer -

i'm trying set custom element using polymer consists of draggable box icon in it. i'd able define icon specifying icon attribute on element, can declarative create elements rather defining seticon method on element, accessible through javascript. i've tried set element handle attribute including properties attribute on element prototype i'm feeding polymer, giving me element code looks this: var elementproto = { : "my-element", behaviors : [someotherproto], properties : { icon : { "type" : "string", "observer" : "_iconobserver", } }, _iconobserver : function(){ /* functionality adding icon */} }; elementproto.othermethods = various functions; polymer(elementproto); in file, i'm trying set icon attribute using setattribute in javascript function, (after importing new element via associated html file) so: var newelement = document.createelem

php - Format string of date in Smarty -

so have these templates ( .tpl files) being generated smarty. have variable {$projects.laycanenddate} contains date in string format 12/24/2016 need displayed in format 24-dec-16 . i tried parsing text code {php} $date = date_create($projects.laycanenddate); $projects.laycanenddate = date_format($date, 'y-m-d h:i:s'); {/php} <div class="right_olbl"> {$projects.laycanenddate} </div> but isn't working, since it's ignoring {php}...{/php} if wasn't there. read there <?php ... ?> tags, i'm lost ones should use. appreciated! just assign date $smarty->assign('date', strtotime('-1 day')); format in tpl using smarty: {$date|date_format:'%e-%b-%y'}

javascript - How to return the response of multiple asynchronous calls? -

similar question : return response async call except call within loop calls multiple time asynchronous function. specifically, how can value of s returned? code returns undefined. function called within loop. library used orm bookshelfjs. help. function getusernamefromdbasync(userid) { var s = "moo"; new model.users({ iduser: userid }) .fetch() .then(function(u) { var prenom = u.get('firstname'); var nom = u.get('familyname'); s = prenom + " " + nom; return s; }); } your aren't showing how you're doing loop makes little harder guess recommend. assuming .fetch().then() returns promise, here's general idea standard es6 promises built node.js: function getusernamefromdbasync(userid) { var s = "moo"; return new model.users({ iduser: userid }).fetch().then(function (u) { var prenom =

Javascript "Table Width" Is Changing "Tbody Width" -

i made javascript change many tables width according amount of text inside each tables. but problem javascript changing width of tbody (saw in browser inspect element) not table width, that's why there unnecessary white-space (red color) after the table (i think because of bad coding or while loop), please see fiddle , scroll right: http://jsfiddle.net/p9edr8e9/1/ mistake , how change width of whole table? thanks! javascript: var table = document.getelementsbyclassname("tabwid"); (var = 0; < table.length; i++) { var j = 0, row; tabwid = table[i].offsetwidth; row = table[i].rows; while (row[j++]) { var hei = row.offsetheight; while (tabwid < 4000) { tabwid += 500; table[i].style.width = tabwid + 'px'; if (row.offsetheight == hei) { table[i].style.width = tabwid - 500 + 'px'; break; } } } } css: .table{

html - Ellipsis works in second span, but not in first one -

Image
i´ve encountered strange behaviour ellipsis property. works 1 span element, doesn't work on another, identical span: how possible? know how fix problem? appreciated. here's html: <div class="parent"> <span class="ellipsis">sadkljasjkfdhkjlhas-qdasfqewrwqe.pdf</span> <div class="icons-right"> <a href="#"><img src="edit-icon.gif"></a> <a href="#"><img src="delete-icon.gif"></a> </div> </div> <div class="parent"> <span class="ellipsis">terribly-terribly-long-filename.doc</span> <div class="icons-right"> <a href="#"><img src="edit-icon.gif"></a> <a href="#"><img src="delete-icon.gif"></a>

meteor - d3.scaleBand is not a function -

i using d3 meteor here how client/main.html looks like. i d3.scaleband() not function. i tried importing different versions of d3 same result. don't need install d3-scale package access d3.scaleband() function?

java - MQTT - subscribe method is not working -

i have mqtt ckient app working on, publish method working fine having hard time subscribe method. this subscribe method, suppose click button subcribe topic: public void subscribe( mqttclient mc) { string topic = jtextfield3.gettext(); int qos = jcombobox1.getselectedindex() ; string[] topics = {topic}; int[] qos = {qos}; if ( jlabel3.gettext().equals("connected") ) { try { mc.subscribe( topics, qos ); system.out.println(topics +" "+qos); system.out.println(topic +" "+qos); jbutton2.settext("subscribed"); jtextfield4.settext(topics.tostring()); } catch ( exception ex ) { joptionpane.showmessagedialog( this, ex.getmessage(), "mqtt subscription exception", joptionpane.error_message ); } } else { jtextarea1.settext("not connected"); } } this actionperformed method button private void jbutton

node.js - Docker compose volume mapping with NodeJS app -

i trying achieve incredibly basic, have been going @ couple of evenings , still haven't found solid (or any) solution. have found similar topics on , followed on there no avail, have created github repo specific case. what i'm trying do: be able provision nodejs app using docker-compose -d (i plan add further containers in future, omitted example) ensure code mapped via volumes don't have re-build every time make change code locally. my guess issue i'm encountering mapping of volumes causing files lost/overwritten within container, instance in of variations i've tried folders being mapped individual files not. i've created simple repo illustrate issue, checkout , run docker-compose -d see issue, container dies due to: error: cannot find module '/src/app/app.js' the link repo here: https://github.com/josephmcdermott/nodejs-docker-issue , pr's welcome , if can solve me i'd eternally grateful. update: please see solution co

arrays - php CURLE_URL_MALFORMAT error -

Image
i trying thing doenst seem work out well.. outputs curle_url_malformat & no url set! how can fix this?.. it needs echo out text on page $link1 <?php $link1 = "http://www.lubbo-zone.nl/script2/?name=ichris."; $ch = curl_init(); $opts = [ 'curlopt_returntransfer' => 1 , 'curlopt_url' => "{$link1}"]; curl_setopt_array($ch , array($opts)); $response = curl_exec($ch); echo curl_errno($ch) . '<br/>'; echo curl_error($ch) . '<br/>'; var_dump($response); ?> i used this, gets me response server, page says checking browser, after seconds redirect other url. so, i'm pretty sure you're setting options in wrong way. $link1 = "http://www.lubbo-zone.nl/script2/?name=ichris."; $ch = curl_init(); curl_setopt($ch, curlopt_url, $link1); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, cu

Connect to external SQL Server through Entity Framework -

basically need test database on external server (the model matches model of local test database). here connection string have far: <connectionstrings> <add name="defaultconnection" connectionstring="database=qualitylinkbuilder;server=12.345.678.901.\sqlexpress;uid=remotepc\administrator;pwd=mypassword;" providername="system.data.sqlclient" /> </connectionstrings> when attempt connect generic error: the underlying provider failed on open. inner exception message: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) it should server=12.345.678.901\sqlexpress in connection string ( replace "\sqlexpress" relevant sql server in

kryo - Kryonet - double incoming packets -

okay. receiving packet once, it's block fired twice. example: i have block this: if (object instanceof initthegame) { system.out.println("starttttttttttttttttttttttttttttttttttttttt"); awaitopponent.dismiss(); isinqueue = false; matchrunning = true; // handles while loop inside thread sends data server isinmatch = true; // handles view (checks if exit app) // new gamepacketsender().start(); casualgameholder.gameloop.start(); new sensor(act, casualgameholder.gameloop); touchlistener = new touchlistener(casualgameholder.gameloop); this_layout.setontouchlistener(touchlistener); act.runonuithread(new runnable() { public void run() { gamestartcountdown countdown = new gamestartcountdown(4000,1000); countdown.start();

javascript - Console error in medium insert js plugin -

Image
i trying integrate medium insert plugin( https://github.com/orthes/medium-editor-insert-plugin ). have set according instructions. works fine except giving me error in console when hover on + button as: i have not made example code. any appreciated.thanks in advance. i found solution problem. since downloaded plugin directly git repo , installed dependency using bower, pulled latest plugins , turns out latest plugin medium-editor(ie. v5.21) not compatible current latest version of medium-insert plugin(ie v2.x) . downloaded v5.9 of it(medium-editor) , voila worked.

Bootstrap Menu Collapse working but isn't showing icons -

i optimizing website mobile devices. noticed collapsible menu working, doesn't show icon bars. basically, if click in area navbar icons should be, dropdown menu show. how can make icons show visitors can know there menu. here code menu <body data-spy="scroll" data-target="#topnav"> <div class="navbar navbar-color navbar-fixed-top" id="topnav"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand page-scroll" href="#page-top">webinsight</a> </div&g

html - Python not progressing a list of links -

so, need more detailed data have dig bit deeper in html code of website. wrote script returns me list of specific links detail pages, can't bring python search each link of list me, stops @ first one. doing wrong? beautifulsoup import beautifulsoup import urllib2 lxml import html import requests #open site html_page = urllib2.urlopen("http://www.sitetoscrape.ch/somesite.aspx") #inform beautifulsoup soup = beautifulsoup(html_page) #search specific links link in soup.findall('a', href=re.compile('/d/part/of/thelink/ineed.aspx')): #print found links print link.get('href') #complete links complete_links = 'http://www.sitetoscrape.ch' + link.get('href') #print complete links print complete_links # #everything works fine point # page = requests.get(complete_links) tree = html.fromstring(page.text) #details name = tree.xpath('//dl[@class="services"]') in name: print i.text_con