Change the values of wm_font_path, wm_font_size, wm_font_color, wm_vrt_alignment, wm_hor_alignment, wm_hor_offset and wm_vrt_offset to fit your needs. Please refer to the CodeIgniter user guide to know more about these settings.
Now all you have to do is include an image tag in your view page that points to the controller function above
One of the many .NET open-source projects that don’t get the attention they deserve is MsSqlSpatial. This project provides spatial extensions to SQL Server 2005 – meaning you can perform various spatial calculations right in your T-SQL queries! Cool eh? But, this project lacks documentation which is a problem for us developers. I’m sure they are working their ass off to make one but in the mean time we have to play around with the code to understand its inner workings.
Since Google Maps is very popular among developers, and my personal favorite, I thought why not give out some tips.
Posted by Raihan Iqbal on Jun 22, 2009 in .net, Tools, asp.net |
Web developers at times need to put their web applications in an offline mode so as to prevent visitors from accessing the site while they are updating it. The classic way to do this would be to upload an app_offline.html file to the root of the web application. The limitation of this technique is that even the developer cannot visit the site! A developer might need to ensure if everything is working fine and at the same time prevent other users from accessing the web site.
So I created an HTTP module that helps overcome this issue. Just place a few lines in your web.config file and you are ready to go!
The following are the main features of this module:
1. Turn on/off the maintenance mode using a setting in the web.config file.
2. Specify the path to the landing page that will be shown to visitors.
3. Specify path to the login page if available.
4. Specify the allowed user roles.
5. Specify the allowed users.
Since the module is in its primary stage, please report any issues that you may find.
The first time I used Firebug (back then there was no IE8 Dev toolbar) I fell in love with it and as a Web Developer, life without it is unimaginable. This excellent article by Chris Brandsma tells you why its so. Check it out here.
My current project requires me to download huge amounts of data from a remote server in the form of XML and save them to our local database. Lets see if we can do this using just one simple T-SQL stored procedure. Lets first create our table. For the purpose of this demonstration I will use a simple schema with the following signature
1: CREATETABLE [dbo].[Employee](
2: [EmployeeID] [int] IDENTITY(1,1) NOTNULL,
3: [Name] [nvarchar](50) NOTNULL,
4: [Gender] [varchar](1) NOTNULL,
5: [DateOfBirth] [datetime] NOTNULL,
6: CONSTRAINT [PK_Employee] PRIMARYKEYCLUSTERED
7: (
8: [EmployeeID] ASC
9: )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
10: ) ON [PRIMARY]
Next, we need to create the stored procedure that will do the batch insert for us.
CREATEPROCEDURE [dbo].[spr_Employee_ProcessXmlData](@employees xml)
ASBEGINDECLARE @TempTable TABLE
(
[Name] [nvarchar](50),
[Gender] [varchar](1),
[DateOfBirth] [datetime]
);
-- Populate the Temporary table from the XML
INSERT INTO @TempTable (Name, Gender, DateOfBirth)
SELECT
ParamValues.Data.value('Name[1]','nvarchar(50)'),
ParamValues.Data.value('Gender[1]','varchar(1)'),
ParamValues.Data.value('DateOfBirth[1]','datetime')
FROM
@employees.nodes('NewDataSet/Employee') as ParamValues(Data);
INSERT INTO Employee(Name, Gender, DateOfBirth)
SELECT T.* FROM @TempTable T WHERE T.Name NOTIN (SELECT Name FROM Employee)
END
I won’t go into details about the XML programming – this great article are among several others that provide a good start for those unfamiliar with this feature of T-SQL. The stored procedure first creates a temporary in-memory table which will hold the data from the XML. Each node is read from the XML and mapped to the appropriate column of the temporary table. The temporary table is merely used to prevent duplicate data from being inserted into our actual table. If you are certain that your XML will never contain redundant data, then you can skip this step and directly insert the data to the Employee table.
We are now ready to perform batch inserts! The following SQL script demonstrates how.
Many of us Alhamdulillah are muslims by birth and thus we "tend" to learn Islam through our peers. But before we do something under the tag of Islam we never ask ourselves the following questions:
What????
Did our prophet PBUH do it? Did any of the prophets do it?!?!
If others are doing it? Why are they doing it?
I’ve decided that I’m going to discuss with my fellow Muslims about one such topic in each episode and I would appreciate if I get some feedback.
One such interesting practice is Arba’een (Arabic: اربعين, means "forty") or Chehlum or Chaliswa or Chollisha I asked myself the above three questions and found the following:
What?? ————– Lets see what the Encyclopedia has to say. This is a quotation from Wikipedia:
Arba’een (Arabic: اربعين, means "forty"), or Chehlum, as it is known by Urdu-speaking Muslims, is a Shi’a Muslim religious observation that occurs 40 days after the Day of Ashura, the commemoration of the martyrdom of Husayn bin Ali, the grandson of the Prophet Muhammad which falls on the 20th day of the month of Safar.
If others are doing it? Why are they doing it? ————————————————————
Culture, tradition, ignorance and the list goes on. What do you think? Please feel free to leave your comments and suggestions below. I hope we can create a platform where we can discuss such “ignored” yet serious topics. As Muslims we cannot afford to turn a blind eye to this otherwise we will be held accounted for. Once again don’t take everything in this post for granted. Do your own research, ask the scholars around you and when you finally find the truth, share it with us and your family members.
In many of my projects I have had to generate non-binary trees using information from the database and then display them in a “tree-like” structure as shown below.
My algorithm is very simple and it makes use of Dan Vanderboom’s excellent Generic Tree Collection but frankly I’m not satisfied with certain aspects of my algorithm. The main issue – the data can never be retrieved in the same order as shown above from the database.
Now that we have a collection ready, we can generate the tree structure
Finally, I add the items to my drop-down control by calling
GenerateDropDownList(rootCategory, 0);
Let’s have a look at the function
I know I could have used LINQ but many of my projects are running in .NET 2.0 so I had to go old-school! I’m looking forward to your valuable comments as to how YOU would do this and why your solution is more efficient than mine.