While working in PHP I found the need to fill an array with new objects on the fly. So at first I tried the array_fill function that worked fine for values but when I tried an object I found it was the same object in every position meaning if I modified one they all changed. What I needed was a new object in each. The easiest way I found to do that was a for loop.
The following doesn’t work correctly
So to accomplish the same idea I did the following
I was working with a CMS and found that one file was not downloading correctly people were saying that the file was being zipped up by the CMS. Well it turns out it was the issue with IE6 and a bad MIME Type. The fix is simple for pptx you need the mime type application/vnd.openxmlformats-officedocument.presentationml.presentation once that was added everything was working correctly. With out this a PPTX file will download as a zip.
A few links on the subject:
We were trying to trim white space from a column that had some newlines. The problem was the oracle trim() was only removing spaces. We found that we had to do two Replace operations Replace(col,char(10),”) and Replace(col,char(13),”) one for linefeed and one for newline. I switch between many Languages and I found it annoying I couldn’t use \n or \r but all well I don’t use Oracle that often.
I have a web page that needs to go through a bootstrap step in order to make all the correct Ajax calls. So I was simply looping through the results and making the Ajax call like the following. You will note that I needed to pass a name to the processing of the data returned but my first attempt was not working.
That code was not working correctly as all the names were coming up as the last one in the loop. And thinking more about it that makes perfect sense. The problem is when the success function fires it looks back to the Activation Record which contains campus_name which has been modified by the loop. So what I need to do to fix it was simply move the Ajax call to a function so an AR would be created for each call allowing me to use the campus_name variable correctly.
Working with a fixed height and width table I found a problem where rows were expanding too much I needed each row to only grow in height enough to contain the text and not fill the rest of the table. The number of rows was dynamic but the height fixed. The hack is simple add a height to each row of 1px which will make it so the rows only grow enough to contain your text then add a last row to act as a buffer with no height. Below the fold I have examples.
While working in Silverlight I ran across a error that seemed rather odd, not because it didn’t make sense but that I couldn’t see anything I did wrong. So the error was
Unhandled Error in Silverlight 2 Application App.xap
While checking the Image tag in the xaml I simply couldn’t find anything wrong with it. It looked very similar to the following xaml. The user.profile_image was of course a full URI that worked fine when written directly in the browser.
So that leaves me with what could the problem be, well it turned out it was simple I was a using a GIF file so http://mydomain.com/foo.gif as a source for an image simply doesn’t work as GIF isn’t supported. But really why would Silverlight not use GIF? Well simply converting the GIF to a PNG then Silverlight can handle the image just fine and display it. Although there are some issues as in Silverlight the only 8 bit and fewer PNG formats support transparency. So if the reason you were using a GIF was for transparency you will have to create an 8 bit or lower PNG. Look for a simple how to next post on converting a GIF to a PNG that Silverlight can display properly with transparency.
While deploying a Java based auto import system I ran into a very odd problem. The code was developed and tested just fine with Connector/J 5.1.6 then while pushing to prod there seemed to be a major issue, the import would run download everything parse it and then clear out the old data but then get stuck. I would then get a series of errors java.sql.SQLException: !Statement.GeneratedKeysNotRequested! well it turned out that the prod sever had Connector/J 5.1.7 installed instead of the 5.1.6 which test had installed. This turned out to be allowing for some wrong practices when it came to prepared statements. It was a pretty easy fix yet it took a bit of time to make sure it happened every where. So why there was a change and what happened is well discussed else where and the links to those will follow. But for now here the change that needs to happen.
Just changes to the following. But make sure you do the change for all prepared statements that will use generated keys, its easy to miss one and have the whole app fail because of it.
So if you would like to read more about whats going on check out these resources:
While working on in Silverlight I found the need to auto populate a TextBox then shift focus to that TextBox. That was simple to do with the following code.
But then there is a problem the cursor is at the start of the text box so if a user starts typing they end up adding to the start when I want them to just add on to the end. So after some hunting I found the SelectionStart property of the TextBox, while this may be obvious to people who work in Silverlight and C# all the time it didn’t jump right out at me so I thought it was worth talking about. So by using SelectionStart and I can move the cursor to the end and users can just append to my started search text.
After seeing this great post from Jamie Thingelstad about using subdomains to redirect people to your LinkedIn or Twitter profile I thought it would be great to add that to my site.
But it was a big process that it shouldn’t have been. I found it very hard to actually find where in the my Go Daddy hosting where to put the subdomain. So if you are doing hosting with Go Daddy and have used their subdomains tied to a folder you have to goto a completely different section to do this type of redirect. It’s in the domain management which one would expect but I look right past the correct section at least a half dozen times, so below there is a picture below the fold with a red box showing exactly where to add the subdomains.
The process is simple once you find the correct section. Simply click add then fill out the “subdomain” and “forward to” fields as an example I did “subdomain”: twitter and “forward to”: http://twitter.com/beckje01 Those simple steps have now set up http://twitter.jeffbeck.info to link to my twitter account.
[![Add to Del.icio.us]] [![Add to Facebook]] [![Add to LinkedIn]] [![Add to reddit]] [![Add to Twitter]]
While using the YUI Library, I came across an annoying issue. It is stated places that order matters when dealing with the library includes, yet there are still some issues that come up. The main one I’ve found is with the YAHOO.util.ScriptNodeDataSource this is used for accessing remote data via the YUI Get Utility. But using the configuration from Yahoo the Get library isn’t included by default, yet when you add it after finding that error the system still won’t work.
The Get Utility has to be loaded before the DataSource library, yet this is the only part of the DataSource library that require the Get utility so it isn’t listed as a dependency for that library. I used the YUI Dependency Configurator yet while working without the combined files you can still introduce the ordering issue. Yahoo needs to add a simple check that the Get utility is always loaded before the DataSource Utility yet that haven’t yet. You may not have this issue while using the combined files mode as it will all be executed at once.
So if you see an error message like “this.getUtility is undefined” make sure you have the Get Utility loaded before the DataSource.