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...




Thursday, December 26, 2013

Morgan Fremen


Friday, November 8, 2013

Ramp Art

Creating this gave me a woody!




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.




Tuesday, June 11, 2013

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.