Posts

Showing posts from April, 2011

how can I change a software of openwrt and rebuild it in Bin file -

... $make menuconfig select package ... $make ... there many bin files in bin folder.: my question , want change software source code of openwrt , rebuild again. i have try edit source code of build_dir. want rebuild openwrt code refresh newest code of svn. does 1 how that? writing code , synchronizing it: 1) clone official linino repository arduino on machine using git (install using sudo apt-get install git): git clone https://github.com/linino/linino_distro.git 2) own changes in relevant code files, makefiles or whatever need change. 3) whenever want synchronize work latest changes remote master branch in linino repository, need first fetch changes, meaning retrieving them without yet merging them, in 2nd time merge them , resolve conflicts if any: preliminary: if created local branch own changes make sur master branch, need check out master: git checkout master a) fetching latest changes: git fetch master b) merging them changes on local re

html - My template responsive menu Bootstrap does not work? -

as can see in picture drew line on menu menu when little, got browser menu why not? i want menu when browser little drumbi site menu main site : drumbi menu my template code code menu: <div class="header"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand"> <img class="img-responsive" style="width: 150px" src="images/websitelogo.png" alt="logo" /> </a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right nav-menu"> <li><a href="#">pricing</a> </li> <li><a href="#">about </a></li> <li><a href="#">blog </a></li> <li><a href="#">help </a>&l

Encoding PHP MySQL -

i can see query results see � character characters "Á". basic connection this: $mysqli = new mysqli(server, user, pass, db); mysqli_set_charset($mysqli, 'utf8'); i tried with: $mysqli->query("set names 'utf8'"); $mysqli->set_charset("utf8"); mysql_query("set names 'utf8'"); but characters still watching. query function connection($mysqli) { mysql_query("set names 'utf8'"); if ( ! $link = mysqli_connect("localhost", "user", "pass") ) { echo ("error"); return false; } if ( ! mysqli_select_db($link, "db") ) { echo ("error"); return false; } if ( ! $consulta = mysqli_query($link, $mysqli) ) { echo ("error"); return false; } return $consulta; } all files saved utf8, var columns in db utt8 too. what or problem? thank you! m

Fastest collection for concurrent read and write other than Java Collections -

i have requirement store strings collections. collection hold billions of strings. the collection must support fast up, add , delete in concurrent manner. is there know fast, low latency collections available besides java collections... i searched didn't come across interesting... to hold billions of strings of reasonable length on reasonable cost server need use strategy have outlined below. first consider implications of "billions" of strings: do storage calculation (e.g. 10 billion strings, 64 characters per string average): 1.28 trillion bytes = 10 billion x 64 x 2 (utf-8 need @ least 2 bytes per character) that means 1 cannot use storage on computer hold strings. the required storage capacity drives 1 use external storage ... flexible use database, fronted cache in mamory. since collection interface, can implement huge storage strings using collection (that internally strings , handle "overflow" database. further implications: t

c++ - cpp: error when using rename function -

