On a daily basis I have my websites backed up and send the tarball via ftp to my local machine. I was interested in automatically copying those files to an external hard drive. I found a simple way to do this using an instance of ColdFusion Directory Watcher Gateway. One could write a component that scans the directory and looks for differences between that and the archive directory on the external drive and copy any changed or added files and run that as a scheduled task. It is far easier to use a gateway instance rather than reinvent the wheel.
Quite often I find it useful to have a ColdFusion object which reflects the data in the row of a query or database table.
I have a written a generator to accomplish this. Please note that this is CF 9 specific. But wait, you say, CF 9 has ORM built in why not just use that. There are two limitations of Hibernate as implemented in CF 9 which rule it out for my use. 1)It is limited to a single datasource and 2) it will not work on an arbitrary query.
We have an application for which different clients have different datasources. The database schema is the same for each client but the database instance, and hence datasource is different.
Also, we often move data returned by a query around the application and to the client side to be used by jQuery. It is much easier to use an object for this than using queries directly.
I have recently been tasked with unifying the look and feel of a large application. The application makes use of the jQuery dialog for notifications as ajax operations process but there are a large number of places where the application uses OS alerts and confirms.
You cannot just replace these calls with a dialog because displaying the dialog does not stop downstream processing like alerts and confirms do. In the alert case this is usually not important unless you have code like:
alert("Sending you to google"); location.href="http://www.google.com";
In the above case you will go toodling off to google before the replacement for the alert has been dismissed. Fortunately in our application this use case doesn't occur so replacing the alert with a dialog works fine.
I decided to try something different and make soup but roast the cauliflower first.
2 slices bacon
1 onion diced
1 cauliflower cut into individual florets.
1 potato diced
1 head garlic
2 qts chicken stock
salt and pepper
What have I chosen is to add attributes to the DOM elements where the letters are displayed so the event handlers have all the information necessary without looking it up:
I was having an issue with an ajax call failing. Of course I thought there was something wrong in the cfc so I added a few more trace statements which didn't help. I finally decided to examine the stacktrace and it pointed (eventually) to the line where the trace occured. I removed that trace and the exception moved to the next trace line. I know I may be in the slow group but I see a pattern here. After removing all the trace statements the code worked fine.
It is a bit ironic that one's first impulse is to add some trace statements to troubleshoot which only exacerbates the problem!
I have an application that uses value objects. In order to avoid public instance variables we use cfproperty tags to determine instance variables. When you extend the value object the property tags are not inherited.
To circumvent this what I have done is create an array in the variables scope:
In the value objects init method I grab the properties using
I then check for the existence of variables['objprops'] and if it doesn't exist create it as an empty array.
I loop through the array (props) and append them to variables['objprops'].
Since a subclass may override a property in the parent class I replace rather than append if a property of the same name exists in the array. Since the init method of the parent class is called first this effectively overrides property in the parent class.
We use the onMissingMethod function to create implicit setters and getters but that is a topic for another post.
I had a bit of the hazelnut raisin bread left that was starting to go stale so I decided to make bread pudding.
The quantities of ingredients aren't critical. As long as there is enough liquid to cover the bread it is going to wind up being bread pudding. Also the flavoring ingredients can be altered to suit your palate.
- 3 or four slices of stale bread cut into chunks
- 1 cup milk
- 2 lightly beaten eggs
- 1/4 cup sugar
- orange zest
- 1/2 tsp cinnamon
- 1/8 tsp freshly ground nutmeg
- 1/4 cup sweetened coconut
- 1/4 cup chokecherry syrup (any fruit flavored syrup should work)
I made an interesting bread over the weekend and thought I would share the recipe. I weigh the flours and liquids so some conversion will be necessary if you use volume measurements: 1 Cup of bread flour is about 130 gm and 10 oz of water is about 300 gm.
- 500 gm bread flour
- 300 gm water room temp
- toasted and chopped hazelnuts. The amount depends on how nutty you want it.
- raisins. Again quantity is your choice. I soaked them in Ouzo but water would work ok also
- 1 tsp salt
- 1 Tbs honey
- 2 tsp yeast. about 1 pkg
- unsalted butter to brush on top