AWG Blogs

Saturday, May 1, 2010

Replacing Form Action Scripts with sed

I needed to replace all form action scripts in all my XSLT templates, specifically to make the script relative to the current path. So I did:
find . -name "*.xsl" -type f -exec sed -i "s#\([\"|'|>]\)/index.php#\1index.php#g" {} \;
There are a few of things to notice about this command:

I used a double quote and not a single quote for the sed script namely because A single quote may not occur between single quotes, even when preceded by a backslash. *

The parenthesis required backslashes because sed apparently is not running in extended mode on my machine.

The argument to sed needs to be quoted to avoid being parsed by the bash shell interpreter. Aside the from the parenthesis the only other character needing escaping is the double quote in the regex. Even the \ don't need further escaping because a double quote string preserves the literal value of all characters except \, $, and `. The backslash has its special meaning only if followed by ", $, `, \, and newline. *http://answers.google.com/answers/threadview/id/496910.html

Friday, April 9, 2010

Use the User DSN When Debugging

Couldn't figure out why I kept getting "failed to call the odbc driver connection utility" when attempting to configure data tables in the DataSet designer in Visual Studio 2005 on a Windows 7 machine -- a duo that has incompatibility problems apparently.

I finally realized that the problem was that I had created a System DSN (like I always do) for the ODBC connection. I created a corresponding User DSN and it worked like a charm.

Friday, April 2, 2010

Virtual Host in Tomcat and NAT

Well, I didn't figure out how to separate the apps by port, but I did learn that it's possible to do so by IP -- by setting the name attribute in the Host tag of server.xml.

The problem appeared however when I attempted to port forward port 80 to the second host entry in the m0n0wall NAT configuration. Browsing to the site from outside the firewall kept bringing me back to the first host entry which by default was set to localhost. That will never do, because I don't want external users seeing the Tomcat management page or welcome page for that matter. That was the whole point of creating a separate app in a separate location on the hard drive (which was done by the way via setting the docBase attribute of the Context tag which goes under the Host tag. I was creating an Open Blue Dragon or openbd application and I didn't want it sitting under the default webapps virtual host.

I solved the problem by simply setting my new app, the second host in server.xml, to localhost, and assigning the default app a second IP (from a second NIC) for management purposes. I'm not sure why or how, but this fixed the problem. I can now access my ColdFusion web app from outside the firewall through port forwarding. And the managment app is only visible from the server itself.

Thursday, April 1, 2010

Don't forget the Share Permissions...

I was getting errors when attempting to access a Visual Source Safe DB configured as a share from the network:

error: Microsoft Visual SourceSafe
Unable to open user login file ....user.log

I thought how could this be, my computer user account is in the Administrator's group. I even tried copying a file to the ...data\loggedin folder, and got this error:

Destination Folder Access Denied
You need permission to perform this action

Silly me. The sharing permissions were not set up correctly.

To fix, open sharing on the VSS DB folder. Click Permissions. Add the Users group, and assign Full Control.

Tuesday, March 30, 2010

MIssing BIN DLLs from VS Website References

If you are ever in the predicament where after copying over a Visual Studio 2005 website to another machine and are not finished working out the dependencies, here's a tip: Make sure all the assemblies listed in the "add assembly" tags in the web.config can be found on the current machine first, or else none of the Bin folder DLLs will be added as references, no matter how hard you try.

I ran into this problem, and Visual Studio 2005 refused to add the Bin folder references, until those web.config assemblies had their match in the GAC. Go figure!

Tuesday, March 16, 2010

MyEDB SQL One Liner

In this case the use case is to reduce the quantity of each product variation ("ron" in myedb speak), i.e. items in a shopping cart, when the total transaction is finalized. The following code can be placed in a transaction inside a MySQL 5.x stored procedure:


update property natural join int_prop natural join entity_property natural join entity
inner join medb_transaction on entity.eid = medb_transaction.eiddst and entity_property.ron = medb_transaction.ron
and property.prop_group_id = medb_transaction.prop_group_id
set int_val = int_val - qty
where medb_transaction.eidsrc = 8 and property.prop_id = 15

The prop_id 15 is the ID of the 'quantity' property. eidsrc is passed as a parameter to the stored procedure and represents the user id (or "eid" for entity id in myedb speak ;) ).

Wednesday, March 10, 2010

New myedb.com Domain for Framework

My first post to describe my MyEDB (My Entity Database) framework/CMS was placed on a holding site at netfirms:

This is my stand-in site to promote my concept of an "Entity Database" which is more than a relational database -- it gives the DB designer more flexibility in setting up and tearing down entities. I call it and the supporting code framework MyEDB for My Entity DB.



It does away with the traditional notion of entity relationships, and just focuses on pure entities, no relationships and the headaches they cause Database designers. The purpose for relationships has evolved from an ingenuous desire to model entities and their relationships into being merely an optimization device. My framework gets rid of the pretense. All optimization is stored natively through the use of single type tables.

One added benefit of this static architecture is that of being essentially a low level database per se, but one that is accessible to database designers.

Combine this with an elegant PHP-based RESTful MVC framework, and all that's left is defining inputs and outputs and coding them. And the effort of coding the input/output wire-ups simply scales to the level of your requirements -- i.e. pay per requirement.
Requirements can be defined as any of the following:
- Create a form for Inserting, updating, or deleting an entity (e.g. a customer record)
- Create a new view of the entity, purely for display (e.g. a product, or any entity. Examine one of your Excel spreadsheets rows for examples of "entities")
- Build search functionality for all your entities or only a subset



Copyright 2010