Meeting the needs of your business from a distance

Replacing Notepad on Vista

by Mark Shiffer 31. March 2009 14:36

I finally decided to give up on the built-in Windows Notepad (I know, I know, a long time coming). I decided to go with Notepad2, but quickly ran into a couple of issues with replacing the built-in notepad so that Notepad2 would come up in its place. Here’s what had to happen:

  1. Go to Windows\Notepad.exe, right click..Properties.
  2. Go to Security tab, click Advanced.
  3. Go to Owner tab..click Edit and select Administrators in “Change Owner to”. Click ok.
  4. Go to Permissions tab..click Edit and select Administrators..click Edit..check Allow/Full Control. Click ok.
  5. Repeat steps 1-4 for Windows\System32\Notepad.exe.
  6. Rename both Windows\Notepad.exe and Windows\System32\Notepad.exe to Notepad_Original.exe.
  7. Rename your desired notepad replace executable to Notepad.exe and copy the file to both Windows and Windows\System32.
  8. Ah, you thought you were done? No, no, no, now we need to take care of the pesky “The publisher could not be verified” dialog box that appears every time that you try to run Notepad.exe now.
  9. Run gpedit.msc.
  10. Go to User Configuration\Administrative Templates\Windows Components\Attachment Manager.
  11. Double-click “Inclusion list for moderate risk file types.
  12. On the setting tab, ensure that the Enabled radio button is checked.
  13. In the list of ‘moderate risk extensions’ type in notepad.exe. This is case-sensitive, so be sure that you have the correct name. A second option here is to just include all executables using *.exe.
    1. This policy setting allows you to configure the list of moderate risk file types. If the attachment is in the list of moderate risk file types and is from the restricted or Internet zone, Windows prompts the user before accessing the file. This inclusion list overrides the list of potentially high risk file types built into Windows and it takes precedence over the Low risk inclusion list but has a lower precedence than the High risk inclusion list (where an extension is listed in more than one inclusion list.)

Tags:

Issues | Tools

Blog Framework Update

by Mark Shiffer 29. March 2009 17:47

I updated my blogging framework this weekend. So, if anyone happens to notice any oddities I would appreciate it if you could let me know. I had to jump through a few hoops to get it to work again as it had been a while since I last updated and I have several customizations to the framework that I had to reapply, not to mention making sure all of the data stayed in tact.

Tags:

Issues

Default Gateway Address Missing

by Mark Shiffer 24. March 2009 02:34

I recently upgraded my DNS and DHCP server from Windows 2003 to Windows 2008. I pretty painless upgrade and I thought all of my settings and installed programs stayed in tact, but that was not the case.

First, I found that Cobian Backup would not run after the upgrade, so I had to uninstall and reinstall that. No big deal, then I noticed that as my IP leases were expiring my computers on the network were no longer receiving the default gateway address. They were getting IP addresses just fine, which gave them internal network access, but they could not reach the internet without the gateway address.

I checked the DHCP setting on the server and noticed that the 003 Router option was no longer set. Apparently that did not come over as part of the upgrade. In case this trips anyone else up, the setting can be found under Server Manager..Roles..DHCP Server..[your server]..IPv4..Server Options. Right click select Configure Options, then check 003 Router and add the IP address of your router.

Tags:

Issues

Google Moderator

by Mark Shiffer 23. March 2009 13:26

I ran across Google Moderator today, and liked it, in particular the “Take a Tip, Share a Tip”section of the site. For some light reading that may still prove useful, I would suggest it. They have sections for Home, Work, Finance, Shopping, and much more. Most of the tips provided are fairly obvious to me, especially in the finance area, but if you poke around long enough you’re liable to find something that can really help you.

Tags:

Websites

Technical Interview Questions

by Mark Shiffer 18. March 2009 15:02

I have been doing a lot of technical screenings and interviews lately (as the interviewer) and I am always looking for good questions to ask. I have been leaning against random technical questions lately, more toward questions that require coding and/or design work, but I still find some value in quizzing interviewees in different areas. Below is a list of some of my questions (colleagues also contributed to this list) and after that is a list that I recently ran across from Scott Hanselman

My Technical Interview Questions:

  • What is the difference between an element and an attribute in XML.
  • What is the difference between XSL and XPATH.
  • What are the two ways to read an XML Document? In .NET what are the classes that correspond to these methods?
  • Explain what JSON is. Compare it to XML.
  • Discuss reflection. Why would you use it? Why would you want to avoid it?
  • Explain how to make an asynchronous call in .NET and what are the potential threading issues?
  • Explain the CLR’s memory model.
  • Explain what an application domain is. How does it relate to a windows process? How does it relate to a windows thread?
  • Explain the difference between Monitors and WaitHandles.
  • What is the difference between a Mutex and a Semaphore.
  • Explain what a double-check lock is? What purpose does it server / why would you use it?
  • What types of state management are available in ASP.NET?
  • What types of session state management are available in ASP.NET?
  • Explain what AJAX is and why you might use it? What methods have you used to implement AJAX?
  • Explain MVC

