Friday, December 27, 2013

LinkButton OnClick Not Firing After OnClientClick

I worked around an oddball problem where the OnClick event of an ASP LinkButton would not fire following execution of some JavaScript tied to its OnClientClick.

The intent is to enable a row in a Telerik RadGrid to be removed by clicking the corresponding button in the row, and more specifically have a modal confirmation dialog appear to prompt the user to confirm their choice.

Here's markup for the GridTemplateColumn containing the button:
<telerik:GridTemplateColumn HeaderText="Remove" UniqueName="Remove" 
  FilterControlWidth="20">
    <ItemTemplate>
        <div style="cursor: hand;">
            <asp:LinkButton runat="server" ID="_RemoveItem" 
                Name="_RemoveItem" Text=" X " Font-Underline="False" 
                ForeColor="DarkBlue" 
                OnClientClick="confirmAspButton(this, 'Are you sure?'); return false;"
                OnClick="RemoveItemButtonClick" 
                style="font-weight:bold;color:red;">
            </asp:LinkButton>
        </div>
    </ItemTemplate>
    <HeaderStyle Width="55"></HeaderStyle>
</telerik:GridTemplateColumn>

The confirmAspButton function is a little JavaScript which is bound to the OnClientClick method of the LinkButton. If the user clicks OK, the confirmation passes and a postback will occur to execute the code beneath the OnClick method, whereas if they click Cancel the dialog will simply disappear.
     function confirmAspButton(button, message) 
     {
          function aspButtonCallbackFn(arg) 
          {
             if (arg) 
             {
                  window.__doPostBack(button.name, "");
             }
          }
            
          window.radconfirm(message, aspButtonCallbackFn, 330, 120, null, "Confirm");
     }


Seems simple enough, yet for some odd reason, in Internet Explorer 10, the LinkButton brought up the dialog just fine, and although the Cancel button click performed as expected, clicking OK had the same effect as cancel and merely cleared the dialog without executing the underlying code.

I managed to find a workaround via StackOverflow which suggests using a Button rather than a LinkButton. Sure enough, this did the trick, for whatever oddball reason whose particulars I could care less to dive into...




Friday, November 8, 2013

Tuesday, October 1, 2013

Repost!

Occasionally I post links to various content on Reddit. Often, a diligent member of the internet's police force informs me that somehow a given image or link has *gasp* already been posted somewhere else on the internet.


"Repost!"

O NOES! Holy Jar Jar Binks' prolapsed rectum, internet police! 

What many who post this don't seem to realize is that a) their message is pointless, and b) Reddit's popularity is all about the pageviews

Reddit lives for pageviews. Billions of them, and of those millions are by unique visitors. Some of those visitors are smart, some aren't, and a few are dumb as a sack of hammers. That said, if Reddit were something like a think tank (which it isn't) or a Wikipedia-like foundation (nope) instead of a for-profit company, a self-proclaimed “part-sibling-once-removed” of Condé Nast, Inc., it might do things smarter than it does now.



Putting aside respect for the massive popularity of Reddit and the hard work its staff and board and communities provide, Reddit the site isn't that bright when it comes to sniffing out content that's already been posted. 


There is the somewhat anemic search functionality, which conscientious users occasionally invoke to perform keyword searches in search of existing content, and there are third-party sites like KarmaDecay which provide reverse image search capability for specific subreddits or site-wide. However, note that there is no smart search capability exposed to the users which is savvy to detect whether a given link ultimate leads to something that's been posted before.

Granted, they are in the red. Running a site as popular as Reddit is a huge undertaking, and the infrastructure required to support it increases with its popularity. Even if such smart search were a high priority, investing in its development would bleed resources from their daily operations. 

If anything, users of Reddit who cry "repost" should realize that they're doing more to hurt the site than they are to help it. Comments on Reddit can be upvoted and downvoted, which requires processing power and bandwidth. The loading and rendering those comments also takes power. Worse than the fact that telling someone they've reposted something adds nothing of substance to a discussion about the content in question, it's wasting Reddit's resources.

