Skip to main content

Posts

Showing posts from 2007

SharePoint 2007 Content Editor Web Part

I have recently moved into the world of development on SharePoint 2007 and I keep wondering why I haven't had time to play with this piece of software. Anyway, what I would like to discuss today is the versatility of the Content Editor Web Part which allows you to use formatted texts, tables and images as if you are working on an asp.net application. If you happen to be a developer and you have been scared of SharePoint it is time to pick up from somewhere and there are so many blogs and resources on the web to learn from. Branding a SharePoint site is obviously one of the dreary things people encounter. If you are looking to engage in branding. Just move straight to a site like http://heathersolomon.com/ I will be in touch on this soon.

VALIDATING FILE UPLOAD ASP.NET

Using the file upload in ASP.NET control is easy as ABC but there are times when you will like to validate the file type that is being uploaded and the size of the file remembering the fact that there is a maximum file size allowed in the server's config file. I will demonstrate with an image upload control (imgUpload) that stores image on a database. I am trying to ensure that only gif, png or jpg are allowed and maximum size of 300Kb. if (newFileName.EndsWith(".gif") newFileName.EndsWith(".png") newFileName.EndsWith(".jpg")) { #region Image size if (this.imgUpload.PostedFile.ContentLength { using (BinaryReader reader = new BinaryReader(imgUpload.PostedFile.InputStream)) { //Add Image byte[] img = reader.ReadBytes(imgUpload.PostedFile.ContentLength); HealthOrganisationImageFacade image = new HealthOrganisationImageFacade(); HealthOrganisationImageDTO pix = new HealthOrganisationImageDTO(0, OrganisationID, img, Organisation.Text, imgUpload.PostedFile.C...

ADD VOICE (SPEECH) CAPABILITY TO YOUR ASP.NET

Adding speech functionality to your site is so easy using the COM API available in the SAPI has a text-to-speech engine (TTS). Mind you every machine with Windows XP has SAPI and TTS. All you need do is to add a reference to a COM dll available in Microsoft Speech Object Library. The dll's name is Interop.SpeechLib.dll Namespace declare your dll as using SpeechLib; Create a text box that will contain your text, add a button that will trigger the voice conversion as shown below: protected void btnVoice_Click(object sender, EventArgs e) { SpVoice voice = new SpVoice(); try { voice.Speak(spText.Text, SpeechVoiceSpeakFlags.SVSFDefault); } catch (Exception ex) { throw ex; } } QED. You are done now. Just make sure your speakers are on and you have got the right volume.

HOW TO FIND DUPLICATE ROWS IN A TABLE (SQL)

If you are saddled with the task of finding duplicate rows in a table using SQL. It is a simple task even though it is not a place you should find yourself because you need to make sure your records are well indexed at the time of creating your table. Now that the worst has happened. All you need do is to select the row that has the duplicate values and count for each of the rows using a GROUP BY clause. For convenience sake, you can order by the same column in question as shown below: SELECT CurrentDate, COUNT(*) FROM tblSingleRate GROUP BY CurrentDate ORDER BY CurrentDate CurrentDate Count(*) 2007-03-12 1 2007-03-13 2 2007-03-14 2 2007-03-15 1 2007-03-12 1 2007-03-13 1 2007-03-14 2 2007-03-15 1 Duplicates are marked in red. QED!

Microsoft Silverlight

It appears the web is getting all the focus in systems development these days as there are new emergence at the National Association of Broadcasters conference (NAB2007). Microsoft Corp. unveiled Microsoft® Silverlight™, a new cross-browser, cross-platform plug-in for delivering the next generation of media experiences and rich interactive applications (RIAs) for the Web. The encouraging thing is that the big names in the media industry are in full support of this development. Let's buckle up then as we move to get the best done. It is the world of Microsoft Silverlight as WPF/E lost the title yesterday. Happy coding guys!

ASP.NET CODE GENERATION TOOLS

There is a lot to learn especially if you are just starting out as an ASP.NET developer. A new free code generation tool now in beta 3 has just been released. It is time for coders to seat down and relax a little because life has been made easy again. I have only explored this tool a little but I can see some similarities with codesmiths, nettiers etc. in it. It generates data and UI for you You need to try it out and see if you are curious like myself. Check it out here: http://www.codeplex.com/actionpack If you are keen on using code generators or would like to find out more. See http://www.castleproject.org/

UPLOAD T-SQL AND DATA MADE EASY

I came across this nice tool some months back which I believe would be useful to some folks out there that have been thinking of how to deploy their applications with zero percent stress. The tool released by Microsoft as a free download is called The SQL Server Database Publishing Wizard. Replicating your database on another server has been made easy. Pick it up, it is yours. Find the download here: http://www.microsoft.com/downloads/details.aspx?FamilyID=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en

SITEMAP SECURITY TRIMMING

securityTrimmingEnabled intellisense was spelled wrongly in ASP.NET 2.0. Note that the correct syntax should be SecurityTrimmingEnabled = "true" or SecurityTrimmingEnabled = "false" in your stemap file. There is a provision to use SecurityTrimmingEnabled in both web.config and sitemap files respectively.

LOOP THROUGH A DATASET

I had a reason to loop through a dataset today and I was just wondering someone could be in need of this. I believe it is straight forward. I am assuming here that you have already created your dataset (ds). foreach (DataRow dr in ds.Tables[0].Rows) { //Do whatever you like here with the rows returned Response.write(dr["columname"].ToString()); }

Starting out...

I have been thinking of starting a blog about my career for a very long time now and I finally made up my mind to do something today. This no doubt is the resurrection power at work. Hope this will help somebody out there to do their work better. Yours in the development world.