Play the Anna Game... Support LokPal

Steve Jobs resigns as Apple CEO

Tim Cook Named CEO and Jobs Elected Chairman of the Board






Apple’s Board of Directors today announced that Steve Jobs has resigned as Chief Executive Officer, and the Board has named Tim Cook, previously Apple’s Chief Operating Officer, as the company’s new CEO. Jobs has been elected Chairman of the Board and Cook will join the Board, effective immediately.
“Steve’s extraordinary vision and leadership saved Apple and guided it to its position as the world’s most innovative and valuable technology company,” said Art Levinson, Chairman of Genentech, on behalf of Apple's Board. “Steve has made countless contributions to Apple’s success, and he has attracted and inspired Apple’s immensely creative employees and world class executive team. In his new role as Chairman of the Board, Steve will continue to serve Apple with his unique insights, creativity and inspiration.”
“The Board has complete confidence that Tim is the right person to be our next CEO,” added Levinson. “Tim’s 13 years of service to Apple have been marked by outstanding performance, and he has demonstrated remarkable talent and sound judgment in everything he does.”
Jobs submitted his resignation to the Board today and strongly recommended that the Board implement its succession plan and name Tim Cook as CEO.
As COO, Cook was previously responsible for all of the company’s worldwide sales and operations, including end-to-end management of Apple’s supply chain, sales activities, and service and support in all markets and countries. He also headed Apple’s Macintosh division and played a key role in the continued development of strategic reseller and supplier relationships, ensuring flexibility in response to an increasingly demanding marketplace.


Apple designs Macs, the best personal computers in the world, along with OS X, iLife, iWork and professional software. Apple leads the digital music revolution with its iPods and iTunes online store. Apple has reinvented the mobile phone with its revolutionary iPhone and App Store, and has recently introduced iPad 2 which is defining the future of mobile media and computing devices.
 
 
-- From Apple

Calculate age using MySQL


Calculate age using MySQL

SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),”1978-03-28″)), ‘%Y’)+0 AS age

1:- DATEDIFF(NOW(),”1978-03-28″)
This function DATEDIFF() returns difference of two dates in days, e.g. DATEDIFF(“1978-04-28″, “1978-03-28″) will return 31 days. So by using NOW() i.e. current date, in the above query, we get, say, 10744 days.

2:- FROM_DAYS(10744)
retuns the date starting from 0000-00-00 i.e. since year 0… so this function outputs “0029-06-01″, i.e. the difference between two dates “1978-03-28″ & “2008-08-27″ is precisely 29 years, 6 months & 1 day. We need just years, so we use

3:- DATE_FORMAT(“0029-06-01″, %Y) +0
and it returns us 29 as an integer value.


SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(“1978-03-28″)), ‘%Y’)+0 AS age

1:- TO_DAYS(“1978-03-28″)
The only new function in this query is TO_DAYS(date), which converts our date to number of days starting from year 0 i.e. the opposite of function FROM_DAYS(days). So this gives us 722536 days. The other function TO_DAYS(NOW()) returns us 733280 days (for 2007-08-27). Subtracting the two, we get 733280 – 722536 = 10744 days. From here on, we move on to step 2 in the above scenario.


SELECT EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(),”1978-03-28″))))+0 AS age

1:- EXTRACT(YEAR FROM “0029-06-01″) +0
Taking the queue from step 2 in the first scenario, FROM_DAYS(10744) we apply another function. EXTRACT(date) which extracts a part from the given date as per the format, here YEAR, and it returns us 29 as an integer value.

This last query using EXTRACT() method is a bit slower than the one using DATE_FORMAT() – (.0001 sec). All these queries return the age in y

MySQL Select NULL

MySQL Select NULL


How to select rows from MySQL table where certain field is empty is a problem i stuggled against for a while like … 10 minutes or so, while solution is quite simple. Remember that it will work with MySQL this solution was not tested with other databases and as far as i am concerned it does not work with Sybase.


SELECT * FROM `table` WHERE `field1` IS NULL
There is also variations for this:


SELECT * FROM `table` WHERE ISNULL(`field1`)
While browsing MySQL documentation i found one more interesting function IFNULL(expr1, expr2). What it basically do is: if expr1 is NULL then it returns expr2 else it returns expr1. Here is a sample usage:


mysql> SELECT IFNULL(1,0);
-> 1
mysql> SELECT IFNULL(NULL,10);
-> 10
mysql> SELECT IFNULL(1/0,10);
-> 10
mysql> SELECT IFNULL(1/0,'yes');
-> 'yes'
That’s it for now, i hope you will find it helpful.

Text Area (or) TextBox Maxlength doest not work when TextMode is set to Multiline


TextArea TextBox Maxlength doest not work when TextMode is set to Multiline

Hi,
This is known issue in ASP.NET Standard Text box control when set its TextMode="MultiLine" the MaxLength property does not work.
There is a workaround to accomplish this using RegularExpressionValidator. Following is the markup that will restrict the text box to maximum of 500 characters.

<asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine" Height="100px"
Width="320px" MaxLength="10">asp:TextBox> <asp:RegularExpressionValidator
ID="regComments" runat="server" ControlToValidate="txtComments"
ValidationExpression="^[\s\S]{0,500}$" ErrorMessage="Maximum 500 characters are allowed in comments box." Text="Maximum 500 characters are allowed in comments
box." > asp:RegularExpressionValidator

MySQL: Solution for ERROR 1442 (HY000): Can’t update table ‘t1′ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.


MySQL: Solution for ERROR 1442 (HY000): Can’t update table ‘t1′ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
Posted in CentOS, Enterprise level solutions, Linux Apache MySQL PHP, MySQL, MySQL Triggers on

Here is a sample table you can create to test following problem/solution on:

CREATE TABLE `t1` (
`a` char(1) default NULL,
`b` smallint(6) default NULL
);
insert into t1 values ('y','1');

I have a table t1 which has column a and b, I want column a to be updated to ‘n’ when column b = 0. Here is the first version I created:

DELIMITER |
CREATE TRIGGER trigger1 AFTER UPDATE ON t1
FOR EACH ROW UPDATE t1 SET a= 'n' WHERE b=0;
|
DELIMITER ;

The trigger created successfully but I got this error when I tried to do an update on column b on table t1:
mysql> update t1 set b=0;
ERROR 1442 (HY000): Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

After searching online for a while and trying different solutions, I finally found a way to update the table which has trigger on it:

drop trigger trigger1;
DELIMITER |
CREATE TRIGGER trigger1 BEFORE UPDATE ON t1
FOR EACH ROW
BEGIN
IF NEW.b=0 THEN
SET NEW.a = 'n';
END IF;
END
|
DELIMITER ;

After the new trigger is in, I issued the same update query and “ERROR 1442 (HY000): Can’t update table ‘t1′ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.” didn’t show up and it updated the col a value to “n” as it suppose to.

mysql> update t1 set b=0;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from t1\G
*************************** 1. row ***************************
a: n
b: 0

Therefore, if you want to create a trigger on the table which will update itself, make sure you use the NEW.column_name to refer to the row after it’s updated and don’t do the full update statement!

However, if you are updating some other table, then you can use the regular update statement:

DELIMITER |
CREATE TRIGGER trigger1 AFTER UPDATE ON t1
FOR EACH ROW UPDATE t2 SET a= 'n' WHERE b=0;
|
DELIMITER ;

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

Shared in googledotnet by Manivannan N

How to get a resource file value dynamically ?

How to get a resource file value dynamically ?

lblResult.Text = GetGlobalResourceObject("Message","rfvEmailId").ToString();

In Message.resx, in App_GlobalResource

there will be a input

Name: rfvEmailId &
Value: Please enter the Email Id


Import an Excel, CSV, txt file into MySQL

Import an Excel, CSV, TXT file into MySQL


LOAD DATA LOCAL INFILE 'C:\\temp\\ListOfCountries.csv'
INTO TABLE [Table Name]
FIELDS TERMINATED BY ''
LINES TERMINATED BY '\r\n'
([Field1],[Field2]);

Stop Sharing a Folder or Drive

Stop Sharing a Folder or Drive
Applies To: Windows 7, Windows Server 2008 R2
You can stop sharing a folder or drive by using the Shared Folders Microsoft Management Console (MMC) snap-in or by using a command prompt.
Description: ImportantImportant
Users connected to a shared folder are disconnected when you stop sharing it. Users may lose data if you stop sharing a folder containing an open shared file without warning. When possible, notify users before you stop sharing a folder.
Stop sharing a folder or drive
To stop sharing a folder by using the Windows interface
1.     Open Computer Management. To do so, click Start, then right-click Computer, and then click Manage.
2.     If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.
3.     In the console tree, click System Tools, then click Shared Folders, and then click Shares.
4.     In the details pane, right-click a shared folder, and then click Stop Sharing (this item only appears if you launched Computer Management using an account that is a member of the local Administrators group).
To stop sharing multiple files, press the CTRL key while clicking the file names, right-click any one of the selected files, and then click Stop Sharing. This removes shared network access to the selected files.
To stop sharing a folder by using a command line
1.     To open an elevated Command Prompt window, click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.
2.     If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.
3.     Type:
net share  /delete.
For example, to stop sharing a folder called myshare, type:
net share myshare /delete
Value
Description
Net share
Creates, deletes, or displays shared folders.
The network name of the shared folder.
/delete
Stops sharing the folder.

Description: noteNote
To view the complete syntax for this command, at the command prompt, type: net help share

How to get a resource file value in label

how to get resource value in label asp.net


Text="<%$ Resources:[Name of .resx file ], [key] %>"

Ex: 

<asp:Button ID="Button1" Runat="server" meta:resourcekey="ButtonResource1" Text="English Button" />

Your label's text attribute now has an explicit expression stating the base file from which to retrieve the resource and the key to select.

test

test

Keep ur coding aside.. Relax for some time..