Friday, 18 November 2016

Java Programming source code for implementing a TIMER..

So guys, as always another source code for JAVA. This one is meant for implementing a timer which could be utilized to basically determine the point in a running program when an action is to be implemented.

This is coded in Netbeans IDE so the codes might look a little complicated. I this helps someone.

SOURCE CODE



package Timing_app;

import java.util.Timer;
import java.util.TimerTask;

/**
 *
 * @author DAVID ORJI
 *
 *For those that do not know the slash
 * and asterisks used in this are
 *multiline comments and have no effects
 *in the program...
 */

/*
    Additional notes
    This is done with the netbeans IDE, so basically you just need to create
    a class and create a JFrame within the class with two JLabels namely:
   
    1. seconds
    2. minutes
*/
public class Timer_app extends javax.swing.JFrame {

 

    int secondsPassed;
    int minutesPassed;
   
       Timer timer  = new Timer();
        TimerTask task = new TimerTask(){
            @Override
            public void run(){
                secondsPassed++;
                seconds.setText(secondsPassed + " seconds passed:");
               
                if(secondsPassed % 60 == 0){
                    minutesPassed++;
                    if(minutesPassed == 1){
                         minutes.setText(minutesPassed + " minute passed ");
                       }
                    else{
                    minutes.setText(minutesPassed + " minutes passed ");
                    }
                       
                }
         }
       
        };
         
 
    public Timer_app() {
        initComponents();
        timer.scheduleAtFixedRate(task, 1000, 1000);
        setVisible(true);
       
        /*The above code specifies ; the Timertask to process,
        delay time/immediacy before the process begins ,
        and the difference in time between each increments*/
       
        //1000 of course equals 1 second.
                      }

