WWW posts page 44

hosts file to access local servers

Ever since I had to change to a Speedstream router instead of my old 2wire (constant and still somewhat present connectivity difficulties), I had been unable to login in to my WordPress install locally. This was because the Speedstream redirected traffic calling the external URL or IP from inside to itself rather than forwarding the request to the server, and because WordPress requires a single fixed URL reference in its database that it automatically redirects to.

I worked hard trying to get the router itself to not do this, but instead the problem was fixable on my computer itself: the hosts file, as I found on this post. You simply edit the hosts file:
$ sudo vi /etc/hosts
and then place an entry like “accessURL externalURL” for another machine, ie:
tobysServer.local cosmicosmo.ath.cx
or modify a localhost line for a local machine (haven’t tried this yet):
127.0.0.1 localhost
becomes:
127.0.0.1 localhost cosmicosmo.ath.cx
Or possibly you could just do as for another machine and access by the LAN address rather than localhost (haven’t tried this either, just speculation).

This was very quick and easy to do and works like a charm. I haven’t seen what happens if my WAN network access goes down with this method: I imagine it would cause problems accessing any part of the site.

One problem I’ve already found with WordPress and this method is that many links don’t work because they contain the full URL. Examples include the Preview button and the all post links. You must copy the link and past it, replacing the hostname bit. But all the admin links work, at least the ones I’ve tried. Tag autocompletion doesn’t seem to be working either, but I’m not sure if that is a browser compatibility problem with this new 2.7 version or a plugin (simple tags) conflict.


WordPress and SVN

I’ve been thinking about it for a while, but I finally decided to use subversion to update my wordpress instead of the download, copy over to server, copy in all old files method. Details on using SVN with wordpress can be found on WordPress.org.

Since it was my first time, I had to do an initial install so that all the subversion tracking data would be there. The command for installation, which would be used for a new install, was just a simple one line thing with the url of the install and a few flags. Then I had to copy over my htaccess, wp-config, and wp-content, all simple and easy.

Because this brought me up to date, I was unable to try the update type commands. But it seems extremely easy, just a one line command again, plus the web based upgrade script.

This should make my upgrading much faster and easier, and so lessen the delay between upgrades.

[Update 09/01/10]The steps, which I should have included before:
$ cd blogpath
# for trunk versions you can simply update
$ svn up
# OR for full point revisions, you must use the switch command to change versions
$ svn sw http://svn.automattic.com/wordpress/tags/2.7/ .
[browser]updgrade.php

[/update]

[Update 2/13]I’ve now done an update via subversion. It was in fact extremely easy, just one simple command line command followed by the upgrade.php script. Everything works fine, no copying and moving files and what not, although a backup is a good idea.[/update]


emac died; back to the old server

On Friday, the eMac being used as my server suddenly died. It was running fine at maybe 1400, and I had remotely accessed the drive around then. But I noticed the fan noise was strangely missing at maybe 1800. The power button did nothing at all. Reading online, it seemed a dead PRAM battery could cause some all-in-one macs of that era to not boot. So I bought a new battery from radio shack on Saturday. It ran a ridiculous $15 for a 1/2 AA Lithium battery, but I figured it was worth a try to get the server up again. Unfortunately, after putting it in and resetting the power management unit several times, the best I got was the fan to get power for less then a second before shutting off. After some more reading, I found the power supply board is probably bad. On those computers, the power supply is built into a special board for only those computers that contains the graphics and audio stuff as well. So it’s probably not worth it to get a new board for the thing to fix it.

I bought myself an external drive enclosure for 3.5″ disks (I already had one for 2.5″) to get the data from the eMac. I had backed up nearly a month before, and had made several important changes since then, so I wanted the data before I got the server up again. The drive was quite a pain to get to. I had to dissassemble much of the emac to get to the drive. Everything in there is very tightly packed together and crazy, very proprietary looking parts for much of it. When I took out the drive, I was a little worried. It had been a while since I had worked with anything but 2.5″ drives. The thing looked so big compared to them that I was worried it might be and old 5.25″. But of course those went by the wayside long before this computer was made. The enclosure I got (an acomdata) works nicely and is very speedy. It’s also quiet, with no fan, but still doesn’t get hot it seems. It cost more than others, but it got very good reviews, much better than the only other one that I could find locally.

So i got the old data and put it back on my iBook, the computer I use most of the time. I had set up a server for testing stuff on it, so I just copied the old site folders and the important mysql files and got it up fairly easily. The new server has MySQL 5, so it is a little more up to date. It still only has Apache 1 though.

Whenever I get my new computer, which will hopefully be in June, when Mac OS 10.5 is released, the iBook will become the server full time. So it worked out alright really. Except that I’m not sure what to do with the dead eMac. It is currently disassembled in my living room. I don’t really know how to sell it, nor to fix it.


new server

I’ve been wanting to get myself a new server for a while now. I’ve been wanting to get some sort of mini-itx size, low power consuming computer. My cousin Paul had gotten a Via board, and I’ve been thinking of that. Since Apple released the Mac Mini, I’ve also been considering that. Both options look pretty good.

However, my mom stopped me from needing to get one of those. She bought me an eMac that she got some good deal on. It’s 700mhz g4 with 1gb of RAM and a 40 GB hard drive. That’s more RAM than my old server had, and the hard drive will be way more than large enough for only storing server files. It’ll have plenty of room to store backup files as well. It seems plenty speedy. I imagine, though, that it uses a lot more power than the ibook. Definately when the CRT is running. I think it uses as much as 90 watts with that. It also has a fan constantly running (which will seem somewhat silly when my house gets down to 45°F this winter), a larger hard drive, and other such desktop power consuming items. And it doesn’t have the built in battery backup of the ibook, which could be an issue with the occasional power losses I get. Thus, I plan to eventually replace it with either a mini-itx type computer or some cheap laptop.

Still, it is rather nice to have. I now no longer have to worry a lick about taking my computer elsewhere or shutting it down or the like for fear of taking the server off the air. It will be very nice to be able to take it with me when visiting friends or what not, as it is a portable computer. It frees up plenty of memory and a little cpu time. And it just seems much nicer and more organized on both my server and my non-server. It gives me a little more training for setting up servers in more normal situation.

Because of this, I also have much reduced memory consumption on my ibook. Normally, my memory swells quickly and then pushes into swap files until I have four or five. They stay even with only the Finder open. Now though, I have free memory and fewer swap files, while the server is approaching it’s 1 GB limit with just the finder and Terminal running.


DarwinPorts: RoR, new apache

I’ve taken an interest in Ruby on Rails because of a recomendation from some folk at Macaddicit forums. I used darwinports to install Ruby and the gems installer. I then used the gems installer to install rails. Darwinports is very nice and easy to use for the installations, as it takes care of all dependcies automatically and has an easy to understand interface. It is extremely slow though, often taking several hours for some packages.

I got rails working quite quickly through the Webrick server. I followed a tutorial that helped me easily create a simple application in rails. So far it seems very nifty and easy to work with, but I still have a lot more to learn before I can really get going with this.

One part of the tutorial introduced me to AJAX, codename for a set of javascript functions that allow loading of content into an already loaded browser page without the use of frames or objects, the only methods I had known of before this. I had been looking for a replacement for frames for a good while. AJAX allows a lot more versatility than the frame method. RoR offers AJAX through some built-in functions, requiring no use of the underlying javascript. I would, however, like to learn the javascript as well.

The Webrick is much slower and less versatile/functional than a regular server, so I wanted to try to get it running through Apache. I tried it with my current apache install, but couldn’t figure out how to get fast-cgi, a seemingly required component, to work with it. So I decided to move over to a darwinports installed apache; it’d be easier to update anyway, than with the WebServerXKit that I had been using, and would also allow me to change my PHP version to use exif tags so that my photo gallery’d work. That was much more of a hastle. I had trouble installing my apache2 with php5, until I realized I needed to remove the startup item created by WebServerXKit to allow darwinports to create its own. I then had trouble getting it running. I thought it replaced the standard apache install from apple, as it seemed to have modified its httpd.conf, but it was really in it’s own directory. It also didn’t create an httpd.conf for me, so I had to create one from its default one, then modify it with my own settings, plus add in loading of both php and fastcgi. I still haven’t gotten RoR working with it yet. I also couldn’t get the darwinports mysql server to work with it, and for some reason had trouble getting the old mysql server to work (I don’t even know what I did to get it working). Darwinports oughta have more documentation on this stuff, as it doesn’t quite work out of the box and has configuration files and what not in its own locations.


Symbolic Links: from intended dir only

I had much trouble making symbolic links work for my web site. After a bit of investigation, I finally realized the problem: symbolic links with relative paths must be made from within the directory they well be in, i.e. ln -s path/to/file linkname. This means you must cd into the directory the link will be in before making the link. Otherwise, the link will not work properly. This is because the path stored in the link is exactly the one you feed into ln. For example, if you type ln -s . /Users/bob/bill.link in a different directory than bob, bill.link would point to ., AKA bob, which may not be the intention. On websites, such things will lead to a 403 forbidden error no matter what the permissions are. In the finder, the link will not work.

This helped me out a lot for my calendar, for which I needed to point it to the iCal .ics files. Since Apple moved the files into individual folders, I couldn’t just point my phpicalendar to that folder; I had to make symbolic links to each file. The alternative to this would require me to manually synchronize two copies of the file, which would be undesirable.

[Update 2016/09/01]Clarified some things based on increased knowledge[/Update]


Server running again, ibook back

My ibook’s logic board failed for the second time since I got it. The failure is a common problem among certain ibook’s, so the board was replaced free.

When I first took it in to the Apple Store (my first visit to one by the way), the guy said it’d cost like $300 because it looked like I spilled something on it. There had been, but it was a long time ago and before the first logic board was replaced. I had been worried then, but they replaced it no problems. I was a bit angry at the apple store at that point and unsure of what would become of my ibook.

