jellyfish
jellyfish · 共 55 篇文章
How to design a bowling scoreboard
I just saw this post: http://www.iteye.com/topic/1112383 titled as OO 还是 procedural 小程序的设计 . It's kind of interesting. First, I love bowling (though just average player), secondly, it's a good design question for interviews. Here is a picture from google for the score board. For each round, there i…
JPA & XA
After I wrote a blog about Spring & JPA settings: http://jellyfish.iteye.com/admin/blogs/899281 , a friend asked me a question about XA on JPA. Last time I did XA was the year 2002, so I figured maybe it's time to revisit this topic to see how things have changed since then. Well, a lot, frankly. I…
2011-02-10 12:15 · JEE · 评论(0)
Tetris Swing implementation
Recently, I've seen an interesting post: http://www.iteye.com/topic/595321 , it's a java implementation of Tetris. While being a long time game player (My first game was the gold digger on an IBM XT back in 1988, subsequently I played Koei's Romance of 3 kingdoms, from II - XI, among others), this …
2011-02-05 11:04 · JSE · 评论(0)
Spring & JPA with Hibernate and EclipseLink
This is to show how to setup JPA with Spring, using Hibernate and EclipseLink respectively. We are not talking about ORM, which is a separate topic. So I am going to use a simple POJO. First, let's create a simple class: package my.test; public class Book { public int bookId; public String bookName…
2011-01-29 03:55 · JEE · 评论(0)
Spreadsheet Dependency graph
In spreadsheets, such as Excel, we can write simple formules like the following: Here C4 = A3 + A5, so if A3=5 and A5=7, then C4=12. If we change A3 to 6 and hit enter, then C4 is automatically changed to 13. So in the background, there is a dependency graph among the cells. We can explicitly show …
2010-11-19 03:00 · Design & Architecture · 评论(0)
国王和100个囚犯
http://www.iteye.com/topic/569275 A simple google on "100 prisoners riddle" yields the following two insights: http://www.algonet.se/~ug/projects/lightbulb/ http://www.ocf.berkeley.edu/~wwu/papers/100prisonersLightBulb.pdf The second one is a pdf, which I appended here. In the above links, I believ…
2010-09-18 04:58 · mathematics · 评论(0)
visit 淘宝面试题:如何充分利用多核CPU,计算很大的List中所有整数的和
I've seen these two: http://www.iteye.com/topic/711162?page=13 http://www.iteye.com/topic/713259 But I am not sure whether I missed something or the majority missed something. Though the chancee of later is slim, I am going to take the chance. Say we have 100 numbers and we are break them into batc…
2010-07-16 00:11 · JSE · 评论(15)
Revisit again: 一道应聘智力题的编程求解, Einstein puzzle
Continue on: http://jellyfish.iteye.com/admin/blogs/610841 , but this time we take a different approach, using ranged variables. First, define all the attributes we need with a range. The reason we need this twist is that later on we can "rule out" (remove values which are not possible based on ded…
2010-06-30 04:30 · Design & Architecture · 评论(0)
Revisit 一道应聘智力题的编程求解, Einstein puzzle
Another brain teaser, titled 一道应聘智力题的编程求解 , http://www.iteye.com/topic/608112 . This is the Einsten's puzzle. There are a few variations but the puzzle is the same. The consensus is that the brutal force way of looping through all possibilities is taking a long time, if not impossible. Since I did …
2010-03-09 00:36 · algorithms · 评论(0)
Javascript charting tool
My minimal requirements: free theme customizable, including fg/bd colors, axises can draw > 1 graphs can show data on the graphs(tooltips, e.g.) Flot: http://code.google.com/p/flot/ good and free gRaphael: http://g.raphaeljs.com/ this one can show multiple y values for a given x value if there are …
2010-02-09 06:36 · web · 评论(0)
General web site design
Here are the considerations of general web site design: 1. Color theme: There is a color theory, namely using "compatible" colors. For example, http://www.hypergurl.com/colormatch.php . 2. master layout: fonts, icons(and address bar icon), menus, content, ads 3. authentication/authorization, SSL fo…
2010-01-22 23:38 · web · 评论(0)
Flot example
Flot is an open source javascript charting tool. I need to plot an interest rate curve in a web page, so the x-axis is date. Here is an example modified from the file interacting.html in the flot example package <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/ht…
2010-01-22 23:18 · web · 评论(0)
Rounded Corners using CSS
In web applications, one of the markups/decorations is rounded corners. There are a lot of ways to do this, e.g., http://www.devwebpro.com/25-rounded-corners-techniques-with-css/ . Recently, I have the requirement to do this with minimal pictures envolved because pictures are considered not safe an…
2010-01-22 22:59 · web · 评论(0)
Domain Driven Design
Having read a lot of discussion on DDD, I feel there is a misleading perception. Anyhow, this is just my experience. Most of the discussion and examples in the DDD discussion are related to database persistence. Actually, in my experience, this is the least concern is DDD. The DAO design one way or…
2010-01-16 02:42 · Design & Architecture · 评论(0)
Lesson on complex number object
Complex numbers, such as 2 + 5i where i = sqrt(-1), have extensive applications in math and physics. So it deserves an another look itself. In this note, I'll go through the decisions I make in the design/modeling. These decisions, I believe, not only work in this case, but also in other common cas…
2010-01-14 04:49 · C# core · 评论(0)