My Coding Interview Questions:

  • Fizz/Buzz
  • Bin Packing Problem – Given a set of various sized weights Wi..Wn, pack the waits into identical sized containers of a certain capacity, C. First, design an algorithm where your primary concern is speed and your secondary concern is minimizing the number of containers used. Second, design an algorithm where your primary concern is minimizing the number of containers used and your secondary concern is maximizing speed.
  • Reverse a string
  • Find the most common character in a string
  • Find single integer that is not duplicated in an array of integers that contains duplicates for all other numbers
  • Write an IsAPrimeNumber method.

My Design Interview Questions:

  • Class design for a deck of cards
  • Class design for Monopoly
  • Class design for Animals

What Great .NET Developers Ought To Know – Scott Hanselman

Everyone who writes code

  • Describe the difference between a Thread and a Process?
  • What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
  • What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
  • What is the difference between an EXE and a DLL?
  • What is strong-typing versus weak-typing? Which is preferred? Why?
  • Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
  • What is a PID? How is it useful when troubleshooting a system?
  • How many processes can listen on a single TCP/IP port?
  • What is the GAC? What problem does it solve?

Mid-Level .NET Developer

  • Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
  • Describe what an Interface is and how it’s different from a Class.
  • What is Reflection?
  • What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
  • Are the type system represented by XmlSchema and the CLS isomorphic?
  • Conceptually, what is the difference between early-binding and late-binding?
  • Is using Assembly.Load a static reference or dynamic reference?
  • When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
  • What is an Asssembly Qualified Name? Is it a filename? How is it different?
  • Is this valid? Assembly.Load("foo.dll");
  • How is a strongly-named assembly different from one that isn’t strongly-named?
  • Can DateTimes be null?
  • What is the JIT? What is NGEN? What are limitations and benefits of each?
  • How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
  • What is the difference between Finalize() and Dispose()?
  • How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
  • What does this useful command line do? tasklist /m "mscor*"
  • What is the difference between in-proc and out-of-proc?
  • What technology enables out-of-proc communication in .NET?
  • When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

Senior Developers/Architects

  • What’s wrong with a line like this? DateTime.Parse(myString);
  • What are PDBs? Where must they be located for debugging to work?
  • What is cyclomatic complexity and why is it important?
  • Write a standard lock() plus “double check” to create a critical section around a variable access.
  • What is FullTrust? Do GAC’ed assemblies have FullTrust?
  • What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
  • What does this do? gacutil /l | find /i "Corillian"
  • What does this do? sn -t foo.dll
  • What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
  • Contrast OOP and SOA. What are tenets of each?
  • How does the XmlSerializer work? What ACL permissions does a process using it require?
  • Why is catch(Exception) almost always a bad idea?
  • What is the difference between Debug.Write and Trace.Write? When should each be used?
  • What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
  • Does JITting occur per-assembly or per-method? How does this affect the working set?
  • Contrast the use of an abstract base class against an interface?
  • What is the difference between a.Equals(b) and a == b?
  • In the context of a comparison, what is object identity versus object equivalence?
  • How would one do a deep copy in .NET?
  • Explain current thinking around IClonable.
  • What is boxing?
  • Is string a value type or a reference type?
  • What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
  • Why are out parameters a bad idea in .NET? Are they?
  • Can attributes be placed on specific parameters to a method? Why is this useful?

C# Component Developers

  • Juxtapose the use of override with new. What is shadowing?
  • Explain the use of virtual, sealed, override, and abstract.
  • Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
  • Explain the differences between public, protected, private and internal.
  • What benefit do you get from using a Primary Interop Assembly (PIA)?
  • By what mechanism does NUnit know what methods to test?
  • What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
  • What is the difference between typeof(foo) and myFoo.GetType()?
  • Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
  • What is this? Can this be used within a static method?

