30th on 30th mapping

Later today, I’m going to a “30th on 30th” event where my friends and I will visit several restaurants and bars to sample some of their food and drinks. There’s a blog that has posted some items that will be served, but I have no clue where they are relative to 30th Street. I don’t know if they’re all close to each other or far apart, and since I’m the contact person for people meeting the group there, I thought I should do some research to map out the places. Since we might do this again, and since many places participate regularly, I thought it’d be useful to work on a mashup to at minimum show the places on a map. I was going to print it out, but with this method everyone can pull it up on their phone. So, this will document part of my work.

I’ve been programming with the Yii framework, and I like how it simplified a lot of tasks like the built in entry forms from the CRUD. To get started, I’m going to build the database now. Since my new Macbook Air isn’t fully set up yet with all my apps, and I don’t have my work Macbook Pro here, I’ll do this with my PC. Eek! So, my tools will be Netbeans 7.0 and MySQL Workbench.

My database:
“places” table to store the name, address of each restaurant/bar, and latitude/longitude for mapping
“special” table to store the date and what’s being offered.
foreign key linking special.place_id to places.place_id

Yii Setup – using yiic to create basic web app files and directories
I’m programming in XAMPP, which is stored at C:\xampp. To set up a basic Yii setup, you need to run “yiic”. I’m more of a unix person, so it was a little trickier to do this on my PC. Well, it wasn’t that hard. Here’s what I did:
cd c:\xampp\htdocs\yii
c:\xampp\php\php.exe framework\yiic webapp 30th

That will prompt you to confirm that you want to create a “Web application”. I typed “Yes”. It’ll spew out some log info about what files and directories get created. At the end, you should get a message telling you that your application was created successfully.

Yii Setup – using gii to create models, controllers, crud
With the database and web app files created, it’s time to use ‘gii’ to automate the creation of models, controllers and crud pieces. I had to check the Yii site to find an example of the order in which these are created. Here’s my order, based on this article, http://www.larryullman.com/2009/11/07/creating-models-views-and-controllers-in-yii-2/:
model generator (table names: place, special)
crud generator (Model Class: Place, Special)
note … this will automatically create the controllers too =)

Populating Data
So far, so good. Nothing has really presented itself as an obstacle, so now it’s time to use the crud forms to enter data. My dev virtualhost is called “30th”, so I can just go to http://30th/place to see the view for the “places” in the database. There’s nothing here now, so I’m going to click on “create”, which will go to http://30th/place/create. It didn’t quite take me there automatically. I had to enter the admin info first …

So, now I’m going to do the boring task of getting the address data for each participating place.

Quick note … since all the places are in San Diego, I altered the database to use city:San Diego and state:CA as the default into. I also recreated the model and crud generators for the “place” table.

The Lion Roars Tonight – Macbook Air Style

I just got my Macbook Air today, and I’m setting it up now to have all my necessary work apps.

First order of business was Netbeans 7.0 which runs on Java. There are lots of articles about Java on newer Macs, but they were just things to read without instructions. I finally found what I needed for my Netbeans install, Java for OS X Lion, http://support.apple.com/kb/DL1421. Once I found that, the Netbeans installation was easy.

S70 maintenance – Thermostat and ECT

My check engine light was on for a while, but since the car seemed to run OK, it didn’t bother me much. However, one day after shutting off the engine, the radiator fan kept spinning for several minutes. That surely was eating up my battery power, so it started to worry me.

Thanks to volvoforums.com, I was told that the probably was likely my electronic coolant temperature sensor (ECT). My research showed that it was a pretty easy job and also best accompanies by a replacement of the thermostat. So, I bought all the parts and tried my hand.

Many sites warned that the two T40 bolts were going to be difficult. In preparation for this, I looked around for some PB’laster as suggested. My web searches couldn’t locate it at the usual hardware stores, but for some reason a single Walgreens location in town had it. Amazon sold it, but I didn’t want to pay $9 for a large can or wait the extra days. So, I went to the Walgreens. Argh, they didn’t have it! Their computer said it was in the store somewhere, but it was nowhere to be found. It definitely not next to the WD40 …

