Wednesday, November 25, 2015

How to Add Low Battery Warning on OpenSUSE

Simply follow these steps:

If you prefer to do it using a GUI, you can go to the Software Center and install Scheduled tasks (or run sudo zypper install gnome-schedule). It will provide a powerful GUI to add cron tasks.

Note that if you use this method, tasks by default will be executed as your own user, not as root. This is usually a good thing.

Once installed this application, search "Scheduled Tasks" and Open it.
Now, Click on New
Click on "A task that launches recurrently"
Now Add description for example: VK Battery Check
On the command, Add: /home/vkpandey/Extras/scripts/CheckBattery.sh
On the Time and Date Option, click on Advanced
In the Minute section, add */5 that means at minute: */5 (in every 5 minutes)
and leave Hour, Day, Month, Weekday *


Now create a following CheckBattery.sh script in any location (For example: /home/vkpandey /Extras/scripts)

#!/bin/bash
BATTERY=$(upower -e | grep 'BAT')
while [ 1 ]
do
    BATTERY_PERCENTAGE=$(upower -i $BATTERY|grep percentage|awk '{ print $2 }'|sed s/'%'/''/g)
    if [[ "$BATTERY_PERCENTAGE" -lt "20" ]]; then
    notify-send --urgency=critical "WARNING: Battery is about to die"  "Hello Vijaya!! Plug in the power cable"
    play /usr/share/sounds/KDE-Sys-Warning.ogg &> /dev/null
    fi
sleep 10
done
**Don't forget the file permission of CheckBattery.sh

Now All Done!

Assign Win + E Key to Open Home Folder [OpenSUSE]

Here is the trick to Assign Win + E Key to Open Home Folder [OpenSUSE]:

1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Launchers
5. Click on "Home Folder" option.
6. Click on the right side (you will see New Accelerator or something)
7. press windows + E (also called Super + E)
8. Now on the right side it shows "Super + E"

Finally you're done. That will create a keyboard shortcut to open home folder. Press Super + E to see the result.

Monday, November 23, 2015

Show Desktop Items on OpenSUSE

To show the desktop items on OpenSUSE, follow these steps:

1. Type Tweak Tool on search bar.
2. Go to Desktop tab
3. On the Top Right Side, change Off button to On.

Now, you're all set.

How to Hide All Normal Windows on OpenSUSE?

Here is the trick to show desktop / hide all normal windows on OpenSUSE:

1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Navigation
5. Scroll down to find "Hide All Normal Windows".
6. Click on the right side (you will see New Accelerator or something)
7. press windows + D (also called Super + D)
8. Now on the right side it shows "Super + D"

Finally you're done. Press Super + D to see desktop.

Monday, November 16, 2015

Wednesday, November 11, 2015

Start PhpMyAdmin OpenSUSE

Go to Terminal and Run:

/opt/lampp/lampp restart

     /opt/lampp/lampp start

Run Gringo/Clingo Successfully on OpenSUSE [Gringo Not Working on OpenSUSE - FIXED!]

With the recent gringo/clingo sources, no configuration should be necessary (under (most) linuxes).
However you have to make sure the installation of the development package of python.

To install the necessary packages:
  sudo zypper in python-devel lua-devel bison scons re2c

For threading support, you also need Intel's tbb. It is in the education repository.
  sudo zypper in tbb-devel

Add Clingo Path to Environment Variable [OpenSUSE]

1. Open Terminal
2. Type the following Command:

vi ~/.bashrc

3. Add the following content
export PATH=$PATH:~/Documents/clingo-4.5.3/

4. To save and exit, click "Shift" + ":" together and type "wq" and press Enter.

Now you're all done.

To ensure you did it right, type:

clingo

Set PYTHONPATH to bashrc [Clingo Python Environment Variable]

1. Open Terminal
2. Type the following Command:

vi ~/.bashrc

3. Add the following content
export PYTHONPATH=~/Documents/clingo-4.5.3-source/build/release/python
export PYTHONPATH=<path-to-gringo-sources>/build/release/python 
        Here, <path-to-gringo-sources> is the path to the gringo sources.

4. To save and exit, click "Shift" + ":" together and type "wq" and press Enter.

Now you're all done.

To ensure you did it right, type:

echo $PYTHONPATH
OR
printenv PYTHONPATH

Friday, November 6, 2015

Remove Folder using Terminal on OpenSUSE

To remove:
1. Open Terminal
2.Type:

sudo rm -r Clang 

