Archive

Posts Tagged ‘Coding’

Excel VBA macro – removing blank rows from table

August 5th, 2009 Paul No comments

news

I know not too many people are coding VBA macros, however if you think about it automating office tasks can be a good way to help business people.  I can tell you that most coders will not touch it thinking that users should be able to do this themselves, most users will not be able to do this, simply because you need to actually write the code.  I can tell you that knowing VBA earned me a pretty coin, and trust me, this is not too hard to learn. 

Here is an example of how to remove all blank rows from a table in excel:

Read more…

Categories: Code Samples Tags: ,

New (at least for me) IO functions.

June 30th, 2009 Paul No comments

embarrassing

Well, live and learn. This was an interesting day. I am working on a little project right now, can’t really discuss details, and quite frankly it is nothing that I am going to be too proud of once it is done. But this is not the point. I had to do some minor IO work with this and this is when I found that instead of doing stuff like:

  |  copy code |? 
01
02
 
03
_fsCFileStream = new FileStream(sFileName, FileMode.Open, System.IO.FileAccess.Read);
04
_srStreamReader = new StreamReader(_fsCfMCCSV, Encoding.GetEncoding(1252));
05
 
06
try
07
{
08
    if ((sLineIn = _srCfMCCSV.ReadLine()) == null)
09
        //do stuff here
10
}catch(){}
11

I can simply do
  |  copy code |? 
1
2
File.ReadAllLines();
3

I guess I was stuck on .Net 1.3 for so long, I completely skipped 2.x and now 3.5 is full of surprises. I know I am behind times, need to catch up soon. Gone to do some reading.

Categories: Coding Tags: , , ,

Codeigniter – I like PHP again!

June 11th, 2009 Paul 19 comments

jumping

In the last few years my focus was on .Net, I love C# with all my heart(my wife does not read this blog, so I am free to say that). It is the language that is structured enough and at the same time powerful and flexible. There have been many advances in .Net, WPF and MVC are exactly what was needed by the development community. Although there are still issues with .Net that have to be resolved, I feel that the framework itself is on the right track. With all my love for .Net I have forgotten about one of the languages that I had started my coding with – PHP.

One of the greatest advantages of .Net as to compare to scripting languages like PHP is ability to really trace the code diving into smallest details. I have hard time imagining debugging something without ability to “watch” the variables that I am working on. Visual Studio is a very well written IDE, I can’t even think of an IDE that comes close to VS, so I got spoiled by all this luxury, until a week ago my boss came up with a project that required use of PHP.

I decided to take on the project myself, wanted to refresh the stuff I knew about PHP and all that. By saying that I would be taking on this myself, I mean the back end, after all my designing skills are very limited and I had given up on creating nice UI long time ago. Will, the UI dude would be making this thing look nice. So after accepting the project, I had started reading on what is going on with PHP, and guess what, there have been some incredible things that were released since I last worked on PHP. Which should not be a surprise, progress can’t be stopped, just me with my deep submersion into .Net stayed completely oblivious to this part of coding. This is how I found Codeigniter.

Now, nobody is paying me for this (I wish someone did), so this is an honest plug of the framework that was done so well, I had coded that silly file sharing thingy that my boss wanted in about 3 days. Keep in mind, this was just the back end, now Will is goofing around with design, and I am sure he will do great, as usual. I found that Codeigniter made my work so much easier. Great documentation is written for the framework, there is a forum and even an IRC channel. To me, this represented a great change from the wild days of my PHP coding. I would recommend Codeigniter to everyone who is interested in doing work with PHP quickly.

Other great things I used on this project – Aptana Studio (excellent IDE, still have not figured out how to use that build in Subversion plugin) and WAMP.

Categories: Coding Tags: ,

Firefox as development platform?

May 28th, 2009 Paul 4 comments

gears

FireFox has been my browser of choice for quite some time. I am the kind of guy who likes customization. There is a certain ways my computer has to be set up, its just the kind of person I am. Perhaps for me the most important feature of FireFox would be plug-ins. This is the best tool for customization of your browser. Now, I have been impressed with newest Internet Explorer, add-ons are step in the right direction, but at this point there are no add-ons to help with coding, but when it comes to FireFox, well, let me just list some:

Most obvious - Web Developer – lets just say that this is a must have if you are coding for web. List of features is just too long and I am just to lazy to list everything, lets just say without it any kind of coding for web would just take too long.

Firebug - simply put one of the best tools for debugging your web site. Add YSlow and get in depth analysis of what is going on with your project.

Pencil – free and quite powerful tool for UI prototyping and diagrams, try it out. It won’t replace industry standard software, I for one prefer Visio or coffee shop napkins and black pen, depends on where the idea strikes me, but if you need to do something quick, Pencil would do just fine.

FireFTP I can’t really count number of times I needed to ftp something quickly. FireFTP serves just that purpose. I can’t really recommend it for transferring bunch of files, keeps on timing out, but then again, I have not really played with all settings to affect that.

Codetch - an IDE like plugin which lets you work with your files in a manner similar to Dreamweaver. Once again, for a full blown project I would use a stand alone IDE, most likely Visual Studio or Komodo Edit, but for a quick change Codetch does the job.

There are more, much more. These are the things that I use quite often. Now, with all that great functionality, would I consider FireFox as a development platform? The answer is no. There are tools that are designed specifically for development purposes, while FireFox is a browser. It might be handy to keep a jump drive with overloaded FireFox installed handy for some quick coding while your machine is unavailable, but for full blow development project, there are tools that can do the job much better.

Optimizing Developer

May 15th, 2009 Paul No comments

man_rain

Have you ever looked at a code that you wrote several years ago? I have to do this all the time, after all I am working on the same application. Not only do I do it to fix bugs, but I do it to optimize the production code. And at times I see my old code and think what was I thinking when I wrote this. You see, with every release our main product grows, new features, core changes, you name it. One can say that we are optimizing the software by adding things our clients ask for and this leads to optimization of code. Optimizing your code is extremely important, normally there are few ways in which a particular problem could be solved, but if you are serious about your work, you do want to pick the most efficient way of doing things. Many books have been written on the subject, simple Google search will produce lots of articles concerning code optimization. Today I am not going to talk about that, instead I will talk about optimizing a developer.

If you are like me – doing coding full time and at times after hours, you want to achieve something which falls beyond simple financial compensation for you work. I want to grow as a developer. I have read somewhere that it takes roughly 10000 hours to master a task – be it musical instrument, a sport or any other activity. I think similar thing is applied to programming. I have been thinking of a way to apply optimization to myself, after all if my code can be optimized, why can’t the writer of the code. Here are some principles that I have came up with. This works for me, might not work for everyone. Once again, just my own opinion. Read more…

Bad code, we all do it.

January 27th, 2009 Paul No comments

978868_166628661

Bad code we all do it.

Well, I had written my share of bad code. Couple of weeks ago I had to fix up a class that was written about 4 years ago. For a while I could not believe I wrote this, but the comments on top clearly identified me as a suspect. The thing is we all write bad code sometimes. If you never wrote any bad code, please raise the hand with which you did not do it.

So, going back to the story – I was looking at it and my first impulse was to try to hide it far away so nobody would ever have to look at it. My second impulse was to rewrite it. I figured, it would probably take me about 5 hours to redo this. I did not do any of it. Instead I brewed a fresh pot of coffee, put my pride far away, printed out copies of it for all developers in the office and decided to play a game. Read more…

Categories: Coding, Management Tags: , ,

Keyboard shortcuts Visual Studio 2008

January 26th, 2009 Paul No comments

1003082_60642695

When it comes to development, IDE is an important part of the process. Some people still use some sort of a text editor to do all their coding, and I applaud them for it. I on the other hand am not a big proponent of typing out all your namespaces / commands / functions, nor am I capable of memorizing all the functions that are available in a language, so I use IDE. Since I am coding C# mostly, I am using Visual Studio. I have to admit – I love Visual Studio, especially with ReSharper (I don’t work for JetBrains, I just simply love this tool) added to the mix. I also have to say for the last 5 years I have not been using desktop to do my coding. I am addicted to laptops, and my boss have been kind enough to always providing me the newest and most powerful laptop budget can allow. This is why I love the idea of not using your mouse, after all, Visual Studio does come with a great deal of keyboard shortcuts, so why not use it? Read more…

Are changes good for you?

October 30th, 2008 Paul No comments

I have been told many many times that changes are supposed to be good for you (or me, since it’s my situation that we are looking into). I have been a coder for quite some time now. I can’t say that I am absolutely ecstatic about programming. It does not influence my life outside of my office hours and time that I spent at home trying desperately to improve myself. For instance, I don’t watch Star Trek or build some kind of crazy contraptions which could loosely be called a robot in my basement, although come to think of it, that sounds like a good idea; the robot one, not the Star Trek. I don’t wear nerdy t-shirts with BSOD on it. I am not participating in heated discussions like “My IDE is bigger then yours!” and “My OS can kick your OS’s butt” and so on. I can’t say that coding is my passion, it is something I am interested in and it pays my bills. Another factor would be my formal training – I have some in development, but as for the other areas I can’t say that I am properly trained. Lately something had changed in my work – I am doing more managerial things then coding. Read more…

Displaying list of installed fonts with C#

September 28th, 2008 Paul No comments

I know that all 1337 hax0rz (sorry, I promise I will not be doing this any more, as a matter of fact it really bugs me when people are using this 1337 crap) are using stuff like Ruby and Python, I know that system programming is for old farts and the future is in web development and all that. I am not disputing this, but there are some cool things you can do with C# and Windows coding. For some bizzare reason, I feel that it might be a good idea to publish some code which I find neat. One of the reasons I like C# is that generally if you need a solution to a particular problem, it is most likely to be alot simpler then what I think. Here is how you get the list of all installed fonts loaded into a ComboBox. Read more…

Exterminating Bugs – Rosetta 3.1 should be here soon!

April 14th, 2008 Paul No comments

This has been a crazy couple of weeks.  Finally all coding for the newest release of Rosetta is done, we are now fixing bugs.  Guys have done great job adding two huge features which I am sure our clients will be happy about.  We also done bunch of smaller things that will improve usability and help save even more time.  Plus tweaked performance, but this is an ongoing battle.

This has been a very difficult release to prepare.  We just hired another great developer – Will who despite my expectation did not require much of hand-holding and was able to just dive into it and make some great things happen.  My other guys had to do features with no set of final specs, it seemed to change with every week but managed to do great so far.  Considering the fact that our support guy Paul was doing lot’s of travel and we had to pick up those duties as well, we did reasonably well.  Dave is supposed to announce this release at the conference at the end of the month, would be great if we could actually finish it by then.

Actually after this release Dave is planning on visiting most of our clients and having a talk about the direction the software is going.  Should be good as we love getting realistic feedback and not just generic – “Look good, will probably use it”.

When I came to then ATP Canada, Rosetta was 1.3.  We had two developers – Matt and I; back then we had to work as a fire brigade all the time.  We also managed sales and support as well as coding.  Now we are looking at 3.1, have great team of developers, dedicated support / sales person and things are looking very optimistic.

I am actually looking forward to this release, after this one there are going to be some major changes in product lines and frameworks, should be fun.

Categories: 9-5 Tags: ,