Archive for the 'Programming' Category

Is the Read-Only attribute on OS Oracle data file a bug for Oracle 10g?

In today’s Oracle 10g training, we were asked to do a exercise on tablespace. I needed to make a tablespace Read Only and Read Write. The syntax was simple, just “ALTER TABLESPACE tbs READ ONLY (READ WRITE”. But while I was playing around, I thought what would happen on the data file after I turned on the Read Only with the tablespace. So I checked the data file (like c:\oracle\oradata\something.dbf) and found out it did not have Read-only attribute even after I altered the tablespace as Read Only. Interesting, it seems the Oracle did not look up the OS level when it deals with the tablespace read-only attributes.

To make things more interesting, I turned on the Read-Only attribute for this tablespace’s data file (Right Click, and check the Read-Only in the proprieties window). Then I went ahead to make more alterations on the tablespace, like increasing the extents size etc. The funny thing was I could see these system changes in Oracle through some dba_ views, but actually they did not take effective. Since I could not insert any new record to a full tablespace even I “successfully” increase the size in Oracle.

Not sure Oracle already aware this situation or not.

Related posts

How to display 0 in conditional [group by] report in Count() SQL Query

sql-injection-database Challenge:
Let me assume this: we have two tables, one is Regions table with all region information (East, West, etc. ) and we have another table with Sales information. Now, we need to display a report with region information and how many sales conducted in each region with greater than $1000 value in each sale. It sounds simple at the beginning since a Count(*) with Group By can do this trick.

But what if I need to still show the region which does not have any sales greater than $1000 on the report? Using Count(*) itself in the query, the region without any sales greater than $1000 will not show in the query result, period.

Continue reading ‘How to display 0 in conditional [group by] report in Count() SQL Query’

Related posts

How easily to create a required validator requiredfieldvalidator for CheckBox control in asp.net 2.0

Challenge:

 I tried to add a CheckBox control to the registration page in my newly implemented open source YetAnotherForum asp.net application. And this CheckBox is for Terms and Conditions agreement, so it needs to be checked before the users submit registration form. It looked like the easy way was to use a RequiredFieldValidator to validate the CheckBox control. But unfortunately this RequiredFieldValidator validation Web control does not work with the CheckBox (or CheckBoxList) Web controls. After I set its ControlToValidate property to the ID of the CheckBox, the page threw an HttpException, saying:

"Control ‘controlID’ referenced by the ControlToValidate property of ‘validationControlID’ cannot be validated." 

Ok, I can perform the validation check in the postback code or replace the RequiredFieldValidator with CustomValidator control. But this is for a constantly updated open source application, I did not want to change too much source code in case I will get overwritten in the next release. So, I need a quick and dirty way to do this.

Continue reading ‘How easily to create a required validator requiredfieldvalidator for CheckBox control in asp.net 2.0′

Related posts

How to remote connect to Microsoft SQL Server Express 2005

Challenge: By default, the SQL Server Express 2005 was not installed for remote access. Which means networking protocols are disabled by default in SQL Server Express. Thus, if you simply installed Express and chose all the defaults like I did, SQL Server Express will only be able to have connections originating on the local machine where SQL Server is installed.

That is why I got the following error message when I tried to connect to one SQL Server Express instance installed on another server from my desktop’s SQL Server Management Studio Express.

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476

And this is the screen shot I have.

sql_remote_error

Continue reading ‘How to remote connect to Microsoft SQL Server Express 2005′

Related posts

Fix a bug in YetAnotherForum version 1.9.1.8

YetAnotherForumAs my previous post said, I installed Yet Another Forum v1.9.1.8 on my server, then I created a board/forum. In my first and only one forum, I turned on the moderate mode which means that any post topic will not show till the forum administrator approves.

Then I went ahead to create the first new topic, and later on a few replied have been posted. Everything was fine but a few days ago the front page could not be seen. I tried a couple of times, only saw the error messages (There has been a serious error loading the forum. No futher information is available…) as the following screen shot. And funny thing was I still could access to other web pages include the administrative portion.

Error Message

Continue reading ‘Fix a bug in YetAnotherForum version 1.9.1.8′

Related posts

Get FCKeditor work on Oscommerce 2.2 release 2a

OSCommerceToday I downloaded All In One FCK Editor WYSIWYG Editor Oscommerce add-ons since I needed to add a WYSIWYG(What You See Is What You Get) HTML editor on one of my client’s Oscommerce Shopping Cart site.

After I did all uploadings and changes according to the Readme document, I got the following errors after I refreshed the back-end page.

Warning: Failed opening ‘fckeditor_php4.php’ for inclusion (include_path=”) in /var/www/html/catalog/admin/fckeditor/fckeditor.php on line 75

Continue reading ‘Get FCKeditor work on Oscommerce 2.2 release 2a’

Related posts

Fix wp.getusersblogs error in Windows Live Writer after upgrading to WordPress MU 1.5.1

I have been using Microsoft Windows Live Writer to update my blogs for a while, but today I got some errors when I tried to publish a post to my newly upgraded WordPress MU 1.5.1 blog. After this error message, I got a prompt windows to ask my blog logon user name and password. I thought the upgrading changed the user information anyhow, so that I updated my logon password, and re-typed it in Live Writer. When I re-published, again saw the same error. I stopped, and then tried to view the web blog within the WLW. The same wp.getusersblogs error popped-up as I encountered during the publishing.

The following is the detailed error message:

log Server Error - Server Error -32601 Occurred server error. requested method wp.getUsersBlogs does not exist. You must correct this error before proceeding.

Continue reading ‘Fix wp.getusersblogs error in Windows Live Writer after upgrading to WordPress MU 1.5.1′

Related posts

Can not start a workflow from a survey response in Windows SharePoint Services 3.0 (MOSS 2007) with "Failed to Start" error

Challenge:

sharepoint When I was approached by a co-worker to come up a quick solution to design a training registration application. The requirement is to display all upcoming training events in calendar view and allow users to register to each training. And upon the registration is submitted, the training department and the user’s supervisor should receive notifications immediately (although not required now, but might need the approval from the supervisor in later development). The deadline is very…, how to say it, … how about this afternoon. Well, while the co-worker asked how to design the database tables and asp.net coding, I suggested why not giving the SharePoint a shot. Since I am the one proposed, then I had to create it for her.

Well, that was what I came up so far. In our Microsoft Office SharePoint Server System (MOSS) 2007 with Windows SharePoint Services 3.0 (WSS), I created a calendar list to display training events; in the calendar item there was a link to another new created survey list acting as a registration form. Then I added a workflow to the survey so that emails will be sent out whenever a new response is added into the survey (or register list).

Everything is working fine, but however, the workflow does not start. Instead, the status of the workflow appears as Failed to Start.

Trouble-Shootings:

I searched this issue on Google, and I found out a lot of people had the similar errors before. Someone pointed out the cause was the user of application pool who should be Network Services instead of a user with administrative right; Someone suggested to re-active the workflow feature in SharePoint Application server; Someone asked whether it was done in SharePoint Designer  2007.

Continue reading ‘Can not start a workflow from a survey response in Windows SharePoint Services 3.0 (MOSS 2007) with "Failed to Start" error’

Related posts

new changes in wp-config.php for WordPress MU 1.5.1

It has been closely two weeks since WordPress released its latest MU 1.5.1 version. I could not get a chance to upgrade mine till today. Normally I just upload all the newer files but wp-config.php to my server via FTPing. During this upgrading, I noticed that the last modified time for newer version of wp-config-sample.php has been changed. To find out what kind of changes inside, I opened the wp-config-sample.php file.

Continue reading ‘new changes in wp-config.php for WordPress MU 1.5.1′

Related posts

The error ‘Unable to determine the page link’ in OSCommerce MS 2

Challenge: Recently I tried to move an older OSC website from one host to another host. After I made changes in the configure.php files and uploaded them to the new host, the first page could not be loaded such error messages as “unable to determine the page link…”. And everything would be fine if I commented out any codes with basename($PHP_SELF) function.

Continue reading ‘The error ‘Unable to determine the page link’ in OSCommerce MS 2′

Related posts

How to set up your own customized template overrides?

Like I copied a post from zen-cart on last weekend, I set up a blank new customized template for zen-cart. But it does not do any good if I do not create any my own overrides to display my own style/texts. The following is a how-to from zen-cart support website covering this topic, and I am pasting here for my own reference.

Basically in the /includes/templates/CUSTOM you can start with copying any templates files/sub-folders from /includes/templates/template_default or /includes/templates/classic, and then whatever your style changes there. But some language related changes should be changed in /includes/languages/LANGUAGE folder.

Continue reading ‘How to set up your own customized template overrides?’

Related posts

How to customized your own template for Zen-cart shopping cart Open Source application

This article is copied from the official zen-cart support web site.

Since Version 1.3.+ Zen Cart™ has moved away from its old table based layout to a CSS based layout.

CAPITALIZED words refer to a folder or language that you choose. We use CUSTOM for your template and ENGLISH for your language by default. Change these if needed.

Continue reading ‘How to customized your own template for Zen-cart shopping cart Open Source application’

Related posts

How to display random header images in K2 theme of WordPress

Maybe you already knew, but I just found out from my own experience. This afternoon, I tried to update the header image for this blog. I went into the back-end Dashboard, then click Presentation –>Custom Image Header. There I uploaded a new image, and got the confirmation message. But when I came to my live site, I still saw the old header image. No matter how many time I refreshed the screen, and I also purged the browser cache too. When I thought it was the bug of my K2 plugin/theme, I uploaded another new image but amazingly I saw the second image appeared when I refreshed the screen (I was supposed to see the third one)!

Continue reading ‘How to display random header images in K2 theme of WordPress’

Related posts

About the installation of YetAnotherForum

YetAnotherForumSome steps to install the free ASP.NET open source forum:

1. First of all, of course you should download this application from http://www.yetanotherforum.net/.
2. Prepare the Microsoft SQL Express database. If you have not installed any on your servers yet, you can download it from Microsoft website for free. When you are on Microsoft Download center, remember you not only need  SQL Server 2005  Express database service, but you also need SQL Server Management Studio Express to create a initial forum admin user.
3. Create a login for your new SQL database, and then a new database Instance. With such information, including Database Name and Logon Account/Password, you can modify the yanet.config first before you start to install the forum.
4. Finally, you can run the installation from the URL of http://yourdomainname/YaNet/install/default.aspx.

Continue reading ‘About the installation of YetAnotherForum’

Related posts