Tricking a new computer into working (maybe)

UPDATE: Oh never mind, I’m just using a different hard drive now.

I have a recently acquired Gateway Pentium 4 that I am trying to upgrade to from the HP PIII I’ve been using for my programs that just have to run on a PC.

Problem 1: The Gateway wouldn’t boot from the CD-ROM drive so I could use the Windows XP installer to format the drive.

Solution 1: I attached this drive as a slave to my HP and formatted it there.

Problem 2: The drive wouldn’t format correctly.

Solution 2: Somehow, I just had to get the right combination of things in the Disk Utility (whatever it’s called) in Windows. Delete the current partition, create a new partition, leave the defaults, and do a quick format. Took me a while to figure this out, otherwise it would tell me that the disk would not format correctly.

Problem 3: The Gateway gets stuck at the Gateway splash screen and won’t let me into BIOS to set the boot device.

Solution 3: Unplug all the drives, or even unplug just the floppies and the hard drive, and I can get into BIOS just fine to set the boot device.

Problem 4: I still can’t get into BIOS when the HD is attached. I can, however, boot from the CD-ROM drive and start the Windows installation (up until it looks for a HD).

Solution 4: Here’s the fun part: I unplugged the HD cable and booted from the CD. Then, before it asked if I would like to install Windows, I plugged the HD in. Don’t try this at home, kids! Setup then located the drive, and by the time it got to asking if I would like to install, it found the drive and away it went!

Problem 5: Rebooting during install, not so good. I got a long low beep that wouldn’t stop.

Solution 5: I hit the power button and manually restarted.

Problem 6: Intel boot somethingy found a problem, so I had to boot from the CD again. Uh oh…

Solution 6: Trying recovery at the moment, more news later.

Later:
Installed again, didn’t give me a long beep at restart, but I got the same Intel Boot Agent media failure. Changed the boot order around in BIOS. Now it goes to a cursor (that I can’t do anything with) after the Gateway flash screen.

Things I wish I had time to write more about

Good news.

Related news, from one of the owners of Small Dog Electronics:

Start Soapbox

*****

Fossil Fuel Free by 2018?
By Don, don@smalldog.com

I read with great interest about the challenge that former VP and current Apple board member Al Gore tossed out yesterday. He challenged the USA to completely shift its entire electricity production to renewable energy sources and eliminate the dependence upon oil and coal. Challenging the auto industry to have all electric cars in 10 years and power those vehicles with electricity powered by hydro, wind, solar and geothermal energy is not only a very ambitious plan, but it is an achievable plan that will provide immense benefits to our country. Oilman T. Boone Pickens (don’t you love that name!) also proposed a far-reaching plan to build massive wind energy capacity and has launched a big advertising campaign.

I have some experience in the wind industry as I started a wind energy company in the seventies and did a comprehensive study of the wind industry in the USA in the ’30s and ’40s while I was at Goddard College. Probably a bit ahead of the times, I worked in that industry for fifteen years and know first-hand that the potential for electrical generation by wind energy is simply HUGE. There is no technological barrier to Al Gore’s plan, the technology to harness renewable energy exists now, the technology to produce electric cars exists now and it really does only take a massive commitment on the part of the people to get it done.

The benefits are significant. We are now importing 70% of the oil we utilize and the world’s oil supplies are rapidly diminishing, prices are escalating (and they are not EVER going to come down) and the competition for this scarce resource is and will continue to be the source of conflict around the world. The escalating price of fossil fuels is hurting our economy, it is making it more expensive to commute to work, it is making home heating this winter an emergency situation and is causing the loss of jobs. Contrast that with the massive effort to completely convert to renewable energy. We would be creating thousands of new jobs, new industries and would be buying energy security for our country. Not only that, but we will be significantly reducing the carbon being emitted into the atmosphere. No longer will the USA be the barrier in the battle against global warming, but instead, we will be the leader.

I was pleased that both presidential candidates supported this goal. Now we have to get into the details of how this can be done. This must be a much higher priority than an erroneous war in Iraq that is consuming our resources, both human and financial! The country currently relies on coal for about half of its electric power (49 percent), followed by natural gas (22 percent), nuclear (19 percent) and hydropower (6 percent), according to the U.S. Energy Information Administration. Renewable power accounts for 2.5 percent, although it’s growing rapidly in many states, especially California.

This is really the answer to $4 gasoline today and $10 gasoline tomorrow. We need to shift the prevailing paradigm and realize that with a united effort and an intelligent goal we can once again claim true independence. Al Gore’s plan is more than a remedy for global warming and diminishing fossil fuels, it is a blueprint for a massive economic development program for our country.

*****

End Soapbox

Something I agree with wholeheartedly.

Something depressing.

Something expensive, but worthwhile (especially since we supposedly can’t spend any money on domestic issues until we get a new president, according to my AAAS updates).

 

 

Alliance p2p notes

I’m working my way through this program. I think it works really well, these are just my notes. I haven’t gotten around to posting these in the official forum or bug tracker yet.

Invite Codes
*The only thing the LAN checkbox affects is new invite codes. It does not change how your computer accesses anything else.

*Leaving LAN unchecked uses the web-accessible IP address of the computer. Checking LAN uses the local address (192.168.XXX.XXX).

*You can create two invite codes for each computer: a LAN code and a web code. Sometimes one will work where the other one will not, depending on the relationship between the two computers.

Moving Around
*Switching one computer from one network to another (e.g., from a wireless access point to a wall jack) sometimes results in loss of connection between the machines that cannot be repaired without a)changing the hostname of the buddy to either a local or web-accessible IP or b)deleting a buddy and re-adding them with their invite code.

*It may be the case that Reconnect has to be pressed by users on both ends of a connection after one person has switched networks in order for the change in IP address to register and the connection to be reestablished.

Miscellaneous
*It is unclear what “Reconnect” actually does.

*It is unclear how long it should take for certain things to happen. Sometimes it takes a couple minutes for everything to get situated after starting Alliance or switching networks. It also lags a couple minutes when someone leaves the network before removing them from the active users list.

*Should you be able to add friends of friends with whom you cannot connect? There is no dialogue or notification when they are unavailable after clicking “Finish.” I know that not everyone’s friends of friends will be online all the time, but if they are, and are not accessible from the current location, that should be reflected somewhere for the user.

*What port is being used to send invite codes? Is it possible that the router is getting mixed up and using the wrong port? Is this encoded into the invite code?

*When downloading, then disconnecting, then attempting to download from a different buddy, download will not begin. After removing everything in the download queue, restart is still required before downloading will commence. This may be related to switching networks too.

*Is there a limit on number of files that can be shown per directory? Alliance will not display a folder with 4840 files (kicks the connection for a few minutes), but when searching will display files in that folder that match the search criteria. This may also be related to funky characters in a filename within the folder–since those files weren’t part of the search results, the folder displayed just fine. It was the number of files–keep it under about 1,000.

*Sometimes the checkbox to browse a folder just disappears. Why is this? Because the shared directory name has been changed and the folder doesn’t exist anymore.

*When you have two laptops on the same wireless network and very few people using Alliance in general, it acts like there needs to be a critical mass in order for sharing to really occur. Such as, A and B are in the same room, on the same network, and can see each other. B can see a third computer C, on a different part of the network (outside the wireless access point), but A cannot. In this case, Friends of Friends seems to work, but user C never shows up for A.

Passing and using variables in SMARTY tags (among other things)

I’m posting this because I could find NO answers to this question anywhere.

I wanted to pass a Smarty variable (for example {$hello}) through to the PHP side in Serendipity, get an extended property from the Serendipity database, run a query on the SMF database based on that property, and echo the output.

Comments are ***, which should be removed when copying and pasting.

In entries.tpl:

***Checks if the entry is one its own page or not.
{if !$is_single_entry}

***Assigns a new variable from a Smarty variable  {$entry.id}.  Note the backticks (``) around the variable name.
   {assign var='entryid' value=`$entry.id`}

***Capture the output of the Smarty function, within which is passed the variable $entryid
   {capture name=plural}
        {numbersmfcomments entryid="$entryid"}
   {/capture}

***Outputs some HTML with the Smarty function.  Distinguishes "Comment" or "Comments" based on the capture output.
   {numbersmfcomments entryid="$entryid"}
   {if $smarty.capture.plural == 1}
        Comment
   {else}
 Comments
   {/if}
   --Add yours!
{/if}

 

In config.inc.php:

 

 

***Makes a new Smarty function
$serendipity['smarty']->register_function('numbersmfcomments', 'numbersmfcomments');
function numbersmfcomments($params, &$smarty)  {

***Gets access to the SMF database and Serendipity globals.
require_once('/home/pmp6nl/public_html/talk/SSI.php');
global $serendipity;

***Gets entry id out of passed variable in Smarty function.
$id=$params['entryid'];

***Gets extended info about entries, which is where the SMF topic ID is stored.
$props = serendipity_fetchEntryProperties($id);
$SMFTopic =  $props['ep_SMFTopic'];

***Run a query to count the number of messages in that SMF topic.
$result = mysql_query("SELECT * FROM pmp6nl_talk.smf_messages WHERE ID_TOPIC = '$SMFTopic'");
$numbercomments = mysql_num_rows($result);

***Output that number, minus the original message.
echo $numbercomments-1;
}

I hope this may be helpful to someone in the future.

References:
http://www.s9y.org/78.html#A4
http://www.smarty.net/manual/en/language.custom.functions.php#language.function.assign
http://www.programmingtalk.com/showthread.php?t=11586
http://www.smarty.net/manual/en/language.builtin.functions.php#language.function.capture

 

Kilimanjaro

This is actually something that I posted as a comment on another blog, but I thought it was worthwhile to post again:

My personal opinion is that we’re not going to destroy the world with what we do, but we should probably try not to (by curtailing ourselves from being overly destructive, etc.).

There is supposedly a paper that explains Kilimanjaro’s loss of glaciers as a result of deforestation. The loss of humid air rising up from the wooded slopes causes less condensation and deposition of ice on the cap of the mountain.

A paper in Nature is often (from what I’ve seen in my searches today) cited as the one that explains all this, but the Nature paper is actually a news summary of the work of Bill Ruddiman. I can’t pull up the references right now because UND doesn’t electronically subscribe to the journals in question.

I think this is probably a good answer to the question of Kilimanjaro, not because I’m skeptical of climate change but because the deforestation theory describes a discrete mechanism by which the ice cap would get smaller. It’s a lot easier to figure out whether a specific theory is correct or incorrect than to argue for or against such ill-defined terms as “climate change” that do not in themselves describe a mechanism.

Install GD library in Leopard

If you’ve been here before, note the heavy edits in italics. Read it all before you start doing funky things!.

I needed the GD library for my installation of The Ultimate Family Tree (TUFaT). It’s also needed for OpenX to be able to display graphcs.. For once, I found an excellent step-by-step tutorial on how to do this in the Moodle Documentation. Seriously, this was one of the easiest things I’ve ever done, and I even upgraded my PHP installation in the process. All the files are in the right place!

Just a note, that php.ini-recommended needs to be copied out, edited, renamed as php.ini, and then moved back for the final step.

Important: This blog post is also excellent and easy. It worked out for me when things didn’t work out (see below). Make sure to read the comments for some problems people have had. Here is another site that I didn’t use (because the last one worked).

Happiness!

EDIT: Not so much. For some reason, after doing this none of the applications I have can access the MySQL databases (Error #1045 – Access denied for user ‘root’@’localhost’ (using password: NO) ). Luckily (after giving up on finding an answer today), you can switch back to the default Leopard PHP installation by switching the commenting on those two lines in /etc/apache2/httpd.conf:

To use new PHP installation (above link):
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module local/php5/libphp5.so

To use old PHP installation:
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule php5_module local/php5/libphp5.so

When I find an answer to my problem, I will try to post it. Right now I am attempting to see how much the GD libraries are necessary for TUFaT.

Update: The solution to my problem was with PHP not really knowing where MySQL was, even though MySQL was on and working beautifully from the command line. I’ll copy it here from the comments on ‘phil has a blog’ (thanks mauricio)! Looking at this comment, it was actually posted only 9 hours ago, so that explains why I didn’t find it earlier this week!.

mauricio

After following all the steps described in the blog I had an issue making PHP & MySQL communicate.

After many trial an errors, lots of headaches, and many days with this machine down I found this post on another site. It solved my problem.

I had the same problem with MySQL getting no valid connection.
Code:
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) in

With my default MySQL and PHP installation in Mac OS X 10.5.2 there are no problems with the connection.

In my opinon it’s caused in this parameters from the compilation:
Code:
‘–with-mysql=shared,/usr/local/php5’ ‘–with-mysqli=shared,/usr/local/php5/bin/mysql_config’ ‘–with-pdo-mysql=shared,/usr/local/php5’

With those configurations PHP searches for the MySQL lib inside of the PHP5 path.
My solution was:
Code:

cd /usr/local/php5/lib
sudo mv mysql mysql.old
sudo ln -s /usr/local/mysql/lib mysql

restart apache

Using ImageJ for what tpsDig does, but on a Mac

If I had discovered this months ago, my thesis would probably be in a much better position right now! I’ve been tied to the PC in my office, rather than being able to go home and watch movies or TV shows while I did my digitizing.

The free program ImageJ is useful for all sorts of things, like processing images for analysis and doing measurements on photographs, but it can also record coordinate (x,y) pairs as an output file, which is perfect for digitizing specimen outlines for later Elliptical Fourier Analysis.

I have been using tpsDig by F. James Rohlf for this, and I’ve never seen an alternative mentioned, probably because most of the other software written for geometric morphometrics is written for DOS and Windows.

Enough blabbering, here’s how to do it:
1. Start ImageJ. Open the image you want to outline.
2. Important! Make sure the coordinate system being used is the same as that in tpsDig (tpsDig places the origin in the lower left, ImageJ in the upper left by default). Select Analyze->Set Measurements…->Invert Y Coordinates.
3. Select the “Polygon Selections” tool on the floating toolbar. [If you’re really good, you could also use the “Freehand Selections” tool and get out scads of numbers.]
4. Outline the object by clicking along the edge of the object. When you close, double click to stop the digitization.
5. Choose File->Save As->XY Coordinates and save your file.
6. You’re done!

To get this to be readable by tpsDig and related software, you will obviously have to add the top three lines that describe the file, the number of landmarks, and the number of curves, as well as the name of the image file as the last line in the file. I don’t have a present need for that, but it’s not too hard to write up an R function (or a terminal script) to add lines (interestingly enough, I’ve been using sed to do this in DOS batch files recently rather than the OS X terminal).

UPDATE: Somewhat annoyingly, ImageJ seems to only open JPG files in RGB colors, not in CMYK. I have no idea why. Luckily, this comes at a time when I am only first starting to realize that CMYK is a more standard color choice than RGB, so most of my files are still in RGB.

If scaling is a factor (it is for me), you can install the Zoom_Exact plugin (near the bottom of the page). Installing this was interesting, but the documentation helped somewhat. What you want to do is:
1. Choose Plugins->New…,
2. Select type “Plugin” and name it “Zoom_Exact”
3. Paste the code into the boz that appears and save it as “Zoom_Exact.java”
4. Restart ImageJ. “Zoom Exact” should appear at the bottom of the Plugins menu.
5. To easily use Zoom Exact, you can map it to a shortcut key with Plugins->Shortcut->Create Shortcut. I have mine mapped to capital “Z” so I can call it up easily when I want to get the scaling right on the screen.

Schools

I’ve been reading the comments to this blog post by an inner-city teacher for the last few days. The major discussion is about whether or not it is right to separate students who care about their education from those who do not want to be in school. Good points have been made on both sides, but the excerpt below (from comment 126) really makes sense to me.
 

Charter Schools aren’t always the answer. Children who have experienced gun violence, house fires, abusive parents, gangs, hunger – are not going to be able to learn whether they are in a charter school or public school.

We need to declare war on the inner city – not Iraq. We need to make our children safe, warm and nourished if they are to succeed in school.

The first step towards having an educated populace is making that populace feel that they can get an education safely. This is an American freedom: are the kids and adults in the inner city able to achieve life, liberty, and the pursuit of happiness? Or are they limited by the devastation they see around them every day? If you don’t see anyone around you achieving anything, it makes you think nothing can be achieved.

We should declare war on the inner city. We should make the entire country safe for our children. I can’t see any argument against this–when we have problems like this in our own country (people losing faith in the economy, people losing faith in the public schools, people losing faith in themselves, people losing faith in students because of how they act), we should act to fix them. This means eliminating gang violence. This means eliminating any sort of criminal activity.

It also means more investment in education. It means offering courses (with childcare) for people who never finished high school. It means engaging the youth before they decide that hanging out on the street corner is more exciting than Edgar Allen Poe, mitochondria, or astronomy.

Destroying the inner city means making people proud of where they live, not because it makes them tough but because it’s their home. It means enforcing building codes and keeping street lights prepared [In good repair?  2014-02-07]. It means making sure that our police force is synonymous with honesty and integrity, not with power and corruption.

This will take time, and it will take money. I for one am willing to donate that time (by volunteering and teaching) and money (yes, even if it means a tax increase) if we can build a country where everyone is free, everyone can feel safe, and everyone can get an education regardless of their circumstance.

UPDATE: Thomas Friedman is saying the same thing.

 

R and installing mvtnorm

Just a note, since I had to figure it out.

Mac OS X Tiger PPC, R 2.6.1

To load the ICSNP library in R, you need to install the mvtnorm package. The package installer for some reason would not do this, but you can download the binary from this page and install it with Packages & Data -> Package Installer -> Local Binary Package (under “Packages Repository”) and click Install, which will let you grab the package from the place to which you downloaded it.