Wednesday, January 27, 2010

Letter To Cousin Inviting To

Invoking Java programs from ASM

Several months ago I sent a portal to JavaHispano tutorial which explained how to do to invoke functions written in assembly language from Java. And as I spent more than three months since then, I can use on my blog: D.
Here is the content and the first two parts to give you an idea, also I leave the source code and the PDF of the tutorial. Content




Introduction When to use JNI?


Software Requirements


Programming

Implementation
  1. Conclusion References and readings
  2. 1. Introduction
  3. In the java.net site there is a small tutorial titled Invoking Assembly Language Programs from Java 1
  4. but English is not very easy for some new Java programmers or assembler. In java.net explain how the invocation of an ASM program from Java and what to do to achieve it, but do not explain how to do each step. So I've taken on the task of facilitating the understanding of these techniques for the English speakers who are taking their first steps with JNI, and to know a little JNI operation and invocation of applications in assembly is essential when you have applications require intensive operations and server process need to deploy a small low-level program to execute such operations, and thereby reduce the time as it may sometimes be critical.
  5. Also JNI have the ability to invoke functions and procedures written in other languages \u200b\u200bsuch as C / C + + or in our case ASM, for example, when you have legacy systems and will need to use some function of the legacy code will be necessary to develop applications that can perform these functions. For more information on JNI and capabilities please consult the manual available on your site 2 Sun.
  6. should be noted that this is not an introductory tutorial or API JNI therefore be limited to mention a few concepts necessary. Quickly, begin to determine the software that we use and where to get it, but we will not stop to learn how to operate them. Later add some environment variables and start with programming. For this, we present the programs and how to compile, but will be available the source code used in the tutorial. By following this tutorial the reader should be able to load a DLL into any Java application and use the proceeds of any native library.
  7. 2. When to use JNI?
  8. Occasionally, some developers are touch found in situations where an application made entirely in Java will not cover all requirements for such. Some examples of these situations can be:
  9. When in spite of wanting to write the whole application in Java to allow cross-platform compatibility, exit platform features that are necessary to implement and are not supported by the Java standard library . This is referred to as a dependency of the platform.
If you already have a library written in another language and want to make it accessible to your Java code, for example, having to work with legacy code. in these cases the libraries are loaded within the same process using JNI apliaciones, although other more efficient mechanisms operating in separate processes.
If you want to implement portions of code in a low level language like assembly to reduce processing time. For example, in applications that require 3D graphics rendering requires more processing time, will have to write a graphics library in assembly language for better performance 3.
In cases where you want to load a native library in an existing process to avoid the cost of starting a new process and load the library in the same 4 . Also
JNI will be convenient to use when you want to use some features of a Java program from a native code.


Document Invoking Java programs give yourself ASM step
Source
Javahispano
    The tutorial

Tuesday, January 12, 2010

The Wrestler Stream Work

Paseo Blind

Blind Walk is a project initiative in collaboration with Bicitekas Get through your city and contact Braille that seeks to give blind people the opportunity to experience a bike ride.

The tours will be offered every Sunday in the Sunday closing of the Reformation, the volunteers, led by Nancy Salcedo, riding bicycles, tandem bicycles for two passengers, where the second passenger will be a blind person, that in this first phase have been invited by association Contact Braille volunteers give instructions to the participants to start, stop, stop and wait for some movements to be made during the course, after this adventure begins. During the tour, the volunteer tells what happens in addition to warning about the movements you make, all in order that the participant will always know what happens.

Last Sunday was the start of the project, and although the bad weather that decreased attendance were there live a different experience ... shot without eyes. This is part of an awareness-raising exercise in which our eyes are covered with a mask and shot in tandem bicycles, the experience is safe, very rewarding, as we roll, I realize that the ear is my main contact with the outside, I hear the bikes around me, the bells, the laughter of children, cars, truck exhaust and although I know that must be far, no I can help but feel anguish because the sound is very strong and could feel it go by me, confused me some moves, a simple lane change appears to destabilize my balance and lower the foot to find the ground is eternal by the uncertainty of not knowing when makes contact, several times during the tour, I did not understand why I feel that giving circles were walking the bike, I feel sick a bit but I'm still amazed by all the sounds I find: water sources or the claws of the dogs hit the floor, I know them, so they are, but never before had such attention from what I can hear while I'm on the bike.

The Blind Walk will be there every Sunday in the Glorieta de la Reforma Avenue Diana on 9 to 13 hours. The tours last about 30 min. You can participate in many ways, inviting anotándote blind or volunteer to give tours, you can help raise the money to buy another bike tandem and grow the project or maybe just go and give a tour blindfolded and put for a moment in another's shoes.

Saturday, December 12, 2009

Stouffer's Outlet Solon

step Converting dates between time zones (2) Converting

In my previous post titled Converting dates between time zones
  • put an example of how to convert a date / time of a local time zone to a different. But working with the same project found that it should make a date in the UTC time zone to local, and then gave me my technical leader a simple solution changing one line of code example in the previous post, just to do what I needed at that time:
  • In the task you were doing was reading a text file with the data "date" as a series of numbers: "20090921" "1230", which represents the September 21, 2009 at 12:30, so I had to use the date format yyyyMMddkkmm. " This time he received the file represents a date / time in GMT time
    . And this time the area was to go to my local time is CST or UTC-6 (Central Time) . Public void
    cambiarZonaHoraria (String date, String pattern, String tz) { SimpleDateFormat format = new SimpleDateFormat (pattern);
    format.setTimeZone (TimeZone.getTimeZone (tz)); try {System.out.println (format.parse (date));
    } catch (ParseException pe) {pe
    . printStackTrace ();
    }} first creates a new instance of SimpleDateFormat with the parameter "pattern" that tells the body that the text is going to shipping is in this format, in my case "yyyyMMddkkmm."
    Then, most important of what we try do, we will assign our object the TimeZone
    format in which you want to convert the time, in my case was GMT. then simply use the method parse (String)
    to convert our text to a Date in the local timezone, in my case CST, so the end result of this example is that the text "200909211230" in format yyyyMMddkkmm "which represents" 2oo9/09/21
    12:30
     "GMT becomes" 2009/09/21 6:30 

    "in CST and which is 6 hours behind the benchmark of
    Time UTC Coordinated Universal or
    .

    only exceptions must remember catching a throw or make them.


    Sunday, December 6, 2009

    Pink Cm Day Period Due

    dates between time zones

    In a project I'm involved I had to convert some dates in the time zone

    UTC (GMT) time zone
    • CST (Central Time) which is used by most states in Mexico . As the project is entirely based on Java technology, I found the task of finding ways to do this with libraries for Java.
    • found that there are some bookstores, such as Quartz, implement a class for time zone conversion. But in my case, need not rely so heavily on third-party libraries or outside the Java API.
    • found that with TimeZone and DateFormat classes I can do the conversion using the following sentences. public void cambiarZonaHoraria (Date date, String to) {DateFormat dateFormat = new SimpleDateFormat ();
    • TimeZone.getTimeZone TimeZone tz = (to) dateFormat
    . SetTimeZone (tz);
    System.out. println (dateFormat.format (date));} What this does is basically

    instantiate SimpleDateFormat with the local date format create a TimeZone instance with the short name time zone specified by the parameter "to"

    is assigned the new time zone object dateFormat using the method format () dateFormat object is the conversion of our date to a string representing the new date in the time zone you've created, and this date is printed on the screen.
     In the same way you can make conversions between different zones and time zones. 


    Now, note that to create a TimeZone using the short name for the zone. This left a list



    zones with their names and IDs that I got running this little program I found in Java Developers Almanac


    :

    • import java.util.Date; Import
    • java.util.TimeZone;
    • public class
    • ListadoZonasHorarias {public static void main (String [] args) {
    • Date date = new Date ();
    • / / Get the ID of all time zones
    String [ ] zoneIds = TimeZone.getAvailableIDs (); System.out.println ("ID short and long name of zone String shortName = tz.getDisplayName (tz.inDaylightTime (date), TimeZone.SHORT)
    String longname = tz.getDisplayName (tz.inDaylightTime (date), TimeZone.LONG) System . out.print (shortName + "\\ t \\ t Hope you can serve like me. Greetings.