ITeye博客

渴死的火烈鸟

standalone · 共 356 篇文章

HBase Schema Design

As someone has said here You need to look more at the types of queries that you will be needing to access your data rather that just nomarlise every thing to 3rd normal form as in traditional relational databases. I collected several useful documents on how to design hbase schema. See the attached …

2013-05-24 11:41 · hbase · 评论(0)

use "--links" option of rsync

Today I used rsync to copy some files but I found for symbolic links it will ignore them if you just use simple command line: rsync SRC DEST With google, I finally figure out I need to add the "--links" option. --copy-links Turn all symlinks into normal files (leaving no symlinks for any other opti…

2013-05-23 10:45 · linux · 评论(0)

Question on HBase source code

I'm reading source code of hbase. When come to class org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher I find this class has private member unassignedNodes but I cannot find where nodes are added into the set. To be figured out. 71 // set of unassigned nodes watched 72 private Set<String> unassign…

2013-05-22 15:05 · hadoop · hbase · 评论(0)

Using the libjars option with Hadoop

As I have said in my last post, I was developing a hbase based mapreduce application. But one damn thing is the hadoop cluster managed by our system admin has no hbase jars in its classpath... So I have to figure out how to provide jars needed by hbase to hadoop. I know "hadoop jar" command has an …

2013-05-20 15:03 · hadoop · hbase · 评论(0)

Use HBase to Solve Page Access Problem

Currrently I'm working on sth like calculating how many hits on a page. The problem is the raw data can be huge, so it may not scale if you use RDBMS. The raw input is as follows. Date Page User date1 page1 user1 date1 page1 user2 date1 page2 user1 date1 page2 user3 ... ... So I need to answer ques…

2013-05-17 14:48 · hbase · 评论(0)

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/thi

If you meet this exception, make sure you include the guava-r09-jarjar.jar JAR in your build path. This is usually located in /usr/lib/hadoop-0.20/lib.

2013-05-16 15:27 · hbase · 评论(0)

[leetcode] Decode ways

http://leetcode.com/onlinejudge#question_91 Decode WaysJun 25 '121292 / 5011 A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode it. Fo…

2013-05-02 21:47 · algorithm · 评论(0)

[leetcode] Balanced Binary Tree

Check if a binary tree is balanced or not. This solution is from the discuss board. Much better than mine. /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public boolean isBalanced…

2013-04-28 14:08 · java · algorithm · 评论(0)

[leetcode] find median of two sorted arrays

http://leetcode.com/onlinejudge#question_4 Solution: a little ugly. public class Solution { public double findMedianSortedArrays(int A[], int B[]) { // Start typing your Java solution below // DO NOT write main() function int len1 = A.length; int len2 = B.length; int i = 0; int j = 0; int k = 0; do…

2013-04-26 10:55 · java · algorithm · 评论(0)

[leetcode] word ladder

Q: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: Only one letter can be changed at a time Each intermediate word must exist in the dictionary For example, Given: start = "hit" end = "cog" dict = As one shortest t…

2013-04-25 15:05 · java · algorithm · 评论(0)

[leetcode] sqrt(x)

I have talked about this question in my previous posts. http://leetcode.com/onlinejudge#question_69 Q: Implement int sqrt(int x). Compute and return the square root of x. Solution: public class Solution { public int sqrt(int x) { // Start typing your Java solution below // DO NOT write main() funct…

2013-04-15 07:44 · algorithm · 评论(0)

[leetcode] word ladder II

http://leetcode.com/onlinejudge#question_126 Q: Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be changed at a time Each intermediate word must exist in the dictionary For example, Given: start = "hit…

2013-04-15 07:35 · java · algorithm · 评论(1)

[leetcode] Count and Say

http://leetcode.com/onlinejudge#question_38 Question: The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2, then one 1" or 1211. Given an integer n, genera…

2013-04-12 14:05 · java · algorithm · 评论(0)

Date/Time处理函数总结 [To Do]

几种我所用到的用来处理日期,时间的函数总结。 Perl localtime # 0 1 2 3 4 5 6 7 8 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); If parameter is not provides, it will use current time. Note the $year returned contains the number of years since 1900, to get a 4-digit year you need: $year += 1900; …

2013-04-12 10:46 · java · perl · python · javascript · shell · 评论(0)

[leetcode] Palindrome Partition

http://leetcode.com/onlinejudge#question_131 Question: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "aab", Return , ] Solution: This is also a DP. I like DP :D import java.util.Arra…

2013-04-12 10:25 · java · algorithm · 评论(0)