SQL Server Connection in ASP.NET

Posted by Nurasto | January 29, 2008 | Software and Web Development | 0 Comments

I choose to write in English because seems many people held problem like I do. I had problem with SQL Server 2000, SQL Server 2005 (Express) in regular basis. I had some thought that the problem related to :

  1. Permission
    Please check your APP_DATA and APP_CODE folder permission, make sure it contains ASPNET and NETWORK SERVICE. Don't add all just try one by one, if you failed on ASPNET user then you could check NETWORK SERVICE also.
  2. Web.Config Setting
    If you want your DATA stored on APP_DATA make sure had correct connectionString (this just example), change the necessary configuration according to your machine and SQL Instance

    <add name="DintCoreDB" connectionString="Data Source=DINT\SQLEXPRESS; AttachDBFilename=|DataDirectory|DintCoreDB.mdf; Integrated Security=true; User Instance=true"/>

  3. SQL Server it self
    SQL Server 2005 with Advanced Service had tricky configuration and it will make a headache, make sure you install this first before all things like Visual Studio. Replacing old instance could direct you into big mess which APP_DATA can't work properly. I don't know why this happen. I keep safe for this one as I don't have much time to experiment.

Hope this works. Laughing

Programming: Closing thought of the year 2007

Posted by Nurasto | December 31, 2007 | Software and Web Development | 0 Comments

I don't do any anlysis on the subject, it's about human insting. I do hate Java since I use it in my AMD 586 in late 1998, the Java Virtual Machine are memory and processor hog. Despite of that, Java concepts are cool and many implemented the class & object related into others language. Java is the OOA & OOP language father.

When I saw the first version of C#, I fall in love, I don't know why. C# is fast enough for me and I like the coding style which require higher degree of details, I am not good at detail and luckily C# force me to keep on eye of details. We have .NET Framework and Mono. Visual Studio Express edition is free and you have no reason to tell that C# is expensive.

I heard that .NET especially C# couldn't replace the Java. I don't agree with it at all, C# language fundamental is mature but the new features always added. We could also programming any device we want, because the Communication to Device already supported by .NET Framework it self. The interoperability between language switch also supported on .NET, you have one team do UI in VB.NET, the master programmer do DLL development in C++ and other do WebService in C#. It's no longer a big problem, because the CIL. So it will result in same intermidate language which shared the .NET Framework.

I heard confusing name which not reflected the functions of an application in Java like WebLogic and JBoss. I don't understand what the heck is that. I really care about one ultimate programming tool that could be exploited to the limit. I don't want to learn some new framework build on a framework, it's really wasting the time.

PHP does have similar problem, we know a lot of framework and people are looking the best. Zend the official PHP developer also questioned about the good of their framework. How that could be happen? there's PEAR and many people refusing use PEAR because it's monolithic architecture, but that's good!. Search on the google and type this keyword "Best PHP Framework" and happy to choose one of them. I understand open-source spirit, but without direction it will come the big mess up. The hosting company also involved in creating problem on PHP development. If open-source is cheap or even free, so you could upgrade the hosting services regulary. You might said that not just simple, yes of course. That's why we paid for hosting company, because we believe on their expertise.

PHP is not yet enterprise class language before the PHP 6.0 is released. I am not scare you, but if you are new developer, you must start to learn how the OOP works, you must learn how programming flow is done in better way. PHP 6.0 is the version I waiting about and I will glad to use it. The future of PHP 6.0 makes people need to learn programming really hard and in the business perspective it will bring a quality products because the developer need understand what they should do in their development time. It's managable and could also in pseudo. PHP 6 should had its own Class/Objects library. This will reduce the confusion.

Ruby on Rail and .NET Framework is great of development tool. I vote for both of them for 1# 2007 development tools. Java is #2, and PHP is #10 because the mess.

From SubText 1.9.5 to BlogEngine.NET 1.2 Migration Experience

Posted by Nurasto | October 15, 2007 | Software and Web Development | 0 Comments

SubText 1.9.5 is great tool for ASP.NET user to blogging but I hate how it works especially when changing theme / skin / layout. It's still like ASP.NET 1.1 experience when you're trying to modify the engine. The site perfomance also degrading when using shared-hosting. SubText also giving me error when a user give their comments and it continues to permanent crash, I suspect Gravatar module makes this happen and a lot of error. The frustation situation became complicated when my hoster not allow me to turn off the CustomError in order to debug SubText.

