Posts

Showing posts from June, 2013

How to perform a mail merge with word from vb.net -

when button on form clicked want text text boxes used fields in mail merge template. have created text file, , when button on form clicked, write contents of text boxes text file. make sure text file in correct format i.e. field headings @ top etc. have created corresponding mail merge template using text file mailing list. question how initiate mail merge code in vb.net please?

ruby on rails - Devise Controller Test undefined method `env' for nil:NilClass -

when write test this, it works : require 'test_helper' class homecontrollertest < actioncontroller::testcase include devise::test::controllerhelpers test "signed in" sign_in users(:default) :show, params: { id: 33 } assert_redirected_to user_session_path end end however when change style of test class little bit describe : require 'test_helper' describe homecontroller include devise::test::controllerhelpers describe "signed in" "works" sign_in users(:default) :show, params: { id: 33 } assert_redirected_to user_session_path end end end then following error: undefined method `env' nil:nilclass i guess that's because of devise::test::controllerhelpers , because describe homecontroller not anymore actioncontroller::testcase . how try solve problem? try? thanks

python - why pycharm gives a wrong condition check? -

Image
i have string read file, there cases readline() return blank line , need check that, please see screenshot below , appreciated if can explain me why gives wrong result: as can see screenshot, line='\n', why expression's evaluation result false? there sure alternative way check blank line, curiously wanting know why script not working. thank you. thanks. your input file contains nasty characters, "zero width space" or "invisible separator" . can output these if print (or evaluate) repr(line) : with open('data.txt', 'w') f: f.write(u"\n") f.write(u"\u200b\n") # 0 width space f.write(u"\u2063\n") # invisible separator f.write(u"\n") open('data.txt', 'r') f: line in f: print(repr(line)) if debug above, able replicate behaviour lines 2 , 3, not lines 1 , 4. note these characters not visible in fonts (they not take space!), , prin...

assembly - this code will not run on Qtspim -

this mips code heapsort. when try run it, following error messages syntax error on line 149 (array: .word 54,23,56,32,99,7,4,2,88,9,11,21,39,55,100,101,43,1,3,69,-5,-24,-17,0) , instruction reference undefined symbol on line 14. have @ many times , still don't see mistakes. please let me know if find any. code: .text .globl main main: la $a0, array # a0 = &array la $t0, size lw $a1, 0($t0) # a1 = size(array) jal heapsort # print array move $t0, $a0 add $t1, $zero, $zero printloop: li $v0, 1 lw $a0, 0($t0) addi $t0, $t0, 4 addi $t1, $t1, 1 syscall li $v0, 4 la $a0, space syscall bne $t1, $a1, printloop # while( t1 != size ) li $v0, 4 la $a0, newline syscall done: jr $ra heapsort: # a0 = &array, a1 = size(array) addi $sp, $sp, -8 sw $a1, 0($sp) # save size sw $a2, 4($sp) # save a2 sw $ra, 8($sp) # save return address move $a2, $a1 # n stored in a2 addi $a2, $a2, -1 # n = size - 1 ble $a2,$zero, en...

Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1 (same version) -

so ran following problem: your ruby version 2.3.1, gemfile specified 2.3.1 says heroku when deployed app. error should happen when have mismatch current ruby version , gemfile's ruby version. you can see code here here's build output: remote: -----> ruby app detected remote: -----> compiling ruby/rails remote: -----> using ruby version: ruby-2.3.1 remote: -----> installing dependencies using bundler 1.11.2 remote: ruby version change detected. clearing bundler cache. remote: old: ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux] remote: new: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] remote: running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: warning: running version of bundler older version created lockfile. suggest upgrade latest version of bundler running `gem install bundler`. remote: ruby version 2.3.1, gemfile...

Android Drawable XML Code For Text Select Handle -

Image
i trying find xml code create textselecthandle. created 3 xml files in drawable folder text_select_handle_middle, text_select_handle_left, , text_select_handle_right. added files style.xml file. i haven't found code online shows how create new round text select handlers android 6.0 marshmallow. changing color of text select handle primary reason wanting this. i saw post linked website android holo colors generator didn't have on new round text select handlers. style.xml <item name="android:textselecthandle">@drawable/text_select_handle_middle</item> <item name="android:textselecthandleleft">@drawable/text_select_handle_left</item> <item name="android:textselecthandleright">@drawable/text_select_handle_right</item> in values\styles.xml should change <item name="coloraccent">@color/md_red_100</item> for color want, not have redraw text select handler

mongodb - expireAfterSeconds what timezone is used? -

when i'm doing: db.events.ensureindex({ "expiresat": 1 }, { expireafterseconds: 0 }) what timezone expiresat comparing ?? mongodb dates utc dates . therefore, values can st "expiresat" field utc times. , expiry going @ after set expiryafterseconds (in case 0) passed since expiresat in utc time.

php - MySQL connection failure from Android application -

i have android project, in use code above connect remote mysql database. should handle login request, user should authenticated in database stored information. private class asynclogin extends asynctask<string, string, string> { progressdialog pdloading = new progressdialog(mainactivity.this); httpurlconnection conn; url url = null; @override protected void onpreexecute() { super.onpreexecute(); //this method running on ui thread pdloading.setmessage("\tloading..."); pdloading.setcancelable(false); pdloading.show(); } @override protected string doinbackground(string... params) { try { // enter url address php file resides url = new url("http://remote.host/test/login.inc.php"); } catch (malformedurlexception e) { // todo auto-generated catch block ...

Arduino Due with ESP8266 simple AT command -

i have arduino due , want connect esp8266 board , test connection simple "at" command on serial command line. have written lot on internet there many different answers on topic , none of them solves issue directly. i set eps8266 correctly 2 power cables. comming different power sources, there should not problem power esp board. i think problems somewhere in different baud rates. if choose 9600 baud connection arduino pc via usb , 74880 connection esp board due @ least error messages correctly when esp board has restart (when force it). ets jan 8 2013,rst cause:1, boot mode:(3,6) load 0x40100000, len 1396, room 16 tail 4 chksum 0x89 load 0x3ffe8000, len 776, room 4 tail 4 chksum 0xe8 load 0x3ffe8308, len 540, room 4 tail 8 chksum 0xc0 csum 0xc0 2nd boot version : 1.4(b1) spi speed : 40mhz spi mod le:52mn the code following: //always high int ch_pd_8266 = 53; void setup() { serial.begin(9600); serial3.b...

c - How to implement a BFS with depth -

i stuck trying think of way to write function bfs depth. wrote working bfs search goes through entire graph thinking of making copy , editing it. my bfs returns array of int -1 denoting end. thinking after every depth, make marker , put -2 onto array show new depth. example: 0, -2, 1, 4, 6, -2, 3, 5, -1 however, part stuck on. put -2 after first number, -2 after inserting of neighbors of beginning vertex, , on. how write function? my function looks this: vertex *bfs(graph *g, vertex v) { if(v < 0 || v > g->numvertices) return null; int size = g->numvertices + 1; int counter = 0; int = 0; queue *fq = createqueue(size); set *ds = createset(size); vertex currentv; vertex *returnarr = (vertex *)malloc(size * sizeof(vertex)); vertex *neighbors; if(addtoqueue(fq, v) != 1){ printf("error in adding queue\n"); return null; } if(addtoset(ds, v) != 1){ printf("error in added set\n"); ...

amazon web services - S3 Cloudfront - Redirects to the file path -

i have configured cloudfront & s3 redirect page such when user loads www.example.com, redirects https://example.com . when load page url www.example.com redirects https://www.example.com.s3-us-west-1.amazonaws.com/index.html . idea missing here? did generate ssl cert both example.com , www.example.com. cloudfront updated both www.example.com , example.com. for www.example.com the origin domain name path: www.example.com.s3.amazonaws.com origin id s3-www.example.com for example.com the origin domain name path: example.com.s3.amazonaws.com origin id s3-example.com for s3 bucket: www.example.com redirected example.com using static website setting - checking redirect requests host name update i had 2 distribution settings. 1 www.example.com & example.com the https characters in red exclamation mark. (invalid cert) certificates valid yes bucket created , in us-west-2 region. i created 2 route 53 alias records. 1 example.com , www.example.com each points...

convert mysql db to php array in particular format -

i have seen other solutions don't put data in php array way described below. i have database called: users in database there many tables e.g. alice,bob each table has following columns e.g. id,name,age i data , put php array, so: array ( [db_users] => array ( [0] => array ( [id] => 1 [name] => alice [age] => 34 ) [1] => array ( [id] => 2 [name] => bob [age] => 42 ) ) ) you should have 1 table called users columns id , name , , age alice, bob, et. al. 1 row in table. have 1 simple query return array desire. select * users here's example schema mysql create table users ( id int primary key auto_increment, name varchar(255), age int ); insert users (name, age) values ('alice', 34), ('bob', 42); and here's example using pdo <?php // returns intance of pdo // https:/...

java - Best way to find a full word on a string -

i'm doing project , need find full word in string example "hello stackoverflow, have nice day" want know if word "over" in string. should use tolowercase() avoid problems? string = "hello stackoverflow"; if (a.indexof("over") >= 0) system.out.println("found"); else system.out.println("not found"); use tolowercase() if unsure of case.

python - Ordered lists of generic foreign keys in Django -

i have app hierarchical course, note , task models. is, each course has bunch of note instances pointing foreignkey, , each note has bunch of task instances pointing it. i want content in specific order, added sequence attribute course , note via parent model. allows them hold ordered list of pk's of linked instances (e.g. [1, 4, 6, 2, 3]), can edit order of. i added global_sequence course, holds list of ('class_name', pk) tuples strings e.g. ["('note', 1)", "('task', 19)", "('task', 31)", "('note', 2)", "('task', 22)",]. class sequence(models.model): sequence = django.contrib.postgres.fields.arrayfield(models.integerfield()) class course(sequence): title = models.charfield(max_len=80) global_sequence = django.contrib.postgres.fields.arrayfield( models.charfield(max_len=30) ) class note(sequence): body = models.textfield() course = mo...

sqlite3 - How do I build lsqlite3 for lua.5.3.1 -

i looking build lsqlite3 0.9.4 lua 5.3.1 on windows 10. not entirely sure how go it. there rockspec file not sure if should trying through that(because default think luarocks configured 5.1) or manually visual studio developer console. unfortunately not have knowledge on should doing. guess googling/trial , error here have done, , have no idea if correct forgive me. cl /nologo /md /o2 -c -folsqlite3.obj -i"c:/lua/5.3.1/include" lsqlite3.c -dluaopen_lsqlite3=luaopen_lsqlite3complete (basically got command luarocks when failed work) , did this: link.exe /dll /out:lsqlite3.dll lsqlite3.obj which gave me bunch of unresolved external sqlite3 symbol errors kind of expected, not sure include in sqlite3.. any advice on how this? first. ships sqilte sourece itself. luarocks has 2 modules. 1 require separate sqlite library. , 1 build sqlite , lsqlite in single file. has no external deps. think lsqlite3 has bug on windwos. provide access sqlite3_temp_directo...

Error:CreateProcess error=193, %1 is not a valid Win32 application in android studio -

good day, received error message after android studio installation complete , trying run template android application on startup. suspect maybe windows version not compatible latest version of android studio because i'm using older version of windows(xp) not sure that. why happening me? there solution or should need switch windows 7 solve issue?

node.js - ack|grep|whatnot special ignore folders pattern node_modules/dir/node_modules -

i have discovered ack , ack -ir --ignore-dir={node_modules,dist,.git} <search-term> works great things ---node_modules/ ---------------project1/ -----------------------node_modules/ ---------------project2/ -----------------------node_modules/ i search files under "root" node_modules , excluding internal ones. note: if run find . -type f | ack -v 'node_modules|.git|dist' under root node_modules folder, proper file list. happen because find . gives out relative paths. way feed list ack ? ack -i <search-term> ./node_modules/* should want. if want include hidden files , folders too, set shopt -s dotglob (assumes bash) first. background information: ack has many rules ignoring files don't typically want search built in . as of @ least version 2.14, includes directories named .git , node_modules , @ whatever level of hierarchy ( ack searches recursively default, though may add -r / -r / --recursive make explicit). s...

visual studio code - Settings for the result window of Jupyter Notebook in vscode python plugin -

i've got vscode python plugin installed successfully; however, font in output window named results jupyter notebook small, further more, there's no text wrap in window, have scroll right see full output. settings output window? vscode 1.7.1 python plugin 0.5.2 don jayamanne python 3.5.2 jupyter 4.2.0

python - Function that iterates through a linked list -

class ln: def __init__(self,value,next=none): self.value = value self.next = next def list_to_ll(l): if l == []: return none front = rear = ln(l[0]) v in l[1:]: rear.next = ln(v) rear = rear.next return front def add_after(ll,value,new): item in ll: if item == value: ll.insert(ll.index(value),new) i working on iterative function named add_after . takes linked list , 2 values, value , new. mutates linked list such every occurrence of value followed new. example: a = list_to_ll([2,1,8,2,2,4,2,5,2]) add_after(a,2,-1) results in referring linked list containing values 1->8->2->-1->4->2->-1->5->2->-1->none. add_after(a,2,2) original list in results in referring linked list containing values 1->8->2->2->4->2->2->5->2->2->none. plus( not allowed use lists, tuples, sets, or dicts in code) use linked lists processing only when run a...

Very simple Java regex not giving expected result -

today first day learning regular expressions (literally no background before this) through chapter strings in book thinking in java 4th edition. pulling hair out why regular expression not matching region of input string. have tested in regex101 , result expected, in java (which can't test on regex101 site admittedly) result different. edit: doing exercise 10 in chapter regex: n.w\s+h(a|i)s input string: java has regular expressions expected result: match found in region "now has" of input string actual result: no match found my relevant code: import java.util.regex.*; public class foo { public static void main(string[] args) { // note: i've tested passing regex arg command line // "n.w\s+h(a|i)s" string regex = "n.w\\s+h(a|i)s"; string input = "java has regular expressions"; pattern p = pattern.compile(regex); matcher m = p.matcher(input); // starting @ beginning of input string, mat...

loops - huge files spark sort and iterate through the whole data set -

i new spark , still don't understand if developer needs aware of parallelism. transparent developer. problem following. need sort records (by cityid , timestamp) large number of large files , need iterate through sorted records in loop , calculation. can not group because order of records (by timestamp) same city important calculation. how can in spark? using rdd , iterate through means on 1 machine because need whole data set , data can not fit on same machine. right? i read lot rdds still missing part, if data can not fit on same machine, same rdd , want iterate through data in 1 loop.. need control something? there way have 1 loop across cluster? in general: if computation sequential (loop on records) spark won't provide advantage. here (if order important in groups defined city): partition data city sort date perform sequential computations on each partition

swift - UITableView Pagination without JSON or XML -

how add pagination property uitableview without json or xml? don't understand code: override func scrollviewwillenddragging(scrollview: uiscrollview, withvelocity velocity: cgpoint, targetcontentoffset: unsafemutablepointer<cgpoint>) { if scrollview == tableview { if ((scrollview.contentoffset.y + scrollview.frame.size.height) >= scrollview.contentsize.height) { if !isnewdateloading { if helperinstance.isconnectedtonetwork() { isnewdateloading = true getnewdate() } } } } } in this article. helperinstance , isconnectedtonetwork , , getnewdate ? i want tableview this: pagination tableview or lazy loding

c# - Type error trying to call Any() using Expression<Func<..>> from method -

i creating reusable mapping expression ef entity bll entity: private expression<func<person, bool>> getnamefilter(string name) { return person => person.profile.username == name; } internal expression<func<ef.perk, bll.perk>> mapperkperk(string name) { return perk => new bll.perk { id = perk.perkid, name = perk.perkname, description = perk.perkdescription, //compilation error owned = perk.players.any(getnamefilter(name)) }; } and getting compilation error on noted line. error reads: icollection not contain definition 'any' , best extension method overload 'queryable.any(iqueryable, expression>)' requires receiver of type 'iqueryable' but not happen when push expression in directly: internal expression<func<ef.perk, bll.perk>> mapperkperk(string name) { return perk => new bll.perk { id = p...

softlayer - Assign aspecific IP address to an vm -

i creating images of existing virtual machines using following code service.createarchivetransaction(templatename, blockdevices, "image of " + vm.gethostname()); i again creating virtual machines using image through api. virtual machines getting created, public , private ips assigned not ones trying put. either old ips, or new random ips. i use following code assigning ip: ` // set subnet id dallas 9 string primarybackendipaddress = "10.0.20.98"; //this ip availble user under chosen subnet component netcomp1 = new component(); vlan vlan = new vlan(); vlan.setid(new long(1229225));// id of vlan associated subnet subnet ss1 = new subnet(); ipaddress ipaddr = new ipaddress(); ipaddr.setipaddress("10.0.253.1"); ss1.setendpointipaddress(ipaddr); ss1.setid(new long(1208349)); // setting id of subnet vlan.setprimarysubnet(ss1); netcomp1.setnetworkvlan(vlan); netcomp1.setmaxspeed(new long(1000)); guest.setprima...

c++ - OpenMP: pragma cancel for ON NUMA -

---------------------edit------------------------- i have edited code follows: #pragma omp parallel private(i, piold, err) shared(threshold_err) reduction(+:pi) schedule (static) { (i = 0; < 10000000000; i++){ //1000000000//705035067 piold = pi; pi += (((i&1) == false) ? 1.0 : -1.0)/(2*i+1); err = fabs(pi-piold); if ( err < threshold_err){ #pragma omp cancel } } } pi = 4*pi; i compile llvm3.9/clang4.0. when run 1 thread expected results pragma cancel action (checked against non pragma cancel version, resulted in faster run). but when run threads >=2, program goes loop. run code on numa machines. happening? perhaps cancel condition not being satisfied! code takes longer single thread non-pragma-cancel version!! fyi, runs file when omp_cancellation=false. i have following openmp code. using llvm-3.9/clang-4.0 compile code. #pragma omp parallel private(i, piold, err) shared(pi, threshold_err) { #pragma omp reduc...

How to break sublist to make each element in the sub list a normal element in the list in python -

for example have [[1,2,3],[1,2,3],3,5,6] i want turn [1,2,3,1,2,3,3,5,6] what code in python 3? iterate a items, iterate subitems if item list; other append new list: a = [[1,2,3],[1,2,3],3,5,6] b = [] x in a: if isinstance(x, list): b.extend(x) else: b.append(x) # b == [1,2,3,1,2,3,3,5,6] another approach using list comprehension (nested for ) combined conditional expression : >>> = [[1,2,3],[1,2,3],3,5,6] >>> [y x in y in (x if isinstance(x, list) else [x])] [1, 2, 3, 1, 2, 3, 3, 5, 6]

android - Having trouble implementing onClickListener for a custom ListAdapter Listview -

i having trouble implementing onitemclick listview . need open new activity on clicking item in listview , pass title/genre/rating/release year data new activity. know how can pass thumbnail image of clicked item in listview , display in new activity. customlistadapter.java public class customlistadapter extends baseadapter { private activity activity; private layoutinflater inflater; private list<movie> movieitems; imageloader imageloader = appcontroller.getinstance().getimageloader(); public customlistadapter(activity activity, list<movie> movieitems) { this.activity = activity; this.movieitems = movieitems; } @override public int getcount() { return movieitems.size(); } @override public object getitem(int location) { return movieitems.get(location); } @override public long getitemid(int position) { return position; } @override public view getview(i...

angularjs - Share Angular2 Service across multiple windows -

my website built angular2. imagine big dashboard lot of modules. information multiple modules required @ same time - therefore want allow users open module in new window. real-world example video container of hangout. from research there 2 ways this: i open route of selected ng-component in new window. result angular reinit services. keep data consistent need find way sync instances. maybe kind of service writes attributes localstorage? this somehow way goldenlayout implemented popouts . init component in window , hide - open new window (b) , pass copy (css, html, data) of component it. mean need sync mirrored component, not sure if architecture. which way go solve described problem , there more elegant solutions?

Camera's Linux system cannot run compiled C program with './abcd', recognises it as a /bin/sh script instead -

recently started scripting camera. made simple hello world program in c, compiled , sent camera. the camera's system bare bones version of linux. running uname gives me linux, , uname -r gives me 2.6.35. bash not installed on system. when execute c executable, thinks script, giving me error: ./helloworld: line 1: syntax error: unexpected "(" any appreciated, thanks. i assume compiled hello world program on 64 bit desktop pc using gcc -o helloworld helloworld.c . the resulting binary meant amd64 architecture (think intel 64 bit) , won't run on other processor type. i.e. incompatible target system (= camera) uses 32 bit artpec-3 processor crisv32 architecture. this means must cross-compile program camera's cpu. check e.g. http://developer.axis.com/wiki/doku.php%3fid=axis:compiling_for_cris_howto.html looks tutorial on getting first program run on camera.

css - Flexbox align items horizontally -

this question has answer here: in css flexbox, why there no “justify-items” , “justify-self” properties? 4 answers is there method align child items in way: [i][i]______[i][i][i], regardless how many items in each of groups? in flexbox container use justify-content alignment of items horizontally . use align-items align items vertically . have @ example snippet below: .parent { display: flex; width: 100%; height: 100px; align-items: center; /* align items vertically */ justify-content: space-between; /* align items horizontally (with equal space in between each of them */ background: #eee; } .children { display: flex; } .child { margin: 0 5px; padding: 0 5px; font-size: 30px; background: #ccc; color: #000; } <div class="parent"> <div class="children left-children...

sql - Oracle query cumulative amount -

this question has answer here: make cumulative sum in view oracle 2 answers i have following table ordered date asc. need column progressively netv sum progressively column netv eatch row. id type date netv debit credit vat progressively netv 177485 invoice 23/12/2015 900 1107 0 1.23 900 177485 transfer 14/1/2016 0 0 1107 0 900 177485 invoice 24/3/2016 900 1107 0 1.23 1800 177485 transfer 27/5/2016 0 0 1107 0 1800 177485 invoice 30/6/2016 900 1116 0 1.24 2700 177485 transfer 5/8/2016 0 0 1116 0 2700 177485 invoice 28/9/2016 900 1116 0 1.24 3600 177485 transfer 4/11/2016 0 0 1116 0 3600 your question bit unclear. understand want have like: select id, type, date, netv, debit, cred...

c - How to delete specific words from char array? -

so task char array delete these words starts , ends same letter. , @ point program crashes. here function: void removesame(char * start) { int i, j, first, last, k; (i = 1; < line_length; i++) { if ( * (start + i) != ' ') { first = * (start + i); (j = i; j < line_length; j++) { if ( * (start + + j + 1) == ' ') { last = * (start + + j); } else { break; } } } (; != j; i++) { k = j - i; * (start + k) = "\0"; } } } and here full code http://pasted.co/22566eb6 as other mentioned: changing * (start + i) start[i] improves readability "\0" should '\0' or 0 - in c, double quotes used represent strings, , strings memory addresses. array indexes start 0 also keep in mind strings write in clear in source (ex: "abcba string") constant strings (const char*) , must copied other location in order modify them. void ...

angular - Putting this Android Layout inside a TabView -

this question raised own perspective. how put following android layout eagerly inside out-of-the-box tabview? android layout generously stacked no update of date: [ http://www.nativescriptsnacks.com/snippets/2016/08/30/aosp-messaging-layout.html] i put specific layout customized data importing 'faker' library, attached here right after, , no data shows on screen in tab view context. when perform injection of data with-out tab view, data appears works perfectly. so in sense, i'm approaching with: how 1 put above layout inside tabview make correctly run if ever case, mine. i not need answer links official nativescript document or whatsoever have gone through them deemed appropriate , tested relevant setups over. i need inspiring inputs corresponding specific question. hope nativescript team seeing answer. views.html regarding out-of-the-box tabview, link components show below, referencing android aosp layout: <tabview #tabview [selectedindex]="tab...

html - PHP to get meta tags after <head> tag -

i want meta tags external url. unfortunately, meta tags on website placed after tag. use get_meta_tags($url) didn't work. here external url source , meta tag description exist @ last. <html><meta http-equiv="content-type" content="text/html; charset=utf-8"> <head><title>tools</title> </head> <body><h2>sitemap notification received</h2> <br> sitemap has been added our list of sitemaps crawl. if first time notifying google sitemap, please add via <a href="http://www.google.com/webmasters/tools/">http://www.google.com/webmasters/tools/</a> can track status. please note not add submitted urls our index, , cannot make predictions or guarantees when or if appear.</body></html> <meta name='description' content='200'> this function should you: function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, curlopt_...

javascript - How do I make this youtube player appear multiple times on my single page website made using Node and fullPage.js? -

the youtube player code attached @ bottom http://www.labnol.org/internet/youtube-audio-player/26740/ , have used on site i'm building. the problem appears once in first instance call in .ejs file. not appear when hardcode instead of calling postgresql database. is due fact youtube iframe api needs use html div id instead of using class? (and yes have tried altering code use class doesnt work) from know in html id can appear multiple times isnt it? this how body of html file looks like: <div id="fullpage"> <div class="section" id="section0"> <h1>whole story</h1> </div> <div class="section" id="section1"> 1st story <h1><%= event[0].title %></h1> <p><%= event[0].description %></p> <br> <div data-video="<%= event[0].youtube %>" data-autoplay="0" data-loop="0" ...

Android | Manage permissions from a seperate class -

i try move of code manages android permissions mainactivity of app external class permissionmanager make code more readable , easier use. public class permissionmanager implements activitycompat.onrequestpermissionsresultcallback { public static final int my_permissions_request_access_fine_location = 0; public static final int my_permissions_request_internet = 1; private activity activity; private arraylist<permissionlistener> permissionlisteners = new arraylist<>(); private boolean locpermissions; private boolean inetpermissions; public permissionmanager(activity caller){ this.activity = caller; locpermissions = false; inetpermissions = false; } public boolean getpermission() { return getpermission(activity); } public boolean getpermission(activity caller) { if ( !hasinetpermissions(caller) || !haslocpermissions(caller) ) { if (activitycompat.shouldshowrequestpermi...

c# - Disadvantages of using Entity Framework in cshtml view -

sometimes put of c# code in view ( .cshtml ) not of code. example have table named lawcategory , this: @{ var db = new contracts.models.datacontext(); var lawcat = db.lawcategory.tolist(); } and use this: <div class="col-md-6"> <label>category:</label> <select name="type" id="type" class="form-control"> <option value="0">all</option> @foreach (var in lawcat) { <option value="@i.id" @(request.querystring["id"] == i.id.tostring() ? "selected" : "")>@i.name</option> } </select> </div> i want know disadvantages of using datacontext in view , connect database instead of send view model controller? is true doing this, may cause set multi connection database? (entity framework) you can u...

node.js - Automate this browserify command whenever js file is changed -

whenever change function.js , have manually run command below browserify function.js bundle.js $ browserify function.js --standalone function > bundle.js how can step automated such command run automatically in background whenever function.js modified? i using node.js v6.9 webstorm 2016.2 on windows 10. the browserify command want run is; $ browserify function.js --standalone function > bundle.js taking reference https://github.com/gulpjs/gulp/blob/master/docs/recipes/fast-browserify-builds-with-watchify.md here full code need. slight modification reference code needed opts browserify. 'use strict'; var watchify = require('watchify'); var browserify = require('browserify'); var gulp = require('gulp'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var gutil = require('gulp-util'); var sourcemaps = require('gulp-sourcemaps'); var assign = require('l...

AngularJS niether ng-keypress or custom directive are working -

trying implement simple keypress event on div somehow nothing happens. have read @ places need tabindex="0" , problem still prevails. here html: <body ng-app="mymodule"> <div ng-controller="myctrl" movement tabindex="1" ng-keypress="iterate($event)"> <div ng-repeat="entity in entities" entity-position="entity"></div> <div class="table"> <div> <select selected='name' ng-model="selected" id="select"> <option value="name" >first</option> <option value="id">second</option> <option value="id">third</option> </select> </div> <table id="table"> <tr ng-repeat="item in cars | orderby:selected" ng-click="go(item)"> <td>{{item.plate}}...

iso - what does is mean ios apps 15px depth what is the advantage? -

i new ios got psd mockup . difference between 5px , 10px , 15px . if use 15px depth advantage? here bigger picture enter image description here

shell - Date difference based on yyymm in unix -

#####date1=201609 #### date2=201508 how calculate difference between these 2 date , output count of no of month ie 201609-201508=13month the calculation of time difference complicated task, single calendar type (and there many ). many programming languages have built-in support date , time manipulation operations, including calculation of time difference. useful feature available in popular shells date command lacks feature, unfortunately. therefore, should whether write script in language, or make assumptions such number of days in year. for example, in perl task done 4 lines of code: perl -e $(cat <<'perlscript' use time::piece; $t1 = time::piece->strptime($argv[0], '%y%m'); $t2 = time::piece->strptime($argv[1], '%y%m'); printf "%d months\n", ($t1 - $t2)->months; perlscript ) 201609 201508 however, difference of time::piece objects instance of time::seconds assumes that there 24 hours in day, 7 days in ...

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -

when try pass variable data view error, can't find document problem controller(carouselcontroller.php) public function index() { $carousels = carousel::orderby('created_at', 'asc')->paginate(12); return view('admin.carousels.index')->withcarousels($carousels); } my view(index.blade.php) <div class="row"> <div class="col-md-9"> <h1>all images</h1> </div> <div class="col-md-3"> <a href="{{ route('carousels.create') }}" class="btn btn-lg btn-block btn-primary ">create new carousel</a> </div> <div class="col-md-12"> <hr> </div> </div>{{-- end of row --}} <div class="row"> <div class="col-md-12"> <div class="row"> @foreach($carousels $photo) <div class="col-xs-6 col-md...

typescript - Angular 2 prevent input inside component from firing form submit outside of the component -

outside form: <form #myform="ngform" (ngsubmit)="save(myform.value, myform.isvalid)"> <tags-input></tags-input> </form> tags input component template: <input type="text" [(ngmodel)]="newtag" (keyup.enter)="addtag(newtag, $event)"> tags input component: addtag(newtag: any, e: any) { e.stoppropagation(); e.preventdefault(); } despite this, still fires submit in outer form. how can prevent form submitting when press enter in input inside component? i'm thinking there must way achieve eventemitter or something, have no idea how. preventing keyup event not prevent submit event of form. 1 way solve raise flag on parent component. like: parent component <form #myform="ngform" (ngsubmit)="save(myform.value, myform.isvalid)"> <tags-input (enter)="onenter()"></tags-input> </form> onenter() { this.preventsave = true...

ruby - Rails & Google API - API calls with an existing access_token -

using https://github.com/google/google-api-ruby-client library, how make calls taken access_token. i think need create authorization object access_token.

php - Getting x amount of items from array -

i'm doing task in school i'm arrays , loops in php. what i've done far make piece of code, makes array names separate text-file, , chooses random name array. what i'd display x amount of random names. amount of names can chosen in input field, preferably or while loop (those ones know somewhat). here code (don't think text-file necessary. if is, let me know): <form method="post"> how many names need? <input type="number" name="amount" min="1" max="28"><br><br> <input type="submit" name="proceed" value="get name(s)"> </form> <?php $text = file_get_contents("names2t.txt"); $array = explode("\n", $text); $randnamenum = array_rand($array); $randphrase = $array[$randnamenum]; if (isset($_post["proceed"])){ echo $randphrase; } ?> is possible i'm ...

WCF Client Extensibility -

can use wcf extensibility feature on non-wcf client? meaning client not run .net framework.(php etc)? i understand can use wcf extensibility features inspect messages, change operation/service behaviour etc @ client side while making request. thanks jagadish

Rails same app with different databases -

i'm building report app in rails current desktop app. app kind of pos/accounting. so @ moment there different clients desktop app installed @ shop or office. each 1 has own mysql database. i planning how setup server, heroku. given keep databases each client separated, i'm trying understand best path follow. another thing consider there different version of app, i.e. restaurant, bar, shop etc.. different versions use same database. i'll need change controller , view. i'll handle using namespace. for client(company) multiple users have access app. the solution thought create database table company , add column company users table. things change client another: call different images assets such logo there might custom views or controller if client requests customization use different database domain possibly, that's not important wouldn't a big deal use same then based on user.company show different logo or other required image, render v...

php - Magento Product Custom Ordering -

i have magento based website ( http://www.apoyowellness.com/index.php/ ). here can see best seller section , have added custom field "featured" products tagged featured shown in best sellers. my problem want re-arrange products per sort weight custom field have defined in product catalog. i have attached custom field sort_order product catalog , every product has sort weight/number 1,2,3,4 etc. want show product according numbering in ascending order. i have each loop gives me attributes of products want how can loop products inside each in ascending order of given numbers (1,2,3 etc). below each code: <?php foreach ($_productcollection $_product): //print_r($_product); ?> <?php if($_product->featured == 1): ?> <div class="reco-sgl"> <div class="product-image-wrapper borderlnright"> <div class="single-products"> <d...