Monday, March 31, 2014

How to reference a .dll out of the GAC in BIDS or Visual Studio and other fun challenges.

Tonight I helped a friend with code. She wanted to reference a static method in a static class in an .rdl report in SSRS. We struggled to get SSRS to reference a .dll she made in Visual Studio. We got past that challenge and then hit another where we were told that partially trusted callers were not allowed, so I cannot say that my evening was a success. Oh well, let me show off what I did learn:

  1. We had to install a .dll in the GAC and that means that the .dll has to be signed (or at least so in her environment). To sign a .dll go to a project's properties in Visual Studio. Pick "Signing" at the "tabs" at the left. Click "Sign the assembly" and then just pick "<New...>" at "Choose a strong name key file:" Make up a name and a password. Finally publish your .dll somewhere.
  2. We put the .dll in the GAC. To do so, at the Visual Studio Command Prompt run a command like so: "gacutil –i C:\Whatever\YourAssemblyHere.dll"
  3. To reference a .dll back out of the GAC you have to jump through a few hoops as suggested here and here. First navigate to C:\Windows\assembly\GAC_MSIL\ at a command prompt then run a command like so: "cd YourAssemblyHere" ...to drill into a folder that has the same name as your assembly. Run a "dir" command here to see a list of folders in that folder. There will be a folder with a funny name like "1.0.0.0__992b220d2c0fa2a6" and you should drill into that folder next. Inside you should see your .dll. You need to take the full path to the .dll as you've just uncovered it and then paste that into the "File name:" field one sees when browsing for a reference when attempting to add a reference in Visual Studio. For some infuriating reason you cannot just navigate to the .dll in the assembly folder at Visual Studio and expect it to make the appropriate association. The stuff nested in C:\Windows\assembly\ will behave oddly when you try to browse into it from Visual Studio.

If a CC icon exists at the lower right at a YouTube movie it means that there is an option for subtitles!

Clicking it will expand some options for turning on the subtitles.

I saw Mahendra Mavani speak on Technology Refresh pitfalls at The Dallas Day of Dot Net convention this weekend.

By Technology Refresh (his term) what is meant is the rewrite of an existing application. To wit, the crafting of that would-be better version of that old application which has its kinks. Mahendra was a consistent presence on a project, from preplanning all the way to bug fixing long after rollout, which was supposed to be done in 2008 yet lingered for years afterwards. Both the cost and time as both estimated and originally allocated would prove to but a third of what was ultimately needed. In the end, and with some compromises, the users of the original system did indeed end up using the new system instead, but Mahendra was hesitant to call the project a success understandably. Bad goals which caused problems include:

  1. Replace the whole system: The original application, a mainframe application which got replaced with an ASP.NET MVC application, had hundreds of users across seventy-four functional roles and ten departments within the greater entity using it. Just as you would not try to climb Mount Everest in a single bound, you should not attempt to replace something of this complexity all at once either. Target the real life group that is driving the effort and plan to replace their chunk first. That slice of the pie will not have seventy-four functional roles. Understand the real-life interaction between the target group, once it is established, and the other groups too.
  2. Enhance while rewriting: There is the temptation for developers to try to do something "awesome" now that they have an opportunity to do some greenfield work. Fight it! In Mahendra's scenario the team looked at perceived holes in workflows and security that led to problems and tried to better workflows and security. Ideas that came out in the Agile process unfortunately reflected the wishes of the before-mentioned chunk of the seventy-four roles which was driving the development and not everyone. Mahendra forced users to log in and out every time they changed roles. Good security right? Users with profiles straddling numerous roles hated this. Just do a rewrite, not a rewrite plus.
  3. Generalize for broader use: Remember YAGNI. (You ain't gonna need it.) The gold-plating may scare/intimidate users by making the new experience more confusing. How does the gold-plating happen? Various parties involved start speculating as to needs. They give their input and the scope just keeps growing. This bullet point is a sister to the one before it. On a tangent, Mahendra gave another example of where a typical Agile process and letting stakeholders drive requirements may undermine success and that lay in an inability to roll out a OLTP/OLAP divide. Instead of having records pushed to a denormalized schema perhaps daily on a nightly process, stakeholders are apt to just decide they have to have real-time reporting (which they don't) and refuse to indulge an OLAP-friendly model leading to extremely complicated queries being crafted for reporting, the kind of queries that cannot be seen on a monitor without scrolling. The technical debt this brings does not merit the "benefit" of accurate-to-the-last-second data.
  4. Ceremonial switch over: Circling back to the first bullet point, a big bang go live in which everything changes for everyone overnight is bad. The go-live becomes a big event, the need for a backup plan just-in-case emerges, an off-peak hours deployment is proposed, the moment of the switch is tense, and then babysitting is needed. Mahendra suggested that if he were a civil engineer in charge of making Austin's roads better and he proposed just building a new Austin in some dead space just to the East of the existing Austin and then having everyone in Austin just move to the new Austin when it was done that no one would take him seriously. The better approach involves fixing one of Austin's roads standalone without forcing everyone tangentially involved into jumping through a bunch of hoops to accommodate something new. For an application you will have to figure out the boundaries between the first piece you are to replace and get users using and the rest of the application which is to be left, initially, untouched. This means you will have to understand the endpoints between the parts and if endpoints don't exist you will have to build them.
  5. One-stop universal solution: This last bit went into "bounded context" as Eric Evans (who wrote Domain Driven Design) might define it. The concept of a "Product" might mean different things in the contexts of ecommerce, manufacturing, inventory, and fulfillment in a large system. If you are just replacing one of these, keep the scope of "Product" to the scope of your bounded context.

Sunday, March 30, 2014

Installing stuff in the GAC.

This seems to touch on how to use Gacutil.exe to install something into the GAC like so:

gacutil -i hello.dll

 
 

...wherein what is above is a command line command. I have not tried this yet myself. This is what I've heard another refer to as "a note to future self." I have learned that if you just put stuff in the GAC folder that it is bad news. If you do not install stuff properly, the stuff likely will be uninstalled when the next installation that touches the GAC is run.

 
 

Addendum 4/1/2014: See also: this

PCI compliance auditing

...is what you must endure if you are keeping a soft copy of credit card records (as an American business entity). PCI stands for Payment Card Industry and there is a Payment Card Industry Data Security Standard. I went to the Dallas Day of Dot Net convention this weekend and ran into a guy there from Improving who said that Improving has done PCI audits for companies to preflight their processes in advance of the real audits from Uncle Sam. Some links:

  1. http://www.cio.com.au/article/400307/understanding_pci_compliance_auditing/
  2. http://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard

 
 

Addendum 7/30/2014: Uncle Sam does not do PCI audits. See: this and this

Wednesday, March 26, 2014

Disable the ViewState in an ASP.NET web forms application....

...by putting something like this in the Master Page's code behind:

protected void Page_Load(object sender, EventArgs e)
{
   this.EnableViewState = false;
}

 
 

