MOSSO Cloud Computing for .NET, IIS7
Shared Hosting, VPS, Dedicated Server
The ASP.NET MVC Information Portal
The ASP.NET MVC (Model View Controller) framework is one of the most talked about and long awaited additions to the Microsoft world of web development. Find and follow all the news, announcements, blog posts, tutorials, tips, and other resources on AspDotNetMVC.com.
The easiest way to export data from MS SQL Server to a csv or text file
Run the query (SELECT * FROM tablename) to get all the data in Query Analyzer, then copy and paste the results from there into Excel. Then save as csv file type.
MSSQL
mysqldump — A Database Backup Program for MySQL
There are three general ways to invoke mysqldump:
shell>
mysqldump [options]db_name[tables]shell>
mysqldump [options] --databasesdb_name1[db_name2db_name3...]shell>
mysqldump [options] --all-databasesIn its simplest form, the mysqldump utility can be used like this:
mysqldump –-user [user name] –-password=[password] [database name] > [dump file]
this will include both the schema and data as well.
If you need only the schema use the -d or --no-data option
e.g. mysqldump -d -u root -pp@ssword mydatabase > mydatabase.sql
Reference: MySQL :: MySQL 5.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program
Yahoo YUI CSS Library
First of all, include the external stylesheet: <link rel=”stylesheet” type=”text/css” href=”http://yui.yahooapis.com/2.5.2/build/reset-fonts-grids/reset-fonts-grids.css”>
CSS Reset (neutralizes browser CSS styles) CSS Base (applies consistent style foundation for common elements) CSS Fonts (foundation for typography and font-sizing) CSS Grids (more than 1,000 CSS-driven wireframes in a 4KB file)
Tutorial Video on CSS Library
How to use the YouTube embedded Video Player
YouTube Chromeless Player API
Chromeless player SWF URL:
http://gdata.youtube.com/apiplayer?key=DEV_KEY
note: it is using gdata.youtube.com and videoId is no longer part of the url as it was used in the javascript player api.
Functions
The following functions are available in addition to the ones listed in the JavaScript API section below:
loadVideoById(videoId:String, startSeconds:Number):Void
cueVideoById(videoId:String, startSeconds:Number):Void
setSize(width:Number, height:Number):Void
Sample Code: http://code.google.com/apis/youtube/chromeless_player_reference.html#ExamplesYouTube JavaScript Player API
Embedding the YouTube player using SWFObject
We recommend using SWFObject to embed any players that will be accessed using the JavaScript API. This will allow you to detect the end user’s Flash Player version (the JavaScript API requires Flash Player 8 or higher), and also will get rid of the ‘Click to activate this control’ box when using Internet Explorer to view the player. To enabled the API in the SWF, you must pass in the parameter
enablejsapi=1.Additional SWF Url Parameters that allows you to set things like color, border, autoplay, ‘Genie’ menu, related videos etc…
Getting the Player Reference
e.g. function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById(“myytplayer”); }
Issuing Calls
e.g. function play() { if (ytplayer) { ytplayer.playVideo(); } } <a href=”javascript:void(0);” onclick=”play();”>Play</a>
Subscribing to Events
e.g.
function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById(“myytplayer”); ytplayer.addEventListener(“onStateChange”, “onytplayerStateChange”); }
function onytplayerStateChange(newState) { alert(“Player’s new state: ” + newState); }
Functions and Events exposed by the Javascript Player API: http://code.google.com/apis/youtube/js_api_reference.html#Operations
Sample Code: http://code.google.com/apis/youtube/js_api_reference.html#Examples
How to embed Flash Player content using SWFObject dynamic publishing
STEP 1: Create alternative content using standards compliant markup
STEP 2: Include the SWFObject JavaScript library in the head of your HTML page
STEP 3: Embed your SWF with JavaScript
STEP 4: Use JavaScript Objects to define your flashvars, params and object’s attributes
TIPS
- Use the SWFObject HTML and JavaScript generator to help you author your code [ http://code.google.com/p/swfobject/wiki/generator ]
- Just repeat steps 1 and 3 to embed multiple SWF files into one HTML page
Why use Dynamic publishing
Description
Create alternative content using standards compliant markup and embed Flash content with unobtrusive JavaScript.
Pros
Avoids ‘click-to-activate’ mechanisms in Internet Explorer 6+ and Opera 9+ and is easy to author (even without using this generator).
Cons
The embedding of Flash content relies on JavaScript, so if you have the Flash plug-in installed, but have JavaScript disabled or use a browser that doesn’t support JavaScript, you will not be able to see your Flash content, however you will see alternative content instead. Flash content will also not be shown on a device like Sony PSP, which has very poor JavaScript support, and automated tools like RSS readers are not able to pick up Flash content.
Turn Google App Engine into your own Personal Content Delivery Network (CDN)
But thanks to Google anyone can now run their own CDN for free on Googles servers. Lucky for you and me Google has made the process really painless and you can even have the CDN under you own domain name.
How do I setup my own CDN using Google App Engine?
Setup
Publish To Your CDN
Using Your Own Domain (Optional)
Calling Google AJAX Language API in C# .NET
Calling AJAX Language API from Non-Javascript environments, the API exposes a simple RESTful interface. In all cases, the method supported is
GETand the response format is a JSON encoded result with embedded status codes. Details here.Example in javascript.
google.language.translate(“Hello world”, “”, “it”, function(result) {
if (!result.error) {
var container = document.getElementById(“translation”);
container.innerHTML = result.translation;
}
});
And now the same code in C#:
WebRequest request = WebRequest.Create(“http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=hello%20world&langpair=%7Cit”);
// This command performs a Language Translation(
/ajax/services/language/translate), for Hello World (q=hello%20world)// from English to Italian (
langpair=en%7Cit). i.e. en|it . Or you can leave the source language blank if you want auto-detection & translation.WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string json = reader.ReadLine();JsonObject account;
JsonObject responseData;
JsonString responseDetails;
JsonNumber responseStatus;using (JsonParser parser = new JsonParser(new StringReader(json), true))
account = parser.ParseObject();//responseDetails = (JsonString)account["responseDetails"];
responseStatus = (JsonNumber)account["responseStatus"];
responseData = (JsonObject)account["responseData"];Console.WriteLine(“responseStatus: {0}”, responseStatus.Value);
Console.WriteLine(“translatedText: {0}”, responseData["translatedText"]);
Console.WriteLine(“detectedSourceLanguage: {0}”, responseData["detectedSourceLanguage"]);// You can get the JSON .NET 2.0 parser I use from here.
// Or if you have .NET 3.5 you can use DataContractJsonSerializer to serializes objects to the JavaScript Object Notation (JSON) and deserializes JSON data to objects.
How do I Recompile the MySQL Library to Run Under the Medium Trust Environment in ASP.NET?
Update: You no longer need that if you use the MySQL Connector/Net 5.2 or later.
- Download the source code for the MySQL Connector/Net from www.mysql.com.
- Extract the contents of the zip file to a local directory.
- Open mysql.csproj project file in Visual Studio.
- Open the AssemblyInfo.cs file, and add the following code, in the using block, at the top of the file (if it is not already there):using System.Security;
- Add the following code to the assembly section of the file:[assembly: AllowPartiallyTrustedCallers]
- Recompile the dll.
You may now reference this dll from other projects. When you decide to publish your project to your hosting server, you need to upload this modified version of the dll to your bin directory.
