Posts

Showing posts from May, 2010

Is this a possible browser quirk with safari and column wrapped flexbox's? -

compare how flexbox looks in chrome or firefox , how looks in safari. chrome & firefox correct. in safari, it's acting minimum height of flex box calculated based on bottom position of last flex item, whereas in other browsers seems calculate minimum height of flex box based upon flex item takes on minimum. can find out if code wrong or confirm bug? view snippet in full page see. html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } .wrapper { margin: 0 auto; max-width: 984px; } .container { margin: 0 80px; padding: 30px 0; } h1 { margin: 0; } .top { position: relative; display: flex; flex-direction: column; max-height: 800px; flex-wrap: wrap; } .prod-header { order: 3; width: 49%; padding-left: 30px; } .prod-header img { width: 100%; } .my-slider { order: 1; width: 51%; padding-right: 30px; } .my-slider img { width: 100%; } .prod-info { order: 4; wid

python - DJango 1.8 use completely different CSS on child template -

i want in django templates. using materialize css framework side bar has menu on it, has links views showing django forms, , menu "base.html", so, parent template. have problem, don't want use materialize css forms classes on child templates, want use different, because application materialize seems confusing users. i have tried this: django templates: use different css pages and let me changes css, want absolutely remove parent template css , use particular css in child templates (forms). or use css affects parent template, not affecting child templates. edit: read comments solution. answered wrote @ beginning, think question wasn't complete. looking solution similar asp.net master pages, master page has own css , not affected webform css (child template), independent. in django if override parent template css on child template, parent affected. menu looks nasty haha. have hint override css classes need. dont extend child template parent base templ

javascript - onClick not working React js -

i trying call function when user clicks div (using onclick in react). don't need pass arguments @ moment, need call function. i'm new react.js apologies in advance ignorance. thanks. var test = react.createclass({ btntapped: function(){ console.log('tapped!'); }, render: function() { var stationcomponents = this.props.stations.map(function(station, index) { return <div onclick={btntapped()}><img src="img/test.png" />{station}</div>; }); return <div>{stationcomponents}</div>; } }); var cards = ["amazon", "aeo", "aerie", "barnes", "bloomingdales", "bbw","bestbuy", "regal", "cvs", "ebay", "gyft", "itunes", "jcp", "panera", "staples", "walmart", "target", "sephora", "walgreens", "starbucks"]; reactdom.ren

How to set a parent property from within a custom element in Aurelia? -

a few days ago asked question 2 way databinding in aurelia custom elements - bind custom element parent viewmodel now need able reuse allselectablevalues custom element (my-custom.js) in parent element (create.js). i need custom value converter have on create.js contains ids need display names instead, looping through array of elements, fetched , residing in custom element. **create.html** <td>${d.someid | allselectablevaluesmapping}</td> and **value-converters/all-selectable-values-mapping.js** export class allselectablevaluesmappingvalueconverter { toview(value) { for(let item in allselectablevalues) { if (item.someid == value){ return item.name; } } } } in ideal world i'd have hoped have worked: **my-custom.js** async attached() { this.allselectablevalues= await await this.myservice.getallvalues(); this.parent.allselectablevalues = this.allselectablevalues; } but custom elem

model - Table inheritance in Laravel -

Image
as newbie laravel, have problem setting laravel models correctly. in uml diagram, i'm using generalization can "inherit" attributes parent table: in database, have following. entity table ------------------- | id | identifier | ------------------- | 1 | azx-c56 | ------------------- | 2 | azx-c06 | ------------------- | 3 | mzx-9f1 | ------------------- | 4 | mzx-x09 | ------------------- worker table --------------------------------------------- | id | entity_id | firstname | lastname |..| --------------------------------------------- | 1 | 1 | jean | michel |..| --------------------------------------------- | 2 | 2 | jane | doe |..| --------------------------------------------- machine table ---------------------------------------------- | id | entity_id | type | description | ---------------------------------------------- | 1 | 3 | xu-09-a | lorem ipsum | ----------------------

php - PDO_MYSQL configure failed when installing so file -

