MS Access Query Truncation Problem

There’s been a small change to the way MS Access works from the ’97 to the 2010 version that can cause some serious issues.

Consider this query “Select * From Table1” . What happens? In both versions, it will run just fine. However, when importing this command through any database connection, say OLEDB, it won’t work. Instead, what’s fed into 2010 is “able1”.

What’s happening? For database connections, table names are required to be square-bracketed. A simple fix.

Just use “Select * From [Table1]” instead.

Advertisements

SQL Sproc Gotcha

It’s easy to mistake the SQL Sproc syntax

ALTER PROCEDURE [dbo].[fooBar]
(
)
AS
-- etc
RETURN  @Success

With this. Note the BEGIN and END statements. It generally works for shorter queries, but for longer ones, you begin to get baffling SQL syntax queries, where sometimes it will execute the ALTER PROCEDURE, but things like changing the whitespace, reverting it, and executing it again will fail.

ALTER PROCEDURE [dbo].[fooBar]
(
)
AS
BEGIN
-- etc
RETURN  @Success
END

Contracting: Tales of Being Short A Project Manager

Dipping your toes in

As a young developer growing up, it’s easy to take all kinds of things for granted. For example, a testing and production environment that aren’t close, but instead, exactly the same. The ability to ask for a copy of Visual Studio without balking at it’s price in sticker-shock. Or a dedicated tester.

It’s easy to get caught up browsing through contracting websites and fancy being a solo contractor on your spare time. You forget to consider how tired you actually are when you drag yourself home from your real job, how much time it really takes to do the dishes, how much of a procrastinator you are, and even possibly how you’ll drop near everything to be immersed in the latest Elder Scrolls game. Instead, you wrap your head around how much money you think you’ll make in your spare time doing what you already love.

You enthusiastically tell your friends who give a shrug, explain to your Uncle Fred how it isn’t a get rich scheme,  try to unconvince your un-computer-savvy Aunt Bethelida to learn programming just so they can try it too, and ward off concerns from family members who believe that because your contracting involves a computer, it is a demonic form of giraffe-sacrifice and should be shut down immediately.  Perhaps you manage to get excellent advice from all your buddies who dipped their toes in, and possibly you even find some templates for things like contracts, invoices, and various other communications. You feel disappointed at the back-and-forth between you, your friends’ friends’ lawyer, your client, their boss, their HR department, and their accounting department that takes months before the final, final contract is sent, looking much different than what you had expected. And if you’re like me, you succumbed to your human tenancy to skim and well… just shot yourself in the foot. Multiple times.

Baited and hooked

All sorts of questions arise like, how does the signature dates affect the dates already written on the contract’s staticly-dated timeline? Does that mean that you really only have a few days to deliver item X or that it is even, that it is already overdue? How exactly will payments come? And when will they come, since it’s been months since task X and your client’s manager’s manager is preoccupied. Suddenly, you realize that depending on the terms of your contract and employment, you may are actually making 30% less of your revenue due to taxes – and the fines for not paying them, because ignorance is no excuse. And what about health care, benefits, sick and vacation days, hm…

But, if you’re like me, that’s only the tip of the iceberg of why you miss your project manager to death.

No matter how good you think you are with client relations, you always seem to wonder if you worded things correctly for such an important legal matter. Is it too bossy? Is it even correct? Does it abide by the contract? There’s no second pair of eyes to do it, and you’ll be the one answering all the questions, inquiries, papers, forms, nonconstructive criticism, and time sheets.

You now manage your own schedule, which in some ways is nice, but in others, you miss that gentle reminder to get back to work when you find yourself engrossed in the latest TV series, and then even procrastinating with re-runs.

You begin your work and perhaps you find the lack of office noise enthralling, but at the same time, you miss the occasional passerby’s surely prying eyes which kept you working, out of fear they’d discover your love for FarmVille. If you’re like me, you find that programming on your couch, on your porch, and even in a coffee shop is enlightening. But when you make a mistake, you have no one to blame but yourself. When you short sight something, it’s your own fault. When you misunderstand, over budget, or encounter scope creep, everything falls on your lap. Where a project manager might help you keep a clear perspective on things, manage that creeping scope caterpillar, and lessen the blow of your own shortcomings, you have no one. Of course, it never was the project manager’s fault for any of these things, and you probably knew that already, but they kept it all under wraps and off your shoulders.

