Updated on memory concern, use of resultset in favor of queryForList
I dont agree this is the best thing to do for learning a language, just to be honest sometimes this will be really helpful in job interviews（Just for the entrance ticket) ——after all interview & your education is a signaling game
There are lots of more important aspects like how to write clean code, object design, testability, etc. This post is mostly about the aspect of basic Java syntax and the language of quiz questions. “can method-local inner class be abstract”, “Output for System.out.print(” ” + 7 + 2 + ” “);”, is ArrayList “ordered” (Ordered !=Sorted) etc.
Just if you are going to use / using Java everyday, it may be also a way to get concepts clear, know the gotchas.
Do it like a machine. Reminds me the old days of HKAL..
First thing, read the manual
Java has bug. Java has design flaw. While if people ask your Java questions, you should read the Oracle stuff. Make sure you understand every sentences in theTutorial. Get used to reading some common java sources when you code– Executors etc. This is the relative efficient way before spending time on deeper Java Source, specification or even JVM bytecode
Some good online free java quiz filtered
- http://www.indiabix.com/online-test/java-programming-test/ Lots of question the level is suitable
- http://www.wiziq.com/tests/java –signup needed
- Android Apps – Tried some but not very good OK, Better
More than java syntax
GOOD BOOKS FOR PREPARATION
- Coding Interviews: Questions, Analysis & Solutions Some C, C++, Java, while very good for basic data structure / algo analysis review
- Google Resume Some chapters are common sense, while some provide insight in problem-solving, what questions will be asked & why
Update: I have created Cheeatz which can be used as a markdown editor and sync it to Evernote. Particular good for developers as you can embed gist easily
Today is a Markdown day – I am working on a project design and I try to put everything in trello for brainstorming. Naturally I am getting my hands dirty with Markdown.
Concept first – even for any small small things
Contrary to to its name, Markdown belongs to the category of Markup languages. we are familiar with Markup languages, not as “a modern system for annotating a document in a way that is syntactically distinguishable from the text.”, but as HTML being one of them.
To confess, I started to be serious in Markdown because of this post titled “The future of MarkDown” by Jeff Atwood (When I am writing this I tried to get the link in markdown, but I am still typing in Evernote)
I am biased. I reply infrequently in stack overflow, while I use Trello heavily. (Created by Joel, co-founder of stack overflow)
And I DO jot a lot of notes. I can spent hours on evernote/ oneNote everyday, from tech, chinese medicine to list of restaurants to try. I also a lazy blogger writing stuff like what you are reading.
Formatting is important, but it should not be complicated. It is impossible in Microsoft “World”, Mac/Google makes it better, but it should be simpler. I already touch-type bold, italic, change font size in Word/Evernote, using all hotkeys I can. In OneNote I ctrl-shfit+> several times, drag it and ctrl+. to make it bulletin. It is still hard, especially when there is code.
Frustration really comes when you try to paste from one place to another – like you drafted the post in Evernote and edit in WordPress for bold and links. Then you try to reply in stack overflow every links (and possible format) breaks. (This is one major point I considering going forTumblr)
One Best thing of Evernote is that it really keep layout of webpage, (based on ENML which based on XHTML) but when you paste it to OneNote, most format doesn’t hold
- You familiar with this single syntax as a “high level” language
- You save some seconds every time
- This principle always apply in software dev – more important than time, you free up your mind to focus on what you are doing, which is very important.
- After all this reduces the sugar your brain uses.
Same reason as Jeff Atwood suggest, I do hope Markdown will be “the language” that can be used everywhere. For me it is like JSON. So start from today I will try to stick with it
Tools – Markable, Cheatsheet
Note the online markdown editior Markable, I am new to it while I think it is very helpful and has lots of potential. Online File Saving, Easy integration with Dropbox, Evernote and Tumblr One feature I will suggest is hotkeys like ctrl-b to generate markdowns, which I believe will be available soon.
My Workflows to make it work everywhere:
- Outlook: after all outlook support some HTML
- Evernote: Update: you can use Cheeatz created by me, which is an online editor with live preview and you can seamlessly sync notes to evernote, opening for modify later. It also allows you to embed gists inside your note with a simple tag, such that you can search your code offline. More read this post
- Or you can use Markable . one gotcha is you need to save the file first, otherwise it will keep asking for your permission. Also possible to copy as HTML in Outlook and send to evernote.
(Furthermore, instead of drafting the note in email and send to Evernote as your company blocks Evernote, you can do it here, and better. vice versa, for import)
- Word: pandoc, pending to try
- WordPress.com: use Markable, either copy the right view to it in “Visual” mode (keep paragraphs & bolds & links at least! quite excited for this!) or view as HTML (tick Source at the bottom) and paste in “Text” mode in wordpress for some support
- WordPress.org: you may check here
A side note: For similar reason, I always usewww.websequencediagrams.com to draw the sequence diagram during prototyping. while drawing by hands always has the highest efficiency, just perhaps no one including myself can read it.
P.S. now the problem back to how you sync copies among these places when you say, edit in wordpress…
Once upon a time I talked to a real strong technical guy, he said that data structures & algorithms are really important.
They are important, not only in interviews, but also if you are really coding something. In some companies you could always “glue” something together by applying this framework and that library, while in real coding after all this is your understanding in how a problem can be solved.
After a year or 2 focusing on trying all sorts of framework out & gluing, lets have some data structure revisited….
As a data structure revisited, would like to ask a question I faced:
Linked List vs Array List (Java)
in Java, this SO thread is perfect
- allow sequential access -> will transverse from either front / back, which closer
- get by Index is O(n)
- add @front is O(1)
- remove is O(n)
- Iterator.remove is O(1)
- Spent more memory for pointers=>higher for 64bit. refer to the chart
- not synchronized
- allow index access
- get is O(1)
- add is O(1) amortized, but O(n) worst-case since the array must be resized and copied
- remove is O(n)
- default size is 10
- consume memory for capacity not actual storage
- not synchronized
- get –> O(1)
- add –> O(n)
- contains –> O(n)
- next –> O(1)
- remove –> O(n)
- iterator.remove –> O(n)
When to use Linked List
Some points against LinkedList in general
- bad performance in getting middle elements
- It uses lots of small memory objects, and therefore impacts performance across the process.
- Lots of small object are bad for cache-locality.
Good Use cases:
- When the size is unknown
- with FIFO / LIFO property
- Some deep dive in the Java API =>possible as a stack, queue, or double-ended queue (deque).
while there is also java.util.ArrayDeque for array to implement dequeue
- Want a more stable behaviour? (To be verified)
<=a already very large ArrayList expanding with GC may cause issue
- There is also an interesting impl of GapList
- Vector also implements the List interface and is almost identical to ArrayList.
- It is also possible to implement Queue with known size using arrayList or ArrayBlockingQueue, with help of circular buffer