Thursday, February 24, 2005

JDBC Driver

Ok, I have an upgrade to my simple JDBC Connector, I added a describe function:


 


http://www.retroevolution.com/beta/JDBCApplicationConnect.htm

GIS MVC article

I am working on a MVC article, similar to the one below, but I hope to add a more GIS specific version.


http://www.retroevolution.com/beta/gismvc/


 

What do you do?

I basically with GIS Web applications and also, regular enterprise applications, such as enterprise wide project management software and that stuff in City Government Engineering projects.


Here are some snapshots of what we are working on now.  I was looking at it, thought I somebody wonder what GIS looks like.  Those google guys do a better job with mapping, but guess what, we aren't google.


 


Images

Here is a recent look at JSPs and templating systems, interesting.

JSPs are normally auto-compiling: Unlike the controllers and models, you can make a change, then see it work. In other words, you can circumvent the drudgery of letting the Ant loose to recompile the half or all of the system and redeploying it in the container. Hence, JSPs serve as a constant and appealing temptation to do the bad thing to get the job done.
Extracting complex view logic is painful: With tag libraries, it's possible to be a good programmer and rid the views of complex logic by extracting code and replace it by tags. That is a noble and right path to follow. The problem is when the effort required to do the right thing is so intense that its basically a project in itself. Then its not something you're gently invited to do. It's a huge barrier and easy source of procrastination ("I'll extract later...") and guilt ("If only I had extracted sooner...").
Java is a terribly view logic language: I talked at length about this subject in The false promise of template languages and I doubt there's any disagreement here, so I'll leave it at that.

Defending Java

Here were some things that I through together really quick over a couple of days.

A simple stream editor, can be used when you don't know SED that well or you need more than just regex and such. This Excel JDom code doesnt really work, but if you transform an Excel 2003 document, ideally you want XSLT but if you want a java way to parse that document, simple code mind you, here you go. The last one is a JSP page for processing SQL sending out SQL statements. It is ugly, but I always hate having to rewrite a web page when I dont have a template around.



http://www.retroevolution.com/beta/SimpleJavaStreamEditor.htm

http://www.retroevolution.com/beta/ExcelJDOMProcessing.htm

http://www.retroevolution.com/beta/SQLWebTool.htm

Recursive Search String

private static int levelSearch(String cmts, String searchStr, int _start, int _total) throws Exception {
if ((cmts != null) && (searchStr != null)) {

String a = cmts.trim().toLowerCase();
String b = searchStr.toLowerCase();
System.out.println(a + " " + _total);
int ln = a.indexOf(b,_start);

int max = ln + searchStr.length() + 1;
if (max > cmts.length())
return _total + 1;

if (ln >= 0) {
return levelSearch(cmts.substring(ln + searchStr.length() + 1),
searchStr, 0, _total + 1);
} else {
return _total;
} /// end of the if //

} /// end of the if //
return 1;
} /// end of the method //

Recursive Search String

private static int levelSearch(String cmts, String searchStr, int _start, int _total) throws Exception {
if ((cmts != null) && (searchStr != null)) {

String a = cmts.trim().toLowerCase();
String b = searchStr.toLowerCase();
System.out.println(a + " " + _total);
int ln = a.indexOf(b,_start);

int max = ln + searchStr.length() + 1;
if (max > cmts.length())
return _total + 1;

if (ln >= 0) {
return levelSearch(cmts.substring(ln + searchStr.length() + 1),
searchStr, 0, _total + 1);
} else {
return _total;
} /// end of the if //

} /// end of the if //
return 1;
} /// end of the method //

WebCrawler in java Simple

Well, while working on the google word sets tool, I had to develop a simple java based web crawler. View the current snapshot. It is simple so if you always wanted code to crawl the web. Here you go, it will search for HREF tags with a set format.

http://www.retroevolution.com/beta/changelog_020505.htm

http://www.retroevolution.com/beta/WebCrawlerJavaSnippets.htm

Spirit for WordSets initial offering

Here is the changelog for my new project, I will describe in more detail later on:

** 2/3/2005:
- First Connection to labs.google.com
- Raw Connection only
Here is an example test case:

RawHttpConnect conn = new RawHttpConnectImpl();
conn.setVerbose(true);

Map d = new HashMap();
d.put("q1", "dog");
d.put("q2", "cat");

conn.setMapData(d);
conn.setRequestPage("labs");

String url = "labs.google.com";
conn.setConnectionData(url, 80, url,"" + 80,url);
conn.connect();

uploaded to http://www.retroevolution.com/SpiritWordSets.zip

** 2/3/2005:
- Added custom logging
- Added unit testing

Example way to add test case

private Logger l;
public static Test suite() {
return new TestSuite(LoggerTest.class);
} /// end of the method //
protected void setUp() {
l = LogFactory.getLogger();

} /// end of the method //

public void testNull() {
l.info("Logger Test");
l.info("Logger Test", new Exception("Test Exception - Dont Panic!"));
} /// end of the test //

...
...
TestSuite suite= new TestSuite("All JUnit Tests");
suite.addTest(LoggerTest.suite());
return suite;

** 2/1/2005:
- Working on web crawler
- SpiritWordSets Initial offering

EMDR - Eye Movement and Stress

There are some smart people, never will I like down on any profession that I really dont have an idea about. Here is a look at EMDR a way to use eye movement and sound to dimish stress. If you actually try it for even a little bit.



http://www.emdr.com/

Simple Recursive Searcher in java

Actually not a full searcher, and it also is part of a java application for visual studio.

http://www.retroevolution.com/beta/VisualStudioDirStruct.htm

Using Patterns

The factory pattern, this is a reminder to myself to use the Factory pattern, also for others, pretty simple, There is normally an interface, an implementation and a Factory object, the Factory object will return the Interface, which is an implementation of some Object.

public class CrawlerFactory {

public static Crawler load(String initDir) {

Crawler c = new Crawler(initDir);
c.process();
return c;

} /// end of the method //

} /// end of class //



public class Crawler {

String initialDir = null;

public Crawler(String initDir) {

initialDir = initDir;

} /// end of the cons //

public void process() {

} /// end of the method ///

} /// end of the class //

ActionListener and Swing Example

///
/// DefaultListener()
///
public ActionListener defaultListener() {

return new ActionListener() {
/// On action
public void actionPerformed(ActionEvent e){

} /// end of method

};

} /// end of the method //



One of my java swing examples doesnt include a action listener, I always forget the exact code I need so here it is,there function returns an action listener.

For example to add to a JButton:

_c.gridwidth=2;
_default.addActionListener(defaultListenter());
_panel.add(_default, _c);

ASP.NET and register IIS

As I become more familiar with .NET, I will post some various tidbits here:

For example, how do you register ASP.NET with IIS you ask?

Run the command below.



07/15/2004 01:49a 32,768 aspnet_state.exe
07/15/2004 01:49a 32,768 aspnet_wp.exe
12 File(s) 1,482,691 bytes
1 Dir(s) 55,751,278,592 bytes free

C:\WINNT\Microsoft.NET\Framework\v1.1.4322>aspnet_regiss -i
'aspnet_regiss' is not recognized as an internal or external command,
operable program or batch file.

C:\WINNT\Microsoft.NET\Framework\v1.1.4322>aspnet_regiis -i
Start installing ASP.NET (1.1.4322.0).
Finished installing ASP.NET (1.1.4322.0).

C:\WINNT\Microsoft.NET\Framework\v1.1.4322>

Variables and bash

I have always wondered this about bash scripting, on IRC:

hello, this is simple, in bash scripting, what is preferred, ${VARI} or $VARI
"$VARI" probably :P
you only need the {} if you've got something after $VARI
I can use $VARI in a string? ABC="kjs;dfksdjfsd $VARI"
you can like that, because there is nothing after it
I see, ABC=${VARI}.zip
however if you did ABC="kjs;dfksdjfsd $VARIabc" that wouldn't work
ah
so you need the {} to tell bash where the variable name ends
ABC="${VARI}.zip" is better in case VARI has spaces in it
ramza2: actually, you can't have . in a variable name. so $VARI.zip is unambiguous.
ah, once again
it's a matter of taste to some extent, but i would only use {} where absolutely necessary
and then the other way $(VARI) or is that in Make scripts
that's makefiles.

Tuesday, February 22, 2005

First thing with new language

I do a couple of things when investigating a new language. First, I look at the package handling. Can it handle more than one file, easily. This is critical for software development. Building libraries and creating a project for your application. Next, how does the language look in an editor. Do I need something special. Lisp is fine in Emacs. But you should never open lisp code in another editor and then expect not to hate the language.

My other blog

Here is my other blog. It will receive more updates. I like the interface. I don't like that others can't comment(probably have to pay for it).

http://www.bloglines.com/blog/berlinbrown

Blogs are life

Well, blogging is just becoming a job at this point. I read others blogs, I update this blog. It is endless and fun. I think the ability to update your blog, in real time, somebody, can see it, they can make a comment that instance. Very nice.