But what you really, really miss is what your project manager did best – sitting down with the clients and figuring out what they are asking, what they really mean, what they really need, what fits under the budget, the easiest way to do it, and what they will ask for later. As a self-contractor, you get stuck commuting or telecommuting to your client’s sites, map in hand, and wondering how to put your gas on the bill. You feel helpless as you wait for everyone to be available for the meeting even though it was extensively planned, while wading through all the wary, suspicious glances of you as an outside. You got lost in the building. You forgot a paper. You just now realize your only pen doesn’t work. You parked where you’re weren’t supposed to,. And you come home eight hours later in rush-hour freeway traffic feeling overwhelmed, and with a notebook full of your own notes that you can’t decipher.

In your communications, you feel helplessly lost as terms like ‘database’, ‘software’, ‘on-line’, ‘desktop’, ‘excel’, and ‘report’ are interchangeably used. But you can’t blame your clients, you created your software to be so seamless and easy that they didn’t have to worry about those terms. When you ask for an explanation of their request, they can only repeat the same vague request, that in your mind means “change everything“. You ask for an example and receive a squiggle comparable to Jack’s attempt to request ‘Chipotle’ If you’re lucky, you stumble onto the approach of providing the entire product, asking them to point to a specific thing, and tell you “make this X a Y”.

Contracting: When it’s worth it

If you’re like me, you find yourself looking at the video games, new computers, plasma television sets, and imagining being able to afford it all along with a pair of working prescription eye glasses. But at the end of the day, you pay your bills, and settle in for a Redbox movie and McDonalds Dollar Menu item, paid mostly in pennies. Your quality of life is really no different than it was before.

Contracting is a lot of work and requires a lot of know-how, and not just the technical kind. But between all the stress headaches and deadline midnight latte’s, if you enjoy what you do and who you do it for, it’s worth it. So, if you’re considering contracting as a beginner, don’t tease yourself with fictitious dollar signs and dreams of a sixth computer. Be realistic, expect your money ten tames later than you imagined, and consider setting some extra cash aside for that inevitable life emergency that will occur until then – say, an accident, a sprained ankle, or an embarrassing trip to the vet because your dog likes their squeaky ball a little too much.

A special thank you to J.H,, MBA and D.W.

ASP.NET Connecting to an (LDAP) Active Directory Server

There are many things that you can do with an Active Directory (AD) server – query users, groups, and so on. It can also be used instead of Windows Authentication, and usually will bypass any username/password logon boxes for non-IE browsers. For my purposes, I need to figure out if user X is in group Y.

Here’s what I have:

        public static Boolean isHealthServices(String username)
        {
            bool isInRole = false;
            String domainname = "something.org";
            String conProperties = "CN=Users,DC=something";
            String domainqueryusername = "username";
            String domainqueryuserpwd = "password";
            String group = "CN=GroupY";
            using (var ctx = new PrincipalContext(ContextType.Domain, domainname, conProperties, domainqueryusername, domainqueryuserpwd))
            {
                using (var grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, group))
                {
                    isInRole = grp != null && grp.GetMembers(true).Any(m => m.SamAccountName ==  username);
                }
            }
            return isInRole;
        }

But, I encounter lots of errors.

The Server Could Not Be Contacted

As it says, it really can’t even find the server. The first thing to do is doublecheck your domainname. Next, check the properties that you are using.

There Is No Such Object On The Server

Your connection properties are wrong. I found that this tool, BeaverTail, is especially useful for figuring out where you are going wrong. You can traverse the LDAP server as ASP.NET would (especially since it is written in C#). The tool is free.

A Referral Was Returned From The Server

Make sure that you prefix the username with the domain. For example “GLaDOS\bob” .

This can also occur if your connection properties aren’t traversing to the correct place. Check the properties that you are using.

A Local Error Has Occurred

This can occur if you used a “/” instead of a “\” in the username. (Note that ASP.NET uses “\” as it’s escape character so “\\” will accomplish this).

An Operations Error Occurred

This one is related to permissions. You’ll want to look into your IIS settings, asp.net user account permissions, and impersonation in your web.config file.

10 Ways To Make Your Project Fail

Not Understanding The Problem

There’s nothing that can hinder your entire application than not understanding the problem or process at hand. And this is nearly guaranteed to happen unless you’ve sit down and done said process yourself by hand. If you don’t understand the problem, then your users aren’t going to be able to understand your application.

It’s Ugly

Aesthetics are important! If your clients don’t like the way the application looks, they already feel they won’t like using it, either.

Poor UI

In my own opinion, the UI is one of the most important aspects of a program. Asking for unnecessary information, not prepopulating data, not telling the user what it is they are doing, textboxes in random places, … ; the list of terrible things to do goes on and on. Only experience, and lots of books and examples, can give you a feel for how to do it right. But the bottom line is: it has to enable the user to be as lazy as possible.

Poor Coding

While there’s a certain stigma that programmers should always write good and clean code, only the experienced ones do. It takes many, many mistakes to finally become ingrained that poor code only leads to more bugs, more headaches, less readability, and slower programming. Refactor and bug hunt as you go along rather than saving it for a proverbial single day when you aren’t too busy.

No Contracts

Clients are well known for putting you in trouble spots, and fast. Scope creep, deadlines, price negotiations, bugs, taxes, … For any contract worth as much as a lawyer consultation, it’s worth it to spend that extra time and money. Especially when there are multiple people working on the project.

Saying Yes To Everything

Even if you have a contract, it’s still all to easy to fall into the pit of wanting to be a people pleaser and saying ‘Yes’ to everything. You absolutely must stick to your guns and the terms of the contract. Make sure you have defined exactly what you will and won’t do in terms of bugs, feature requests, changes, additions, deletions, etc.

Poor Client Communication

It’s extremely important to keep your clients informed on how their project is doing. Whether things are going smoothly, poorly, or you just don’t know, make sure to remain perfectly transparent. Make sure your clients understands exactly what you are doing (to a reasonable level) and where their money is going. This fosters a sense of trust and an overall better project. A good rule of thumb is to respond to any email within 24 hours, even if it’s to say that you need more time to formulate the answer. Consider a live timesheet or bug tracking application so your client can keep tabs at a glance and when they choose.

No Tester

Not having a tester nearly guarantees that bugs will be found. It’s simply insane to demand that a programmer catch all of his own bugs, because after looking at it for X hours, things are going to skirt by unnoticed. Even if you do have a tester, some things may not be caught, but your software will definitely be in better conditions with one.

No Backups

Harddrives can, do, and will fail at the worst possible second. It is simply not acceptable to store all of your project on one medium and expect it to always be grand. Make sure you have backups, whether they are offloaded to a different server, website, cloud storage, or even your flash drive.

You

You yourself have the greatest bearing on your project because you directly influence it. Perhaps you just can’t motivate yourself to start until the night before it is due. Perhaps you didn’t realize that you were in over your head. Perhaps you didn’t give yourself enough time to account for family emergencies. Whatever the problem, you need to be prepared and capable of combating your own weaknesses, whether it is incompetence or burn out.

The Problem With Firefox’s New Release Schedule

Firefox has been known for its excellence over IE. Not only that, but it has been writing the book on standard browser functionality when it came to tabs, tab snapping, skins, plug-ins, extensions, and the search bar.

With Firefox’s announcement to begin a more rapid release schedule, some rejoice in the company becoming more “corporate like” by following in Microsoft’s footsteps. I still hold my skepticism.

One major concern is that browser add-ons are extremely popular – and for some, a big factor in adoption rate. However, the new schedule means that your plugins won’t work very often, or for very long. Many plug-in developers release a drive-by application, not bargaining to babysit their plug-in through each of Firefox’s releases. In fact, Mozilla could begin to loose it’s developers because of this, programmers may seek a platform that supports backwards-compatibility.