Disappointed, I went home and borrowed my roommates WD40 and sprayed the bolts. As a test, I tried to unscrew the bolt, and I heard it crack and saw some powder come up. That worried me a little, because in the forum someone showed a picture of a broken low quality torx bit. None of my tools are high quality, so I was worried this could happen to me, but luckily I was still OK. I sprayed some more WD40 and called it a night to let the WD40 do its work.

Oh, back to my low quality tools. Not only are they low quality, but in some cases they aren’t even the best for the job. I was using a T40 bit that fits into driver. Real mechanics have T40 bits that fit onto socket wrenches. Here’s how lame my setup was … a T40 bit sitting in a 1/4″ hex socket with an extension connected to my 98 cent ratchet from Lowe’s. I had to tape the T40 bit to the socket so that it wouldn’t fall out when I lowered the tool into place. It did the job in loosening the back bolt, but my tape method totally failed, and the T40 bit fell somewhere into the dark depths of the engine =( Not learning my lesson, I opted for a cheap $6 toolset from HomeDepot that had the T40 bit. I thought I’d be better off this time since I found a proper sized extension with a magnet, and I used duct tape this time!

So, finally, I had courage and I got out my trusty copper pipe to act as a breaker bar. I held the tools firmly in place to minimize the chance of stripping the head, and I was able to break it loose. When I took it out, I could see some white area, which was probably the powder I saw earlier. I guess it was loc-tite or something …

OK, so here’s where the next surprise came … before I removed the bolts, I had pinched off the radiator hose as best I could. What I didn’t realize was that there was a lot of coolant sitting on top of the thermostat. I opted not to drain my coolant first, and this was probably a bad idea. Well, not a whole lot of coolant was lost, but it could have been mitigated. All the coolant started to splash out because the 2 bolts mentioned earlier helped form a seal around the thermostat. Once loosened,  …

Moving on … so I changed out the thermostat in 5 seconds. It just sits in place and the pressure of the bolts keeps it there. So, I turned my attention toward the ECT. I was a little puzzled because the “ECT” in my hand was so not the same as what I saw in the guides. It mentioned a 19mm nut, and I thought that maybe that was part of the car and that it would screw over the new ECT. So, I kept going … Much to my chagrin, I realized that my 19mm open wrench was missing from my bag of wrenches. Neither of my roommates had one, so I was stuck! I was not in the mood to put everything back just so I could drive to the hardware store, so I called my dad. Luckily he had one, so we planned for him to bring it by the next morning.

With the 19mm wrench in hand, I was able to loosen the nut. There’s not a lot of room to turn a wrench, but there’s enough to get the job done. So, I took out the ECT, and it looked just like the ones in the guide, Sadly, it was not remotely close to what I had bought. Going back online to see what I bought, I realized that I had bought a “electronic coolant level” sensor! Dang it! So, once again, I was stuck …

I remembered that someone in the forum mentioned buying their ECT from Napa, so we went there after having lunch. They didn’t have it. After trying two other auto parts stores, we were able to reserve one at a PepBoys across town. It didn’t have a crush washer in the box, but I guess I wasn’t too bothered by having to reuse the old one at this point.

So, I installed the new ECT, and put everything else back in place. I also refilled my coolant tank and started the car. It started, but the Check Engine Light was still there. Oh well, I thought … maybe it’ll go away after I drive it. I drove the long way to church, and it still didn’t go out. Argh. Then, upon my roommate’s suggestion, I used my OBD reader and erased the codes, and that did the trick. The Check Engine Light went away and hasn’t come back.

Yay.

S70 maintenance – spark plugs and more

Some cars don’t have easy access to the spark plugs, but that’s not the case with the Volvo S70. All 5 plugs are sitting right on top of the engine under a plate. With the right torx bits, the plate comes off, and you can see the wires that lead to the distributor cap. My car is a 1998 S70 T5, and I guess it’s old enough to have a distributor cap and rotor; I didn’t know until recently that the newer models don’t have them.

The distributor cap is obstructed by the airbox, but having gone through the process of replacing my ABS module, I could probably take out the airbox without looking. It’s simple and doesn’t require any tools.

The distributor cap and rotor both came off easily. One thing that surprised me was that the bolts of the Volvo rotor were not the same as the Bosch rotor. The Bosch rotor required a 3mm allen wrench.

One thing that was nice was that the plastic clip that keeps the spark plug wires together has numbers labeling the wires. The distributor cap also has numbers too. I labeled the wires on my old cap as a reference, but with the numbers on the cap, it wasn’t necessary. It was a good precaution though.

The job wasn’t too bad overall. The spark plugs came out easily. My spark plug socket had a rubber gasket inside, so once I unscrewed the plugs, the gasket was tight enough to hold the plugs as I lifted the socket out of the engine. Without that rubber gasket, I’d probably have to find some super long needle nose pliers to fish them out.

My spark plugs were not gapped correctly. They were at least .03, so I gapped them to .028. Putting the new ones back in was easy too with the rubber gasket. I just popped the plug into the gasket, and then I was able to lower the plug into place. Without the gasket, I would have dropped the plug into place, which would not have been very clean since I put some anti-seize on the threads.

Overall, I’d say this job is a confidence booster for beginning shade-tree mechanics, especially when the car starts up after the job is done.

Trying the Rosewill Alkaline Battery Charger

Recently, newegg.com had the Rosewill alkaline battery charger (RGD-CT505) on sale for $9.99, a good discount of the normal $29.99. I read a lot of the reviews, and many complained about not all batteries working, leaking, and diminished use of batteries over time. For $9.99, I was willing to give it a try. Heh, immediately after putting in my order, I started to rethink my impulse purchase. For $9.99, I could just about buy a brand new, problem free set of NiMh batteries. Plus, there have been some recent deals for large packs of regular alkaline batteries for free after rebate.

Oh well, I’ve spent much more on other impulse buys. This was worth at least trying. After all, I have a virtually infinite supply of alkaline batteries available to me. At my workplace, we have battery recycling bins, and I’ve been tapping into them for a while. You’d be surprised at how many batteries I’ve been able to salvage. Oftentimes, when you use several batteries together, one battery will go bad, and thus the set doesn’t have enough juice overall. To me, these batteries get tossed way too early. Plus, even if they all lost their charge equally, some devices don’t need as much voltage to work. I’ve been able to subside for quite a while on used batteries in my Apple bluetooth mouse at work.

One useful caveat in the reviews I read was that the charger didn’t like batteries that were already highly discharged. Before starting my test, I separated a batch of batteries into three bags, one for batteries less than 1.1V, batteries less than 1.4V, and batteries above 1.4V. The ones below 1.1V are probably not worth trying, and the ones above 1.4V are still somewhat usable as is. So, I’m focusing on the batch in the midrange.

The instructions said to charge for 4 hours. So, I let them charge from 10:33pm to 2:33am. Here’s what I’ve found so far:

ID Brand V start V end V resting
1 Energizer 1.347 1.577
2 Duracell 1.347 1.577
3 Duracell 1.222 1.522
4 Duracell 1.297 1.555

I recorded the voltage fresh off the charger, but what matters more is the resting voltage. I measure that tomorrow. However, so far, the results are promising. At the moment, I’m not really interested in doing any scientific testing of the these batteries. As long as they keep my Nintendo Wii controllers and blinking red lights on my bike working, I’m happy =)

