To set the width of a tab in TabHost
tabHost.getTabWidget().getChildAt(0).setLayoutParams(new LinearLayout.LayoutParams(80,50));
Sending Email from an Android Device
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String[] recipients = new String[]{"mschumacher@f1.com", "rbarichello@f1.com"};
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message");
emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Choose Mail Client..."));
Wednesday, August 17, 2011
Wednesday, August 10, 2011
MySQL Remote Access under Linux Box
Lets try to allow mysql to grant access from remote machines.
Lets assume, Machine1 tries to connect to Machine2's MySQL Database.
Machine1 IP: 192.168.1.1
Machine2 IP: 192.168.1.2
Configuration Steps :
1. On Machine2, edit the /etc/mysql/my.cnf configuration file
Note :This might require superuser privileges.
1.1 Modify the below line in my.cnf file
bind-address = 127.0.0.1
with
#bind-address = 127.0.0.1
Basically, we are making Machine2 to listen connections from
remote machines.
2. On Machine2, Execute the below command in MySQL Command Prompt
mysql>GRANT ALL ON *.* to root@192.168.1.1 IDENTIFIED BY 'machine1pwd';
mysql>FLUSH PRIVILEGES;
Syntax: GRANT ALL ON *.* to machine1-user-name@machine1-ip IDENTIFIED BY 'machine1-password';
3. Restart the MySQL Server on Machine2
/etc/init.d/mysql restart
4. Time to do a test.
From Machine1's Terminal, execute the below command
>mysql -u root -h 192.168.1.2 -pmachine1pwd;
This should take you to Machine2's MySQL Command Prompt.
That's it.
Lets assume, Machine1 tries to connect to Machine2's MySQL Database.
Machine1 IP: 192.168.1.1
Machine2 IP: 192.168.1.2
Configuration Steps :
1. On Machine2, edit the /etc/mysql/my.cnf configuration file
Note :This might require superuser privileges.
1.1 Modify the below line in my.cnf file
bind-address = 127.0.0.1
with
#bind-address = 127.0.0.1
Basically, we are making Machine2 to listen connections from
remote machines.
2. On Machine2, Execute the below command in MySQL Command Prompt
mysql>GRANT ALL ON *.* to root@192.168.1.1 IDENTIFIED BY 'machine1pwd';
mysql>FLUSH PRIVILEGES;
Syntax: GRANT ALL ON *.* to machine1-user-name@machine1-ip IDENTIFIED BY 'machine1-password';
3. Restart the MySQL Server on Machine2
/etc/init.d/mysql restart
4. Time to do a test.
From Machine1's Terminal, execute the below command
>mysql -u root -h 192.168.1.2 -pmachine1pwd;
This should take you to Machine2's MySQL Command Prompt.
That's it.
Subscribe to:
Comments (Atom)