Posts RSS Comments RSS 137 Posts and 271 Comments till now

Archive for April, 2007

A Potentially Great Online Image Storage

Image Hosting for Ummah

I just found this online image storage which DOESN’T require you to create account to upload images/photos.

 

It also have a catchy tag, “Image hosting for the ummah”. Targeting the muslim population perhaps?

 

PROS:

  • No account required. Just upload and take note the image URL
  • Hot-linking is allowed. The image can be used anywhere, your website, blog, or auctions.
  • Unlimited bandwidth. Sounds great!!!
  • Unlimited number of images. Sounds promising!!!

CONS:

  • No explanation regarding the intellectual right of the image uploaded. Will the image automatically belong to imgspot.com??
  • Your image can’t be too popular. It will be deleted if imgspot.com consider the image is ‘extremely high usage’. No clear definition of ‘extremely high usage’ found in the TOS.
  • You can’t upload pornographic material. Well someone out there definitely will be sad for unable doing so ^_^!
  • If imgspot.com consider a material is infringing the TOS, the image will be removed. In extreme case, the user will be banned. But how to ban user if no account is required to upload image? Are they going to ban the IP? So there is a possibility that your image is banned because of your naughty neighbour

MY CONCLUSION:

  • This website has been around since 2004. They put Adsense adverts in the upload page. Your clicks might help their survival =P
  • Use this service for fun. Be prepared to loss your images/photos.
  • Practical. No account is needed
  • I will use it. If my image is removed, Photobucket and Flickr are still around as my safety net =)

So what do you think?

COMIC: Business or Pleasure

Business or Pleasure ??

DotNetNuke: Error Installing Module

Just solved a simple problem but took me hours to figure out the solution. So I will just share it here hopefully it will help you avoid the same mistake.

 

I have few DotNetNuke modules to be improved/debugged. So I managed to install the first module and improved it. When I tried to install the second module, DotNetNuke prompted me this:

error

So my immediate response was re-edit the manifest (.dnn) file. After validated it using DotNetNuke’s Manifest Validator (apparently it’s only an XML validator ^^!), I reinstall the module. Still the same error.

 

Strangely when I check the Module Definition Page, the module is actually installed. The DNN Manifest declared 4 Module Definition, but apparently only 3 added. When I tried to add the fourth Module Definition manually, it prompted me, “Module Definition is already exist”. EUREKA!!! (unlike Archimedes, I was not in the bathtub and then running around the village naked. I just running around in my house, fully clothed, of course :-))

 

So I compared the both DNN Manifest files. Snippets from the first DNN Manifest:


    Statistics
    
        
            DesktopModules/FirstModuleName/FirstModuleControlName.ascx
            View
        
    

 

Snippet from the second DNN Manifest:


    Statistics
    
        
            DesktopModules/SecondModuleName/SecondModuleControlName.ascx
            View
        
    

 

CONCLUSION: DotNetNuke’s Module Definition Friendly Name Is Unique

Prevent Error Caused By Null-Value in Your Stored Procedure

Consider you have a stored procedure that perform a SELECT operation for an object which is characterized by the ‘Start Date’ and ‘End Date’. Let’s assume we have the following TABLE:

Table Name: Events

Columns:
EventID int
EventName Varchar(64)
EventDesc Varchar(512)
EventStartDate DateTime
EventEndDate DateTime

And let’s assume that we have the following stored procedure:

 

CREATE PROCEDURE [dbo].[ListFilteredEvents]
	-- Add the parameters for the stored procedure here
	@StartDate datetime,
	@EndDate datetime
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

        -- Insert statements for procedure here
	SELECT
		Events.EventID,
		Events.EventName,
		Events.EventDesc,
		Events.EventStartDate,
		Events.EventEndDate
	FROM
		Events
	WHERE
		Events.EventStartDate>= @StartDate AND
                Events.EventEndDate<= @EndDate
	ORDER BY
		Events.EventStartDate
END

 

Now what will happen if somehow the SP caller will pass blank value as the StartDate and/or EndDate? Error (Exception will be thrown) of course. If we have access to the source code of the application that execute this stored procedure, we could easily error-prevention at the application level. But if our access is only limited to database level, we could do the following:

 

CREATE PROCEDURE [dbo].[ListFilteredEvents]
	-- Add the parameters for the stored procedure here
	@StartDate datetime,
	@EndDate datetime
AS
BEGIN
   IF @StartDate IS NULL
   BEGIN
      -- Set it with the smallest value of DateTime data type
      SET @StartDate=CAST('1753-01-01' as DATETIME)
   END

   IF @EndDate IS NULL
   BEGIN
      -- Set it with the biggest value of DateTime data type
      SET @EndDate=CAST('9999-12-31' as DATETIME)
   END

   BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

        -- Insert statements for procedure here
	SELECT
		Events.EventID,
		Events.EventName,
		Events.EventDesc,
		Events.EventStartDate,
		Events.EventEndDate
	FROM
		Events
	WHERE
		Events.EventStartDate>= @StartDate AND
                Events.EventEndDate<= @EndDate
	ORDER BY
		Events.EventStartDate
   END
END

 

This way we could prevent Error/Exception being thrown whenever a blank value is passed into the stored procedure.

 

Important Update: Saturday, 21 April 2007 13.43 PM — Thanks for Bro MCA for pointing out a better solution =)

 

CREATE PROCEDURE [dbo].[ListFilteredEvents]
	-- Add the parameters for the stored procedure here
	-- Set it with the smallest value of DateTime data type
        @StartDate DateTime='1753-01-01',
	-- Set it with the biggest value of DateTime data type
        @EndDate DateTime='9999-12-31'
AS
BEGIN
   -- SET NOCOUNT ON added to prevent extra result sets from
   -- interfering with SELECT statements.
   SET NOCOUNT ON;

   -- Insert statements for procedure here
   SELECT
	Events.EventID,
	Events.EventName,
	Events.EventDesc,
	Events.EventStartDate,
	Events.EventEndDate
   FROM
	Events
   WHERE
	Events.EventStartDate>= @StartDate AND
        Events.EventEndDate<= @EndDate
    ORDER BY
    Events.EventStartDate
END

Comments in VB and C#

I was just browsing through MSDN website when I noticed something that all this time I considered it very trivial. Apparently in VB, you need to give every line apostrophe (’) to make that line a comment (I know this). And you can’t use the underscore (_) to continue the comment, you still need to give the apostrophe again in the next line (now that is new).

 

Very contrast compared to other language such as C# (or other similar language in that matter, like C/C++, Java), you can use double slashes (//) to start a comment. To make multiple-line comment, you need to start it with /* and end it */

 

The comparison becomes a moot point if you are using Visual Studio. You can easily select the lines, and press Ctrl+K+C to comment it, and Ctrl+K+U to uncomment the selected lines.

Pages (6): « 1 [2] 3 4 5 » ... Last »

Close
E-mail It
Socialized through Gregarious 42