Start Date - End Date OF Previous (Day, Week, Month and Year)

Here you can find out how to search the start date and end date of the different period in python.

The required modules of python to work with datetime are as below :

import datetime
form datetime import timedelta, date
import time 
from pytz import timezone
import pytz


Fetching Dates:

#Day:

st_date = datetime.datetime.now(pytz.timezone(str(tz))).date() - datetime.timedelta(days=1)
ed_date = datetime.datetime.now(pytz.timezone(str(tz))).date() - datetime.timedelta(days=1)

#week

year_pre_week_detail = str(datetime.datetime.now(pytz.timezone(str(tz))).date().strftime("%Y")) + '-                          W' + str(int(datetime.datetime.now(pytz.timezone(str(tz))).date().strftime("%W")) - 2)

st_date = datetime.datetime.strptime(year_pre_week_detail + '-0', "%Y-W%W-%w").strftime('%Y-%m-%d')

ed_date = (datetime.datetime.strptime(str(st_date), "%Y-%m-%d") +  
                  datetime.timedelta(days=6)).strftime('%Y-%m-%d')

#Month 

ed_date = date.today().replace(day=1) - timedelta(days=1)
st_date = ed_date.replace(day=1)
         
#Year
 
st_date = date(date.today().year, 1, 1)
ed_date = date(date.today().year, 12, 31)

Python Date and Time

This is what we can do with the datetime and time modules 

in Python.


# import modules for the time and datetime

import time
import datetime


# working with the date and time 

print "Time in seconds since the epoch: %s" %time.time()
print "Current date and time: " , datetime.datetime.now()
print "Or like this: " ,datetime.datetime.now().strftime("%y-%m-%d-%H-%M")
print "Current year: ", datetime.date.today().strftime("%Y")
print "Month of year: ", datetime.date.today().strftime("%B")
print "Week number of the year: ", datetime.date.today().strftime("%W")
print "Weekday of the week: ", datetime.date.today().strftime("%w")
print "Day of year: ", datetime.date.today().strftime("%j")
print "Day of the month : ", datetime.date.today().strftime("%d")
print "Day of week: ", datetime.date.today().strftime("%A")


# That will print out something like this:

Time in seconds since the epoch: 1349271346.46
Current date and time: 2012-10-03 15:35:46.461491
Or like this: 12-10-03-15-35
Current year: 2012
Month of year: October
Week number of the year: 40
Weekday of the week: 3
Day of year: 277
Day of the month : 03
Day of week: Wednesday

Net Neutrality : Internet Freedom

The issue of net neutrality is one of the most talked about issues in India at present.
Should you be worried? Most certainly, because it takes away your freedom of communicating freely and promotes inequality by granting total control to Internet Service Providers (ISPs) on which sites and apps get priority. Above all, it is important to know the whole concept of net neutrality before jumping into the fight against those violating the rights of so-called netizens.


What is Net Neutrality?


Net Neutrality is the Internet’s guiding principle: It preserves our right to communicate freely online. This is the definition of an open Internet.
Net neutrality is the means for every internet user to freely access any content or application without restrictions. Once you pay for the data through your respective ISP, you have the freedom to access anything on the internet and at the same speed. This means, you are allowed to decide on how to spend your allotted data, whether by watching a YouTube video, sharing WhatsApp messages or even connecting with friends on social networking sites like Facebook and Twitter.  Internet service providers should provide us with open networks — and should not block or discriminate against any applications or content that ride over those networks. Just as your phone company shouldn't decide who you can call and what you say on that call, your ISP shouldn't be concerned with the content you view or post online.
It’s important for access to knowledge, services and free speech, as well as freedom and ease of doing business online, for this access to be neutral:
– All sites must be equally accessible
- The same access speed at the telco/ISP level for each (independent of telco selection)– The same data cost for access to each site (per KB/MB).


What will happen if there is no net neutrality?


