Tagleen
      


Last Visited:

  • View
  • InfoInfo
  • Filesattachmen
Programming
Edit this page PreatyPrint Send E-mail

  • Java Practices: Generating unique IDs
    Tags: Java Programming Hash UID UniqueID ID

    • Clipping
      • Style 2 - SecureRandom and MessageDigest
        \The following method uses SecureRandom and MessageDigest :
        \ * upon startup, initialize SecureRandom (this may be a lengthy operation)
        * when a new identifier is needed, generate a random number using SecureRandom
        * create a MessageDigest of the random number
        * encode the byte returned by the MessageDigest into some acceptable textual form
        * check if the result is already being used ; if it is not already taken, it is suitable as a unique identifier
        \The MessageDigest class is suitable for generating a "one-way hash" of arbitrary data. (Note that hash values never uniquely identify their source data, since different source data can produce the same hash value. The value of hashCode, for example, does not uniquely identify its associated object.) A MessageDigest takes any input, and produces a String which :
        \ * is of fixed length
        * does not allow the original input to be easily recovered (in fact, this is very hard)
        * does not uniquely identify the input ; however, similar input will produce dissimilar message digests
        \MessageDigest is often used as a checksum, for verifying that data has not been altered since its creation.
        \Example

        import java.security.SecureRandom;
        import java.security.MessageDigest;
        import java.security.NoSuchAlgorithmException;
        \public class GenerateId {
        \ public static void main (String... arguments) {
        try {
        //Initialize SecureRandom
        //This is a lengthy operation, to be done only upon
        //initialization of the application
        SecureRandom prng = SecureRandom.getInstance("SHA1PRNG");
        \ //generate a random number
        String randomNum = new Integer( prng.nextInt() ).toString();
        \ //get its digest
        MessageDigest sha = MessageDigest.getInstance("SHA-1");
        byte result = sha.digest( randomNum.getBytes() );
        \ System.out.println("Random number: " + randomNum);
        System.out.println("Message digest: " + hexEncode(result) );
        }
        catch ( NoSuchAlgorithmException ex ) {
        System.err.println(ex);
        }
        }
        \ /**
        * The byte returned by MessageDigest does not have a nice
        * textual representation, so some form of encoding is usually performed.
        *
        * This implementation follows the example of David Flanagan's book
        * "Java In A Nutshell", and converts a byte array into a String
        * of hex characters.
        *
        * Another popular alternative is to use a "Base64" encoding.
        */
        static private String hexEncode( byte aInput){
        StringBuffer result = new StringBuffer();
        char digits = {'0', '1', '2', '3', '4','5','6','7','8','9','a','b','c','d','e','f'};
        for ( int idx = 0; idx < aInput.length; ++idx) {
        byte b = aInputidx;
        result.append( digits (b&0xf0) >> 4 );
        result.append( digits b&0x0f );
        }
        return result.toString();
        }
        }


        Example run :
        \>java -cp . GenerateId
        Random number: -1103747470
        Message digest: c8fff94ba996411079d7114e698b53bac8f7b037
    • Posted on 2007-11-08 10:02:56, by milorad
  • Project List
    Tags: CVS Java WebCVS Development Programming

    • Clipping
      • JCVS is a Java implementation of the CVS client/server protocol, as well as several client applications that leverage that protocol. The applications include jCVS II, a full featured CVS client, jCVS Servlet, a simple servlet used to browse CVS repositories, and jcvsweb, a more modern web application that provides a sophisticated CVS repository browser/portal.While www.jcvs.org is designed as a CVS repository portal, it is also here to help with the use and development of jCVS clients. Those who wish to write code with the jCVS package will find the downloads they need, as well as discussion forums to assist with any questions.The areas below provide a number of links related to jCVS, its use, and development. If you are unable to find what you need, or the answer to your question, you are invited to inquire in one of the discussion forums.
    • Posted on 2007-11-21 07:44:19, by milorad
  • wiki/Java API - Skype Developer Zone
    Tags: 4Olja Skype Programming WebProgramming Tagleen

    • Clipping
      • Skype4Java is an library which represents the Skype API as objects, with properties, commands, and events and notifications by Java. Using Skype4Java enables developers to make plug-ins on multi-platform and use good IDEs such as eclipse, IntelliJ and NetBeans.This project supports many functions of Skype API. We started implementation of Skype 2.5 and 2.6 functions.Skype is supporting Koji Hisano <UBION INC.> and Bart Lamot to develop an official Java API for the Skype API. This project started from 2006/05 by combining Skype API for Java and JSA to develop one-cross platform API for Java programmers.
    • Posted on 2007-11-29 09:18:58, by milorad
  • Groovy - Home
    Tags: Java ScriptingLanguage WebProgramming Programming WebDevelopment

    • Clipping
      • Groovy... * is an agile and dynamic language for the Java Virtual Machine * builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk * makes modern programming features available to Java developers with almost-zero learning curve * supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain * makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL * increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications * simplifies testing by supporting unit testing and mocking out-of-the-box * seamlessly integrates with all existing Java objects and libraries * compiles straight to Java bytecode so you can use it anywhere you can use Java
    • Posted on 2008-01-31 23:10:26, by milorad
  • HP Unix - Java - HPjmeter 3.0.01 Overview
    Tags: Java Programming GarbageCollector MemoryLeak Tools ProgrammingTools

    • Clipping
      • HPjmeter 3.0.01 features include the following functionality:Automatic problem detection and alerts * Memory leak detection alerts with leak rate * Thread deadlock detection * Abnormal thread termination detection * Expected out of memory error * Excessive method compilationDynamic real-time display of application behavior * Java heap size * Garbage collection events and percentage time spent in garbage collection * CPU usage per method for hottest methods * Object allocation percentage by method * Object allocation percentage by object type * Method compilation count in the JVM dynamic compiler * Number of classes loaded by the JVM * Thrown exception statistics * Multi-application, multi-node monitoring from a single consoleDrill down into application profile metrics * Graphic display of profiling data * Call graphs with call count, or with CPU or clock time * Per-thread display of time spent in nine different states * Per-thread or per-process displayIntegrated, in-depth garbage collection analysis * Easy-to-access graphic display of resource utilization by the garbage collector, including visual presentation of the impact of the garbage collector on application performance * User-configurable graphs for flexibly presenting the collected GC data in alternate relationships * Graphic display of garbage collection behavior that provides insight into thread activity
    • Posted on 2008-03-17 03:14:32, by milorad
  • Using JavaScript as a Real Programming Language
    Tags: Java JavaScript JS Programming Research TechnicalReport Sun Finland

    • Clipping
      • Using JavaScript as a Real Programming LanguageAuthor(s):Tommi Mikkonen and Antero TaivalsaariReport Number: Date Published: Available Formats:TR-2007-168 October 2007 Portable Document Format (PDF)Request Hard CopyAbstractWith the increasing popularity of the World Wide Web, scripting languages and other dynamic languages are currently experiencing a renaissance. A whole new generation of programmers are growing up with languages such as JavaScript, Perl, PHP, Python and Ruby. The attention that dynamic languages are receiving is remarkable, and is something that has not occurred since the early days of personal computers and the BASIC programming language in the late 1970s and early 1980s.At the same time, the web is becoming the de facto target platform for advanced software applications, including social networking systems, games, productivity applications, and so on. Software systems that were conventionally written using static programming languages such as C, C or Java™, are now built with dynamic languages that were originally designed for scripting rather than full-scale application development.At Sun Labs, we have created a new, highly dynamic web programming environment called the Lively Kernel that is built entirely around JavaScript. As part of this effort, we have written a lot of JavaScript code and applications that exercise the JavaScript language in a different fashion than the typical JavaScript programs found on commercial web sites. Among other things, we have used JavaScript as a systems programming language to write the Lively Kernel itself.In this paper we summarize our experiences using JavaScript, focusing especially on its use as a real, general-purpose programming language
    • Posted on 2008-07-01 07:45:00, by milorad
  • Web Applications - Spaghetti Code for the 21st Century
    Tags: Java JavaScript JS Programming Research TechnicalReport Sun Finland

    • Clipping
      • Web Applications - Spaghetti Code for the 21st CenturyAuthor(s):Tommi Mikkonen and Antero TaivalsaariReport Number: Date Published: Available Formats:TR-2007-166 June 2007 Portable Document Format (PDF)Request Hard CopyAbstractThe software industry is currently in the middle of a paradigm shift. Applications are increasingly written for the World Wide Web rather than for any specific type of an operating system, computer or device. Unfortunately, the technologies used for web application development today violate well-known software engineering principles. Furthermore, they have reintroduced problems that had already been eliminated years ago in the aftermath of the “spaghetti code wars” of the 1970s. In this paper, we investigate web application development from the viewpoint of established software engineering principles. We argue that current web technologies are inadequate in supporting many of these principles. However, we also argue that there is no fundamental reason for web applications to be any worse than conventional applications in any of these areas. Rather, the current inadequacies are just an accidental consequence of the poor conceptual and technological foundation of the web development technologies today.
    • Posted on 2008-07-01 07:45:33, by milorad
  • Zsolt on tech: Symbolic link not allowed or link target not accessible...
    Tags: Linux Command Help Programming apache2 WebProgramming SystemAdmin

    • Clipping
      • "Symbolic link not allowed or link target not accessible..."
        Apache 2 refused to serve pages with that claim in the error_log (Suse 10.1). I had tried everything (permissions, ownership, etc.) - nothing worked. My httpd.conf piece looked really perfect:
        \<Directory "/srv/www/htdocs">
        Options FollowSymlinks
        AllowOverride None
        Order allow,deny
        Allow from all
        </Directory>
        \and no success. Then, I found the line in the httpd.conf:
        \Include /etc/apache2/default-server.conf
        \Yes, yes, that include file contained a configuration for the document root, and certainly overwrote my settings. So, if your settings look really good, and the symlink problem still exists - look for such an include.
        \The problem seems to be obvious - but search Google for it, and you may be surprised...
    • Posted on 2008-07-02 13:18:48, by milorad
  • CVS FAQ - Ximbiot - CVS Wiki
    Tags: CVS CVSadmin Programming SystemAdmin

    • Clipping
      • How do i generate a passwd file in $CVSROOT/CVSROOT?
        \Please see the Cederqvist for information on the format of the CVSROOT/passwd file.
        \My favorite method for generating crypted passwords is using the Perl crypt function:
        \perl -e 'print crypt "password", "sa"' >>$CVSROOT/CVSROOT/passwd
        \Where "sa" is the salt, or an arbitrary two character string which is used to encrypt the password. You will of course have to subsequently edit the passwd file to get the generated crypted password string into the proper location.
        \Another method you can use is to cut and paste the password from a UNIX passwd file, but this probably won't work if you are using "shadowed" passwords. Derek 12:32, 25 Jul 2005 (EDT)
        \Please also note that, if using multiple repositories e.g. for security reasons, each repository must provide its own password file in $CVSROOT/CVSROOT/passwd. A randomized generation of the salt to provide the password string is suggested here: http://www.faqs.org/docs/ldev/0130091154_201.htm.
        \Also note here, though, that the example provides a general user access as third field of the password row that is generated (for more on that, see the Cederqvist).
        \/Wilmer T
        \htpasswd command should be used to generated passwd file in the $CVSROOT/CVSROOT directory.
        \htpasswd is the default built in command in linux. To create passwd file and storing userrname and encrypted passwd in the file. htpasswd -c passwd userA return prompts for password for userA and Re-Type confirmation. To add more username's in the passwd file use the following command.
        \SYNTAX : htpasswd -b <PASSWD FILE> <USERNAME> <PASSWORD>
        EXAMPLE: htpasswd -b passwd userB userB htpasswd -b passwd userC userC
    • Posted on 2008-10-29 09:45:35, by milorad