Showing posts with label Concept. Show all posts
Showing posts with label Concept. Show all posts
List of Posts
-Calculation of Rectangle Overlap / Intersection area
-Architecture of Web Application
-How could you start a programmer job?
-Technical Debt / Code Debt / Design Debt
-Functional Design
-Regular Expression
-Geometry and Transformation
-Java Practices
-Code Refactoring and Coupling
-A Basic Image Viewer
-Front End Technology
-Best Practices
-Bank Check/Cheque Translator
-Core J2EE Patterns
-MOM
-Exception Handling 2
-Exception Handling 1
-Interactively Setting the Window/Level of an Image
-Dicom Header: Image Pixel
-Memory leak

Wednesday, April 23, 2014

Calculation of Rectangle Overlap / Intersection area

http://jsfiddle.net/uthyZ/

Saturday, December 10, 2011

Architecture of Web Application

HTML
Browser (HTML) -> Tomcat (JSP / Struts) -> JDBC/Hibernate -> Database
Browser (HTML) -> Tomcat (JSP / Struts) -> JDBC -> Stored Proc -> Database
Browser (HTML) -> IIS (ASP.NET) -> ODBC -> Database
Browser (HTML) -> Apache Web Server (PHP) -> Database

RIA
Flash Player(swf) -> Remote Object / Web Service -> Application Server (GlassFish) -> Persistence -> Database
Flash Player(swf) -> HTTP Service -> Web Server (Tomcat) -> JDBC -> Database
Silverlight -> HTTP / Other Protocol -> IIS -> Linq / ODBC -> Database

AJJAX
AJAX Framework -> Tomcat/Application Server -> JDBC/Persistence -> Database

Remarks: Those designs could be remixed.

HTTPS (SSL) could apply to the web service.

Friday, December 9, 2011

How could you start a programmer job?

Basic stuff:
1. Be familiar the hello world of the language for the project (which you cannot know all the programming lanauge/framework before your work)

2. Be familiar the compilation procedure and setting for the project (e.g. version of SDK/Framework)

Understand the business logic:
1. Study the user manual

2. Study for the requirement spec

3. Study for the functional spec

4. Study for the integration spec (if the project provide service for others)

Understand the program architecture:
1. Study for ER diagram (if have)

2. Study for the architecture/micro-architecture diagram of the project

3. Ask which framework did the project used

4. Ask which library did the project use

5. Study for the class diagram

6. Draw the diagrams(Class Diagram/ER Diagram) once to familiar of the project (especially there are no diagram provides)

Remarks: There are no shortcut for success, never give up and you would become the expert

Saturday, December 3, 2011

Technical Debt / Code Debt / Design Debt

http://en.wikipedia.org/wiki/Technical_debt

Functional Design

Functional Design
http://en.wikipedia.org/wiki/Functional_design

Functional Design Specification
http://www.scottmanning.com/content/functional-design-specification/

7 Essential Guidelines for Functional Design
http://www.smashingmagazine.com/2008/08/05/7-essential-guidelines-for-functional-design/

Thursday, September 22, 2011

Regular Expression

http://gskinner.com/RegExr/

Wednesday, June 15, 2011

Geometry and Transformation

http://courses.csusm.edu/cs535xz/Lectures/transformation.pdf

Wednesday, April 20, 2011

Java Practices

http://www.javapractices.com/home/HomeAction.do

Sunday, March 20, 2011

Code Refactoring and Coupling

Code Refactoring
http://en.wikipedia.org/wiki/Code_refactoring

Coupling
http://en.wikipedia.org/wiki/Coupling_%28computer_programming%29

Dependency Hell
http://en.wikipedia.org/wiki/Dependency_hell

Refactoring To Patterns
http://rockfish.cs.unc.edu/COMP290-agile/rtp113.pdf

Tuesday, March 8, 2011

A Basic Image Viewer

http://www.eclipse.org/articles/Article-Image-Viewer/Image_viewer.html
http://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html


