Tuesday, October 18, 2011

Android, Get the Process ID and Thread ID

When you debug the Multi-Thread app in android, it will be better that you can tell the activity thread id. so I have one Simple Line of Code to dumpout the logcat message, time, processid, thread id and the message.

public static void MLog(String msg) {
        Log.d("xxxnew", String.format("at %s Process ID %s, Thread ID %s %s   ", new Date().toString(),  Process.myPid(),Process.myTid(),msg));
    }


image

Saturday, October 15, 2011

HP Notebook, stuck on booting screen, Status: 0xc00000e9

some bad day, My HP pavilion stuck on the booting screen, here is what it looks like,
Status: 0xc00000e9
Info: An unexpected I/0 error has occurred.
image

So basically, it’s an IO error, for sure, should be disk IO error. then I go to the bios, Diagnostics-> hard drive test,
Get an 303 error, looks like 404 for geeks,
image

here is the HP error codes, http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c01443317

No magic, the hard drive died, replace a new one will fix the issue.

Friday, October 14, 2011

Hadoop Hbase, Test JAVA client and inspect the network flow

I just setup three VMS, with the following roles

192.168.209.130 /HOME NameNode, HbaseMaster(Standby server), Region Server, Zookeeper
192.168.209.132 /LA DateNode, HbaseMaster (Active One), Region Server, Zookeeper
192.168.209.133 /NJ Zookeeper

then I create one basic table, called ‘customer’ with Info as the only one column family.

image

then on the client machine which is win 7, I write a simple HBASE client to push some data to the HBASE. client runs on 192.168.209.1, Here is the Code. 

image 

on the client side, you need reference the HBASE jars , and put the conf folder into the classpath. in the client hbase-site.xml, just point to the zookeeper instances. Here I put three ZK quorums.
image

Then run the program, after done. you can tell from the hbase  shell, 5 records are there.
image

from the client, you can tell from the console log. it will first talk to zookeeper, to get which master is active. then  query the root region, then the meta region information.
image

after that, it will write data to the corresponding regions server directly.

here is the network flow layout.
First, setup TCP connection with Zookeeper, to locate the master server.  2181 is the zookeeper Listening Port.
image

Then talk to Root region server which is LA to get the region allocation.
image
once it has those information, it will cached in memory. then put the data to that regions server directly.

image

that’s all the client conversation. (client , zookeeper, region server.)

The general communication flow is that a new client contacts the ZooKeeper ensemble
(a separate cluster of ZooKeeper nodes) first when trying to access a particular row. It
does so by retrieving the server name (i.e., hostname) that hosts the -ROOT- region from
ZooKeeper. With this information it can query that region server to get the server name
that hosts the .META. table region containing the row key in question. Both of these
details are cached and only looked up once. Lastly, it can query the reported .META.
server and retrieve the server name that has the region containing the row key the client
is looking for.

Saturday, August 27, 2011

Oops, Youtube support team are trained monkeys

image

500 Internal Server Error

Sorry, something went wrong.
A team of highly trained monkeys has been dispatched to deal with this situation.

If you see them, show them this information:

WFlEO-pxslLQKQ8jn5sBkCwnuuZg1YYqX9bVND5_m5gRtSxuruNgKsTd17lg
uIm1sVMS98fpTtpzlNX96mH1WLq79xMZUvOLdhFvKX_WGYFfc38YlrkAm23q
kPFJ7mrbT12tQundh7bk1y0TEqJfe0SA336fLvzgVEm1tt8oIf8-ib7CH3QQ
n11bbMFCY1iJgCn1ezZIl1rXHkmuRU9xrlQ4d-XrG1JmJtaRRFY1kklSloUj
JECppOrM0wAaZXFODfOpE_ZQXT0iJk46_YrqBf0-rD7nXYmruWZqU4zcnvWN
tnXr70fXkkBoVohlx-yC7GiBtceyBSPMYhotqQD2gE7JMa_LtCXflVx15Hs3
yfKiDZIcjiaQ5U1L2YHgXwplA4SiOJ2SRM2HI1DO9_9bs9qMKWPvc-OUt3nV
PmZHNdlYW143KHOCRqZv0m19bQ2vxXhZjEHfc8GrLZu3Vz3_y1QvVAt4lj5J
2UPBp6mJvmB3Ouzak6VN1jXSa24n8gXE5VrGNcnWs1GKCpGNd6yRQWpq9shw
BF1eygVB8mZri2xeUBh4vLZ7pwEj06c-qmJr4RItLLXWT8CMqeM6KrYxWr6g

