jQuery: $.ajax is not a function

April 20th, 2009

When upgrading to a new version of our Learning Management System (LMS) written in Java, I found that our custom JavaScript code had broken when attempting to use the $.ajax function in jQuery to call my ASP.NET web service. Due to the complexity of how this vendor handles the compilation of front end model-view-controller (MVC) pages, I thought that they might be loading my three JavaScript files in parallel to speed up front-end load times.

$.ajax is not a function

It turns out that even my $.timer function was broken also, so did some research and tried using jQuery.ajax() and jQuery.timer() instead of the shortcut notation.

By default, jQuery uses “$” as a shortcut for “jQuery”

This default name for calling jQuery functions resolved my issue. To confirm, I added “$” to the Firebug watch window and it was indeed an object owned by Prototype.

In addition, jQuery recommends calling jQuery.noConflict() to return the “$” to the original library. This will force you to use jQuery(”div doStuff”) with everything. Alternatively, I could use:  var $j = jQuery.noConflict() and then use $j.Ajax().

Using jQuery with Other Libraries:
http://docs.jquery.com/Using_jQuery_with_Other_Libraries

jQuery & Scriptaculous Issues:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:288874

Writing & Speaking Skills

March 24th, 2009

This article on How to Write Fast Code hit Reddit and Hacker News today. The key point is make the CPU do less, not more, in order to write code that performs faster.

This same advice applies to how we speak and write, especially in our professional lives. When writing emails and speaking in a meeting, try to provide the most useful and pursuasive information in as little words as possible. This will improve communication, save time and help your listening skills.

T-Mobile Lost Rebate

March 15th, 2009

There are a number of people who had problems with T-Mobile rebates, as indicated in this article and it’s comments.

I bought my wife a Blackberry Curve in late December 2008, and sent in all required forms to a P.O. Box as indicated by the rebate process.
After waiting exactly 6 weeks, I started checking tmobilerebates.com on a weekly basis until about week 10.

I then decided to call up the T-Mobile rebate center and talk to a representative. I calmly explained my position, and how I patiently have waited about 10 weeks to hear about the status of my rebate. The representative was nice and attempted to lookup the status (of the rebate) by asking me the same questions as tmobilerebates.com. After finding no results on my rebate status, she put me on hold for about 5 minutes. When she came back, she told me that she had spoken with a Customer Care representative with T-Mobile. She then went on to say that they confirmed my records of purchasing a new Blackberry and that they had credited my account for the $100 that was owed to me.

I would speculate that either T-Mobile has ongoing issues with their rebate process or they took a look at my account and did not want to piss me off considering I’m a loyalty customer (2+ years) with a family plan of 4 phone lines.

Extending Enterprise Applications

February 25th, 2009

I support a learning management system (LMS) at our company. It is a vendor web application written in Java running on JBoss, and we have many customizations specific to our company’s implementation.

This recent article as well as this one gave me the idea to write this post. I am with the mindset that believes there are no crappy uninteresting problems. There are only crappy uninteresting bosses.

We are in the middle of a project in which we are upgrading to the vendor’s latest version, 5.4, and we are officially taking over the Java development of our specific customizations. We are given the source code for only our customizations, but we have to rely on the vendor’s API documentation which includes a sample “Hello World” app and sample ANT build script. We don’t have the source code for the core LMS, so we use JAD to decompile the vendor’s application when we need to better understand things.

We have a few EJB classes customized by the vendor that need to be recompiled utilizing an Eclipse user library containing the various jar files of the new version (5.4) of the vendor application.

Things started to get tricky. One of our EJBs, lets call it CustomInstructorEJB.java, does not compile.

What they originally did was completely copy their original EJB, lets call it InstructorEJB.java, and renamed it CustomInstructorEJB.java. They added some customizations to CustomInstructorEJB.java and threw it in the customization.jar (where custom code is kept). Their original InstructorEJB.class is still in the application jar file.

We were unable to compile our CustomInstructorEJB.java with the new 5.4 product because of changes in the Bean interface in the new version. We got some interface mismatch errors or something (I need to ask my coworker). We soon learned, as .NET developers learning the way through J2EE, that EJBs classes are mapped in ejb-jar.xml deployment descriptor.

To resolve the issue, we did what the Enterprise Vendor should have done in the first place, which is to have the CustomInstructorEJB class extend (inherit) from the original InstructorEJB class. We did the following:

  • Map CustomInstructorEJB as the in ejb-jar.xml while leaving the <home> and <remote> interfaces be the out-of-box InstructorBeanHome and InstructorBean interfaces
  • Did a DIFF on CustomInstructorEJB (version 5.3) with the InstructorEJB (version 5.3) to determine 2 customized functions for our company
  • Wiped out all code in CustomInstructorEJB, except the 2 functions that are customized
  • Made CustomInstructorEJB extend from InstructorEJB
  • Did a DIFF on CustomInstructorEJB with the new InstructorEJB (5.4) to determine if our customized functions have additional new enhancements in the upgraded version

This almost worked. This is where enterprise software sucks, oops I mean, where enterprise software presents… a challenge.

The vendor made wide use of private functions instead of protected. Therefore, our customized function X() made calls to private functions p1() and p2(). Since private functions in InstructorEJB are not accessible from our extended class CustomInstructorEJB, we decompiled InstructorEJB and copied the necessary private p1() and p2() functions into CustomInstructorEJB.

In an ideal world, the vendor would have made all of the internal functions protected instead of private. And when customizing an EJB for a client, the vendor could have made use of inheritance to provide custom middle-tier functionality on top of their original EJB.

IT at Intel

February 4th, 2009

My department sent out an email with the 2008 Intel Annual Report (public information) and encouraged us to talk about it when speaking to people outside of Intel.

intel_it_data_traffic.PNG

I’m not going to be negative and post rants about my employeer or my employer’s clients, such as this guy. I’d rather share how being an application developer in a corporate IT does not always suck. Besides, now is probably not the best time to talk negative about an employer, especially when said employer is in good fiscal health, needs no government bailout, and has taken proactive measures to trim cost ahead of the economic downturn.

Some of the highlights in the annual report relate to my involvment, such as working on several large projects for our Learning Management System (LMS), which happens to have one of Intel’s highest internal user-base.

“Provided 220,000 courses to Intel employees, suprassing 95% compliance for information security and privacy courses for the third consecutive year.”…
“Intel ranked among the top three most secure companies for employee behavior in an independent survey.”

For a large upgrade project, my coworker setup a development and test environment almost instantly with no additional hardware in our pre-production environment thanks to Development on Demand (DoD).

“Intel developers and employees in labs often need new test and development systems for specific projects. Traditionally, this has often meant purchasing dedicated hardware, even if it used only for a short time to run a set of tests. To address this, we created Development on Demand (DoD), which allows developers to rapidly create virtual development environments hosted on existing servers. After a developer submits a request, it typically takes only 10 minutes to create a virtual machine (VM).”

On a final note, I also have opportunities for diversification in various technologies since we support a wide variety of custom built and vendor applications. I currently support and develop on Visual Studio 2005 .NET apps and Eclipse 3.4 for JBoss apps.

.NET and 64-bit

June 27th, 2007

If you are moving from 32-bit to Windows 2003 x64, you may find yourself wondering which regasm.exe to use or what the differences are between c:\windows\microsoft.net\framework and c:\windows\microsoft\framework64.

64-bit Windows supports existing 32-bit code using the Windows-on-Windows 64 (WOW64). Heath Stewarts’ Blog does a good job describing the .NET Framework support for 64-bit.

If you need to support legacy or .NET 1.1 applications in IIS, you can enable 32-bit worker processes in IIS by changing a metabase property called Enable32BitAppOnWin64. KB article 894435 describes how to do this, but beware that IIS 6.0 does not support running both modes at the same time. You will need to install the script maps for the appropriate 32-bit or 64-bit version.

It’s also worth noting that running VBS scripts at the command prompt (to troubleshoot legacy ASP/COM code) requires the use of the 32-bit or the 64-bit version of cscript.exe. If you use the wrong one, you may find yourself getting “provider not found” errors when using the Oracle driver - ORAOLEDB.Oracle.1.

32-bit System Root:%SystemRoot%\sysWOW64

32-bit Registry Hive: HKLM\Software\Wow6432Node

64-bit System Root: %SystemRoot%\system32

64-bit Registry Hive: HKLM\Software

Life At Intel: Response to ‘Life At Google-A Microsoft Perspective’

June 27th, 2007

The article about comparing a developer’s life at Google compared to Microsoft caught my interest. I joined Intel as a software developer straight out of college a little over 2 years ago. I work in the Folsom campus which is in the Sacramento area. Reading about Google’s culture catches my interest, except that I don’t really want to live in the Bay Area again (I graduated high school in Pleasanton).

Intel is probably a lot more like Microsoft for software developers. I work in IT supporting existing web applications and writing new ones for HR. All the things you read about working at Intel, the good things at least, are true. The culture is very A-type personality, with many meetings, small greyish blue cubicles and positive focus on career development. The pay has been good considering bonuses, awards and on-call pay. I made $10k more than my base salary last year and I am on track to do the same this year. We don’t get anything for free such as CPUs, food, banners, posters or t-shirts, although I do have a free t-shirt for community involvement.

Here is my Intel perspective…responses to some of the questions to the Google employee:

1. What is the culture really like? How many hours are people actually working? What are the least amount of hours you can work before you are looked down upon?

Many people work very long hours, but some people take advantage of Intel’s policy on work-life balance. In my experience, Intel does a great job of awarding and promoting based on accomplishments. On the other hand, I am on my 4th manager in 2 years and all 4 have liked me. My managers are the opposite of micro-managers and I rarely see them.
Intel did not make it on the Top 100 Companies to Work For this year, but it has in the past.

3. What are the office arrangements like? Do you have an office or cube space?

See Conan’s visit to Intel Headquarters in Santa Clara. In Folsom, my cubicle is big enough to roll my chair in and out and that’s it. Folsom, Santa Clara and Chandler, Arizona all have the same color cubicle walls, it’s disgusting. The CEO even has a cube, except it’s much larger.

4. What is the management structure like (hierarchy)?

Intel is nowhere near like Google. Intel strives to have about 10 direct reports for each manager. At one point, our CIO John Johnson (we call him JJ) was about 30,000 feet in relation to how many managers he was away from me. Intel has recently gone through some downsizing in order to become a more ‘agile‘ company.

5. Do they actually have plans for career development?

Yes they do. There are all sorts of career development resources, but it’s ultimately up to the employee to talk with his/her manager about it.

Employee/Manager frequent one-on-one meetings are engrained in our culture. Check out How Intel Grooms Its Leaders The succession formula is downright revolutionary: It picks CEOs years in advance, without drama or surprise.

6. Who would you recommend Google Intel to? Is it for the college kid or family type, worker bee or innovator?

Intel is definitely a great company to work for if you love the work you do, as long as you are not in support. My coworkers, recent college graduates from University of Arizona and Virginia Tech, generally like their job and are satisfied with management, but they are moving on to pursue post-graduate degrees.

For a recent college graduate, the experience I have gained working on enterprise level applications and learning from senior developers/architects has been tremendous. Test Driven Development, Agile, and Rails are not part of the culture in my department, but some of us are beginning to change that. If you want to do C++, .NET, Java or SAP then Intel is the right place. If you want to create new and exciting web apps, then you should look at Google or startups.

How about a SQL 2005 Dyanamic Mgmt View to help troubleshoot long running queries

June 26th, 2007

It’s been a while since my last post. I have been working on a new vanilla app called Saba, a learning content management system (LCMS) based on Java. Reverse engineering enterprise web app SQL queries is starting to become fun….

In SQL Server 2005, use this Dynamic Management View (DMV) to watch a SPIDs wait times, wait types, sql text, etc based on your database id:

– CURRENT REQUESTS, WAIT TYPE, & QUERY TEXT
select wait_time as ‘wait time’, wait_type as ‘wait type’,
SQLText = (SELECT Text FROM sys.dm_exec_sql_text(er.sql_handle)),*
FROM sys.dm_exec_requests er JOIN sys.dm_exec_sessions es ON er.session_id = es.session_id and database_id=41

Loading this assembly would produce a different grant set

April 25th, 2007

PROBLEM: when debugging a .NET 2.0 web application on Windows XP and IIS 5, you get the following error:

ERROR:
Exception type: FileLoadException
Exception message: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0×80131401)

RESOLUTION: iisreset fixes the problem

CAUSE: unknown - temporary asp.net files not being cleaned?

COMException - SourceSafeTypeLib.VSSDatabaseClass

April 25th, 2007

I use the following code to make a connection to VSS:

SourceSafeTypeLib.VSSDatabase ssDB = new SourceSafeTypeLib.VSSDatabase();
ssDB.Open(vssServerPath, vssUserName, “”);

Here are some exception details of the runtime error:

((SourceSafeTypeLib.VSSDatabaseClass)(ssDB)).Users’ threw an exception of type System.Runtime.InteropServices.COMException’
{”The SourceSafe database path migtool does not exist. Please select another database.”}
ErrorCode -2147167977
HelpLink “ssusexp.hlp#12009″

A temporary workaround to this problem was to use <identity impersonate=”true”> in my web.config so that the web application and business object dll run as my user account instead of the ASPNET user in Windows XP.

The ideal solution would be to deploy the business object assembly in a COM+ application running under different user credentials, but I am removing this code this week and switching to Team Foundation Source Control.

Additional information about this problem can be found at:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=62249&SiteID=1
http://blogs.msdn.com/korbyp/archive/2003/06/24/54033.aspx