Monday, October 02, 2006

BLOG: XenoCode

.NET assemblies contain allot of imformation, so much so that it is very easy for someone to reproduce the original source code of the application. Information such as method names, types, member variables and method names can “easily” be extracted from the assembly. Have a look at Reflector (http://www.aisto.com/roeder/dotnet/), it is a class browser for .NET components.

XenoCode

This product helps to protected your .NET assembly from reverse engineering, tampering, decompiliation and even goes as far as to optimize your binaries.

http://www.xenocode.com/

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=404

Tony

BLOG: jCIFS -The Java CIFS Client Library

The Java CIFS Client Library

jcifs-krb5-1.2.9 released / Kerberos Authentication Support
posted by Mike, Sep 13, 2006
This package is stock jcifs-1.2.9 modified to support Kerberos 5 / SPNEGO extended security
authentication. Please note that this has no impact on the HTTP Filter which still only supports NTLM.

1. How do I do NTLM HTTP authentication (a.k.a Single Sign On) for my website?
2. Does jCIFS support NTLMv2?
3. Why is java.net.URL throwing unknown protocol: smb Exceptions?
4. I'm getting these UnknownHostExceptions right from the start. What am I doing wrong?
5. Why do I get these "Network is unreachable" IOExceptions?
6. How can I authenticate arbitrary user credentials from an application or web clients against an NT domain?


http://jcifs.samba.org/

Tony

BLOG: Deliver Your Java Application in One-JAR!

Deliver Your Java Application in One-JAR!

      $ jar -tf myapp.jar

      META-INF/MANIFEST.MF

      lib/a.jar

      lib/b.jar

main/main.jar

The manifest contains a Main-Class setting to launch our application, and entries for the supporting JAR files a.jar and b.jar.

      Manifest-Version: 1.0

      Class-Path: main/main.jar lib/a.jar lib/b.jar

      Main-Class: com.main.Main


However, if file system is not defined, you will get errors. What about using the 'jar:' protocol in the Class-Path entry? This doesn't work either. It appears that the JAR loader only supports file-based URLS. Which is where One-JAR comes in.

      $ jar -tf one-jar-boot.jar

      META-INF/MANIFEST.MF

      com/simontuffs/onejar/Boot.class

      com/simontuffs/onejar/Handler$1.class

      com/simontuffs/onejar/Handler.class

      com/simontuffs/onejar/JarClassLoader$ByteCode.class

      com/simontuffs/onejar/JarClassLoader.class

      boot-manifest.mf

There is also a pre-built manifest file called boot-manifest.mf. To complete the One-JAR deployment process, create a suitable directory and expand this file into it, then update the myapp.jar file as follows:

      $ mkdir boot

      $ cd boot

      $ jar -xvf ../one-jar-boot.jar

      $ jar -uvfm ../myapp.jar boot-manifest.mf .

-Done-jar.info: info

-Done-jar.verbose: VERBOSE

Notice how the JarClassLoader keeps track of where classes came from: for example the com.a.A class is contained inside the lib/a.jar file inside myapp.jar.

At this stage you should be asking "How does One-JAR decide which is the main class?". The conventional way would be to have a manifest attribute in the top-level JAR file myapp.jar and require this to be edited before the final jar was assembled. But this is all unnecessary: One-JAR simply looks for a jar file inside the main sub-directory of the composite JAR file myapp.jar, and provided that that JAR file has a Main-Class manifest attribute, it will be used as the main entry point. This allows an existing main-class JAR file to be bundled inside a One-JAR archive without further modification!

http://one-jar.sourceforge.net/

Friday, September 29, 2006

STORY: Junit fails solution and discussion

Our code base is pretty big. It will cost 30 minutes to compile and unit tests, which will not include build the installers. Recently there were always failures happening in the server unit tests. There are two sets of the tests. One will generate the Derby (or java database) and using Hibernate to perform the actual unit tests. The other ones are normal unit tests. They are using mock objects to perform the unit tests. The unit tests will randomly fail due to real DAO and mock DAO problems. All the unit tests will pass if they are run separately.

1) Batch the any test cases inheriting DAOTestCase and batch any test cases inheriting BaseTestCase.

Explanation: Controls how many Java Virtual Machines get created if you want to fork some tests. Possible values are "perTest" (the default), "perBatch" and "once". "once" creates only a single Java VM for all tests while "perTest" creates a new VM for each TestCase class. "perBatch" creates a VM for each nested <batchtest> and one collecting all nested <test>s. Note that only tests with the same settings of filtertrace, haltonerror, haltonfailure, errorproperty and failureproperty can share a VM, so even if you set forkmode to "once", Ant may have to create more than a single Java VM. This attribute is ignored for tests that don't get forked into a new Java VM. since Ant 1.6.2

2) Reduce the test cases which require external database to tests. I look into the many test cases require external database are not actually the DAO classes. In other words, those test cases are not very in high qualities and could be optimized not to use external DB.

Explanation: I agree with your assumption that the tests that aren't the DAO tests that are going against the database are of lower quality and should be corrected so that they are more isolated in their scope. i.e. no database interaction at all. My philosophy is avoid the database at all costs, because it is expensive with respect to time.

3) Introduce JUnit4 which don't require database and hibernate initialization for each test case but for test suites, which will substantially reduce the test time we spend on setting up and tearing down databases and make the unit tests more efficient and shorter time, subsequently less problems.

4) Using memory database for cruise testing and Derby database for daily testing. Rationales are the same as 3).

5) Temporary using forMode="perTest" for stabling current AMT build.

Cons: I realize that from our discussions yesterday that 5) will cost time for the build, but may be a way to bridge the problem as try to correct the root cause. However there is a risk of the "oh its working now, let's not touch it" syndrome sneaking in and stopping us at this stage before we fix what is really going on.

6) Current AMT cruise build is 30 minutes long which definitely drag down the productivity. We should try to reduce the time by multiple means, such as splitting Sentry and Ardmore out of frameworks.

Pros: Yes the 30 minute build is something truly amazing in terms of time. Please, if you find some time, present me with some good arguments for different mechanisms for restructuring the build which could make it more efficient. We can then review them and see what we can do going forward.

Well, as lean software development principles go, we should probably stop and fix this problem now.

So what it comes down to is this, I believe we should be fixing the build, at least to get rid of this recurring problem with the failed tests in the framework. We need to work some more build stories into the iterations, and therefore I believe we have to prepare some compelling arguments with solid goals and at least a rough plan of how to get there to present to management so we can encourage him to "buy" some build improvements.

BLOG: WMI - Windows Management Instrumentation

You could easily management other computers settings thru WMI.

For example, you could easily find out the Events, Remote batch file execution, change the file NTFS setting using “”

Win32_NTEventLogFile

Win32_NTLogEvent

Tools

--+ C:\WINDOWS\SYSTEM32\WBEM\WBEMTEST.EXE

--+ WMI CIM Studio (Downloadable from Microsoft).

Jawin is a great tool to bridge java and WMI and any other windows native dlls.

WMI query is like the SQL query but much simpler than limited functionalities.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wql_sql_for_wmi.asp


WMI Reference

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp

Tony

Wednesday, September 27, 2006

BLOG: Java performance tuning

You can make the JVM start to take the advantage of powerful server config (2+ processor, 2G+ memory)

· java server Xmx1g XX:+UseParallelGC
· increase the size of young generation through put ratio.( 5%). If you want to set the ratio to 5%, you need to calc the milliseconds it needs to set the parameter. The 5% = 1 / (1+nnn). Therefore MaxGCPauseMillis(nnn) equals 19. XX:MaxGCPauseMillis

· -XX:+UseLargePages=2m
· Increase the size of permanent generation
· GC threads will equal to cores
· Client Xshare:on
· -XX:+DisableExplicitGC
· You can use JConsole to connect to agent.

http://java.sun.com/performance/

Tuesday, September 26, 2006

EVENT: Sun Java Developer Day

James Gosling was here to give speech. There are total 4 to 5 million java developers world-wide. Java goes everywhere from enterprise, standard, embedded, and smart card. Java has the database associate with it now which is compatible with SQL 92, 99 and 2003.

There was a splash related to NetBeans. The profiler of NetBeans is really fancy to provide you with heap size, GC statistics, thread count, thread state, per method CPU time, call tree, http monitoring, memory leak. It also has collaboration feature. It also has BluePrints like windows project templates.

The source for Java Technology Collaboration

http://dev.java.net/

Java Specifications

http://jcp.org/

Netbeans

http://netbeans.org/

http://share.java.net/

Tony

Be A Developer That Uses AI

Developers will not be replaced by AI, they'll be replaced by developers that use AI. Generative AI tools are revolutionizing the way de...