You are currently browsing the category archive for the ‘computer hell’ category.

A HELPDESK LOG

Monday ——

8:05am User called to say they forgot password. Told them to use password retrieval utility called FDISK. Blissfully ignorant, they thank me and hang up. God, we let the people vote and drive, too?

8:12am Accounting called to say they couldn’t access expense reports database. Gave them Standard Sys Admin Answer #112, “Well, it works for me.” Let them rant and rave while I unplugged my coffeemaker from the UPS and plugged their server back in. Suggested they try it again. One more happy customer…

8:14 am User from 8:05 call said they received error message “Error accessing Drive 0.” Told them it was an OS problem. Transferred them to microsupport.

11:00 am Relatively quiet for last few hours. Decide to plug support phone back in so I can call my girlfriend. Says parents are coming into town this weekend. Put her on hold and transferred her to janitorial closet down in basement. What is she thinking? The “Myst” and “Doom” nationals are this weekend!

11:34 am Another user calls (do they ever learn?). Says they want ACL changed on HR performance review database so that nobody but HR can access database. Tell them no problem. Hang up. Change ACL. Add @MailSend so performance reviews are sent to */US.

12:00 pm Lunch

3:30 pm Return from lunch.

3:55 pm Wake up from nap. Bad dream makes me cranky. Bounce servers for no reason. Return to napping.

4:23 pm Yet another user calls. Wants to know how to change fonts on form. Ask them what chip set they’re using. Tell them to call back when they find out.

4:55 pm Decide to run “Create Save/Replication Conflicts” macro so next shift has something to do.

Tuesday

8:30 am Finish reading support log from last night. Sounded busy. Terrible time with Save/Replication conflicts.

9:00 am Support manager arrives. Wants to discuss my attitude. Click on PhoneNotes SmartIcon. “Love to, but kinda busy. Put something in the calendar database!” I yell as I grab for the support lines, which have (mysteriously) lit up. Walks away grumbling.

9:35 pm Team leader from R&D needs ID for new employee. Tell them they need form J-19R=9C9\\DARR\K1. Say they never heard of such a form. Tell them it’s in the SPECIAL FORMS database. Say they never heard of such a database. Transfer them to janitorial closet in basement.

10:00 am Perky sounding intern from R&D calls and says she needs new ID. Tell her I need employee number, department name, manager name, and marital status. Run @DbLookup against state parole board database, Centers for Disease Control database, and my Oprah Winfrey database. No hits. Tell her ID will be ready tonight. Drawing from the lessons learned in last week’s “Reengineering for Customer Partnership,” I offer to personally deliver ID to her apartment.

10:07 am Janitor stops by to say he keeps getting strange calls in basement. Offer to train him on Notes. Begin now. Let him watch console while I grab a smoke.

1:00 pm Return from smoking break. Janitor says phones kept ringing, so he transferred them to cafeteria lady. I like this guy.

1:05 pm Big commotion! Support manager falls in hole left where I pulled floor tiles outside his office door. Stress to him importance of not running in computer room, even if I do yell “Omigod — Fire!”

1:15 pm Development Standards Committee calls and complains about umlauts in form names. Apologizing for the inconvenience, I tell them I will fix it. Hang up and run global search/replace using gaks.

1:20 pm Mary Hairnet from cafeteria calls. Says she keeps getting calls for “Notice Loads” or “NoLoad Goats,” she’s not sure, couldn’t hear over industrial-grade blender. Tell her it was probably “Lettuce Nodes.” Maybe the food distributor with a new product? She thinks about it and hangs up.

2:00 pm Legal secretary calls and says she lost password. Ask her to check in her purse, floor of car, and on bathroom counter. Tell her it probably fell out of back of machine. Suggest she put duct tape over all the airvents she can find on the PC. Grudgingly offer to create new ID for her while she does that.

2:49 pm Janitor comes back. Wants more lessons. I take off rest of day.

Wednesday

8:30 am Irate user calls to say chipset has nothing to do with fonts on form. Tell them Of course, they should have been checking “Bitset,” not “chipset.” Sheepish user apologizes and hangs up.

9:10am Support manager, with foot in cast, returns to office. Schedules 10:00am meeting with me. User calls and wants to talk to support manager about terrible help at support desk. Tell them manager about to go into meeting. Sometimes life hands you material…