Monday, August 22, 2011

How To, Auto Suggesting with multi words/terms using solr ShingleFilterFactory

Google has one amazing feature called auto sugesstion. basically, when you type one word, even just the prefix of the word, it will list the suggestion for you like this,
image
Even further, google has one unknown REST API that you can use to query the auto-completion word lists provided by Google.
http://google.com/complete/search?output=toolbar&q=%22intel+s%22

 image

For Apache Solr, If you want to do the same thing as google does, here is one simple approach. Just using the ShingleFilter,

Create one text field that use this filter,

<fieldType name="text_shingle" class="solr.TextField" positionIncrementGap="100">
            <analyzer>
                <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
         <filter class="solr.ShingleFilterFactory" maxShingleSize="4" outputUnigrams="true"/>
            </analyzer>
        </fieldType>

Then create one field to use that field type
image

After that, we can post a simple document to the Solr, I will put one wiki page, http://en.wikipedia.org/wiki/X25-M to the solr.

you can just create one doc and post it to solr using curl

image


image

Now you can go to the solr admin to check the description terms, you will see those multi-word terms

image

for application, we can run a facet query to get the keyword list and count.
image

http://localhost:8080/solrmaster/select/?q=description%3A*&version=2.2&start=0&rows=0&indent=on&facet=true&facet.field=description&facet.prefix=02g2

pretty simple to get startedSmile

Wednesday, August 17, 2011

How to, Hadoop , error to start Jobtracker of hadoop, FATAL org.apache.hadoop.mapred.JobTracker: java.lang.RuntimeException: Not a host:port pair: local

One day, I just created a fresh centos and download/install the hadoop, by default it runs on local mode. so I just change the config to run in distributed mode. When I run bin/start-all.sh. get the follow errors in the tasktrackr log.

2011-08-16 21:00:12,136 INFO org.apache.hadoop.mapred.JobTracker: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting JobTracker
STARTUP_MSG:   host = hadoop/192.168.209.131
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 0.20.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010
************************************************************/
2011-08-16 21:00:12,280 WARN org.apache.hadoop.conf.Configuration: bad conf file: element not <property>
2011-08-16 21:00:12,280 WARN org.apache.hadoop.conf.Configuration: bad conf file: element not <property>
2011-08-16 21:00:12,280 WARN org.apache.hadoop.conf.Configuration: bad conf file: element not <property>
2011-08-16 21:00:12,299 INFO org.apache.hadoop.mapred.JobTracker: Scheduler configured with (memSizeForMapSlotOnJT, memSizeForReduceSlotOnJT, limitMaxMemForMapTasks, limitMaxMemForReduceTasks) (-1, -1, -1, -1)
2011-08-16 21:00:12,344 FATAL org.apache.hadoop.mapred.JobTracker: java.lang.RuntimeException: Not a host:port pair: local
        at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:136)
        at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:123)
        at org.apache.hadoop.mapred.JobTracker.getAddress(JobTracker.java:1807)
        at org.apache.hadoop.mapred.JobTracker.<init>(JobTracker.java:1579)
        at org.apache.hadoop.mapred.JobTracker.startTracker(JobTracker.java:183)
        at org.apache.hadoop.mapred.JobTracker.startTracker(JobTracker.java:175)
        at org.apache.hadoop.mapred.JobTracker.main(JobTracker.java:3702)


it looks like the runtime still pick up the default mapreduce configuration located in the hadoop-x.core.jar, you can get this file by unzipping hadoopcore.jar,
image

image

So the error means it pick up this default setting of Local. Then I read careflly about the mapred-site.xml, here it is.
image

It looks like perfect, right, cause I just copied the setting from the default xml, while, I just keep the weird error.
well, here is final xml that works great, I highlighted the difference, I forgot to put the property tag. so the runtime will ignore this xml and pick up the default settings.
image

Summary, when you get weird error, check the log first, then make sure those conf xml are in right format that comforts the scheme
tricky, hah?

Tuesday, August 2, 2011

Download Bing.com Daily Wallpaper App for Android

bing

https://market.android.com/details?id=com.androidyou.bing&feature=search_result
Features,

  • Save images to use them as your Android wallpaper
  • Access and download Bing's daily wallpapers
  • Read comments on wallpaper images
  • Share images via e-mail or your favorite social networking site
  • Recall and view your download history
  • set as wallpaper automatically
  • background run

 

AD Free Edition,
bingdx

 
Locations of visitors to this page