Photoshop file format importer / parser in flash AS3
http://durej.com/?p=128

Tuesday, February 1, 2011

Front End Technology

HTML + CSS + Javascript
- suitable for beginner and web developer(free)

jQuery
- suitable for heavy web component project(free)
- support Ajax

extJS
- suitable for heavy web component project($)
- support Ajax

Struts2
- suitable for MVC pattern project(free)
- support internationalization(locale)
- support MVC

JSF
- suitable for Java Standard Project(free)
- support internationalization(locale)
- support MVC

Flex
- suitable for MVC pattern project, separate the UI code with back end technology with Web Service/BlazeDS($)
- support internationalization(locale)
- support MVC
- support Ajax(FABridge)

Silverlight
- suitable for .net developer ($)
- support internationalization(locale)
- support MVC
- support Ajax

Thursday, December 23, 2010

Best Practices

Comment
// SCR#[xxxx] REQ#[xxxx] on [xx/xx/20xx] [xx:xx][am/pm] [add/delete/modify/move] by leong for [purpose]

// SCR#101 REQ#1576 on 12/12/2010 11:00am add by leong for bug fix in employee sql query

Sunday, December 12, 2010

Bank Check/Cheque Translator

Digit to English
http://www.thisiscool.com/Num-Num.htm

Digit to Chinese

http://www.mandarintools.com/numbers.html

Tuesday, December 7, 2010

Core J2EE Patterns

http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html

Core J2EE Patterns: Best Practices and Design Strategies
http://www.corej2eepatterns.com/index.htm

Wednesday, November 3, 2010

MOM

MOM (Message-oriented middleware)
Producer > Send Msg >                           > Receive Msg > Consumer
Producer > Send Msg >                           > Receive Msg > Consumer
                                             >MOM Server >
Producer > Send Msg >                           > Receive Msg > Consumer
Producer > Send Msg >                           > Receive Msg > Consumer

Friday, October 29, 2010

Exception Handling 2

http://www.javaworld.com/javaworld/jw-07-2005/jw-0711-exception.html?page=1

http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html

//////////////////////////////////////////////////////////////////////////////
public UserUI{
public User getUserUI() throws EJBException {
try{
UserBO userBo = new UserBO();
return UserBO.getUserBO();
}
}catch(AppException appEx){
if(appEx.isLogged)
logger.error(appEx)
throw new EJBException("EJB Exception" + app.getMessage())
}
}catch(Exception ex){
logger.error(ex)
throw new EJBException("Unknown system error");
}
}
}
//////////////////////////////////////////////////////////////////////////////
public UserBO{
public User getUserBO() throws AppException{
try{
UserDao userDao = new UserDao();
return userDao.getUserDao();
}catch(AppDBException ex){
if (!ex.isLogged)
logger.error(ex)
throw new AppException("System database error", true)
}catch(XMLException xmlEx){
logger.error(xmlEx)
throw new AppException("System XML error", true)
}
}
}
//////////////////////////////////////////////////////////////////////////////
public UserDAO{
public User getUserDao() throws AppDBException
{
try{
...
return User;
}catch(Exception ex){
logger.error(ex)
throw AppDBException("System database error", true)
}
}
}
//////////////////////////////////////////////////////////////////////////////

Wednesday, October 27, 2010

Exception Handling 1

Best Practices for Exception Handling
http://onjava.com/pub/a/onjava/2003/11/19/exceptions.html
The Nature of Exceptions
1. Exceptions due to programming errors
2. Exceptions due to client code errors
3. Exceptions due to resource failures
Types of Exceptions in Java
1. Checked exceptions
2. Unchecked exceptions (RuntimeException)
Best Practices for Designing the API
1. When deciding on checked exceptions vs. unchecked exceptions
2. Preserve encapsulation
3. Try not to create new custom exceptions if they do not have useful information for client code
4. Document exceptions
Best Practices for Using Exceptions
1. Always clean up after yourself
2. Never use exceptions for flow control
3. Do not suppress or ignore exceptions
4. Do not catch top-level exceptions
5. Log exceptions just once

Three Rules for Effective Exception Handling
http://today.java.net/pub/a/today/2003/12/04/exceptions.html
1. Be Specific
2. Throw Early
3. Catch Late

The Java Tutorial(Lesson: Exceptions)
http://download.oracle.com/javase/tutorial/essential/exceptions/index.html

Antipattern
http://en.wikipedia.org/wiki/Antipattern
http://www.c2.com/cgi/fullSearch

Exception handling in an n-Tier application-best practices?
3 layers: a DAL layer, a BLL layer, and a UI layer.
Propagate exceptions from the DAL up through the other two so can do cleanup in the UI and BLL if a database call fails.
Able to Trap exceptions originating locally in the BLL and UI layers.

Private Class CallOneException Inherits Exception
End Class

Private Class CallTwoException Inherits Exception
End Class

Private Sub BaseCall()
Try
CallOne
Catch CallOneEx As CallOneException
Catch CallTwoEx As CallTwoException
Catch Ex As Exception
Finally
End Try
End Sub

Private Sub CallOne()
Try
CallTwo
Catch CallTwoEx As CallTwoException
Throw
Catch Ex As Exception
Throw New CallOneException
Finally
End Try
End Sub

Private Sub CallTwo()
Try
Catch ex As Exception
Throw New CallTwo Exception
Finally
End Try
End Sub

Exception handling in 3-Tier Architecture
http://www.codeproject.com/KB/exception/expceptionhandling-3-tier.aspx

Logging Exceptions: Where to Log Exceptions?
http://tutorials.jenkov.com/java-exception-handling/logging-where-to-log-exceptions.html

Exception Handling Best Practices in .NET
http://www.codeproject.com/KB/architecture/exceptionbestpractices.aspx