I decided to call the same number I had called the first time (then it was shipped from home, in a box provided by apple). The guy seemed familiar with the problem, and had me hold down the power button for 30 seconds with no power connected, then zap the PRAM. It started up fine, though I had since the problem started not been able to get past the login screen, and usually got no video at all. He told me just to take it to the apple store if something went wrong, and gave me a case number.

After two days, it froze up and wouldn’t start again. I tried the same routine he had me do, but to no avail. I cleaned it up a bit and took it back to the apple store. There was a different guy there, more talkative and friendly, who sent it in for me this time. Phew.

I watched the progress on the apple site. It was done the next day. It shipped back a little slower, but was with me only four days after first taking it in. That’s mighty fast for sure, and all free. It sucks that the logic boards fail on these computers, but at least apple takes care of it quickly and freely. Unfortunately, Their program will expire for my model soon, so this’ll be the last time. I probably have perhaps a year left with it, as it has gone thus far. Hopefully the next computer will be a little more reliable. Hopefully I’ll have money for it when the time comes.

They replaced both the logic board and the keyboard. Bonus. Sweet.

So the server is back up again, not that anyone but search bots and hacker bots visit it anyway.


Hierarchical Site DB Storage

a prototype hierarchical site database will be made containing a description and discussion of everything I own organized by category. for now this’ll allow children to have only one parent, but it will need multiple parents in the future.

page display:
a nav box at the side of each page will have links to its parent, siblings, and children. children will be ordered by type
the content will be in a box. content may also contain links to other pages, especially children, when mentioned.
a site map will provide a hierarchical link list of all pages in database

each page will be a entry in a database. It will have:
a unique id to identify it
the id of its parent page (what links to it)
type/template defining display of page by type
style of page (style sheet for colors, etc of sections). parent inherited if blank. will be unimplemented at first
content of page

root page will be home, with links to all first level sub pages.

example for stuff
transportation page
children: car, sailboat, bicycle, foot
content: It is essential to get from point A to point B: to get products stored elsewhere, see different things and people, go to locations better suited for certain functions. One comes with feet with which to travel about. This mode of transportation is very easily accomplished, requires as little as oneself, allows careful manuevering in tight places, and can easily handle terrain other transportation types have trouble with. It is also relatively very slow and tiring for longer lengths and can only handle ground. A bicycle provides transportation with the body as a motor, allowing more speedy and efficient travel. The bicycle is a fairly simple device, lightweight and easily storable in most places. A car is a much faster mode of transportation that requires very little exertion on the users part. It allows great distances to be achieved within less time and easy transport of goods. It is also big and much more expensive to own and operate…
(this is a brief overview of transportation. children are linked to in content with a brief summary of each. Each child will go into more depth.)
template: this would probably be a “summary” or “directory” type template, just a overview of a category with summaries of each child. Its children would probably be as well. The car category might have children that are of a “product” type, giving a review/discussion of specific instances of the parent. the parent of a collection of “product” pages may contain a comparison summary that provides a conclusion as to which is best for a given situation.


Design Problem Solutions/Tutorial Database

I spend a lot of time writing html, php, and css for my website to implement various ideas and create a certain look. I very often find myself having trouble with one particular thing. I search the web with google or search forums to try to find a solution. Sometimes it’s extremely simple, while others it creates new problems. As I am often working on one part of my site at once, these problems are often related. I would like a site that is a central repository for solutions for all of these problems to exist.

The site would probably be a wiki so as to get input from many people, have a large source of authors, and continue to be updated with new problems.

Posts would be much like a tutorial. They would explain what to do, and also why.

Navigation would be critical, allowing one to quickly find solutions to a specific problem as well as for a more generic learning how to do something type fashion. A good search system would exist like most wikis have, allowing search of the title as well as the content. Also needed is a good way to relate articles and navigate to them through relations. A good, specific category system would be important, with related articles in related categories. The articles should be organized in such a way that they could be followed in a general sequence towards a specific goal like a tutorial. As an example, many people like to create CMSs to manage their site. They go through the same or comparable problems to those who’ve already made them, and thus would benefit from the knowledge of those who’ve already been through it. The cms tutorial would guide them through the process, with the most basic articles being the main path they follow and the less important articles forming side paths. Branching off based upon decisions would also lead through different paths. CMSs are similar in many ways, but some decisions in the design process lead to certain differences in the design process; branches would allow one to design their CMS and choose the branches that apply to them.

This would become sort of a code repository, with code for anything already generically written, and branches in logic allowing for all possible different needs to be accomodated.

Though I came up with this for programming and web design, it could apply to any problems, and thus web-design and programming would only be sub-categories. Examples of where this could be used are in designing a car or planning the construction of a house. Numerous decisions are made in each, though the basic concepts would be used in every implementation: every housebuilder must look at the types of flooring available and decide which is best for the application; every car body design must choose a balance between factors such as aerodynamics, appearance, and capacity to accomodate other parts; every design must choose between a more costly or less costly path based on available resource (money, time, etc).

This seems to work best for problems of design.