This cuts the the size of the hidden variable that comes up in HTML down to 108 characters. You might as well do this if you're not going to use ViewState. I guess it is kinda comic that a disabled ViewState is still 108 characters long.

Upload a file in an ASP.NET web forms application.

This may be a more modern way to go, but I have found, today (while tinkering), in my notes an example of how to do an old school file upload implementation in ASP.NET web forms. To test the code in my notes, I made an new web forms app in Visual Studio 2013 and I put these two controls in Default.aspx:

  1. <input id="FileUploader" type="file" runat="server" />
  2. <asp:Button ID="Button" runat="server" Text="Button" OnClick="Button_Click" />

 
 

I then fleshed out the code behind like so which allowed me to move files into C:\temp successfully via the controls mentioned above:

using System;
using System.Web.UI;
namespace Pushy
{
   public partial class _Default : Page
   {
      protected void Page_Load(object sender, EventArgs e)
      {
      }
      
      protected void Button_Click(object sender, EventArgs e)
      {
         string fileName = FileUploader.PostedFile.FileName;
         int fileLength = FileUploader.PostedFile.ContentLength;
         if (fileName != "" && fileLength > 0 && fileLength <= 2048000)
         {
            fileName = System.IO.Path.GetFileName(fileName);
            try
            {
               FileUploader.PostedFile.SaveAs("C:\\temp\\" + fileName);
            }
            catch (UnauthorizedAccessException exception)
            {
               throw exception;
            }
         }
      }
   }
}

Access the Startup from the Task Manager in Windows 8 to keep Skype from starting up on its own whenever you power on.

The Task Manager is a pretty good thing to have pinned to the task bar. You may find it by picking Search from the right navigation that has Search, Share, Start, Devices, and Settings in it. Then search for "Task Manager" and when you find the Task Manager, pin it to the task bar. If you launch the Task Manager, you will see a tab for "Startup" and going there will show you a list of what spins up automatically upon starting up. Right-click on Skype and pick "Disable" from the menu which appears to keep it from automatically starting.

If you replace an old site with a new one while keeping the existing domain name, you will want to create 301 redirects for all of the pages which no longer exist in the name of not losing your search engine rankings.

The way to do this in C# (for a given page or route) is given here. At Headspring, I moved a site from .jsp (JavaServer Pages) to .aspx (ASP.NET web forms) and I recall that I had to jump through some hoops to get fake .jsp pages (which only contained 301 redirects) to run as .aspx pages in an ASP.NET environment. I recreated every page I threw away from the old site as a dummy page with a redirect at the new site. I believe I had to "OK" the .jsp extension somehow in the Web.config file. We used a third party for the hosting so I did not have to alter what .jsp did in IIS myself, but I wonder if I put in a request for as much with the third party. That would make sense. I can't recall.

If you have the staff scan printouts to a PDF for you at FedEx Office, if you have not brought your own USB drive, you'll end up buying one at FedEx Office.

Just a heads up. I've been in this situation before. They won't just email you your file. You can use one of the pay-per-use workstations to do your own scanning, but I'm not sure if you can make a PDF with the software on those machines. I suppose you could email yourself a .jpg you made in Photoshop and then make a PDF of it back at your home with your own software. I suppose you could also use zamzar.com too at the pay-per-use workstation. I spent my day at Kinko's Copies (now FedEx Office) today printing, scanning, and faxing, and I was grateful that I've grown smart enough to just keep a USB drive at my keychain in our modern era.

I got this cool toy, a mix of a bottle opener and a USB key, at No Fluff Just Stuff in Austin in 2011.

Tuesday, March 25, 2014

Clear cookies, cache, whatever ...in Firefox the easy way.

  1. Pick: History > Clear Recent History...
  2. In the "Clear All History" dialog which appears, select "Everything" at the "Time range to clear:" dropdown.
  3. Check checkboxes for Cookies, Cache, Whatever...
  4. Click: "Clear Now"

This is easier than what I suggest here where...

Tools > Options > Network > Clear Now

...should really be...

Tools > Options > Advanced > Network > Clear Now

...perhaps it used to be different when I wrote that other blog posting years ago.

Monday, March 24, 2014

Don't use Response.Redirect in an ASP.NET MVC Controller Action. It won't work.

This is bad:

using System.Web.Mvc;
using FluffyNothing.Core.Objects;
namespace FluffyNothing.UserInterface.Controllers
{
   public class AccountController : MvcController
   {
      public ActionResult Index()
      {
         Person person = GetFullIdentity();
         if (person == null)
         {
            Response.Redirect("/");
         }
         return View(person);
      }
   }
}

 
 

This is better:

using System.Web.Mvc;
using FluffyNothing.Core.Objects;
namespace FluffyNothing.UserInterface.Controllers
{
   public class AccountController : MvcController
   {
      public ActionResult Index()
      {
         Person person = GetFullIdentity();
         if (person == null)
         {
            return RedirectToAction("Index", "Home");
         }
         return View(person);
      }
   }
}

Share your desktop over Skype in Windows 8.

I figured out how to do this from these links:

 
 

The first link points out that you cannot share your screen as of yet with the version of Skype for Windows 8 and encourages you to use the "old" version from: here ...yet, even passing this hurdle however, I struggled to share my desktop from the "Change screen sharing settings" option that appears at the menu one finds when clicking on the "plus icon" as suggested here:

This option should take you to another screen where you affirm that you are to share your desktop. Then your desktop will NOT be seen. The cure is to go to the right menu with options for Search, Share, Start, Device, and Settings and then pick Start. You will end up at the start menu. From here, then go back to your desktop. That should do the trick.

Wednesday, March 19, 2014

Using the new keyword in lieu of the override keyword in C# will allow for method hiding not unlike just leaving the override keyword off.

namespace Whatever.Objects
{
   public class Cat
   {
       public virtual string Speak()
       {
           return "Meow";
       }
   }
}

 
 

Considering the class above, note these three scenarios for a child class named Lion. In each scenario the test provided passes.

Child

Test

 
 namespace Whatever.Objects 
 { 
    public class Lion : Cat 
    { 
        public override string Speak() 
        { 
            return "Roar"; 
        } 
    } 
 } 
 
 
 using Microsoft.VisualStudio.TestTools.UnitTesting; 
 using Whatever.Objects; 
 namespace Whatever.Tests 
 { 
    [TestClass] 
    public class Test 
    { 
        [TestMethod] 
        public void Lion_says_what_youd_expect() 
        { 
            Lion lion = new Lion(); 
            Cat cat = lion; 
            Assert.AreEqual(cat.Speak(), "Roar"); 
        } 
    } 
 } 
 
 
 namespace Whatever.Objects 
 { 
    public class Lion : Cat 
    { 
        public string Speak() 
        { 
            return "Roar"; 
        } 
    } 
 } 
 
 
 using Microsoft.VisualStudio.TestTools.UnitTesting; 
 using Whatever.Objects; 
 namespace Whatever.Tests 
 { 
    [TestClass] 
    public class Test 
    { 
        [TestMethod] 
        public void Lion_says_what_youd_expect() 
        { 
            Lion lion = new Lion(); 
            Cat cat = lion; 
            Assert.AreEqual(cat.Speak(), "Meow"); 
        } 
    } 
 } 
 
 
 namespace Whatever.Objects 
 { 
    public class Lion : Cat 
    { 
        public new string Speak() 
        { 
            return "Roar"; 
        } 
    } 
 } 
 
 
 using Microsoft.VisualStudio.TestTools.UnitTesting; 
 using Whatever.Objects; 
 namespace Whatever.Tests 
 { 
    [TestClass] 
    public class Test 
    { 
        [TestMethod] 
        public void Lion_says_what_youd_expect() 
        { 
            Lion lion = new Lion(); 
            Cat cat = lion; 
            Assert.AreEqual(cat.Speak(), "Meow"); 
        } 
    } 
 } 
 

