Posts

Showing posts from August, 2011

ChatGPT - How Long Till They Realize I’m a Robot?

Image
I tried it first on December 2nd... ...and slowly the meaning of it started to sink in. It's January 1st and as the new year begins, my future has never felt so hazy. It helps me write code. At my new company I'm writing golang, which is new for me, and one day on a whim I think "hmmm maybe ChatGPT will give me some ideas about the library I need to use." Lo-and-behold it knew the library. It wrote example code. It explained each section in just enough detail. I'm excited....It assists my users. I got a question about Dockerfiles in my teams oncall channel. "Hmmm I don't know the answer to this either"....ChatGPT did. It knew the commands to run. It knew details of how it worked. It explained it better and faster than I could have. Now I'm nervous....It writes my code for me. Now I'm hearing how great Github Copilot is - and it's built by OpenAI too...ok I guess I should give it a shot. I install it, and within minutes it'

Deploy an ASP.NET MVC 2 Web site on IIS 6.0

Image
Hey sports fans! Today I was given the task of deploying my web site to my development machine. With MVC 2 plugged-in to Visual Studio 2008, it should have been a cinch (with VS2010 and IIS7, it IS), but I ran into some roadblocks I thought I'd blog about. So all I thought I would have to do is right click the ASP.NET project in the solution explorer while the solution was open in Visual Studio, and click publish, and then specify the directory to publish it to. Visual Studio was supposed to do the rest. But ACTUALLY it was much tougher. First I had to open the properties of the ASP.NET project, and go to the "Web" tab, and set it to run on an IIS server instead of a development server. THEN I took the step of right clicking the project and (publish...)ing it. But everytime I tried to navigate to http://localhost/ it would give me a weird error saying the directory was inaccessible. The problem was that IIS had no mapping for paths without extensions. you see

Rate my design

Image
Yesterday I worked on refactoring one of the components in my ASP.NET MVC2 project. If anybody's reading and knows anything about software, I'd be glad to have your feedback on the design. The controller handles all the logic, taking requests from the web and processing/delivering the response. My models are basically just data-transfer objects, and the Views are each strongly typed to a model, so that it can access values given by the controller. There are 3 different types of views, one inside the other. The outermost view is not type cast to any model, it just calls some javascript that asynchronously loads _ServerView views into a div element. The _ServerView's are strongly-typed to ServerModel's. The _ServiceView holds the smallest bit of information, and they're loaded one-by-one for each _ServerView. The _ServiceView is type cast to a ServiceModel. Using this structure, we can have any number of _ServerView views on a page, and any number of _Ser

Models, Views and Controllers

Image
The MVC design pattern is one of the most widely used design patterns around, but it's talked about so much by experienced developers that sometimes noobs can get mislead as to the meaning and purpose of it. So here's an overview of the design pattern and what it's parts are for. We'll start with a high-level flow of events: 1.) The user interacts with the user interface, which sends a message to the controller. 2.) The controller receives the message, converts it into a form that the Model can understand and interact with, and then sends it to the Model. 3.) The Model accepts the new information, and makes changes to it's own state reflecting the new information that it's just received. 4.) The view detects the changes in the Model, and updates itself accordingly. 5.) Repeat 1 - 4. This is very high level and can change a little with every implementation, but the overlying theme and idea is there. Also, the way in which the view detects the chang

Connecting to an API written in C from C#

The last couple of days have been trying for me at work. Fortunately, I learned something. I was working on an application that needed to connect to a 3rd party API that was originally written in C - like a billion years ago. There was good documentation on the software, but in order to connect to it in C#, I had to go online and find out how from somewhere else. So here's what you do: First, make sure the API was installed on your system, so that the dll's are registered in the GAC. Second, start a new project in C#, and create a new class. Make sure to import "System.Runtime.InteropServices". At the top of the class definition, do something like this: [DllImport("User32.dll")] public static extern int MessageBox(int h, string m, string c, int type); Now, you'll have to know the signature of the methods you want to use from the API first. Anyway, once you declare that the function you want to use is defined externally, and you've t

TryRuby today!

Evening code fans. I'm making some progress on a software system that I'm building at work, and I've started to enjoy the process of finding a problem, creating a solution, and writing code to represent what I've come up with. But now I wanna try something new... I've been hearing a lot about Ruby on Rails in recent times, and I'm highly interested in it at this point. For those of you who don't know, Ruby is an object oriented programming language, but it's different from Java and C# in that it's a scripting language, so it doesn't get compiled down to machine code before it's run. "Rails" is a framework written for the Ruby language that makes it ridiculously easy to create websites in a Model-View-Controller sorta way. Just to get a basic web server up and running requires only 2 super simple commands on the command line! A Rails webpage differs from ASP.NET MVC (the stuff I'm using at work) in that it doesn't r