Posts

Showing posts from August, 2012

.NET Configuring GIT environment and local build for working with multiple repositories with dependencies between them -

we have multiple teams working on large project divided multiple repositories , each team works on 1 or more repositories , of repositories shared among teams. security policy , dont give developer access repositories ones required project. our dev folder looks : repos.folder repo1 repo2 ... repon bin.folder the developer first download build server dlls bin folder, projects output bin.folder on local build through visual studio . the problem , because not developers have projects , cannot reference projects .csproj files (as not have references) , reference them dll files in bin folder - developers can download them build server, , , when developer tries setup work space solution (.sln file) , visual studio not automatically detects build order of projects , each developer needs setup sln file himself going through each 1 of projects references -- tremendous overhead ... wanted ask if has solution problem or if spots caveat/problem in our dev env , know how handl

Uploading a small audio file from iOS app to a Python-Flask server -

i have literally gone through each , every stackoverflow post related audio file upload ios app, haven't been able code working. basically, creating app can record sound, sound sent python-flask server, runs machine learning algorithms on soundfile , returns value client(ios app). have recording part working, , have been ale communicate server having trouble sending audio file server. so question of 2 parts: 1. how send audio file ios server? 2. how read received audio file in server? here codes: // code send audio file local python-flask server (this code has been taken few answers on stack overflow) nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request sethttpmethod:@"post"]; [request seturl:[nsurl urlwithstring:@"http://127.0.0.1:5000"]]; nsstring *boundary = @"---------------------------14737809831466499882746641449"; nsstring *contenttype = [nsstring stringwithformat:@"multipart/form-data; boundary=%@",

multithreading - Multithreaded merge, best java threading practices recommended -

problem - merge 1000 hash-maps single map. assume each hashmap contained alphabets , frequency 1 page of book, , book had 1000 pages. have scanned through each page , created 1000 hashmaps, , want reduce / merge them. has done taking advantage of multithreading. note - not using hadoop has done on single machine. question tailor made doubts solved please refrain answers suggest by-pass threading. is typical problem known solution ? if yes please point me reference links. if not, how go reduce-merge problem, given threads dont return values ? here suggested approach. work in divide-conquer manner. first spawn 500 threads each combining 2 maps, spawn 250 threads each combining 2 merged maps ... , on. oppositions ? better ideas ? if can use java 8 use parallel stream job done in parallel: list<map<string, integer>> maps = new arraylist<>(); //populate: 1 map per page map<string, integer> summary = maps.parallelstream() .flatmap(m ->

html - Resizing an iframe -

i wondering, there anyway resize video inside iframe? below code working on, when tried resize iframe, resizes wrap , not player therefore creating scrollbar. there anyway resize video player itself? <iframe width="600" height="370" src="http://online.fairytail.tv/s/googplayer.php?skintype=nemesis1&amp;to=1002mjumgqzg&amp;autostart=false&amp;id=108994262975881368074/ft1#5832691710150899906"></iframe> iframe{ width: 600px; height: 370px; } you cant style elements inside iframe domain unless give ability change parameters in url or something... https://developer.mozilla.org/en-us/docs/web/security/same-origin_policy

javascript - Modal work But not delete data with clicking confirm -

i want delete data modal confirmation.on remove click modal show when click confirm data not delete. i trying cant understand whats wrong code my code <script> $(document).on("click", "#deletebtn", function (e) { e.preventdefault(); e.stoppropagation(); var link = $(this).attr('data-adid'); console.log($("#mymodal btn-warning a")); $("#mymodal .btn-warning a").attr('href',link); $(".modal").modal("show"); }); </script> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header">

ios - Objective-C should I set Arrays to nil after use? -

is practice dealloc items i've created inside method or class after use? for instance, if have method: -(nsarray *)splitclasseswithdata:(nsdata *)data { nsstring *htmlstring = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nsmutablearray *classes = [[nsmutablearray alloc] init]; nsuinteger length = [htmlstring length]; nsrange range = nsmakerange(0, length); while(range.location != nsnotfound) { range = [htmlstring rangeofstring: @"lblperiod" options:0 range:range]; if(range.location != nsnotfound) { range = nsmakerange(range.location + range.length, length - (range.location + range.length)); nsnumber *toadd = [nsnumber numberwithinteger:range.location]; [classes addobject:toadd]; } } int counter = 0; nsnumber *count = [nsnumber numberwithinteger:[classes count] - 1]; nsmutablearray *classarray = [nsmutablearray arraywithcapacity:[cla