     // The following below are Netbeans GUI generated code so pls ignore all in red
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        seconds = new javax.swing.JLabel();
        minutes = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(seconds, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minutes, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(100, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(seconds, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(minutes, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                      


    public static void main(String args[]) {


            Timer_app run = new Timer_app();
           
    }

    // Variables declaration - do not modify                    
    private javax.swing.JLabel minutes;
    private javax.swing.JLabel seconds;
    // End of variables declaration                  
}

Techniques used by the hacking community to steal information....

This next is a sub-category of the one above and in it is an enumeration of the some of the popular methods used by hackers gain unauthorized access to information and also carry out unscrupulous activities on the internet.


  1. Phishing also known as spoofing.
  2. Identity theft.
  3. Pharming.
  4. Using key logger applications.
Spam also known as unsolicited e-mails.

So i will discuss the first one and hopefully in the subsequent posts i might discuss the rest.

Phishing as the name implies is basically fishing but in this case on the Internet which is definitely a prodigious ocean for fishes. So phishing simply entails the use of a bait to source for confidential information, which i must say quite a number of unsuspecting people still fall victim to.

Here is one exemplary  instance for a clearer picture of what it is, so you receive an email probably with an attachment stating that there had been an error somewhere along the line with a transaction involving your bank account, now believe me this  email  most cases will look very convincing and credible and it is most likely that you might be contacted beforehand(as in by telephone), in the email attachment is contained a link link to a website, if this link is clicked you are directed to a website that looks very much like that of the banking service which you are subscribed to, it's even more convincing especially if you have never visited your banks website, on the website might be contained form boxes which would request that you enter information that might be related to your credit card or otherwise on the pretext that it will be used for your identification. As soon you have done that and submit the form, well you have supplied the managers of the website information which they could sell or even utilize to shop on the net, or worse the attachment on the email might contain any kind of file which when opened automatically infects the the device with a spyware which would steal sensitive information thereafter, well either way your computer becomes a tool for manipulation, so beware of the kind of mails  you would open and the kind of info you are sharing. Stay Safe.

SECURING A HOME WIRELESS NETWORK FROM POTENTIAL HACKERS


Hi guys,
This new post embodies four different categories, beneficial to anyone out there who uses the internet and they are as follows;

SECURITY MEASURES TO BE IMPLEMENTED ON A WIRELESS NETWORK TO ENSURE A SAFE AND RELATIVELY SECURED NETWORK.

Since wireless signals can be accessed by anyone within range, including your next-door neighbor, the ramifications of unsecured home networks are great. By usurping your Internet signal, the speed by which you can connect is decreased  as the signal is shared with other computers (or mobile devices). The use of your signal can also open a pathway for hackers using programs that can gain personal information from your computer or insert malware onto your system. You can ensure your home network is protected in several ways.


Changing  the Username and Password

 Since most router manufacturers want to make it as easy as possible for the home user to set up a wireless network, default passwords are available on the manufacturer’s web site as well as many places on the Internet. Check in any documentation that came with your router or download the documentation from the web site. To access your wireless router, follow these steps: 1. Determine the default username and password for your model router. 2. Type 192.168.1.1 into the address bar of any web browser. 3. Enter the default username and password to open your router’s interface. 4. Find the administrative section that displays the username and password. The image you see will be different, depending on the router brand you are using. 5. Change both the username and the password, according to the instructions on your router. Ensure your password contains symbols, uppercase and lowercase letters, and numbers. The best ones contain at least 8 characters, and 13 is even better. Also, consider changing the password every 60 to 90 days to be more secure. 6. Save the changes.

Changing the Network Name 

Changing your SSID helps in several ways. First, it makes it easy when connecting new devices to an available wireless network. Some families have one network for the parents
and another for cell phone or laptop connection. Even if outside scanners find your network, they cannot join without the appropriate password. To change the name, open the router administrative window as described earlier and find the location of your wireless name, as shown here.

Applying Media Access Control Filters

 Most wireless routers provide a way with which you can add, or whitelist, the devices that connect to your wireless network. Consider listing the media access control (MAC) addresses of the most commonly connected devices, such as smart phones. Each device has its own address, and you can list those addresses in your router’s MAC filter.

 Enabling Strong Encryption

Ensure that your router is set to Wi-Fi Protected Access 2 (WPA2) rather than the older WEP setting.

Other Options 

You have a couple other options, discussed here: Ensure that your router has the latest updates. Go to your manufacturer’s web site and download the latest firmware. • Use “anti Wi-Fi” paint on one of the walls. However, since this special paint has chemicals that absorb radio signals, do not paint this type of paint in the entire room.

Tuesday, 15 November 2016

Recommendation for newbie programmers.

Lovely people, just in case anyone's wondering what kind of comments they could post.. well, any kind is permissible; complains, questions, encouragement, support, commendation, criticism......just about anything but i would appreciate commendations and questions....as this would assist me decide what to post and more importantly i would be helping all the inquisitive minds out there....thanks....

So guys yap, another sweet post ......
Programming,, what is programming ? Basically it is communication with your computer, simple.
I know there are a lot of people out there that have developed an interest for programming but not sure how to start, well, I understand  and believe me i felt the same way when i started so here is a list of programming languages u might want to consider.

* JAVA my special programming language
* JavaScript
* Swift
* Perl
* CSS, HTML, PHP...Web programmming.
* Python.....

So the list above might not be seeming so helpful now, but relax.
I would recommend python for the newbie programmer , why? well first of all it is less detailed, not simple but less detailed which is what a newbie programmer should look out for..
Secondly it doesn't take much to set up....all u have to do is download IDLE that's all and you are set to program with python..
I know, you might not understand until you implement it , however, since i am a nice guy i will you guys a little peek of how easy python programming is...below is source code for a simple calculator...just download IDLE paste this in it after of course you have set it up and it's running, press F5 and you would see..and if you are
interested in learning further just comment about it i give you guys a few more tips and sources where you could get in depth knowledge for this.

Source Code

while True:
    ##calculator program..
    print("Options")
    print("Enter '1' to add two numbers")
    print("Enter '2' to subtract two numbers")
    print("Enter '3' to multiply two numbers")
    print("Enter '4' to divide two numbers")
    print("Enter '5' to get the modulus between two numbers ")
    print("Enter '6' to get the power between two numbers")
    print("Enter '7' to get the quotient between two numbers")
    print("Enter 'quit' to end the program")
    print("")
    user_input = int(input("Enter option : "))

    if user_input == "quit":
        print("Quitting.....")
        break
    elif user_input == 1:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 + num2)
        print("The answer is"+ " "+result)
        print("")
    elif user_input ==  2:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 - num2)
        print("The answer is "+result)
        print("")
    elif user_input == 3:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 * num2)
        print("The answer is "+result)
        print("")
    elif user_input == 4:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 / num2)
        print("The answer is "+result)
        print("")
    elif user_input == 5:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 % num2)
        print("The answer is "+result)
        print("")
    elif user_input ==6:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 ** num2)
        print("The answer is "+result)
        print("")
    elif user_input == 7:
        print("")
        num1 = float(input("Enter a number: "))
        num2 = float(input("Enter a number: "))
        result = str(num1 // num2)
        while float(result) > 2:
             print("This answer is greater than two and a loop is about to start ")
             print("The answer is "+ result)
             print("Running the application")

    else:
        print("Unknown input")

One more thing programming is for the patient and devoted mind.... 



Relaxation for the mind, body and soul practice this as many times daily as you can...

So lets talk relaxation, well i love meditation, matter of fact i do it whenever i can so here is a narrative of steps to follow in order to reach that culmination of self - realization....

“So the first step is to keep a good meditation posture with a straight back and relaxed shoulders. In that position, your chin usually moves slightly, just a little bit, towards your neck; to a small degree. Part of the first step is to keep your tongue up and touching the roof of your mouth. “The second step is to close your eyes and slightly cross them looking up towards the middle of your forehead, at the opening of your third eye. “And the third, and last step, is to start breathing all the way down to your navel area. “People usually breathe superficially in the chest area. Few people are able to breathe down to the navel center. And that is because it is not necessary to breathe. It happens automatically. If it were necessary to breathe, you probably would not be able to survive so many days. How would you breathe while sleeping? In this meditation, however, you are asked to be aware of your breathing. And even more than that: you are asked to bring your breathing, your prana, all the way down to the navel center. “You think it is easy, but it is not. Breathing is just a vehicle. Within this vehicle there is something very important: prana or life force energy. When you do this meditation, after two or three months you will begin to feel the prana flowing in you. The easiest way to feel prana(life force/ energy) is to look up towards the third eye.

There is more just try to practice this as much as you can....

How to implement sound in java programming language

So guys yap....third blog post i wanna this post special as 3...well is one of my favorite numbers, so well in my last post i mentioned that i might be posting source codes for java programming.....well here is a short code to implement a custom button alongside sound in java...images included..

Firstly images you will need to create...
This is the custom_button kind of 3d..cool right

button_hover..as in when mouse is over  this

Mouse clicked..
Here is the whole source code....this is Netbeans auto compiled code by the way so  ya u could it out or just  use Netbeans ..Jframes and stuff...so  u simply got to create a subfolder in the package's main for images and  
for sound....and include them in the paths when calling them...pardon the lengthy codes i just want u guys to see it all
For example
Package Main
     folder Sound
           sound file
       folder Images
               all images stored here

I hope is helpful
package App_package;

import java.io.File;


import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.ImageIcon;


/**
 *
 * @author DAVID
 */
public class Main_menu extends javax.swing.JFrame {

     File sound = new File("(This should be the sound file location on your system..eg"C:\\Users\\David\\ring.wav")");
    
    public Main_menu() throws LineUnavailableException {
        initComponents();
         Clip clip = AudioSystem.getClip();
    }


    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setPreferredSize(new java.awt.Dimension(300, 200));
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/custom_button.png"))); // NOI18N
        jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel2MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabel2MouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jLabel2MouseExited(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jLabel2MousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jLabel2MouseReleased(evt);
            }
        });
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 60, -1, 40));
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 20, 160, 110));

        pack();
    }// </editor-fold>                        
      void playSound(File sound)
    {
    try{
       
        clip.open(AudioSystem.getAudioInputStream(sound));
        clip.start();
       
        
        Thread.sleep(clip.getMicrosecondLength()/1000);
    }catch(LineUnavailableException | UnsupportedAudioFileException | IOException | InterruptedException e)
    {
    System.err.println(e);
    }
    }
     static void stopSound(File sound) throws UnsupportedAudioFileException, LineUnavailableException, IOException
     {
         clip.stop();
     }
    private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {                                     
       ImageIcon ii = new ImageIcon(getClass().getResource("/images/button_hover.png"));
       jLabel2.setIcon(ii);
    }                                    

    private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {                                    
         ImageIcon ii = new ImageIcon(getClass().getResource("/images/custom_button.png"));
       jLabel2.setIcon(ii);
    }                                   

    private void jLabel2MousePressed(java.awt.event.MouseEvent evt) {                                     
         ImageIcon ii = new ImageIcon(getClass().getResource("/images/mouse_clicked.png"));
       jLabel2.setIcon(ii);
           playSound(Alarm);
           
    
    }                                    

    private void jLabel2MouseReleased(java.awt.event.MouseEvent evt) {                                      
        ImageIcon ii = new ImageIcon(getClass().getResource("/images/button_hover.png"));
       jLabel2.setIcon(ii);
       System.out.println("You clicked the button");
     try {
         stopSound(sound);
     } catch (UnsupportedAudioFileException ex) {
         Logger.getLogger(Main_menu.class.getName()).log(Level.SEVERE, null, ex);
     } catch (LineUnavailableException ex) {
         Logger.getLogger(Main_menu.class.getName()).log(Level.SEVERE, null, ex);
     } catch (IOException ex) {
         Logger.getLogger(Main_menu.class.getName()).log(Level.SEVERE, null, ex);
     }
        //  playSound(Alarm);
    }                                     

    private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
    }                                    

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main_menu().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration                   
}