[here, if you're not in a current directory, give full path]

Find OpenSUSE Version using Terminal

A quick way to find which version of OpenSUSE you're using:

1. Open Terminal
2. Type:
cat /etc/SuSE-release
That will show you the result.

UPDATE:
/etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead

Thursday, November 5, 2015

Take Screenshot on OpenSUSE

Run the following command:

gnome-screenshot -a

By default, the screenshot will be stored in Pictures folder.

Wednesday, November 4, 2015

Set PYTHONPATH Environment Variable OpenSUSE

1. Open Terminal
2. Type:
 which Python
it will show the path where python is installed.
For example: /usr/bin/python

3. Now, type the following command:

export PYTHONPATH=$PYTHONPATH:/usr/bin/python

4. Now you're all set. Just to make sure, type following command:
printenv | grep PYTHON
or
printenv PYTHONPATH
that should show you :
PYTHONPATH=:/usr/bin/python

if the pythonpath is not set, it shows:
PYTHONPATH=

Thursday, October 29, 2015

Check if bison is already installed on OpenSUSE

Check if bison is already installed on OpenSUSE:
1. Open terminal.
2. These are the helpful commands:


zypper se bison

which bison

bison --version
or 

bison --help
for help 


For re2c

open terminal
type
which re2c
type:
re2c --version

How to Make Sure if GCC is Installed? [OpenSUSE]

Check if gcc is installed on your Linux device:
1. Open terminal.
2. Type
which gcc
which gives the output:  /usr/bin/gcc

3.  Now, to find the version, type:
gcc -v

good luck! ;)


To install:
 sudo zypper in gcc


or search for gcc (SUSE Linux) 4.8.5
 

Install Sublime Text on Linux [OpenSUSE]

Step 1: Download sublime text folder
Step 2: Unzip the downloaded folder
Step 3: Move the extracted folder to opt directory
Command to move the folder is:
sudo mv Sublime_FOLDER_NAME /opt/

Step 4: Create a symlink in bin:
sudo ln -s /opt/Sublime Text 2/sublime_text /usr//bin/sublime

Now you're all done. You can easily start Sublime Text from the Console by running
sublime

Install F.lux on OpenSUSE (Flux for Linux)

1. Download the flux package from f.lux website.
2. Unzip the folder and copy the xflux file into documents folder.

3. go to the directory where xflux is located. Open terminal and type the following command:
sudo cp xflux /usr/bin/
sudo chmod 755 /usr/bin/xflux
xflux -z 88001    (here 88001 is the zip code for Las Cruces, NM)
4. You'll get the following message:

--------
Welcome to xflux (f.lux for X)
This will only work if you're running X on console.

Sunday, October 18, 2015

How to Create a Bootable USB Flash Drive

Simply follow all of the following steps:
  1. Insert a USB flash drive into a running computer.
  2. Open a Command Prompt window as an administrator.
  3. Type diskpart.
  4. In the new command line window that opens, to determine the USB flash drive number or drive letter, at the command prompt, type list disk, and then click ENTER. Thelist disk command displays all the disks on the computer. Note the drive number or drive letter of the USB flash drive.
  5. At the command prompt, type select disk <X>, where X is the drive number or drive letter of the USB flash drive, and then click ENTER.
  6. Type clean, and the click ENTER. This command deletes all data from the USB flash drive.
  7. To create a new primary partition on the USB flash drive, type create part pri, and then click ENTER.
  8. To select the partition that you just created, type select part 1, and then click ENTER.
  9. To format the partition, type format fs=ntfs quick, and then click ENTER.
    System_CAPS_importantImportant
    If your server platform supports Unified Extensible Firmware Interface (UEFI), you should format the USB flash drive as FAT32 rather than as NTFS. To format the partition as FAT32, type format fs=fat32 quick, and then click ENTER.

  10. Type active, and then click ENTER.
  11. Type exit, and then click ENTER.
  12. When you finish preparing your custom image, save it to the root of the USB flash drive.
Now you're all set. Your pendrive is bootable! :)