10:00 am Call Louie in janitorial services to cover for me. Go to support manager’s office. He says he can’t dismiss me but can suggest several lateral career moves. Most involve farm implements in third-world countries with moderate to heavy political turmoil. By and by, I ask if he’s aware of new bug which takes full-text indexed random e-mail databases and puts all references to furry handcuffs and Bambi Boomer in Marketing on the corporate Web page. Meeting is adjourned as he reaches for keyboard, Web browser, and Tums.

10:30 am Tell Louie he’s doing great job. Offer to show him mainframe corporate PBX system sometime.

11:00 am Lunch.

4:55 pm Return from lunch.

5:00 pm Shift change; Going home.

Thursday

8:00 am New guy (“Marvin”) started today. “Nice plaids” I offer. Show him server room, wiring closet, and technical library. Set him up with IBM PC-XT. Tell him to quit whining, Notes runs the same in both monochrome and color.

8:45 am New guy’s PC finishes booting up. Tell him I’ll create new ID for him. Set minimum password length to 64. Go grab smoke.

9:30 am Introduce Louie the custodian to Marvin. “Nice plaids” Louie comments. Is this guy great or what?!

11:00 am Beat Louie in dominos game. Louie leaves. Fish spare dominos out of sleeves (“Always have backups”). User calls, says Accounting server is down. Untie Ethernet cable from radio antenna (better reception) and plug back into hub. Tell user to try again. Another happy customer!

11:55 am Brief Marvin on Corporate Policy 98.022.01: “Whereas all new employee beginning on days ending in ‘Y’ shall enjoy all proper aspects with said corporation, said employee is obligated to provide sustenance and relief to senior technical analyst on shift.” Marvin doubts. I point to “Corporate Policy” database (a fine piece of work, if I say so myself!). “Remember, that’s DOUBLE pepperoni and NO peppers!” I yell to Marvin as he steps over open floor tile to get to exit door.

1:00 pm Oooooh! Pizza makes me so sleepy…

4:30 pm Wake from refreshing nap. Catch Marvin scanning want ads.

5:00 pm Shift change. Flick HR’s server off and on several times (just testing the On/Off button…). See ya tomorrow.

Friday

8:00 am Night shift still trying to replace power supply in HR server. Told them it worked fine before I left.

9:00 am Marvin still not here. Decide I might start answering these calls myself. Unforward phones from Mailroom.

9:02 am Yep. A user call. Users in Des Moines can’t replicate. Me and the Oiuji board determine it’s sunspots. Tell them to call Telecommunications.

9:30 am Good God, another user! They’re like ants. Says he’s in San Diego and can’t replicate with Des Moines. Tell him it’s sunspots, but with a two-hour difference. Suggest he reset the time on the server back two hours.

10:17 am Pensacola calls. Says they can’t route mail to San Diego. Tell them to set server ahead three hours.

11:00 am E-mail from corporate says for everybody to quit resetting the time on their servers. I change the date stamp and forward it to Milwaukee.

11:20 am Finish @CoffeeMake macro. Put phone back on hook.

11:23 am Milwaukee calls, asks what day it is.

11:25 am Support manager stops by to say Marvin called in to quit. “So hard to get good help…” I respond. Support manager says he has appointment with orthopedic doctor this afternoon, and asks if I mind sitting in on the weekly department head meeting for him. “No problem!”

11:30 am Call Louie and tell him opportunity knocks and he’s invited to a meeting this afternoon. “Yeah, sure. You can bring your snuff” I tell him.

12:00 am Lunch.

1:00 pm Start full backups on UNIX server. Route them to device NULL to make them fast.

1:03 pm Full weekly backups done. Man, I love modern technology!

2:30 pm Look in support manager’s contact management database. Cancel 2:45 pm appointment for him. He really should be at home resting, you know.

2:39 pm New user calls. Says want to learn how to create a connection document. Tell them to run connection document utility CTRL-ALT-DEL. Says PC rebooted. Tell them to call microsupport.

2:50 pm Support manager calls to say mixup at doctor’s office means appointment cancelled. Says he’s just going to go on home. Ask him if he’s seen corporate Web page lately.

3:00 pm Another (novice) user calls. Says periodic macro not working. Suggest they place @DeleteDocument at end of formula. Promise to send them document addendum which says so.

4:00 pm Finish changing foreground color in all documents to white. Also set point size to “2” in help databases.

4:30 pm User calls to say they can’t see anything in documents. Tell them to go to view, do a “Edit — Select All”, hit delete key, and then refresh. Promise to send them document addendum which says so.

4:45 pm Another user calls. Says they can’t read help documents. Tell them I’ll fix it. Hang up. Change font to Wingdings.

