Allen Sun 2013-05-03T20:16:51-07:00 leix.sun@gmail.com JDeveloper Icon in Ubuntu 2013-05-04T00:00:00-07:00 Allen Sun http://sunus.github.io//2013/05/JDev-Icon-Ubuntu It is a shame that I spent so much time on JDeveloper itself. But the default icon for JDeveloper make me crazy. Here is how it looks like after I make it as the icon for Ubuntu launcher.

Default JDeveloper Icon

Fortunately Oracle has a nice icon for JDeveloper in its official twitter account. It looks much better, isn't it? :)

JDeveloper Icon

Well, I thought everything was done and I can continue my work with JDeveloper. Then I found the icon in sidebar is not correct. It use the icon of Java. Shit.

JDev Sidebar Issue

Thanks to Google, I found the solution for this is to set StartupWMClass in the desktop file to tell unity it is a different application from other java applications. StartupWMClass can be found through command xprop|grep WM_CLASS. For JDevloper, it is oracle-ide-osgi-boot-JDeveloper. In a word, you can solve the problem by attaching the following line to your desktop file.

StartupWMClass=oracle-ide-osgi-boot-JDeveloper

JDev Sidebar Fixed

That's all. And that's how programers waste their lives. :)

]]>
JDevloper 11g Personal CheatSheet 2013-05-03T00:00:00-07:00 Allen Sun http://sunus.github.io//2013/05/My-JDev-Cheatsheet Font & Font Size
  • Font: Preference -> Code Editor -> Fonts -> Font Name -> Source Code Pro
  • Font Size: Preference -> Code Editor -> Fonts -> Font Size -> 14

Show Line Number & Whitespace

  • Line Number: Preference -> Code Editor -> Line Gutter -> Show Line Numbers
  • Whitespace: Preference -> Code Editor -> Display -> Show Whitespace Characters

JDeveloper 11g Cheatsheet with Customized Key Mapping

JDev Keyboard Scheme File

Edit

Ctrl + Shift + C                    // Copy Path
Ctrl + Shift + V                    // Extended Paste
Ctrl + Shift + D                    // Duplicate Selection

View

Ctrl + Shift + A                    // Application Navigator
Ctrl + Shift + K                    // Bookmarks
Ctrl + Shift + R                    // Breakpoints
Ctrl + Shift + P                    // Component Pallete
Ctrl + Shift + L                    // Log 
Ctrl + Shift + S                    // Structure

Refactor

Alt + Shift + R (customize)         // Rename 
Ctrl + Alt + X                      // Extract Method
Ctrl + Alt + F                      // Introduce Field
Ctrl + Alt + V                      // Introduce Variable
Ctrl + Alt + P                      // Introduce Parameter
Ctrl + Alt + C                      // Introduce Constant

Search

Ctrl + F                            // Search
F3                                  // Find Next
Shift + F3                          // Find Previous
Ctrl + R                            // Replace
Alt + Shift + Down                  // Go to Next Highlight
Alt + Shift + Up                    // Go to Previous Highlight
Ctrl + E                            // Incremental Search Forward
Ctrl + Shift + E                    // Incremental Search Backward
Ctrl + Shift + F                    // Find in Files
Ctrl + Alt + U                      // Find Usages

Navigate

Alt + Left                          // Back
Alt + Right                         // Forward
Ctrl + K                            // Toggle Bookmark
Ctrl + Q                            // Go to Next Bookmark
Ctrl + Shift + Q                    // Go to Previous Bookmark
Ctrl + Shift + `                    // Quick Outline
Ctrl + G                            // Go to Line
Ctrl + Shift + Backspace            // Go to Last Edit
Ctrl + -                            // Go to Java Type
Ctrl + Alt + -                      // Go to File
Ctrl + =                            // Go to Recent Files
Alt + 0                             // File List
Alt + Home                          // Select in Navigator
Alt + Up                            // Go to Previous Member
Alt + Down                          // Go to Next Memeber
Ctrl + Shift + H                    // Type Hierarchy
Alt + Shift + H                     // Call Hierarchy

Build

Ctrl + Shift + F9                   // Make 
Ctrl + F9                           // Make Project

Run

Ctrl + F11                          // Run File
F11                                 // Run Project
F5                                  // Toggle Breakpoint
F9                                  // Resume
F8                                  // Step Over
F7                                  // Step Into
Shift + F7                          // Step Out
F4                                  // Run to Cursor    
Ctrl + I                            // Inspect
Ctrl + F5                           // Watch

Source

Ctrl + Space                        // Completion Insight
Ctrl + Alt + Space                  // Smart Completion Insight
Ctrl + Shift + Space                // Parameter Insight
Ctrl + Shift + Enter                // Complete Statment
Ctrl + Enter                        // Expand Template  
Ctrl + D                            // Quick Javadoc
Ctrl + Alt + Enter                  // Code Assist  
Ctrl + Shift + G, A (customize)     // Generate Accessors
Ctrl + Shift + M (customize)        // Override Methods
Ctrl + Shift + G, F (customize)     // Generate Constructor from Fields
Ctrl + Shift + G, S (customize)     // Generate Constructor from Superclass
Ctrl + Shift + G, E (customize)     // Generate equals() and hashcode()
Alt + Shift + Z                     // Surround
Ctrl + Alt + Z                      // Unsurround
Ctrl + /                            // Toggle Line Comments
Ctrl + Alt + O                      // Orgnize Imports
Alt + Shift + F                     // Reformat
Ctrl + J                            // Join Line
Ctrl + Shift + U (customize)        // Convert Selections to Upper Case
Ctrl + Alt + D (customize)          // Delete Current Line
]]>
Sublime Text 2 Useful Packages 2012-08-16T00:00:00-07:00 Allen Sun http://sunus.github.io//2012/08/Sublime-Text-2-Packages I heard about sublime text 2 months before. Everyone said it is great. But I didn't give it a try because I think it is just another editor. Yesterday while I was trying to learn python by following Learn Python The Hard Way, I decided to use it and found out it does work great. Here are some useful packages/plugin I liked very much.

  • Sublime Package Control The first package you should install. It is a package manager which allows you install/remove packages.

  • Theme - Soda Popular theme. It can be install though package control.

  • alternative_autocompletion Textmate like autocompletion. t can be install though package control.

  • SublimeRope Python autocompletion. t can be install though package control.

  • SublimePythonTidy Python code formatter. Installing it though package control doesn't work. Read the instrution in here to install it manually.

  • Hide the Sidebar cmd+K, cmd+B

]]>
Connect to Windows 7 from Ubuntu 11 using RDP 2011-12-07T00:00:00-08:00 Allen Sun http://sunus.github.io//2011/12/Ubuntu-Win7-RDP-Issue It seems that the RDP setting for Windows 7 by default will enable 'Network Level Authentication'. The out of box RDP tool Remote Desktop Viewer or Remmina Remote Desktop Client on Ubuntu does not support it. So to connect to the Windows 7, you have to change the RDP setting to disable the 'Network Level Authentication' like the following picture shows.

Windows 7 RDP

I found that there are some RDP clients on linux which support NLA here . If you do really need this feature, you can give it a try.

]]>
Download the sources of android 2011-11-21T00:00:00-08:00 Allen Sun http://sunus.github.io//2011/11/Android-Source Well, you can follow the instructions here to download the whole repository of android. I did it yesterday. It took me about 10 - 12 hours to download all sources which are about 10G. Then I was wondering maybe a lot of people don’t need to download such a huge repository and then find the wayto do it as follows.

  • Setup repo command by following the instructions in this page.
  • Execute
 repo init -u https://android.googlesource.com/platform/manifest 
  • Go into .repo folder and open manifest.xml. You will find all information of all sub projects.
  • Download the subprojects using
 repo sync project0 project1 project2 

You can also download the sub projects using git clone if you like.

]]>
hg branch != git branch 2011-11-20T00:00:00-08:00 Allen Sun http://sunus.github.io//2011/11/Git-Mercurial-Branch In Git, a branch is merely one of the many kinds of ‘refs’, and a ‘ref’ is simply a pointer to a commit. This means that there’s nothing fundamentally different between ‘bob/do-test’ or ‘tmp-do-test’, or ‘master’, they are all pointers to commits, and this pointers can be easily be deleted, renamed, fetched, pushed, etc. IOW you can do pretty much whatever you want with them.

In Mercurial, a branch is embedded in a commit; a commit done in the ‘do-test’ branch will always remain in such a branch. This means you cannot delete, or rename branches, because you would be changing the history of the commits on those branches. You can ‘close’ branches though. As Jakub points out, these “named branches” can be better thought as “commit labels”.

From Mercurial vs Git; it’s all in the branches

]]>
Incomplete shortcuts of IDEA and Eclipse 2011-08-01T00:00:00-07:00 Allen Sun http://sunus.github.io//2011/08/Incomplete-shortcuts-of-IDEA-and-Eclipse Most Useful Ones

Function Eclipse IDEA
Go to class Ctrl + Shift + T Ctrl + N
Go to File Ctrl + Shift + R Ctrl + Shift + N
File Structure Popup Ctrl + O Ctrl + F12
Go to Line Ctrl + L Ctrl + G
Go to Declaration Ctrl + B / Ctrl + Click F3 / Ctrl + Click
Type Hierarchy F4 Ctrl + H
Method Hierarchy Ctrl + T Ctrl + Shift + H
Call Hierarchy Ctrl + Alt + H Ctrl + Alt + H
Find Usages Ctrl + Shift + G Alt + F7

Others

Function Eclipse IDEA
Toggle Case Ctrl + Shift + X/Y Ctrl + Shift + U
Find Next Ctrl + K F3
Find Previous Ctrl + Shift + K Shift + F3
Comment with Line Comment Ctrl + / Ctrl + /
Comment with Block Comment Ctrl + Shift + / Ctrl + Shift + /
Reformat Code Ctrl + Shift + F Ctrl + Alt + L
Optimize Imports Ctrl + Shift + O Ctrl + Alt + O
]]>
High Performance Web Sites 2010-06-28T00:00:00-07:00 Allen Sun http://sunus.github.io//2010/06/High-Performance-Web-Sites High Performance Web Sites

  • Rule 1 Make Fewer HTTP Requests
  • Rule 2 Use a Content Delivery Network
  • Rule 3 - Add an Expires Header
  • Rule 4 - Gzip Components
  • Rule 5 - Put Stylesheets at the Top
  • Rule 6 - Put Scripts at the Bottom
  • Rule 7 - Avoid CSS Expressions
  • Rule 8 - Make JavaScript and CSS External
  • Rule 9 - Reduce DNS Lookups
  • Rule 10 - Minify JavaScript
  • Rule 11 - Avoid Redirects
  • Rule 12 - Remove Duplicate Scripts
  • Rule 13 - Configure ETags
  • Rule 14 - Make AJAX Cacheable
]]>
If all you have is a hammer, everything looks like a nail 2010-05-27T00:00:00-07:00 Allen Sun http://sunus.github.io//2010/05/Everything-Looks-Like-a-Nail

背景:

  1. 客户的老系统已经用了几十年了。于是客户IT部门花很多钱(上千万)在内部开发了一个新系统(以下简称新系统)。这个系统的想法不错,希望通过管理客户的人际关系网络,来分析出客户的风险。但开发并不成功,开发两年只实现了有限的功能,性能很差。客户的大领导转向我们公司的产品。

  2. 我们的产品在行业中有几个比较成功的客户。有行业领域的经验积累。但产品本身并不算很成熟。销售展示的时候有夸大成分。行业本身比较复杂,各种客户确实有复杂的定制需求。

  • 钉子: 客户IT部门强烈要求在产品中定制他们新系统中的一些功能。
  • 锤子1 -- 架构师: 本来公司没有准备架构师(因为是现成的产品,架构师也不可能改变产品的架构),但客户要求有,于是临时从外面顾问公司请了一个,对公司产品不了解,但本身经验很丰富。对于钉子,架构师的考虑是需求比较合理,技术难度不大(基本没什么技术难度)。更重要的是,客户乐于付钱去在我们产品上做这些定制。于是很积极的在和客户讨论相关的细节。 //注释:增加新功能对于架构师/程序员更有满足感,尤其是对产品不熟悉,在业务方面会很有挫折感。
  • 锤子2 -- 产品专家 产品专家对产品和行业都比较熟悉。对于钉子,专家强烈反对客户对定制我们产品的要求。专家的考虑是: 1. 这个并不是客户的真正需求,只是客户的IT部门一厢情愿的想法。在他做产品实施的这么多年,没有接触到过类似的需求。他需要接触真正在使用系统的客户来作出判断。 2. 这个并不是一个很关键的功能。 3. 根据他的经验,客户对于产品的定制,大部分都是失败的。并且对于公司来说,对产品的定制程度越高,对产品支持的成本就越高,升级产品的难度就越大。毕竟,公司是卖产品而不是卖服务的。 4. 还没到最后时候,没必要答应客户去做这样的定制。

最后:我就是个打酱油的,打酱油的心态很重要。

]]>
Connect Exchange 2007 using Evolution under Ubuntu 2010-05-14T00:00:00-07:00 Allen Sun http://sunus.github.io//2010/05/Connect -Exchange2007-Ubuntu I did a lot of Google search before, but failed. Then today morning my collegue told me that he found a way to connect the exchange server under Ubuntu. Here are the steps. 1. sudo apt-get install evolution-mapi 2. In Evolution -> Preferences -> Mail Accounts, add a new mail accout. 3. Choose "Exchange MAPI" as Server Type, input your exchange server address and your username.

That's it. This is so exciting that I can get rid of the OWA access.

]]>