Uncategorized

Good analysis on Microsoft vs Apple strategies

In pursuing your MBA, some of the most important lessons you’ll learn come from looking at the example set by big businesses gone before you. From the good to the mediocre to the downright ugly, there are plenty of businesses to base your own decisions on, whether you’re trying to determine what to do or what not to do in a business situation.

Today’s infographic examines a prime instance of a company that has seen great success, and yet doesn’t seem to be going anywhere in the modern industry: This company is the well-known titan Microsoft. Under the watchful, savvy eye of Bill Gates, Microsoft grew and flourished quickly, enjoying a great deal of success in its early years. But since its boom in the first wave of the tech era, Microsoft has slowly but surely stagnated and fallen into the shadow of successful innovators, specifically, Apple, for example.

Uncategorized

Google Glasses

riteshkamal

Sunglasses – What purpose do they serve?

They protect your eyes? – correct!
They add to their style? – correct!

What if I tell you they can tell you who the person, you looking at, is?
How many common friend do you both share on a social networking site?
Entertainment, games and lot more – GOOGLE will bring this to you with GOOGLE Glasses.

Later this year, Google is expected to start selling eyeglasses that will project information, entertainment and, this being a Google product, advertisements onto the lenses.
The glasses are not being designed to be worn constantly — although Google engineers expect some users will wear them a lot — but will be more like smartphones, used when needed, with the lenses serving as a kind of see-through computer monitor.

The glasses will use the same Android software that powers Android smartphones and tablets. Like smartphones and tablets, the glasses will be equipped with GPS and motion sensors. They will also contain a camera and audio inputs and outputs.

the location information was a major feature of the glasses. Through the built-in camera on the glasses, Google will be able to stream images to its rack computers and return augmented reality information to the person wearing them. For instance, a person looking at a landmark could see detailed historical information and comments about it left by friends. If facial recognition software becomes accurate enough, the glasses could remind a wearer of when and how he met the vaguely familiar person standing in front of him at a party.
They might also be used for virtual reality games that use the real world as the playground.

When someone is meeting a person for the first time, for example, Google could hypothetically match the person’s face and tell people how many friends they share in common on social networks.

Source : Newyork Times

Root password lost – recover it here!

Need to login on to LINUX machine – but don’t have the privilege? – or want to gain root privilege?
Pre Requisite – you need the access physical or command line or console access to reboot the machine.

Follow the steps :-

  1. The very first screen when you restart the linux machine – press an enter or space whichever works and this will take you to the snapshot of step 2.

Kernel menu

                                                                                Fig 1

  1. You will get this screen –

edit-mode-option

                                                                                Fig 2

Press Enter. You will get the screen in Fig.3

Kernel console

                                                                                Fig 3

Press e in the end of 2nd line , the one starting with kernel, to enter the edit mode.

  1. You will get the screen in fig 4, add “s” at the end to login next time in single user mode Type Enter

single user mode

4. After the step 3 you will get this screen, press b to reboot.

After single user edit

  1. After the reboot, below is the screen you will get-

After Reboot

Now you can change the password by typing passwd,it won’t ask you this time for the old password.

password change

Now, you have successfully changed the root password.

PS : Remove thes “, that you have put in there previously by using the same procedure. And next time you reboot you can login as root!!

Any query/help/suggestion/feedback regarding this is welcome. Please feel free 🙂 

Triggers and Procedures in MySQL

Introduction
MySQL Triggers
are one of the newer features in MySQL that are helping to make it a viable alternative for large enterprise applications. So, what are MySQL triggers, and why does MySQL's ability to use them make it more attractive to serious database users?

Simply put, triggers are small programs that are stored in the database itself, and are activated by database events which often originate at the application layer. These precipitating database events are UPDATE, DELETE or INSERT queries.

The trigger itself may execute before or after the query that initiates it. Triggers are often used to maintain the integrity of data across tables of an application.
When a user on a website makes a purchase, for example, the first action that occurs in the database may be that a credit is inserted into an accounting table. By way of a trigger this action could initiate a chain reaction of events in other tables throughout the application. The product count of an item could be decremented in an inventory table, a debit deducted from a customer's account balance in another table, a store credit applied to yet another table.

Why to use procedures

You may say that you have been doing this all along in your applications using PHP or Perl or Python or ASP code. What's the big deal about using MySQL triggers? Well, there are some advantages to using triggers over application code for maintaining integrity of data across tables.

A trigger generally performs the types of tasks described faster than application code, and and can be activated easily and quickly behind the scenes and does not need to be a part of your application code. This saves time and spares you from redundant coding. If you ever port your application to another language, chances are your triggers can stay in place without modification, along with your tables and other database objects.

Explanation

To demonstrate how MySQL triggers work, let's set up two simple tables on a database we'll call “sales_records” that have data that is interdependent. Imagine a database that tracks the sales records of three salespeople at a department store.
They work in the electronics department selling things like TVs , stereos, and MP3 players. We have the main table that keeps a record of each sale made. It records the amount of the sale (sale_amt), the date (date), the name of the salesman (name), his id number (employee_id), and the product id (prod_id). We'll call this table (cleverly enough) “sales”.

In the second table, we want to keep some data that will allow us to easily keep track of how each salesperson is doing. It will include the salesperson's id (employee_id), name (name), total number of sales (total_sales), and a column that keeps each salesperson's average amount per sale (ave_sale). We want to see who's moving the high-end items. We'll call this table “performance”.

How to use Triggers and Procedures

Now comes the hard part. As I mentioned, triggers are database objects just as tables are. Triggers, however, are able to execute procedural code that modifies data in your tables. In this case, we want our trigger to fire before any INSERT statement that executes in the sales table. When a sale record is inserted in the sales table, the salesperson's totals must be updated in the performance table. The following code can be typed in your favorite text editor and pasted into your console at the MySQL prompt.

Before you do that though, you want to execute this line: mysql: Delimiter $$ Our procedural code uses semicolons at the end of statements, so we need to set a different delimiter to let MySQL know when our code block is over, and so that it doesn't stop processing our block when it hits a semicolon. Keep in mind that after you finish your block you will have to set the delimiter back to the semicolon, or end any subsequent commands with the new delimiter.

For example if you made errors in your CREATE TRIGGER block and want to delete it, DROP TRIGGER; won't work unless you set the delimiter back to the semicolon. Here is the code for the trigger: OK, let's talk about the code.

  • Using the CREATE TRIGGER statement, we've initiated the trigger, naming it 'sales_bi_trg'. MySQL triggers can fire before or after an INSERT, UPDATE or DELETE event.
  • This one fires before any data is inserted in the 'sales' table. The FOR EACH ROW clause signifies that the block will act on each row that meets the criteria of our SQL statements.
  • The keywords BEGIN and END enclose the trigger statements that will execute when the trigger fires.
  • There are two variables declared. The first is 'num_row' which checks to see if the employee has who has made the sale that is to be entered, has had a sale entered in the performance table previously. If there are no employee_id's that match, then this is the employee's first sale, and this meets the 'ELSE' condition of our “IF' statement. This data will be entered as an insert in the performance table rather than an update. If the 'num_row' is greater than 0, then the performance table will be updated. The second variable, 'tot_rows', is a count of how many sales the employee has in the 'sales' table. This value is used to calculate the employee's average sale.
  • The count is being done before the sale is inserted in the sale table, so we have to add one to it. When the 'performance' table is updated the average sale = total_sales/(tot_rows+1).
  • If our MySQL trigger is working correctly, the 'performance' table will keep a running total of each salespersons total sales, and also the average amount of their total sales. It will do this independently of your application code and be portable to any application platform. To give it a whirl, insert some data into the 'sales' table and monitor the content of the 'performance' table. Here is the statement: Change the numbers and names and try it a few times. (Remember, an employee keeps the same employee_id number for each of his sales.)

If you're feeling adventurous, start thinking about how the MySQL trigger would have to be extended to account for UPDATE and DELETE statements on the 'sales' table. Another eg :

create trigger tb1_bi_trg before insert on tb1 for each row begin declare rnk int;
select new.rank into rnk;
if rnk<=4 then insert into tb2 set salary=5000;
else insert into tb2 set salary=2000;
end if;
end
create view v as select rank,name,marks*rank as income from tb1;

Another eg :
CREATE TABLE Employee1( id int, first_name VARCHAR(30), last_name VARCHAR(15), start_date  DATE, end_date      DATE, city  VARCHAR(10), description   VARCHAR(15) );

insert into Employee1 values (01,'Girish','Tewari','20081225',  '20100625','Nainital','Programmer');

insert into Employee1 values (02,'Komal','Choudhry','20071122', '20100421','Meerut','Programmer');

insert into Employee1 values (03,'Mahendra','Singh','20061012',  '20070512','Lucknow','Programmer');

select * from employee1;

CREATE TABLE Employee_log( user_id       VARCHAR(15), description   VARCHAR(100) );

CREATE TRIGGER Employee_Trigger AFTER UPDATE ON employee1
                 FOR EACH ROW BEGIN INSERT into Employee_log (user_id, description)
                VALUES (user(), CONCAT('Id with ',NEW.id,' is modified ', ' from ',OLD.start_date, ' to ', NEW.start_date));
END$$

update employee1 set start_date='20061231';
PROCEDURES : delimiter // create procedure procedure_name begin select * from table_name; end delimiter ;

Now call the procedure call procedure_name(); it will shows all the contents of the table table_name. declaring variable in a procedure : After "begin" just write the followings declare variable_name datatype(size) default default_value; eg: declare x int default 0 we can also declare more than 1 variables at a time declare x,y int default 0

Assigning variables
declare total_count int default 0 set total_count = 10;
declare total_products int default 0 select count(*) into total_products from products;

In mysql console you can see what you have written in the procedure i.e you can see the code of the procedure by using :

select body, definer, (and/or any other column available) from mysql.proc where name='your_procedure'

Drupal installation problem in your system

Drupal Installation SolutionIf drupal is not working in your Windows(like if you have tried installing drupal but it’s giving some errors). Try these (worked for me) –

1. Increase PHP’s memory settings by doing
a)      Click on the WAMP icon in your system tray (or wherever it is just click on it). It will show you all the options like Apache, Mysql, PHPadmin, Localhost etc.
b)      Select Config files (in newer versions ) or PHP (in old versions) —-à then click on PHP.ini
c)       Go to line “upload_max_filesize=2M”, change it to 32 M or more
d)      Save and restart WAMP

2. Got an ERROR : C:\WAMP\www\includes\file.inc on line 911 –
Do this : Go to the line where it is written “elseif ($depth>=$min_depth && ereg($mask, $file))” change ereg to mb_ereg

3. Setup Database problem

a) First create a database named drupal or whatever you want.

b) Enter the database username as root and password “”[null]
Keep in mind : When you are renaming the default_settings.php to settings.php then make sure you are copying the content of default_settings.php & renaming it to settings.php.
Keep this file in  sites\default. After doing all this I got my drupal site , hoping the same for you. Cheers!