I consider to use another .NET blog engine like DasBlog and Single User Blog. Unfortunetly, both of engine created for people who love blogging at extreme level which doesn't suited to casual user like me. I just need simple blogengine, easy admin interface and powerfull. I prefer Blog Engine which use ASP.NET 2.0 MasterPage technology. Before I starting to reinvent the wheel, I browse CodePlex and I found BlogEngine.NET 1.2 created by Mads Kristensen and his teams. Okay, I download the Web Project and also Source. I want to extend some function which missing in this BlogEngine like "Link" in SubText, this is essential and BlogRoll is not suitable for the job.

The Migration Process

Thanks to BlogML which provide format to exchange blog content between blog engines. Okay, I start by exporting my journal content from SubText and save it to my harddisk. I attach the file in BlogML. Now, I try to import the BlogML file into BlogEngine.Net, unluckly the import function is using WebService which my new host doesn't like it and throw "Service Unavailable" information. I retry the process and it happen again.

I test it on my development environment in my laptop, it works like charm but the comments are not imported!. I try several times and I give up, because I don't have the source of BlogEngine Import/Export source code. I ask Doctor Google, and he gives me this link http://www.codeplex.com/blogengine/Thread/View.aspx?ThreadId=11978 which contain discussion about this matter. They had release some addtional extension and allow us process Import/Export internally, which doesn't need WebService.

Now, everything goes fine and I succesfully importing my post and comments into BlogEngine.NET.  Did you know that BlogEngine have two alernative to store your blog entry? yes, BlogEngine.Net give us option to choose XML or SQL Server 2005. Unfortunetly, the new extension didn't work SQL Server. The technical thing is already solved even I must use XML to store my journal entry. Well, hope soon I could migrate to SQL Server.

Changing The Theme

Believe or not, I create a new the theme in 1 hour! comparing to SubText skins which I need 2 days to understand how it works. This is MasterPage advantage!. You just need to read "standard theme" code for several minutes and copy it into new directory. You could play around with your own Themes and the Themes instantly available in settings menu at administration area.  This still an overview, maybe I will give a tutorial on how to create our own theme from scratch :). I do create my own theme from scratch and make "standard" theme to be my guide. You'll need 2 Visual Studio instance to compare your work :).

SQL Server still my first agenda

I still working around for BlogML import/Export extension to be able to importing to SQL Server. I hope I could make some hack inside the code.

fin. 

ASP.NET, it’s Perfomance and JavaScript

Posted by Nurasto | September 27, 2007 | Software and Web Development | 0 Comments

When creating a solution with ASP.NET we should shift our mind. Most of the component make our life easier, I bit supprise when a developer don’t know SqlObjectDataSource / ObjectDataSource, which a valuable component that should be use when you’re going to ASP.NET 2.0.

The presentation is presentation layer, why don’t keep it that way?. I am not hardcore programmer like the mighty C++ programmer whom able to program in unmanaged code / MFC. Those people are top notch even compare to Java programmer. I am positioning my self as practitioner programmer, most of my time just think the logic not how to manage memory and use threading especially working in ASP.NET or PHP environment.

HTTP is stateless, is still stateless and that’s the beauty of HTTP. ASP.NET save the state using their own method like VIEW STATE which enlarge the HTML output. If you’re great developer you won’t think to much how to get rid of VIEW STATE since it’s very usefull in ASP.NET 2.0, why don’t make a setup to the and make something called Compression being enabled?. It cost less and efficient. OSI layer must keep in our mind as we move on to Web programming, Web Server have big influences to Web.

Okay, I just want to share that I get bit confused when mixing non ASP control a.k.a HTML form component like <input> to be JS controller for other ASP control. Hell, if you working with non MASTER PAGE (this ASP.NET 2.0 feature), you will be happy ever after. You know that ASP.NET would render all Response.Write BEFORE touching the component, it’s beyond of Page_Load Event and PostBack. Okay, I give you an example :

<Asp:textbox id=”textboxUser” runat=”server”/> <input type=”button” name=”xyz” onclick=”ShowUserName(‘textboxUser’)” />

Let’s pretend that we use Master Page. Okay we have code in Javascript (we use IE) :

<script type=”text/javascript”>

function ShowUserName(controller) {

var obj = document.getElementById(controller);

window.alert(obj.value);

}

You will get error … yes, you will get error!. Why? because we using MasterPage, so the real ID is not textBoxUser but ctl00_ContentPlaceHolder1_textBoxUser. You could specify it manually, like :

<Asp:textbox id=”textboxUser” runat=”server”/> <input type=”button” name=”xyz” onclick=”ShowUserName(‘ctl00_ContentPlaceHolder1_textboxUser’)” />

