Skip navigation

Category Archives: internets

In any modern web app, you probably want to have really cool and simple URLs like how WordPress does for your permalinks. E.g., the permalink for this posting is

https://bobobobo.wordpress.com/2008/05/04/how-do-i-design-a-simple-front-controller/

MUCH better than the typical MSDN type urls:

http://msdn.microsoft.com/en-us/library/52cs05fz.aspx
http://msdn.microsoft.com/en-us/library/d06h2x6e.aspx
http://msdn.microsoft.com/en-us/library/bb385954.aspx

Do you think when I complete this posting and publish it, WordPress will ACTUALLY PUT A FILE at https://bobobobo.wordpress.com/2008/05/04/how-do-i-design-a-simple-front-controller/?

NO you dummy!!

Anytime you see REALLY simple urls like http://www.website.com/PersonsUsername/ most likely what is happening there is the web application is using something called REQUEST MAPPING. You do REQUEST MAPPING using what is called a FRONT CONTROLLER.

The FRONT CONTROLLER works to INTERPRET requests for specific URI’s AS requests to OTHER pages, engines, and so on.

Give this a watch.

First, NOTICE how simple that uri is? In case you didn’t follow the link through, its http://cakephp.org/screencasts/view/3.

So CakePHP a front controller to do “request mapping!” WATCH THE VIDEO to get an idea, dude.

ANYWAY, how do you create a really simple front-controller and do request mapping from a Java servlet?

Just create a regular servlet, then make the web.xml entry for it something like this:

<servlet>
  <servlet-name>member</servlet-name>
  <servlet-class>member</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>member</servlet-name>
  <url-pattern>/member/*</url-pattern>
</servlet-mapping>

NOTICE the /member/* for the <url-pattern>? THAT means that ANY requests that come in with the pattern http://www.my.server.com/member/WHATEVER will AUTOMATICALLY be mapped down into the “member” servlet.

So the “member” servlet class might look something like this:

public class member extends HttpServlet
{
  protected void doGet( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  {
    String requestURI = request.getRequestURI();  // if the user hit
    // http://www.my.site.com/member/BOB then the REQUEST URI looks like
    // /member/BOB
    // All I'm going to do now is get everything after the last slash,
    // and that is what will tell me which member profile is desired:
    String desiredUserProfile = requestURI.substring( requestURI.lastIndexOf("/") + 1 );

    // work with desiredUserProfile to produce page output, whatever.
  }
}

Get the idea?

See also:

Java:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html

PHP:
http://www.phpwact.org/pattern/front_controller

Apache Server:

mod_rewrite

Advertisements

What the. . . ?

I’m trying to set up and ftp server on my machine here.

This machine reaches the internet through a router, so I configured the router to talk to dyndns. the router forwards ports of my choosing.

I set up IIS, change the port to 2001 for extra security, and try to connect to it via a simple, reliable ftp program like WS_FTP 6.0 1 (before they tried to make it all weird and heavy and snazzy. No snazz for me, thank you.)

I get the following response from the IIS server:


WINSOCK.DLL: WinSock 2.0
Ipswitch WS_FTP LE 6.0 2003.11.04, Copyright © 1992-2003 Ipswitch, Inc.
- -
connecting to 25.11.22.33:574
Connected to 25.11.22.33 port 574
220 Microsoft FTP Service
USER bobobobo
331 Password required for bobobobo.
PASS (hidden)
230 User bobobobo logged in.
CWD /Ipswitch/Product_Downloads
550 /Ipswitch/Product_Downloads: The system cannot find the path specified.
PWD
257 "/" is current directory.
SYST
215 Windows_NT
Host type (S): Microsoft NT
PASV
227 Entering Passive Mode (192,168,1,103,5,113).
connecting to 192.168.1.103:1393
- -
connecting to 192.168.1.103:1393
Connected to 192.168.1.103 port 1393
LIST
426 Connection closed; transfer aborted.
! Retrieve of folder listing failed (4)

Connection CLOSED???? WHY??

It turns out the answer is that I’m trying to use a port other than the default port 21.

It turns out that IIS 5.1 ONLY works if you set the port to 21. Isn’t that weird?

HOW AM I SUPPOSED TO READ WITH THIS MOVING STUFF IN THE WAY??? ITS TOO DISTRACTING!!

adblock1.png


Hello .. what’s this…?

adblock2.png


Sweet

adblock3.png


THANKS OPERA! I CAN GET BACK TO READING NOW

adblock4.png


Opera browser

here it is

Jan 27

@ 9:18pm, google says in response to the question

1 Canadian dollar = 0.994233 U.S. dollars

Value of Canadian dollar in US dollars, Jan 27/08

Yet, amazon.com and amazon.ca continue to have wildly different prices when it comes to the same exact books.

Compare:

I’m sure there are quite a few more factors in determining prices than I am aware, but come on. $10 more to buy the exact same book, with the same isbn, when the difference between the Canadian and US dollars differ by LESS THAN A CENT??

It seems these prices are appropriate for a couple of years ago, not today.

Why are we paying so much more?

Canadian flag

You know what’s annoying?

URLs like http://msdn2.microsoft.com/en-us/library/bb509638.aspx.

“bb509638.aspx” is completely meaningless to me as a page name.

I heard that wordpress was giving members 3 gb of space. . . however, i didn’t realize we’re still limited to just image files and ms-word docs.

Hmm. We need to serve up other file types. For instance, I’m wanting to serve up a few .zip packages that contain MS Visual Studio projects. These packages are in the KB, and if .doc files can be served up from the blog, shouldn’t code packages be too?

There are a number of options though

esnips.com

!!! My pick (I am moving to mediafire.com, Jan 1/09. I’ll still use esnips, but mediafire looks really neat.)
links like CLICK HERE TO DOWNLOAD!

ugh.. microsoft skydrive. I really DO NOT like how it downloads through a script request. its annoying!!

4shared.com

links like http://www.4shared.com/file/35910795/33c58b0a/testfile.html

I like 4shared.

Other fileupload hosts

wikifortio

Download links like http://www.wikifortio.com/799208/testfile.txt
1 – 99 day storage period
Upload seems to be a tad slow, but I only uploaded a small testfile

senduit

Links like http://senduit.com/b36ba8
– Longevity: 30 minute expiry
– Comments: Doesn’t meet my needs here, but i can see how this would be useful for distributing a smaller file quickly among 5 or 6 friends quickly and easily.

rapidshare.de

links like http://rapidshare.de/files/38405006/testfile.txt.html
Too many “hoops” to jump through to get to final download. Limited unless you have premium.

mihd.net

links like http://mihd.net/f0e2zv
pretty good

badongo.com

links like http://www.badongo.com/file/7479445

files.to

files.to is stupid because it requires a captcha

mediafire.com

WOW. This one is really glossy. Links like CLICK TO DOWNLOAD!. NO LOGIN REQUIRED TO UPLOAD! Really neat! (Tested Thurs Jan 1 / 09) !!! NEW PICK Jan 1 /09

STILL SEARCHING

I’m still looking for a file host that will give me a direct link that I can just post to my blog, without requiring redirection.

The closest thing to this that i’ve found is hfs, which allows you to easily set a folder to see the public internet.

It also does a good job of getting around routers, you just have to port forward.

The best thing would be . . .

Of course, the best thing would be if wordpress actually allowed users to upload other types of files. Although there’s potential for abuse, I want/need to upload code packages (.zip files that contain .cpp files).

WordPress COULD allow .zip archives up to a maximum of say, 8MB or so. Code packages will be something in the KB, so they won’t cause traffic problems.

Lots of people know you have to use &gt; in your HTML to get the > sign.

However, it appears that lots of people don’t know you can get superscripts and subscripts by using the <sup> and <sub> tags.

You can also get the ≤ sign by using &le; in your HTML.

I love this page.

more HTML entities than you thought existed.

And a unicode character reference for bloggers.

thought this was cool.

man. The net is just . . .

EXCELLENT list of Open source software and other really cool stuff

interesting article about Terman

sweet php math formula printer

just another reason to use Smarty

matrix cookbook

Ahaha.

Finally.

ie 8 passes Acid 2.

Wow! I remember seeing Hakon Wium talk about how badly ie fails in this youtube video (he starts speaking at about the 28 minute mark)

also today: iui lib – apple-iphone like interface – very cool

asserts in C++

And some nerdcore rap that entertains (however briefly), linked to in above article: mcplusplus

Google sitemap – MAN this is valuable

I like looking at Google trends

Its really nifty