Creating and Throwing Exceptions (C# Programming Guide)
http://msdn.microsoft.com/en-us/library/ms173163.aspx
Things to Avoid When Throwing Exceptions
1. Exceptions should not be used to change the flow of a program as part of ordinary execution. Exceptions should only be used to report and handle error conditions.

2. Exceptions should not be returned as a return value or parameter instead of being thrown.

3. Do not throw System.Exception, System.SystemException, System.NullReferenceException, or System.IndexOutOfRangeException intentionally from your own source code.

4. Do not create exceptions that can be thrown in debug mode but not release mode. To identify run-time errors during the development phase, use Debug Assert instead.

Friday, August 6, 2010

Interactively Setting the Window/Level of an Image

Interactively Setting the Window/Level of an Image
http://www.dfanning.com/ographics_tips/contrastzoom.html

Image Contrast and Brightness Adjustment
http://www.dfanning.com/ip_tips/contrast.html

Improved Image Contrast
http://www.dfanning.com/ip_tips/xstretch.html

Calculate windowing width and level from Image pixel data
http://www.medicalconnections.co.uk/wiki/Calculate_windowing_width_and_level_from_Image_pixel_data

Tuesday, July 27, 2010

Dicom Header: Image Pixel

There is a set of attributes in the
dicom standard associated with the pixel bit representation in a dicom
image. Some image types (SOP classes) use the definitions in the Image
Pixel Module, others have specialized the image pixel attributes for
specifc to the SOP class (e.g. DX Image Pixel Module)

Here's the verbage for the general Pixel Module
Bits Allocated (0028,0100)
Number of bits allocated for each pixel sample. Each sample shall have
the same number of bits allocated. See PS 3.5 for further explanation.

Bits Stored (0028,0101)
Number of bits stored for each pixel sample. Each sample shall have the
same number of bits stored. See PS 3.5 for further explanation.

High Bit (0028,0102)
Most significant bit for pixel sample data. Each sample shall have the
same high bit. See PS 3.5 for further explanation.

Pixel Representation (0028,0103)
Data representation of the pixel samples. Each sample shall have the
same pixel representation. Enumerated Values: 0000H = unsigned integer,
0001H = 2's complement


For DX, the attributes have been specialized as follows
Bits Allocated (0028,0100)
Number of bits allocated for each pixel sample. Enumerated Values: 8,
16

Bits Stored (0028,0101)
Number of bits stored for each pixel sample. Enumerated Values: 6 to 16

High Bit (0028,0102) Most significant bit for pixel sample data. Shall
have an Enumerated Value of one less than the value in Bit Stored
(0028,0101).

Pixel Representation (0028,0103) Data representation of the pixel
samples. Shall have the Enumerated Value: 0000H = Unsigned Integer.

Plus there are several mandatory attributes describing the relationship
of the pixel values to the xray intensity values, rescaling factors,
etc which were applied during the processing.

Most DICOM viewers do handle data greater than 8 bits. CT and MR pixel
data are typically 12 bits, allocated into 16 bit words. I've seen CR
and DX at both 12 bits and 16 bits, and seen it displayed by numerous
applications.

However, picking up on our earlier conversation, I've seen a number of
DICOM acquisition gateways which only support capture 8-bit data. For
example you indicated your sensor manufacture had recommended
PACSGear. A quick browse of their website says they only support 8-bit
secondary capture. I don't know the detailed specs of acquisition
stations and so can't cite one off the top of my head which does
support capturing 16 bit data but am wondering if your problem is more
on constructing rather than displaying side of the equation. People
here are also usually pretty helpful to tell you what might be wrong if
you want to post one of your images to an accessible location

http://www.cabiatl.com/mricro/dicom/index.html

DICOM Sample
http://www.barre.nom.fr/medical/samples/
http://pubimage.hcuge.ch:8080/
ftp://medical.nema.org/MEDICAL/Dicom/DataSets/WG04
http://www.aycan.de/main/lp/sample_dicom_images.html
http://www.rubomed.com/dicomfiles/index.html

ftp://medical.nema.org/medical/dicom/DataSets/WG16 Enhanced MR product images
ftp://medical.nema.org/MEDICAL/Dicom/DataSets/WG12 Ultrasound product disk exchange test images
ftp://medical.nema.org/MEDICAL/Dicom/DataSets/WG04 Compression working group test images (uncompressed, JPEG, JPEG-LS and J2K

http://www.dclunie.com/medical-image-faq/html/part8.html

Thursday, July 15, 2010

Memory leak

http://en.wikipedia.org/wiki/Memory_leak

Detecting .NET application memory leaks
http://www.codeproject.com/KB/dotnet/BestPractices5.aspx

Memory Leak Detection in .NET
http://www.codeproject.com/KB/dotnet/Memory_Leak_Detection.aspx

Three Common Causes of Memory Leaks in Managed Applications
http://blogs.msdn.com/b/davidklinems/archive/2005/11/16/493580.aspx

ASP.NET Memory Leak Issues with COM Interop
http://www.csharper.net/blog/asp_net_memory_leak_issues_with_com_interop.aspx

Avoid C# Memory Leaks with Destructor and Dispose
http://www.csharphelp.com/2007/05/avoid-c-memory-leaks-with-destructor-and-dispose/

Tool:
1. perfmon
2. Debug Diagnostic Tool
3. LeakDiag & LDGrapher

Get Started: Debugging Memory Related Issues in .Net Application Using WinDBG and SOS
http://www.codeproject.com/KB/debug/WinDBGAndSOS.aspx

Manage Unmanaged Resources and Memory With VB.NET
http://devcity.net/Articles/93/1/gc_manage.aspx

How to monitor your Java applications in Windows memory usage
http://www.ibm.com/developerworks/library/j-memusage/

Other Ref:
http://www.codeproject.com/KB/dotnet/IDisposable.aspx
http://www.codeproject.com/Articles/38069/Memory-Management-in-NET.aspx
http://www.codeproject.com/KB/dotnet/EventHandling_GarbageColl.aspx
http://www.codeproject.com/KB/scripting/leakpatterns.aspx