i have installed php 5.4.44 , mysql 5.1.51, , tried install pdo_mysql , when execute command ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql --with-zlib-dir=/usr/lib64/ , shows pdo_mysql configure failed, mysql 4.1 needed. i have tried change version of php doesn't work, problem , how can fix this? installation processes require development headers along binaries. in case, missing libmysqlclient-dev : sudo apt-get install libmysqlclient-dev

javascript - Is it safe to wrap a function inside jQuery.removeClass()? -

i'm working on custom slider has dynamic video. each time slide changes, new video inserted dom while previous 1 gets deleted. i'm using css transition class change video's position view, ideally want function to: 1) add css class old video 2) remove() or detach() old video** 3) add css class new video the code have far is function videodetach() { // restore loading spinner $('.spinnermsg').removeclass("nospin"); // move video out of screen , bring next 1 in $('#bgin video:first').removeclass( function (){ $('#bgin video:first').addclass("outview"); settimeout(function(){ $('#bgin video:first').detach(); $('#bgin video:last').addclass("inview"); },250); }); } this code works expected not sure if it's safe or correct, best practice accomplishing such task? ** not sure 1 choose, each video inserted slider repeats

typescript - Angular2 give error Argument of type 'ElementRef' is not assignable to parameter of type 'ViewContainerRef' -

