Wednesday, November 26, 2008

Replace NewLine in TSQL

It's quite frustrating how tiny task become so time-consuming and worrisome. Never would have imagined this hard to do. 

Had a situation where records gathered from an application will serve as input to a large application. The data first had to be cleaned (glad I got Sql server tools). This was done in seconds. On export to CSV, it was discovered that one of the fields (address field) had newline inputed in it causing wraping of the record as new line in the exported CSV.

Of course I was quick to type

update xxxxx set CustAddress = Replace(CustAddress, char(13), '')

Alas, no change. Kept getting same reponse. Even len(CustAddress ) = Replace(CustAddress, char(13), ''). 

Search for this issue on the net and could not find a direct linking article of blog reporting this scenerio. 

I finally got the answer from an article on Simple-talk by Robyn Page and Phil Factor

update xxxx set custaddress = REPLACE(custaddress, COALESCE(char(13) + char(10),'[^-a-z'']'), '')

Quite some other stunt in the article too.

Friday, November 21, 2008

MSFT's Application Architecture Guide 2.0 Beta 2

Microsoft Patterns & Practice team has recently released the beta 2 of the Application Architecture Guide 2.0 offering significant changes from Beta 1 among which are

Technology matrixes for choosing technologies like Presentation, Data Access, Workflow, and Integration technologies. 
New Agile Architecture Method 
Tuned and pruned the recommendations across the entire guide. 
Restructured the guide for simpler parts 


Read more about the changes at J.D. Meier's blog

Thursday, November 20, 2008

Microsoft Expression Web Inline Styles

I like to agree that Microsoft Expression Web is a great tool to use. I instantly saw the need to need for such tool to complement Visual Studio and considering that it's has less memory footprint tool and I can get my tortoise- performing notebook (Never seem to get a machine fast enough -HP Compaq nc6400)  to deliver working on a web page faster.  It is also very cool with css and I consider tracing image very "slick". 

I am particularly irritated with the fact that the designer generates only inline-styles. I experienced this with silence in version 1 and this persisted in version 2. Even if the element being moved around in the designer already has a class attribute, one notices that an inline style is created for the element and have to manually copy and merge the changes with what is the external style.

Is there a mode like this in this because I really cannot imagine the designer of this tool missing out on this kind of cool feature.

Wednesday, November 19, 2008

ASP.Net Textbox watermark

I don't like to do javascript! Asked myself several times over the past years why my javascript has been so poor even it has several syntax semblance to C# and other languages with same cancer of the semi-colons ;).

What I have been able to identify a reason for dislike is the poor IDE support for javascript. Visual Studio brought quite a bit of cool supports and features but not enough for an aging brain like mine to pick up. However, rising to the challenge and had to do a textbox watermark. 

I had done this before with a sample from Stan (a friend - Great Chap) but can't seem to find the source anymore nor Stan himself and also done this with ASP.Net Ajax but the client do not want Ajax feature, nor is ready to pay more for that so I had to revert to my plain-old javascript in ASP.Net and this is what I came up with.


App_Code
public static void WatermarkHelper(TextBox textBox, bool isPostBack, string defaultText)
    {
        textBox.Attributes.Add("onfocus", isPostBack ? "" : "WatermarkFocus(this, '" + defaultText + "');");
        textBox.Attributes.Add("onblur", isPostBack ? "" : "WatermarkBlur(this, '" + defaultText + "');");

        textBox.Attributes.Add("class", isPostBack ? "normal" : "watermark");
        textBox.Text = defaultText;
    }

Page_Load
Util.WatermarkHelper(plsperacreText, IsPostBack, "Enter Code");

Javascript
function WatermarkFocus(element, defaultText) {

            if (element.value == defaultText) {
                element.className = "normal";
                element.value = "";
            }
        }

        function WatermarkBlur(element, defaultText) {
           

            if (element.value == defaultText || element.value.length == 0) {
                element.className = "watermark";
                element.value = defaultText;
            }
            else
                element.className = "normal";
        }


CSS
.watermark
{  
/* sure u can add a lot more */
   color: DarkGray;
}

.normal
{
}


And that does it

Monday, November 17, 2008

e-Commerce Development

I really do not like to do websites. In fact, I used to hate to do one and though I develop quite a bit of web-based business applications with C# and ASP.Net, website development seems not what I'd like to do.

Recently, I had to take a full e-Commerce website using ZNode and LinkPoint payment gateway from First Data. ZNode is pretty interesting and intend to do a service site using this. I did not particularly like Linkpoint. The documentaion on it's setup and integration to applications is quite lame and I waste quite a bit of time trying to figute it out.

This has prevented me from the scheduled task for this week of revving the PDC 2008 conference content. 

Wednesday, November 12, 2008

PDC 2008