i have following code: void commandrenhandler::handlecommand(socket* socket, std::vector<std::string>& rvparams){ if (rvparams.size() < 2){ socket->writeline("not enough parameters specified"); return; } std::string filepath = base_directory; filepath.append(rvparams.at(0)); std::string filepath2 = base_directory; filepath2.append(rvparams.at(1)); int result = rename(filepath.c_str(), filepath2.c_str()); // test std::cout << filepath << " " << filepath2 << std::endl << "result: " << result << std::endl; if (result == 0) socket->writeline("file renamed"); else socket->writeline("could not rename file"); } in function receive 2 file-paths files need renamed. i've added test cout. i've got 1 file need renamed. here input , output of tests: 1 (renaming file manually - works intent

javascript - jQuery hover images carousel timeout overlaps -

i'm building webpage shows products. when hovering on product image, slideshow-like event should start. you'll see photo's of product in several states. i've coded jquery , i'm facing kinda annoying bug. when hover on several products fast , leave mouse on 1 product, slide through images fast. the html structure looks this: <div class="products"> <div class="productcontainer" data-product-id="1"> <img src="http://detestdivisie.nl/upload/images/hover-tests/inside/bmw-inside.jpg" class="mainproductimage" /> <div class="hoverimages"> <img src="" data-lazy-src="http://detestdivisie.nl/upload/images/hover-tests/inside/bmw-inside-1.jpg" /> <img src="" data-lazy-src="http://detestdivisie.nl/upload/images/hover-tests/inside/bmw-inside-2.jpg" /> <img src="" data-lazy-src="http://detestd

zurb foundation - How to show/not show a Reveal depending on data being returned from an AJAX source -

i have convert system runs ajax script , displays alert if returned data length greater 0 ie message returned. runs on form load, , periodically thereafter via timer. i'm trying impliment using foundation 5. when add reveal page, displays whether there's data or not. if use success callback function check length of returned data, how stop reveal displaying if length zero? i've tried following code: $('#messagemodal').foundation('reveal', 'open', { url: 'check_message_ajax.php', success: function(data) { if(data.length == 0) { return false; // tried "return;" , "stop;" } }, error: function() { alert('failed loading modal'); } }); any pointers appreciated.

shell - How to execute tshark command from bash script -

i trying execute tshark command find packets of particular ip address in bash command follows:: while read client echo "client adrees:" $client1 cmd="tshark -r \"(ip.src == 10.129.5.192)\" -r 12clients.pcap" echo $cmd done < input while executing script error follows:: client adrees: 10.129.26.154 tshark -r "(ip.src == 10.129.5.192)" -r 12clients.pcap tshark: read filters specified both "-r" , additional command-line arguments thanks in advance... :d use array variable instead store , execute command - using single string literal double quotes won't interpreted correctly: # store command tokens in array. # note each word or quoted phrase form separate array element. cmd=( tshark -r "(ip.src == 10.129.5.192)" -r 12clients.pcap ) # invoke command expanded array. # double-quoting prevents shell expansions of elements. "${cmd[@]}"

function with list inputs in python -

i trying create function ex: rotateelement (doc, lmnt_id, axis, angle) lmnt_id , axis , angle inputs come in form of list. ex: axis = [line1, line2, line3] angle = [20, 25, 30] lmnt_id = [1, 2, 3] doc constant value how can call function iterates through inputs. want use line1, 20 , 1 when runs first time line2, 25 , 2 when runs second time , on. tried runs once: for in lmnt_ids: lmnt_id = j in axises: axis = j result.append(elementtransformutils.rotateelement (doc, lmnt_id, axis, angle)) thank you! it looks want: for axis_, angle_, lmnt_id_ in zip(axis, angle, lmnt_id): result.append(elementtransformutils.rotateelement(doc, lmnt_id_, axis_, angle_)) zip match 3 lists , assign n th value each loop variables in turn

java - Parsing CSV file with BufferedReader vs Scanner -

team, have parse file line line , in single line have split ",". first string name , second count. finaly have display key , count example peter,2 smith,3 peter,3 smith,5 i should display peter 5 , smith 8. so in confusion choose between bufferedreader vs scanner. went through link . came these 2 approach. concerns. approach 1 : use buffered reader. private hashmap<string, mutablelong> readfile(file file) throws ioexception { final hashmap<string, mutablelong> keyholder = new hashmap<>(); try (bufferedreader br = new bufferedreader(new inputstreamreader( new fileinputstream(file), "utf-8"))) { (string line; (line = br.readline()) != null;) { // processing line. final string[] keycontents = line .split(keycountexam.comma_delimeter); if (keycontents.length == 2) { final string keyname = keycontents[

Restrict Google Custom Search with a logical AND? -

i created google cse , want add query "and (apples or bananas)" . besides that, there way retrieve specific info result pages? is possible, if yes how. for first part of question, think have manually add "and (apples or bananas)" each query string. for second part, i"m not sure quite mean 'specific info', if want extended info, take @ pagemap information returned part of each result - gives useful additional info. beyond in list of results, need retrieve , parse corresponding page yourself.

c++ - Is it possible to resolve static members similarly to overloading the member access operator for another type? -

i not sure call it, possible commented out line reflects? template <typename t> class test { public: test(t& t) : m_t(t) {} t* operator->() { return &m_t; } private: t& m_t; }; class { public: static const int integer = 0; void function() {} }; int main() { a; test<a> test(a); test->function(); // similar doing test<a>::integer? return 0; } well, why don't do: test->integer; you can access static members same way non-static ones (i.e. instance variable). the other option define in test: template <typename t> class test { public: typedef t value_type; // ... }; in case able do: test<a>::value_type::integer; which avoid need of creating instance of test<a> . at last, if using c++11 , test follows smart pointers conventions, have: std::pointer_traits<test<a> >::element_type::integer; which has advantage work if replace test<a>

c - About OpenMP with gnu gcc -

i have windows 8 64bit operating system. i wanted experiment following c code openmp functionality: hello.c program #include <stdio.h> #include <stdlib.h> #include<omp.h> int main() { #pragma omp parallel printf("hello world!\n"); return 0; } while tried run program command prompt using: gcc -fopenmp hello.c i got following error: c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot fin d -lpthread collect2.exe: error: ld returned 1 exit status i have c:\mingw in path gcc 4.8.1. what's wrong? lost. thanks!! thanks osgx, as newbie couldn't make out these "pthreads" meant. after found solution problem. installed gcc 4.8.2 64 bit on machine http://www.equation.com/servlet/equation.cmd?fa=fortran . changed environment variable in path itself. after finishing installing, restarted computer , when typed: gcc -fopenmp hello.c for above code in command line, code worked!!

python - Selecting rows with similar index names in Pandas -

lets have pandas dataframe of following form: b c a_1 1 4 2 a_2 3 3 5 a_3 4 7 2 b_1 2 9 8 b_2 7 2 6 b_3 5 4 1 c_1 3 1 3 c_2 8 6 6 c_3 9 3 7 is there way select rows have similar names? in case of dataframe above mean selecting rows start a, or rows start b, etc. using @akavall setup code df = pd.dataframe(data = my_data, index=['a_1', 'a_2', 'b_1', 'b_2'], columns=['a', 'b']) in [1]: my_data = np.arange(8).reshape(4,2) in [2]: my_data[0,0] = 4 in [3]: df = pd.dataframe(data = my_data, index=['a_1', 'a_2', 'b_1', 'b_2'], columns=['a', 'b']) in [5]: df.filter(regex='a',axis=0) out[5]: b a_1 4 1 a_2 2 3 [2 rows x 2 columns] note in general better posed multi-index in [6]: df.index = multiindex.from_product([['a','b'],[1,2]]) in [7]: df out[7]: b 1 4 1 2 2 3 b 1 4 5 2 6 7 [4 rows

sql - Issue with null values being inserted -

so have searched on answer, know it'll basic , silly i've overlooked life of me can't see it. at insert "" values point, i'm stuck unable insert null values.. need spaces blank. :/ drop table patient; drop table kennel; drop table prescription; create table patient ( patient_id number, name varchar2(15), dob date, primary key(patient_id) ); create table kennel ( kennel_no varchar2(2), kennel_section varchar2(1), admission_date date, patient_id number, primary key(kennel_no), foreign key (patient_id) references patient ); create table prescription ( prescription_date date, drug_code varchar2 (5), drug_name varchar2 (55), dosage varchar2 (25), num_days_dosage number , kennel_no varchar(255), foreign key (kennel_no) references kennel ); insert patient values (1234,'wiggles','12 d

c# - Method called by Web UI doesn't returns results -

i'm confused, have method: public ienumerable<professionalmodel> getallprofessionals() { return context.professionalcontext .include(x => x.useraccountmodel) .include(x => x.useraddressmodel).tolist(); } if call using console ui return 1 record (it works), if call using mvc application returns no 1 record! console ui: professionalcontext pcontext = new professionalcontext(); var list = pcontext.getallprofessionals(); foreach (var in list) { console.writeline(i.name); } console.readkey(); mvc web ui: public class professionalcontroller : controller { public professionalcontext professionalcontext { get; set; } public actionresult index() { professionalcontext = new professionalcontext(); var professionals = professionalcontext.getallprofessionals(); if (profe

CSS Selector * does not work for Twitter Bootstrap -

i want change rules of twitter bootstrap .span class not work. i want change direction of them , apply them border. here have out: .span* { direction: rtl !important; border: 1px #ccc solid !important; } why not work? put space between * , selector .span * { }

qt - C++ override virtual method throws an error "LNK2001: unresolved external symbol" -

i'm developing c++ qt application. have 1 abstract class , 2 children. 1 of children works way should, second 1 causes error: freewer.obj:-1: error: lnk2001: unresolved external symbol "public: virtual void __thiscall sierpinski::render(class qpainter &,class qrect)" (?render@sierpinski@@uaexaavqpainter@@vqrect@@@z) file not found: freewer.obj the problem is, both of children defined same way. let's show code. fractal.h: #ifndef fractal_h #define fractal_h #include <qpainter> #include <qrect> #include <qdebug> class fractal { public: virtual void render(qpainter &painter, qrect target) = 0; }; #endif // fractal_h cantor.h: #ifndef cantor_h #define cantor_h #include "fractal.h" class cantor : public fractal { public: void render(qpainter &painter, qrect target) q_decl_override; }; #endif // cantor_h cantor.cpp: #include "cantor.h" void cantor::render(qpainter &painter, q

jekyll serve '--watch' doesn't work in combination with '--detach' -

this works: jekyll serve --watch this notice new file in ./_posts , autogenerate static files but jekyll serve --watch --detach doesn't autogenerate files. want have autogenerating while running headless. how jekyll working headless , watching new files too? *using jekyll (1.5.1) ruby 2.1.0dev (2013-09-22 trunk 43011) on debian 3.2.51-1 x86_64* unfortunately, known bug in jekyll. release notes said fixed after --detach implemented, bug still there. now, recommend using jekyll serve --watch in separate shell.

Writing text blocks using nested iteration in Vim -

let's i'd write 5x5 text block, such as aaaaa aaaaa aaaaa aaaaa aaaaa and want using nested iteration. in pseudocode like do 5 times ((do 5 times (type 'a')) change line) so first guess convert as 5 ((5 (i esc)) enter) but can't that, because vim doesn't support use of parentheses specifying execution order. , typing 5 5 esc enter will of course not work, since produce single line 55 'a's , newline. so question is: there way write text blocks using nested iteration in vim? know there other ways write text blocks, want know if possible, out of curiosity. you cannot directly, need use register, expression, or macro: qq5aa<esc>a<cr><esc>q4@q qq - record macro 5aa<esc> - insert 5 a 's a<cr><esc> - insert line break q4@q - stop recording, repeat 4 more times

html - Masonry plugin not working -

Image
i have started use masonry plugin cannot work. below picture of problem. as can see not desired effect. below code using: content <div class="container" id="reviews"> <div class="row"> <div class="comment-block"> <div class="new-comment"></div> <?php while($row = mysqli_fetch_array($result)) { $data = mysqli_fetch_array(mysqli_query($con, "select first_name, last_name transactions order_id = '{$row['order_id']}'")); $name = $data['first_name']. ' '. mb_substr($data['last_name'], 0, 1); if($row['rating'] == 5) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span

Let for loop wait until code finish execution javascript -

i have bubble sort function when swap occurs should show visibly. after lots of approaches continues executing loops without waiting animation stop. (we allowed use javascript). there way tell website wait animation complete. here snippet of code: for (var = 0; < len; i++) { (var j = 0, swapping, endindex = len - i; j < endindex; j++) { if (marksarr[j] > marksarr[j + 1]) { //swap objects /*(function() { var k = 0, action = function() { document.getelementbyid(courseskey[j]).style.top = (parseint(document.getelementbyid(courseskey[j]).style.top) + 1) + 'px'; document.getelementbyid(courseskey[j + 1]).style.top = (parseint(document.getelementbyid(courseskey[j+1]).style.top) - 1) + 'px'; k++; if (k < difmoves) { settimeout(action, 200);

Android BitmapShader memory leak -

i've memory leak in android app, cause outofmemory exception. i've done memory analysis thought mat, , result there're ' 480 instances of "android.graphics.bitmapshader", loaded "" occupy 42,611,792 (81.71%) bytes.' i'm using lot of bitmaps , drawable, in whole project never use bitmapshader. guess how reduce number of objects or recycle them, if never instantiate no 1 of them. everyone are using progressbar ? noticed ton of bitmapshaders in mat application well, , of them retained progressbar instance. used dominator tree view, right-clicked on bitmapshader instance, choosing 'merge shortest paths gc roots' 'exclude weak references'. somewhere along hierarchy shows progressbar.

c - Given an array of characters, how can i take multiple digits from this array and assign it to an int value? -

so have char array such char *array = "hello name steven 123*3"; and want extract 123 expression , put in int . i know can like int firstnum = array[15] - '0'; (assuming 1 15th character in array), , give me firstnum = 1 . but able whole 123 number single integer, , im not quite sure how this. any appreciated edit: found out called strtol, unsure of how use it. i'm thinking long numberwanted = strtol(array[15], *p, 10); how let know when stop? or stop once non-int or non-long? , *p? try using sscanf . int n1 = 0, n2 = 0; char ch = 0; char *array = "hello name steven 123*3"; sscanf(array, "%*[^0-9] %d %c %d", &n1, &ch, &n2); this assumes prefix string never contain digit. if contain digit, read (which assumes data consists of: prefix string, 1 or more digits, 1 character, 1 or more digits. int n1 = 0, n2 = 0; char ch = 0; char *array = "hello name steven 123*3"; size_

autoit - Closing Chrome window or better solution -

i'm new autoit , have program working. objective: open website in browser , close after given period of time (1.5 hours). script: ;open command prompt start chrome from. run("c:\windows\system32\cmd.exe") winwaitactive("c:\windows\system32\cmd.exe") send('"c:\program files\google\chrome\application\chrome.exe" http://website.com' & "{enter}") ;close dos box winwaitactive("c:\windows\system32\cmd.exe") send('exit' & "{enter}") ; 5400000 = 1.5 hours sleep( 5400000 ); winwaitactive("listen live - google chrome","") ;send("{f4}{altup}") send("{ctrldown}{shiftdown}q{shiftup}{ctrlup}") the opening works fine script never closes. appears work when timer short not when long. the script executed via windows scheduled tasks. i've tried separating open/close 2 separate scripts didn't seem work either. i'm open alternative solutions work on win

php - Cakephp with google map API by marcferna / CakePHP-GoogleMapHelper -

currently im using api marcferna / cakephp-googlemaphelper https://github.com/marcferna/cakephp-googlemaphelper api me need draw direction current location im looking @ getdirection() function in googlemaphelper.php still can figure out way current location lat , lng value var start = new google.maps.latlng({$position['latitude']},{$position['longitude']}); var end = new google.maps.latlng({$position['latitude']},{$position['longitude']}); var request = { origin:start, destination:end, travelmode: google.maps.travelmode.{$travelmode} }; i have edit function own can end lat,lng need start lat , lng value finish function cant find anyway try use navigator.geolocation before these code still not working solution? in advance

database - how to insert array values in a single column in mysql with php? -

m dealing checkbox selection <input type="checkbox" name="chk_group[]" value="1"> <input type="checkbox" name="chk_group[]" value="2"> <input type="checkbox" name="chk_group[]" value="3"> <input type="checkbox" name="chk_group[]" value="4"> here im getting values of checked checkboxes in array: $ids = array(); foreach($_post['chk_group'] $val) { $ids[] = (int) $val; } echo $ids = implode(',', $ids); if check 2nd , 3rd checkbox [2,3] value in array $id . problem want store these values separately in db table column table is: product_attribute id a_id i want insert values array in column a_id id ------ a_id 1 ------- 2 2 ------- 3 how can use insert query store data in mysql table?? where have implode(',', $ids) replace sql. example:

Facebook graph API and Facebook groups -

i have 2 questions facebook graphapi , facebook group: is there way connect existing fb group , new fb app? i wanna add new member of fb group via fb graph. have code ( graph api reference ) $postresult = $this->facebook->api("/group_id/members", "post", array ( 'member' => 'user_id', ) ); but still error " (#3) unknown method ". the documentation says: an app access token can invite app users group created app. so request must made app access token , same app app must have created group. you cannot send request friends if group not created using app.

ruby on rails - Downloading text instead of render (probably Nginx conf) -

i'm trying deploy app vps (rails 3.2, capistrano 2.15) ubuntu 13.10 + nginx 1.4.7 + phusion passenger 4.0.40 i following these manuals http://gorails.com/deploy/ubuntu/12.04 , https://library.linode.com/web-servers/nginx/configuration/basic had problems in configuring nginx never used before (403 err, 500 err etc) eventually got weird thing makes me nuts: when go url app supposed (and normal html page supposed rendered) text file downloaded instead. text file contains ruby code (like in code of /home/myapp/current/app/views/home/index.html.haml). here /opt/nginx/conf/nginx.conf contains #user nobody; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /home/myapp/.rvm/gems/ruby-2.0.0-p451/gems/passenger-4$ passenger_ruby /home/myapp/.rvm/gems/ruby-2.0.0-p451/wrappers/ruby; include mime.ty

python - Raise error if initiating a class, but not when initiating its subclasses -

i'm implementing guess similar abstract class in python. here's example: in [12]: class a(object): ....: def __init__(self, b): ....: self.b = b ....: raise runtimeerror('cannot create instance of class') ....: in [13]: class b(a): ....: pass ....: in [14]: c=b(2) what want example, able initiate b subclass, call c.b , retrieve 2. if call class, give me runtimeerror. problem implementation raise error on b well. how can around this? one solution, commented, place self.b = b part in subclass , overwrite __init__ function. prefer leave code in superclass if possible, since duplicated quite in quite few subclasses otherwise. thanks. import abc class a(object): __metaclass__ = abc.abcmeta @abc.abstractmethod def __init__(self, b): pass class b(a): def __init__(self, b): self.b = b c = a(2)

java - Adding scroolbar to JList(including DefaultListModel object ) -

i trying add scrollbar jlist , have searched in site there lot of thing topic when ı try referenced questions , of them has worked.my code here. list = new jlist(); list.setvisiblerowcount(1000); model = new defaultlistmodel<string>(); list.setmodel(model); jscrollpane scrollpane = new jscrollpane(); scrollpane.setviewportview(list); how can add scrollbar jlist ? can me question? how can ı add scroolbar jlist?anybody can me question? the scrollbar appear automatically when number of elements in list greater size of scroll pane. i'm guessing setvisiblerowcount(...) method nothing because didn't add data listmodel. since there nothing render size 0. using row count of 1000 makes no sense since can't display 1000 of lines of data on single page. property meant reasonable value 10 can see 10 items of data @ 1 time when have 100 items in list. post sscce demonstrates problem (once add data model , make row count reasonable) if ne

Memberwise assignment cartesian class c++ -

i have code cartesian class , want add memberwise assignment set values of coord1 coord2. not quite sure how go doing this. syntax writing memberwise assignment class objects? make changes class itself, or put them in main function? #include <iostream> using namespace std; class cartesian { private: double x; double y; public: cartesian( double = 0, double b = 0) : x(a), y(b){} friend istream& operator>>(istream&, cartesian&); friend ostream& operator<<(ostream&, const cartesian&); }; istream& operator>>(istream& in, cartesian& num) { cin >> num.x >> num.y; return in; } ostream& operator<<( ostream& out, const cartesian& num) { cout << "(" << num.x << ", " << num.y << ")" << endl; return out; } int main() { cartesian coord1, coord2; cout << "please enter first coordin

android - SQLite wont show results -

i'm using simple databasehandler-class, because want of things raqqueries. database correctly created. use: public class databasehandler extends sqliteopenhelper { private static int database_version = 2; private static string database_create_table = null; private static string database_table = null; public databasehandler(context context, string dbname, string dbcreatetable, string dbtable) { super(context, dbname, null, database_version); database_create_table = dbcreatetable; database_table = dbtable; } // creating tables @override public void oncreate(sqlitedatabase db) { try { db.execsql(database_create_table); log.i("db created with: ", database_create_table); } catch (sqlexception e) { log.e("oncreate", e.getmessage()); } } // upgrading database @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { // drop older table if existed db.execsql("drop t

node.js - How to return a JSON object using NodeJS, Passport, mongoose, & MongoDB -

i'm new nodejs, passport, , mongo. i'm trying set basic local authentication, successful, however, when try return entire object returns empty array. my node setup: var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var passport = require('passport'); var localstrategy = require('passport-local').strategy; var mongoose = require('mongoose/'); mongoose.connect('mongodb://localhost:27017/eidata'); var schema = mongoose.schema; var userdetail = new schema({ username: string, password: string, fullname: string }, { collection: 'userlist' }); var userdetails = mongoose.model('userlist', userdetail); var user_obj = user; var app = express(); // environments app.set('port', process.env.port || 3000); app.set('views', path.join(__dirname, 'vie

asp.net mvc - Phaser game library with javascript and VS 2013 web express -

so i'm totally new phaser game library , i'm trying setup project using vs 2013 web express in mvc project. i'm wanting use javascript (not typescript) , i'm assuming can use iisexpress web service vs creates when starts. of tutorials i've seen talk getting apache setup, i'd prefer use iisexpress when click run vs it's easier because don't have anything. so added phaser project. complained pixi. added pixi project, , when have following line following error: var game = new phaser.game(500, 600, phaser.auto, 'game_div'); "javascript runtime error: object doesn't support action" is setup of phaser ok? can not use iisexpress vs run phaser? my index.cshtml is @section scripts{ <script src="~/scripts/pixi/pixi.js"></script> <script src="~/scripts/phaser/src/phaser.js"></script> <script src="~/scripts/main.js"></script> } <div id="game_div">

javascript - Include ttf files in chrome extension content script -

i using content script inject html webpage. trying use google font, cabincondensed-regular, , number of icon fonts gotten icomoon. have downloaded files , including them in css @font-face , because can tell it's faster, don't know how include them in manifest.json. specify file "content_scripts": [ { "matches": [ "<all_urls>"], "css":["style.css", "jquery-ui.css"], "js":["jquery-2.1.0.min.js", "index.js", "jquery-ui.min.js"], } but far can tell there no specific tag fonts, how can include ttf files? looks can use "web_accessible_resources" link font files (instead of "content_scripts" . make sure @font-face path correct font files. see: https://developer.chrome.com/extensions/manifest/web_accessible_resources

javascript - Multidimensional array push -

how can this? "type" = string showmarkers('vehicles'); showmarkers('houses'); hidemarkers('vehicles'); var my_array = []; function showmarkers(type) { //code var gmm = new google.maps.marker( { //code }); my_array[type].push(gmm); //uncaught typeerror: cannot call method 'push' of undefined } function hidemarkers(type) { for(var = 0; < my_array[type].length; i++) { my_array[type][i].setmap(null); //hide markers } my_array[type] = []; //empty array of `type` } i got 3 different map icons want users able remove individually th problem my_array[type] undefined if call showmarkers before hidemarkers . change function this: function showmarkers(type) { //code var gmm = new google.maps.marker( { //code }); if (!(my_array[type] instanceof array)) { my_array[type] = []; } my_array[type].push(gmm); }

asp.net - Server looking for vb source file - Why? -

i deployed update asp.net website. 1 aspx file , files in bin. (after compiling website.) when run website says vb file (for file updated) doesn't exist, when try access aspx file. why looking @ vb file? shouldn't using compiled stuff in bin? here's error get.... server error in '/' application. parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: file '/member/xxxxxxxx.aspx.vb' not exist. source error: line 1: <%@ page language="vb" masterpagefile="~/layouts/singlecolumnformed.master" autoeventwireup="false" line 2: codefile="xxxxxxxx.aspx.vb" inherits="member_xxxxxxx" title="self study" %> line 3: source file: /member/xxxxxxxx.aspx line: 1 version information: microsoft .net framework version:4.0.30319; asp.net ver

vb.net - Error : Property is Read only? -

i have binding source entity : mybindingsource.datasource = _ (from t in context.mytable select t.id , t.vl1 , t.vl2).tolist now , try change value : mybindingsource.current.vl1 = 25 i error : an unhandled exception of type 'system.missingmemberexception' occurred in microsoft.visualbasic.dll additional information: property 'vl1' readonly. why error ? can ? thank !

c# save overwrite image error -

im trying save file using im getting gdi+ error because im trying save on source file im using. solutions? example: private void form1_load(object sender, eventargs e) { bitmap sourceimage = new bitmap("images/sourceimage.jpg"); sourceimage = cropbitmap(sourceimage, 0, 0, sourceimage.width, 50); sourceimage.save("images/sourceimage.jpg", imageformat.jpeg); } public bitmap cropbitmap(bitmap bitmap, int cropx, int cropy, int cropwidth, int cropheight) { rectangle rect = new rectangle(cropx, cropy, cropwidth, cropheight); bitmap cropped = bitmap.clone(rect, bitmap.pixelformat); return cropped; } see the documentation constructor . section reads: the file remains locked until bitmap disposed. you must dispose sourceimage before saving new one. so, use different variables: var sourceimage = new bitmap("images/sourceimage.jpg"); var croppedimage = cropbitmap(sourceimage, 0, 0, sourceimage.width, 50); sourceimage.

javascript - Angular - TypeError: path must be a string for $scope.formData? -

i have form has number field: input type="number" class="form-control" placeholder="0" ng-model="formdata.position" and when submit form, .error function responds 500 internal server error, error: typeerror: path must string $scope.createproduct = function() { // validate formdata (using our exentions.js .filter) make sure there //if form empty, nothing happen if (!isemptyobjectfilter($scope.formdata)) { // call create function our service (returns promise object) emotions.create($scope.formdata) // if successful creation, call our function new emotions .success(function(data) { $scope.formdata = {}; // clear form our user ready enter $scope.products = data; // assign our new list of emotions }) .error(function(data) {

java - Showing the opened file in Eclipse package browser -

i wanted enable feature in eclipse. when use ctrl + alt + t or ctrl + alt + r open class or resource file, want open , highlighted in package browser. way it's easy me check version history, commit changes, etc. my eclipse 3 has feature, seems disappear in eclipse 4. does know how configure it? click on icon "link editor" (arrow left , arrow right) or select "link editor" menu item in view menu (click on triangle icon in top-right corner of view , select). works in package explorer , project explorer (eclipse 3.x , 4.x).

html - Centered div with position:absolute has offset for Android devices when content is larger than viewport -

Image
issue shows on android browsers when following on page: a div element size larger device's viewport. (i used 1200px.) one or more other div elements either left:0; right:0; margin:auto; or left:50%; margin-left:-100px style centering. the issue "centered" div elements aren't. have offset left (or top if centering vertically). problem shows on android devices in both chrome , dolphin (webkit). not show on desktops (tested chrome, firefox, safari, , ie). here example css: body{ margin:0; padding:0; } .wide-element { position:absolute; height:800px; width:1200px; left:50%; margin-left:-600px; background:url(1200px-wide.png); } .fixed-1, .fixed-2, .absolute-1, .absolute-2 { height:200px; width:200px; } .fixed-1 { position:fixed; margin:auto; left:0; right:0; top:0; bottom:0; background:rgba(0, 0, 255, .5); } .fixed-2 { position:fixed; margin:-105px 0 0 -105px; left:50%; top:50%; border:5px solid blue; } .absol

Bash with arguments to modify ffmpeg command -

i'm trying make bash script takes arguments start time , time, takes input file , output file name. if start time , end time left out, execute input , output. i've been trying can use script.sh -t1 00:00:00 -t2 00:00:20 far have prompting values. #!/bin/bash read -ep "enter path .mov-file: " file ifs=: read -rp "where should trimming start? (hh:mm:ss): " shour smin ssec ifs=: read -rp "when should trimming end? (hh:mm:ss): " ehour emin esec ifs=: read -rp "output file: " output start=$(( shour*3600 + smin*60 + ssec )) end=$(( ehour*3600 + emin*60 + esec )) duration=$(( end - start )) ffmpeg -i "$file" -t "$duration" -c:v libvpx -crf 4 -b:v 1500k -vf scale=640:-1 -c:a libvorbis $output please point me in right direction! i've tried using if/else doesn't work.

django nonrel - require_indexes when unit testing on djangoappengine -

i'm trying reduce , clean datastore indexes on gae datastore, set require_indexes=true. removed indexes , ran unit tests, tests pass without issue , there no changes made gae sdk index.yaml. why passing????? i think solution djangoappengine.sb.stubs.activate_test_stubs needs updated follows require , setup indexes: def activate_test_stubs(self, connection): if self.active_stubs == 'test': return os.environ['http_host'] = "%s.appspot.com" % appid appserver_opts = connection.settings_dict.get('dev_appserver_options', {}) high_replication = appserver_opts.get('high_replication', false) require_indexes = appserver_opts.get('require_indexes', false) datastore_opts = {'require_indexes': require_indexes} if high_replication: google.appengine.datastore import datastore_stub_util datastore_opts['consistency_policy'] = datastore_stub_util.pseudorandomhrcons

Powershell AD Users CSV report with ADPropertyValueCollection Error -

got loop going through ad users delete users on 90 days old. want pull report of deleted users in csv. in few fields of cvs microsoft.activedirectory.management.adpropertyvaluecollection the code this users in have not logged on within # 60 days in "active directory" , disable them # # current date loginfo("start of log file") loginfo("compare date : getting date") $comparedate=get-date # number of days check back. loginfo("set disable time : settings number of days disable 60") $numberdays=(get-date).adddays(-60) #$then = (get-date).adddays(-60) # number of days check stale accounts # our sample here taking "oldaccounts" , pumping # 30 more days. #therefore 90 days old accounts haven't logged in should purged # loginfo("set delete time : setting number of days delete 90") $deletedate=$numberdays+30 # have "override fields" bypass delete # happening. if "notes" field in a/d conta

java - Netty trouble with chat server -

i'm having trouble figuring out wrong simple netty chat program working with. i have tried debugging through program hasn't been able show me problem lies. through debugging seems client connecting server, write function doesn't seem working. i followed tutorial here . have source code here on github. here client classes. public void run() throws exception { eventloopgroup group = new nioeventloopgroup(); try { bootstrap bootstrap = new bootstrap() .group(group) .channel(niosocketchannel.class) .handler(new chatclientinitializer()); channel channel = bootstrap.connect(host, port).sync().channel(); bufferedreader in = new bufferedreader(new inputstreamreader(system.in)); while (true) { channel.write(in.readline() + "\r\n"); } } { group.shutdowngracefully(); } } public class chatclientinitializer extends channelinitializer<socketchan

php - pass text area value in jquery -

i have text area in php page , want pass value of php page when teaxt area changing. <textarea name=taskdescn id=taskdescn rows=25 onclick="updatettaskdescription()" </textarea> function updatettaskdescription() { $('#taskdescn').bind('input', function() { var taskdescription = $("#taskdescn").val(); //alert('ok'); //alert(taskdescription); $.post('../myfolder/edit.php', {taskdescription:taskdescription}, function (data) { alert(taskdescription); }); }); } in edit.php $taskdescription=$_post['taskdescription']; my problem can not value $taskdescription in edit.php.please body me solve this i noticed quotes missing in textarea attributes. try this: <textarea name="taskdescn" id="taskdescn" rows="25" onclick="updatettaskdescription()"> </textarea>

why doesn't the octave 3.6.4 for windows make automatically path for package folder? -

why doesn't octave 3.6.4 windows make automatically path package folder?: i installed octave 3.6.4 on windows xp system , of packages. 'pkg list' operation shows every packages i've installed, package folder not included in path list. (checked use 'path') so can't use 'fspecial' although have packages in 'share/ocetave/packages/image-2.0.0' folder. my question body: why situation happen?? isn't normal setup file make automatically link path? don't want use 'addpath' function. octave not load packages default, need load them. use pkg load image . can see packages loaded pkg list have asterisk in front of names. having load packages thing many users coming matlab find strange if compare other languages, such python, perl, or c++, expect them import, use, or #include every libraries available in system default? see octave's faq more details. if want package loaded automatically default, recommende

Android: ListView background color when not enough items fill. [Screenshot] -

Image
so have listview. items have own drawable. the divider own drawable. now, when have listview, seen in screenshot below, empty area without enough elements fill, it's white. i've tried setting cache color hint, doesn't solve (honestly can't think of else may wrong it). any appreciated. adding code... my listview creation , properties: final listview v = new listview(this.getactivity()); fl.setbackgroundcolor(color.transparent); v.setbackgrounddrawable(this.getactivity().getresources().getdrawable(r.drawable.item_selector_bad)); v.setdivider(new colordrawable(color.parsecolor("#00000000"))); v.setdivider(this.getactivity().getresources().getdrawable(r.drawable.item_square)); v.setcachecolorhint(color.transparent); v.setselector(this.getactivity().getresources().getdrawable(r.drawable.item_selector_bad)); v.setdividerheight(20); as xml files, general layout such a item in list has: <?xml version="