Saturday, October 24, 2009

After Basic

Well so far AIT has been mildly dissapointing. They are so overbooked with recruits that we are put on waiting lists for months.

I am able to talk to my wife each day on the cell phone which really helps. She has shipped me a laptop which should arrive in about a week which we should be able to do video chat on, that will be nice. We are hoping to have her move down here right after Christmas vacation.

Friday, October 16, 2009

Graduating Basic


Well basic was definitely an experience. Physically it wasn't too much of a challenge given my country upbringing; but I missed my family a lot and wasn't allowed hardly any contact with them. I am looking forward to AIT with apprehension, we'll see how much freedom I have, I'm hoping for the best and planning for the worst. I really miss computers and hope I have access to them both for programming and contacting my family.

I took this photo for my wife, it's not my standard uniform, but I really like having something I can go on a nice date in now.

Monday, July 13, 2009

Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function.

I have run into a very interesting and very frustrating problem with Sql Server.
So far my experimenting points to a bug in sql server, though I wish it was something I was doing wrong.

I have created a scalar-valued function that uses a table variable. According to microsoft's msdn and several other sites doing inserts, updates, and deletes on local table variables in user functions is very valid.

In my case I was able to get Inserts and Deletes to work, but am having all sorts of issues with the Update statement. I copied microsofts example one and that executed fine, so then I started replacing pieces of their code with my own and saving/executing until it was a duplicate of my original function. At this point I assumed something must have been cached incorrectly in my original query window.

However, I needed to add a second update statement to the function and while the first one still works the second one won't take. So after messing with it for a bit I once again executed the microsoft example and bit by bit copied each piece of my sproc over replacing their code; and what do you know it worked again.

The only difference I can see is that their update statements are inside of a While loop, so it is still a bug in sql server, but I might be getting a little closer to a better work around.

Update: Looks like it might have been my problem after all, which is wonderful. I was using square brackets around my table variables; on a co-workers suggestion I removed those and my queries started working.

I'm guessing that all I was doing before was figuring out a way to bypass the query parser as can often happen in large stored procedures.

Wednesday, June 24, 2009

salesforce insufficient privileges on custom page

I recently created a new custom apex page in SalesForce. It worked fine as an administrator but regular users were unable to find it.
All of the solutions I found assumed someone was pretty familiar with navigating the SFDC admin area so I figured I would give the path where the answer is located.

The page that helped me the most is here.

  1. Login as an administrator
  2. Click on the 'Setup' link on the left of the upper right hand side
  3. Under 'Administration Setup' in the left hand column, expand the 'Manage Users' list
  4. Click on 'Profiles'
  5. Click on the NAME of the profile you want to give permissions to ( under the Users area you can see what profile your users are assigned to )
  6. Scroll to the bottom of the page
  7. Click on the 'Edit' button for the 'Enabled Apex Class Access' area
  8. Move your new class into the enabled list and click the 'Save' button
  9. Scroll to the bottom of the page again.
  10. Click on the 'Edit' button for the 'Enabled Visualforce Page Access' area
  11. Move your new page into the enabled list and click the 'Save' button

That should be it, anyone in that profile should now be able to see the new page.

Wednesday, June 17, 2009

Cross Apply Incorrect syntax near '.'

I recently ran into an issue that had me puzzled for a bit.
I was using the new Cross Apply functionality in SQL 2005 and was getting the error:

Incorrect syntax near '.'

I checked and rechecked my syntax but couldn't figure out what I had done wrong.
After doing some googling I came accross this sqlteam post in which another poor guy had worked through the same issue.
He ended up figuring out that Cross Apply didn't work when the database was set to sql 2000 compatibility. It makes sense, though it might have been nice to get a more clear error message.

Armed with that information I looked up the code to change the db compatibility level, and what do you know my problem was solved.

Here is the code copied from the link above:
----SQL Server 2005 database compatible level to SQL Server 2000
EXEC sp_dbcmptlevel AdventureWorks, 80;
GO
----SQL Server 2000 database compatible level to SQL Server 2005
EXEC sp_dbcmptlevel AdventureWorks, 90;
GO

Monday, June 8, 2009

Colorado Technical University

I was recently reading on military.com and discovered that Colorado Technical University was one of their recommended colledges.
It seemed they favored CTU because the college not only had higher education courses and has a great distance educational program but also because the school takes special care to tailor itself to the service man/woman's needs. For example they allow the service member to put their education on temporary hold if they get deployed.


Getting such praise from the military is great for me since that just happens to be the college I graduated from. Now that I have joined the U.S. Army, when I want to continue my education I won't have any issue transfering education since they already have all my records.

Web Resource but no Embedded Resource

I was having a major problem trying to get an embedded javascript file registered.
The issue started because I was trying to port over Raj Kaimal's ( http://weblogs.asp.net/rajbk/ ) GridView client side reordering extender to the Data Grid. Since both controls are very similar the work wasn't difficult, however I was getting hung up trying to stick the .js file in my backend dll.

Searching google it seemed as though a lot of people got hung up in this area. I finally stumbed on Lee's post which directed me to Damian's blog

While niether of those posts directly solved my issue, Damian gave me the idea of using a reflector to see what the .NET view of my dll looked like. From that and a little luck I discovered that the proper syntax was:
[assembly: System.Web.UI.WebResource("[default namespace].[folder].[file name].js", "text/javascript")]

then for the script reference:
new ScriptReference("[default namespace].[folder].[file name].js", "[assembly name]");

most people keep the default namespace and the assembly name the same which makes things simpler but fosters a lot of confusion as to what the various parameters are really looking for.