I have more to say regarding DevExpress while I am yet on the outside looking in.

Adding to this, this, and this I wish to say that I've helped a friend with code some and have become intrigued by the DevExpress controls that are used at her workplace. The framework provides an easy way to roll your own controls and to speak between C# methods and JavaScript functions. Talking from one language to another appears to be as easy as the SignalR stuff. There a tools for both ASP.NET web forms and ASP.NET MVC! Update Panel for AJAX in ASP.NET web forms apparently has an even better replacement version of sorts in the form of a DevExpress control.

callback versus postback in ASP.NET web forms

A postback is the familiar act of submitting a web form's form back to itself. A callback happens when one reaches back to the server in an Update Panel AJAX implementation. It does not have the full lifecycle associated with the postback.

.Single versus .First in C# lambda expressions

int[] array1 = { 1, 3, 1000, 4, 5 };
int value1 = array1.Single(element => element > 999);

...is an example given here of using .Single in a lambda expression. When using .Single one is to get back one and only one item. There is an assumption that only one item may match the criteria. An exception will be thrown if this is not the case. .First in contrast will return the first match even if there is more than one match.

Ayende abandons Rhino Mocks?

I learned this week that Ayende is distancing himself from his Rhino Mocks mocking framework. This suggests that someone else has taken over the project. I'm kinda glad I know MOQ instead. NSubstitute is another mocking framework for C# yet.

Red tape for storing credit card data as an American corporate entity...

...is significant. Any company that keeps credit card records must endure a yearly audit to make sure they are doing so appropriately. "Wallet" is a term for the staging grounds for saved credit card information online. A user might have a wallet as user might have a shopping cart.

MSSQL locks

I had an interview question on Monday in which I was asked some SQL questions. The one I couldn't answer had to do with locking for concurrency which I really wasn't yet familiar with. I can't say I have a comprehensive understanding of it now either, but I would like to blog what I've learned just this morning in doing some research. This...

SELECT * FROM People

 
 

...might, I suppose, have a concurrency-friendly sister which looks like this...

SELECT * FROM People WITH (UPDLOCK, HOLDLOCK)

 
 

A way to sidestep a lock might be...

SELECT * FROM People WITH (NOLOCK)

 
 

Helpful stuff I have bumped into this morning includes:

  1. http://technet.microsoft.com/en-us/library/aa213039(v=sql.80).aspx
  2. http://technet.microsoft.com/en-us/library/aa213026(v=sql.80).aspx
  3. http://stackoverflow.com/questions/1483725/select-for-update-with-sql-server
  4. http://stackoverflow.com/questions/210171/effect-of-nolock-hint-in-select-statements
  5. http://stackoverflow.com/questions/7843733/confused-about-updlock-holdlock

 
 

The last of these links has this cheatsheet in it:

   (UPDLOCK)   (HOLDLOCK)   (UPDLOCK, HOLDLOCK)   (TABLOCKX) 
 SELECT   not blocked   not blocked   not blocked   blocked 
 INSERT   not blocked   blocked   blocked   blocked 
 UPDATE   blocked   blocked   blocked   blocked 
 DELETE   blocked   blocked   blocked   blocked 

Tumblr wants you to express yourself (but not hurt yourself).

Section 230 of the Communications Decency Act of 1996 stages noteworthy rules for the online service providers who share content online and thus draws a line in the sand between those who publish content and those who are the portal for the publishing. 230(c)(1) states that you are not liable for the content of others as an online service provider while 230(c)(2) states that you may self-police if you wish and you are free to take down the content of those you host based upon your own standards and judgment calls. The only exception to these rules has to do with content which violates federal law such as child pornography. However, content such as a blog posting full of slanderous lies about a corporate entity, while certainly fodder for getting its creator in hot water, is not subject matter that an online service provider would be obligated to pull from one of its forums. Such questionable content may be left online without the hosting party being in a position of liability. A publisher may face criminal charges for revenge porn in California, but not the intermediary providing the hosting. I saw a Jeff Hermes and an Eric Goldman speak on this subject at SXSW and they were joined by a third lawyer named Ari Shandadi (middle of the photo) who was the de facto star of the show and had the most interesting things to contribute. He is the general console for Tumblr and he spoke to how Tumblr operates under the protection of Section 230. He suggested that Secret would have needed a lawyer as early as its third employee in the absence of Section 230, but that fortunately this was not the case. He was very much a proponent of Section 230 and while acknowledging the problems that come with charming websites such as those that publish mugshot photos from arrests online while trying to bait their victims into paying them to remove the images, he also did not flinch from suggesting that our society just has to take the good with the bad and that the overall effect of Section 230 is inducive to free speech. He was loathe to see exception cases written into law tampering with it. A lot of goofy things come out of state legislatures, and it is probably best that only federal law may introduce loopholes to Section 230. Ari drew a comparison between Facebook and Tumblr and noted that while Facebook heavily polices and censors what its users may broadcast, that Tumblr tries to go in the other direction offering as much freedom to publishers as possible. He did call out a couple of exceptions. Tumblr will take down photos of people hurting themselves. They self-censor self-mutilation voluntarily while they are not explicitly obligated to. They have also made an architecture decision not to allow comments on posts as this may open the door to cyberbullying or other complexities Tumblr would rather not deal with. When individuals send Tumblr correspondence requesting that the posts of others which upset them be taken down, Tumblr does not oblige the requests.

secrets and bubbles

