Monday, September 30, 2013

Crystal Report - Load Report Failed on ASP.Net Page deployed in IIS 7 - Windows Server 2008 x64

Load Report Failed 
Yesterday i got this error, when i'm trying to load my crystal report in production machine. This one is a generic error, it means that, you maybe wondering where this error come from, even i'm wondering too ^^.
Before, in my development machine, everything is fine, i can see the report. 
When i tried to deploy it in my production machine, suddenly this error show up.

This is what i do to solve this problem :
1. Go to IIS -> Application Pools
2. Right click on DefaultAppPool (or application pools that your site using) --> Choose advanced Settings...
If you are thinking How To : Check Application Pools that a site is using from IIS 7, please click the link
3. Choose identity
4.Choose Network Services
5.Choose Ok and then Ok again

You are ready to go ^^

Off  course there some things that you need to check first, like :
1. Gave full rights for “C:\WINDOWS\Temp” folder depending on IIS user
2. Redistributable crystal version has installed
Reference : Sendy Santoso (http://geekydeveloper.blogspot.com/)

source : http://geekydeveloper.blogspot.com/2011/05/crystal-report-load-report-failed-on.html

Sunday, September 29, 2013

Formula show datetime ปี พ.ศ. / ค.ศ. ตามชื่อ ใน crystal report

if left({CUSP_PharmacyInfantsVaccineReport_GetList.FullName},1) in ['A' TO  'Z'] THEN
cstr({CUSP_PharmacyInfantsVaccineReport_GetList.Birthday},'dd') +'/'+ totext(Month({CUSP_PharmacyInfantsVaccineReport_GetList.Birthday}),"00")+'/' + cstr({CUSP_PharmacyInfantsVaccineReport_GetList.Birthday}, 'yyyy')
else
cstr({CUSP_PharmacyInfantsVaccineReport_GetList.Birthday},'dd') +'/'+ totext(Month({CUSP_PharmacyInfantsVaccineReport_GetList.Birthday}),"00")+'/'
 + cstr(DateAdd("yyyy",543,{CUSP_PharmacyInfantsVaccineReport_GetList.Birthday}), 'yyyy')

Thursday, September 26, 2013

Function ConvertDateDDMMYYY

CREATE  FUNCTION [dbo].[ConvertDateDDMMYYY]
(
-- Add the parameters for the function here
@DateConvert DATETIME,
@IsThaiDate bit
)
RETURNS NVARCHAR(10)
AS
BEGIN
-- Declare the return variable here
DECLARE @DateConv NVARCHAR(10)

-- Add the T-SQL statements to compute the return value here
SET @DateConvert = ISNULL(@DateConvert,GETDATE())

-- SELECT @DateConv = CAST(DATEPART(YYYY,@DateConvert) AS NVARCHAR)
-- + CASE WHEN LEN(DATEPART(MM,@DateConvert)) = 1 THEN '0' + CAST(DATEPART(MM,@DateConvert) AS NVARCHAR)
--   ELSE CAST(DATEPART(MM,@DateConvert) AS NVARCHAR) END
-- + CASE WHEN LEN(DATEPART(dd,@DateConvert)) = 1 THEN '0' + CAST(DATEPART(dd,@DateConvert) AS NVARCHAR)
--   ELSE CAST(DATEPART(dd,@DateConvert) AS NVARCHAR) END

SELECT @DateConv = CASE WHEN LEN(DATEPART(dd,@DateConvert)) = 1 THEN '0' + CAST(DATEPART(dd,@DateConvert) AS NVARCHAR)
  ELSE CAST(DATEPART(dd,@DateConvert) AS NVARCHAR) END
+'/'+ CASE WHEN LEN(DATEPART(MM,@DateConvert)) = 1 THEN '0' + CAST(DATEPART(MM,@DateConvert) AS NVARCHAR)
  ELSE CAST(DATEPART(MM,@DateConvert) AS NVARCHAR) END
+'/'+ CASE WHEN @IsThaiDate = 0 THEN CAST(DATEPART(YYYY,@DateConvert) AS NVARCHAR)
  ELSE dbo.UFN_GetUserLanguage(CAST((DATEPART(YYYY,@DateConvert) + 543)AS NVARCHAR), CAST(DATEPART(YYYY,@DateConvert)AS NVARCHAR)) END
-- Return the result of the function
RETURN @DateConv

END

Friday, September 13, 2013

Add favicon to your web site or html page

Favicon icon means Favorites, as this icon will be shown next to the bookmark in the favorites. Apart from this, the new version of different browser also shows this icon on number of places like Tab Tile, Title bar etc. Having an icon for a web site allows the users to easily identify the site without reading the description.

Create a Favicon?

Faviicon is a 16x16 .ico file which can be created from any standard icon file creator. You may use Visual Studio to create this. You can also create this online from some sites life favicon.cc

Add favicon to your web page

To add a favicon to you web page just place the favicon in the root directory of the application. Other way, if you want to install it for a sub folder then place it the the folder itself or specify the path of the favicon in you web page head section
<link href="favicon.ico" rel="icon" type="image/x-icon" />
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon">


source : 

"Default Text" Fields Using Simple jQuery Trick

A lots of the time you want to add instructions to text box fields of the page to provide usability information to the users. Alternate way of doing this could be using default text in the input fields. A default text is the text which appears in the text box when it is empty. e.g.
Name
Email
Website
Comment
You can see this is useful and good idea to have this in the UI. There is an easy trick in jQuery to do this. Below is the step by step procedure to do this.

Step1

If you don't have jQuery then download latest from its website and include in you page.
<script src="jquery.js" type="text/javascript"></script>

Step 2

Create two CSS classes defaultText and defaultTextActive as mentioned below.
<style media="screen" type="text/css">
    .defaultText { width: 300px; }
    .defaultTextActive { color: #a1a1a1; font-style: italic; }
</style>

Step 3

Add this JavaScript to you page
<script language="javascript">
<!--
$(document).ready(function()
{
    $(".defaultText").focus(function(srcc)
    {
        if ($(this).val() == $(this)[0].title)
        {
            $(this).removeClass("defaultTextActive");
            $(this).val("");
        }
    });
    
    $(".defaultText").blur(function()
    {
        if ($(this).val() == "")
        {
            $(this).addClass("defaultTextActive");
            $(this).val($(this)[0].title);
        }
    });
    
    $(".defaultText").blur();        
});
//-->
</script>

Step 4

To every text field or text area where you want to apply default text add "defaultText" as css class and specify the default text in the title attribute. e.g.
<input class="defaultText" title="e.g. someone@example.com" type="text" />
You default text setup is ready. Run the page and see the magic. Click here for a running sample page.

Layout Form without Tables with CSS Trick

How to design a form without using any table or nested div
Creating a form with lots of field could be a tedious task as it involves playing with TR and TD in html table. Along with that it also increases the size and complexity of the html code of out page. e.g. Look at the below form:






Could you imagine it to create without using table or nested div. Well if no then you can just by using easy CSS trick. here is the whole css + html code for doing this.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Layout Form without Tables</title>
    <style type="text/css">
    .formLayout
    {
        background-color: #f3f3f3;
        border: solid 1px #a1a1a1;
        padding: 10px;
        width: 300px;
    }
    
    .formLayout label, .formLayout input
    {
        display: block;
        width: 120px;
        float: left;
        margin-bottom: 10px;
    }
 
    .formLayout label
    {
        text-align: right;
        padding-right: 20px;
    }
 
    br
    {
        clear: left;
    }
    </style>
</head>
<body>
    <div class="formLayout">
        <label>Title</label>
        <select>
            <option>Mr.</option>
            <option>Dr.</option>
            <option>Ms.</option>
            <option>Mrs.</option>
        </select><br>
        <label>First Name</label>
        <input id="name" name="name"><br>
        <label>Last Name</label>
        <input id="Text1" name="name"><br>
        <label>Address</label>
        <input id="address1"><br>
        <label></label>
        <input id="address2"><br>
        <label>City</label>
        <select id="city">
            <option>New York</option>
            <option>Chicago</option>
            <option>etc.</option>
        </select><br>
        <label>Zip</label>
        <input id="zip"><br>
    </div>
</body>
</html>
source : http://www.dailycoding.com/Posts/layout_form_without_tables_with_css_trick.aspx

ImageLens – A jQuery plug-in for Lens Effect Image Zooming


I was searching a good jQuery plug-in for image zooming but couldn't find any which was matching my criteria. I need the lens effect while zooming images and it should work without much plumbing. So, I decided to create one and now sharing this with everyone.

What I need to use this?

  1. jQuery
  2. ImageLens plug-in – jquery.imagelens.js
  3. An image

How to use this?

Include jQuery and jquery.imageLens.js in you web page -
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.imageLens.js" type="text/javascript"></script>
For default image lens just use imageLens as below. Note that it will automatically calculate actual size of image and start showing zooming -
$("#img_01").imageLens();

Note - If you are using IE 8 or lower than you will see a square lens

(hover on image to see the lens effect)


If you thumbnail  image is different from zoomed image then you can specify custom image source -
$("#img_03").imageLens({ imageSrc: "sample01.jpg" });
(hover on image to see the lens effect)

You can also change lens size -
$("#img_02").imageLens({ lensSize: 200 });
(hover on image to see the lens effect)

There are some more attributes you can adjust in the lens like border color and border size -
$("#img_04").imageLens({ borderSize: 8, borderColor: "#06f" });
(hover on image to see the lens effect)

source : http://www.dailycoding.com/Posts/imagelens__a_jquery_plugin_for_lens_effect_image_zooming.aspx

Wednesday, September 11, 2013

Display Loading Image While Page Loads


Published April 15, 2013 by Brad Knutson
Display Loading Image While Page Loads
Often times as web developers, we build websites that are fairly media intensive. Lots of graphics, slideshows, large Javascript files, large CSS files, etc, etc. It’s not uncommon for page load times to suffer on some really visually appealing and well designed pages.
There has to be a better way to display these pages, rather than watch the awesome background image that we created load literally line by line.
This topic got me thinking. Certainly, the first area we should look at is optimizing our images, minifying our stylesheets and scripts, and doing anything we can to reduce the weight and bandwidth strain the end user feels. In some cases however, design and functionality outweight a slight delay in page load time. Clients like seeing really stunning and visually appealing pages, jQuery functions “wow” them – and that’s great – but page load times can suffer.
In cases where we do not want to sacrifice style and design for page load time, perhaps we should consider another alternative? What about displaying a page loading image while the page loads gracefully in the background, out of site? How can we accomplish this?

Find a page loading graphic

If your a talented designer and want to make one yourself, by all means go right ahead. For the rest of us, a quick Google search for “page loading gif” will produce some good results. Make sure you find an image (perhaps from a stock image site) that doesn’t have any usage restrictions. Remember to protect yourself. Here is one I found.
Page Loading Gif

Add the Page Loader Div

Add the below div right below the opening <body> tag.

<div class="loader"></div>

Add some CSS

.loader {
 position: fixed;
 left: 0px;
 top: 0px;
 width: 100%;
 height: 100%;
 z-index: 9999;
 background: url('images/page-loader.gif') 50% 50% no-repeat rgb(249,249,249);
}
This ensures that the page loading image is centered on a near white background (change color as desired) and covers the entire screen. The z-index positions the full-screen div on top of all the other elements, hiding them behind it while they load.

Add jQuery and a line of code

The final step is to add a link to the jQuery library in the header, as well as a simple jQuery function call. Add this above the closing </head> tag.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
 $(".loader").fadeOut("slow");
})
</script>
Without this jQuery function, the page loading div would cover the entire page indefinitely. The jQuery function waits until the DOM has completely loaded, then fades the page loader div out of view, showing the contents behind it.
As soon as your browser caches the contents of the DOM, page load times will increase dramatically. I’ve purposely added some fairly large size images to the demo I’ve linked to above, but you’ll likely only see the full effect the first time you load the page. To see it again in all it’s glory, try clearing your browser’s cache or trying it in another browser.
I don’t believe this method should be used on all sites, but we’ve all seen media intensive sites that utilize this method. It is a nice placeholder as opposed to watching images and CSS load slowly on our screen.
Leave a comment below if you have any questions!

source : http://bradsknutson.com/blog/display-loading-image-while-page-loads/

jQuery Show Loading Image While Page Loads or Show Loading Image in Webpage while Page Loads

Introduction

Here I will explain how to use 
jQuery to show loading image while page loading in jQuery or show loading image in webpage while page loading instead of blank page in jQuery.


To show loading image on page load we need to define load function in jQuery during pageload and need to write css class to show loading image for that we need to write code like as shown below

// jQuery Plugin and calling function in page load
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#pageloaddiv").fadeOut(2000);
});
</script>

// CSS Class
<style type="text/css">
#pageloaddiv {
positionfixed;
left0px;
top0px;
width100%;
height100%;
z-index1000;
backgroundurl('pageloader.gif') no-repeat center center;
}
</style>

// loading div to show loading image
<div id="pageloaddiv"></div>

If you want check this code in complete example check below code

Example:


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Show Loading Image while Page loading</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#pageloaddiv").fadeOut(2000);
});
</script>
<style type="text/css">
#pageloaddiv {
positionfixed;
left0px;
top0px;
width100%;
height100%;
z-index1000;
backgroundurl('pageloader.gif') no-repeat center center;
}
</style>
</head>
<body>
<div id="pageloaddiv"></div>
</body>
</html>
Live Demo



source : http://www.aspdotnet-suresh.com/2013/09/jquery-show-loading-image-while-page-loads.html