Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Wednesday, June 22, 2011

YourKit Profiler for .NET

ynp_logo.gif

YourKit Profiler provides zero-overhead profiling for your .NET applications and makes code profiling and memory usage optimization simple and fast.
  • Supports:
  • .NET Framework 2.0, .NET Framework 3.x, .NET Framework 4
  • Integration with Microsoft Visual Studio 2005, 2008 and 2010
  • Windows 2003/XP/Vista/2008/7
  • 32-bit and 64-bit systems

  • Fastest code profiling for locating bottlenecks and solving application performance problems



  • Real-time, live performance metrics with graphs, stacks and threads



  • Memory profiling for optimizing memory usage and discovering memory leaks



  • Profiles all types of .NET applications, including standalone .NET applications, .NET web services, Silverlight 4 applications, .NET Windows services, .NET DCOM objects, ASP.NET and more



  • User-friendly interface provides results that are easy to interpret



  • Smart tools for locating problems automatically



  • On-demand profiling lets you profile only when needed to ensure lowest overhead

  •  

  • Read more: YourKit

    YouTrack 3.0 — Fully Customizable Bug Tracker, Now Free For Small Teams

    This spring-summer time appeared to be very hot for JetBrains. And today we are happy to announce one more major release —please welcome YouTrack 3.0, a fully customizable version of our intelligent issue and bug tracker with a Free Pack now available for small teams.
    YouTrack 3.0 introduces two major enhancements: customizable workflow and complete issue attributes customization. With these additions, a team can completely automate the issue life-cycle management based on its specific process needs, while still enjoying an intelligent, extremely usable and developer-oriented issue tracker.
    With YouTrack 3.0, now you can:
    • Define your own workflow to automate issue life-cycle management. Watch demo.
    • Customize the set of issue attributes and their values
    • Submit issues by email
    • Automatically close or modify any related issue attributes from VCS Commit Comment
    • Access and handle your issues from your mobile device
    (more...)
    Read more: JetBrains zone

    Monday, June 13, 2011

    Java to .NET Migration WhitePaper–Trends and Benefits

    I stumbled upon an interesting whitepaper written by Pique solutions. It spoke about the trends and insights and the strategic investments being made by companies, while doing a development platform migration from Java to .NET.

    According to the whitepaper, the primary reasons of migration included technical and business reasons, platform stability and reliability, vendor support, total cost of ownership, and staff expertise and the availability of skills.

    Here’s an interesting observation made in the whitepaper:
    A higher incidence of companies migrating to .NET, with 28% more enterprises migrating from Java to .NET than from .NET to Java. Nearly one in five of the 782 companies in the survey already migrated from Java to .NET, with nearly half of those migrations occurring within the past six months.
    Assuming this survey is unbiased, that is a pretty impressive number! Here’s an interesting chart that displays the top three business drivers for Migration

    Read more: devCurry

    Monday, May 30, 2011

    Marrying Java to Microsoft .NET in the Cloud

    There’s nothing particularly new about having to integrate applications built using diverse programming models. What is changing is the venue where that integration is starting to take place. As cloud computing continues to evolve, it’s becoming pretty clear that IT organizations are going to have to start integrating applications outside the four walls of the data center.

    To help address this issue, JNBridge released today version 6.0 of its JNBridgePro middleware platform for integrating Java and Microsoft .NET frameworks. According to JNBridge CTO Wayne Citrin, the new release extends the capabilities of the company’s middleware platform to cloud computing environments both inside and outside the enterprise.

    Obviously, IT organizations can accomplish many of the same things using Web services and REST interfaces and little brute force. But Citrin says that JNBridgePro is designed to provide a richer set of application programming interfaces that provide much better levels of performance. In addition, as a superset of many programming interfaces, JNBridgePro is a lot more accessible and results in better overall performance across disparate programming models, he said.

    JNBridgePro is designed to be a plug-in for both Eclipse and Visual Studio development environments, which Citrin says is one of the things that make the company’s middleware so accessible to developers.

    JNBridge3.gif

    Read more: CTO Edge

    Thursday, May 19, 2011

    Thrift

    Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml.
    Originally developed at Facebook, Thrift was open sourced in April 2007 and entered the Apache Incubator in May, 2008.

    Read more: Apache Thrift

    Wednesday, April 27, 2011

    Using the Tika Java Library In Your .Net Application With IKVM

    This may sound scary and heretical but did you know it is possible to leverage Java libraries from .Net applications with no TCP sockets or web services getting caught in the crossfire? Let me introduce you to IKVM, which is frankly magic:

    IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework. It includes the following components:
    • A Java Virtual Machine implemented in .NET
    • A .NET implementation of the Java class libraries
    • Tools that enable Java and .NET interoperability
    Using IKVM we have been able to successfully integrate our Dovetail Seeker search application with the Tika text extraction library implemented in Java. With Tika we can easily pull text out of rich documents from many supported formats. Why Tika?  Because there is nothing comparable in the .Net world as Tika.
    This post will review how we integrated with Tika. If you like code you can find this example in a repo up on Github.

    Compiling a Jar Into An Assembly
    First thing, we need to get our hands on the latest version of Tika. I downloaded and built the Tika source using Maven as instructed. The result of this was a few jar files. The one we are interested in is tika-app-x.x.jar which has everything we need bundled into one useful container.
    Next up we need to convert this jar we’ve built to a .Net assembly. Do this using ikvmc.exe.
    tika\build>ikvmc.exe -target:library tika-app-0.7.jar
    Unfortunately, you will see tons of troublesome looking warnings but the end result is a .Net assembly wrapping the Java jar which you can reference in your projects. 

    Using Tika From .Net
    IKVM is pretty transparent. You simply reference the the Tika app assembly and your .Net code is talking to Java types. It is a bit weird at first as you have Java versions of types and .Net versions. Next you’ll want to make sure that all the dependent IKVM runtime assemblies are included with your project. Using Reflector I found that the Tika app assembly referenced a lot of IKVM assemblies which do not appear to be used. I had to figure out through trial and error which assemblies where not being touched by the rich document extractions being done. If need be you could simple include all of the referenced IKVM assemblies with your application. Below I have done the work for you and eliminated all references to all the IKVM assemblies which appear to be in play.

    jni4net

    bridge between Java and .NET (intraprocess, fast, object oriented, open-source)

    How it works
    jni4net-overview.png

    Using reflection we grab public method signatures for core classes of .NET and Java and generated proxy classes for the other side.
    We have .NET version of JNI API. 
    We use JNI to forward the call from .NET proxies to methods on real Java objects. 
    We use JNI to register .NET implementation of native methods of Java proxies to forward call to methods on real .NET objects.
    Features
    Intraprocess - it means that both VMs are in same process. Any call uses same thread and same stack for both environments. It's relatively fast.
    Proxies - we use proxies which look like and behave like the real/original object. Marshaled by reference except for primitive types and arrays.
    Garbage collected - if you don't create cycle between VMs heaps, the proxies and instances are collected and released properly.
    Proxygen - tool to wrap your own library. Works with reflection, so you need just .jar or .dll, and proxygen config file. You could wrap most CLR or JVM classes.
    Core - core classes of JDK and .NET framework are already included in jni4net. Using that for reflection and invocation across the boundary is possible.
    Samples - are included with the binaries. See ReadMe.txt in directories
    Troubleshooting - use knowledge base or ask people
    Platforms - at the moment only Windows 32 and 64 bits. CLR 2.0 and CLR 4.0. JRE 1.5 and above.
    License - opensource, GPL tools and LGPL runtime
    Status - currently Alpha quality. Lot of work ahead, lot of ideas, lot of missing features, looking forward to community feedback.
    Contact - use mailing group or talk to pavel.savara@gmail.com
    .NET/C# to Java Hello World -> Full sample

    using net.sf.jni4net;
    public class Program
    {
        private static void Main()
        {
            Bridge.CreateJVM(new BridgeSetup());
            java.lang.System.@out.println("Greetings from C# to Java world!");
        }
    }

    Read more: jni4net

    Monday, April 11, 2011

    Top 20 Core Java Interview questions asked in Investment Bank

    This is a new series of sharing core Java interview question on Finance domain and mostly on Big Investment bank. Anybody who is preparing for any Java developer Interview on any Investment bank can be benefited from these set of core Java Interview questions. I have collected these questions from my friends and I thought to share with you all.  I hope this will be helpful for both of us. Please share answers for unanswered question and let us know how good these interview questions are.

    1. What is immutable object? Can you write immutable object?
    You need to make class final and all its member final so that once objects gets crated no one can modify its state. You can achieve same functionality by making member as non final but private and not modifying them except in constructor.

    2. Does all property of immutable object needs to be final?
    Not necessary as stated above you can achieve same functionality by making member as non final but private and not modifying them except in constructor.

    3. What is the difference between creating String as new () and literal?
    When we create string with new () it’s created in heap and not added into string pool while String created using literal are created in String pool itself which exists in Perm area of heap.

    4. How does substring () inside String works?
    Another good question, I think answer is not sufficient but here it is “Substring creates new object out of string by taking a portion of original string”.

    5. Which two method you need to implement for key in hashMap ? 
    (equals and hashcode) read How HashMap works in Java for detailed explanation.

    Thursday, April 07, 2011

    Java: Ignore/Trust an invalid SSL cert for https communication

    Very Once a while you will need your Java app to talk to a pre prod server (Web Service) over https, but you face the issue is that SSL is not a valid/expired/self signed cert... 
    You may get an error that looks like

    org.springframework.web.client.ResourceAccessException: I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)

    You can add code to your app to ignore it or you can ask java to ignore that server's bad cert... The following is how i get java to ignore that invalid cert.
    How to Ignore/Trust a Single Cert

    WINDOWS
    "%JAVA_HOME%\bin\keytool" -import -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -alias abc-dev -file abc-dev.cer

    MAC
    sudo $JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/lib/security/cacerts -alias abc-dev -file abc-dev.cer

    CentOS/Linux 
    sudo $JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -alias abc-dev -file abc-dev.cer
    How To Ignore/Trust a CA root certificate
    --Note: there maybe multi files for a CA cert so do the following command for each file.

    WINDOWS
    "%JAVA_HOME%\bin\keytool" -import -trustcacerts -alias myCA -file myCA.cer.txt -keystore
    "%JAVA_HOME%\jre\lib\security\cacerts"

    Wednesday, March 30, 2011

    15 Must Know Java Interview Questions After 2 Years of Experience

    Interview Questions that every developer should have the answer
    Enterprise Java Application development is growing every day and new features being introduced but the the beginners have always start from the basics. The questions listed below are what in general a Java developer should be able to answer after 2 years of experience. (Assuming no prior exposure to Java)
    Core Java
    1) What is the purpose of serialization?
    2) What is the difference between JDK and JRE?
    3) What is the difference between equals and ==?
    4) When will you use Comparator and Comparable interfaces?
    5) What is the wait/notify mechanism?
    6) What is the difference between checked and unchecked exceptions?
    7) What is the difference between final, finally and finalize?
    JEE
    8) What is the difference between web server and app server?
    9) Explain the Struts1/Struts2/MVC application architecture?
    10) What is the difference between forward and sendredirect?
    General
    11) How does a 3 tier application differ from a 2 tier one?
    12) How does the version control process works?
    13) What is the difference between JAR and WAR files?

    Read more: Extreme Java

    Sunday, March 13, 2011

    Java removed from Linux Standard Base 4.1

    The Linux Standard Base 4.1 has been released by the LSB Workgroup at the Linux Foundation. Version 4.1 comes complete with an updated specification, a new version of the SDK, and updated Linux Application Checker and Linux Distribution Checkers.

    Previously included in LSB 4.0 in a "Trial Use" status, Java has now been removed from LSB 4.1. The release notes point out that licensing issues for the compliance test suite "make it impossible to include Java as a language". The workgroup is looking into creating an LSB compliant Java runtime environment which could become part of a later version of the LSB.

    Other "Trial Use" modules from LSB 4.0, covering multimedia (ALSA), security (NSS) and desktop miscellaneous (xdg-utils) have been promoted to part of LSB 4.1 and are now required submodules. The GTK+, Cairo and CUPS libraries have also been updated and three new test suites added. Further details are available in the release notes but generally, the workgroup expects "broad compatibility between 4.0 and 4.1". The updated tools and binary components for LSB 4.1 are available to download.

    Read more: The H Open

    Wednesday, March 09, 2011

    Remote desktop on mobile phones

    Project Description
    Mobile Remote Desktop enables you to connect to your computer from mobile phones using bluetooth connectivity. Once connected, Mobile Remote Desktop gives you the control of mouse and keyboard of your computer from mobile phone.

    Read more: Codeplex

    Monday, March 07, 2011

    Remotely debug a mobile web app

    jsconsole.com is a simple JavaScript command line tool. However, it also provides the ability to bridge across to other browser windows to remotely control and debug that window - be it in another browser or another device altogether.

    In fact, mobile web app debugging is so damn tricky, that I gave up, and decided to build this very tool instead. See the videos examples if you'd rather see this in action now.

    Creating a session

    To create a new session, in the jsconsole prompt, simply run:

    :listen

    This will yield a unique key along the lines of FAE031CD-74A0-46D3-AE36-757BAB262BEA. Now using this unique key, include a <script> in the body element (not in the head) of your web app that you wish to debug:

    <script src="http://jsconsole.com/remote.js?FAE031CD-74A0-46D3-AE36-757BAB262BEA" ></script>

    Now any calls to console.log from your web app will display the result in the jsconsole session that is listening to your key. Equally, if you run a command in the jsconsole session, the code will injected in to your web app and the result returned to jsconsole.

    In addition to generating a new code with :listen, you can also ask jsconsole to listen to a predefined code (but for your own security, try to chose something unique that only you know):

    :listen FAE031CD-74A0-46D3-AE36-757BAB262BEA

    Now I can use the same remote key in my web app to avoid having to regenerate a new code each time. Note that only the last remote client (i.e. your web app) to connect to jsconsole will recieve remote debug calls - previous windows will be ignored.

    Read more: jsconsole.com

    Sunday, March 06, 2011

    libgdx wiki changes and request

    Tony has been hard at work preparing yet another of his awesome tutorials. I started rearranging the Wiki a little bit a week ago. It now has a proper table of contents. The Wiki will not be publically editable, maybe at some point we’ll create a community Wiki. Go check out our new fangled Wiki here and tell us what you think!

    I also created a new video tutorial, this time i present basic audio playback with Music and Sound. I’ll continue with those (even though netray says it’s a waste of time, but it’s fun!). Next up is input processing, after that i’ll probably do a little opengl tutorial and then discuss the graphics classes.
    Finally i have a request for all you people that have made a libgdx game. Provide me with a link to a video (you all used the desktop functionality to produce a demo video, right?), maybe a YouTube or Vimeo link, whatever works for you. Also provide me with the title and market link of your game/application. I plan on creating a demo reel video of sorts for the Google Code page so people get to know what things are possible with libgdx.

    Here’s the list of games/demos i have so far

    Read more: Badlogic games

    Immutable Law of Java #20: The new Keyword

    im•mu•ta•ble [him-moo-tribble]
       – an adjective: not mutable; unchangeable; changeless.

    If you’re learning Java, it’s important to know some of the immutable rules of the language. I’m going to discuss about a dozen of them in a series of articles, with the first one being discussed today: immutable rule #20. You may be wondering why are we starting at rule #20? You’ll have to wait for immutable rule #37 to find that out, so be patient.

    So here’s the first immutable rule of Java, also known as immutable rule #20:
    In Java, all objects are created using the keyword new, except for the objects that are created without using the keyword new.
    You know, when you create an instance of an object, you need to do something like this:

    Byte me = new Byte(1); or Long johns = new Long(2);

    So, whenever you create an instance of an object in Java, you always use the keyword new; always; every time...except that is, for the times when you don’t.
    Stringing us along.
    One of those times you don't need to use the keyword new is with String objects. String objects don’t need to be created with the keyword new. You can create a String like this:

    String bean = “lima”;

    Of course, Strings really sit on the fence with regards to this issue, as you can use the keyword new to create them if you really want. So, you could actually do this:

    String lima = new String(“Peru”);

    Of course, you shouldn’t do that, unless of course, you think you should (another immutable rule, I guess). It has something to do with the String pool or something. If you use the keyword new when creating a String, that instance gets its own, unique, special memory location, even if there are a hundred other Strings that use the exact same set of characters in their composition. If you don’t use the keyword new, two Strings that are the same, such as “Peru” and “Peru” will end up sharing the same memory location. It’s a great optimization to slap two Strings that are the same into the same chunk of memory, especially if you’re using plenty of String objects in your application.

    Friday, March 04, 2011

    IKVM.NET 0.46 Release Candidate 0

    Finally, after way too long, the first 0.46 release candidate is available.

    What's New (relative to IKVM.NET 0.44):

    • Integrated OpenJDK 6 b22.
    • Added -Xreference: option to ikvm.exe and ikvm.runtime.Startup.addBootClassPathAssemby() API.
    • The binaries zip now includes lib/ikvm-api.jar to avoid having to run ikvmstub to get access to the IKVM Java APIs.
    • Ported parts of fdlibm to C# to use for StrictMath methods tan, cbrt, floor, pow, hypot, expm1 and log1p.
    • Add support for serializing .NET exceptions in Java. We don't serialize the actual object, but a placeholder instead, to avoid having to implement full .NET serialization interop.
    • Added IL optimization step to code generator.
    • Added SynchronizationContext for AWT event thread.
    • Many IKVM.Reflection improvements and bug fixes.
    • Many Swing/AWT improvements.
    • Implemented IPv6 support (.NET only) for java.net package APIs.
    • The sun.boot.class.path system property now points to VFS to allow javac to work (although a bit slow, because the boot class files are dynamically generated on demand).
    • Resource and generated stub classes are now projected into the virtual IKVM home directory, to make code that assumes that resources live in jars happy.
    • Improvements to @ikvm.lang.Internal handling.
    • Many minor improvements.
    Fixes since previous development snapshot:
    • IKVM.Reflection: Added limited support for #- metadata stream ("uncompressed" table heap). ParamPtr table is not yet implemented.
    Read more: IKVM

    Thursday, March 03, 2011

    Apple vanishes Java from Mac OS X Lion

    Apple has removed the Java runtime from its upcoming Mac OS X Lion, according to a report based on firsthand experience with a preview release of the OS.

    Appleinsider reports that the latest developer release of Mac OS X 10.7 Lion removes both Java and Rosetta, the package used to run PowerPC code on Intel-based Macs. But according to the fanboi news site, Lion includes a mechanism for automatically downloading the latest version of Java for the Mac.
    In late October, Apple caused a fair amount of unrest among Java developers when, in the release notes of a Java update, it said that Java on Mac had been "deprecated" and that it "may be removed from future versions of Mac OS." Now, it has been removed, but the future of Java development on Macs is secure. In November, Apple and Oracle announced that they would collaborate on a Mac-based incarnation of OpenJDK, an open source version of Java.

    Apple said it would contribute "most of the key components, tools and technology" needed for a Java SE 7 implementation on Mac OS X, including a 32-bit and 64-bit HotSpot-based Java virtual machine, class libraries, a networking stack, and base code for a new graphical client.

    Read more:  The register

    Monday, February 28, 2011

    JVM Tutorials - Herong's Tutorial Examples

    This free book is a collection of notes and sample codes written by the author while he was learning JVM himself. Topics include JVM (Java Virtual Machine), HotSpot, JRockit, GC (Garbage Collection), Memory, Stack overflow, CDS (Class Data Sharing), Runtime, Reflection.

    Read more: JVM Tutorials - Herong's Tutorial Examples

    Sunday, February 20, 2011

    Java 6 Update 24 Plugs 21 Security Holes

    A new version of Java fixes at least 21 security flaws in the widely-distributed software bundle. Updates are available for Windows, Linux and Solaris users.
    If you’re curious about the security updates included in Java 6 Update 24, see the release notes from Oracle. As I have shown in many stories on this blog, outdated Java installations can give bad guys and malware a foothold on your system, so if you use Java, please keep it updated. If you have Java installed but can’t remember why, you might consider simply uninstalling it altogether (you can always reinstall it later). I only keep Java installed on one system of mine, and I disable the Java plugin from within Mozilla Firefox (Tools, Add-ons, Plugins).

    Read more: Krebs on security

    Thursday, February 17, 2011

    Пишем игру для Android. Часть 3. Управление игровыми объектами

    В этой статье мы рассмотрим две темы: управление игровыми объектами и их взаимодействие. Мячик у нас уже летает, осталось сделать, чтобы он отражался от стен и ракеток; также стоит реализовать управление нижней ракетки игроком, а верхней — неким алгоритмом.
    Итак, приступим.
    Движение мячика
    Для начала добавим в GameObject следующие полезные функции:

    GameObject.java

    /** Верхняя граница объекта */
    public int getTop() { return mPoint.y; }
    /** Нижняя граница объекта */
    public int getBottom() { return mPoint.y + mHeight; }
    /** Левая граница объекта */
    public int getLeft() { return mPoint.x; }
    /** Правая граница объекта */
    public int getRight() { return mPoint.x + mWidth; }
    /** Центральная точка объекта */
    public Point getCenter() { return new Point(mPoint.x + mWidth / 2, mPoint.y + mHeight / 2); }
    /** Высота объекта */
    public int getHeight() { return mHeight; }
    /** Ширина объекта */
    public int getWidth() { return mWidth; }
    /** @return Прямоугольник, ограничивающий объект */
    public Rect getRect() { return mImage.getBounds(); }
    /** Проверяет, пересекаются ли два игровых объекта */
    public static boolean intersects(GameObject obj1, GameObject obj2)
    {
       return Rect.intersects(obj1.getRect(), obj2.getRect());
    }

    Игровые объекты ничего не знают ни о друг друге, ни об игровом поле, поэтому все столкновения будут обрабатываться GameManager-ом. Итак, рассмотрим сначала такую ситуацию:
    001.jpg
    Read more: Virtual Reality Online