I saw a Mr. Owen Thomas speak at SXSW. His talk was titled "#siliconvalleyproblems: Can We Fix the Tech Mess?" and the talk had two themes which were really pretty different jammed into one talk with a funny title. The first theme had to do with how a city changes in a tech boom. With the exception of one year in New York, Owen has lived in San Francisco since the mid-1990s and has watched the city change. At some point the influx of tech workers created two societies, one of tech and one of everyone else. Techies lived lives apart and this created cultural challenges for nontechies. Housing pricing soared and this pushed many nontechies out of the city. When the tech bubble burst at the end of the dotcom era, the city was devastated as its economy was chained to tech instead of being diversified. At the end of the talk one of the questions came from a woman who feared the same thing happening in Austin. She said that she wasn't a techie and couldn't follow many of the references that Owen had name-dropped during his talk and she also asserted that the cost of living in Austin is ballooning as Austin becomes a tech hub. Owen suggested a crash in Austin would not come from the same circumstances as before as venture capital was fueling the artificial reality in San Francisco which eventually collided with actual reality. He felt that most now see venture capital as they might a casino, in that it is the stuff of luck and gambling, and in having our eyes open we insulate ourselves from a repeat of the American recession one before our most immediate one. The other theme in Owen's talk had to do with his own professional history which provides much insight into the history of blogging and online gossip. Owen started out working at suck.com which was the first webzine with keepers savvy enough to realize that they needed to publish content daily. Owen said that suck.com existed before blogging and served to define what would become the blogosphere and eventually Twitter. Sucksters wrote under pseudonyms. He felt that shock jock talk (having the audacity to say what is on your mind) is a cornerstone of blogging/Twitter culture and, hence, pseudonyms and anonymity are important. He found Secret, which I had not yet heard of, to be best app to emerge at the South by Southwest of 2014. It allows one to spread gossip anonymously on companies and Owen drew a parallel to Secret and the fuckedcompany.com of yore which took bits of gossip on flailing startups from anonymous submissions and just deemed that any one would-be fact coming from twenty different sources was actually fact that could be published at its site. Owen worked there too. I think Secret follows the same model without human editors. It has its own process for the equivalent of voting stuff up at Reddit. Owen felt that his prior place of employment and Secret to both be venues for people who love the places they worked while also being disappointed in them. Owen worked at Gawker next and is at readwrite today.

Loop through the contents of a C# dictionary.