If there is no net neutrality, ISPs will have the power (and inclination) to shape internet traffic so that they can derive extra benefit from it.
Assuming TRAI (Telecom Regulatory Authority of India) succeeds in its attempt to diminish net neutrality, you will be forced to abide by the rules set by your ISP. For instance, you pay ₹249 for 1GB of 3G data on Any Network for a period of 30 days; net neutrality gives you the freedom to use your data any way you want, but if there is no net neutrality, Your network will control your bandwidth treating all websites and apps with different speed. To give you a better perspective, your ISP can charge you extra for WhatsApp, Skype and other VoIP apps and other sites and apps. This tactic will be applied for websites and apps as well.
Without net neutrality, the internet as we know it will not exist. Instead of free access, there could be "package plans" for consumers. For example, if you pay Rs 500, you will only be able to access websites based in India. To access international websites, you may have to pay a more. Or maybe there can be different connection speed for different type of content, depending on how much you are paying for the service and what "add-on package" you have bought.
Should you join the fight?
Definitely, because TRAI's deadline for submissions of any complaints against its "Regulatory Framework for Over-the-top (OTT) services" or simply put end of net neutrality ends on 24 April. If TRAI doesn't receive enough complaints, it will pass the plan and India will see the first sign of Dark Age.
What you do to help?
If you are a frequent internet user or you use internet from time to time, if u wish that this is not acceptable then vote

Sample of java program



Sample of java program to print " Hello Java" on screen with short

 description to easy understand the java program.


Sample Program


public class Hello
{
public static void main ( String args[] )
{
System.out.println("Hello Java");
}
}


     class name and file name are same.

     public is a access specifier this define the scope of the method or class.

     static means that method is associated with the class, not a specific instance(object)
     of  that class.

    void specify the return type of the method.

    array args[] is a String array use to get value from command line argument.

    In System.out.println()
            - System is a in-built class which is present in "java.lang" package.
    - out is a static final field (ie, variable) in System class which is of the type
               PrintStream ( a built-in class, contains methods to print the different data values ).
    - println() is a method use to print any message in nee line. we also use print()
               method is to print message is current line.

    how to compile ?
    javac programName.java;
    ex:-  javac Hello.java;

    how to Run ?
            java MainClassName;
    MainClassName means class which contain main method.
    ex:- java Hello

    O/P :-

































Basic Commands for Unix

 Hello friends, Here I am going to explain you all the basic command for the Unix. So you can handle system or access the data through the terminal.

       Commands :


>>Basic Commands


1)  cal : 

The cal command is used to to display the calender.
For example to check calendar you need to type cal command as follows:

               

2) passwd

The passwd command is used to change the password of the unix system. Every unix system will require a password for the security.





3) whoami, who, user

The who am i  command is used to know the name of the user by which you are currently logged in.
The who command is used to know the name of the user who are online on connected system.
The user will display the name of the users.



                                >> File Management Commands<<

4) ls command

The ls command is used to list the directories and files of the current running directory with the 
-l option.
As shown below example d stands for the directory and - is for the executable file like text file, image or any other format.




5) cat

The cat command is used to read the file. We can also create the file with the cat command by using >  sign with it. as seen below example :




6) wc (word count) command

The wc command is used to count the number of characters, words and lines of any file.
In wc  command -c for character, -w for word count and -l for line count

Syntax  $wc <filename>





7) cp command

To make a copy of a file use the cp command. The basic syntax of the command is:

Syntax :
                  $ cp source_file destination_file





8) mv Command 

The mv command is used to rename the filename

Syntax :
                 $ mv old_file new_file




9) rm Command 

The rm command is used to remove the particular file.
It is recommended to use -i option along with rm command.

Syntax :
               rm <filename>




Step to set the the path of JDK (Java Development Kit)

Step 1.  Download JDK ( Depend on your windows version compatibility ).

Step 2.  Install JDK.

Step 3.  Set the System variable path (eg. Win8).

          Open MyComputer properties.


  Click on "Advance System setting".


Click on "Environment variable..".


Drop-down list of "System variable" select the variable "Path".  
          Click on edit button.

 
Set the cursor on last position in variable value.
          Then write semicolon(;) then write the path of bin folder of JDK.


Basic of Java

Introduction

        Java is an object oriented programming language and a platform developed by the  James GoslingMike Sheridan, and Patrick Naughton initiated the Java language project. The small team of sun engineers called Green Team. in June 1991.
It is a fully platform independent language  

Platform Independent  Any hardware or software environment in which a program runs, known as a platform. Since Java has its own Runtime Environment (JRE) and API, it is called platform
                    Thus the system which have a support to the java platform can run the java program their is no any changes is required in the program. Their is only the java class files are used which are a intermediate code generated by the compiler.
                      In java the Intermediate code is generated by the Compiler are used by the Java Virtual Machine (JVM)  and it  converts its into the machine code to execute the program.