Monday, July 04, 2011

Simple Rules in Twitter, Google+ and Facebook

Few days back i got an invitation an I created a Goolge+ account. I did it when Facebook came up and when twitter came up too. I was thinking whats so different in Google+ other than in Facebook. I figured three different sharing systems work in all three networks i just mentioned.

Twitter : You can follow any person (Person X). What ever person X share can be seen for all his/her followers. But X do not see any thing that his/her followers do. This is best for people who are like actors, scientists, and so on.

Google+ : If you add some person into your circle, the added person can see your content. So this is the absolute opposite of Twitter. So this is good for normal people to keep informing others. But you cant see what he/she is up to by adding them into a circle. They need to add you into a circle if they want to share things.

Facebook : This is a combination of both Twitter and Google+. When you add a friend and friend accepts his/her friend request you can see their posts and friend can see your posts. Still you can set security levels and sharing levels. But default is sharing happens in both ways.


I have a feeling now its time for me to move from Facebook to Google+. But still "Mark Zuckerberg" will be one of my favorites.

Saturday, June 11, 2011

Bugs and How to Fix them ! for Android Beginners

Unknown Host Exception in Android
When you try to load something from web, and you have done almost everything right still you might get this exception.
06-10 11:08:50.217: WARN/System.err(868): java.net.UnknownHostException: nopsa.hiit.fi
06-10 11:08:50.217: WARN/System.err(868):     at java.net.InetAddress.lookupHostByName(InetAddress.java:497)
06-10 11:08:50.217: WARN/System.err(868):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
06-10 11:08:50.217: WARN/System.err(868):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
06-10 11:08:50.237: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:69)
06-10 11:08:50.237: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:48)
06-10 11:08:50.272: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
06-10 11:08:50.272: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
06-10 11:08:50.272: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
06-10 11:08:50.277: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
06-10 11:08:50.277: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1018)
06-10 11:08:50.297: WARN/System.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:512)
Solutions:
1.) Change the host name ( here it is nopsa.hiit.fi) to the ip address of the host. It can work.
2.) Restart your emulator ( few times.. may be )
3.) add folowing code to AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
In some cases when you have'nt done the last change i suggested you might bet the following error as well.
06-10 22:47:29.866: WARN/System.err(380): java.net.SocketException: Permission denied
06-10 22:47:29.896: WARN/System.err(380):     at org.apache.harmony.luni.platform.OSNetworkSystem.socket(Native Method)
06-10 22:47:29.946: WARN/System.err(380):     at dalvik.system.BlockGuard$WrappedNetworkSystem.socket(BlockGuard.java:335)
06-10 22:47:29.946: WARN/System.err(380):     at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:216)
06-10 22:47:29.997: WARN/System.err(380):     at java.net.Socket.checkOpenAndCreate(Socket.java:802)
06-10 22:47:30.026: WARN/System.err(380):     at java.net.Socket.connect(Socket.java:948)
06-10 22:47:30.026: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:75)
06-10 22:47:30.058: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.(HttpConnection.java:48)
06-10 22:47:30.077: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
06-10 22:47:30.116: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
06-10 22:47:30.146: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
06-10 22:47:30.146: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
06-10 22:47:30.176: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1018)
06-10 22:47:30.186: WARN/System.err(380):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:512)

ActivityNotFoundException
06-10 22:50:18.256: ERROR/AndroidRuntime(572): FATAL EXCEPTION: main
06-10 22:50:18.256: ERROR/AndroidRuntime(572): android.content.ActivityNotFoundException: Unable to find explicit activity class {hiit.nopsa.pirate/hiit.nopsa.pirate.GameHome}; have you declared this activity in your AndroidManifest.xml?
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.Activity.startActivityForResult(Activity.java:2827)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.Activity.startActivity(Activity.java:2933)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.view.View.dispatchTouchEvent(View.java:3885)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2194)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.os.Looper.loop(Looper.java:123)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at java.lang.reflect.Method.invokeNative(Native Method)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at java.lang.reflect.Method.invoke(Method.java:507)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-10 22:50:18.256: ERROR/AndroidRuntime(572):     at dalvik.system.NativeStart.main(Native Method)
to fix this bug you should add the following code to the AndroidManifest.xml
<activity  android:name=".ClassName"/>
The ClassName should be replaced by your Class name which is a Activity.