Friday, May 25, 2012

Identifying data type in literals without casting

Learning c#. When declaring literals, it turns out there is are some special suffix characters you can use to declare data type. They are:

• M (deciMal)
• D (Double)
• F (Float)
•L (Long)

So, for example, if you do the following:

decimal salesTaxRate = 6.5;

The compiler will interpret the literal "6.5" as a double, and you're going to have problems. But, just append a"D" and you're good. Like so:

decimal salesTaxRate = 6.5M;

Now the compiler interprets 6.5 as a fixed-point decimal, instead of a floating point double. 

Why the compiler can't just assume that the double literal needs to be cast to a decimal, I can't say. Maybe one of the C# experts out there can say?

Multiple LEFT JOINs in MS Access

I had forgotten about this one. In Microsoft Access, if you want to do more than one LEFT JOIN, you have to use parenthesis in the FROM clause. So, for example, instead of just plain old:

SELECT a.columna, b.columnb, c.columnc
FROM tablea AS a LEFT JOIN tableb AS b ON a.id = b.id LEFT JOIN tablec AS c ON a.id = c.id

you would have to do the following:

SELECT a.columna, b.columnb, c.columnc
FROM ((tablea AS a) LEFT JOIN tableb AS b ON a.id = b.id) LEFT JOIN tablec AS c ON a.id = c.id

Otherwise, you get a "Missing Operator" error. Stupid Access.

--Update 10/29/2009--
Incidentally, this should work with other sorts of joins as well.

MS Access, SQL JOIN syntax for 3-way table join

In Microsoft Access, if you want to do more than one LEFT JOIN, you have to use parenthesis in the FROM clause otherwise, you get a "Missing Operator" error.



  1. SELECT a.columna, b.columnb, c.columnc
  2. FROM ((tablea AS a) LEFT JOIN tableb AS b ON a.id = b.id)
  3. LEFT JOIN tablec AS c ON a.id = c.id
  4.  
  5.  
  6. --Or, without the AS syntax...
  7. SELECT tablea.columna, tableb.columnb, tablec.columnc
  8. FROM (tablea LEFT JOIN tableb ON tablea.id = tableb.id)
  9. LEFT JOIN tablec ON tablea.id = tablec.id

Saturday, May 19, 2012

String was not recognized as a valid DateTime C#


Im stuck here why i run my project in local properly but when i upload to server got this error.
i passing like this.

///////////////////in js///////////////////
'&dFrom='+Ext.getCmp('txtDateFrom').getValue().dateFormat('m/d/Y')
'dTo=' + Ext.getCmp('txtDateTo').getValue().dateFormat('m/d/Y')

///////////////////in c/////////////////////
 DateTime dFrom;
 DateTime dTo;
 dFrom = Convert.ToDateTime(Request.Params["dFrom"]);
 dTo = Convert.ToDateTime(Request.Params["dTo"]);


Solution:
1. Make date string format as looks like "dd/MMM/yyyy"


this.Text="22/may/2012";
 DateTime dFrom;
 dFrom = Convert.ToDateTime(this.Text);

2.May be  a culture problem
try to use ParseExact
DateTime.ParseExact(Request.Params["dFrom"], "MM/dd/yyyy", CultureInfo.InvariantCulture)
3.Try other sample too
  Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); //dd/MM/yyyy

    this.Text="22/11/2009";

    DateTime date = DateTime.Parse(this.Text);
For more details go here:

Thursday, May 17, 2012

9 Mobile Framework to Kick Start Your Mobile Development Career


Introduction

Mobile development has been growing since the day Apple introduced iPhone. Mobile browser has never been so robust. It supports HTML5, CSS3 even with CSS animation. After that, Google introduced Android, and the era of mobile platform has began.
In the mobile industry, it has quite a few of frameworks available aiming to create a mobile web app rapidly. To help you start up your mobile development, I have done some research on all mobile frameworks, and below is the list. I have used jQTouch before, it's pretty easy to implement but definitely has a lot of room of improvement.
  • Zepto.jsZepto.js is a minimalist JavaScript framework for mobile WebKit browsers, with a jQuery-compatible syntax. The goal: a 2-5k library that handles most basic drudge work with a nice API so you can concentrate on getting stuff done. Zepto.js is currently in early beta, and you can help to make it awesome by contributing code, documentation and demos.
  • DynamicXDHTMLX Touch is an HTML5-based JavaScript library for building mobile web applications. It‚Äôs not just a set of UI widgets, but a complete framework that allows you to create eye-catching, cross-platform web applications for mobile and touch-screen devices.
  • SenchaSencha Touch, the first HTML5 mobile JavaScript framework that allows you to develop mobile web apps that look and feel native on iPhone and Android touchscreen devices, has just hit the big 1.0. And best of all, it‚Äôs completely free to use.
  • jQuery MobileA unified user interface system across all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design.
  • jQTouchA jQuery plugin for mobile web development on the iPhone, iPod Touch, and other forward-thinking devices.
  • Wink ToolKitWink toolkit is a mobile JavaScript framework for building webapps on iPhone, iPad and Android
  • iUIiUI is a framework consisting of a JavaScript library, CSS, and images for developing advanced mobile webapps for iPhone and comparable/compatible devices.
  • iWebkitiWebKit is a file package designed to help you create your own iPhone, iPod Touch and iPad compatible website or webapp.
  • WebAPP.netWebApp.Net is a light weight, powerful javascript framework taking advantage of AJAX technology. It provides a full set of ready to use components to help you develop, quickly and easily, advanced mobile web applications.

Tuesday, May 15, 2012

Windows 7 - HomeGroup Desktop Icon - Add or Remove

EXAMPLE: HomeGroup desktop icon

Here's How:
1. To Add the HomeGroup Desktop Icon
A) Click on the Download button below to download the file below.
Add_HomeGroup_Desktop_Icon.zip 
download
B) Go to step 3.
2. To Remove the HomeGroup Desktop Icon
A) Click on the Download button below to download the file below.
Remove_HomeGroup_Desktop_Icon.zip

download
3. Click on Save, and save the .zip file to the desktop.

4. Open the .zip file and extract the .reg file to the desktop.

5. Right click on the downloaded .reg file and click on Merge.

6. Click on RunYes, and OK when prompted.

7. Log off and log on, or restart the computer to apply.

8. When done, you can delete the downloaded .reg and .zip files on the desktop if you like.

Friday, May 11, 2012

Examining .NET 4.0 with C#: ExpandoObject


 I brought up the C#:
1public string Name { getset; }
syntactic sugar, it still isn’t as clean or concise as Ruby:
1class Person
2   attr_accessor :first_name:last_name
3end
or what he envisioned for Java:
1//context of another
2class Person p = new Person();
3p.firstName := "John";
where the getter and setter are automatically appended to the Person object by the compiler.
Well, .NET 4.0 still isn’t quite as cool and concise, but it is getting closer with the introduction of the ExpandoObject. By adding the following using statement:
1using System.Dynamic;
you now get the ability to write code like:
1dynamic p = new ExpandoObject();
2p.firstName = "John";
Oh, and did I mention that you get IntelliSense with it as well?
IntelliSense with ExpandoObject properties.
You still get IntelliSense with ExpandoObject dynamic properties.
When using ExpandoObject(s) with .NET 4.0 and C#, you get IntelliSense for all of the dynamically generated fields.
link: http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject(v=VS.100).aspx