Javascript scope in for loops#

In JavaScript, you don't need to define your variables.  You can just up and use any variable as you see fit, like this:

asdfasdf = 'asdfasdf';

However, these variables will then be created in a global scope, which is bad.

I came across a bug today that involved for loops and globally undefined variables.  It's not as clear what is happening when the counter variable is first used inside the for declaration, but the result is the same: a global variable:

function test2() {
     for (i = 0; i < 10; i++) {
         alert(i);
         test3();
         alert('now i is ' + i);
     }
     alert('done');
 }

 function test3() {
     for (i = 0; i < 10; i++) {
         // do whatever here
     }
 }

In this example, test2()'s for loop will only run 1 time, because test3's loop ends up using the same variable.

To fix this problem you need to define your looping variables:

for (var i=0; i < 10; i++)

This is a best practice that you should remember to do.

Categories:
Thursday, February 18, 2010 9:44:03 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Comcast turns off your internet#

Last night, all of a sudden, my internet connection went down.

After a while, all my web requests started getting directed to a comcast page that said:

"You will need to activate your account"

telling me that I needed to download some software.  Total BS.

The link for the software didn't even work.  I tried rebooting the modem, the router, nothing worked.

So after an hour in a comcast support chat (using my EVDO card for internet) they finally added my modem back to their system (or whatever).

If you get this message, and you are not a new customer, either comcast f'ed up (which is likely because they are possibly the worst company on earth) or you didn't pay your bill.

Categories: Misc
Saturday, February 13, 2010 9:11:10 PM (Central Standard Time, UTC-06:00) #    Comments [2]  | 

 

Skype on Mac OSX#

My wife just tried to install Skype on her Mac OSX computer.  Of course it didn't work.  Nothing ever works on Macs it seems.

After lots of messing around I found some random suggestion on some forum to try this:

1. Quit Skype
2. Go to the folder “ ~/Library/Application Support/Skype/ “
3. Delete the file "shared.xml"
4. Start Skype

Amazingly, this worked.

Categories: Misc
Tuesday, February 09, 2010 2:31:38 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Disabling SSRS Subscriptions#

As far as I could find, there is no easy way to disable (not delete) an SQL Server Reporting Subscription.

We thought we had found a way to do this by changing the schedule to "run once" and set an "End Date" so that it would never run after that date.

This seemed to work, but after a restart of the server this weekend, the job executed on monday morning.

I'm not sure why it happened Monday morning ( as opposed to Sunday morning, as the machine was restarted on Saturday night) or if has anything to do with today being the first of the month, but either way, this didn't work and people were emailed some useless notice that they didn't need.

So, if you are using this method to disable your SSRS reports, watch out.

Categories:
Monday, February 01, 2010 10:58:04 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

All content © 2010, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: