Apr

16

By leadiv

No Comments

Categories: Coding and Projects

Tags: ,

OpenRule 2.0

Released OpenRule 2.0 (Venus) into the wild. Lots of new features including:

* Transparency controls
* Can measure in Inches, Centimeters, Pica and Pixels
* Custom measurements can be created
* The new Preference dialog allows you to customize the functionality and look of the ruler
* The tick leader line — a small line that hangs off the ruler — helps you keep track of where your mouse is on the ruler
* The ruler can be nudged by one pixel using the arrow keys and moved by 10 pixels by holding down the control key and using the arrow keys
* New about information
* Pressing F1 takes you to the user guide page
* Window and Mac executable are available

Mar

18

By leadiv

No Comments

Categories: Coding and Projects

Tags:

Java System Property Files

The pass few days I have been trying to figure out how to work with property files. A project I am working with uses Java DB and I want to have a property file that customizes where the database is located. Finding and loading the file has proven a bit difficult because I am trying to call the property file from the static main function of my program. So I can’t use the usual static functions to call the resource file in a physical independent way. I am hoping that encapslating it in a class might solve my problem.

Mar

6

By leadiv

No Comments

Categories: Coding and Projects

Tags: , ,

Derby

The past few days I have been consumed with trying to figure out how Derby works. Derby is Java’s DBMS coded entirely in Java. I want to use Derby as part of the deliciousBlogger project to manage profile and scheduling information.

Derby has some very cool features if you are developing with Java. You are able to start it up as an embedded or server database. The embedded mode means you dont need a separate process to be running for the database system. It will run in the same space as the JVM. From what I have figured out you can pretty much do all the basic functions as other database servers though not always the same way. It does support core SQL commands to keep it standard.

I finally figured out how to start up the database in embedded mode (or at least i think it is); create a table; insert a few items; then query the table and print out the results.

package model;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.derby.drda.NetworkServerControl;
import java.net.InetAddress;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
*
* @author leadiv
*/
public class testing {
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
NetworkServerControl server;
Connection conn;

try {
server = new NetworkServerControl(InetAddress.getByName(“localhost”), 1527);
server.start(null);

System.out.println(server.getSysinfo());
String nsURL=”jdbc:derby://localhost:1527/testing;create=true”;
java.util.Properties props = new java.util.Properties();
props.setProperty(“user”,”dbo1337″);
props.setProperty(“password”,”fnpbz”);

/*
If you are running on JDK 6 or higher, you do not
need to invoke Class.forName(). In that environment, the
ClientDriver loads automatically.
*/
Class.forName(“org.apache.derby.jdbc.ClientDriver”);
conn = DriverManager.getConnection(nsURL, props);

/*interact with Derby*/
Statement s = conn.createStatement();
s.execute(“create table \”MYTABLE\” (\”ID\” INTEGER not null primary key, \”NAME\” VARCHAR(50))”);
s.execute(“insert into mytable values(1, ‘Paul’)”);
s.execute(“insert into mytable values(2, ‘Ashley’)”);

ResultSet rs = s.executeQuery(“select NAME from MYTABLE”);

while (rs.next()) {
System.out.println(“Name: ” + rs.getString(1));
}

rs.close();
s.close();
conn.close();
server.shutdown();

} catch(Exception ex) {
Logger.getLogger(ProfileSQL.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
}

Here are some links talking about Derby: Java Databasing with Derby, Derby’s Documentation

Jan

20

By leadiv

1 Comment

Categories: Coding and Projects

Tags:

Delicious Blogger

I have been working on a project recently to allow bloggers a way to post delicious links on their blogspot blog as a post automaticly. This first version will not be to useful for those who only use Google’s Blogger site or do not have access to a server with php. It is more of trying to understand what the process looks like in living breathing code. This will be a simpified prototype that is usable by anyone that has access to a server with php and cronjobs.

Today I just started on the script to access Google’s Blogger API. It seems to be so far much easier then working with Delicious either that or I have gotten better at reading and working with APIs.

Comment if you have any questions, concerns or ideas for this project.

Oct

31

By leadiv

No Comments

Categories: Coding and Projects

Tags: , , , ,

OpenRule Mercury

About 2 months of coding has finally paid off. Mercury has been release earlier this week. This is the first stable version of the screen ruler OpenRule. It is a very basic version of the popular freeware program JRuler. One of my favorite features is the snap to zero functionality, which will snap the ruler to your cursor at pixel zero. More information can be found on the project page.

Oct

27

By leadiv

No Comments

Categories: Coding and Projects

Tags: , , , ,

OpenRule roadmap

This is the overall roadmap for the OpenRule software. The current status version of OpenRule is marked below in orange-yellow. Hopefully, by the time we reach Mars status OpenRule can be marked as mature and will not need any more additional features. As always you can get the most up to date version on the project page.

Mercury (1.x)

• Must be always on top
• Have ruler ticks counting off the units
• Displays the number of pixels from the beginning of the ruler (pixel 0)
• Ruler should be easily re-sizable
• A fast key for flipping between horizontal and vertical modes.
• Close and minimize buttons
• Snap beginning of ruler to cursor
• The ruler is drag-able

    Venus (2.x)

    • Add Program icon to replace the default Java Icon.
    • Allow the ruler to be transparent
    • Allow the ruler to be different colors.
    • Nudge the whole ruler by a pixel using arrow keys    (left, right, top and bottom)
    • A leader hangs off of the ruler which easily shows where your cursor is on the ruler
    • About menu item
    • Help menu item
    • Change the tick units (px, inch, cm, pica, custom)

      Earth (3.x)

      • Add Default Preferences for: color and transparency, orientation, always on top, tick units, and bar layout
      • Snap end of the ruler to cursor
      • Snap ruler to cursor at pixel position X
      • Snap cursor to end of ruler
      • Snap cursor to beginning of ruler
      • Snap cursor to nearest tick
      • Snap cursor to nearest tick mode
      • Click, click measure mode (The mouse click defines the beginning and ending positions)
      • Swap the info bar and tick bar

        Mars (4.x)

        • Rotate ruler
        • Click, click measure at an angle (The mouse click defines the beginning and ending positions)

          Revision List*

          • Must be always on top — Make this optional but default to “always on top”
          • Nudge by 5 pixels when using ctrl+arrow keys

            Bug List*

            Does not work on Mac (Java 1.5.x)

              Found a Bug? Report it!

              Ongoing Tasks

              • Code documentation
              • Getting started and Help sections
              • Streamlining code making it efficient

                *A significant amount of minor revisions and bugs can count for a version or significant internal code revision.

                Oct

                23

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , , , ,

                OpenRule update

                This past week has seen lots of effort in getting the basic version of OpenRule up and running. Here are some highlights:

                • Developed the vertical version of the ruler
                • Added the RulerEvent and RulerListener claases to address
                  • flipping between the two Ruler modes
                  • form controls (minimizing, exiting)
                  • global keyboard commands
                • Allow the ruler to resize

                You can download the newest version of the ruler here and the code here. Have comments or questions about OpenRule? Email us at paul(at)leadiv(dot)com or post a comment on this post.
                Always welcome other developers to help make OpenRule even better. If you are interested please contact me here paul(at)leadiv(dot)com

                Oct

                20

                By leadiv

                1 Comment

                Categories: Coding and Projects

                Tags: , , ,

                OpenRule notes

                While working on open rule I ran into an interesting issue. I created a TickBar object that draws the ticks on the ruler (the lines marking off individual units). This was extended from the JPanel class so that I could easily draw on it using the paintComponent function. After creating TickBar I wanted to extend it to create a vertical version. The only problem was when I went to draw on the vertical version, it drew the horizontal and vertical ticks. The reason why is because I have to make a call to the super of this function to make sure that the component is clean and ready to be drawn on. However, when I am in the Vertical version of the TickBar the call to the super causes the horizontal ticks to be drawn as well.

                To solve this delimma I created an interface called Drawable. Drawable separates out the drawing function from the paintComponent function so that the child object could easily over-ride the draw function.
                I thought that was kind of cool.

                Oct

                18

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , , , ,

                popup menu trouble

                I ran into some trouble when I tried putting the popup menu on the ruler. It rendered the dragging functionality useless. I was unable to attach the menu to the frame which where the draggable functionality is implemented. The solution I found was to apply the draggable events to the main ruler panel which is where the popup menu resides as well. This way the popup menu listeners do not consume all of the mouse listening events.

                Sep

                25

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                OpenRule update

                Uploaded a new version of OpenRule (0.0.20080924r50). I added a “tick” bar which ticks off all the even pixels and groups them in 10s and 20s with labels on the 20s. The new download now includes the source code, license and executable jar. Download the new version here. As always you can also grab the source code from the svn server here. I have been a bit busy which is why this update has been put off. Email me, paul(at)leadiv (dot)com, about any feedback or if you want to join the OpenRule project.

                Sep

                22

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , ,

                code snipit…

                I was working on a project for a friend who wanted to use css styles on some product pages of theirs. They could not easily add the css as an external link, which resided on their own site (different from the site with the product pages). This would not be a problem except that they wanted their css to cover about 400 pages. As you can imagine that would make maintaining the pages much more difficult to maintain. After much head banging to try and get ajax and iframe solutions to work I came across a very cool trick.

                Just create a javascript function that inserts a link tag pointing to your external css. This worked like a charm in IE6, IE7 and FF3.

                function loadCSS(loc) {
                var
                headID = document.getElementsByTagName(“head”)[0];
                var
                cssNode = document.createElement(‘link’);
                cssNode
                .type = ‘text/css’;
                cssNode
                .rel = ‘stylesheet’;
                cssNode
                .href = loc;
                cssNode
                .media = ‘screen’;
                headID
                .appendChild(cssNode);
                }

                loadCSS("http://example.com/external.css");
                
                

                The obvious drawback to this approach is that if someone has javascript turned off then none of your css will show up. But in this case the site relied on javascript a lot. If you are interested in more information on this and other cool tricks you can read more here.

                Sep

                8

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                OpenRule

                Purpose: Measure the distance between two points on the screen.

                Motivation: I have been doing more precise web development for work and needed a good tool to measure pixel differences of HTML mock ups that I build. This means I need a screen ruler that can be used across all browsers and not just a plug-in that would work for one browser. After searching Google, I found a popular screen ruler that I could use. The only problem is that it is shareware. After extensive usage I find the tool useful but lacking in some areas. This project’s aim is to rectify these changes

                Requirements:

                • Measures two points on the screen quickly and intuitively
                • Open Source
                • A small application footprint in memory

                To Do Features:

                • Must be always on top
                • Have ruler ticks counting off the units (This should be flexible and easy to change unit types)
                • Displays the number of pixels from the beginning of the ruler (pixel 0)
                • If the cursor is on the ruler guidelines are displayed
                • A leader hangs off of the ruler which easily shows where your cursor is on the ruler
                • A fast key for flipping between horizontal and vertical modes.
                • Close and minimize buttons
                • Middle double click minimizes ruler
                • Snap beginning of ruler to cursor
                • Snap end of the ruler to cursor
                • Snap ruler to cursor at pixel position X
                • Snap cursor to end of ruler
                • Snap cursor to beginning of ruler
                • Snap cursor to nearest tick
                • Snap cursor to nearest tick mode
                • Allow the ruler to be transparent
                • Allow the ruler to be different colors from default
                • The ruler is drag-able
                • Click, click measure mode (The mouse click defines the beginning position and the ending position)
                • Click, click measure at an angle (Same as above but you can rotate as well)
                • Rotate ruler
                • Nudge the whole ruler by a pixel using arrow keys
                • Swap the info bar and tick bar (The info bar shows information such as pixel distance from zero, tick bar shows a graphically representation of the units on the ruler.
                • Ruler should be easily resize-able
                • Change the tick units (px, inch, cm, pica, custom)

                Now for those who are wanting to help develop I refer you to my projects page where you can download the source code. Please send me a note if you are adding features (paul[at]leadiv[dot]com). That way we can see about getting you hooked into the project. I dont have an email list up yet since I am the only one interested in such a project at the moment :) . For those interested in looking at the program you can download it here.

                Aug

                7

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , ,

                a new obsession…

                I recently found out about a fun little game called Robocode. Now this is not a game for the non-programmer because you are coding a bot program with in the Robocode framework.

                This takes me back to my college days when my university had a game called “battle bots.” Basically, you code a bot (a program) that runs in the main program along side other bots and they fight each other till one last bot is standing. The really cool thing was that there was no human intervention. So we would go into the computer labs and set up a big screen watching our creations battle it out.

                Robocode is not as elaborate as the battle bots but it does give me an excuse to play with some AI techniques without having to write a whole custom environment. Maybe I can use Joone to develop a NN Robocode Bot.

                Aug

                4

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , ,

                neural nets

                From time to time my thoughts always go back to Artificial Intelligence type programming techniques. Neural nets are always so intriguing, its like a little black box. you put in your inputs and the program gives you what it thinks it should be with out having to actually program it in the traditional sense. My biggest problem is that I could never find a good open source program to be able to easily generate and program neural nets. That is until recently when I stumbled across a project called Joone. It is pretty well done NN engine and has a GUI interface to be able to test out NN ideas.

                Aug

                1

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                justforfun program…

                This is a fun little program copied from processing.org’s spore2 simulation. I want to use this as a base for an AI life experiment that I have thought about creating for a while. I want to investigate how physical shape and apperence can effect the interaction between creatures. For anyone interested in seeing my program you can run it from java web start. This program does not have a digital signature so your OS may complain about it. You can also download and browse the source.

                Jul

                24

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , ,

                java logic errors…

                Recently, I was working on a project to reproduce processing.org’s spore2 program. During the course of developing the program I kept running into a logic error which caused my simulation to work but not achieve the desired effects. The problem with tracking this down is that my program was keeping track of thousands of bits of data which made debugging almost impossible. On a large scale the program kept bottlenecking instead of creating the cool lava lamp flow of little creatures.

                I eventually solved this issue by tracking just one creature and found that instead of making a downward circular path like was expected from the rules it kept always going in a downward left position. This gave me the idea that maybe just one rule was being executed. This was exactly the case as it turns out I can not compare Color objects directly in Java. Needed to use the .equals() function. Once I translated my == and != to .equals() and ! .equals() it worked prefectly.

                Sometimes it seems that targeted information is much better for debugging then lots of information.

                May

                16

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                i want to make this…

                So today i was reading some xkcd (one of my favorite webcomics) and came across this comic:

                xkcd comic

                This is a great comic and I really want to make this robot! For sometime I have been playing with the idea of pursuing robotics especially since I found society of robots. Just haven’t found the time or money lately but maybe some day I might take a crack at making this.

                May

                8

                By leadiv

                2 Comments

                Categories: Coding and Projects

                Tags: ,

                crossoverart.org

                I have been working on a website lately for my uncle. It is an e-commerce site selling wooden crosses. Fairly small and basic site with only 3 products. So I decided to set them up with a WordPress Site using the WP E-commerce plugin. The last thing I have been working on has been a design for their site. I know that I am not really a designer but I wanted to try and give them something more then just the usual WP themes. So with the helpful advise of my wife (who is the designer of the family) I have been slowly developing a theme for them. So far I like what I have developed. I know that it is still a bit rough, however, If you have any constructive comments and criticisms please leave a comment. You check out the progress here.

                Mar

                5

                By leadiv

                2 Comments

                Categories: Coding and Projects

                Tags: , ,

                version control what’s that?

                For years I have never really given a thought to version control for any of my projects. This has resulted in many failed projects or so many copies of the same file that I accidentally overwrite something. What I have found is that version control is a good way of keeping track of new changes or be able to go back a version. This is true for projects that include hundreds of developers or if you are just coding for yourself. Because you never know when a small little script turns into a myriad of php, javascript and css pages.

                For web development it seems the best type of version control to use is subversion. subversion or SVN is the successor to CVS. Another aspect of version control that I have never found a definite way of defining is release version numbers. Most times I just make up release version numbers when I come to a good stopping point in the code :) .

                Recently, when I made the move to leadiv.com I wanted to have my projects in some kind of source version control repository. Hopefully, making it easier for people who may be interested in my work to participate in developing these projects with me. So far I have moved only one of my projects into a SVN repository using Google’s project hosting site. It is very useful to use (and free) . I have been using SVN tortoise to access the repository when making changes or needing to bring the code down to work on it. So far it has worked out fairly well. It’s not all that awkward to work with and I don’t put the changes back up until I have finished my coding session. Continued…

                Jan

                25

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                Reunion released!

                Reunion: an event planner

                Version 1.0 of the reunion code has been released. You can check out the project here

                Jan

                23

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: , ,

                project reunion update!

                So, the project that I have been working on for the pass few weeks is finally up and running. As a recap, the reunion project is a small tool useful for planning and visualizing a date to hold an event. A list of people and dates are put into the system by the administrator. For each person the admin page allows marking off which dates they are unavailable or cant make it to the event if it is held on that date. The administrator can then view the index page to see which dates will have the most people be able to make it.

                The viewing page lists each proposed date, gives a color rating to it as to how viable the date is, lists with who can’t make it and a yes/no chart of available/unavailable people. This allows the user to quickly assess what dates are the best for everyone.

                I believe this tool has potential to be extended into a larger system for event planning. I will be releasing the source code soon for anyone who wants to use this or develop the code more. For now here is the tool to play around with. Feed back (pb4(at)leadiv.com) is always appreciated.

                Jan

                7

                By leadiv

                No Comments

                Categories: Coding and Projects

                Tags: ,

                projects:
                reunion app

                For the pass few days I have been working on a reunion application for my annual college reunion/gathering. Basically, I needed a way of managing who was coming and when they are able to come in a easy to use interface. Making it easier to try and figure out what day would be the best to have the reunion. And just to add a bit of complexity into this, I have a feature that allows you to mark some of the users as “priority.” This was done because we were wanting to make sure that everyone else who came last year could be given a chance to come this year. So far these are the features I am thinking about having:

                1. Instead of a calendar month view the application shows up as a week view.
                2. There are a quick color block indicating it how many people can’t make it on the particular week.
                3. A list of those who can’t make it
                4. Pie chart view of thoes who have the week available vs. not available
                5. An easy way of adding new weeks and participants

                This first version hopefully will be out soon. I want to add more features on as well but first I should probably make the first version ;) .