If content is worthy of being reposted, it often generates some constructive discussion, particularly to those for whom it's a novel find that have never, ever, seen it before. Engaging good content rather than whining about that already seen seems far more worthy of Reddit's dedication to community than its users chiding submitters of content one word at a time.



tl;dr: Repost police, get over yourselves and do something useful for a change.



Wednesday, July 10, 2013

Ender's Game

Orson Scott Card sure is a classy guy.

Long known for his staunch advocacy against homosexuality and outright disrespect of homosexual people, and just in time for the upcoming film adaptation of his popular novel, Ender's Game, he makes a curiously timely plea to the movie-going public to put aside his views, stating in a statement to magazine Entertainment Weekly, "The gay marriage issue is moot."

How quaint, and convenient! Personally I dislike lining the coffers of such people with my dollars, however groundbreaking their works are. 

Someday, all knowledge and the fruits of people's creativity may be free. No longer will talented writers, actors, musicians, or others have to take on multiple minimum-wage jobs to make ends meet while they struggle on the side to achieve their dreams and pursue their passions. 

Instead, everyone will have their basic needs provided for so that, as Maslow indicates in his hierarchy of needs, people will be able to self-actualize and actually live rather than spend much of their daily life worrying about paying the bills, or their very survival. Not now, not in decades, perhaps not in millenia, but someday... hopefully!

I think a good first step toward such an audacious way of life is to share information.

Here, for example is a freely available set of ebooks in PDF format of the Ender's saga, which can be read online or downloaded. I encourage anyone interested in this fine piece of literature to obtain it at their leisure, without having to pay for it, and with the satisfaction that no royalties whatsoever will make it into Orson Scott Card's quite intolerant little hands.



Saturday, June 29, 2013

Dell Vostro 200 Fan Noise

The Dell Vostro 200 in its mini tower/desktop case is a decent computer with just one exception.

NOISE.

When powered on, the fans shoot up to their maximum RPM for a second or so, then slow down. Depending on what you're doing the fan noise is anything from the level of relatively benign white noise to a constant or fluctuating jet engine like drone. Scanning for malware, playing a graphics-intensive game, defragmenting the hard drive, anything with lots of CPU activity prompts the Vostro 200's fans to go full speed.

I found a simple solution to this dilemma. Inside the case there are two 80mm fans for cooling the CPU. One is mounted directly atop the CPU heatsink, and the other is mounted vertically in a bracket along the right-hand side of the computer to push air out ventilation holes in the case.



I had a nice, quiet, 120mm NZXT "performance" fan lying around and decided to use it instead of the two 80mm turbofans that came with the system. 

The CPU fan atop the heatsink is clipped on with several plastic clips, I simply removed each of these with pliers and discarded them since they'd just be in the way of the wider 120mm fan. The exhaust fan alongside is screwed to the case, so I removed it likewise and discarded it.

I then removed the vast amounts of dust and dog hair that had accumulated beneath the fan. As the case is lying horizontal to the desk, I decided to loop some narrow zip ties through the fan's screw holes and through holes in the rear grille of the case. I secured the ties with enough tension to keep the fan hovering just above the plastic and metal of the heatsink assembly.

It's a mystery why Dell chose seemingly the loudest fans possible for this computer. Or, perhaps it isn't so mysterious, perhaps loudness happens to be an unfortunate side effect of cheap hardware. Or, perhaps they wanted to make it seem especially sleek and high tech by having it mimic a 747 taking off. 

Regardless, now the new 120mm fan runs at a quiet, constant speed, and keeps CPU temperatures well within normal limits, with no fear of liftoff.




Saturday, May 25, 2013

Sound Card Stereo Channel Mysteriously Dies

The left channel of my Sound Blaster X-Fi Xtreme Audio sound card decided to die.





















I carefully smoothed my headset cabling in case a break had developed in the typically very fine stranded wiring of the headphones, and also tried removing the plug with an MP3 playing and noticed that only one channel was being played back, the right with the plug fully inserted, left if I just slightly unplugged it. Just in case I plugged the headphones into my laptop; perfect stereo sound, so something's definitely up with the card.  

I popped open the computer and examined the headphone jacks on the card. They appeared to be made of plain copper, and they seemed to have oxidation, much like an old penny.

I took a flat-bladed screwdriver from an eyeglass repair kit and carefully scraped away at the copper surface, revealing shiny metal underneath, then blasted away any residue with some canned air.




Now my music is once again in glorious stereo!




Friday, May 10, 2013

Sony SMP-N200 Streaming Media Player Review

This marks the 1-year anniversary since ditching DirecTV for the Sony SMP-N200 streaming media player.




The device features HDMI, optical, and RCA jacks, as well as an ethernet port.



So far, the experience has been great! Rather than paying around $900 a year for satellite, I'm paying just what I'd been paying before for internet, around $40 monthly, a decent compromise.

The interface of the player is very similar to that of Sony's Bravia series of TVs. 


 
The remote enables navigation to the various options and settings. A great thing about this little black box is that you can browse the web, grabbing either streaming video from YouTube and elsewhere, or just general browsing. However, one trick is to use a smartphone app, Sony Media Remote, so that you gain the benefit of a keyboard; trying to "type" using the Sony's remote is an exercise in aggravation, to say the least.

For over-the-air TV, a Winegard antenna hung up near the ceiling of the living room plus a signal amplifier has managed to pull in 8 stations, six broadcast in my immediate area, and two more from towers about 40 miles away.

With the Sony SMP-N200 I can also stream downloaded video over my home's wireless network. To do this, I first needed to enable Homegroup on my Windows 7 desktop PC, and then I installed Nero MediaHome to act as a server for the Sony. Most any popular encoding format (AVI, MPG, MKV, WMV, and more) can stream from my computer to my TV with very little effort.

All in all, aside from the clunky remote, I'd give it a solid 4 out of 5 stars for the money I've saved thus far over cable or satellite.









Tuesday, May 7, 2013

The "GenerateResource" Task Failed Unexpectedly

Shortly after setting up a RAM disk using the freeware version of Dataram RAMDisk to see whether Visual Studio 2010 might compile a huge solution faster, I began getting the following errors after relocating the system's temp files to the root of the RAM drive:
The "GenerateResource" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.

I dug around and found numerous references to existing bug reports and a few workarounds. I tried unsetting the readonly file system attribute in my solution folder, setting the GenerateResourceNeverLockTypeAssemblies property in my project file to true or false to downgrade some security parameters, but ultimately it was the top answer here that did the trick.

I had set the environment variables for the RAM drive initially to just R:\, referencing the root of the drive. Apparently VS 2010 doesn't like this, so I simply created a new folder on my ram disk named TEMP, and then updated the environment variables accordingly:




Just to rule it out, and also because I hadn't rebooted Windows in a while, I also opened Control Panel => Programs and Features, and performed a Repair on Microsoft .NET Framework 4 Client Profile just in case the framework files might've gotten corrupted somehow, and then restarted.

Problem solved! Now on to see whether Joseph Fluckiger's experimentation which returned lukewarm results on performance of building to a RAM disk holds water for a solution with, say, dozens of projects.



Wednesday, February 20, 2013

Left and Right Double Quotation Marks

Often I find myself wanting to use left and right double quotation marks rather than the generic ones.

Especially if you happen to be quoting someone, it adds a touch of class to use these rather than their boring unicode counterparts. This site outlines the differences between the two, and for convenience I'm posting each here so that either one can be easily copied and pasted:
 
 
 Left quotation mark. Hold down ALT and hit 0147 on your numeric keypad.

 Right quotation mark. Hold down ALT and hit 0148 on your numeric keypad.


Below is as an animated GIF showing each of the left and right double quotation marks as well as the plain old unicode ones in CharMap, and keystrokes you can use to type the former if you're so inclined:

A handy animated GIF outlining them all.
 


 

Saturday, February 16, 2013

Block Reddit Ads, Part Deux

In my previous post I outlined a method to block Reddit ads. 

It worked, until I tried hitting Reddit early this morning.

It appears that the ad structure is slightly different, now the following element hiding rule in the Element Hiding Helper of AdBlock Plus should do the trick:

reddit.com###siteTable_organic.organic-listing


This ought to work until they decide to change up their site structure once again. 

UPDATE: Apparently, the developer of AdBlock Plus has decreed that Reddit ads will from this point forward be whitelisted, stating that Reddit ads meet their 'acceptable ads' guidelines, necessitating custom rules like I describe above. To me, this is a bad idea, especially since even bigtime advertisers like Yahoo, Fox, and Google have inadvertently helped malware procreate through ads.





Friday, February 15, 2013

Block Reddit Ads

Reddit recently introduced an update to their ads which eludes AdBlock Plus.




Instead of a simple element ID denoted as a sponsored link, their page uniquely identifies it according to a link to the comments for a given ad posting. Ads annoy me, and as my previous post on blocking Reddit ads attests, even their minimal advertising is an unwanted distraction.

However, using the Element Hiding Helper, it's trivial to block the new ad scheme. If you're already familiar with hiding elements, all you need to do is add an element hiding rule like this:
reddit.com###siteTable_promoted > *

If you want a more detailed procedure which might help you block other unwanted web content, read on.

In Firefox, tap the ALT key to display the menu, then click Tools => AdBlock Plus => Select an element to hide (or alternatively hit CTRL-SHIFT-F3). This brings up the element selection dialog that lets you pick and choose items on the web page to hide.



Now a red selection box will outline and identify elements of the page as your mouse cursor hovers over them. If you hover over the sponsored link area, you should see something like this:



Note the entire ad post is surrounded, with a tag in the lower-left indicating the post is within a DIV element. Click on the tag for this area, and you'll open the Compose element hiding rule dialog.



This is the Basic view, but we need to go deeper, so click on the Advanced view button.


By default, when you clicked to select the ad, the element hider chose that specific DIV element. However, blocking this won't do, as each ad will have a unique identifier (in this case, 17aahm) which will foil the filter. 

To get around this, first click on the checkbox beside the option that begins "class: thing id-..." to uncheck it, and then click on the DIV in the list which is the parent to this one, just above the default selection. Then, click the checkbox beside siteTable_promoted so that it's checked, and then click the Add element hiding rule button.





Now the ad should be hidden, either immediately or after your next refresh of Reddit's page.




Tuesday, February 5, 2013

Foscam FI9821 Wireless Workaround

In my abortive attempt to review the Foscam FI9821, I mentioned the complete inability for the camera to find let alone connect to mine nor any wireless networks in my neighborhood. This precluded my ability (and desire) to review the camera any further.

Now, however, the camera sees and connects successfully to my wireless network. 

After my issues with the late Foscam FI9820 with its poor daytime image quality and anemic firmware, I already experienced RMA hell and didn't want to go through it again. Thus, being handy with electronics, I decided to try an off the wall suggestion found in Foscam's support forum.

Note that the following steps may VOID the manufacturer warranty.

1. Power off the FI9821 and disconnect all cables.

2. Remove the rubber feet on the underside of the camera, this should reveal a couple of screws. Remove them. There are also two screws located on the underside beneath one round laser QA label and another beneath a round paper label. Remove the labels and then the screws as well.

3. Carefully remove the bottom of the camera and follow the wire that runs from behind where the antenna screws in to the camera to a metal "post" on the circuitboard, similar to the one depicted here:


4. Remove the connector, then reconnect it, and as you do so wiggle it, just a little bit.

5. Reverse the steps above and reassemble the camera.

6. Connect the power and ethernet cables, and proceed to configure the camera to connect to your wireless network if you haven't already. Be sure to save the settings!

7. From the camera's web interface, on the Wireless Settings screen click the Scan button. Your wireless network should appear similarly as shown below:


8. Unplug the ethernet cable and wait a minute or so, then try browsing to the camera's IP address. With luck, the camera will have switched to wireless mode and you should then be connected wirelessly, at last!

Why does this work?? It could be due to insulation which is sometimes used to coat electronics, such as that used to coat thin wire that's used for coils. Perhaps in the manufacturing process, the post got sprayed with insulation by accident, leading to a poor connection with the antenna wire connector. Wiggling the connector around on the post may've scraped away any insulation, leading to a solid connection.

Regardless, releasing a $150+ camera so hurriedly with a problem like this, one that some simple quality assurance practices could've caught and fixed, is ridiculous. Although again I applaud Foscam for their responsive customer service and providing me with a free upgrade to the newest model of their camera, shame on them for not catching this frustrating little glitch!

I will review the camera in earnest in the near future, now that its wireless connectivity, a core feature in my eyes, is operational at last.


Saturday, February 2, 2013

Foscam FI9821 Review

UPDATE: Hard to believe, but a tip on Foscam's support forum from some random user turned out to be more helpful than Foscam.

A user on the forums reported that they got their wireless functional by simply popping open the camera, and then adjusting the wire connected to the camera's antenna.

Lo and behold, upon opening up the camera (and surely voiding its warranty, but no matter at this point as far as I'm concerned) and then removing the wire from its little post, reattaching it, then grinding it around the post back and forth a few times, suddenly the camera is able to detect my wireless network!


Wow. 

Foscam should enclose instructions telling their users how to crack the camera open and do what their QA department should've done and ensure the connection between the antenna and their camera is solid.

Or, even better, Foscam should do this testing prior to selling a $150+ camera to its customers!

___
 

I am pleased to be able to review the recently released Foscam FI9821 IP camera.

Perhaps in part due to my rather frank review of their FI9820 model, Foscam has just recently premiered the FI9821, with similar capabilities as the FI9820 but, I hope, fewer outright bugs than the previous model.

To review, the Foscam FI9820 had the following disagreeable problems:
  • Poor daylight video quality.
  • Inability to connect to a wireless WPA2 network that uses a complex passphrase with any non-alphanumeric characters.
  • As reported by Foscam, no further firmware support that might resolve these and any future issues.

I must give credit to Foscam's tech support. Courteous and respectful to the last, even when I threatened to contact my bank to dispute the credit card transactions associated with my purchase of two FI9820 cameras, they fulfilled an RMA request and provided me with a FREE upgrade to two FI9821 cameras at no cost other than for shipping the old cameras to their Houston, Texas facility.

Now, on to the review of Foscam's newest camera.

The cameras each arrived carefully packaged via USPS Priority Mail. My first minor disappointment came in the form of the AC adapter, its cord is still a mere 3 feet in length, less than I'd like.

I plugged in the power and fired up the camera, then assuming it would utilize DHCP to acquire a network address from my home router, I scanned my network using the handy free utility, Advanced IP Scanner, to ascertain its IP address so I could point my browser to it and configure it. No joy, the MAC address of the camera didn't appear to be detected by the software.

I uncharacteristically decided to consult the manual, which instructed me to pop the included CD into my drive and run the IP Camera Tool utility to help detect the camera on my network. Upon doing so, the camera was indeed detected, but strangely its TCP port had been set to 88 at the factory rather than the industry-standard 80 for http traffic. 



Okay. 

I accessed the camera's interface, and promptly changed the port to the standard port 80. So far, so good.

Next I tried to configure the wireless network settings on the camera. The interface isn't terribly helpful, for one, it seems Foscam expects your wireless network's SSID to be broadcast rather than hidden. I prefer to keep my SSID hidden to minimize the chance some passerby might see it and gain access, but as was the case with the FI9820, this new model wants your SSID to be broadcast.


Despite setting my SSID to be broadcast, this camera seems to NOT want to connect to my wireless network. This as of the most recent 1.1.1.10 firmware update.

I simply cannot review this camera any further until I'm able to connect it to my wireless network. I've contacted Foscam support, hopefully they'll address this issue sooner than later.