foreach(KeyValuePair<Guid, string> values in personInModel.Home)
{

...as suggested here is the trick.

See if a C# dictionary contains any keys.

if (whatever.Keys.Count > 0)
{

Get rid of all breakpoints in Visual Studio 2013.

At: DEBUG > Delete All Breakpoints

Monday, March 17, 2014

imposture syndrome and conversations with crowds

Adam Savage was one of the keynotes this year at South by Southwest. He is on a TV show called MythBusters which I think I have seen maybe one time. The theme of the show has to do with trying to disprove junk science with real science, I think. His talk suggested that art and science are bedfellows and that they coexist nicely. Much of the theme conflicted completely with that of this other talk I saw earlier. The talk was kind of fluffy. He just wanted you to see art and science as awesome. Beyond that, a lot of the assertions he made were rather vapid and rather unscientific. He got a big applause when he wished aloud that schools would spend as much money on science fairs as they do on sports programs. He also wished that STEM (science, technology, engineering, and mathematics) as both an education lobby and high ideal was STEAM instead of STEM. An A would get added for Art in his ideal. He said it was awful that the first things to go in a school budget are arts and hands on science experiments. He said that a conversation you have with one other person is better than the one you have with a crowd. He said that we all have imposture syndrome and it keeps us working hard as we are all trying to escape feeling stupid and illegitimate.

Unity

...is perhaps the "Microsoft way" to do dependency injection. Copy here reads: "Unity is a lightweight, extensible dependency injection container with support for instance and type interception." This sort of corrects what I suggest here. Unity would be different from Spring.NET as Spring.NET has service locator gunk in addition to dependency injection stuff.

Designers versus Developers

At a South by Southwest talk, Jon Kolko, a designer and the author of a book dubbed "Exposing The Magic of Design," was one of many participants in a roundtable discussion on design at the Microsoft Studio (a building at 323 Congress where Microsoft seemed to set up shop for SXSW) where, truth be told, it might be more accurate to say he was the event's star. He seemed to be heavily driving the discussion and things said seemed to make their way back to him as prompts for him to react to or retort. He spoke considerably more than any one of the other players at the forum. In the picture I provide here he is not the guy with the microphone but the guy immediately next to him. A former coworker wanted to attend this talk and I stumbled in late to it to find him. I'm not sure of the exact title or the exact subject. The group vaguely spoke to the challenges of design. Things said included:

  • We need a product. Designers need to solve a problem, not just feed developers who are sitting on their hands waiting for something to do.
  • Designers approach problems from a very different angle than developers. A developer will try to solve a puzzle and ask himself/herself "How can I do it?" while a designer's first question is "Why?" Why tackle a given challenge? To get to the heart of the real problems one must ask the right questions.
  • At, for example, Microsoft, you are a consumer, or you are a developer, or you are a designer, etc. Your story goes down a certain path of actions. You have a narrative. The story is the mission statement for design. There is always a narrative to consider in good design.
  • Getting executives on board with "the feeling" can be challenging. Perhaps this is the core challenge for a designer.
  • Jon thought that there are also challenges to getting engineers to embrace the touchy feely and said that he had trouble getting Microsoft's engineer culture to embrace good design. Another individual thought that developers are actually designers. He saw a craftsperson in every developer and said that when you are writing code you are being creative and spinning alchemy. Budget and time are often constraining engineers and keeping them from real work. Jon counter argued that there is an end game in design and that as a designer you are striving for something that has a larger humanitarian purpose.
  • Software and drug narcotics are the only two spheres where we dehumanize people by labeling them as "users."
  • Empathy is what it feels like to be another person. Empathy may be impossible to completely achieve, but an empathic approach will gain you a lot of good design decisions. Using a cool new tool, less so.
  • Jon thought that it was alright to lose the designation of first to market. Take your time. He felt that a Lean approach is effective for telling you what not to build, but not what to build. For the later you need time.
  • Kill your babies. Designers are taught this but developers do not receive comparable training in computer science. Another gentleman mentioned that he really only sees the packratting of old code in junior developers. He felt that most good developers would say of their work that "it's just code."
  • What is art? ...is a silly question to answer, but Jon, while acknowledging this, nonetheless asserted that in making art you have to be OK with any possible outcome. Art is about asking questions and not solving problems. He did give that much of a minimal definition.
  • If you do too much work for a company, everything you do will start looking like everything else the company has done.

Addendum 6/1/2014: In rereading this the second to last and first bullet points seem conflictory. Hmmm...

QuickSilver

BroadVision QuickSilver is a tool for making documentation. It allows one to reference in pieces from many diverse sources and search against them too.

What is coming from Adobe?

I saw Devin Fernandez and Winsha Chen of Adobe speak on how Adobe rolls Alpha versions for new products and what new products it is experimenting with at SXSW. New things:

  • Gadget is Adobe's answer to the Google Chrome Developer Tools. It is a Google Chrome extension built in Backbone allowing one to hover over browser elements to get CSS details. What is more, you may change details right there at the browser and have the effect make its way back to the underlying file. The demonstration included changing a color on the fly and in that scenario a familiar looking Adobe color picker appeared. By default one is making inline style changes when using this tool, but there is also a way to pick a selector and make a global change there.
     
  • ASTRIcss is a tool for searching those 500 line CSS files that you inherit. You may constrain a search to be to specific properties and/or selectors.
     
  • Floto was to be a Twitter Bootstrap prototyping tool, but this ended up being something that died early. The problem was that prototyping as a term means many different things to many different people. An assessment of product/market fit has to be made for all potential tools and this one could not overcome the fact that designers and developers wanted two different things.
     
  • Parfait! allows for layer hunting in a multi-layered Adobe Photoshop .psd file. One may search for content and pull just the layer desired out to a .png or .jpg file. This is intended to be a helper for those times when you are handed a .psd that is one big rat's nest and you just need to find a particular layer within it. Parfait! also includes a means for easily uploading a .psd file to a cloud.
     
  • Magpie is a tool for emailing notes to yourself, which we all do. It somehow makes the experience better.

A selector in CSS...

...could start with a pound sign for an ID or a dot (period) for a class or no odd character at all if one is just trying to style all tags of a certain variety. Selectors are definitions for styling something in CSS. See: this

Sunday, March 16, 2014

Crowdsourcing Diplomacy

Map Give is a portal channeling volunteers to build data for OpenStreetMap for immediate goals perhaps more pressing than the need to update OpenStreetMap maps in general. Specifically, its aim is to provide relief in times of crisis by providing maps of crisis areas so that onsite professionals are working with adequate overviews of the regions they have to address. I saw two U.S. State Department Officials named Joel Campbell and Hillary Brandt speak on Map Give at a SXSW talk. They wanted to educate everyone about the technology and I suppose I found it both impressive enough and admirable enough to gush about it anew here. Maybe I can help spread word myself. For a map to helpful in our modern era it needs to be digital, contain both graphic and geographic data, be GIS (stands for "geographic information system," contains spatial data of how far apart in space points are from each other, and is the heaviest used standard in modern maps) compatible, and be dynamic allowing for changing data (houses get torn down, new roads are added, etc.). A high-resolution raster image satellite snapshot a terabyte in size of a troubled area, for example early 2010 Port-au-Prince, Haiti after it was devastated by an earthquake, holds little value. In order for it to be cast to something usable, human beings will have to draw vector shapes over top of it to outline building and roads. So far we cannot just ask computers to make sense of satellite photos themselves. Human judgment is needed. OpenStreetMap breaks satellite snapshots up into tiles and lets volunteers draw meaningful shapes over the tiles. There is then a committee approval process for submitted tiles across other volunteers. Many third world locales such as Port-au-Prince, Haiti turn out to be poorly mapped when the horrible moment comes when maps are really, really needed, so this technology provides a way for Average Joe to help from the comfort of his living room without ever visiting Haiti. The U.S. State Department has a heavy following in social media and it will alert its followers of the need to help map when trouble hits. By crowdsourcing the mapmaking to the masses, the contribution of any one individual need only be minimal and together we may all produce maps much faster than the State Department could on its own. This is especially important in a crisis when time is a critical commodity. Prior use of OpenStreetMap has already proved that this concept will work. Volunteers have poured out to help map a troubled area quickly several times before. The only thing really new here is that now the State Department would like you to know about all this and will try to channel your mapmaking energies towards its own philanthropic goals. Their efforts got me to learn about this technology for the first time at South by Southwest and I pass along the insight here.

two word Captcha

One of the things I remember from my days at AMD is Joel Holder telling me that Captcha (Completely Automated Public Turing test to tell Computers and Humans Apart) implementations with two words really only check for validation against one word no different from the usual Captcha implementations. The second word is a word that is being translated from a scan from a book and by making parties bottleneck through a Captcha and retype text anyways, a means emerges for translating books via crowdsourcing. Perhaps a participant will mistype a word to translate, but not any one word will be submitted to more than one participant.

Friday, March 14, 2014

Golden Ratio

At SXSW the Adobe Corporation hosted many talks. I saw the whole of one (well, minus the time I stepped out of the room to speak to a former coworker) which I hope to blog about later and then, following it, I saw a piece of another by a Paul Trani called "5 Things Every Designer Needs To Know About Design" from which I had to duck out early. Interesting things said in what I got to see included:

  • Design fundamental concepts include: variety, contrast, symmetry, balance, and tension
     
  • Concepts on the left side of the brain include order, balance, symmetry, and space, while concepts on the right side of the brain include variants, contrast, tension, scale, and texture. The left side represents stability while the right side represents excitement. You need the right mix of both. Perhaps in a web page the body copy could show stability while the header could show excitement. This was an example Paul gave.
     
  • It is important to think about where the eye will read, first, second, third...
     
  • There is a golden ratio in design in which the sum of a and b over a is equal to a over b. Both are equal to roughly 1.61803. That is the only way it may work out. To use this ratio define an area such that there is either a seam or a point of interest not midway between two side sides, but 1.61803 "units" into that which is 2.61803 "units" across. Do not break up content by cutting an area evenly in half. Do not center things meant to draw the eye. Instead use the golden ratio.

I close with an interesting scene from Darren Aronofsky's Pi:

When testing a WCF application locally, take the time to publish it to a site hosted in IIS and not just a virtual directory.

Duh. Don't make this mistake. Otherwise you'll get an error such as:

There was an error downloading metadata from the address. Please verify that you have entered a valid address.

 
 

With suggestions for what the problem could be such as:

  • the metadata exchange mex endpoint is not defined
  • metadata exchange is not enabled
  • you are using the wrong address
  • you are being blocked by some security setting

 
 

...when you attempt to reference in the service at another application in Visual Studio 2013.

Critics and Haters

Ann Friedman apparently has a disapproval matrix showing the four types of people she might interface with as a public persona. They are:

  1. friends
  2. frienemies
  3. critics
  4. haters

You friends are your lovers (perhaps not literally, but they are those who love you) while your frienemies are akin to your ex-lovers. Pushback comes from critics and haters. There is a difference between the two and it is wise not to mistake a critic for a hater, as the critic has something legitimate to say and being dismissive of a critic may make you look bad, defensive, weak, etc. When attacked you have to take the time to try to determine if the other party is saying something legitimate. This was an insight shared by a Sally Kohn who was part of a SXSW panel I saw for a talk titled: "Breaking the Mold: How to Thrive When Allies Turn." The talk really didn't have much to do at all with fighting with one's friends, but it did touch on how to deal well with people who don't like what you have to say. Much of it really applies to people at Sally's level (CNN contributor) or a similar one, but a librarian from New York who was facing some scathing criticism from blogging enemies spoke during the time for questions at the end, seeking help, and really a lot of the lessons could just as easily apply to her too or someone else of a smaller, emerging profile. Sally also stressed the importance of building a network of friends. You'll need it when you end up with a "network" of critics and haters, so be known well in your own "community." Also on the panel, a Joanne Bamberger suggested that in attempting to keep intestinal fortitude it is important to remind yourself that the criticisms of you are not being lobbied at you because of you, but that instead those looking daggers in your direction are in fact just trying to stake out their own territories. Jehmu Greene rounded out the panel. She suggested that one should have an ethic of honesty over politeness and should be willing to point one's finger at a problem within one's own circle. This is superior to trying to defend something you can't defend or being someone who turns a blind eye. I guess her advice does tie into the title of the talk. Street cred and legitimacy do not come from being shy.

C# 5.0

C# 5.0's delta with C# 4.0 is not particularly interesting and does not make me feel inadequate for only knowing C# 4.0. This offers the following chart:

Yawn! You may use C# 5.0 with the ASP.NET 4.5 Framework and Visual Studio 2013. This hints that C# 6.0 will be significantly different. There will be a new compiler and not just a new rollout based on compiler tricks.

Peek Definition

In Visual Studio 2013, right-clicking on a call to a method and selecting "Peek Definition" is similar to yet different from right-clicking on a call to a method and selecting "Go To Declaration" as the former will open a little window within the pane showing your code and display the method there. You may scroll within the window and close it when you are done with it. The effect happens if the method is in a different file but also if the method is in the same file. This is helpful in working inside a file with thousands of lines of code. You may see two pieces far apart side by side easily.

Ctrl Minus

If you drill into a method by right-clicking on a locale where it is used and then selecting "Go To Declaration" in Visual Studio 2013, you may hop back to where you were by pressing the Ctrl key and the hyphen at the same time. What is more you may drill inwards many times over with the "Go To Declaration" trick and progressively walk backwards with Ctrl Minus.

Thursday, March 13, 2014

Membership Provider

Ways to manage logins in ASP.NETland:

  1. Froms Authentication
  2. Active Directory
  3. Membership Provider
  4. the Facebook/Twitter stuff or maybe OAuth
  5. roll your own

 
 

I learned of Membership Provider for the first time via a phone screen this week. It seems that it offers a way to loosely couple authentication to the rest of an application too so that an implementation may, one day, be swapped out.

Deep Dive into Net Neutrality

I saw a Mr. Andrew Rasiej and a Mr. Craig Aaron speak on Net Neutrality at SXSW this week. The talk delved into the history of the issue, problems with the absence of Net Neutrality, and a bunch of sinister shadowy nefarious nastiness. Net Neutrality as a concept would prevent online service providers from giving preferential treatment to the content they deliver. Comcast which is America's biggest player providing the cables running high-speed internet connections, flexing muscle to the point of near monopoly in our modern post dialup account nation, has previously gotten caught trying to restrict BitTorrent's bandwidth in an act of sabotage. The FCC (Federal Communications Commission) tried to censure Comcast for this act but was unable to do so effectively because of a botched move it made when Michael Powell (the son of former Secretary of State Colin Powell who was so enraged at that Super Bowl XXXVIII halftime show which belongs in a different blog posting) was its chairman. While the Telecommunications Act of 1996 largely solidified Net Neutrality for dial up accounts and also what cable was being purposed for the internet, Michael Powell was petitioned to make an exception for broadband and a law allowing for an exemption, a loophole, was shepherded into reality. Today Michael Powell is a lobbyist for the same interests that initially courted him in his role in the public sector. He is, in fact, the head of the cable lobby. Boo! With the basic value of nondiscrimination that had been baked into our laws discarded, the FCC has since tried to find its only legal loopholes to prevent Comcast from repeating its prior trick, but it really operates in this capacity in a muted, sickly manner. The FCC is ineffectively at doing its job due to its history. Are there counterweights to the Powell forces lobbying in Washington? Absolutely. The Online Piracy Act (SOPA) and the Protect IP Act (PIPA) where pieces of legislation which would have allowed the U.S. Government to use DNS tricks to block certain domain names in America in the name of fighting online piracy. These acts never became law because of public outcry. However, the resistance will never have the deep pockets of Comcast so it is operating at a disadvantage overall. Our villains have lobbied local legislatures and have gotten nineteen states to vote against having municipal wireless to strengthen Comcast's grip by way of undermining any would be alternatives. Netflix has a digital service which rivals one of Comcast, but it has to stream its service over Comcast's pipes. What is stopping Comcast from giving preferential treatment to its own media? In an aside Andrew broke time into Before Internet and After Internet centering around our year 1994 in lieu of Before Christ and After Death at year 0, or perhaps year 1. (Like that Super Bowl XXXVIII halftime show there could be a whole different blog posting on this detail.) The companies that existed in the BI era which still thrive today, in Andrew's opinion, hate the internet and see it as a huge inconvenience to their business models. Hollywood hates Napsteresque piracy for example. Andrew asserted that BI companies want to see the internet die of a thousand paper cuts so that they may return to their lucrative practices of yore. They pour money into Washington through individuals like Michael Powell to make it happen. What is more, Andrew feels there are plenty of AI companies that are quick to exploit some of the problems in the name of profit. Facebook apparently provides free internet to some parts of the 3rd World, but it stops being free once someone browses away from Facebook itself. The take away from the talk: doom and gloom! Moneyed interests are making the internet sick. Comcast is to try to buy Time Warner. But in some regions, such as New York City, lawmakers will have to approve the regional doings. What will Bill de Blasio do? Maybe we should all write him a letter.

 
 

Addendum 12/16/2018: I think SOPA is actually the Stop Online Piracy Act.

Making System.Web.UI.WebControls.DropDownList do what you wish in ASP.NET web forms applications.

 <select>
    <option value="13">Foo</option>
    <option value="42">Bar</option>
    <option value="88" selected>Baz</option> 
    <option value="96">Qux</option>
 </select>
 var dictionary = new Dictionary<string, string>(); 
 dictionary.Add("13", "Foo");
 dictionary.Add("42", "Bar");
 dictionary.Add("88", "Baz");
 dictionary.Add("96", "Qux");
 MyDropDownList.DataSource = dictionary;
 MyDropDownList.DataTextField = "Value";
 MyDropDownList.DataValueField = "Key";
 MyDropDownList.DataBind();
 MyDropDownList.SelectedIndex = 2;
Both of the above will make something like this:

...but, they are wildly different aren't they? The web forms version takes a little time to understand and thus merits a blog posting. I have a lot of old notes on how to manipulate drop down lists, but not at this particular blog, so behold my update. A friend of mine asked me for some help and I put together some code for her. The code I put together shows off how to manipulate the System.Web.UI.WebControls.DropDownList control. This wasn't really the goal of my help. Her problem was that she needed to progressively drop line items which had been touched upon out of a dropdown list, but she was keeping only the most recent item in Session. The wrong way of doing this sort of thing is emulated below. What follows is a code behind for a web form that contains one DropDownList and also one Button. I think it should be easy enough to understand. Assume that one visits this form, leaves it, and keeps revisiting it. The contents of the DropDownList are supposed to shrink over time but they don't.

using System;
using System.Web.UI.WebControls;
namespace Whatever
{
   public class Bad : System.Web.UI.Page
   {
      protected global::System.Web.UI.WebControls.DropDownList MyDropDownList;
      
      protected void Page_Load(object sender, EventArgs e)
      {
         if (!Page.IsPostBack)
         {
            PopulateDropDownList();
            PotentiallyRemoveItems();
         }
      }
      
      protected void Button_Click(object sender, EventArgs e)
      {
         if (MyDropDownList.SelectedItem.Value != "")
         {
            Session["ToRemove"] = MyDropDownList.SelectedItem.Value;
            Session["LeadIn"] = "Bad";
            Response.Redirect("SomewhereElse.aspx");
         }
      }
      
      private void PopulateDropDownList()
      {
         MyDropDownList.Items.Clear();
         MyDropDownList.Items.Add(new ListItem("Foo", "13"));
         MyDropDownList.Items.Add(new ListItem("Bar", "42"));
         MyDropDownList.Items.Add(new ListItem("Baz", "88"));
         MyDropDownList.Items.Add(new ListItem("Qux", "96"));
         MyDropDownList.Items.Insert(0, (new ListItem("", "")));
         MyDropDownList.SelectedIndex = 0;
      }
      
      private void PotentiallyRemoveItems()
      {
         if (Session["ToRemove"] != null)
         {
            string toRemove = Session["ToRemove"] as string;
            MyDropDownList.Items
                  .Remove(MyDropDownList.Items.FindByValue(toRemove));
         }
      }
   }
}

 
 

Here is my fix. Again, the thing I hope you really see is how to manipulate a DropDownList in a web form by way of C#.

using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
namespace Whatever
{
   public class Good : System.Web.UI.Page
   {
      protected global::System.Web.UI.WebControls.DropDownList MyDropDownList;
      
      protected void Page_Load(object sender, EventArgs e)
      {
         if (!Page.IsPostBack)
         {
            PopulateDropDownList();
            PotentiallyRemoveItems();
         }
      }
      
      protected void Button_Click(object sender, EventArgs e)
      {
         if (MyDropDownList.SelectedItem.Value != "")
         {
            if (Session["ToRemove"] == null)
            {
               List<string> toRemove = new List<string>();
               toRemove.Add(MyDropDownList.SelectedItem.Value);
               Session["ToRemove"] = toRemove;
            } else {
               List<string> toRemove = Session["ToRemove"] as List<string>;
               toRemove.Add(MyDropDownList.SelectedItem.Value);
               Session["ToRemove"] = toRemove;
            }
            Session["LeadIn"] = "Good";
            Response.Redirect("SomewhereElse.aspx");
         }
      }
      
      private void PopulateDropDownList()
      {
         MyDropDownList.Items.Clear();
         MyDropDownList.Items.Add(new ListItem("Foo", "13"));
         MyDropDownList.Items.Add(new ListItem("Bar", "42"));
         MyDropDownList.Items.Add(new ListItem("Baz", "88"));
         MyDropDownList.Items.Add(new ListItem("Qux", "96"));
         MyDropDownList.Items.Insert(0, (new ListItem("", "")));
         MyDropDownList.SelectedIndex = 0;
      }
      
      private void PotentiallyRemoveItems()
      {
         if (Session["ToRemove"] != null)
         {
            List<string> toRemove = Session["ToRemove"] as List<string>;
            foreach (string item in toRemove)
            {
               MyDropDownList.Items.Remove(MyDropDownList.Items.FindByValue(item));
            }
         }
      }
   }
}

Wednesday, March 12, 2014

Sys.WebForms.PageRequestManager

Per this: "Manages partial-page updates of server UpdatePanel controls in the browser, and defines properties, events, and methods that can be used to customize a Web page by using client script." UpdatePanel is... ahem, the old way of doing AJAX in ASP.NET web forms projects. Sys.WebForms.PageRequestManager may be called in JavaScript. It has many properties hanging off of it.

Beginning a variable name with a dollar sign in jQuery...

...is a convention that is not mandatory which is often used to denote that the thing kept in the variable is a special as opposed to traditional variable. This says many things about the subject. Perhaps a DOM node in lieu of a string would end up in a variable starting with a $. Both the dollar sign and the underscore are legitimate characters to use in JavaScript in variable names. They look strange when we see them, but we can use them if we wish.

DBNull.Value

This suggests that "you can use the DBNull.Value property to explicitly assign a DBNull object value to the field. However, most data providers do this automatically." I saw someone else's code wherein there was some sanity checking to ensure that DBNull.Value was passed in lieu of just plain Jane null whenever applicable. I guess this safeguard was needed in that case.

A finalizer runs when the object it decorates is being disposed of in C#.

I thought I'd add that clarification onto this.

Tuesday, March 11, 2014

named argument

About four minutes and fifty seconds into this we get the following example of using a named argument when assigning just one of several optional parameters when calling a method wherein the one of several is not necessarily the very first:

public class FileStream
{
   public FileStream (
         string path,
         FileMode mode,
         FileAccess access = FileAccess.ReadWrite,
         FileShare share = FileShare.Read,
         int bufferSize = 0x1000,
         FileOptions options = FileOptions.None)
   {
      
//Actual code
      new { path, mode, access, share, bufferSize, options }.Dump();
   }
}
 
void Main()
{
   new FileStream ("temp.txt", FileMode.Create,
         options: FileOptions.Asynchronous);
}

 
 

This trick came up last night while I was helping a friend understand someone else's code. A name followed by a colon followed by a value, as shown above in calling a method, is a "named argument."

a global economy driven by platforms and APIs

What is an API? An API may be accessed programmatically. One may ask for a service without speaking to another human being. (self service) In interfacing with APIs remote services appear to be local. The end user does not care how the resource being used is manufactured or where and does not have to. All that is abstracted away. At a SXSW event on APIs I saw yesterday, the star was Amazon CTO Werner Vogels. He was interviewed by Echo CEO Khris Loux, whose company does media streaming stuff. The central assertions that Werner seems to wish to communicate were that firstly when he opened up the Amazon marketplace as a venue for other vendors to sell upon it was a win-win for both Amazon and other parties, and that secondly and moreover there are other scenarios in which one rival exposing an API that all other rivals may use would be beneficial to everyone allowing competitors to have something of a symbiotic relationship through a common channel! Werner suggested that AWS (Amazon Web Services) allowed Amazon to have the largest catalog in the world which it could not have had otherwise. It is not a winner-take-all model as while the nature of the API clearly benefits Amazon it also is a boon for smaller entities who may now reach a wider-than-previous-possible audience in their sales efforts. Pharmaceutical companies in America have to record a degree of data on their rollouts and studies to feed back to regulatory agencies in name of meeting red tape requirements which is heavy, not trivial. Per Werner, if just one of the six major players in the field would just expose its safety data via an API for the other five to use, it would benefit everyone. There is so much double work which could just go away leading to: greater efficiency, greater profits, greater good. A lot of corporate layers could be shed by just opening up APIs in Werner's thesis. Move Hyatt to Airbnb. Let CNN sell its video feeds so that not just CNN utilizes them. There was some devil's advocacy pushback from Khris as he tried to poke holes in Werner's vision. As Werner responded it seemed like AWS was already avoiding a few pitfalls which could really be serious pitfalls for other APIs. Werner suggested it probably best to not lock participants into contracts. The API model should not be the old school cell phone model. Werner said that Facebook controls everything which appears in its App Store suggesting that was too restrictive. I wonder if he meant Apple. I guess they both apply. For a party to offer such an API the API must be open and not favor the authoring party. There is not and should not be a code snippet within AWS which says:

if (Amazon) then
{
   GoLeft();
} else {
   GoRight();
}

Monday, March 10, 2014

Tim Berners-Lee vs. Marc Andreessen

Tim Berners-Lee is the inventor of the World Wide Web it seems. I just learned his name in reading an article on Edward Snowden. I've always associated Marc Andreessen of Netscape with the beginning of the World Wide Web, but I guess he just brought it into our living rooms. It was there before he made it accessible. The invention was 25 years ago this week.

Addendum 3/13/2014: The http technology that Berners-Lee made was at first owned by an organization called CERN which kept it to itself from 1989 to 1993. It then released it to the public. The Mosaic browser then appeared.

Saturday, March 8, 2014

Vota por un gato...

I am this year undertaking the South by Southwest Interactive festival for the first time since, I think, 2000. This is the biggest thing that happens in little 'ole Austin, Texas which is progressing to be less little and more avant-garde all the time. I saw a talk today called "Lol of Nations – Understanding Global Memes" which featured four panelists each speaking to the niche memes of six particular nations. One thing that each speaker had in common was a focus on the exclusively political memes. There were not any goofy fun equivalents of the Nyan Cat brought out. Each meme on exposition was made in the name of influencing opinion. The panelists were:

  1. Andreas Monroy-Hernandez focused on Mexico and asserted that one may see a political narrative by watching how trending political memes progress over time. He focused on Enrique Peña Nieto, Mexico's current president, and how he was portrayed in memes over time. Initially there were winks at his handsome appearance and suave persona, but this trend gave way to one of a fake reformer who is a puppet of perhaps the United States or perhaps Felipe Calderón who was president before him. Andreas also mentioned a political campaign to get a cat named Morris to be elected the mayor of a city which appealed to exactly the sort of voters which Nieto disenchanted and also disenchanted voters in general. Vota por un gato...
     
  2. Ben Valentine spoke on the three West African nations which share Lake Victoria: Kenya, Tanzania, & Uganda. He mentioned that when elections were held, there was a bias by Western journalists to try to portray the elections as disastrous. Any misdemeanoresque altercation was stereotypically blown up into a bigger problem when retold by outsiders when in reality the electoral process ran pretty smooth. Locals began making fun of how warped the coverage was in memes making light of how American News saw things. This helped them reclaim the reality.
     
  3. Ellen Agapie spoke to a political tug-of-war between two parties in the government of Romania and how the two sides used signature tactics. One offered exclusively the sort of text-merely-overlaying-a-photo readable "sound" bytes that we've come to expect from memes in America. The other offered sort of fictitious movie posters with the faces of Romanian political figures Photoshopped into other images from American media ads.
     
  4. Katie Pearce said that memes are cheap, funny, shareable, anonymous, and trackable making them great political tools. She spoke to how the government of Azerbaijan used memes to undermine political opponents. She felt that in or modern era it is just harder than it used to be to be a dictator. A dictator can only suppress so much of the media on modern tech-savvy planet Earth and no longer has the cold war politics to prop him up. Dictators now win elections by seventy-eight percent of the vote in lieu of ninety-nine, and they try to just shut down opponents by sending them auditors or health inspectors in lieu of death squads. Dictators now pretend to champion democracy in the name of controlling their narratives. They are, in fact, treading carefully in destroying their enemies. Memes are a great tool for them as they allow them to undermine their enemies and in a dictatorship, the dictators will be able to broadcast widely within the media a lot louder than their opponents may shout back.

I've looked into how to merge two different DataSet objects before binding to a GridView control in an ASP.NET application.

dataSetOne.Merge(dataSetTwo);

...might be one way but:

 
 

dataSetOne.Tables[0].Merge(dataSetTwo.Tables[0]);

...really might be better.

Add and drop event listeners in dojox.

The postCreate function which is empty here ended up looking like this:

postCreate: function() {
   window.addEventListener('resize', lang.hitch(this, this.prepChart));
},

 
 

The afterActivate method in a controller would call this method on a widget for making a pie chart once to establish an event listener which would then kick off the prepChart method on the widget whenever the browser was resized, thus resizing the pie chart the widget displayed. The problem was though that the event was never turned back off and once one transitioned to another view errors starting bubbling up to the console. The postCreate method ended up getting refactored to:

postCreate: function() {
   this.resizeCallback = lang.hitch(this, this.prepChart);
   window.addEventListener('resize', this.resizeCallback, false);
},

 
 

In the beforeDeactivate method on a controller that called the postCreate method in its afterActive method, one would have to call out to a new method on the widget to turn the event listener back off:

dropEvent: function() {
   window.removeEventListener('resize', this.resizeCallback, false);
},

 
 

Note how lang.hitch had to get cast to a variable and then used from there. Calling lang.hitch twice somehow produced a mismatch, so the cast-to-a-variable trick was the way around that problem.

Wednesday, March 5, 2014

SugarCRM

...is the thing you use before you admit to yourself that you need SalesForce. SugarCRM has a commercial version, but there is also the Open Source free version that many seem to use to manage their contacts for sales when starting out.

Tuesday, March 4, 2014

Crystal Reports

...is something I have heard of for over a decade but have never used. Wikipedia says: "Crystal Reports is a business intelligence application, currently marketed to small businesses by SAP AG. It is used to design and generate reports from a wide range of data sources."

Saturday, March 1, 2014

CSS Zen Garden

...is still around. It still shows how differently the same swath of HTML may look just by applying different CSS stylesheets. It's now over a decade old. When tableless design was really blossoming I remember CSS Zen Garden coming up in conversation a lot. Fun stuff.

beginnings of an Entity Framework repository

using System.Collections.Generic;
using System.Data;
using System.Linq;
using FluffyNothing.Core.Interfaces.DatabaseIntegration;
using FluffyNothing.Core.Objects;
namespace FluffyNothing.Infrastructure.DatabaseIntegration
{
   public class PersonRepository : IPersonRepository
   {
      public void AddPerson(Person person)
      {
         using (var db = new PersonContext())
         {
            db.People.Add(person);
            db.SaveChanges();
         }
      }
      
      public List<Person> GetPersons()
      {
         using (var db = new PersonContext())
         {
            var people = from person in db.People
                      select person;
            return people.ToList();
         }
      }
      
      public List<Person> GetPersons(string email)
      {
         using (var db = new PersonContext())
         {
            var people = from person in db.People
                      where person.Email.Equals(email)
                      select person;
            return people.ToList();
         }
      }
      
      public List<Person> GetPersons(string email, string password)
      {
         using (var db = new PersonContext())
         {
            var people = from person in db.People
                      where person.Email.Equals(email) && person.Password.Equals(password)
                      select person;
            return people.ToList();
         }
      }
      
      public void UpdatePerson(Person person)
      {
         using (var db = new PersonContext())
         {
            db.Entry(person).State = EntityState.Modified;
            db.SaveChanges();
         }
      }
   }
}