Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Monday, February 20, 2006

...and that's because Oracle doesn't support booleans! I completely forgot about this and re-realized how unbelievably idiotic this is!!! AARGH! I'm porting code over that went against the ODBC drivers for Oracle (which must have done something special to allow booleans) to the raw Oracle provider (ODP.Net).


kick it on DotNetKicks.com
Monday, February 20, 2006 1:17:30 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback


Hari found a page full of cool ASP.Net articles here.


kick it on DotNetKicks.com
Monday, February 20, 2006 12:05:08 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback

 Sunday, February 19, 2006

...I found this article an interesting read. Whether you own a Mac or a PC you really should exercise a decent amount of caution when running programs, etc; I mean, it's just common sense. The thought that one operating system is somehow immune to virus attacks is idiotic.


kick it on DotNetKicks.com
Sunday, February 19, 2006 11:57:11 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback


http://www.microsoft.com/downloads/details.aspx?familyid=f22e51e5-b82e-4a54-9ccc-3418e0bf5639&displaylang=en


kick it on DotNetKicks.com
Sunday, February 19, 2006 11:22:12 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing
 Saturday, February 18, 2006

I encountered a user interface "problem" today. At work I have multiple monitors, and at home I only have the one on my machine (I own Dell 9300, and so it's my desktop at both places). As a result, sometimes when going back and forth between the multiple monitors and my single, I sometimes wind up with an app that'll draw itself OFF the desktop window when I suddenly fire it up on my single monitor (if I open the app, it'll show up, but like on some wacky negative x/y coordinate way off in la la land).

There's a way, apparently, to bring the window BACK onto my visible desktop through Alt-SPACE-M or something like that, but I couldn't get it to work for some odd reason. So I wrote an app that'll simply re-align all my desktop windows to the 0/0 x/y position. It's a rough hack because all I wanted was to get my app to draw its window in a sane position again - so, I wouldn't take the code as-is and use it wherever. It worked for me, and it was an interesting way to step back and realize "Man, I'm a geek".

using System;
using System.Collections.Generic;
using System.Text;

namespace StraightenWindows
{
    class Interop
    {
        public delegate System.Boolean EnumWindowsProc(
            System.IntPtr hWnd,
            System.Int32 lParam);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.Boolean EnumDesktopWindows(
            System.IntPtr hDesktop,
            Interop.EnumWindowsProc lpfn,
            System.Int32 lParam);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.Boolean IsWindow(System.IntPtr hWnd);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.Boolean IsWindowVisible(System.IntPtr hWnd);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.IntPtr GetParent(System.IntPtr hWnd);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.Int32 GetWindowText(
            System.IntPtr hWnd,
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPStr, SizeConst = 255)]
            System.Text.StringBuilder lpString,
            System.Int32 nMaxCount);
        [System.Runtime.InteropServices.DllImport("user32")]
        public static extern System.Boolean MoveWindow(
            System.IntPtr hWnd,
            System.Int32 x, System.Int32 y,
            System.Int32 nWidth, System.Int32 nHeight, System.Boolean bRepaint);
    }
    class Program
    {
        static System.Boolean EnumWindowsCallback(System.IntPtr hWnd, System.Int32 lParam)
        {
            // verify it's a window and it's visible
            if (Interop.IsWindow(hWnd) && Interop.IsWindowVisible(hWnd))
            {
                // verify it's a parent window
                if (Interop.GetParent(hWnd) == System.IntPtr.Zero)
                {
                    // the get parent can also return zero on error, so check for that condition.
                    if (System.Runtime.InteropServices.Marshal.GetLastWin32Error() == 0)
                    {
                        System.Text.StringBuilder sb = new StringBuilder(255);
                        if (Interop.GetWindowText(hWnd, sb, 255) > 0)
                        {
                            Console.WriteLine("Window " + hWnd.ToString() + " has text '" + sb.ToString() + "'");
                            Console.WriteLine();
                            Console.WriteLine();
                            // fix
                            Interop.MoveWindow(
                                hWnd,
                                0, 0, 500, 500, true);
                        }
                    }
                }
            }

           
            return true;
        }
        static void Main(string[] args)
        {
            Interop.EnumWindowsProc p = new Interop.EnumWindowsProc(EnumWindowsCallback);
            Interop.EnumDesktopWindows(System.IntPtr.Zero, // use current desktop
                p, 0);
            Console.Write("Press any key to continue...");
            Console.ReadKey();
            return;
        }
    }
}


kick it on DotNetKicks.com
Saturday, February 18, 2006 3:27:45 PM (Central Standard Time, UTC-06:00)  #    Comments [2] - Trackback
Computing | Personal Adventures

If you want the equivalent of SqlCacheDependency for your oracle databases, look at the OracleDependency class:

static void ListenerStart(System.Object p)
{
Oracle.DataAccess.Client.OracleConnection conn = null;
Oracle.DataAccess.Client.OracleDependency dep = null;
try
{
conn = new Oracle.DataAccess.Client.OracleConnection(connectionString);
conn.Open();
Oracle.DataAccess.Client.OracleCommand comm = conn.CreateCommand();
comm.CommandText = "select * from teset_e";
dep = new Oracle.DataAccess.Client.OracleDependency(comm, false, 50000, false);
dep.OnChange += new Oracle.DataAccess.Client.OnChangeEventHandler(dep_OnChange);
comm.ExecuteNonQuery();
// to prevent the objects from being collected (which I bet they will - I don't
// know for sure), we'll just spin in an idle loop forever.
for (; ; System.Threading.Thread.Sleep(1000)){}
}
catch (System.Threading.ThreadAbortException e)
{
// close the databases
if (conn != null)
conn.Close();
}
return;
}

static void dep_OnChange(object sender, Oracle.DataAccess.Client.OracleNotificationEventArgs eventArgs)
{
changeNoticed = true;
Console.WriteLine("Change noticed at " + System.DateTime.Now.ToString());
return;
}

Recommended reading:

kick it on DotNetKicks.com
Saturday, February 18, 2006 12:08:01 AM (Central Standard Time, UTC-06:00)  #    Comments [1] - Trackback
Computing | Database
 Friday, February 17, 2006

I have a philosophy on contracting that is shared by some, and not-so-shared by others; nonetheless it appears to be a rather successful one so I thought I'd share it right quick (this won't take too long).

The idea behind contracting work is that you are given a job because you are seen as a smart business move - not because you're somehow smarter. The important thing to remember here is that you are not considered technically better (more capable of user the computer, of learning, etc.) by any stretch of the imagination by the one cutting your check than anyone else on their internal team. What I mean by that statement is that, even though you are getting the job, you ought to consider that many people inside the team that's contracting you could also get the job done too. Even if they (those paying for you) don't see this, you ought to always think that way. What makes you valuable is:

1) Your autonomous capabilities,
2) Your one-time use and disposability,
3) Your speed,
4) Your knowledge/experience

Each one of these factors boils down to one simple thing: money. Given your autonomous nature, the people contracting to you expect that they can treat you as relatively hands off for small periods of time and that you are capable of using common sense to achieve goals with the rest of the team. Your contractee is expecting that you are not going to go "off into the weeds" all too often, that they won't have to babysit you, and that you'll be able to show results relatively fast. Your one-time use and exposability is important as those paying for you only have to be responsible for you during this particular project - they don't have to pay for health insurance, they don't have to worry about someone stealing you away - all in all you're seen as fairly low risk. These are important factors, but the most important are the last two that I mentioned: speed and expertise. You are, by the hopes of those buying you, a catalyst for the project - you are the molecule that, when snapped into the rest of the project, speeds the reactions and gets the thing done.

So, these are all kind of introductory thoughts - but what is my philosophy? My philosophy is that if you're getting paid to work at X dollars per hour, you ought to constantly judge your work by that rate; and so if you have a bad day, or you suddenly become an ignoramous about something and fail to get something done by your own internal clock - you charge less (in other words, you don't charge for the hours you spend screwing up, only those you spend doing something right). I'm an optimizer, I prefer to think in terms of how something can be done more effectively the next time around - and so I only charge for what I think I'M worth, and my judgement system is often a lot harsher than anyone else I've met. The result: less wack-off'ery and more focus as you suddenly tell yourself "I shouldn't just dork around on this project, because I'm only going to pay myself what I'm worth" - I find that every project I'm on I get to understand my limitations better, and gain a hell of a lot more focus and effeciency. I'm a huge fan of building into my environment certain external pressures and realities that keep me focused - reality doesn't waver (like an alarm clock), however we often do internally.

Another interesting side-effect of this philosophy is that my endeavor to understand things is highly restricted during 'contract mode'. Contracting is about application - you ought to be applying your talents when the stage lights are on, not uncovering technologies and learning how to use them: you are under the gun, and they aren't paying you to appease some inner demon (daemon?) to get to the bottom of things and figure out how they work. This reminds me of the days back in high school when I used to try out for honor bands - when I would audition, I would perform what I practiced; and I never asked myself, "Man, I wonder why Bach decided to use this particular chordal progression".

The reason some don't like this philosophy of mine too well is that, as contractors, we are here to make money - which often means hours (paid by the hour). The thing is, though, that you ought to look at the world four dimensionally (that is, by including time) and realize that,

1) You really don't want to be stuck on this one project forever,
2) They don't want you stuck on this one project forever

...basically, my theory is that if you get one job done well, there'll be more waiting for you. Don't try to suck all your money out of one project or look for that golden project - look for continuity instead (you can always get dropped, remember that).


kick it on DotNetKicks.com
Friday, February 17, 2006 2:20:32 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing | Ranting

Anyone ever hear of this?


kick it on DotNetKicks.com
Friday, February 17, 2006 1:32:57 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback

Computers Blogs - Blog Top Sites

Archive
<February 2006>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)