Posts

Gulp Task for Django runserver -

I am trying to create an action to start my Django backend. I took a lot of time to solve them Search correctly to activate virtual environment stdout Get the manage.py runerver for output I've put together a solution to search for hours. I hope this will save a lot of time and frustration Below are fiction works, coffeescript Written in, the Django backend will begin: exec = requires ('child_process'). Exec gulp.task 'service: backend', - & gt; Proc = exec 'Source Bin / Active; PYTHONUNBUFFERED = 1 ./manage.py driver 'proc.stderr.on' data ', (data) - & gt; Process.stdout.write data proc.stdout.on 'data', (data) - & gt; Process.stdout.write data You can run the job with Bulk Service: Backend Note: You will not need to install any node package, built in child_process. Use the parameter instead of span to be able to run multiple commands in one call Not only stdout but stderr handle as well or you ...

javascript - Node.js Connection mongodb using mongoclient -

In the node JS I just wanted to write some external method that gets the data from the mongode and returns it back to In this I used the MongoClient.js module to interact with the mongodb . But the problem is that when the external method is called, this database returns the value before completing the connection method execution. Here I have to hold my Return Statement only till the mongodb.connect method was completed. What to do? Here my code is, service.js var employee = requirement ('./ model / employeeService.js'); Var json = employee .getUser (employee ID); Employee service works as a model, which interacts with the database and returns the data to service.js where our web services are written and this user responds to. employeeService .js export.getUser = function (employee ID) {var json = []; MongoClient.connect (db.getdbUrl), function (mistake, db) {if (err) {json = err;} else {document = (employeeId)? {_ Id: employeeId}: {}; Db.collection (...

stack memory layout in C -

I try to understand the stack memory layout in C by compiling the following code and inspecting the address in GDB. I only record at least important points, the higher one is equal to the output print \ u & amp; A is generated using a Here is a simple test code: zero test (int a, int b) {int c = a ; Int d = b; Printf ("% d,% d \ n", c, d); } Int main () {int x = 1; Int y = 2; Test (x, y); Return 0; } I have the following results, and B: 6808 and A: 6812 & Amp; Amp; C: 6824 & amp; D: 6828 $ rbp: 6832 (frame indicator). I am confused with regard to local variables, the parameters should not work sitting on the high memory address, can anyone explain this in detail? Thank you. Edit: If I print the memory like this: printf ("& amp; a:% p, & amp; b:% p \ n ", (& Amp; amp; nbsp;), (and b)); Printf ("& amp; c:% p, & d:% p \ n", (& amp; c), (& amp; D)); I found & amp; A: 0x7fff4737687c, ...

c++ - Recursive solution for detecting negatives? -

I am writing a program that detects the number of negatives in a stack. The first snippet of code below gets the goal (I think) lightly. I am just trying to achieve the same goal. The second is the snippet I have done so far .. but I am unable to work it successfully. int negcount = 0; While (mystack.size ()> 0) {if (mystack.top () & lt; 0) {negcount ++; } Mystack.pop (); } It is that I tried to make the function recursive. Of course there is something wrong with the loop method but I am not sure whether .. size_t r_approach (stack my_stack) {int cnt = 0; While (mystack.size ()> 0) {if (mystack.top ()> = 0) {cout & lt; & Lt; "Nothing" & lt; & Lt; Endl; Mystack.pop (); } Else {cnt ++; Mystack.pop (); R_approach (mystack); }} Cout & lt; & Lt; CNT & LT; & Lt; Endl; } If your solution pretends to be recurring, while loop? You should not be repeated using the recursive: size_t r_approach (stack & lt; int &...

ruby on rails 4 - How to pass arguments to mina deploy tool -

We're using to deploy our Rails4 app after switching from Capistrano, we can do the cap cap production deploy: invoke task = "namespace: taskname" Where to start the work was a custom deployment task that used to argue to execute a specific rake function on a given environment. How to pass the argument to Mina to run the specified rack work? So far I have noticed that the nearest Meena = deployed for the harassment in Mina is. I am looking for the name of the name of the Mena names: The action name is which will have a CD in the current directory / current directory and a bundle app rake name space: function name . It seems quite simple, what am I missing? Edit as suggested by Guy Teube in /config/deploy.rb now set: work, env [' TASK '] Set: On, "# {deploy_to} / On" desc "Invites a Rocket" Work: Inococo => : Environmental queue "CD # {current} & amp; amp; amp; amp; amp; amp; bundle # [task}" end is runni...

javascript - play/pause gif with mouse event -

I have an image format GIF in my web page. I want to go with the mouse to play the animation on any image. And as long as the mouse is still there, it stays on the last frame and when the mouse comes back in the original image. Can anyone help? Something like this: HTML & Lt; Div id = "picture" & gt; & Lt; Div class = "img img1" & gt; & Lt; Img data-gif_src = "http://38.media.tumblr.com/tumblr_mdnaeqwmTr1rtuulro1_250.gif" src = "http://i.dailymail.co.uk/i/pix/2011/12/25/article-2078552 -0F44CB3D00000578-206_468x331.jpg "/> & Lt; / Div & gt; & Lt; / Div & gt; CSS #images .img {width: 200px; Height: 150px; } #images .img img {width: 200px; Height: auto; } JS $ ('# images .img img'). Mousecenter (function () {$ (this) .data ('img_src' $ (this) .attr ('src')); $ (this) .attr ('src', $ (this) .data ('gif_src' ));}) MouseLove (function () {$ (th...

python 2.7 - Extend every single string in a list with punctuation -

I have a long list like: ['this', 'hello' 'Good', ...] Now I want a new list that looks: ['this',' this. ',' Hello, 'hello', 'hello', 'hello', 'hello!', 'Hello:', 'good', 'this', 'this', 'it:', 'hello', 'hello' Good ', ...] So I want to add a punctuation mark to each word. Is this also possible? This would be an easy way: Nihilist = [] old list For items in: newlist.append (item) newlist.append (item + '.') Newlist.append (item + ',') newlist.append (item + '?') Newlist.append (item + '!' 'Newlist.append (item +': ') slightly shorter: adds nilist = [] = [' ',', ', To be added to the list: newlist.append (item + plus) or as an understanding of the list: '.', '!', ':' adds = ['', ',', '.', '?', '!...