Saturday, September 3, 2016

MYSQL- query for last one month count,last 60days,Feb month report generation








select SUM(CASE WHEN (DATE_FORMAT(order_date,'%m-%d-%y') > DATE_FORMAT(CURRENT_DATE - INTERVAL 30 DAY,'%m-%d-%y')) THEN 1 ELSE 0 END) AS ord,age from order1 group by age ;



select SUM(CASE WHEN (DATE_FORMAT(order_date,'%m-%d-%y') > DATE_FORMAT(CURRENT_DATE - INTERVAL 60 DAY,'%m-%d-%y')) THEN 1 ELSE 0 END) AS ord_from_60_days,SUM(CASE WHEN (DATE_FORMAT(order_date,'%m-%d-%y') > DATE_FORMAT(CURRENT_DATE - INTERVAL 30 DAY,'%m-%d-%y')) THEN 1 ELSE 0 END) AS ord_from_1month,age from order1 group by age ;


+------------------+-----------------+------+
| ord_from_60_days | ord_from_1month | age |
+------------------+-----------------+------+
| 7 | 4 | 23 |
| 0 | 0 | 25 |
+------------------+-----------------+------+
2 rows in set (0.00 sec)

Saturday, July 23, 2016

hackerrank

Are you want to program some algorithms or some basic CS concepts ? I would say you can go and try it in https://www.hackerrank.com

Sunday, July 10, 2016

Dynamic Programming | Set 10 ( 0-1 Knapsack Problem) | GeeksforGeeks


Its very interesting to watch GeeksofGeeks videos, if you are interested to learn algorithms and some cool solution for problems.

Saturday, July 9, 2016

Rust applicatons

Are searching some of the applications written in Rust? below you have some of the interesting applications.

1. http://www.redox-os.org/  - operating system written in Rust
2. http://zinc.rs/ - Zinc is an experimental attempt to write an ARM stack that would be similar to CMSIS or mbed in capabilities
3. http://maidsafe.net/ - Maidsafe, a company that tries to create an encrypted, completely decentralized "successor" to the internet
4.https://github.com/servo/servo - Servo, the new browser engine being developed by Mozilla 
5. Iron is a high level web framework built in and for Rust, built on hyper.
ironframework.io/doc/iron/

6. wtftw, a tiling window manager - https://kintaro.github.io/rust/window-manager-in-rust-01/

Thursday, June 30, 2016

debug a python program

How to debug a python program:

It is important to get know the debugging method ,if we really started to learn a new programming  language:

In Python programming language we have a tool similar to gdb which is pdb.

You can start debugging as below :

 python -pdb -m selectsort.py





more details on pdb - https://docs.python.org/2/library/pdb.html

http://infohost.nmt.edu/tcc/help/pubs/python22/pdb-commands.html

 
s(tep)
Execute the current line, stop at the first possible occasion (either in a function that is called or on the next line in the current function).
n(ext)
Continue execution until the next line in the current function is reached or it returns. (The difference between next and step is that step stops inside a called function, while next executes called functions at (nearly) full speed, only stopping at the next line in the current function.)
unt(il)
Continue execution until the line with the line number greater than the current one is reached or when returning from current frame.
New in version 2.6.
r(eturn)
Continue execution until the current function returns.
c(ont(inue))
Continue execution, only stop when a breakpoint is encountered.
j(ump) lineno
Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don’t want to run.
It should be noted that not all jumps are allowed — for instance it is not possible to jump into the middle of a for loop or out of a finally clause.
l(ist) [first[, last]]
List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With one argument, list 11 lines around at that line. With two arguments, list the given range; if the second argument is less than the first, it is interpreted as a count.
a(rgs)
Print the argument list of the current function.
p expression
Evaluate the expression in the current context and print its value.


Friday, June 24, 2016

Rust pointer implementaiton

https://aml3.github.io/RustTutorial/html/02.html#Starting_to_Corrode:%3Cbr%3EPointers,_Memory,_Strings,_and_I/O

I am really scared of pointers in C programming itself.. Rust have more features than C for pointers .. :-)


But this really good read the above link on Rust memory management. I believe that there are lot of values for learning these new features .

Rust vs C program speed

I was just going through some of the Rust programs and tutorials...

This is one of the site which benchmark programing language speed. Rust programming language doesn't compromise the speed

http://benchmarksgame.alioth.debian.org/u64q/rust.html

http://benchmarksgame.alioth.debian.org/why-measure-toy-benchmark-programs.html


If you are really looking for some Rust applications , here you can browse.

http://pcwalton.github.io/blog/2013/05/20/safe-manual-memory-management/


This is one good link for those who want to start with Rust - https://aml3.github.io/RustTutorial/