So hopefully in future posts for source codes they will be much more concise and succinct, ok guys i hope this is helpful, try to pay most attention to the methods and the fields.
Become a developer
Lovely people, just in case anyone's wondering what kind of posts they could post.. well, any kind is allowable; complains, questions, encouragement, support, commendation, criticism......just about anything but i would appreciate commendations and questions....as this would assist me decide what to post and more importantly i would be helping all the inquisitive minds out there....thanks....

Sunday, 13 November 2016

Programming and Lifestyle: ➡ Yap guys second post..I am sharing a couple of ...

Programming and Lifestyle: ➡ Yap guys second post..
I am sharing a couple of ...
: ➡ Yap guys second post.. I am sharing a couple of channels which i am a patron of on the YouTube ,which have in stock for you a comprehens...
➡ Yap guys second post..
I am sharing a couple of channels which i am a patron of on the YouTube ,which have in stock for you a comprehensive learning experience for the beginners in java programming  language..
1. Vertex Digital Arts
2. TheChernoProject

Hopefully, my future posts might be source codes  for java programming which implements various actions


become a developer



Tuesday, 8 November 2016

My First Blog Post...

Hi guys, this is my first blog post and i blog basically about Lifestyle and Programming , i am new right now but i promise in soon time you guys will appreciate my blog...

So well, i have chosen to blog about Programming and Lifestyle, firstly cause it is what i do for a living and also i wish to share my knowledge with my visitors and essentially discuss ways to get around problems regarding a number of programming languages and also to share with my visitors the lifestyle of  the  programmers......