Category Archives: learning

Something Spiritual.


I went for one client meeting and I have seen a diagram. I was not able to take any picture but I have managed to write all the points which was available in picture.

This picture was related to spirituality.

The inner circle is growth and it has 2 section.
The left section has few points as –

  • Culture
  • Value
  • People
  • Ownership
  • Seamless Ness
  • Relationship
  • Dream
  • Desire
  • Ambition
  • Emotion

The right section has few points as –

  • Process
  • Policies
  • System
  • Design
  • Profitability
  • Consequences
  • Opportunity
  • Death
  • Fate
  • Accounts
  • Measurement

If I see these points are very imp in normal life for both Professional and Personal area.

Happy Karma.
Happy Yama.

Advertisements

How to hard reset Android LG P690, when touch is failed.


I am using LG-P690.

Today suddenly touch stopped working.  I am not able to do anything. Anything means anything. All my account are active and I am clueless what to do.

Before giving this phone to support I want to reset everything.

Objective : How to hard reset if your LG P690 touch is not working.

LG_P690

When the phone is fully off mode, press and hold the Home key + Volume down key + Power key. After some time say 5-10 seconds. You will get LG logo that time release the power key.

And when it will show the hard reset screen then release all the other keys.

And then take a deep breath and wait and finally your phone will be in same state when you have bought the same.

 

Happy Android.

“A” to “Z” of Stress Management


Note : Its not written by me. I just got it from my old archives. Liked to share the same.

  • Always take time for yourself, at least 30 minutes per day.
  • Be aware of your own stress meter, know when to step back and cool down.
  • Concentrate on controlling your own situation, without controlling everybody else.
  • Daily exercise will burn off the stress chemicals.
  • Eat lots of fresh fruit, veggies, bread and water, give your body the best for it to perform at its best.
  • Forgive others, don’t hold grudges and be tolerant not everyone is as capable as you.
  • Gain perspective on things, how important is the issue.
  • Hugs, kisses and laughter. Have fun and don’t be afraid to share your feelings with others.
  • Identify stressors and plan to deal with them better next time.
  • Judge your own performance realistically, don’t set goals out of your own reach.
  • Keep a positive attitude, your outlook will influence outcomes and the way others treat you.
  • Limit alcohol, drugs and other stimulants. They affect your perception and behaviour.
  • Manage money well, seek advice and save at least 10 per cent of what you earn.
  • No is a word you need to learn to use without feeling guilty.
  • Outdoor activities by yourself or with friends and family can be a great way to relax.
  • Play your favourite music rather than watching television.
  • Quit smoking. It is stressing your body daily, not to mention killing you too.
  • Relationships. Nurture and enjoy them, learn to listen more and talk less.
  • Sleep well. With a firm mattress and a supportive pillow, don’t overheat yourself and allow plenty of ventilation.
  • Treat yourself once a week with a massage, dinner out, the movies. Moderation is the key.
  • Understand things from person’s point of view.
  • Verify information before exploding, from the source.
  • Worry less. It really does not get things completed better or quicker.
  • Xpress. Make a regular retreat to your favourite space, make holidays part of your yearly plan and budget.
  • Yearly goal setting. Plan what you want to achieve based on your priorities in your career, relationships, etc.
  • Zest for life. Each day is a gift, smile and be thankful that you are a part of the bigger picture.

Happy Stress Free Life.

Learning Saturday – III


There are no secrets to success. It is the result of preparation, hard work, and learning from failure. – Colin Powell

Happy Learning.

Hungry Saturday – II


It was great week.

Happy Learning.

Hungry Saturday – I


I am starting the new series as “Hungry Saturday”.
On saturday ( not every ). I will publish all my learning to this post. By this way I want to make sure the continuity and learning.

Happy Learnging. Happy Hunger.

Board Room – Ground Rules


Few days back I went for one meeting and was sitting at client meeting room.

Got these “Ground Rules” and liked very much.

  • Be Open, Speak Your Mind
  • There Is No Rank In The Room
  • What You Say Stays Within The Wall
  • Every Contribution Is Valuable
  • Stay Focused.
  • One Speaker At A Time.
  • Be An Active Listener, Talking Doesn’t Equal Learning.
  • Give Freely Of Your Relevant Experience.
  • Keep An Open Mind.
  • Agree/Disagree Only If It Make Sense To Do So.
  • Ask Your Question No Matter How Obvious You May Think The Answer.
  • Humor In The Right Place Is The Bonus.

Happy Meeting.

Quick Perl Interview Points


Some years ago when I was planning for job change one of my close friend Deepak told me if you want to crack Perl interview just revise these points. I called these as bullet points.

Just revising these points for my reference and for your help.

This is no particular order and written as mentioned by him over the phone 🙂

  • Referencing – de-referencing of data types – scaler, hash, array
  • pack – unpack
  • string – split. while,
  • pop,push,shift,unshift
  • array – add variable..
  • hash print
  • data read from hash.
  • sorting – numeric or normal
  • file handing
  • DB connection.
  • path module.
  • use warning, use strict, dbi, cgi, dump
  • perl mysql connection
  • regular expression – all small example
  • adding module how to..
  • use
  • require
  • my or local diff.
  • package
  • why we use 1 in package.
  • little oops in perl
  • @ISA
  • command line in perl
  • /usr/bin/perl
  • CGI T
  • use dignostic
  • how to debug
  • perl -d
  • cpan to cgi.
  • pass by value , pass by reference
  • environment variable
  • data type of return value.
  • how to know that array has unique value
  • how to run system command from perl, how many ways. 4-5 ways. diff between each
  • spacial variable
  • comments in regular expression
  • what are the default error
  • what is slurp mode
  • file hander, opearion, third argument
  • how to escape
  • apache
  • sorting – numeric or normal
  • regular expression – all small example
  • adding module how to..

I will keep adding new point as and when I will get.
Comment your points.

Happy Perl.

Drupal Bullet Points


I have used Drupal in 2008-2010 and worked on Drupal5 and Drupal6.

I am just collecting some keywords during my learning.

Drupal
Node
Content
Content Type
CCK
users
annonomouse user
logged in user
Roles and Permissions
role based permission
Single Sign on
blocks
modules
drupal plugin software
hook system
extensible
event driven system.
Drupal core
Drupal contributed
menus
menu paths
Drupal pages
Drupal index.php
clean urls
themes
site configutaiion..
error reporting…
status report
cron
performance
caching

Now I am not using Drupal, but which my work. This framework was awesome for CMS structure.

Happy Drupal.

Simple Java AD/LDAP Authenticaion Code


There are so much of code and reference available for AD/LDAP integration in Java. I also searched a lot and the below code worked for me.
As a non-java developer I found so interesting while working on some complex java stuff.

 

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class ADTestNew {
    public static void main(String[] args) {
    try {
        Hashtable env = new Hashtable();

        env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

        env.put(Context.PROVIDER_URL,"ldap://192.168.100.225:389"); //replace with your server URL/IP

        // This line is optional based on environment. You can try with comment or without comment also.
        env.put(Context.SECURITY_AUTHENTICATION,"DIGEST-MD5"); //No other SALS worked with me

        env.put(Context.SECURITY_PRINCIPAL,"login"); // the user name.

        env.put(Context.SECURITY_CREDENTIALS, "Passw0rD"); //the password.

        DirContext ctx = new InitialDirContext(env);

        ctx.close();

    } catch(NamingException ne) {
        System.out.println("Error authenticating user:");
        System.out.println(ne.getMessage());
        return;
    }
    //if no exception, the user is already authenticated.
    System.out.println("OK, successfully authenticating user");
    }
}

Happy Java.

Server Administration on LAMP Stack


The common process flow for LAMP Stack projects and there server maintenance.

  • * Get the best deal from hosting company.
  • * Get the root access and direct unique ID by which you can directly talk to them for any query and emergency.
  • * Do some hardware configuration check such as –
    • # CPU Check, Memory Check, Disk Space, Memory Status, Swap Space
  • * Do some software configuration check such as –
    • # LAMP Stack configuration, need to install via source or via standard packages.
  • * Security checks. Server need to be optimized with security checks.
    • # Configure Software Firewall.
    • # Changing in default SSH port
    • # Disable direct root login
    • # Change root password strong
    • # Create user group and give access to only developers and maintainers.
    • # White-list only port 80 and 443.
    • # Authenticate mailing ports.
    • # Enable SFTP for file uploads for developers.
    • # Disable SVN Access.
  • * Do server monitoring.
    • # Enable and watch server logs.
    • # Enable and watch error logs.
    • # Enable and watch slow query logs.
    • # Install Awstats for monitoring server logs.
    • # Install and configure Nagios as alert mechanism.
    • # Watch and maintain server space, memory utilization, HTTP Service, CPU Load, SSH Service.
  • * Later work on server optimization.
  • * Optimize PHP and MySQL configuration based on need and requirement.

This list can have more option. If you find new things, give me comments.

Happy Server.

Drupal Interview Questions


So while working with Drupal Projects in my previous company. Me and my team prepared some Drupal Interview Question. This does not have everything but this will be for 1st round for sure. If you know these many question then I think you know Drupal For Sure.

Here is the list which is basic Drupal Questions.

  • Drupal Basics – Node, Module, Teaser, theme, Path, taxonomy, Patch, Region, Block, Menu
  • Installation of Drupal, steps and how to upload it on the live site from the local Machine.
  • Core Module in Drupal, their Names and their Functionalities.
  • Hook, Node Concepts
  • Functions and their Functionalities for – t() Function, l() function, Watchdog functions etc
  • Theme System in Drupal.
  • Themes and Theme Templates.
  • Theme Engines (Interface between the Drupal Core and the theme template).
  • Theme Hooks (Provide a way of interaction between the Modules and theme)
  • Theme Template structure and different sections as Page.tpl.php, node.tpl.php, block.tpl.php, box.tpl.php, etc
  • Derivative themes or Sub themes or Theme inheritance concepts that came into existence in Drupal 6, about it and its functionalities.
  • Steps to create a derivative theme and how to move for creating the theme from Derivative themes to a new theme right from scratch.
  • Theme function.
  • Where the Drupal theme functions are defined?
  • How the Drupal Theme functions can be overridden.
  • How to Implement the AJAX Effects on the Block modules in Drupal 6
  • Theme registration and the concepts in Drupal 6.
  • CCK modules and its importance with major functionalities.
  • How to create a Module.
  • How to insert the database table schema from the Modules when they are installed and remove the table scheme when they are un-installed (modules.)
  • User, Permission, Role in Drupal
  • How the Drupal database works?

Please give comments for more Drupal Questions.

Long back I have shard my PHP Interview Questions also.

Happy Programming.

Groovy: Use findAll to fetch string from long string.


How to use findAll() in groovy, when you have to find some specific string from string.

def name= 'this#   is to%% te$st ^in*d~~ all $$from CCa s<>>ng, this is basi?><:"{}cally fetch only interested thing.'
def name1 = ''
def findName = name.findAll(/[A-Za-z\s+]/).each{name1 += "${it}"}
println findName
println name1

We can also use

def findName = name.findAll(/[A-Za-z\s+]/)
def name1 = findName.join('')

This code will fetch only sting and space and give output in name1.

Output –

run-single:
[t, h, i, s,  ,  ,  , i, s,  , t, o,  , t, e, s, t,  , i, n, d,  , a, l, l,  , f, r, o, m,  , C, C, a,  , s, t, i, n, g,  , t, h, i, s,  , i, s,  , b, a, s, i, c, a, l, l, y,  , f, e, t, c, h,  , o, n, l, y,  , i, n, t, e, r, e, s, t, e, d,  , t, h, i, n, g]
this   is to test ind all from CCa sting this is basically fetch only interested thing
BUILD SUCCESSFUL (total time: 1 second)

Program has many ways to do.
Happy Programming.

Quick Tutorial – How to zip and unzip files under unix environment


Linux support zip and unzip facility.
All you need to install zip and unzip via apt-get in your debian/ubuntu linux.
The same is available via yum or zypper.

Some examples for zip and unzip.

1. Creates the zip archive and put all the files of the current directory in the compressed form.

ankur@ankur:~> cd test/
ankur@ankur:~/test> ll
total 0
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 3.txt
ankur@ankur:~/test> zip zipthis *
 adding: 1.txt (stored 0%)
 adding: 2.txt (stored 0%)
 adding: 3.txt (stored 0%)
ankur@ankur:~/test> ll
total 4
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test>

This command will automatically put the zip extension when the process will done.