ASP.NET (UI) Developers

  • Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick.
  • What is a PostBack?
  • What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState?
  • What is the <machinekey> element and what two ASP.NET technologies is it used for?
  • What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each?
  • What is Web Gardening? How would using it affect a design?
  • Given one ASP.NET application, how many application objects does it have on a single proc box? A dual? A dual with Web Gardening enabled? How would this affect a design?
  • Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET?
  • Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad?
  • Give an example of how using an HttpHandler could simplify an existing design that serves Check Images from an .aspx page.
  • What kinds of events can an HttpModule subscribe to? What influence can they have on an implementation? What can be done without recompiling the ASP.NET Application?
  • Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET.
  • Explain how cookies work. Give an example of Cookie abuse.
  • Explain the importance of HttpRequest.ValidateInput()?
  • What kind of data is passed via HTTP Headers?
  • Juxtapose the HTTP verbs GET and POST. What is HEAD?
  • Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting client.
  • How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?
    Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader.
  • How does VaryByCustom work?
  • How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page.aspx?q=5)?

Developers using XML

  • What is the purpose of XML Namespaces?
  • When is the DOM appropriate for use? When is it not? Are there size limitations?
  • What is the WS-I Basic Profile and why is it important?
  • Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace.
  • What is the one fundamental difference between Elements and Attributes?
  • What is the difference between Well-Formed XML and Valid XML?
  • How would you validate XML using .NET?
  • Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
  • Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
  • What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other.
  • What is the difference between an XML "Fragment" and an XML "Document."
  • What does it meant to say “the canonical” form of XML?
  • Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
  • Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?
  • Does System.Xml support DTDs? How?
  • Can any XML Schema be represented as an object graph? Vice versa?

Tags:

Programming

cURL

by Mark Shiffer 17. March 2009 16:26

cURL is the name of the project. The name is a play on 'Client for URLs',
originally with URL spelled in uppercase to make it obvious it deals with
URLs. The fact it can also be pronounced 'see URL' also helped, it works as
an abbreviation for "Client URL Request Library" or why not the recursive
version: "Curl URL Request Library".


The cURL project produces two products:
libcurl
A free and easy-to-use client-side URL transfer library, supporting FTP,
FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE, LDAP and LDAPS.
libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading,
kerberos, HTTP form based upload, proxies, cookies, user+password
authentication, file transfer resume, http proxy tunneling and more!
libcurl is highly portable, it builds and works identically on numerous
platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX,
IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac
OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more...
libcurl is free, thread-safe, IPv6 compatible, feature rich, well
supported and fast.


curl
A command line tool for getting or sending files using URL syntax.
Since curl uses libcurl, it supports a range of common Internet protocols,
currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, LDAPS,
DICT, TELNET and FILE.

Tags:

Programming | Tools | Websites

Some Solar Energy Resources

by Mark Shiffer 17. March 2009 14:47

The following websites can help you calculate the solar potential of your property and determine whether installing solar panels is a viable idea for your situation:

National Renewable Energy Laboratory

RoofRay

Tags:

Freelance/Consulting Websites

by Mark Shiffer 10. March 2009 17:51

I copied this quick comparison of consulting websites from another blog here. I have used some of this sites in the past, both to obtain work and to distribute work. I copied here for future reference.

  Elance.com Guru.com oDesk.com RentACoder.com
php projects 1831 271 887 425
Technical Writing projects 18 89 42 51
Sales & Marketing projects 302 127 No category 147
Alexa rank (lower is better) 4960 14833 13768 18859
Free option Yes - limited bidding Yes - higher fee on jobs Yes Yes
Fee 6.75% to 8.75% based on volume 10% for free membership level. 5% for premier level. 10% 15% or $3 minimum. Lower rates for direct payments and bonuses.
Premier Membership Fee $9.95/Month. Up to 20 bids (up from 3). Up to 2% fee discount $29.95-$99.95/quarter depending on field for each subject area (profile). 50% off for annual membership None None
Limit on bids 3 for free level/mo. 20 for premier. Fees for additional bids 10 for free level/mo. 100 for premier. Fees for additional bids None None
Dispute Resolution When Escrow service is used When Escrow service is used Hourly jobs only Yes
Escrow service Yes Yes Hourly jobs only Yes
Online tests & certifications Yes No Yes No

And some additional sites from another post that I read:

1. All Dev Jobs
Mainly web development projects.

2. Authentic Jobs
A fairly active job board that attracts some great project postings.

3. Freelance Switch
The freelance switch job board is very active, and contains a wide range of development jobs. There is a catch though: It costs $7 a month to reply to any of the postings.

4. Javascript Ninja Jobs
This is a job board for freelance javascript jobs from John Resig, the author of the jQuery library.

5. MetaFilter Jobs
Freelance development projects, mostly consisting of web and mobile application development.

6. No Agencies Please
Primarily a site for UK based work, but there are lots of remote projects. Includes a whole range of different development projects, and isn’t just limited to web development.

7. Programmer Meet Designer
A site that aims to introduce programmers to designers. Many of the projects that get listed are for skills exchanges (eg. you code my site I’ll design yours. There are occasionally paid jobs though, so it’s worth checking the site every so often.

8. Search Web Jobs
Lots of web development jobs, primarily involving CSS, HTML, PHP and MySQL.

9. Smashing Jobs
The job board of the online web development magazine.

10. Web Directions Jobs
Web development jobs. Mostly PHP and Javascript.

11. Plasis Jobs
Plasis Jobs aggregates freelance development jobs from 8 of the above 10 sites, so instead of having to check lots of different sites everyday to make sure you don’t miss out on a great new project you only need to check one! It also filters the jobs so that only freelance development jobs are shown, rather than full time jobs, or jobs for designers.

Tags:

Graphics | Programming

Prevent Duplicate Extension Method Signatures

by Mark Shiffer 9. March 2009 17:17

There are pluses and minuses to the use of Extension Methods as implemented by the Microsoft. Per there own guidelines Microsoft recommends to implement extension methods sparingly and only when you have to. Whenever possible, client code that must extend an existing type should do so via inheritance or other means.

That being said, one of the issues that I have with Extension Methods is that they compile fine even when the signature matches that of the base class it is extending. In this scenario, the extension method will never be called. In my opinion this should be a compiler error, thus I have created a Code Analysis rule to prevent extension methods that have the same signature as a method on the class it is extending. Here is a link to it: MSSWC.CodeAnalysis.MaintainabilityRules

To install this rule, simply copy the dll into your FxCop\Rules folder. Here is the source for the rule if you want to do your own spin on it:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.FxCop.Sdk;
using System.Runtime.CompilerServices;
using System.Reflection;
 
namespace MSSWC.CodeAnalysis.MaintainabilityRules
{
    /// <summary>
    /// Generate warning/error when method signature of an extension method matches one that already exists on the 
    /// base class.
    /// </summary>
    internal sealed class DoNotDuplicateBaseClassMethodSignatureInExtensionMethod : MaintainabilityRule
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DoNotDuplicateBaseClassMethodSignatureInExtensionMethod"/> class.
        /// </summary>
        public DoNotDuplicateBaseClassMethodSignatureInExtensionMethod()
            : base("DoNotDuplicateBaseClassMethodSignatureInExtensionMethod")
        {
 
        }
 
        /// <summary>
        /// Members has an attribute of the given type.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="typeToCheck">The type to check.</param>
        /// <returns>True if member has an attribute of typeToCheck</returns>
        private static bool MemberHasAttribute(Member member, Type typeToCheck)
        {
            foreach (AttributeNode attrib in member.Attributes)
            {
                if (attrib.Type.FullName == typeToCheck.FullName)
                {
                    return true;
                }
            }
 
            return false;
        }
 
 
        /// <summary>
        /// Returns whether the baseType has a method signature that matches the passed in methodSignature.
        /// </summary>
        /// <param name="baseType">Type of the base.</param>
        /// <param name="methodSignature">The method signature.</param>
        /// <returns>True if baseType has a method signature that matches methodSignature.</returns>
        private static bool TypeHasMethodSignature(TypeNode baseType, string methodSignature)
        {
            var result = from m in baseType.Members
                         where m.FullName == methodSignature
                         select m.FullName;
 
            return result.Count() > 0;
        }
 
        /// <summary>
        /// Checks the specified member for problems.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <returns></returns>
        public override ProblemCollection Check(Member member)
        {
            Method method = member as Method;
            if (method != null)
            {
                if (MemberHasAttribute(member, typeof(ExtensionAttribute)))
                {
                    // Get first parameter's type which is the type that we are extending
                    TypeNode node = method.Parameters[0].Type;
 
                    // build array of the parameters for the extension method
                    string parameters = "";
 
                    for (int i = 1; i < method.Parameters.Count; i++)
                    {
                        parameters += method.Parameters[i].Type.FullName + ",";
                    }
 
                    parameters = parameters.Trim(',');
 
                    // build method signature string
                    string methodSignature = node.FullName + "." + member.Name.Name;
                    if (!string.IsNullOrEmpty(parameters))
                    {
                        methodSignature += "(" + parameters + ")";
                    }
 
                    // ensure method signature does not already exist on base class
                    if (TypeHasMethodSignature(node, methodSignature))
                    {
                        Resolution resolution = GetNamedResolution("Default", 
                            new object[] { member.FullName, methodSignature });
 
                        Problems.Add(new Problem(resolution, method.SourceContext));
                    }
                }
            }
 
            return Problems;
        }
    }
}

Tags:

Programming | Tools

Copyright © 2001-2012 MS Consulting, Inc. All Rights Reserved.