codehutch.com

Online Code Repository

I encountered this error while running an old project, based from ASP.NET 1.1 Commerce Starter Kit and dashCommerce, previously called ASP.NET 2.0 Paypal eCommerce Starter Kit. It was recommended in dashCommerce installation to create a separate application pool solely for the dashCommerce project’s virtual directory. All was running smoothly until I installed it more than a couple times and missed this step along the way and thus it gave me “Server Application Unavailable” error.

This error might also mean something else, I’m only referring to the following.

The Problem:
Running at least two applications in different ASP.NET Frameworks (1.1 and 2.0/3.0) side by side could mean that somewhere you are trying to run 1.1 applications and 2.0/3.0 applications within the same process.

The Solution:
Create different application pools in IIS for each ASP.NET Framework, one for 1.1 applications and the other for 2.0 applications.

Solution Source: ASP.Net Forums



Tags:

Image Opacity Using CSS

Here is an illustration on how to use CSS to modify the opacity of ‘image-links’ and create a nice effect

CSS:

img{
border:none;
}

updated version

.link img{
-ms-filter: “alpha(opacity=50)”; /*IE 8*/
filter: alpha(opacity=50); /*lower IE versions*/
opacity: 0.5; /*FF*/
}

.link:hover img{
-ms-filter: “alpha(opacity=100)”; /*IE 8*/
filter: alpha(opacity=100); /*lower IE versions*/
opacity: 1; /*FF*/
}

deprecated

.link img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 0.5;
}

.link:hover img{
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
-moz-opacity: 1;
}

How to use:

<a href=”#” class=”link” ><img src=”superman.jpg”/></a>

Sample:

Thanks for the input j.j.  :)



Tags:

I was trying to deploy my Project using Visual Studio 2008 a while ago, when I encountered this Error:

“It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level This error can be caused by a virtual directory not being configured as an application in IIS.”

And I had no idea why it was happening. I was not even trying to access my project in a browser (I was just trying to deploy!). I wasted almost an hour trying to figure it out before I luckily stumbled to Rob Gruen’s blog. Though his case was different (I did not upgrade), I hurriedly followed his suggestion. I search for web.config file in my project’s folder and to my surprise, there were two of them. Suddenly, I remember that I was testing something and added a test-website inside my project which contains a web.config file. I just deleted the whole test-website and, boom! the deployment went smoothly. So, if you encounter this error, just remember that you cannot use multiple web.config in one application.



Tags:

I was digging through my files when I found this subroutine and I thought, maybe somebody out there might need it. It’s not my original code though (and I forgot where I got it). Anyhow, I just wanted to share it and here it is:

Public Sub ExportToExcel()

Dim table as Datatable = “Query your datatable here”
Dim name as String  = “filename”

Dim context As HttpContext = HttpContext.Current
context.Response.Clear()
For Each column As DataColumn In table.Columns
context.Response.Write(column.ColumnName & “,”)
Next
context.Response.Write(Environment.NewLine)
For Each row As DataRow In table.Rows
For i As Integer = 0 To table.Columns.Count - 1
context.Response.Write(row(i).ToString().Replace(”,”, String.Empty) & “,”)
Next
context.Response.Write(Environment.NewLine)
Next
context.Response.ContentType = “text/csv”
context.Response.AppendHeader(”Content-Disposition”, “attachment; filename=” & name & “.csv”)
context.Response.[End]()

LoadData_Base()
End Sub



Tags:

SQLite

Ever get tired of setting up a database server everytime you transfer from machine to machine.Maybe when you deploy your code from development to production. Well, i just found out this amazing thing called SQLite.

I’m not sure wether this is built-in or an add-on to php but it can be used together with it. What i’ve tested on the other hand is its relationship with Java. It can be easily appended to your java application through the use of a jar file that can be found here. It’s simple to use since you don’t need to learn some new syntax to get started. If you know JDBC, then you’re set to go.

      Class.forName("org.sqlite.JDBC");
      Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");

Just specify that you’ll be using the SQLite driver and point out the database that you want to use (in this case, test.db). If the database doesn’t exist, it’ll create a file named “test.db”. That file serves as the database itself, so take care that you don’t delete it. For every new database, it’ll create a file just like that, depending on the database name that you’ve supplied. To run the program, make sure that the jar file is in the classpath.

Now you’ve got a serverless database!

update (5/13/09):

I was searching for a database manager for SQLite and good news! I found one and it’s just a plug-in for Firefox. How cool is that? Download it here.



Tags: