Aug
10
2006
I’ve seen and tried a ton of HTML/CSS/JavaScript tricks and hacks to get rounded corners on DIV elements. So far I have found that the easiest way to get rounded corners on divs is by using the Rico JavaScript framework. To demonstrate this in code let me define a snippet of HTML:
<DIV id="mydiv" style="background-color: #FFE6BF">
some text
</DIV>
To make the DIV element have rounded corners just execute the following bit of JavaScript, perhaps in the document.onload event method:
Rico.Corner.round('mydiv');
You can also pass in some additional options to Rico’s round function which indicates which corner(s) to round. Here is another example which rounds only the top-right and bottom-left corners:
Rico.Corner.round('mydiv', {corners:'tr bl'});
And of course, br and tl also work.
As a convenience, you can round the corners of multiple elements at once. To round all DIV elements that use a given class use the following JavaScript:
new Rico.Effect.Round('div', 'roundCssClass');
With the above JavaScript, only those DIV element that use the CSS class roundCssClass will be rounded off.
2 comments | tags: framework, html, javascript, rico, web2.0 | posted in CSS, HTML/XML, JavaScript, TechKnow
Aug
10
2006
Woot! I lucked out and was able to score a conference pass to RubyConf 2006. I booked my flight, reserved my room, and I am ready to start packing. I will also be in attendance for the Carson Workshops’ The Future of Web Apps summit in San Francisco. If you are scheduled to attend either RubyConf or the Carson Summit and want to get together, have a couple of beers, or share notes between sessions feel free to drop me a line. I am looking forward to getting the most of these two events and meeting other developers.
Technorati Tags: ruby, rubyconf, conference, denver, san francisco
no comments | posted in Rant, TechKnow
Aug
9
2006
I have written plenty of one-off no-brainer recursive Java methods that search through a directory hierarchy searching for a type of files. Such methods are good exercise problems for rookie Java programmers. But since I am a Java programmer I bearly exercise, so I tend not to write that type of method anymore. I let Jakarta Commons IO do the recusive file seach for me. Using the FileUtils, SuffixFileFilter, and TrueFileFilter from the Commons IO library I could recursively search a directory hierarchy for all groovy files with the following bit of code:
SuffixFileFilter sff = new SuffixFileFilter(".groovy");
// listFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter)
Collection cl = FileUtils.listFiles(f, sff, TrueFileFilter.INSTANCE);
Other useful FileFilter classes available in the Commons IO library include PrefixFileFilter, NamedFileFilter, DirectoryFileFilter, and FalseFilterFilter.
Technorati Tags: java, jakarta, commons io, recursive, groovy
no comments | posted in Java, TechKnow
Aug
8
2006
I’ve mentioned before my use of Groovy in Groovy Closures and Common Groovy Errors. I have also mentioned the need to use Visual Basic scripts to open MS Word, or print an HTML document from Internet Explorer. In this article I will mention how to use Groovy and Scriptom to do COM scripting. Before I integrated with Scriptom I had to write one off Visual Basic scripts and run them from Java by using the Runtime’s exec(String) method. Now I could write the COM script in Groovy. Here is an example of Groovy code that will open a new Outlook mail message window and populate the To field:
import org.codehaus.groovy.scriptom.ActiveXProxy
def outlook = new ActiveXProxy("Outlook.Application");
def message = outlook.CreateItem(0);
def emails = "user1@domain1.com;user2@domain2.com";
def rec = message.Recipients.add(emails);
rec.Type = 1 // To = 1, CC = 2, BCC = 3
message.Display(true);
You can run this code from the groovyConsole once you have Scriptom configured.
Technorati Tags: groovy, java, gdk, scriptom, activex, com
4 comments | posted in Java, TechKnow, Visual Basic
Aug
8
2006
In Flex on Rails we walked through how to generate data in rails to be consumed by a Flex UI. Now to close the loop lets demonstrate how to post information from Flex to Ruby on Rails. For this example we are going to create a user login UI in Flex and have a rails action validate the user name and password. To get started lets show the MXML code for the Flex UI:
Continue reading
no comments | posted in Ruby, TechKnow
Aug
7
2006
In a Ruby on Rails web application you can do some fancy client-side effects using AJAX and RJS via remote links and remote forms. But toggling and fading HTML elements is a far cry from Rich Internet Application controls. In this article I will demonstrate how to connect a Flex 2 UI on the client-side with Ruby on Rails application on the server end. This example is loosely ported from Integrating Adobe Flex and PHP by Mike Potter of Adobe.
Flex applications can read in xml documents from a web server and display it’s contents in a tabular format. To demonstrate this let us first define a new action that will list all the users in a rails application.
def listusers
@users = User.find :all
render :layout => false
end
For this action, create a listusers.rxml view. To create an xml document that lists the known users in the system add the following xml builder code in the listusers.rxml file:
xml.users do
@users.each do |user|
xml.user do
xml.id user.id
xml.username user.user
xml.since user.created_at
xml.email user.email
end
end
end
Continue reading
no comments | posted in Ruby, TechKnow