4:58 pm Plug coffee maker into Ethernet hub to see what happens. Not (too) much.

5:00 pm Night shift shows up. Tell that the hub is acting funny and to have a good weekend.

 


I am not sure who originally wrote this, though I would really like to know.  I am thinking it may be Markus Baur (https://www.cs.cmu.edu/~mbaur/j1.html).  I remember first seeing this around 1999, and being in system administration and support at the time I found it quite funny.  So much I have thought about it now again through the years.

“Lettuce Nodes”

Advertisements

Another issue has arisen with my Windows 10 external boot on my Mac Book Pro.  There was an large update for Windows 10 which was failing. The reason, you can’t install windows on a usb flash drive using setup.  Sigh.

After a quick google search the fix was simple enough.  You simply go to registry key HKLM:\SYSTEM\CurrentControlSet\Control and change the value for PortableOperatingSystem from 1 to 0.

The part I didn’t expect is that now my MBP wants to boot the the external drive by default.  I am sure setup changed this in the boot partition.  My fear is bricking the MBP partition as I am not as familiar with its configuration.  I can still easily hold down the option key to cho0se the partition to boot to, though I don’t want to do this each time going into OSX as I use it 90% of the time now.

Under system preferences I opened Startup Disk, unlocked it and selected the Macintosh HD drive (the only one in the list by the way as my external drive is disconnected).  I then clicked the restart button.

Hey, that worked, cool.  The MBP now boots to OSX on restart or power-up, nice.

I have always known Microsoft OS’s to be a bitch with boot partitions (thinking back to old Linux multi-boot systems I had).  It has just been a while since I have been bit by it and I guess in a way I would have hoped they would have improved on things a bit.

I have spent the last few months at work standardizing system builds and creating simple scripts and checklists to help maintain them.  As you may know this is a very labor-intensive way to go about things.  Its inability to scale is already showing strong even with the few dozen servers we manage.Pile of servers

Another pain point is the lower environments. The scripts are written for production.  Though I try to keep them as generic as possible, there are just things that aren’t generic, like bound IP’s.  So now that we are moving our standard build to all environments this is starting to shard our deployment processes.  Something I would like to avoid.

A logical step you may be screaming right now, is automation tools! Apply a deployment automation framework like Chef, Puppet or PowerShell DSC. I can’t disagree, but time is very limited and the first step toward a framework needs to be made carefully.

I knew from experience that automation will be needed, but I intentionally didn’t start there as what exactly needed to be automated or to what level wasn’t known. And for the most part this still isn’t fully known–and that’s okay.  That’s why whenever approaching such targets you do so in small iterations (batches) and review your progress continuously.

Instead of starting out coding the configuration of my server I started with a checklist of everything which goes into it.  I assume if I was a seasoned Chef user (for example), I may start with a Recipe and start defining my server that way, but I am not a seasoned Chef user, or puppet, orPowerShell DSC, or super-automater-X. I am an administrator who still follows checMorpheusklists and runs scripts to do much of my work, and I am drowning.  Time for the next step, time for an automation framework, but which to choose?

This is where the overwhelming part comes in as I try to determine which way to go in a world I know little about.  I understand the concepts and operation of these things, but I have no idea the effort required to implement one technology over the other, and which ones will work best in our environment.

Am I afraid to do some good old fashion research and testing?  No. I really don’t think so.  Time is such a factor now and none of this is supported by my mangement.  I am doing this because I know it needs to be done.  They wont buy into it until they know its a sure thing (sigh).  I would hate to spend a week digging into a solution to determine that it doesn’t work.  Well honestly, what is the problem with that?  It isn’t like I will not learn from it either way, if the path is successful or not. What I would really like is to know which is the most logical way to go for a Windows platform. A pros and cons list may even be a good start, as long as its written neutrally.

 

puppetlabs.com PowerShell getchef.com

 

Obviously PowerShell DSC is fully supported on windows. 😉  And the reading I have done on Chef and Puppet describes they support windows machines as well (Though neither list Server 2012).  PowerShell DSC is new and rough around the edges and both Chef an Puppet have been banged around for a while. But without learning each one and trying them out, how am I to know a logical path to go down.  Analysis paralysis anyone?

Have you gone down this path? Do you have some resources to suggest?

 

 

On and off for the last couple of months I have been learning Erlang.  My primary source for this is a decent booked named, “Learn You Some Erlang for Great Good!” (Fred Hebért, (c)2013 no starch press). What a great name, no starch press (:  I first found this tutorial online at http://learnyousomeerlang.com/.  The entire book is there, believe it or not.  I worked through the first few chapters and was hooked.  I decided to purchase the book to help pay for the work and for it to be more convenient to read.  But I digress, back to IIS & Mercurial.

Mercurial Logo

The whole reason for the Erlang digression is that I was going through examples in the book on different computers.  After I was done with the session I would have copy my practice files back to my home server, which was a pain on a disconnected Linux box.  To solve this, I figured, why not setup a repo at home.  I have been wanting to do this for a while anyhow.  Now I could setup an SVN repo in a few minutes, but I don’t really use SVN anymore (“It’s so 1990’s (:  ).  Mercurial is my DSCM of choice.  I have nothing against GIT, and do use it, I just regularly use Mercurial.

IIS7 logo

My home server is Microsoft Windows Home Server 2011.  Basically Windows 2008 R2 (IIS 7.5) with some other “stuff” thrown in.  Finding installations for a Mercurial server under Windows is not a simple task.  There are articles out there, most of them are old or incomplete.

This walk-through, http://www.jeremyskinner.co.uk/mercurial-on-iis7/ [Jeremy’s article], is good and walks well through the process.  Unfortunately it is out of date and doesn’t cover well what needs to be installed today to get this to work.  The first part of my pain as things weren’t working.  I am thankful for its explanation of adding CGI support in IIS7, something I haven’t needed to do in IIS7 before.  One thing this article mentions (in bold) is to use x86 installer of Python, even if your machine is 64-bit.  I believe this is no longer accurate as I installing 64-bit Mercurial and 64-bit Python and all is working fine.

For the start of my journey I was using this walk-through along with a few Mercurial wiki pages: http://mercurial.selenic.com/wiki/HgWebDirStepByStep and http://mercurial.selenic.com/wiki/PublishingRepositories.  I was understanding how the publishing works, but not getting things to work on my Windows server.  Mostly my error was around Python not being able to find hgweb stuff.  It was blowing up on application = hgweb(config), and said application undefined. The additional Mercurial installation I needed was located here: http://mercurial.selenic.com/wiki/Download#Windows which I found in a helpful wiki artical, http://mercurial.selenic.com/wiki/HgWebInIisOnWindows.  If you follow this article straight through, you will almost have a successful installation.  What I learned from this page is that the Python module installer needs to be run.  This adds Mercurial modules to Python.  Something which is needed and not specified in the other installation instructions.

If you don’t like the command line, the IIS configuration in the Mercurial wiki article is done through the command line.  You can reference how to do these through the UI using Jeremy’s article.

My suggestion after going though this, this morning is to use both articles.  Read through them first, before installing anything, then plan your attack and go for it. Oh and yeah, you’ll need to refer to the Publishing Repositories wiki page.

New hg site

A few things I learned from this morning’s adventures

  • Within the hgweb.config file the section [collections] is no longer needed, the section [paths] may be used instead.  There is more information around this here: http://mercurial.selenic.com/wiki/PublishingRepositories
  • Within hgweb.config a path of / = /path/to/repo/* will show (publish) all repositories.
  • Withing hgweb.config using allow_push = * allows any user to push to the repository. Using this settings negates the need to enable authentication on the web.  Yes this makes things insecure, but my setup is internal to my house only.

So sure this took a bunch of hours to figure out and get working correctly.  Though now it is working correctly and I have my working Mercurial repository like I have been wanting for some time. Plus I have learned a bunch of stuff too.  Perhaps I’ll go play a game now.

It has been a frustrating day for me.  I rarely use my eReader, though I am feeling really lost without it.  I guess the worst time to lose a book is while you are in the middle of it.

I am currently on my second Kindle. I purchased my first Kindle in June of 2011, a generation three w/ keyboard.  I used the reader off and on over the year, probably reading around a dozen books, maybe twenty tops.  This Kindle began locking up and would not power on any longer one day.  Working with support, the device was out of warranty and I was sold a new one for $50 or so.

I used this second Kindle to basically read the Harry Potter series all the way through and put it in a drawer, where is stat for around six months.  A few weeks ago when I went back to use the Kindle it wouldn’t power on.  It makes sense, I am sure the battery was drained.

I put the unit on charge overnight and was ready to go in the morning.  I looked at my book list, hey I have read all these already.  I put the Kindle down on the end table, where it sat for another two weeks.

Last week I located a teaser book I was interested in and sent it to my Kindle.  One night I sat down to read it, was completely consumed by it and purchased the full book when I got to the end.  I read for another four hours that night without issue.  It was 02:30 when I went to bed, what was I thinking?

The next day I started to read the book again.  At the fourth or fifth page turn my Kindle locked up! What? Really?  Come on.  Over the next couple of days, I went through all the typical crap to get it to work, including a factory reset.  I just slowly got worse and worse.

This morning I called Kindle support, and of course this Kindle is not under warranty.  I guess it only had 90 days warranty for some reason.  What you get when you buy a re-manufactured unit.

I really just want the Kindle to work, it doesn’t make sense why it doesn’t unless it is my electronics karma coming back to bite me.  20+ years of messing with electronics, computers, etc. I guess they are fighting back.  Just like the time I get around to paving my own computer and there are nothing but roadblocks along the way; but I digress.

Long and short, I am not going to get another Kindle.  The yearly failures have become like a service charge, and if I wanted that I would have my own Prime account.  So once Google decides what they are doing with the next Android version and release the refresh Nexus 7, I will purchase one of those and read from it, and surf, and leave it in a cafe somewhere… 🙂

All my main development machines are now running Visual Studio 2012.  I have a few new projects in VS2012 and have begun updating my old projects to it as well.  I ran into an annoying issue today that I need to post.

My Blog by Email site was built using VS2010 and ASP.NET MVC 3.  My new machine, which I am working on right now, is running Windows 8 and VS2012.  Recently a new user started using the site and discovered a few bugs I needed to get fixed.  I cloned the repo from Bitbucket and opened the solution in VS2012.

My first tip-off that there was an issue is when the Migration Report displayed 7 errors all on the _bin_deployableAssemblies\ folder.

BlogByEmail\_bin_deployableAssemblies\Microsoft.Web.Infrastructure.dll: Failed to backup file as C:\vsp2k12\BlogByEmail\Backup\BlogByEmail\_bin_deployableAssemblies\Microsoft.Web.Infrastructure.dll 
BlogByEmail\_bin_deployableAssemblies\System.Web.WebPages.Razor.dll: Failed to backup file as C:\vsp2k12\BlogByEmail\Backup\BlogByEmail\_bin_deployableAssemblies\System.Web.WebPages.Razor.dll  (... Plus 5 more files)

My second is when I went to run the project and the build failed for the same 7 files.

If you recall the _bin_deployeableAssemblies folder is used to aid in bin deploying MVC 3 applications to [shared] hosts which don’t have ASP.NET MVC 3 loaded.  You can read more about it here [@haacked.com].

It turns out this isn’t required in VS2012 as I found here :

Starting with MVC 3 Tools Update we are now using Nuget package references, which means that your project is automatically bin-deployable. Since the tooling gesture is no longer necessary it was removed from VS 11.

The fix here is really simple.  Remove the files and _bin_deployableAssemblies folder from your project.  Everything should compile just fine.

Now the one part I have not figured out is where or how we get the files that used to be in _bin_deployableAssemblies.  I don’t see them in the bin folder as I assumed they would be.  I will need to do some test deployments at my host, Arvixe (I think they didn’t have MVC 3 loaded).  Add a comment below if you h ave some knowledge around this.

After spending my Saturday getting my new Windows Home Server 2011 server setup just right (I am plowing and installing over WHS v1) I came to the realization that the workgroup is stuck at WORKGROUP.  Stuck you ask? Yes, stuck.  Since WHS2011 is using certificate services you can’t change the workgroup name through computer properties. Plus for some reason the setup wizards never asked.

I did come across a post that said you can press <alt>+<f10> at the computer name screen and set it, but I was way to far into my fourth load to start over again now (Yes I would have if I didn’t find this great little video).  Using PowerShell type in the following two lines of script.  Your workgroup name will be updated.  Remember no spaces etc.

$sysinfo = Get-WmiObject Win32_ComputerSystem
$sysinfo.JoinDomainOrWorkgroup("workgroupname")

Of course now that I am done, this shows up in search from TechNet: http://social.technet.microsoft.com/wiki/contents/articles/4127.how-to-change-a-workgroup-name-on-windows-home-server-2011-and-windows-storage-server-2011-r2-essentials-en-us.aspx

I am simply listing this that it may assist someone, I have no idea if this may break something on other systems. It worked for me very well, but I must express, use at your own risk.

Switch to use to conect to a Windows server console from various OS’s:

Remote Desktop (Vs. Client Connection Manager)

Windows XP < SP3

/console

Windows XP SP3

/admin

Window Vista [< sp1]

/Console

Windows Vista (Business) [sp1]

/admin

Windows 7

/admin

Windows Server 2003 (incl. R2) [sp2]

/console

Windows Server 2008

/admin

Note RDC 6.1 (6.0.6001) supports Remote Desktop Protocol (RDP) 6.1

http://blogs.msdn.com/rds/archive/2007/12/17/changes-to-remote-administration-in-windows-server-2008.aspx

Connects to the console session of a server

Connects you to the session for administering a server.

Why the heck don’t they just put a check box on the login form?

█ ███ ██████████ █ ████ ████████████ ██████████████████  ███████████████ ██████ ████████████████████   ███████   ██████ ████ ██████████ ███████████████████████

████████████████████ ████████ ████ ████ █████████ ███ ████ ████████ ████████████ ████ █████ ██████ ██████████ ██ ███ ████ ███████ ███ ████ ██ █████ ███ ███ █████ █████████ ███████████ █████████████████ █████ █ █ █ ████ ███ ████ ███ ██████ ████████████  ██████  ███████████ ███████ ███ ██████ ███ █████ ██ ████████████ █████ ██████ ███ █ ███████████ ███ ██ █████ ██ ████ ███ ██████ ███████████ █████ ███ ████████ █████ ███ ███████ ██████ █████ ██ ████ ████████ █████ █████ ███████ ██ ███████ ██ ████████ ████ ██████████ █████ ██████████████ █████████ ██████ █████ ███████████

████ █████ ████████ ████████████████ ███ ███████  █ █ █ ██ █████ ███████ ███████████ █████ ███ ██████ ██████████ █████████ ████████ ████████ ███ █████ ████████████

██ █████ ██████ █████████ ███████████ █████ █ ████ █████ ███ ███████ ████████ █████████████

█████ ███ ███████ █████████ ███████████ █ ███████ ██ ███████ ███ ██████  ██████ ██ ████████████

██████ ███ █ ███████ ███ ████████ ████████ █████ ██████ ██████ ███████ █████ ████ ████ ████ ██████ █████ ██ ████ ███████ ████ ██████ ███ ████ █████ ██████ ███████

██████ ██ ██ ██ ████ ███ ██████ ████ █████████ ███ █████ ███ ██████ █████ ████████ █████ ██████ █████ █████ ███ ███████ ██████ ████████████ ████████████████████████████████████████████████████████████████████████████ ███████ █████████ ██████ █ ███ ██ ██████████ ██████████ ███████████ █████████ ███████ ██████ ███ ███████ █████ █ █████ ████████████ ███████ ██████ ████ ██████████ ██████████████████ ██████████████████ ██████████████ ███████ ██████ ███ ████████ ████ ████████ ██ █████████ ██████ ████████████ ██████████████ █████████ ██████ ████ ██████

████████████ █████████████████ █████████████████████████ ███████████████ █████████████ ██████ ████████████████████████ █████████████████ █ ██████████

I just took the long silly way around to return a json result to  a page.  I kept trying to send a json string back as just that, a string and it just wouldn’t work.  Whenever JavaScript received the string it didn’t know what to do with it, except treat it as a string of course.  I banged my head against this one for too many hours.  Though my persistence payed off.

As the night got later (I think it’s 03:00 about now) I decided to figure out how others are returning json object from ASP.NET MVC.  It isn’t as simple as it should be, but not too difficult.  The biggest issue, as with much in MVC land is the huge lack of documentation.  So looking up something like JsonResult, yields a pretty useless help page.  So more time had to go into discovering on how to actually use this cool new result type.

It turns out you can set up and action with a return type of JsonResult (it’s usually ActionResult) and have that action return a json object.  I am not even going to pretend I can do this from other objects like json.net (from James Newton-King).  I am using this to return a model as json which populates my form with on-demand instructions.  This library rocks, but I digress.

The basic structure I used is a dictionary object

public JsonResult MyAction()
{
  Dictionary<string, string> dict = new Dictionary<string, string>();
  dict.Add("keya", "valuea");
  dict.Add("keyb", "valueb");
  return Json(dict);
}

That’s pretty much it in a nutshell.  Json() is a new web helper in MVC3.  You can find it at System.Web.Helpers.

I saw one example where you can build an object on the fly, but I couldn’t get it to work.  It basically looks like this:


//....
return Json(new {keya = valuea, keyb = valueb};

The dictionary generic works for now.  If you know of a better way, please let me know.

Twitter Updates

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: