Wednesday, 22 January 2014

Useful MySQL Database Commands


Create a database on the sql server.

mysql> create database [databasename];

List all databases on the sql server.

mysql> show databases;

Switch to a database.

mysql> use [db name];

To see all the tables in the db.

mysql> show tables;

To see database's field formats.

mysql> describe [table name];

To delete a db.

mysql> drop database [database name];

To delete a table.

mysql> drop table [table name];

Show all data in a table.

mysql> SELECT * FROM [table name];

Returns the columns and column information pertaining to the designated table.

mysql> show columns from [table name];

Show certain selected rows with the value "whatever".

mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";

Show all records containing the name "Bob" AND the phone number '3444444'.

mysql> SELECT * FROM [table name] WHERE name = "Bob" AND phone_number = '3444444';

Show all records not containing the name "Bob" AND the phone number '3444444' order by the phone_number field.

mysql> SELECT * FROM [table name] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number;

Show all records starting with the letters 'bob' AND the phone number '3444444'.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444';

Show all records starting with the letters 'bob' AND the phone number '3444444' limit to records 1 through 5.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444' limit 1,5;

Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. This finds any record beginning with a.

mysql> SELECT * FROM [table name] WHERE rec RLIKE "^a";

Show unique records.

mysql> SELECT DISTINCT [column name] FROM [table name];

Show selected records sorted in an ascending (asc) or descending (desc).

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

Return number of rows.

mysql> SELECT COUNT(*) FROM [table name];

Sum column.

mysql> SELECT SUM(*) FROM [table name];

Join tables on common columns.

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

Create a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

# mysql -u root -p mysql> use mysql; mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password')); mysql> flush privileges;

Change user’s password from unix shell.

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password 'new-password'

Change user’s password from MySQL prompt. Login as root. Set the password. Update privs.

# mysql -u root -p mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere'); mysql> flush privileges;

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop # mysqld_safe --skip-grant-tables & # mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD("newrootpassword") where User='root'; mysql> flush privileges; mysql> quit # /etc/init.d/mysql stop # /etc/init.d/mysql start

Delete a column.

mysql> alter table [table name] drop column [column name];

Add a new column to db.

mysql> alter table [table name] add column [new column name] varchar (20);

Change column name.

mysql> alter table [table name] change [old column name] [new column name] varchar (50);

Make a unique column so you get no dupes.

mysql> alter table [table name] add unique ([column name]);

Make a column bigger.

mysql> alter table [table name] modify [column name] VARCHAR(3);

Delete unique from table.

mysql> alter table [table name] drop index [colmn name];

Load a CSV file into a table.

mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1,field2,field3);

Dump all databases for backup. Backup file is sql commands to recreate all db's.

# [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

Dump a table from a database.

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

Create Table Example 1.

mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

Create Table Example 2.

mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default 'bato');

Tuesday, 21 January 2014

Dynamically add button, textbox, input, radio elements in html form using JavaScript

Adding Elements like textbox, button, radio button etc in a html form using JavaScript is very simple. JavaScript’s document object has a method called createElement() which can be used to create html elements dynamically.
We had used this function in our tutorial: Dynamic combobox-listbox-drop-down using javascript to add dynamic options to a combo box-listbox. Let us use this function to create textboxes, radio buttons, buttons etc dynamically and add them in our page.

Following is the source code of our example.
<HTML>
<HEAD>
<TITLE>Dynamically add Textbox, Radio, Button in html Form using JavaScript</TITLE>
<SCRIPT language="javascript">
function add(type) {
    //Create an input type dynamically.
    var element = document.createElement("input");
    //Assign different attributes to the element.
    element.setAttribute("type", type);
    element.setAttribute("value", type);
    element.setAttribute("name", type);
    var foo = document.getElementById("fooBar");
    //Append the element in page (in span).
    foo.appendChild(element);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<H2>Dynamically add element in form.</H2>
Select the element and hit Add to add it in form.
<BR/>
<SELECT name="element">
    <OPTION value="button">Button</OPTION>
    <OPTION value="text">Textbox</OPTION>
    <OPTION value="radio">Radio</OPTION>
</SELECT>
<INPUT type="button" value="Add" onclick="add(document.forms[0].element.value)"/>
<span id="fooBar">&nbsp;</span>
</FORM>
</BODY>
</HTML>
Also note that we have used setAttribute() method to assign the attributes to our dynamically created element. 

Demo: CODE-PEN

Friday, 17 January 2014

How To Get Database Size in MySQL

Database Size Calculation

Using following steps you can calculate the size of the existing MySQL database:
  • 1. Open Terminal/Command prompt(Window)

    In window, Goto start-->Search cmd-->Click to open
  • 2. Change to MySQL directory


  • 3. Connect to MySQL Database

    mysql -h localhost -p -u alfresco
    Enter Password:

  • 4. Type select command to get size of a Database

    select table_schema, sum(data_length+index_length) 
    /1024 /1024 as MB from informaation_schema.tables 
    where table_schema ="datbase_name";

Thursday, 16 January 2014

How to Create Putty SSH Key For Secure Login

Create putty SSH Key for secure login you need to follow these steps:

Step 1: Download Putty gen software to create SSH key.
Step 2: Run Putty gen software and click on generate Tab.

After Click on generate tab it look like this

Step 3: Type Password on Key Passphrase box
Step 4: Type Password again for confirmation in confirm passphrase box
Step 5: Click on save public key and save file with respective user name

Step 6: Click on save private Tab and save file with .ppk extension
Below File has been created after 5th and 6th step
  • private-key.ppk
  • Public-key
Step 7: Now you can send Public key to biglobe san for update in all server.

Change Alfresco Database Connection (Alfresco 3.3 or higher)

New updated version of the Alfresco comes with PostgreSQL. If you are still using Database other than PostgreSQL, you can change the Database following given steps:
  1. Create a new "alfresco" database (Here i am assuming your current database is "alfresco")
  2. Create a new 'alfresco' user. Set this user's password to 'alfresco'. (Here i am assuming your current user name and password are "alfresco")
  3. Ensure that the alfresco user has the required privileges to create and modify tables.
  4. Verify/modify the Alfresco data location in the alfresco-global.properties file.
  5. Override some properties in alfresco-global.properties 
  6. Start the application server (eg. Tomcat) to verify your configuration changes. 
If you are using MySQL you can follow these step:
  1. Create a new "alfresco" database,here.
    CREATE DATABASE <DATABASENAME>;
  2.  Create a new 'alfresco' user. Set this user's password to 'alfresco'.
    GRANT ALL PRIVILEGES ON alfresco.* To  
    'alfresco'@'localhost' IDENTIFIED BY 'alfresco';
  3. Ensure that the alfresco user has the required privileges to create and modify tables 
  4. Verify/modify the Alfresco data location in the alfresco-global.properties file. 
  5. Override some properties in alfresco-global.properties
    db.name=alfresco
    db.username=alfresco
    db.password=alfresco
    db.host=localhost
    db.port=3306
    db.driver=org.gjt.mm.mysql.Driver
    db.url=jdbc:mysql://${db.host}:${db.port}/${db.name}
    db.pool.validate.query=select 1
    To recover all index back. You have to override these properties.
    db.schema.update=true
    index.recovery.mode=FULL
    db.schema.update.lockRetryCount=24
    db.schema.update.lockRetryWaitSeconds=5
  6. Start the application server (eg. Tomcat) to verify your configuration changes.  

PostgreSQL example 

The following properties needs to change:  
alfresco-global.properties:
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=5432
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://${db.host}:${db.port}/${db.name}
Ensure that the postgresql.conf file (pg_hba.conf for postgres 8.1.3) (refer to PostgreSQL documentation for more info on this file) contains:
host    all    all    127.0.0.1/32    password

Oracle example 

The following properties needs to change:  
alfresco-global.properties:
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=1521
db.driver=oracle.jdbc.OracleDriver
db.url=jdbc:oracle:thin:@${db.host}:${db.port}:<database sid>
db.pool.validate.query=select 1 from dual 

Microsoft SQL Server example

The following properties needs to change:  
alfresco-global.properties:
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=1433
db.driver=net.sourceforge.jtds.jdbc.Driver
db.url=jdbc:jtds:sqlserver://${db.host}:${db.port}/${db.name}
db.txn.isolation=4096
db.pool.validate.query=select 1

DB2 example

The following properties needs to change:  
alfresco-global.properties:
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=50000
db.driver=com.ibm.db2.jcc.DB2Driver
db.url=jdbc:db2://${db.host}:${db.port}/${db.name}

Tips:

For Mor Informaton: Database_Configuration

Source : http://wiki.alfresco.com/wiki/Database_Configuration

Wednesday, 15 January 2014

How to Create a Database in MySQL

MySQL can be an intimidating program. All of the commands have to be entered through a command prompt; there is no visual interface. Because of this, having basic knowledge of how to create and manipulate a database can save you a lot of time and headaches. Follow this guide to create a database of US states and their populations

Creating and Manipulating a Database

    1. Create the database.  From the MySQL command line, enter the command CREATE DATABASE <DATABASENAME>;. Replace <DATABASENAME> with the name of your database. It cannot include spaces.
    For example, to create a database of all the US states, you might enter CREATE DATABASE us_states;
    Note: Commands do not have to be entered in upper-case.
    Note: All MySQL commands must end with ";". If you forgot to include the semicolon, you can enter just ";" on the next line to process the previous command.
    1. Display a list of your available databases. Enter the command SHOW DATABASES; to list all of the databases you have stored. Besides the databse you just created, you will also see a mysql database and a test database. You can ignore these for now.   

    1. Select your database. Once the database has been created, you will need to select it in order to begin editing it. Enter the command USE us_states;. You will see the message Database changed, letting you know that your active database is now us_states.

    1. Create a table. A table is what houses your database’s information. To create one, you will need to enter all of your table formatting in the initial command. To create a table, enter the following command: CREATE TABLE states (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, state CHAR(25), population INT(9));. This will create a table named "states" with three fields: id, state, and population.
    • The INT command will make the id field contain only numbers (integers).
    • The NOT NULL command makes sure that the id field cannot be left blank.
    • The PRIMARY KEY designates the id field as the key field in the table. The key field should be set to a field that cannot contain any duplicates.
    • The AUTO_INCREMENT command will automatically assign increasing values into the id field, essentially automatically numbering each entry.
    • The CHAR(characters) and INT(integers) commands designate the types of data allowed in those fields. The number next to the commands indicated how many characters or integers can fit in the field.

    1. Create an entry in the table. Now that the table has been created, it’s time to start entering your information. Use the following command to input your first entry: INSERT INTO states (id, state, population) VALUES (NULL, ‘Alabama’, ‘4822023’);
    • This is essentially telling the database to enter the information provided into the three corresponding fields in the table.
    • Since the id field contains the command NOT NULL, entering NULL as the value will force it to automatically increment to 1, thanks to the AUTO_INCREMENT command.

    1. Create more entries. You can create multiple entries using a single command. To enter the next three states, use the following command:INSERT INTO states (id, state, population) VALUES (NULL, ‘Alaska’, ‘731449’), (NULL, ‘Arizona’, ‘6553255’), (NULL, ‘Arkansas’, ‘2949131’);. This will create a table that looks like the following:

source: wikihow

Job Openings in NEC Technologies India Ltd

Job Openings in NEC Technologies India Ltd
download
Please find below JD:
S.No Job Code Positions Brief Skill set #
S.No Job Code Positions Brief Skill set # Year of experience No of Positions
1 ISD-SMTS-01 Sr MTS Oracle PLSQL Development 4-6 1
2 ISD-M-02 Manager PMP (Desirable), understanding of CMMI, quantitative project management, understanding of web based enterprise project lifecycle 7-8 2
3 ISD-Des-03 Designer GUI Designer, Photoshop , HTML, CSS 4-6 2
4 ISD-STE-04 Sr. Test Engineer 3-5 years of Testing experience as a Sr. test engineer or Lead test engineer on Microsoft solutions or JAVA and OSS based products. (Preferrably Finance Domain) 3-5 2
5 ISD-SMTS-05 Sr MTS .Net Developer 3-5 2
6 ITPF=SMTS-06 Sr MTS Java Developer (Struts and Linux) 4-6 2
7 ITPF-SMTS-07 MTS / Sr MTS C++ Linux (Template programming, STL on linux) preferrably from storage domain 2-5 3
8 ITPF-SMTS-08 Sr MTS C++ Linux 3-4 3
9 ITPF-SPM-09 Sr. Project Manager PMP (Desirable), understanding of CMMI, quantitative project management, understanding of web based enterprise project lifecycle 10-12 1
10 GBES-LSE-10 L2 Support Engineer Windows Admin (Understanding of active directory, office 365, MS technologies) 2-4 1
11 GBES-LS-11 L1 Support (Japanese Bilingual) N3/ N2 resource for helpdesk support 2-4 1
12 GBES-MR-12 Market Research Identifying market opportunities, Analysis after data collection, Designing and conducting surveys, Creating deliverables and reports for clients. Education: MBA + B.tech 1-2 1
13 Support-HER-13 Executive-HR Education: B.Tech + MBA (Generalist profile) 1-3 1
14 Support-RC-14 Recruitment – Contractual B.Tech+MBA (Recruitment Profile) 0-1 1
15 NEAD-DQAE-15 DQA Engineers 2-5 Yrs of Exp (Telecom product (PBX/ IPBX testing) 2-5 12
16 NEAD-DQAL-16 DQA Lead 2-5 Yrs of Exp (Telecom product (PBX/ IPBX testing) 5-8 1
17 NEAD-M-17 Manager Networking Domain 7-8 2
18 NEAD-M-18 Manager Network Testing 7-8 1
19 NEAD-L-19 Lead Network Testing 5-7 1
20 NEAD-PM-20 Project Manager Wireless domain 7-8 1
21 NEAD-E-21 Engineers Network Engineers (Wireless domain) 1-4 5
22 NEAD-E-22 Engineers Network Engineers (Datacom domain) 1-4 4

Please send your profile on below mail-id, if your profile matches the requirement:-
deepak.m.shrma@gmail.com

Last Date of submission: 20-Jan-2014

Tuesday, 14 January 2014

Why Alfresco ECM (Enterprise Content Management) system?


The paper shows that for document management plus collaboration and integration with SharePoint, you’d have to pay EMC/Documentum $863,937.98 for a 1000 user configuration as opposed to $318,738 for SharePoint and $33,500 for Alfresco for similarly-sized systems with equivalent functionality. Those numbers exclude the supporting infrastructure software.

The most popular, reliable and one of the best content management systems of the world,

It allows for management of data of any format (not only document content and images) via free repository,

Rich collaboration tools,

It enables easy web designing for people, who are not familiar within the area of IT,

Additional functionality to edit and manage image files,

No license charge - due to the fact that Alfresco software is available under Open Source license, it is totally free;

Total freedom in software modifying to fulfil customers needs due to Open Source license,

Dynamic development - free access to current updates and rich functionality (which is constantly being extended by Alfresco community),

Scalability - the system does not lose efficiency when its complexity grows,

Compatibility with the most used operation systems like Linux or Windows,

Full integration with popular office suites, like Microsoft Office or OpenOffice.org.
Target Customer
Alfresco is made for people who want to do great work. Your content is your business: Strategic plans. Customer profiles. Sales presentations. Invoices. Contracts.