i'm creating angular2 app using angular-cli, when use constructor below give error this error argument of type 'elementref' not assignable parameter of type 'viewcontainerref'. property 'element' missing in type 'elementref'. my constructor constructor( _elementref: elementref, _loader: dynamiccomponentloader,_parentrouter: router, @attribute('name') nameattr: string, private userservice: logincomponent) { super( _elementref, _loader, _parentrouter, nameattr); this.parentrouter = _parentrouter; this.publicroutes = ['', 'login', 'signup']; } what wrong code?. i'm using angular2 rc.3 add viewcontainerref import constructor , use using elementref. apparently has changed , cannot pass elementref viewcontainerref. import {component, dynamiccomponentloader, elementref, viewcontainerref} '@angular/core'; .... constructor( _elementref: elementref, _viewcontainerref: viewc

C# Error Displaying The Xml Element in DataGridView -

Image
the purpose of code reading xml elements , display every element under related column name in datagridview. so, here have code: ienumerable<xelement> tables = xelement.elements(df + "table"); foreach (xelement table in tables) { //get name tablename node xelement tablenamenode = table.element(df + "tablename"); tbtablename.text = tablenamenode.value.tostring(); xelement numberrows = table.element(df + "numberofrows"); tbnumrows.text = numberrows.value.tostring(); string tablename = tablenamenode.value; tabledata td = new tabledata(currentproject.currentschema.findtable(tablename)); td.populatefielddata(); // tabledatalist.trygetvalue(tablename, out td); tabledatalist.add(tablename, td); //if open project after save or open it, excepti

go - unable to obtain all permission bits -

on shell, have file , change permissions of file sudo chmod 4755 <file> . upon calling lstat on file, i'm seeing correct information permissions, has 4755 permission mode. in golang program, there reason why i'm not getting correct permission mode bits? i'm formatting result fileinfo().mode().perm() incorrectly? upper 3 bits "special"? thanks help! short answer: 3 upper bits special , need accessed separately. long answer: documentation explains 9 (out of 12) least significant bits considered standard unix permissions. the documentation defines behavior of perm() function calling: func (m filemode) perm() filemode perm returns unix permission bits in m. this means perm not defined return of additional bits looking for. furthermore, source code shows perm() function masking value returned filemode() 0777 causing initial 3 bits disregarded. the modesetuid , modesetgid , , modesticky bits (4, 2, , 1 respectively) must eac

c++ - friend function in class templates and error LNK2019 -

i'm trying overload operator << in template class , error want nsizenatural<30> a(101); cout << a; without whole program compiles error: error lnk2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<<30,unsigned int,unsigned __int64,10>(class std::basic_ostream<char,struct std::char_traits<char> > &,class nsizenatural<30,unsigned int,unsigned __int64,10> const &)" (??$?6$0bo@i_k$09@@yaaav?$basic_ostream@du?$char_traits@d@std@@@std@@aav01@abv? $nsizenatural@$0bo@i_k$09@@@z) referenced in function _main my numbers.h file : template<int size, typename basic_type = unsigned int, typename long_type = unsigned long long, long_type base = bases(dec)> class nsizenatural { // how decelerate friend function friend ostream& operator<<(ostream& str, const nsizenatural<size, basic_type, long_

foreign keys - view details in tree view from original model (Many2one) - Odoo 9 -

i have simple database has 3 models follows 1- camps (to store camps master data) 2- players (to store players master data) 3- players_camps (to store camps each player has attended) the code models follows: class camps(model): _name = 'camps' name = char('name') organizer = char() date_from = date('from date') date_to = date('to date') place = char() supervisor = char() notes = text() class players(model): _name = 'player' name = char() camps = one2many('player_camps', 'player') class player_camps(model): _name = 'player_camps' camps = many2one('camps', on_delete='cascade', on_update='cascade') organizer = many2one('camps', on_delete='cascade', on_update='cascade') place = many2one('camps', on_delete='cascade', on_update='cascade') date_from = many

How to read Azure Service Bus messages from Multiple Queues with one worker -

i have 3 queues , 1 worker want monitoring 3 queues (or 2 of them) one queue qpirate 1 queue qships 1 queue qpassengers the idea workers either looking @ 3 of them, 2 of them, or 1 of them, , doing different things depending on message says. the key though message failing because ship1 offline, queues in qships refresh, workers looking @ , other queues hung try process messages queue while looking @ other queues little bit, while other workers looking @ other 2 queues , skipping qships continue process through messages without holdup or delays. public static void gotmessage([servicebustrigger("%lookatallqueuesintheservicebus%")] brokeredmessage message) { var handler = new messagehandler(); var manager = new messagemanager( handler, "pirateships" ); manager.processmessageviahandler(message); } looking around online i'm guessing isn't that's possible, seems be? in adv

php - Laravel 5: return number of affected rows MySQL -

how return similar php function mysql_affected_rows() when use laravel 5 db class, ex: db::delete("delete chat id = {$mid}"); how return number of affected row? thanks, for update() , delete() calls, return value number of affected rows. $affected = db::delete("delete chat id = {$mid}");

javascript - Split an array with sub arrays into separate arrays if the line count exceed $x -

i have array of example data i'm trying split 2 columns paginate on data. basically, i'm building directory listing , need display 2 columns of data. if data long page one, split data array , display on page. the directory listing shows tenantname , suitenumber on 1 line if includeoccupants = y, list occupant array below tenantname. the problem comes in when displaying data. can have 18 total rows in each column, if there 22 occupants, list needs break , show on next column. i've hacked few solutions nothing worth posting example. my general thinking should iterate on list using loop , inside loop, iterate on occupants array. using counter, increment counter every tenant , occupant , if number gets bigger 18, break loop. issue creating second, 3rd, , possibly 4th arrays of data based on supplied array of tenants. var directory_data = '[{"tenantname":"u.s. trust","suitenumber":201,"occupants":[""],&qu

version control - Keep branches in separate SVN repositories up to date -

i have 2 separate svn repositories both trunk, branches, , tags directories. within branches directory, have several sw project branches exist , need date each other in both of repositories; for example branch prj1.br exists in repo-a , repo-b: repo-a/branches/prj1.br repo-b/branches/prj1.br using subversion there proper way keep these branches in different repositories date each other via svn commands scripted? i guess should use vendor branches , i'm not sure because it's unclear how branches in repo-a , repo-b related. here current vendor branches management python 3.3+ script http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/svn-vendor.py

python - Dictionary Comprehension to generate values of built-in type -

i dictionary comprehension list of keys built-in type of str values. headers = ['header1', 'header2', 'header3'] print dict([(x,str) x in headers]) output: {'header2': <type 'str'>, 'header3': <type 'str'>, 'header1': <type 'str'>} desired output: {'header2': str, 'header3': str, 'header1': str} you do have dictionary built-in str in it. the <type 'str'> due print call use value obtained calling objects' __str__ when prints it. value str <type 'str'> . if save dictionary, access 1 of members , use you'll see is str class: >>> d = dict([(x,str) x in headers]) >>> d['header1'](123) '123'

javascript - pagination called to multiple elements not working, only calls it for the last one -

i've got pagination script when called multiple times, fires last element has been called. ideas why happening? <script> $('.calendar-nagyhaz').scrollpagination(); $('.calendar-felso').scrollpagination(); </script> if try call ".calendar-felso" affected. pagination script looks this: (function($) { $.fn.scrollpagination = function(options) { var settings = { nop : 1, // number of posts per scroll loaded offset : 0, // initial offset, begins @ 0 in case error : '', // when user reaches end message // displayed. can change if want. delay : 500, // when scroll down posts load after delayed amount of time. // usability concerns. can alter see fit scroll : false // main bit, if set false posts not load user scrolls. // still load if user clicks. } // extend options work plugin if(o

java - Seconds since epoch to LocalDate in Joda -

how convert seconds past epoch localdate in joda? e.g. long seconds = 1468608443l; ? localdate.fromseconds(seconds); // not exist what exist fromdatefields , fromcalendar . is necessary convert seconds 1 of these 2 things first? alternately can make instant with instant instant = new instant(seconds * 1000); then try converting date or datetime input localdate . standard way accomplish this? best method far: instant instant = new instant(seconds * 1000); localdate date = instant.todatetime(some_time_zone).tolocaldate();

jquery - How to fix "Uncaught TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement' -

i working cuepoint.js create text links cue html5 video time marker corresponding particular lines of text. need dynamically assign links time value written array string. know need use parseint() recast values integers when retrieved array. since links , times dynamic, need assign links times within loop pushed array. here's code var cuetimes = []; (var j = 0; j < textitems.length; j++) { var times = parseint(timeitems[j]); cuetimes.push(times); $(".field-name-field-text-"+(j+1)+" > div > div").click(function(){ cuepoint.settime(cuetimes[j])}); console.log(cuetimes[j]); } when run code, however, receive error. uncaught typeerror: failed set 'currenttime' property on 'htmlmediaelement': provided double value non-finite. as far can tell, integer isn't being correctly read such jquery. however, when output time values console, appear integers. when test code using static array index (

javascript - ajax php jquery realtime saving of counter -

currently script.php works want happen, instead of displaying hours, minutes , seconds want have 3 values combined , posted log.php $_post['timespent'] value $id sent $_post['id'] every 1 second. script.php <p><span id="hours"></span>:<span id="minutes"></span>:<span id="seconds"></span></p> <script> var sec = -1; function pad(val) { return val > 9 ? val : "0" + val; } setinterval(function () { $("#seconds").html(pad(++sec % 60)); $("#minutes").html(pad(parseint(sec / 60, 10) % 60)); $("#hours").html(pad(parseint(sec / 3600, 10))); }, 1000); </script> log.php <?php include 'includes/config.php'; $loggeduser = $_session['username']; $stmt = "update rotator_tracking set time_spent=:time_spent id=:id"; $stmt = $db->prepare($stmt); $stmt ->execute(array(

javascript - dynamic variable.optiones.selected -

i'm new here in forum first question. if wrong it. question: i've got multiple select in html file values save in database. when site loaded again select select options selected before automaticly. need this: <select multiple id="a"> <option>tomato</option> </select> <select multiple id="b"> <option>apple</option> </select> <select multiple id="c"> <option>orange</option> </select> <select multiple id="d"> <option>cake</option> </select> <script> var ids = ["a", "b", "c", "d"]; for(i=0, < 4, i++){ var id = ids[i]; id.options[0].selected = true; } </script> this tried (on web page selects have more 1 option). i've done research in internet, not able find results. problem dynamic variable it's interpreted it's id of html object compiler should inte

ssh - ngrok tunnels to localhost reconnecting issue -

i have camera set on arm based system running ubuntu 12.0.4 lts. accessing internet ethernet cable of modem. able view live stream camera using motion software on local network. view these streams internet, found software ngrok. after installation, when type ./ngrok http 80 or ./ngrok tcp 22 or else, says connecting initally then, goes tunnel status reconnecting (x509: certificate has expired or how resolve ? other information might useful: version 2.0.19/ web interface http://127.0.0.1:4040 connections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00 you use other tunnel solution. please have https://pagekite.net/support/quickstart/ please follow these steps use new way create tunnel localhost website: `https://pagekite.net/support/quickstart/` 1) run => curl -s https://pagekite.net/pk/ |sudo bash 2)

parsing - Parsec3 Text parser for quoted string, where everything is allowed in between quotes -

i have asked question before ( here ) turns out solution provided did not handle test cases. also, need 'text' parser rather 'string', need parsec3. ok, parser should allow every type of char inbetween quotes, quotes. end of quoted text marked ' character, followed |, space or end of input. so, 'aa''''| should return string aa''' this have: import text.parsec import text.parsec.text quotedlabel :: parser text quotedlabel = -- reads first quote. spaces string "'" lab <- liftm pack $ endby1 anychar endofquote return lab endofquote = string "'" try(eof) <|> try( oneof "| ") now, problem here of course eof has different type oneof "| " , compilation falls. how fix this? there better way achieve trying do? whitespace first comment on handling white space... generally practice write parsers consume whitespace fol

android - after parsing json null value is returned even though it is not null -

{ "page": 1, "results": [ { "poster_path": "/liv1qinfqz4dlp5u4lq6haiskoz.jpg", "adult": false, "overview": "under direction of ruthless instructor, talented young drummer begins pursue perfection @ cost, humanity.", "release_date": "2014-10-10", "genre_ids": [ 18, 10402 ], "id": 244786, "original_title": "whiplash", "original_language": "en", "title": "whiplash", "backdrop_path": "/6bbz6xyvgfjhqwbplnuh1lsj1ky.jpg", "popularity": 7.361171, "vote_count": 1949, "video": false, "vote_average": 8.32 } ] } this json response when parse value of id null below networking , json parsing code please help.. public class movietask extends asyncta

http - How to turn off ssl for specific url? -

here config: upstream example { server unix:///home/deploy/apps/example/shared/tmp/sockets/example-puma.sock; } server { listen 80 default_server; server_name example.org; location /non_https { proxy_pass http://example; } return 301 https://$server_name$request_uri; } server { listen 443 ssl default_server; ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; include snippets/ssl-params.conf; root /home/deploy/apps/example/current/public; try_files $uri/index.html $uri @example; location @example { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off; proxy_pass http://example; } keepalive_timeout 10; } i need turn off ssl /non_https/* how it? if place retuen 301 inside location "/" block should work: server { listen 80 default_server; serv

Gradle task replace string in .java file -

i want replace few lines in config.java file before code gets compiled. able find parse file through filter during copying it. have copy had save somewhere - thats why went solution: copy temp location while replacing lines > delete original file > copy duplicated file original place > delete temp file. there better solution? may should try ant's replaceregexp : task mycopy << { ant.replaceregexp(match:'aaa', replace:'bbb', flags:'g', byline:true) { fileset(dir: 'src/main/java/android/app/cfg', includes: 'testingconfigcopy.java') } } this task replace occurances of aaa bbb . anyway, it's example, can modify under purposes or try similar solution ant.

ios - How to cancel performBlock: -

i implemented search , every new character typed user performfetch: started inside of performblock: . if search string changes cancel previous started block , start over. how cancel or @ least inform block inside performblock: about it? example code have right now: [mymanagedobjectcontext performblock:^{ // fetch background queue if([[self fetchedresultscontroller] performfetch:nil]) { // update view main queue // don't if performblock got started again! how? [[nsoperationqueue mainqueue] addoperationwithblock:^{ // refresh ui }]; } }]; there no api cancel performblock . once starts, continues until completes or until code return s it. if find necessary cancel fetches while in progress, nsasynchronousfetchrequest , allows cancellation via nsprogress . async fetch requests , cancellation described in wwdc 2014 core data session

ruby - Sass-rails issue importing css -

i trying install new gem ( https://github.com/froala/wysiwyg-rails ), has css dependencies i'm trying call using sass-rails see @import instruction in rendered css. the installation worked fine, since did bundle install, , can load js. css files in right folder in ruby, not succeed in having css imported. i using line of code css: @import 'wysiwyg-rails/froala_editor.min.css'; is there else have sass-rails able access files import. not answer, ended using bower installation , access css files.

visual studio code - VSCode: "bash: EOL: command not found" on startup -

on starting vscode (mac), integrated terminal shows following being executed: bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash: eol: command not found bash-3.2$ i see each line being executed, can't work out source of is. note there 15 of them, used fewer. don't know whether relates number of extensions or not, it's not same number. is there way can see relates to, , if example, it's configuration issue or bug? jon

Python finding Prime Numbers between any two numbers -

i'm trying find prime numbers between 2 random numbers. firstly, have written code like: m,n = map(int, raw_input().split()) in range(m, n+1): j in range(2, i): if i%j == 0: break else: print i, now test case suppose enter 2, 30 prints 2 3 5 7 11 13 17 19 23 29 now analyzing, don't need loop till "i" in second loop rather can same looping till i/2, changed code as: m,n = map(int, raw_input().split()) in range(m, n+1): j in range(2, int(i/2)+1): if i%j == 0: break else: print i, then result same above while looped till i/2 in second loop. now, i'm trying use sieve of eratosthenes method print prime numbers , used code as: m,n = map(int, raw_input().split()) in range(m, n+1): sqrt_num = int(n**(0.5)) j in range(2, sqrt_num+1): if i%j == 0: break else: print i, but prints 7 11 13 17 19 23 29 for same input. please me understand

How can I get Intellij to show more frames of stack in the run console? -

at run time, run console shows like: caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:422) @ org.robolectric.robolectrictestrunner.gethooksinterface(robolectrictestrunner.java:455) ... 29 more caused by: java.lang.exceptionininitializererror @ org.robolectric.internal.paralleluniverse.<init>(paralleluniverse.java:32) ... 34 more caused by: java.lang.runtimeexception: no shadows modules found containing org.robolectric.shadowsadapter @ org.robolectric.robolectric.instantiateshadowsadapter(robolectric.java:91) @ org.robolectric.robolectric.<clinit>(robolectric.java:14) ... 35 more i see of fram

How can I search a database based on multiple, dynamic criteria? -

scenario: i'm building web app pairs programmers, designers, business people, etc. based on user's search criteria. how can return relevant search results based on criteria entered person searching? for example: business user searching programmer php, angular, mysql skills. each skill separate tag (tag1 = php, tag2 = angular, tag 3 = mysql) , each "person" object made of different combination of data. is there more elegant way query database rather have column in person table each skill , have query run search based on presence of said skill? i guess rather multiple columns build 1:many relationship between person , skills , return results containing said skills. feel return more rows necessary though. a more specific example how stackoverflow allows tag question multiple tags...how these tags/questions searched , stored in db? you don't mention database using. if database handles array-based searches (for example, postgresql does), prefe

python - Python3x Integer and String Input -

i want user input number give number : types " 10 " -but... give number : types " i want type 10 " want program "count" integer. because if types string program stop import random goal = random.randrange(1,10) n = 1 tries = 0 name = input("dose onoma sou ") print("a game in python") while n != 0 : value = int(input("madepse poio einai noumero:")) n = abs(value - goal) print(value,n) tries = tries + 1 if n >= 4 : print("den eisai koda") elif n > 0 , n <= 3 : print("eisai koda") else : print("to vrikes") print ("to score sou einai: ",tries) skoros = str(tries) score = open('score.txt', 'a') score.write(name) score.write(' ') score.write(skoros) score.write("\n") score.close this take input , pull first number out of it. \d matches digit 0-9, , + means "one or more&q

javascript - Why is the result different in the Chrome console and sublime? This in JS -

Image
i'm learning identifier , know when function not called on object refers window object in non-strict mode. result, expect this.bar log "whatever." "whatever" output when run code in chrome console.it, output undefined when run code using node build system in sublime. why case? right result in chrome console correct? when else encounter problems this? here's code function foo() { // console.log(this) console.log( this.bar ); } var bar = "whatever"; // -------- foo(); // output "whatever" in chrome console , output undefined in sublime's node build system. when use this in function without specifying different context, refers global object. in chrome, window object. in node, called global . when specifying different context, be, example, using new constructor, or call , apply functions bind particular this . the main difference when use var bar = "whatever"; in node, use of

PLC - PC communication using Snap7 in C# WPF app -

Image
please, have question snap7.dll library. long time wanst working in c#, maybe doing wrong. possible use snap7 in c# wpf project library or developed windows forms? stupid know, asking because not able add snap7.dll project references. thank you. downloaded , played around examples http://snap7.sourceforge.net/ looks console application doesn't reference assembly directly. this isn't wpf vs winforms thing. managed vs unmanaged code thing. there snap7.net.cs .net wrapper class file. references "snap7.dll" , exposes functionality c# class. @ runtime load assembly using dllimport. copy both snap7.net.cs file , snap7.dll project. use snap7 class methods/attributes in code. update snap7.dll copy output directory, or use post build event copy snap7.dll output directory. edit: want restate do not add reference snap7.dll directly using project -> references . dllimport annotation of wrapper class file load @ runtime.

inheritance - How to mixin behavior using class decorators in Python? -

i have base class has lot of direct sub classes. there multiple independent features shared multiple of sub classes. use case python's cooperative inheritance. however, features should wrap behavior outside, need earlier in method resolution order. class wrappedsub(featurea, featureb, featurec, realsub): def __init__(self, *args, **kwargs): featurea.__init__(foo=42) featureb.__init__(bar=13) featurec.__init__(foobar=546) realsub.__init__(*args, **kwargs) class realsub(base): # lots of code ... it nice decorate child classes instead. @mixin(featurea, 42) @mixin(featureb, 13) @mixin(featurec, 546) class realsub(base): # lots of code ... precisely, need @mixin decorator first block below equivalent second. @mixin(sub, *feature_args, **feature_kwargs) class realsub: # lots of code ... class realsub: # lots of code ... class wrappedsub(feature, realsub): def __init__(self, *sub_args, **sub_kwargs): feature

mysql - How to take out percentage in sql -

i have sql students attendance table have entered values this: student_id total_classes class_attended 1 31 26 2 31 21 3 31 17 4 31 21 5 31 29 i want calculate attendance percentage of student_id 1. im looking how frame sql statement above.. you need divide number of attended classes total , multiply 100: select student_id, round(class_attended/total_classes*100) total student the above return following result: +------------+-------+ | student_id | total | +------------+-------+ | 1 | 84 | | 2 | 68 | | 3 | 55 | | 4 | 68 | | 5 | 94 | +------------+-------+

winforms - writing from textbox to text file C# -

i want write textboxes in windows form textfile, want use spilt. want written in text file this namelabel : nametextbox passlabel : passtextbox how can that! streamwriter txt = new streamwriter("d:\\register.txt") txt.write(namelabel.text); txt.writeline(nametextbox.text); txt.write(passlabel.text); txt.writeline(passtextbox.text); you can use system.io.writealltext write text in file. example: system.io.file.writealltext("d:\\register.txt", string.format("{0}:{1}\n{2}:{3}" namelabel.text, nametextbox.text passlabel.text passtextbox.text));

Xamarin (ios): Empty storyboard error message -

when want build iphone app, empty error message: base.lproj/appstoryboard.storyboard: error : storyboard opens, doesn't tell me error is. what should find out whats problem is? i found out myself. had set diployment target version 9.1 7.1 had. :/

css - How to split html form in 2 columns only for some rows -

could me please splitting rows in 2 columns here html body { font-family: 'arial', serif; max-width: 100%; padding: 0px 30px; } h1 { margin-bottom: 0px; } p { text-align: center; margin-top: 0px; } fieldset { margin-bottom: 15px; padding: 10px; border-radius: 5px; border-width: 1px; } legend { padding: 0px 3px; font-weight: bold; font-variant: small-caps; } label { width: 110px; display: inline-block; vertical-align: top; margin: 6px; } textarea { width: 100%; } input:focus { background: #ebebe3; } textarea { height: auto; weidth: 100%; } select { width: 254px; } .buttonholder{ text-align: center; } input[type=text] { border-radius: 3px; } input[type=choice] { border-radius: 3px; } input[type=submit] { padding: 9px; width: 80px; background-color:#2c3e50; color:#fff; position:relative; } .list { width:100%; height: