Posts

Kentico 7 Get Current Date Time using macro

In Kentico 8, you can call the macro method to show date-time information just like C# code which is : {%DateTime.Now%} But for Kentico version 7, you can not call date-time in a macro using the above code. So I have to wonder how to call the date-time using a macro in Kentico 7 and how to format the date-time. Below is a solution to achieve this in Kentico 7. Get Date Time {% CurrentDateTime%} Format Date Time  {% GetDateTime(CurrentDateTime, "MM dd yyyy")%} Hopefully, the above solution helps someone.

How to create multiple tab on android app

Image
This tutorial to show how to create multiple tab on Android App. This example using android studio. Kindly download the studio here ( https://developer.android.com/sdk/index.html ) Step By Step 1. Open Android Studio. 2. Choose Start New Android Studio Project 3. Set Application Name "Three tab example" 4. Choose Phone Or Tablet  Note : Minimum SDK means the lower SDK that your application will support. The more higher your API level the Less phone can support your application. This is because not every phone now have latest version of android OS.  5. Choose Tabbed Activity 6. Set Navigation Style to Action Bar Tabs With View Pager 7. Click Finish button. Now you have basic android app with three tab navigation. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

Optimize compilation for a complex projects

Image
Most of the web applications nowadays are complex applications that maybe have more than 50MB source code to deploy on the server and it will lead to a long compilation time around 3-10 minutes depends on the server resources. Some will say, it still ok to wait for the compilation since it only happens for the first time. What about require to change the source code with a very minimal code of line.? Like one line only.? Do you still love to wait 3-10 minutes? The answer is no. But how to avoid this situation. It is simple, just one line of configuration on the web.config will help to fasten compilation code (Just in time compilation). The answer is put : optimizeCompilations="true" as an attribute on the compilation element in the web.config file.

Force to download file in ASP.NET

This is an example of how to force the current HTTP Context Response to download files. Before that, you need to set a path/folder in your web application to store files that you just created or pre-set the file to download. In ASP.NET this is the way to set a path. Since we can use the tiddler("~") symbol to referring to the root with a virtual path set from IIS. string pathFile = Server.MapPath(Request.ApplicationPath); Force download method : string pathFile = Server.MapPath(Request.ApplicationPath); Response.AddHeader("Content-Type", "application/octet-stream"); Response.AddHeader("Content-Transfer-Encoding", "Binary"); Response.AddHeader("Content-disposition", "attachment; filename=\"" + yourfilename + ".csv\""); Response.WriteFile(pathFile + yourfilename + ".csv"); Response.End();

Fix issue file not upload to server with Multiview + File Upload + UpdatePanel - asp.net

Recently I have developed some modules to upload the file to the server. In my code, I have an update panel and also the multiview. Somehow the upload not working. So I thought I was not set the full postback for the upload process in the trigger section under the update panel. But actually, the full postback was set correctly. So I wonder, why the upload not working.  So I start to investigate my code, and luckily I found the solution. The solution  I just need to set enctype attribute at the form and value  multipart/form-data. This is the code I use. protected override void OnInit(EventArgs e) { base.OnInit(e); Page.Form.Attributes.Add("enctype", "multipart/form-data"); } Hopefully, this simple solution helps someone.

Jquery Mobile, document ready not fire.

Today i have experience some weird situation which i already put the alert script on my mobile html page, but the alert didn't show. The alert script not put at the homepage, but at the url provided, when click the button then will redirect current page to the new page with contain alert script. For me,this is so weird. No error on script. At the first place i though it was cache.. so i click on refresh button.. So i just assume it is cache. But after a while, it always need to refresh only show the alert message. So i start googling the problem. Some folks says need to clear  cache, close open the browser, and put some funny funny script just to clear the cache.. But still the problem exist. After keep looking, i found the answer in here :  Demo JQuery The document say, if want to put html "a" tag, need to put some attribute based on what are the requirement you want. Example : if you want to redirect the current page to the new page : <a href="newpage.html"

Example Lock Dataset in C#

This is an example of how to lock your database or prevent data in the dataset to changed (read-only dataset). In a large web application, you may have a reference table in the database, and the application no need to read on the reference table every time the application needs to get a reference. You can store the reference table in cache memory. But you afraid that the data might accidentally  changed by your code. This is the way to make your dataset lock / read-only. Lock Dataset method /// <summary> /// Makes the given DataSet read-only /// </summary> /// <param name="ds">DataSet</param> public static void LockDataSet(DataSet ds) { // Do not lock null if (ds == null) { return; } EventHandler locked = (sender, e) => { string msg = String.Format("DataSet '{0}' cannot be modified, it is read-only.", ds.DataSetName);