Orchard – Slow?


Hello! I’m back!

Lately there was an issue related to a site that I have published. It was using Orchard 1.4.1 and it is (the client think) is slow. I am confused for the first when I face the issue. “It is running so fast in my computer!”, I said. But then it was a client and of course, they didn’t accept such reason.

Then I began to browse for the solutions and I got some as described below.

  1. Maintain the server performance (IIS) on this Orchard documentation, I found that some steps may be taken. Managing App Pool Recycle can be useful too. 🙂
  2. Updating your Orchard. This discussion clearly describe that updating orchard can make the site runs faster.
  3. I reference back to the first link. Removing the unused modules. I was using Disqus for the website’s comment system. What I got is a complaint from the client for their web is so slow. I can’t blame them for the slow connection. Disqus load outside files and data. Then I try to calm them down using normal comment from Orchard and it runs a bit faster. Well, not quite a good decision for I have to implement some more functions so that the Orchard.Comments will act like Disqus. Fool indeed.

That’s the three maintenance that I have done. I think the site runs quite faster now. I hope they like it.

Advertisements

Orchard – Deployment


Hi there!

I haven’t post anything yesterday so I think I will post two posts today. This is the first. This actually happens yesterday when I am trying to deploy a web that is using Orchard CMS.

I found that some steps (cheating steps actually) to deploy it easily and quick. I am using FTP publish method from VS 2010.

  1. Prepare your source code ready. Prepare the FTP server ready too. Create SQL dump statement that contains your web’s database.
  2. If there are files in the FTP already, back it up.
  3. Execute your SQL statement in the target database
  4. Using the given user from the database admin, update the default site to the new environment.
  5. Change the setting in ~/App_Data/Sites/Default/Settings.txt so that your connection string match the publish environment.
  6. Set your build to release mode in Visual Studio.
  7. Configure your publish method to FTP and publish it to the FTP server
  8. Change all localhost:port to the new site in your code. ex: wwww.this-is-the-new-web.com
  9. Publish it

Quite easy and simple steps. Sometimes, there is an error. You can check the log for more details. Log is located at ~/App_Data/Logs/. Error that I meet is that the user given by the DB admin can’t access the database. So I have to ask the DB admin to let the user access it. That’s all.

TFS – My View (1)


It is funny when I use TFS from Microsoft. Not I want to judge them badly, I am just saying my opinion. Well I am using that because it is one of the requirement from a very influenced client. They have implement TFS and stuffs, so I follow.

Okay, what I feel is not so good is that TFS freeze my Visual Studio every time I want to perform check-in. Well, my connection may be slow, but it is the main problem. The server out there may have been waiting for long, my machine is waiting. They both keep waiting, and stupid time. I can’t continue on my work. What should I do? Edit those codes that using Framework using notepad++? What about no?!

I think it is very important for such tasks to be done in the background. So that small developer like me wont have to wait for long to continue working.

And also I add an index (1) there at the title because I want this impression to continue. It is not always bad what this TFS had.

Sitecore – Extra Fields on Membership


Hello! Now I want to discuss about membership in Sitecore. I won’t tell in detail. I will focus in how could these membership can be used simply for some features.

In my application, there’s a membership that using extranet\ role. So I use membership class. Membership in Sitecore is basically the same with .NET Membership class. Well, they inherit .NET. So if you’ve learned and know about .NET membership class, you can make log in, log out, register, forgot password, and edit profile page easily. And also, if you want such tutorial, I won’t giving it because if you google it, there are blogs that have given step-by-step guide already. Just follow it. 🙂

Sitecore allows us to create an extra field. What is that? I don’t know exactly, but you can add a field on your user object and it will be stored in database. Let’s not discuss about how Sitecore manage it. These fields can be accessed like a dictionary (array of object with string as the key). It makes the custom fields are easier to manage. You just have to define the key then use it everywhere.

You also knew that developers can create a custom membership for sitecore. But as I look deeper, it is confusing if you only have a short time to develop a complex membership (confusing if you are new to Sitecore of course). So let’s just use this custom field where you can add values just by adding fields needed. For example in my app, I want the user have phone number and address. Should I create a custom membership and let even the administrative users have phone number and address? I don’t think so. I could just add two fields every time an extranet\ user register their account. I can edit those two fields anytime I want to.

For now I can’t give you the code example because I am not at my office and I left the code there. I promise will edit this tomorrow.

edit:
To create those extra field, you can modify the code below.

Sitecore.Security.Accounts.User user = authHelper.GetActiveUser();
user.Profile.SetCustomProperty("key", "value");
user.Profile.Save();

Sitecore – Web Service


I don’t know whether I should hold my post for another day or I keep posting everything. But well, I am in mood to post things, so here it is.

Somehow, I develop a web that using javascript to run a serverside method. Yes, sometimes you need that. I figure it out how to use that and I got the answer: web service.

Sitecore has provide its developer with a web service to access some functions. You can find it on /sitecore/shell/Webservice/Service.asmx Well they provide some useful functions I told you and you might need that. But those functions are not always needed (I guess). For me, (I don’t know about others) I use web service to access data that my application provide not the data that CMS provide for my application. For example, sitecore is providing me the list of users, I really don’t need to use web service (at least until now) to access that. My application provide a list of products and I need to access them from anywhere. Oh, and by the way, if you use the web service that Sitecore provide you will be logged in as sitecore/* user.

So, I create a custom web service in my application. Just say that the web service provide me a function that returns a list of string. I have to call it using javascript. How do I do that? Here’s the step.

  1. Add [System.Web.Script.Services.ScriptService] tag before your web service class definition. So it will become like the code below.

    [System.Web.Script.Services.ScriptService]
    public class ClassName : System.Web.Services.WebService
    
  2. You need to register your service in your web control. Using the code below, you can register the web service as a script on a control.

    <asp:ScriptManager ID="_scriptManager" runat="server">
      <Services>
        <asp:ServiceReference Path="/path/to/your/web/service.asmx" />
      </Services>
    </asp:ScriptManager>
    
  3. Then you may call it using javascript using the code below.

    The.Namespace.Of.Your.Web.Service.WSName.MethodName([params,]OnSuccess,OnFail,userContext);
    

    Params is all parameters needed by your web service method. OnSuccess is a function that will process the result if there is no error. OnFail is a function that will process the result if there is any error. And I haven’t used userContext. 😀

  4. the function to process the result will be like

    function FunctionName(result) {
        /* body */
    }
    

Simple right? Just four steps to use it. You can do most of anything. And if you want to use the web service from the server side C# code, it becomes even simpler. You only need to add reference then use it as you like.

Sitecore – Intro


Hello all!

I am new to Sitecore CMS, yet I want to share my experience with this CMS. Please, don’t expect me to post powerful and super awesome posts like Alex Shyba did in his blog. Well, he is a master, and I am a newbie.

The first time I saw this CMS, I am impressed. “Wow! This worth the price!” I am not the one who pays for the license. My company pays. 😀 Sitecore is a powerful CMS and I like it. You can create (almost) anything there. Well, why I would say something like that? Because it is using .net and C#. Yes, I am C# addict.

But if you expect to have a very well documented CMS and a very good step by step development process, please, Sitecore is not providing that. I saw the documentation and it is for advance developers who have developed many sites. Why would I say something like that? Well, it is not step by step and the information provided is not so complete. In the end you will need to search the internet for step by step guide, but when you read the documentation, every step is written there but not in a very clear order.

In summary, Sitecore is a good CMS. +1 because it have Sitecore Rock in Visual Studio. +1 for it can do various things. -1 For it has a bad documentation. And I have to say, it worth the price.