but, this isn’t good because sometime you want rename the ContentPlaceHolder1 into ContentPlaceHolderXYZ, then you will get crash. You know what will be happen next, you must rewrite ALL control ID in your onclick event. There’s some elegant way, and you won’t deal with Response.Write(). You could use <%= textboxUser.ClientID %> and we need to add this to our input button onclick event :

<Asp:textbox id=”textboxUser” runat=”server”/> <input type=”button” name=”xyz” onclick=”ShowUserName(‘<%= textboxUser.ClientID %>’)” />

and you’re done. So, if you bos doesn’t like postback and I don’t know why they think postback will be happen when OnClientClick is rendered as OnClick at the browser which doesn’t create a postback, and love to use the hardway. Please don’t hesitate to show up your self to you bos that you could done a wrecking ASP.NET 2.0 fundamental.

Don’t think that Ajax will create a “Wow” functional experience, it could wreck. If you’re running business a dollar means a lot, you should see this page http://ajaxian.com/archives/accessibility-use-ajax-get-sued. AJAX will help user, but for high transaction business, leave it to HTML Form, using PostBack will save your day. I will be safer, traditional is old-school but safer!.

Happy hacking the ASP.NET 2.0 and wait a second, you will go to ASP.NET 3.5. Tell your mate at your IT/IS Solution company who love DataList  especially in Indonesia to begin learning about GridView and the DataSources component. ASP.NET is growing. And tell them not to use CodeSmith which is confusing, because they never write the code and force them to use ObjectDataSource which built-in in your Visual Studio 2005. I recommend SubSonic rather than CodeSmith as DAL.

WishList: Own a mySQL “superduper” extension on my PHP production server

Posted by Nurasto | August 30, 2007 | Software and Web Development | 0 Comments

I hope much from PHP 5 and MySQL 5 when developing a application which provide summary reports. The constraint is coming from the requirement. OK, I make the code with full PHP 5 and MySQL 5 features.

I have 3 master tables which have one to many relationship. I am looking for feature that could combine the three table, and I do INNER JOIN on those 3 tables. I should retype this as variable in PHP code, which is hard to read and I should send several bytes to MySQL Server.

Description of SQL code that I build (this is fake, i am trying to give a case):

SELECT A.User, B.Thread, B.ThreadName, C.Topic FROM myUsers AS a 
INNER JOIN myThread as B ON a.id_user = b.id_user
INNER JOIN myTopic AS C ON b.id_thread = c.id_thread;

Maybe you ask, why I don’t use asterisk near SELECT (example SELECT * FROM)? because I don’t need all fields and I want perfomance!. For queries like this the asterisk giving big impact perfomance output. Can you Imagine how long the query is? and when needed the WHERE clause also be used on the queries.

Oh yeah, you might said . Just use variables in PHP!. Heck, the matter is not that simple, I want 75% process is held on mySQL server because I need computing and processing to currency with SUM, MAX, MIN, and so on so forth. 

The purpose is PHP + HTML become the presentation layer. I would use stored procedure when knowing have to create a summary, but I was develop too far which give me effort and time to edit all mySQL command into mySQLi. I should consider to use mySQLi extension for next projects. The disadvantage to use mySQLi is run slow for some machine.

According to PHP manual, mySQLi could support for mySQL server version 4.1 and above. Which help me to use Store Procedure. I remember that mySQL have connector, because I am using it in .NET too. I visit mySQL developer website and I found no connector for mySQL 5.0.45. The stories goes on and I am looking the best way to make the process faster.

I really want to use VIEW feature in mySQL to shortening the long code like that, so I just call

SELECT * FROM myViewTable

and giving the same result as the previous query. Well, the code is finished and I use it for fun in mysql client console. I read that VIEW have limitation, so I don’t use it.

Now, the code is working good but often make the CPU work hard, it utilize around 84% – 100% only for mySQL. In some case, maximum timeout is arise. This is happen because the bootleneck between PHP engine and mySQL server, so user must wait a moment when generating report in real time. Increasing maximum time for processing and memory available for php engine is just for temporarily solution.

Is there any mySQL “superduper” extension?. One conclusion has been made:The production server will always need continuously patched with new version of connector to make the availability of the web application reached.

Another question is came up to the case, “Are LAMP ready for Enterprise and OLAP application?”.

Bit and Bytes

Hello. My name is Dityo Nurasto. I am working as freelance software and web developer.

This is my personal playground. Enjoy your stay and don't hesitate to send comments.

ShoutBox