Just returning back to serious work after PDC 2008 at Los Angeles. Had lots of fun with co-developers. The technology show-cased were cool and got new insights too. My utmost interest is with Azure. I am yet to start drilling through my 160GB hard disk given to us but will do soon and pump lots more content about my accomplishments here. Hang on ...



Check out more pix of the event at PDC 2008

Back to Blogging here

I guess I will have to return to blogging here. Inthril that host my blog for a while has been having problems and so I could not log in.

It's been a while I blogged. Been clogged down with lots of task and thinking and having done a lot. I Need to showcase quite a bit ot what's going on in my head.

Saturday, May 15, 2004

Alfa version of my Current Project



Just finally finished with the alfa version of my current project codenamed “Bellagio”. Its kept me up at night for a while and glad that it gets to this stage. Thanks to the development team which consist of Emeka, Demola (PM), Femi, Seun, Kenny and Wale.

Will take the next couple of days rest in readiness for continuation of the project to a final product and u know the sweet part of things?

MORE CHALLENGES J

Chat with a C# newbie (Convert)



xxxxxxx: you're using C#?

onawoleco: Yeah! and its sweet

onawoleco:

onawoleco: what would u recommend?

xxxxxxx: recommend?? how do you mean???

onawoleco: I was wondering y u asked if I used C#

onawoleco: So i thot u had another language in mind

xxxxxxx: you need to use what you "think in".you see i was trying to learn C# but i

onawoleco: So what do u think in?

xxxxxxx: but i need to know its advantages b4 moving in...

onawoleco: What do u "Think In"

onawoleco: It has all the advantage of Java

onawoleco: its smoother and simpler

onawoleco: but better features

onawoleco: and soon Generics will be introduced which is a better implementation of Templates in C++

xxxxxxx: actually "C++"

xxxxxxx: but i suspect there is a very strong similarity b/w them. thats why i am considering it

onawoleco: I do think in C++ too but commercial product always have stringent deadline of which C++ is not appropriate

onawoleco: There is

onawoleco: Same syntax

xxxxxxx: very much like visual c++ (i suspect)

onawoleco: Only u cannot will miss some features in C++

onawoleco: though most has better replacement in it

onawoleco: Not really

onawoleco: VC++ -> MFC is trying to give C++ an OOP look

onawoleco: everything in C# is an object

onawoleco: there is nothing like primitives

onawoleco: like u can say 3.ToString()

onawoleco: This is impossible in C++

onawoleco: but in C# numerics are classes too

onawoleco: Sorry objects too

xxxxxxx: what is my fastest way of learning C#?

onawoleco: Get a book on it

onawoleco: Thinking in C# could be okay

onawoleco: read from the numerous articles on the internet

onawoleco: I learnt a lot thru that way

onawoleco: and join a .Net user group

onawoleco: I am starting a very strong one in Naija soon

xxxxxxx: like which group?

onawoleco: Check www.gotdotnet.com

onawoleco: U will find numerous leads

xxxxxxx: or which website has good tutorials?

onawoleco: read articles from www.codeproject.com, www.theserverside.com

onawoleco: Gotdotnet supports MS passport

onawoleco: all u will use is ur MSN/Hotmail ID

onawoleco: The other is quite easy to get one

xxxxxxx: so C# creates stand-alone applications just like MFC does?

onawoleco: Better and Quicker than MFC

onawoleco: .Net compiled codes are not in Binaries like C++

onawoleco: and MFC alike

onawoleco: C# compiled codes are in IL

onawoleco: which is more like Java bytecodes

onawoleco: but better than Java bytecodes 'cos it is in itself OO

onawoleco: This what the .Net CLR understands and execute

onawoleco: it actually uses JIT

onawoleco: Just-In-Time compilation

onawoleco: which is an optmized compilation anyway

onawoleco: so u may experience the running slow the first time u execute

onawoleco: subsequent time, its faster

onawoleco: The IL made it possible to have language agnostics on .Net

onawoleco: which means it is language neutral

xxxxxxx: this will only run on systems which have .Net installed?

onawoleco: U can program in any language as long as there is compiler to compile to IL

onawoleco: Sure on systems with .Net framework

onawoleco: Just as u cannot run a java code without a JRE

onawoleco: This gives u lighter exectables

xxxxxxx: what is IL?

onawoleco: Intermediate Language

xxxxxxx: .Net can be installed on Win98?

onawoleco: Sure!

xxxxxxx: i will start off tonight! have some kind of tutorials which i save on my notebook about five weeks ago

onawoleco: C# also comes with a garbage collector

onawoleco: better than Java GC

onawoleco: Gooooooooooooooooo

onawoleco: Feel free to ask any que. Will sure like to help

onawoleco: and u can join my group

xxxxxxx: i have never understood that concept.. "garbage collector"

onawoleco: I will even need u to enter Ife well

onawoleco: as soon as I have the draft plan

onawoleco: I will let u see it

xxxxxxx: is it like clearing up unallocated memory?

onawoleco: In C++ u have what u call destructors

onawoleco: yeah it clears unused memory

onawoleco: U sure know what u used destructors for

onawoleco: but sometimes, developers get careless

onawoleco: and forget to clear up allocated memories

xxxxxxx: i mean like freeing allocated memory after use?

onawoleco: which leads to memory leakage

onawoleco: Not immediately after use

onawoleco: at specific time determined by the system

onawoleco: The concept of pointers make momory leakage even more on C++

onawoleco: which is y C# and Java avoided pointers

onawoleco: Though C# provided a workaround under the unbrella of DELEGATES

onawoleco: thats another powerful concept in C#

xxxxxxx: then i will start up with c#, one has to update with time

onawoleco: Sure

onawoleco: thats y I made the decision sometimes ago

onawoleco: even though I still code in VC++ and VC++.Net

Thursday, May 13, 2004

Skype - P2P Telephony Explained

This link leads to the technical details of Skype. It strictly for geeks interested in this innovative implementation of a true P2P application.

Skype - P2P Telephony Explained

and also its

Skype - FAQ

48 Laws Of Power

Just on the sixth law which states

 

            COURT ATTENTION AT ALL COST

 

            Everything Is judge by its appearance; what is unseen

counts for nothing. Never let yourself get lost in the

crowd, then, or be buried in oblivion. Stand Out. Be

conspicuous, at all cost. Make urself a magnet of

attention by appearing  larger, more colorful, more

mysterious than the bland and timid masses….

 

 

 

Onawole, Clement Oladapo

Lead Software Developer
Splashers Technologies
Suite B15 Festac Plaza
24 Road Festac
Tel: 234-802-316-6353
www25.brinksters.com/murpheux

 

Skype in the Sky!!



Wooooow!!!! This is the best piece of software I have seen since Kazaa. And moreso produced by same guyz that did Kazaa and its free. Though its still in its beta stage but very cool. Tested it out and was amazed. Its awesome and glad someone thought of this and made it available.

Wednesday, May 12, 2004

What a day!

I sort of count today as a non-productive day as I did not learn to work on something new. Have been on a project – quite large and interesting and spent most of today fixing QA issues.

 

However, I need to make the solution authenticate via, WinNT, Active Directory and ADAM in a role-based security. I guess this will be the challenge for next few days.

 

 

Onawole, Clement Oladapo

Lead Software Developer
Splashers Technologies
Suite B15 Festac Plaza
24 Road Festac
Tel: 234-802-316-6353
www25.brinksters.com/murpheux

 

How Word for Windows Uses Temporary Files



89247 - WD97: How Word for Windows Uses Temporary Files


Had an issue with Microsoft Office. Was working on a solution that needs to create Office Document, Allow users to modify/update the document and upload to a store (RDBMS).

Implemented a FileSystemWatcher to know when the file was actually updated i.e. modified and save clicked. This failed as the FileSystemWatcher never for once discovered that the document was modified or updated. The problem is that Microsoft Office creates a temporary files and updates this instead of the original file. What baffles me is how Microsoft Office Apps conversely update the original file and with what mechanism..

Discussed this with a boss and he showed me this article 89247 - WD97: How Word for Windows Uses Temporary Files.


Still working on this to see how this helps me out!.

Working with office solutions

 

Considering the way that Microsoft office uses temporary files which makes it impossible for me to know exactly when the original (not the temporary file) was updated using a FileSystemWatcher, I decided to change the design in such a way that I keep track of the when the process with which I opened the office application on exits.

 

Using

 

Process process = new Process();

 

      process.EnableRaisingEvents = true;

      process.Exited += new EventHandler(process_Exited);

      process.StartInfo = pInfo;

 

// start process

process.Start();

 

Since the user can open more office document of this sort, I also kept this processes in a list

 

WatchProcess.Add(process);

 

So that on closing of my main form I can know which processes have not been exited. Display a warning to the user, and force an exit

 

private void FrmMainEMR_Closing(object sender, System.ComponentModel.CancelEventArgs e)

      {

            if (WatchProcess.Count > 0)

            {

                  if (new FrmConfirmation().ShowDialog(this) == DialogResult.Yes)

                        CloseApplication();

                  else

                        e.Cancel = true;

            }

            else

                  CloseApplication();

      }

}

 

 

This is how I was able to get thru this. Now I can sleep tonight as this has kept me up for a couple of nights. Thanx

 

 

Onawole, Clement Oladapo

Lead Software Developer
Splashers Technologies
Suite B15 Festac Plaza
24 Road Festac
Tel: 234-802-316-6353
www25.brinksters.com/murpheux

 

My First Blog

this is not actually my first blog. Had an unsuccessful one earlier at murpheux.blogspot.com which shows non of my posting. After three postings and still could not view anything. Decided to create another which is this.

Will have to get my postings on the other blogspot and paste here.

Here I go in a more fulfilled IT participation in the software world!

As for me, Coder For Life!