Pencarian

Rss Posts

 

 

 

Berita pada bulan September, 2010

Introduction to PHP – Bradley Holt

Sep 11, 2010

Matthew Weier O?Phinney and I are giving an Introduction to PHP presentation this morning at Vermont Code Camp. I?ve posted the slides to SlideShare and the example PHP scripts are available on GitHub. If you are at Vermont Code Camp and attended our session, please take a minute to give us feedback on Joind.in.

Marty Jones: Spring 3 session level Model Attributes with Multi Tab browsers

Sep 11, 2010

I wanted to share a solution that I came up with using Spring 3 with SessionAttributes and multiple tabs within the same session. Basically the issue is that if you open the first tab and do a get
to load the command object into the session and then open a second tab and do a get on the same controller with a different command object then the first tab’s command object has been replaced by the second tab’s command object and if you submit the form on the first tab then it will update the second tab’s command object with the data from the first command object!

Spring by default uses the class DefaultSessionAttributeStore to store and retrieve the command objects from the session based upon the session attribute name only. This is what causes the command objects to be stomped on by multiple requests within the same session.

This is a known issue and a JIRA ticket has been created that will address this in version 3.1M1.

To address this issue until the fix is incorporated into Spring, I created the following solution:

I created the a class that implements the SessionAttributeStore interface. This class stores and retrieves the session level command objects based upon a unique (conversation id) that is automatically generated when the command object is stored on the session. So when you do a get request with a controller that has session attributes and you assign your command object to the model map, the storeAttribute method will be invoked and it will generate a unique conversation id (System.currTimeInMillis()) and append this to the attribute name (your command object name) and store it on the session as well as set the conversation id as a request attribute so that the view that is displayed can post back the conversation that it will be involved in. So all you have to do is add a hidden input field in your form that will post back the conversation id that it is in and the controller will issue a retrieveAttribute method and based upon the incoming conversation id will retrieve the correct command object from the session. I created a simple tag library that will create a hidden input field for you.

It is pretty simple to setup, basically you do the following:

In your dispatcher-servlet.xml file you define the class that you want to do the storing and retrieving of command objects from the session

<bean id="sessionConversationAttributeStore" class="com.marty.support.SessionConversationAttributeStore">    <property name="numConversationsToKeep" value="10"/></bean>

Then you tell the AnnotationMethodHandlerAdapter class that you want to use a custom sessionAttributeStore:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">    <property name="webBindingInitializer">        <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">            <property name="conversionService" ref="conversionService" />        </bean>    </property>    <property name="sessionAttributeStore">        <ref bean="sessionConversationAttributeStore"/>    </property>     </bean>

Finally you add the following tag library call inside your forms that use session model attributes:

<sessionConversation:insertSessionConversationId attributeName="<your command name here>"/>

Here is a link to a sample application that shows how to use the custom SessionAttributeStore along with the source code for the SessionConversationAttributeStore class and the SessionConversationIdTag tag library.

Hopefully someone else will find this helpful.

Marty

MySQL relay-log-space-limit vs. your page cache

Sep 10, 2010

Leif (who works for Spinn3r) published a great post on the mySQL relay-log-space-limit variable and using the page cache efficiently:
When the SQL thread is not able to keep up, logs will accumulate. You can set the location of your relay logs with the relay-log option; in the default configuration (and many production configurations), the relay logs are stored on the same disk as the rest of MySQL?s data. If the total size of the relay logs ever exceeds relay-log-space-limit, the IO thread will pause until the SQL thread has moved on to its next file and deleted its previous one.
Unfortunately, relay-log-space-limit defaults to zero (unlimited). This means that when the SQL thread can?t keep up, the slave?s relay logs will continue to accumulate indefinitely (until its disk fills up). When the total size of those logs approaches the amount of vfs page cache available, the SQL thread will begin to read them from disk (instead of getting cache hits), which will exacerbate the IO shortage that caused the problem in the first place.

Discover a Bit of JavaOne

Sep 03, 2010

If you’ll be in the San Francisco area during JavaOne week, and you’re interesting in attending some of JavaOne, but don’t want to pay for the entire conference, consider purchasing a JavaOne / Oracle Develop Discover pass. The base Discover pass costs just $75 and provides you with entry into the keynote addresses, the exhibition halls, the Mason Street Tent (where I’ll be spending quite a lot of time), Oracle Mix, and more. If you’d like to attend a few sessions, consider the Discover Plus pass, which provides your choice of three OpenWorld or JavaOne / Oracle Develop sessions and some other extras, for $695.

Note that these prices are the pre-conference prices — you need to purchase your Discover pass by September 18 to get these rates. If you purchase your pass at the conference, the cost will be $125 for the Discover pass, and $795 for the Discover Plus pass.

The Mason Street Tent will be in part a gathering center for the Java community. As java.net Community Manager Sonya Barry recently reported, the tent will be the center of java.net activity at JavaOne. Though I’ll be attending quite a lot of sessions, when I’m not attending a session, you’ll usually find me in the tent (probably writing a blog about the last session I attended, or chatting with the community, or writing a blog about one of those chats). Java User Group leaders are expected to be setting up shop near the java.net area, and the Oracle Technology Network will also be in the area. The OTN will be featuring a full schedule of interviews and talks with key members of the Java and broader open source communities as part of its Oracle Technology Network Live program.

You can get a sneak preview of JavaOne, including what’s going to be in the tent, this coming Tuesday, September 7, at 10 AM, Pacific Time, in a special edition of Justin Kestelyn’s TechCast Live. See the details in the JavaOne Conference Blog’s post JavaOne Preview on TechCast Live! (Tues., Sept. 7, 10am PT).

Still having doubts? Well, as Sonya notes, java.net will be located right next to the coffee and beer — so that should guarantee we’ll see you, right?

But, seriously, if you’d like to attend just some of JavaOne, do consider purchasing a JavaOne / Oracle Develop Discover pass. With everything that’s going to be going on in the tent, in the exhibition halls, and at the keynotes, how can you go wrong for just $75 (or $695 to be able to attend 3 sessions)?

Java Today

In the Aquarium, Alexis Moussine-Pouchkine announces a New GlassFish 3.1 Screencast: Application-scoped resources:

This short screencast demonstrates the new application-scoped resources feature available starting with Milestone 4 of GlassFish 3.1 (the demo used promoted build #17). Such resources are bound to a module (war, ear, ejb) and as such they are created on deploy and destroyed when the module is undeployed. They are defined in a file called glassfish-resources.xml (schema-constrained) and shipped with the archive…

At Hudson Labs, Kohsuke Kawaguchi talks about Recent label and matrix project improvement:

Today, I?d highlight two recent improvements to the label and matrix projects. When you have multiple slaves in your Hudson build farm, you can use labels to classify slaves by their capability/environment/architecture/etc. For example, your one slave might have ?32bit? and ?windows? label, while another one might have ?linux?, ?ubuntu?, and ?64bit.? (with plugins like platform-labeler plugin, you can attach labels automatically, too.) Or if you do Selenium testing, you might add browser names as labels to indicate which slave has which browser available…

Robilad announces the availability of JVM Language Summit 2010 Recordings On Oracle Media Network:

The recordings of the majority of the sessions from the JVM Language Summit 2010 have been uploaded to the Oracle Media Network. Paul Leahy has compiled a list of session recordings and their corresponding abstracts. Slide decks for most of the sessions are available on the JVM Language Summit wiki

James Sugrue reports on Eclipse innovations in IDE 2.0: The Age of Intelligent IDEs -

The latest innovation in the Eclipse space that I’d like to share with you is Code Recommenders. Already available as a plugin for Eclipse, Code Recommenders provides intelligent code completion. Rather than giving you all possible methods for code completion, this plugin proposes the methods that you probably need at the top of the list, with a rating of how applicable each method is. To see Code Recommenders in action, see the following screencast


Poll

Our current java.net poll asks What threat does further fragmentation of the Java language pose? Voting will be open until Monday.


Spotlights

Our new java.net Spotlight is from the JavaOne Conference Blog, JavaOne Preview on TechCast Live! (Tues., Sept. 7, 10am PT):

You’ve read the blogs, you’ve consumed the tweets and Facebook updates. Now how about hearing from some live humans? Next Tuesday morning (Sept. 7, 10am PT), Oracle Technology Network offers you a JavaOne preview via a live video chat with Sharat Chandar and Tori Wieldt, two people intimately familiar with the content and community aspects of the conference. You’ll get insights into the content contribution process, hear about particularly interesting technical sessions and BOFs, and get a sneak peek of the contents of the Mason St. tent, where Oracle Technology Network will host the community in all its glory…

We’re also still highlighting java.net Community Manager Sonya Barry’s JavaOne Conference Blog post Java.net Activities at JavaOne:

I’m excited about JavaOne this year.  It’s going to be different in a lot of ways, but we are doing our best to ensure that the Java.net presence for the community is just as good if not better then previous years.  In years past Java.net has had a “community corner” booth in the JavaOne pavilion at Moscone… This time we’ll be housed in the Mason Street tent, which will be a large comfortable space for people from all of the technology communities to hang out, pick up swag, watch the videocasts, and see some live events too..,


Subscriptions and Archives: You can subscribe to this blog using the java.net Editor’s Blog Feed. You can also subscribe to the Java Today RSS feed and the java.net blogs feed. You can find historical archives of what has appeared the front page of java.net in the java.net home page archive.

Kevin Farnham

Twitter: @kevin_farnham

MySQL Cluster: 5 Steps to Getting Started, then 5 More to Scale for the Web

Sep 03, 2010

Join us for a live and interactive webinar session where we will demonstrate how to start an evaluation of the
MySQL Cluster database in 5 easy steps, and then how to expand your
deployment for web & telecoms-scale services.Just register here: http://www.mysql.com/news-and-events/web-seminars/display-566.htmlGetting Started will describe how to:

Get the softwareInstall itConfigure itRun itTest it

Scaling for HA and the web will describe how to:

Review the requirements for a HA configurationInstall the software on more serversUpdate & extend the configuration from a single host to 4Roll out the changesOn-line scaling to add further nodesWhen: Wednesday, September 08, 2010: 09:00 Pacific time (America)

Wed, Sep 08: 11:00 Central time (America)

Wed, Sep 08: 12:00 Eastern time (America)

Wed, Sep 08: 16:00 UTC

Wed, Sep 08: 17:00 Western European time

The presentation will be approximately 45 minutes long followed by Q&A.

dbbenchmark.com ? configuring OpenBSD for MySQL benchmarking

Sep 03, 2010

Here are some quick commands for installing the proper packages and requirements for the MySQL dbbenchmark program.

export PKG_PATH=”ftp://openbsd.mirrors.tds.net/pub/OpenBSD/4.7/packages/amd64/”
pkg_add -i -v wget
wget http://dbbenchmark.googlecode.com/files/dbbenchmark-version-0.1.beta_rev26.tar.gz
pkg_add -i -v python
Ambiguous: choose package for python
a 0:
1: python-2.4.6p2
2: python-2.5.4p3
3: python-2.6.3p1
Your choice: 2

pkg_add -i -v py-mysql
pkg_add -i -v mysql
pkg_add -i -v mysql-server
ln -s /usr/local/bin/python2.5 /usr/bin/python
gzip -d dbbenchmark-version-0.1.beta_rev26.tar.gz
tar -xvf dbbenchmark-version-0.1.beta_rev26.tar
cd dbbenchmark-version-0.1.beta_rev26
./dbbenchmark.py –print-sql
– login to mysql and execute sql commands
./dbbenchmark.py