2. Now try for zipping the subdirectory also..
Here I have created the subdirector as “subtest”.

ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test> zip -r subzipthis *
 adding: 1.txt (stored 0%)
 adding: 2.txt (stored 0%)
 adding: 3.txt (stored 0%)
 adding: subtest/ (stored 0%)
 adding: subtest/sub1.txt (stored 0%)
 adding: subtest/sub2.txt (stored 0%)
 adding: zipthis.zip (stored 0%)
ankur@ankur:~/test> ll
total 12
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test>

To use unzip to extract all files of the archive pics.zip into the current directory & subdirectories:

3. Listing of your files from a zip folder.

ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test> unzip -l subzipthis.zip
Archive:  subzipthis.zip
 Length     Date   Time    Name
 --------    ----   ----    ----
 0  10-20-10 10:03   1.txt
 0  10-20-10 10:03   2.txt
 0  10-20-10 10:03   3.txt
 0  10-20-10 10:14   subtest/
 0  10-20-10 10:14   subtest/sub1.txt
 0  10-20-10 10:14   subtest/sub2.txt
 382  10-20-10 10:05   zipthis.zip
 --------                   -------
 382                   7 files
ankur@ankur:~/test>

4. To test about your zip archive that archive is OK or not:

ankur@ankur:~/test> unzip -tq subzipthis.zip
No errors detected in compressed data of subzipthis.zip.
ankur@ankur:~/test> unzip -tq zipthis.zip
No errors detected in compressed data of zipthis.zip.

5. Unzip your data

ankur@ankur:~/test> unzip zipthis.zip
Archive:  zipthis.zip
 extracting: 1.txt
 extracting: 2.txt
 extracting: 3.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

6. Now you want to extract only the specific files from your zip folder. You can use like this…

ankur@ankur:~/test> unzip zipthis.zip 1.txt
Archive:  zipthis.zip
 extracting: 1.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

7. To extract all files to some specified directory.

ankur@ankur:~/test> unzip zipthis.zip -d /home/ankur/test/
Archive:  zipthis.zip
 extracting: /home/ankur/test/1.txt
 extracting: /home/ankur/test/2.txt
 extracting: /home/ankur/test/3.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

8. Unzip files one by one with confirmation.

ankur@ankur:~/test> unzip -q subzipthis.zip
replace 1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace 2.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace 3.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace zipthis.zip? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
ankur@ankur:~/test> ll
total 12
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

9. Zip and Unzip version and liceance.

zip -v
zip -L
unzip -v

10. Help from zip and unzip

zip -h
unzip -h

setup django quick install


All this text and help provided by
http://docs.djangoproject.com/en/dev/intro/install/

Get the live code from live code base.

ankur@ankur:~> svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

Python interpreter can load Django’s code.
There are various ways of accomplishing this.
One of the most convenient, on Linux, Mac OSX or other Unix-like systems, is to use a symbolic link:

ankur@ankur:~> python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
/usr/lib/python2.6/site-packages
ankur@ankur:~> ln -s `pwd`/django-trunk/django /usr/lib/python2.6/site-packages/django

This simply lets you type django-admin.py
from within any directory, rather than having to qualify the command with the full path to the file.

ankur@ankur:~> ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/bin

Now we don’t have to run python setup.py install,
because you’ve already carried out the equivalent actions in above steps.

ankur@ankur:~> mkdir django-code
ankur@ankur:~> cd django-code/
ankur@ankur:~> django-admin.py startproject mysite
ankur@ankur:~/django-code> ll
total 4
drwxr-xr-x 2 ankur users 4096 2010-09-18 12:09 mysite
ankur@ankur:~/django-code> cd mysite/
ankur@ankur:~/django-code/mysite> ll
total 24
-rw-r--r-- 1 ankur users    0 2010-09-18 12:08 __init__.py
-rwxr-xr-x 1 ankur users  546 2010-09-18 12:08 manage.py
-rw-r--r-- 1 ankur users 3386 2010-09-18 12:08 settings.py
-rw-r--r-- 1 ankur users  482 2010-09-18 12:08 urls.py
ankur@ankur:~/django-code/mysite> python manage.py runserver
Validating models...
0 errors found

Django version 1.3 pre-alpha SVN-13861, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[18/Sep/2010 02:11:07] "GET / HTTP/1.1" 200 2051

At http://127.0.0.1:8000/ Says

It worked!
Congratulations on your first Django-powered page.

%d bloggers like this: