Thursday, August 30, 2012

Microsoft Office Communicator (OCS) Client for MAC OS X


I've been search around to get a free Microsoft Office Communicator (OCS) Client for MAC OS X but I could not find it anywhere. 

Until recently Microsoft provided a single Messenger for Mac that was used for connecting to both - MSN Public IM Network as well as Private Office Communication Server (OCS). But with the release of Office 2011 Microsoft changed that altogether... Now there are 2 separate products - MSN Messenger which is still free but works only for Microsofts Public IM Network and Communicator for MAC which now comes bundled with Office 2011 for MAC and is not free.

So guys, forget getting it for free now, you are forced to buy a license for Office 2011 to get OCS now. 

Tuesday, August 28, 2012

Query to Find MySql DB and Table Sizes


To Find MySql DB Sizes

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;

More Informative query is: 


SELECT IFNULL(B.engine,'Total') "Storage Engine", CONCAT(LPAD(REPLACE(FORMAT(
B.DSize/POWER(1024,pw),3),',',''),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Data Size",
CONCAT(LPAD(REPLACE(FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ',
SUBSTR(' KMGTP',pw+1,1),'B') "Index Size",CONCAT(LPAD(REPLACE(FORMAT(B.TSize/
POWER(1024,pw),3),',',''),17,' '),' ',SUBSTR(' KMGTP',pw+1,1),'B') "Table Size"
FROM (SELECT engine,SUM(data_length) DSize,
SUM(index_length) ISize,SUM(data_length+index_length) TSize FROM information_schema.tablesWHERE table_schema NOT IN ('mysql','information_schema','performance_schema') AND
engine IS NOT NULL GROUP BY engine WITH ROLLUP) B,(SELECT 2 pw) A ORDER BY TSize;


To Find Individual MySql Table Sizes


SELECT TABLE_NAME, table_rows, data_length, index_length, 
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "schema_name";
Replace "schema_name" with your database name. 

Monday, August 27, 2012

Resetting macbook to factory settings without CD/DVD

Install or Reinstall Lion from Scratch

1. Backup your existing data. 
2. Restart and Hold down Command + R key until menu appears. 
3. Select Disk Utility from Menu and Continue. 
4. Once DU is loaded select your drive.
5. Check the status of your drive. If it does not say "Verified" that means your hard drive has already failed or it is about to fail. This is a permanent hardware failure and drive should be replaced at this time.
6. If you Drive was Verified, then click Erase from Menu. 
7. Select Format Type to MAC OS Extended and Erase. Wait until the process is completed.
8. Quit DU and come back to main menu. 
9. Select "Reinstall Lion" and click Install. This should start the Lion installation. Follow online instructions to complete the process.   

Friday, August 24, 2012

How to check if MySql table supports utf8 format


The best way to find if a MySql table is in UTF-8 format is to query the information schema. 

Use below query: 


select c.character_set_name from information_schema.tables as t,
     information_schema.collation_character_set_applicability as cwhere c.collation_name = t.table_collationand t.table_schema = "your_db"
and t.table_name = "table_name";


This would work with just mysql version >= 5.0.

Enjoy. 

Wednesday, August 22, 2012

Unable to connect - MFEWSErrorDomain error 56


Unable to connect - MFEWSErrorDomain error 56 using MAC Mail Client connecting to Exchange

I spent days troubleshooting my MAC mail client problem connecting to Exchange Server. 

Couple of things you should check for this are: 

1. You are able to connect to your Exchange Server. 
2. The Error above definitely means some incorrect settings. A common one is Mail > Preferences -> Accounts -> Advanced Look for Internal Server Path. If the Internal Server Path is set to EWS/webservices.aspx change it to to: EWS/exchange.asmx and retry. 
3.  Check Ports on which you are trying to connect to. 


Sunday, August 19, 2012

Find files created in last 24 hours in unix

This can be easily achieved by using the find command. 

find [path] [options]

See man page for detailed options of find command. 

find . -ctime -1 # finds files which are created in less then 1 day from currrent folder.
find . -ctime +2 # finds files which are created older then 2 days from currrent folder.


Enjoy. 

How to find out directory size in ubuntu from terminal


Commands like ls -l or df -h show me the file sizes or disk space utilization but none of them show me the size of a directory.

To see the directory size in ubuntu from terminal or command line use the command du as below. 


du -hs /path/to/folder


Where,.  

 -h is for displaying the size in human readable format. Like in MB or GB etc.
-s is for summary.  

Tuesday, August 14, 2012

uBuntu Linux find if package is installed in Linux from Terminal


In Debian / Ubuntu


Find if package is installed or not
dpkg -s ttf-mscorefonts-installer

Where ttf-mscorefonts-installer is the package name that I want to find out if it is installed or not. 

Other useful commands are: 

To print a list of packages installed on the system. 
dpkg-query -l

List of packages installed on the system that start with "ttf"
dpkg-query -l 'ttf*'


In Red Hat Enterprise / Fedora Linux / Suse Linux / Cent OS


$ rpm -qa | grep ttf-mscorefonts-installer


Monday, August 13, 2012

Simple PHP script for sending emails


Here is a simple PHP emailer script.

<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

Saturday, August 11, 2012

Show form element values in PHP



The below code reads all form variables and prints them. 

<?php
$keys =array_keys($_POST); // store all variable names into a numericaly indexed array begining at 0
for ($i =0; $i <count($keys); $i++) // go trought the created array and do....
{
echo $keys[$i] . ": " . $_POST[$keys[$i]] . "<br>\n"; // print data in the format var_name: var_value
}
?>


Wednesday, August 8, 2012

Amazon RDS Limitations


Amazon RDS Limitations


  • Amazon's RDS service does not provide a shell access the to the machine where it is running. That means we cannot install our own software in that machine. For example we cannot install our own favorite monitoring software in that machine.
  • We need to depend heavily on using Amazon Cloudwatch to monitor RDS instances. 
  • Database Replication support is still at preliminary stage.
  • Database Clustering is not supported yet.
  • We don't have direct access to MySQL configuration. For any configurations we want to do, we need to do it via DB Parameter group using command line tool.
  • Autoscaling is still not supported.
  • Accessing RDS instance is not provided through same API's as EC2. For example you cannot use Elastifox to access your RDS instance.
  • When a DB Instance changes database parameter groups (i.e. it stops using its current DB Parameter Group and starts using another), it must be restarted. However when adding or modifying a parameter the rebooting may depend on whether the add/modify parameter is dynamic or static. 

Amazon RDS Instance Sizes and Maximum concurrent connections



RDS Class  max_connections innodb_buffer_pool_size---------  --------------- -----------------------
t1.micro   34              326107136
m1-small   125             1179648000
m1-large   623             5882511360
m1-xlarge  1263            11922309120
m2-xlarge  1441            13605273600
m2-2xlarge 2900            27367833600
m2-4xlarge 5816            54892953600

Some Important Points when working with Amazon RDS: 

1. You are not given SUPER privilege and there is no direct access to my.cnf
2. To change startup options of MySQL you need to create your own DB Parameter Group and change its default values using RDS CLI.