(source: https://technet.microsoft.com)

Run Clingo on Windows

there are 2 ways to do this:

1. download clingo and extract it.
2. copy the files into some location. for example: C:\clingo
3. Add "C:\clingo" to the environment variables settings.
4. Then you're all set. Go to command prompt, type cd c:\clingo 
tyen type: clingo 0 someprogram.pl


Second way:
1. download clingo and extract it.
2. copy the files into some location. for example: C:\clingo
3. select clingo folder
4. press Shift key and right click that folder
5. Then you will see the Open Command Prompt Window Here option
click that option and you're all set.

Note: If you're using windows 8 on 32 bit, it may not work the recent version. However, clingo-3.0.5-win32 works perfect.


Happy Grounding and Solving!

Wednesday, June 24, 2015

How to Install Python Twitter Master

First download Python Twitter Master from GitHub.
Then,
Extract the downloaded file and put it in a desktop (that makes you easy to navigate from command prompt)

Go to command prompt.
Type cd desktop command and press Enter
Type cd python-twitter-master command and press Enter (the folder name that you just extracted)
Type python setup.py install command and press Enter.

Then you're done.

How to Install Tweepy Python

First download Tweepy from GitHub.
Then,
Extract the downloaded file and put it in a desktop (that makes you easy to navigate from command prompt)

Go to command prompt.
Type cd desktop command and press Enter
Type cd tweepy-master command and press Enter (the folder name that you just extracted)
Type python setup.py install command and press Enter.

Then you're done.
You'll see the following screen when you press the above command.

Installation of Tweepy Python

Tuesday, March 31, 2015

Rename Multiple Files without Parentheses using Bat File

To remove parentheses from multiple files in windows, do the followings:

1. If you have many files like this:
conf (1).jpg
conf (2).jpg
conf (3).jpg
conf (4).jpg
conf (5).jpg
conf (6).jpg

2. Create a bat file. The code for bat file is:

Monday, March 16, 2015

Start a New SVN in Linux

1. First go to your home directory
2.  Open terminal
3. Create any folder that you want to make
for eg. mkdir Jupiter
4. go to that folder
example: cd Jupiter
5. Type
svn checkout svn://amon.cs.nmsu.edu/cs581sp2015/teamUSM1


Now it will load all the files from svn repository to your computer

Friday, March 13, 2015

NMSU Payroll Direct Deposit Advice Password

If you receive the .pdf file from payroll advice and wondering what is the password, here you go!

The password is: first 4 digits of your family name + last 4 digits of your social security number.

Monday, March 2, 2015

How to Use SVN in Windows

1. First of all search the svn software for windows.
    You can directly go to http://tortoisesvn.net/ and then downloads directory.

2. Install TortoiseSVN-(....).msi software on your PC

3.  Create the folder where you want to have your project files. Then right click on it and select TortoiseSVN → Checkout
For example: Goto  → My Documents
                       → then right-click with the mouse on an empty spot
                       → then click on SVN Checkout

Thursday, February 26, 2015

Internal vs External Quality

External Quality Characteristics: 
care u air
Correctness, Usability, Efficiency, Reliability, Integrity, Adaptability, Accuracy, and Robustness.

Internal Quality Characteristics: 
mut r pr
Maintainability, Flexibility, Portability, Re-usability, Readability, Testability, and Understandability.

Tuesday, February 17, 2015

Java Applet Program to Draw Olympic Ring

import java.awt.*;
import javax.swing.*;

public class Olympic extends JApplet{

    public void paint(Graphics g){
   
        g.setColor(Color.blue);
        g.drawOval(10,10,100,100);
  

Basic Java Calculator using Methods

import java.util.Scanner;

public class calculator{
   
    private static final Scanner STDIN = new Scanner(System.in);
   
    public static void main(String[] args){
       
        int inpOpr;
        System.out.println("\n 1. Addition");
        System.out.println("\n 2. Substraction");
        System.out.println("\n 3. Multiplication");
        System.out.println("\n 4. Division");
        System.out.println("\n Enter your choice");
  

Tuesday, February 10, 2015

Add External Class File When You Run Java

To add external class file as input,

1. On the eclipse left pane, right click the project folder name
2. Click on Run As and then click on Run Configurations
3. On the left side, you will see your project folder name nest under Java Application
4. Click on your project folder name

How to Add ASM Library Files in Eclipse

1. On the eclipse left pane, right click the project folder name
2. Click on Properties
3. New window will appear.
In a new window, see the left pane,
a. Click on Java Build Path
b. Click on Libraries tab
c. You will see "Add External Jars" on the right side, click on that button
d. Select the asm library jar files.

Hello.java

Sometimes I need a very simple java file in order to work on other class file project.
In order to reduce my workload on creating basic blocks, this is a very simple hello.java file:

import java.util.*;

public class hello{

    public static void main(String[] args) {
      
        Date d = new Date();
        System.out.println("Date: "+ d);

Saturday, February 7, 2015

Add Files or Folder to SVN

1. First go to your home directory and then svn directory example: home/ your svn directory name like vkpandey
2. Create a folder example: reading2
3. Put your file into the directory example: put reading2.txt into reading2 folder
4. Right click and open terminal from your svn directory name (goto vkpandey and right click and click on "open in terminal" option)

5. Enter the command svn add reading2 to add reading2 directory and it's file in a SVN
The command gives you the message like:
                         A         reading2
                         A         reading2/reading2.txt

Monday, January 19, 2015

Wireless Not Working on Windows 8.1

Wireless problem on Windows 8.1 Laptop

You can change the adapter settings as follows on your laptop:

You can do this by going to
Right click My Computer,
go to properties,