angularjs - How to use Twitter API from client side? -

i'm trying information twitter using angularjs , passport. i've made authentication through oauth using passport js - worked - saved user information in session. now i'm trying run command on twitter api endpoint (both v1.1 & v1) keeps complaining authorization. example: executing in controller $http.jsonp(https://api.twitter.com/1/statuses/user_timeline.json, { }) gives me error: https://api.twitter.com/1/statuses/user_timeline.json 401 (unauthorized) this command has worked in twitter console (and use jsonp avoid cross domain issues). should pass additional headers manually request - s.a auth_token etc? or why wouldn't work? should exploit fact i've made authentication use api? i've red https://dev.twitter.com/docs/auth/authorizing-request didn't quiet understood. thanks helping, all twitter requests need authorized: https://dev.twitter.com/docs/auth/authorizing-request so need pass oauth

MeteorJS Meteor Methods call from server to server -

i understand meteor methods let client server call, what's best approach call function or method meteor method, i.e. server server call. right if regular js function call works if js file in lib folder. need in server folder. here code i have topics collection sits in collection folder , has following i have following collection meteor.methods({ topicpost: function(topicattributes) { var user = meteor.user(), topicwithsametitle = topics.findone({title: topicattributes.title}); // ensure user logged in if (!user) throw new meteor.error(401, "you need login add new topic"); meteor.call('checkuser'); } }); i have following method sits in server folder meteor.methods({ checkuser: function () { alert('aaaa'); } }); this works , it's not great solution. method handling have all of functions outside meteor.methods , , relay proper functions when neces

AngularJS + Go Revel web framework for SEO in Prerender.io -

i developed web site using angularjs , revel. found seo in single page application big problem. checked https://prerender.io/getting-started , can't found middleware revel installation. me how contribute revel? i stumbled on topic chance , enable prerender (self hosted on docker) on angular project running on node. i use nginx frontend proxy requests node app. prerender intergrates nginx , allow avoid integrating revel in case. this basic schema prerender nginx request ----> nginx if bot ?_request_fragment_ --> proxy prerender app (will generate prerendered html if not exist in cache ... if normal request ---> proxy revel (node, app ...)

authentication - equivalent to global "before_filter" in Yesod -

i have been attempting play yesod, , have run simple problem can not seem find solution to. say want have global function, runs on every request irrelevantly of route or handler (for example authentication function). want like uid <- requireauthid to run before every handler function , return control handler function when uid provided / if exists where slot in? 'yesod way' of doing before filters? one way modify yesod instance foundation type. assuming foundation type called app, can following force authorization before other handlers called. instance yesod app --the following lines somewhere within block. isauthorized (authr loginr) _ = return authorized -- don't want accidentally lose access login page! isauthorized _ _ = mauth <- maybeauth case mauth of _ -> return authorized nothing -> return $ unauthorized "you must login first." obviously, edit suit needs, should gi

c# - How can I display IEnumarable<XElement> type in GridView? -

i need retrieve data xml file display result set in gridview using linq . i have read xml file disk , fetched elements want, need display these results in table. should do? c# code : protected void page_load(object sender, eventargs e) { xelement xml = xelement.load(@"c:\veri.xml"); ienumerable<xelement> urunler = xml.elements("urun"); } my xml schema : <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:element maxoccurs="unbounded" ref="urun"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="urun"> <xs:complextype> <xs:sequence> <xs:element ref="urunid"

php - Dynamic Dependencies for larger library -

let's have library contains multiple parts, , b. in application require library use part only. defined thru config setting in application can read dynamically. now , b have different requirements other packages. how require dependencies if used? the obvious answer split library 2 libraries. library not split , require big effort of work , change workflow - don't want. think of eg. zend framework single library. the best way removing both , b "require" section , adding them "suggest" section instead (including short description): { ... "suggest": { "a/a": "to able use x (1.*)", "b/b": "to able use y (~1.3)" } } now, when user installs package, it'll message showing suggested packages: package/package suggests installing "a/a": able use x (1.*) package/package susgests installing "b/b": able use y (~1.3) the user installing package

python - ponyORM: trouble with query -

i have query dynamic conditions,i.e. select (lambda obj:obj.a = 'a' , obj.b = 'b' , ...) so write code this: def search(self,**kwargs): q = unicode('lambda obj:', 'utf-8') field,value in kwargs.iteritems(): value = unicode(value, 'utf-8') field = unicode(field, 'utf-8') q+=u" obj.%s == '%s' and" % (field,value q = q[0:q.rfind('and')] res = select(q.encode('utf-8'))[:] but have error during execution of function: tasks.search(title='Задача 1',url='test.com') res = select(q.encode('utf-8'))[:] file "<string>", line 2, in select file ".../local/lib/python2.7/site-packages/pony/utils.py", line 96, in cut_traceback return func(*args, **kwargs) file ".../local/lib/python2.7/site-packages/pony/orm/core.py", line 3844, in select if not isinstance(tree, ast.genexpr): thro

php - Issue in disabling function in CODEIGNITER -

this question exact duplicate of: issue in accessing supposedly disabled function in codeigniter 1 answer i realized significant problem in application. it's apply , hire functions. ideally, applicant can apply once job post.however, happens in program not this. after more tests, realized, applicant can send two, three, 4 , on should not case. correspondingly, client can hire or reject applicant more once (depending on number of proposals sent), what's more erroneous is, applicant has been hired, if client clicks reject button on proposals page, status changes "approved" rejected. i think should change in part: public function add_job_proposal_from_provider($obj) { if ($obj['proposal'] == null){ $data = array ( 'proposal' => $obj['proposal'], 'job_id' => $obj['job_id'],

MySQL Triggers - Year-Month(YYMM) Prefix + Auto Increment ID -

i saw post explaining use of triggers create prefixed ids how make mysql table primary key auto increment prefix http://sqlfiddle.com/#!2/0ed88/1 i new triggers , find out if there's way have prefix year-month (yymm) instead of preset 4 letters "lhpl" written in sqlfiddle? much appreciated! lots learn in mysql journey! create table table1_seq ( id int not null auto_increment primary key )| create table table1 ( id varchar(7) not null primary key default '0', name varchar(30) )| create trigger tg_table1_insert before insert on table1 each row begin insert table1_seq values (null); set new.id = concat('lhpl', lpad(last_insert_id(), 3, '0')); end | insert table1 (name) values ('jhon'), ('mark')| replace 'lhpl' with date_format(now(),'%y%m') the now() , date_format() functions documented here: reference: h

visual studio 2012 - I'm having trouble integrating VS2012 with Git -

i have secure git repository company , want integrate git vs2012. however, i'm not able clone repository team forge. when grab ssh key , enter when cloning, error saying don't have permission account , may not have entered correct credentials. however, never prompted credentials. there place add credentials in vs2012? i saw posts saying vs2012 doesn't support ssh tried using http key no luck generate public / private key pair: $ ssh-keygen -t rsa the public key in home directory. i.e. ~/.ssh/id_rsa.pub add public ssh key teamforge: $ clip < ~/.ssh/id_rsa.pub paste contents of public key settings > authorized keys. test connection: $ ssh -v user@server clone repository: also, make sure cloning ssh, not https. i.e. $ git clone ssh://user@server/project.git

sql - Nested Inner join query -

i have 4 tables called attr, data, extradata , syst. have multiple/nested inner joins attributes 4 tables, , running issues because of that. background, there column called 'id' in 'data' table obtaining inner join between data , extradata follows: select x.id data x inner join extradata xa on x.dataid = xa.dataid x.data = 'condition1' , not xa.additionaldata = 'condition2' this id has matched id in attr table, , 1 more inner join syst table. following abbreviated version of query that's i'm trying out: select top(10) a.id attr inner join data x on a.id = ( select x.id data x inner join extradata xa on x.dataid = xa.dataid x.data = 'condition1' , not xa.additionaldata = 'condition2' ) inner join syst s on a.sysid = s.sysid s.desc = 'condition3' there (obviously) wrong query, i'd grateful suggestions. in advance! assuming attr.id maps data.id , can join of tables , of condi

How to make custom form control in c# -

i trying in visual studio other day when realized, if make form control me allot easier, except have no idea how that, want form control have grids, each square having own color property, if knows how make form controls, or better knows how make described, happy :d this msdn article basic step step outline of how can write customer control. unfortunatly ms has not figured out how avoid link rot -- may need search creating custom winform controls find if come in future. you best servered subclassing existing control , customizing it. you might find of freely available winform control projects gold-mine of useful info if serious this. however, sounds should consider doing creating "user control", simpler composite of few existing controls. article on types of controls winforms may useful overview you. beyond should use s/o if trying resolve specific problem having when coding. google more appropriate tool finding tutorials, etc.

linux - Writting a simple filesystem in C using FUSE -

i've learned hello.c. can create hello file under mountfile. i've no idea how create folder under mountfile , create hello under mountfile/foldericreate. can use cat mountfile/foldericreate/hello code similar simple hello.c #define fuse_use_version 30 #include <fuse.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> static const char *hello_str = "hello world!\n"; static const char *add_path = "/add"; static const char *div_path = "/div"; static const char *hello_path = "/hello"; static int hello_getattr(const char *path, struct stat *stbuf) { int res = 0; printf("%s", path); memset(stbuf, 0, sizeof(struct stat)); if (strcmp(path, "/") == 0) { stbuf->st_mode = s_ifdir | 0755; stbuf->st_nlink = 2; } else if (strcmp(path, hello_path) == 0) { stbuf->st_mode = s_ifreg | 0444; stb

jquery - Set cookie to change Bootstrap Menu -

i have html website, developed using bootstrap. basically have landing page goes either white page, or black page. on white page, menu white, , on black page menu black. depending on page user visits, see either white menu, or black menu. i want set cookie remember page have selected go (white or black), , change navbar , logo (put in div id="black" or div id="white" ) this first time ever working cookies, have no idea how call cookie page, or how change div. this code far set cookie in white page: <script> $( document ).ready(function() { document.cookie="menu=white"; } </script> code set cookie in black page: <script> $( document ).ready(function() { document.cookie="menu=black"; } </script> when users go next page, how call value of cookie, , change relevant menu, depending on value of cookie? some guidance appreciated. edit : answer i found answer, praveen. on landing pages, set cookies ei

Testing Android In App Billing real purchases -

what conditions test real purchases, when have tested app using test product android.test.purchased ? there few steps need pass, remembering, of them need time update on google play servers. for example, let's use com.example.product our real product id. time shows in example change own. upload apk file you can't test real purchases in debug mode. need download app beta, google know it's ok make purchases in app. check if have billing permission in androidmanifest.xml : <uses-permission android:name="com.android.vending.billing" /> change android.test.purchased com.example.product , export *.apk file. must signed ! publish apk in beta, you can go next steps, you'd need time beta ready download. add new product you can't add new product until have published beta. you can't test subscriptions, products. can test subscriptions (they renewed every 24h) go products section in google play develop

ruby on rails - Capistrano Many Private Repo Github -

very strange behavior , cant understand problems. have 2 private repositories on github , deploy capistrano. first app normal deployed deploy.rb : require "rvm/capistrano" require 'bundler/capistrano' set :rvm_ruby_string, "2.1.0" set :assets_role, :app set :normalize_asset_timestamps, false set :application, "awesome_app_one" set :scm, :git set :repository, "git@github.com:myaccount/repo_one.git" set :branch, :master set :deploy_via, :remote_cache set :ssh_options, { forward_agent: true } set :user, "rails" set :deploy_to, "/home/rails/#{application}" set :shared_children, %w(public/system public/files public/uploads log tmp/pids tmp/sockets) set :use_sudo, false task :production role :web, "123.456.789.0" role :app, "123.456.789.0" role :db, "123.456.789.0", primary: true set :branch, :master set :deploy_to, "/home/rails/#{application}" set :rails_env

html - Table using divs - no y overflow for row -

i trying create table using divs. (i can't use table, tr & td tags) the problem is: my cells must next each other (i use float:left ) my row should never expand vertically, can grow on x-axis. so here html : <div id="table"> <div class="rowheader"> </div> <div class="row"> <div class="cell">bla</div> <div class="cell">bla</div> <div class="cell">bla</div> </div> <div class="row"> <div class="cell">bla2</div> <div class="cell">bla2</div> <div class="cell">bla2</div> </div> </div> and css : #table { display: table; width: 100%; } .row { width: 100%; overflow: hidden; display: table-row; } .cell { float: left; display: table-cell; margin: 1px; padding: 2px; width: 35%; backg

gcc - Installing gfortran 4.6 in Fedora 19 -

i beginner fedora. use gamess software programme requires gfortran 4.6. when "yum install gcc-gfortran", fedora 19 ships gfortran 4.8.ix probl can tell me in detail fix problem. gfortran 4.6 has been replaced newer version since fedora 18. can download prebuilt release. there if have 64 bit machine, , there if have 32 bit. simply unpack , copy directory in path .

excel - How can I wrap an If statement around this code? -

i given project work on , i'm bit stumped. have routine being driven shortcut macro move data column column f , begin build itemized list 1 works through column. what need, however, wrap current operation in if statement operation not move data new cell if data in g5 (or, rc) equal cell value in a4 (or, rc-1). if can logic down, can operation work intended. the macro created macro recorder, here code: sub inserttagline() selection.insert shift:=xldown activecell.offset(1, 0).range("a1").select selection.copy activecell.offset(-1, 4).range("a1").select activesheet.paste activecell.offset(0, 1).range("a1").select application.cutcopymode = false activecell.formular1c1 = "=""tag: ""&rc[-1]" activecell.select selection.copy selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false activecell.offset(0, -1).rang

multithreading - Time based thread synchronization in java -

wondering if there time based synchronization in java. example below synchronization locks object , waits until //my application processor finishes task. synchronize (myobject) { //my application processor. } with same, there way synchronize 1 min or 2 min. synchronize (only 1 min && object) { //my application processor } or there other way in java synchronization method. p.s: don't want run threadmanager monitor above. , don't want run while loop. maybe looking java.util.concurrent.scheduledthreadpoolexecutor provides various ways of scheduling task performed/repeated in thread @ specified time/times in future. maybe have method holds lock extended period of time (almost bad idea), , asking how abort operation , release lock if time limit reached. there couple of ways depending on takes time. but guesses. haven't told problem trying solve. your example of using "synchronized" timeout not make sense. purpose of &q

c++ - casting array to variable -

i need efficient way cast part of array variable. let's suppose array defined this: unsigned char bytes[240]; now, need uint32_t value somewhere in array, this: uint32_t * word = reinterpret_cast<uint32_t *>(bytes[4]); which think me second word in array right? question is, safe , portable (windows, linux on x86 & x86_64, os x nice, don't care arm, ia-64 etc). you should use memcpy . portably ensures there no alignment or strict aliasing problems. if no copy needed, compilers smart enough figure out , directly reference data in array: uint32_t value; memcpy(&value, &bytes[4], sizeof value); //modify value: //... //copy array: memcpy(&bytes[4], &value, sizeof value);

How would I implement a forth-style reverse-polish notation parser in boost spirit? -

i'm trying implement parser old forth-based grammar of functions take form of: "num" "num" "command" command string of kind. for example: 0 1 hsff 41 sensor on 1 12.0 bh 4 lnon as can see, grammar [mostly] reverse polish notation, string of arguments preceding command. grammar pseudo white-space dependent, in that: 0 1 hsff 41 sensor on is valid as: 0 1 hsff 41 sensor on (in other words '\n' treated space) extra whitespace skipped, so: 0 1 hsff 41 sensor on is 2 valid commands lot of unnecessary whitespace. all of seemed simple enough, started chugging away @ implementing grammar. of course, things never simple seem, , found parser fails on first character (in case int). so, boiling things down, tried implementing single rule: namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; qi::rule<iterator> cmd_targetsenspaircmd =

ruby on rails - Rspec spec returns a LoadError -

returned app after years absence , not get: rspec spec to run. ran year ago , thought had left @ point pick again when had time, not ... decided update ruby , rails , went updates, bundle install etc, have ruby 2.1.1p76 , rails 4.1.0 running. i ran same command shown above , flag got: /users/me/.rvm/gems/ruby-2.1.1@rails410/gems/pg-0.17.1/lib/pg.rb:4:in `require': dlopen(/users/me/.rvm/gems/ruby-2.1.1@rails410/extensions /x86_64-darwin-13/2.1.0/pg-0.17.1/pg_ext.bundle, 9): library not loaded: @executable_path/../lib/libssl.1.0.0.dylib (loaderror) referenced from: /applications/postgres.app/contents/macos/lib/libpq.dylib reason: image not found - /users/me/.rvm/gems/ ruby- 2.1.1@rails410/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/pg_ext.bundle i noticed have loaderror not sure need correct that. 2 lines down see 'reason: image not found' , here further away solution. hopefully has expertise , generosity give me pointer in right direction? i instal

reflection - Scala Method Mirror return Type is always Any -

i new scala. how solve problem method mirror returns any? class abc{ def getstring(): string = { return "a,b,c"; } } //somewhere in project val ru = scala.reflect.runtime.universe val mirror = ru.runtimemirror(getclass.getclassloader); val c = class.forname("abc"); val classsymbol = mirror.classsymbol(c); val classtype = classsymbol.totype; val im = mirror.reflect(c.newinstance()) val _method_ = classtype.declaration(ru.newtermname("getstring")).asmethod; val method = im.reflectmethod(_method_); println(method()); //this prints "a,b,c" println(method().length()); // error, value length not member of can proper function returns proper object instead of any? thank you! if method mirror cannot return proper object(like string), point of method mirror? there no way runtime reflection return objects proper static types because static types applicable @ compilation time (hence static types); in order enforce dynamical

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7? -

this question has answer here: how avoid arrayindexoutofboundsexception or indexoutofboundsexception? [duplicate] 2 answers exception in thread "main" java.lang.arrayindexoutofboundsexception: 7? public static void main(string[] args) { piece[][] board; board = new piece[7][7]; // black pawns!create , set on board pawn bp1 = new pawn("black", true, 0, 6); board[0][6] = bp1; pawn bp2 = new pawn("black", true, 1, 6); board[1][6] = bp2; pawn bp3 = new pawn("black", true, 2, 6); board[2][6] = bp3; pawn bp4 = new pawn("black", true, 3, 6); board[3][6] = bp4; pawn bp5 = new pawn("black", true, 4, 6); board[4][6] = bp5; pawn bp6 = new pawn("black", true, 5, 6); board[5][6] = bp6; pawn bp7 = new pawn("black", true, 6, 6);

LogCat in Eclipse Android Debugging Exclusion Tag -

how create exclusion tag in eclipse. want tags beginning media omitted logcat in eclipse. because program has lot of different tags beginning media want go away. can tell want see there seems no way tell not want see. this related how filter out tagname in eclipse logcat viewer . in general, want use java regular expressions filter out/select particular log lines. example: ^(?!(media)).*$

jquery - Updating a table image using AJAX -

i have run funny situation using ajax update databases. on table editable, can upload images. once modify table (new or edit), fields sent , table reloaded ajax. images uploaded folder , filename/path captured show on table. ok small images (size) larger image, table reloads faster image uploaded. end broken image on table requires full page reload. i wondering if there ajax solution try load image on screen (based on class name) until loads or time out after amount. thanks.

Installing MySQL in Docker fails with error message "Can't connect to local MySQL server through socket" -

i'm trying install mysql inside docker container,tried various images github, seems manage install mysql when try run mysql gives error: error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' system specifications: ubuntu 12,04 on aws docker 0.10.0 packages tried far: https://github.com/eugeneware/docker-wordpress-nginx https://github.com/tutumcloud/tutum-docker-mysql remember need connect running docker container. want use tcp instead of unix socket. check output of docker ps command , running mysql containers. if find 1 use mysql command this: mysql -h 127.0.0.1 -p <mysql_port> (you find port in docker ps output). if can't find running mysql container in docker ps output try docker images find mysql image name , try run it: docker run -d -p 3306:3306 tutum/mysql "tutum/mysql" image name found in docker images .

performance - JavaScript Does memory leak happens every time function is called -

currently attending javascript training trainer told every function write constructor , every time call new object created. consider following code, function test(){ console.log("test"); } test(); test(); so every time call test function, create new object every time? update according him following code not result in memory leak function test(name){ this.name = name; } var 1 = new test("nicholas"); and following code allocate object , result in memory leak function createtest(name){ var t = new object(); t.name = name; return t; } var 2 = createtest("nicholas"); every function write constructor no not true. every time call new object created. if calling constructor using new yes new object craeted. otherwise not true. and yes there no memory leak happens when create object or when call function.

c++ - Counting number of even lines from file -

#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream plik; plik.open("napisy.txt"); int nr_line=0; string line; int ile_parzystych=0; cout << "podpunkt a)=:"<< endl; if(plik.good()==false){ cout << "wrong read of file!"<<endl; } while(getline(plik,line)) { if( line.length() / 2 == 0) { ile_parzystych++; if(nr_line==1) {cout << "to jest pierrwsza linia - jest ona nieparzysta więc licznik = " << ile_parzystych << endl;} if(nr_line==2) {cout << "to jest druga linia - jest ona parzysta więc licznik = " << ile_parzystych << endl;} } } plik.close(); cout << endl << ile_parzystych << " <- tyle jest linii parzystych"; } problem

Apache downloading php files instead of executing them -

i trying install phpmyadmin in ubuntu server , when try access via browser it, php file downloads instead of displaying web page. placed phpinfo testfile in /var/www , working fine. i have commented lines in php5.conf file: <filesmatch ".+\.ph(p[345]?|t|tml)$"> sethandler application/x-httpd-php </filesmatch> <filesmatch ".+\.phps$"> sethandler application/x-httpd-php-source # deny access raw php sources default # re-enable it's recommended enable access files # in specific virtual host or directory order deny,allow deny </filesmatch> # deny access files without filename (e.g. '.php') <filesmatch "^\.ph(p[345]?|t|tml|ps)$"> order deny,allow deny </filesmatch> # running php scripts in user directories disabled default # # re-enable php in user directories comment following lines # (from <ifmodule ...> </ifmodule>.) not set on # prevents .htaccess files disabling

shell - VBA code to open two files using an application -

i'm relatively new @ vba, , developing excel based tool creates 2 .xls files, paths saved in 2 variables. next step user has select these 2 files, right click , select application called compare . i wondering if process automated using shell commands in vba. please advise. yes, possible. assuming compare takes 2 files arguments, this: public function opencompare(strfileone string, strfiletwo string) dim x variant x = shell("compare.exe " & strfileone & " " & strfiletwo, vbnormalfocus) end function

maven - How to create multiple WAR files from single pom.xml? -

i having single build.xml, creating multiple war files project. doing migration ant build maven build. how create multiple war files single pom.xml? i suggest build multi module maven project, each war output of single module. @ mini guide multiple modules , multimodule reference more details. i hope helps.

php - CakePHP : Updating all tables after user edit? -

i working on cakephp website, of of works trying update users page (which redirect now, once have working planing on making ajax update). code work, if ($this->request->is('post')) { $this->loadmodel('setting'); $this->loadmodel('address'); if ( $this->user->save($this->request->data, $validate = true, $fieldlist = array('firstname','surname','homephone','mobilephone','dob','gender')) ) { $newuserid = $this->auth->user('id'); $this->session->write('auth', $this->user->read(null,$newuserid)); $this->session->setflash('update done :)', 'goodflashmsg', array(), 'good'); $this->redirect('/user'); } else { $this->session->setflash('sorry :( there has been error, please try again', 'badflashmsg',

php - Best practice to separate Backend / Frontend with single Laravel4 installation? -

i hear tips got real experience folder structure worked with. coming codeigniter , i'm trying figure out best way create backend (cms) , frontend (frontpage) ? here couple app structures want critics on, considering actual version of laravel 4.1.28 . structure 1 webapp backend app/ bower_components/ local_components/ node_modules/ public/ vendor/ artisan.php composer.json composer.lock contributing.md gruntfile.js package.json phpunit.xml readme.md server.php frontend app/ bower_components/ local_components/ node_modules/ public/ vendor/ artisan.php composer.json composer.lock contributing.md gruntfile.js package.json phpunit.xml readme.md server.php structure 2 webapp app/ bootstrap/ commands/

javascript - Load more WordPress posts on (infinite) scroll with AJAX -

i'm loading more posts via ajax when user clicks on 'load more' button. code i'm using based on tutorial: http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/ my aim modify code more posts loaded when user scrolls bottom of page. i've tried replacing $('#pbd-alp-load-posts a').click(function() { }); with this: $(window).scroll(function(){ if ($(window).scrolltop() == $(document).height() - $(window).height()){ } }); when doing that, new posts loaded when user scrolls bottom of browser window second time, next set of posts not loaded page. using button click approach, new 'load more' button added page next set of posts loaded if user clicks again. how can scroll approach load next set of posts when user scrolls bottom of page again? in test, instead of using exact equality : if ($(window).scrolltop() == $(document).height() - $(window).height()) { ... } try using threshold, e.g. :

Use StrongLoop to monitor NodeJS application in Linux via proxy -

i trying monitor strongloop test application , following error: [root sls-sample-app]# slc strongops generating strongops configuration requires registered email , password. visit http://strongloop.com/register if have not already. please enter your: email address: xxx please enter your: password: xxx error: { [error: connect etimedout] code: 'etimedout', errno: 'etimedout', syscall: 'connect' } i have registered on strongloop website , provided registration details in above run attempt. rhel 6.3 machine connected internet via proxy. how can proxy configured? thank you slc strongops doesn't have proxy support yet, it's being worked on. in meantime workaround find api key yoru account profile when logged dashboard , create strongloop.json manually info shown here. http://docs.strongloop.com/display/doc/setting+up+strongops+monitoring#settingupstrongopsmonitoring-configuringyourapikey

html5 - Defining how 2 separate, overlapping canvases blend -

Image
i want put canvas on top of , define way contents blended. i have 1 white canvas black characters on it, , want highlight part of transparent blue rectangle, without having black characters in background turning dark blue. in fact, i need aspect i'd if merged 2 canvases globalcompositeoperation set "multiply" instead of default, while keeping both canvases separated , overlapping. here's have : here's want : i aware globalcompositeoperation allow me if merged 2 canvases one. i'd rather keep both canvases : background canvas displayed lib. can still draw in it, complicate things lot: i'd dependent on logic , have tweak mine , theirs make work, performance critical , solution imply more drawing @ 24fps, i'd struggle every time lib updated... all in seems way better keep away interfering lib. there way choose how overlapping canvases behave? thanks in advance! edit: we've thought of transforming white parts of background can

CSS: Vertical align content of an element -

i need vertical align span, thing makes complicated span needs occupy whole parent. jsfiddle so, html is <div> <span>ok</span> </div> css: div { width: 200px; height: 200px; background-color: lightgrey; } span { display: block; width: 100%; height: 100%; vertical-align: middle; } is possible without changing html ? update: although below answers correct , interesting, chose 1 used correct one! tell behave table: div { width: 200px; height: 200px; background-color: lightgrey; display: table; } span { display: table-cell; text-align: center; vertical-align: middle; } http://jsfiddle.net/9uae6/2/

debugging - Why does Evan's Debugger say that I'm moving to eax instead of rax? -

i'm moving values rax debugger displaying it's moving eax. what's matter it? debugger, nasm or knowledge? anyway of course code working perfectly. debugger i'm using evan's debugger. in nutshell, both , debugger correct. when move rax , affects rax , eax , ax , al , ah refer various subsets of same 64 bits: al lower 8 bits of ax ( ah upper 8 bits). ax lower 16 bits of eax . eax lower 32 bits of rax .

c# - XamlParseException when using converter -

i getting xamlparseexception when try use converter. suspect made mistake in converter can't catch it. full error text: a first chance exception of type 'system.windows.markup.xamlparseexception' occurred in system.windows.ni.dll additional information: cannot create instance of type 'app.converters.dimensiontotext' [line: 21 position: 42] namespace app.converters { class dimensiontotext : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { dimensions dim = (dimensions) value; //bool param = (bool) parameter; return dim.width.tostring().trim() + "\"x " + dim.length.tostring().trim() + "\"x " + dim.height.tostring().trim() + "\""; } public object convertback(object value, type targettype, object parameter, cultureinfo culture)