Prestashop and express checkout

Ion_cannon released his express checkout for Prestashop a while ago, but I haven’t tried it yet. Now that Prestashop has moved up to 1.3 alpha, I guess version 1.2.5 must be pretty stable by now. So, I guess now is a good time to try the new module.

I haven’t used any modules other than the ones that come with the installation, so hopefully this will be a piece of cake to install and use. I’m running a pretty plain installation with just a few tweaks to the base theme, so I think that will help …

The first step was to move the module files into place. I think by default these (blockmyaccount, blockcart, and blockuserinfo), so I copied them into the modules folder.

The next step was to move the theme files. A lot more files being overwritten in this step …

Next, copy the ‘img/ionexpress’ folder into the ‘img’ folder. No overwriting here.

Next , ‘express-order.php’ and ‘express-cart.php’ are moved to the root directory where other php files are. No overwriting here.

Next, a SQL query was run, “ALTER TABLE ps_customer ADD guest int(1) NOT NULL DEFAULT 0;” This gave the output:
Query OK, 23 rows affected (0.09 sec)
Records: 23  Duplicates: 0  Warnings: 0

Next, a little terminal work to delete the Smarty cache files, “sudo rm /tools/smarty/compile/*.php” from root directory.

Next, some updating of the back office tools … edit “admin/tabs/AdminCustomers.php” … look near the top of the file for “public function __construct()” and add
‘guest’ => array(‘title’ => $this->l(‘Guest’), ‘align’ => ‘center’, ‘active’ => ‘guest’, ‘type’ => ‘bool’, ‘orderby’ => false),
before
‘active’ => array(‘title’ => $this->l(‘Enabled’), ‘width’ => 25, ‘align’ => ‘center’, ‘active’ => ‘status’, ‘type’ => ‘bool’, ‘orderby’ => false),
Finally, I edited the “themes/express-order.tpl” file to make the “US” the default country. I changed the “                    <select name=”id_country” id=”id_country”>
<option value=”">–</option>
to be
<select name=”id_country” id=”id_country”>
<option value=”21″>USA</option>

Yeah, those are the changes that I made. Now, to see how it looks …

Prestashop duplicate products error

The admin tool for Prestashop is slick, but the pure ajax pages slows me down when pages have to refresh. One good thing about zencart was that I could modify attributes without having to load other information about the products. Plus, I could switch from one product to another very easily.

As soon as I add an attribute to a product, like telling the system that I want to sell the mask in blue, the system has to reload a lot of information. So, there’s always a pause before I can add another color mask. It would have been been nice to take an existing product and just duplicate it a few times since practically all the masks have the same colors. Unfortunately, the duplicate product feature isn’t working for me, and I wind up with a “an error occurred while creating object” error message.

It duplicates the product in the “ps_products” and “ps_products_lang” tables, but not in the important “ps_category_product”, “ps_product_attribute” and “ps_product_attribute_combinations” tables. The ps_category_product table is easy to modify and there’s very little needed to get the product into the table. I’ve figured out the other two tables, but they require a little coordination. I’m going to try skipping that routine tonight and try the product attribute import feature. I hope that will make things easier. I really ought to import products to speed things up!

update:
Well, the import of attributes worked once I realized that the fields were separated by semi-colons. I should have figured that out sooner, but when the tool says to import a CSV file, that notion gets confusing. A comma separated file implies that fields are separated by commas! So, I had to load my CSV file in Excel and search/replace the commas to be semi-colons.

So, the import did work, but one problem is that it duplicates options in the database. I don’t need more than one “blue” attribute in the database. It would be nice if it I could have provided the id value for blue instead of it creating a new attribute. So, this isn’t going to work for me.

The answer is straight database hacking inserts for now … The ps_product_attribute table is only important to me for 3 fields: id_product_attribute (auto_increment), id_product, and default_on. So, my insert will just be
“insert into ps_product_attribute (id_product, default_on) values (126, 0)”, and I’ll run that statement for each attribute I want to insert for a product. For the first attribute, I’ll change that 0 to a 1 to designate it as the default attribute. All this does is tell the database that I want to create an attribute for the product, and it produces a primary key id_product_attribute that I’ll use to actually specify what the attribute is.

So, in the “ps_product_attribute_combination” table, I will run
“insert into ps_product_attribute_combination (id_attribute, id_product_attribute) values (75, 245)” where the 75 is the id value for blue attribute, and the 245 is the primary key I just created. If I do this properly, I should be able to have a file with all the insert statements and just run through it all at once. As long as I keep my primary keys in order, this should work. Heh, if it doesn’t work, I’ll have to add an another update to this post!

Prestashop Import from Zencart – part 1

Tonight, I thought I’d get acquainted with Prestashop. I installed it once before when I was thinking about starting a store for someone. I gave up on that after having to manually create products from static pages. That’s normally something the shop owner would do, but I was trying to create the store in hopes of having the owner pay for it eventually. So, I was going backwards.

For this install, I tried Prestashop with a store that I set up before with Zencart. Zencart works fine, but I guess I wasn’t too interested in the theming part, and I don’t really like the steps to completing a sale. So, the existing store is not very professional looking. It gets the occasional sale, which isn’t stellar, but that’s fine for now since hosting is dirt cheap, and the main avenue of sales is elsewhere. It would, however, be nice to have a better looking site and see if that will increase sales.

So, in comes Prestashop …

Since I’m starting from an existing store, I was pleased to find an OS Commerce to Prestashop import script online. It doesn’t import attributes, but at least it was a start. I don’t know if I should have looked harder for an import script, but oh well …

To import the zencart products (zencart is a modified OSC), I did a mysql dump on the zencart database to a text file. Then, I did a search/replace on the “zen_” to “osc_” which the import script wanted. I also did a “chmod -R 777″ on the os2ps directory to fix some permission problems. Running the script creates 2 sql files in a “generated” directory, one for categories, and another for products.

I ran the category import script without any errors. The product import script had a few problems though due to duplicate keys. I was importing from an older test database, so I don’t know how reliable some of the data is, so this didn’t really bother me. For the item that didn’t import properly, I just edited the sql code to use an id (integer) that wasn’t in use. That fixed the one product, but I had a few more items that also didn’t work. After fixing those, I was able to run the script without errors. Not bad.

When I finally went to the admin site, I could see that there were new categories, but they all had empty names. The sql for the categories had the names in them, so I was a bit confused why they didn’t show up. No big deal … it was easy to edit the missing names. I had to enter short names for the categories anyways, so it wasn’t very much extra work.

The categories showed up with a list of products, and these too had empty names. That again was puzzling since the prices were there. I eventually figured out that the items all were imported with the “id_lang” field set to 2, which is “French”. Since I was viewing the site in English, the site didn’t have the language information for the data in English. So, I ran a simple query to update the “id_lang” to 1 for all the products in the “ps_product_lang” table. Heh, I realized even later that I should have done that to the categories in the “ps_category_lang” table. Now my “ps_category_lang” table has French and English versions of the categories, but I will delete the French ones since they aren’t necessary.

Well, that’s as far as I’ve gotten for now. I have all the products in the database with categories and prices. The next step is to deal with the missing attribute and image data. That will likely be manual.

Aspire One – 16G Compact Flash upgrade

I finally bought a ZIF flip cable, and that solved all my problems, as I expected it would. The BIOS recognized the 16G Sandisk Extreme III compact flash card, and the red led light on the card blinked instead of staying lit. All those were good signs that I could finally put away the slow 8G SSD.

The first order of business was then to make the CF adapter fit. I’ve seen various methods of installing the adapter, and they varied in what was cut away. Rather than cut a post, I chose to cut into the unneeded compartment. To do this, I used my dremel tool to cut a small slit into the side. I wasn’t trying to be very precise, and I was suprised that the height of the slit was exactly the same size as my adapter card. I had to widen the slit so that it’d fit, but that was easy. I also cut a small notch to clear the red led. I didn’t want the adapter to move around and bump the led. Finally, I glued a piece of plastic to the case to keep the adapter in place. It seems pretty solid now. I didn’t even have to add any padding to the top or bottom to keep it from rattling.

With the new card, the first thing I did was try to install the XP recovery disk. That went well, but that’ll be another post …

CF card, adapter, ZIF cable

Before cutting a horizontal slit

The adapter held in place with glued down plastic

Installed with motherboard on top

Boot menu

BIOS screen