send email from console or cmd using telnet

A simple way of verifying the connectivity and right functionality of your mail server. This is done in ubuntu. The same should work for windows also.

The commands are highlighted

pandian@Kannan:~$ telnet smtp.myhost.com 25
Trying 209.237.134.152…
Connected to mymail.myregisteredsite.com.
Escape character is ‘^]’.
220 mymail.myregisteredsite.com ESMTP
HELO myhost.com
250 mymail.myregisteredsite.com
MAIL FROM: pandian@myhost.com
250 ok
RCPT TO: pandian@myhost.com
250 ok
DATA
354 go ahead
Subject:-subject-

test body content.
.
250 ok 1335470983 qp 3750
QUIT
221 mymail.myregisteredsite.com
Connection closed by foreign host.
pandian@Kannan:~$

Advertisements

Hello World Application in android

I have given some code snippets for some of the simple android applications under the same tag. Unfortunately, I couldn’t continue developing it further. Let me start once again now. I hope this hello world application be a good starter!

So the above diagram shows the components of Application development. Please have a look at the Android Fundamentals http://developer.android.com/guide/topics/fundamentals.html

Please install the Android SDK an ADT plugin for Eclipse as explained in http://developer.android.com/sdk/index.html

Once you are ready with the setup, create a new Android application as given in the screenshots below.

Once the project is created, You can see the default code stub HelloAndroidActivity.java have been created as above. This is a sub class of Activity. We will add a text and show it in the UI. You can see the code changes below.

package org.grassfield.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
textView.setText("Hello, Android");
setContentView(textView);
}
}

 

Now Run the project, we can see Android emulator is getting opened. Give some time to do the loading process. You can see the output as below.

 

have fun 🙂

How to disable firewalls in Ubuntu, RedHat, CentOS

RedHat and other RedHat flavours

First login as the root user.

Next enter the following three commands to disable firewall.

# service iptables save
# service iptables stop
# chkconfig iptables off

If you are using IPv6 firewall, enter:

# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off

Ubuntu

$ sudo iptables -X
$ sudo iptables -t nat -F
$ sudo iptables -t nat -X
$ sudo iptables -t mangle -F
$ sudo iptables -t mangle -X
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -P OUTPUT ACCEPT

sudo ufw disable

A simple RSS Parsing Android application

Adding further more changes to my code given in my earlier post, I am adding the source code as well as the APK file for a simple RSS SAX parser.

This will parse the feed http://foxbrush.wordpress.com/feed and show the content on the screen. More finetuning required, will be added later.

Source file (eclipse project archive) – http://ubuntuone.com/4Id0xEpemi3JwEhIRvwQKd

APK file – http://ubuntuone.com/4SjwRCdQwh6QsoWBd46TAY

Android version required 2.3.1; Tested with my HTC

Feedparser (c) – http://www.ibm.com/developerworks/opensource/library/x-android/

HTTPURLConnection in Android

A Code snippet that reads a URL and print the HTML content on the screen, as raw text.
You may need to refer my earlier post to enable the necessary permissionpackage org.grassfield;

package org.grassfield;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HellodroidActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
URL url = new URL("http://www.google.com");
HttpURLConnection openConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = openConnection.getInputStream();
StringBuffer sb = new StringBuffer();
int c=-1;
while ((c=inputStream.read())!=-1){
sb.append((char)c);
}
inputStream.close();
TextView textView = new TextView(this);
textView.setText("Google Output ==>"+sb.toString());
setContentView(textView);
} catch (MalformedURLException e) {
e.printStackTrace();
TextView textView = new TextView(this);
textView.setText(e+"");
setContentView(textView);
} catch (IOException e) {
e.printStackTrace();
TextView textView = new TextView(this);
textView.setText(e+"");
setContentView(textView);
}
}
}

UnknownHostException while accessing Internet – Android

I am creating a new HelloWorld application for HTTP URL Connection demo. While accessing http://www.google.com, I am getting UnknownHostException

Obvious, we need to grant the permission for internet access. Hence add the android.permission.INTERNET permission in the manifest file as given below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.grassfield"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HellodroidActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

</application>

</manifest>

Android tablet war – a review

For the past few months, I tried many times to purchase a tablet for my personal needs. Unfortunately no attemt was fruitful because I am not quiet convinced with the models I have seen.
Motorola xoom, samsung galaxy tab, acer iconia, HTC flyer etc etc. In addition, Indian market is heat because of low end tablets (midlets) like Beetel magiq, techberry techpad etc.

Motorola Xoom

Motorola Xoom

First of all let me tell you my requirement – lot of text typing (emails, wordpress, facebook, and instant messaging), youtube every night! Mostly productivity gadget. If you compare the highend models which I told above, almost all of them have android as such (with their own apps for the name sake). You will decide based on the processor, memory, and other hardware related specs like HDMI port, tv out etc. Low end models – you should be happy with what they give.

Samsung galaxy tab 10.1

Samsung galaxy tab 10.1

In the high end models, I have evaluated samsung galaxy tab, motorola xoom and HTC Flyer. Galaxy tab almost = moto xoom, but moto has a HDMI out and extendible SD card option. So still I give less marks to the Ipad competitor – samsung galaxy tab 10.1. But HTC Flyer has many drawbacks as below.
* Android v2.3 – others v3.0 or v3.1
* 7 inch screen – others 10.x inches
* costly – others are cheaper.

But still I will vote for Flyer because of the HTC Scribe technology – because of its unique way of sophistication to handwriting. I am damn sure, this will be very helpful when you get into half-a-day or full day customer visits or meetings. HTC starts working on this scribing, I hope they will make this as good as HTC sense. This is what the way phone or tablet vendors need to impress their customer. Better hardware and recent version of android alone won’t win your customer hearts.

HTC Flyer

HTC Flyer

Here is a video that can explain you the HTC scribe!

Another decision by Apple at the war-end makes me to postpone the purchase of a high end tablet (also I can’t afford that much amount now :D) the new release from Apple has a powerful CPU to compare with others for more computing. I am sure this will add unavoidable traffic in the market. I expect all the vendors will try to copy or cross this limit. So you can find better android tablets in the near future.

Let me conclude this post with a note on low end model – techberry techpad. It costs around 8500 INR, Chinese make and distributed by a Chennai based distributor of Techberry mobiles. I have purchased this tab as a interim solution till I find my dream tablet. The drawbacks of this model are
1. Low end processor – the tablet is sluggish than the other low end model Beetel Magiq
2. Not fully google – Not that much google friendly like other devices. Coundn’t map google and get alerts at real time.
3. Android market is missing and all the links are android market is failing. It has a Chinese application manager called appstore which is a ‘dhrabai’. The popular applications like meebo, google talk, plus… everything needed to be downloaded as .apk files and install it.
4. No bluetooth
5. No inbuilt 3G. You need USB modem

Techberry Techpad

Techberry Techpad

But still one convincing reason I got with this is its support to USB. USB keyboard and USB mouse is given with this midlet which makes my text typing so easier. I don’t know why high end models are not giving much support to this – or they sell these items for extra cost. I am damn sure, no one can type much with the onscreen virtual keyboard. I really got excited when I saw my USB mouse too started working. The keyboard comes with a leather like casing, which makes the carrying much simpler.

(I din’t talk about IPAD – Somehow I hesitate myself to be tied to a particular technology or particular vendor!!!)

There are many innovations coming up! See this! Solar Powered Android Tablet by Bharat Electronics – Priced at $72 http://todayontech.com/solar-powered-android-tablet-bel/

Have a wonderful week ahead!