Posts This Month
· Helpful MS images
· Java spider function
· Ipswitch not uploading your files when you're uploading directories?
· Warning: copy(yourfile): failed to open stream: Permission denied in yourPHPfile on line x
· Dumping old computer blog posts here
· Problems publishing on Blogger.com?
· What is PR2, PR3, PR4, etc.?
· Site update

Archives
April 2005
May 2005
June 2005
July 2005
August 2005
November 2005
December 2005
January 2006
February 2006
March 2006
May 2006
June 2006
July 2006
August 2006
October 2006
March 2007
May 2007
June 2007
September 2007
November 2007
January 2008
June 2008
August 2008

Links
· Startup Applications List
· Welcome to the Hex Hub (Named Hexadecimal Color Codes for HTML)



More blogs on this site:



Powered by Blogger
 

Computer Blog - thebroadroom.net: May 2007

Disclaimer: all of the following is purely from personal experience. TheBroadroom.Net urges you to use your own instincts, common sense, and willingness to take risks when applying any of the information below.

Geeks rule.
Profile · Current Blog



Google Custom Search


Helpful MS images
posted by Colleen Shirazi, Tuesday, May 29, 2007 at 3:29 PM (Pacific)





Labels: ,


0 Comment(s)



Java spider function
posted by TheBroadroom.Net, Monday, May 28, 2007 at 11:09 AM (Pacific)

Thursday, October 21, 2004

Here is some source code for a Java spider function. I'll guess it could have been written as a recursive function but I couldn't remember the name "recursive," so I slapped together two functions. Quick and dirty, but it works.

public void spider(String directory) {

  File dir;
  Vector directories;
  String child;
  String mydir;

  // got this snippet off the Net
  dir = new File(directory);
  String[] children = dir.list();
  directories = new Vector();

  if (children == null) {
    // Either dir does not exist or is not a directory
  }
  else {

    for (int i = 0; i < children.length; i++) {

      child = children[i].toLowerCase();

      // I don't have the FileFilter class, sorry
      if(child.endsWith(".html") || child.endsWith(".htm")) {
        m_file_list.addElement(directory + "/" + child);
      }

      // test to see if it has no extension
      else if(child.indexOf(".") == -1) {
        mydir = directory + "/" + child;
        directories.addElement(mydir);
        m_directories.addElement(mydir + "/");
      }
    }
  }
  testVector(directories);
}

public void testVector(Vector v) {

  // if there's anything in the directories vector, call spider
  for(int i = 0; i < v.size(); i++) {
    spider((String)v.elementAt(i));
  }
}
...

Of course what you do with the files and subdirectories is your business. Here I have a vector to add the filenames to, and a vector to store the directories and subdirectories. You don't need to store the latter if all you want to do is access all of your files and do something with them; I stored them purely for the report that gets written after all the directories have been crawled.

If you would like the option of eliminating certain subdirectories from getting crawled, it's easy enough to list them and then compare each directory against your list.

Here's the report for my particular program. It's simple; all it looks for are two HTML tags. If it doesn't find them, it slaps the file on the "tags not found" list; if it does, it replaces whatever is between the two tags with a new string (in this case it would be advertising).

This is from our "fun" and "fashion" directories:

Completed files: 4
fun/index.html
fun/book_reviews/index.html
fun/book_reviews/2003_q4/da_vinci_code.html
fun/article_index/index.html

Tags not found: 47
fun/wit_wisdom.html
fun/weblogs/index.html
fun/weblogs/women_bloggers.html
fun/book_reviews/2003_q4/five_people.html
fun/book_reviews/2004_q1/girls_guide.html
fun/book_reviews/2004_q1/five_people.html
fun/book_reviews/2004_q1/emperor.html
fun/book_reviews/2004_q1/songbird.html
fun/book_reviews/2004_q1/why_some_men.html
fun/book_reviews/2004_q2/how_do_you_compare.html
fun/book_reviews/2004_q3/buddha.html
fun/book_reviews/2004_q3/corpses.html
fun/book_reviews/2004_q3/midlife.html
fun/book_reviews/2004_q3/evenings.html
fun/book_reviews/2004_q3/pregnancy.html
fun/book_reviews/2004_q3/sororities.html
fun/book_reviews/2004_q3/who_cares.html
fun/book_reviews/2004_q3/drifting.html
fun/book_reviews/2004_q4/chasing.html
fun/book_reviews/2004_q4/winning_habits.html
fun/book_reviews/2004_q4/angels_demons.html
fun/book_reviews/2004_q4/a_royal_duty.html
fun/book_reviews/2004_q4/sammys_hill.html
fun/link_exchange/index.html
fun/feature/index.html
fun/feature/marlo_thomas.html
fun/feature/old_features.html
fun/feature/who_cares.html
fashion/index.html
fashion/what_do_you_wear/index.html
fashion/what_do_you_wear/reach_for.html
fashion/what_do_you_wear/accessories.html
fashion/what_do_you_wear/gap.html
fashion/what_do_you_wear/banana_republic.html
fashion/what_do_you_wear/shoes.html
fashion/what_do_you_wear/target.html
fashion/what_do_you_wear/old_navy.html
fashion/what_do_you_wear/bras.html
fashion/what_do_you_wear/cafepress.html
fashion/what_do_you_wear/2003_q4/socks.html
fashion/what_do_you_wear/2003_q4/whimsy.html
fashion/what_do_you_wear/2003_q4/fall.html
fashion/what_do_you_wear/2003_q4/old_clothes.html
fashion/what_do_you_wear/2003_q4/weather.html
fashion/what_do_you_wear/2004_q3/bracelets.html
fashion/anti_fashion/index.html
fashion/anti_fashion/2003_q4/accessories.html

