Telerik grids: If your JavaScript fails, so will they.

I was using timer on my grid, similar to this demo, using the JavaScript functions RequestStart and RequestEnd to update a label.  The function retrieved the label using document.getElementById("LabelId").

It worked perfectly, until I redid the page as a web control.  *dramatic music*

This, if you are not aware, changes the id of the label to something like ControlId_LabelId.  Since the JavaScript functions are not called until the client does something like paging, grouping, etc. everything appeared to work fine while I was converting it to a control.  When I finally finished that and decided to do one last test, I discovered that paging had stopped working – it would just “hang” there, with the little loading graphic.  Couldn’t figure out why, simplified the backend, etc.

Finally, I noticed that the timing label wasn’t working… maybe my js functions were not working?  Oops!  The ID had changed, so I needed to fix that.  Since I couldn’t hard-code it (the control ID should be change-able) I ended up wrapping the label in a <div id="labelid"> and using document.getElementById("labelid").firstChild instead.  (Note that this isn’t an ideal solution, because it still limits you to one control per page, but it does work, and the nature of this particular control is such that you would only have one per page.)

Ta-da!  It worked.

Random notes from my first real ASP.NET web dev project

I’m doing my first ‘real’ ASP.NET project this summer at my internship.  ‘Real’ in this case meaning ‘from scratch and not based on modifying/copying/adapting existing code’.  I thought I knew a fair amount earlier, but there were some little things that I learned that may be of interest to others just starting out.  (I learned plenty of big things, too, but those deserve their own posts.)

#1 : Viewing the contents of a DLL in Visual Studio

(“Contents” meaning “list of functions and members, etc.”, not “code”.)  I was having issues finding this, maybe someone else was too?  Or maybe it’s just me…  Gotta learn it sometime, though!

– Use the object browser: Either press Ctrl-Alt-J or go to View > Object Browser.

– If your DLL is not listed, click the ‘…’ next to the Browse box.

– Select your DLL: Viola!  You can now browse the functions and whatnot.

#2 : make sure your application is, in fact, running as an application.

Yeah, this was a big “D’oh!” moment, but a critical lesson for me (at my on-campus job, somebody else had already set up the website so I never had reason to find this out).

My site was working fine for a while, until I tried to enable AJAX for my Telerik components.  Nothing worked.  I had the hardest time figuring out why – I even downloaded a working example, which promptly ‘broke’ on my machine.

Somehow I finally got the idea that perhaps  it had to be set up as an application.  Ok, easy enough:  I go into IIS, right-click on the folder, click “Convert to Application”, click “OK” on the dialog box.

It gave me a 503 error: the service is unavailable.  What?!  Turns out the problem was, I glibly clicked through with the default options – and the DefaultAppPool.  To fix this, I went into the advanced settings for the application and changed the Application Pool to “default” (the name of the website it was under).   Better yet – avoid the problem from the start by selecting the correct application pool when the dialog box pops up after you click “Convert to Application”.

#3 : If at first you don’t succeed… reload.

This is pretty basic, but don’t forget to clear the cache, especially when you’re dealing with CSS or JavaScript.  On numerous occasions I’ve hit F5 and gotten extremely frustrated at my perfect code not working – only to realize that the only problem was that the browser hadn’t reloaded the changed code.  The solution: make it a habit to use Ctrl-F5 when developing.  It reloads everything, including your fresh CSS and JavaScript files.

Similarly, I’ve had issues with SQL Developer giving me the error:

Errors for PROCEDURE my_proc:
LINE/COL ERROR
-------- -----------------------------------------------------------------
287/14   PLS-00103: Encountered the symbol "end-of-file" when expecting
         one of the following:
         ;         The symbol ";" was substituted for "end-of-file" to continue.

This frustrated me to no end, and I realized something was fishy when I was copied-and-pasted existing, valid procedures and got the same error.  It usually fixes itself if I restart SQL Developer.  But in reality, I usually end up using it for the syntax highlighting and browsing stored procedures, users, etc. (I have yet to find an easy way to list procedures for Oracle – MySQL wins [imo] in that arena) and just paste the code into SQL*Plus.

(Coincidentally, I have a batfile set up for that with my login, so I just have to type ‘ora’ and the prompt shows up.  It’s not laziness, it’s efficiency!)

first!!1!eleven!!!

Hey everyone!

Intro posts are overrated, so don’t put too much stock by this – I’m sure you’ll get a better idea of who I am by reading my forthcoming posts than from anything I could write specifically on the topic. If I think about this too much, I’m bound to misrepresent myself, for better or for worse.

First off, a disclaimer: I’m purposely keeping this anonymous, not telling my family/friends that I have started this blog, etc. Part of that is an experiment – how many people can I attract to this blog purely by virtue of its content, rather than having people read it to snoop on my life?  But the main reason is that I want the imagined freedom of being able to say what I want without having to worry about who I know is going to read it and ask me about it the next day. Now, to be sure, I’m not planning on saying anything particularly controversial, but it’s just that I change my mind about things and reconsider quite frequently. Also, some posts may be a bit personal, and you know how that is, yes?

Ok, good.

A little about me, now. I’ll be a junior this fall at a science and engineering-focused university, majoring in physics and minoring in astronomy and computer science. I love most of it – I can’t say I enjoy error analysis or probability distributions, but building circuits and AI programming can be great fun. All my jobs thus far have involved web programming – during the school year, I work on the campus library’s website, and during the summers I have an internship doing (surprise!) more programming. This year I am hoping to find a research job on campus to get some experience in physics, but I could write a whole post on that…  Anyhow, this isn’t meant to be a resume, but just to give you an idea about the things I might cover, the languages I’ve used include: Java, HTML, CSS, JavaScript, SQL (every variety, plus APEX), PHP, Python (and the Django framework!), ASP.NET (VB and C#)… Oh, and I want to learn C/C++, Ruby, Perl, and maybe Lisp.

Don’t freak out, now. I have non-nerdy interests as well: I like literature, logic, grammar, and thinking about justice, morals, and theology. (Ok, maybe that’s still a little nerdy.) I also like to read, draw / paint, sew, crotchet, knit, etc. (I’ve tried pretty much every craft I’ve heard of – the few I haven’t, I either plan to or have a good reason not to.) I’ll be posting pictures of things I’ve made, most likely, although once the school year starts up again I expect to be a little too busy, what with programming and physics labs, to make anything of consequence. You might get some sketches out of the margins of my notes, though.

In conclusion, this blog is mainly a repository for my thoughts that I deem of possible interest to you, dear reader. I make no claims nor promises on the contents or subjects thereof – in fact, I expect them to cover a wide variety of topics, as perhaps you may have gathered from above.

Thanks for reading and peace out, d00dz.