Total files read: 51

Total directories read: 17
fun/
fun/weblogs/
fun/book_reviews/
fun/link_exchange/
fun/article_index/
fun/feature/
fun/book_reviews/2003_q4/
fun/book_reviews/2004_q1/
fun/book_reviews/2004_q2/
fun/book_reviews/2004_q3/
fun/book_reviews/2004_q4/
fashion/
fashion/what_do_you_wear/
fashion/anti_fashion/
fashion/what_do_you_wear/2003_q4/
fashion/what_do_you_wear/2004_q3/
fashion/anti_fashion/2003_q4/

Labels:


0 Comment(s)



Ipswitch not uploading your files when you're uploading directories?
posted by TheBroadroom.Net, at 11:02 AM (Pacific)

Wednesday, February 02, 2005

I just found out that the default setting on the Ipswitch FTP program, does not transfer "older or same" versions of files on the server, when you're uploading directories. It doesn't pause and ask you. It just goes through every motion of uploading them, and doesn't upload them at all.

Oh gee, how did I find out about that? rotfl...

Labels: ,


0 Comment(s)



Warning: copy(yourfile): failed to open stream: Permission denied in yourPHPfile on line x
posted by TheBroadroom.Net, at 10:54 AM (Pacific)

Friday, February 04, 2005

A possible solution to PHP Warning: copy(yourfile): failed to open stream: Permission denied in yourPHPfile on line x

I got this error and cracked my head over it for a while. The usual, googling around and getting hundreds of examples of people asking this same question and not getting much, if any, answer to it.

Someone finally came up with the idea that it had to do with permissions...XOOPS.

First I checked to see if the destination directory was writable. It was.

Then...(slaps self upside head)...I realized that the file I was trying to upload, was supposed to overwrite an existing file on the server. I had FTP'd that existing file up prior to that and I suppose that had made it un-writable-to.

I went and deleted the existing file on the server, rather than bother trying to change permissions on it. Of course this would depend on which file you're trying to overwrite...you may well prefer to change the permissions.

Once the file was gone, the upload was successful.

Labels:


0 Comment(s)



Dumping old computer blog posts here
posted by TheBroadroom.Net, at 9:29 AM (Pacific)

I've decided to dump the posts from the old computer blog here. The blog itself got deleted a long time ago, back when I was a moron and deleted it (the tech stuff usually gets experimented with first). Hence, the posts have been sitting on static HTML pages all this time. It's not worth doing anything with the pages (they're in the old site format) and some date back to 2002 and are basically worthless anyway, so...

Labels:


0 Comment(s)



Problems publishing on Blogger.com?
posted by Colleen Shirazi, Sunday, May 27, 2007 at 11:28 PM (Pacific)

I've had these on and off. I'll try publishing a post, and the thing keeps running and running, and doesn't publish anything. It will occasionally show a message saying to the effect: This is taking longer to publish than we thought, click here to continue publishing. So I click, and it starts running and running again, then I get the "publishing is taking longer than we expected" message again, then it runs and runs again, et cetera.

After some rounds of this, it will say, "Your blog was published with errors." When it finally gets to this point, I can actually publish it.

I used to be able to pop open IE and get it to publish there (I usually use Firefox). Now it's exactly the same in both browsers.

One time it did that, it occurred to me to try clearing the cache. This actually worked. When I got the umpteenth "publishing is taking longer than we expected" link, I cleared the browser cache before clicking the link. It published right away.

I haven't had the opportunity to try this theory out again as Blogger hasn't been "down" for me since, but I'm game to give it another go.

Labels:


0 Comment(s)



What is PR2, PR3, PR4, etc.?
posted by TheBroadroom.Net, Friday, May 18, 2007 at 8:58 PM (Pacific)

I went ahead and downloaded the Google Toolbar. I'm not big on toolbars, but the idea of being able to see the Google PageRank of every single Web page you visit...it's...handy.

Yes, you can download this from the orange link at the top of this blog (a small commission will go to thebroadroom.net):



Even if you already have Firefox, you can choose to download only the Google Toolbar.

What you'll get for your trouble is a little doohickey like this:



That's the PR4. (We have a few of these; the screenshot is from our home page.)

If you visit the root directory of the domain, you'll return the PageRank of the entire domain, otherwise it gives you the PageRank of the page you're on. It changes every three months, from what I read.

Labels:


0 Comment(s)



Site update
posted by TheBroadroom.Net, Wednesday, May 16, 2007 at 10:51 PM (Pacific)

So...I'm sitting here, working on updating the blogger templates. The problem is not the blogs of course. The problem is that half the site is still on HTML pages, before I moved everything to blogs...and the HTML pages are out of date. They were produced before I got Dreamweaver, so they don't even have the "new" site template on them.

I can admit it's been a long time since I've done anything with this site, beyond the few sections I contribute to regularly. I suppose what's motivating me now can be summed in a single word: PageRank.

I know, I know, I shouldn't give a crap about PageRank--since, currently anyway, it isn't putting much moola into my pocket--but I happened to come across some people who use the Google Toolbar, and therefore view the PageRank of every Web page they visit, and it finally occurred to me that this site actually has a decent PageRank.

So, first the easy stuff...fix up the blogs. I'm halfway finished with that, it's more nip and tuck than any real work.

What I'm thinking of doing is simply grabbing the content of those old HTML pages, estimating the dates (some, if not most, are just going to have the quarter as the date), and shoving it all into...the blogs.

It's not worth converting HTML pages to new, Dreamweaver'd HTML pages. (It would be more than just slapping the template on.) It would be worth it to shlep the content onto the blogs. It's good content.

Labels:


0 Comment(s)