RevTwt

Thursday, July 9, 2009

A Simple Guide to .Net Remoting

By jamiemoffat


Remoting is .Net’s way to create and uses object instances on a remote machine, without any of the hassle of DCOM.
This guide provides a (very) quick guide to getting you up and running and calling across your network. Most of the examples that Microsoft provide use a console application to host your remote object, which wouldn’t be the way most of us will use the technology.
This tutorial will cover the most common hosting method, which is within IIS.
I haven’t gone too deep into all the settings that are available with .Net Remoting, I will cover those in a future article.
1) Create a C# class that inherits MarshalByRefObject: E.g.


public class myObj : MarshalByRefObject
{
// ...
}

Add some classes, properties etc.
2) Compile it to produce myObj.dll
3) Now, the object needs to be hosted somewhere. The easiest way to do this is to host the object within IIS.
First of all though, we need to describe our object so it can be accessed. To this end, create a web.config file with the following text:
E.g.


<configuration>
<
system.runtime.remoting>
<
application>
<
service>
<
wellknown mode="SingleCall" type="myNamespace.myObj, myObj"
objectUri="myObj.soap" />
</
service>
</
application>
</
system.runtime.remoting>
</
configuration>
In this XML: 
type ="myNamespace.myObj, myObj" is the full type name, followed by the assembly name.
On the Remote Server:
1) Create a directory called “myRemoteObject”. Create a Bin directory beneath it.
2) Create a new IIS virtual Directory called myIISObj that points to the myRemoteObject directory.
3) Place your compiled versions of myObj.dll in the myRemoteObject \Bin directory
4) Place the Web.Config file in the myRemoteObject directory.
On the Client:
In your application set a reference to the local object on your client machine. This allows he CLR to pick up the meta data of the object so that we can create the object remotely (There is another way to generate the meta data without needing the actual object on the client, a utility called SoapSuds.exe, but I leave that for you to read about )
Now we need a client.config file analogous to the web.config file, which tells the CLR how to access (ie. where to access) the remote object.


<configuration>
<
system.runtime.remoting>
<
application name="Client">
<
client url="http://andy2k/myIISObj">
<
wellknown type="myNamespace.myObj, myObj"
url="http://andy2k/myIISObj/myObj.soap"/>
</
client>
<
channels>
<
channel ref="http" />
</
channels>
</
application>
</
system.runtime.remoting>
</
configuration>

(Note: replace “andy2k” with the name of your remote server)
Now in the client code, simply create the object as usual but, first of all, load the config file.


//Load the Http Channel from the config file
try
{
RemotingConfiguration.Configure("client.config");
}
catch{}

//instantiate the remote object on the server
//(this is really just a proxy object here)
myNamespace.myObj anObj = new myNamespace.myObj();
The .Net runtime picks up the fact that this is not a local object (because of the config file read in the previous line) and creates the object on the remote machine. You now access the object as if it was created locally, and .Net does the rest. 
(if you’re not convinced, create a method in the class that simply returns a string representing the name of the local machine
Something like:


public string getCompName()
{
return System.Environment.MachineName;
}

that should convince you that the object has been created on the remote machine)
And there you have it – you’ve just created a remote object!


 


Original post can be found here

Wednesday, July 8, 2009

Joining Multiple Tables with SQL Inner Join Statements

You can use SQL JOIN statements to combine data from three or more tables. In an earlier article, we took a look at using inner joins and outer joins to combine data from two different tables. In many cases, you’ll want to take this a step further and combine data from three or more tables. Let's take a look at the SQL statements that allow you to accomplish this goal for an inner join.
You may recall from our basic inner join example that the SQL statement below combines data from the Drivers and Vehicles tables in cases where the driver and vehicle are located in the same city:

 

SELECT lastname, firstname, tag
FROM drivers, vehicles
WHERE drivers.location = vehicles.location
This query produced the following results:
lastname firstname tag
-------- --------- ---
Baker Roland H122JM
Smythe Michael D824HA
Smythe Michael P091YF
Jacobs Abraham J291QR
Jacobs Abraham L990MT

 

Now, let’s extend this example to include a third table. Imagine that you wanted to include only drivers and vehicles present at locations that are open on the weekend. You could bring a third table into your query by extending the JOIN statement as follows:

SELECT lastname, firstname, tag, open_weekends
FROM drivers, vehicles, locations
WHERE drivers.location = vehicles.location
AND vehicles.location = locations.location
AND locations.open_weekends = 'Yes'
lastname firstname tag open_weekends
-------- --------- --- -------------
Baker Roland H122JM yes
Jacobs Abraham J291QR yes
Jacobs Abraham L990MT yes

 

This powerful extension to the basic SQL JOIN statement allows you to combine data in a complex manner. In addition to combining tables with an inner join, you can also use this technique to combine multiple tables using an outer join. As you may recall, outer joins include results that exist in one table but do not have a corresponding match in the joined table.

Suggested Reading

Introducing Joins

Inner Joins

Outer Joins

 

Original post can be found here

Tuesday, July 7, 2009

nopCommerce Open Source E-Commerce Solution

nopCommerce is an open source e-commerce solution that contains both a catalog frontend and an administration tool backend. nopCommerce is a fully customizable shopping cart. It's stable and highly usable. From downloads to documentation, nopCommerce.com offers a comprehensive base of information, resources, and support to the nopCommerce community.

nopCommerce is new but very popular open source e-commerce solution. nopCommerce is available for free. A solution with comprehensive features that is easy to use for new online businesses, yet powerful enough for the most demanding e-commerce expert. It’s a secure, scalable and extendable e-commerce platform.

Create and manage a professional online store with nopCommerce 1.20. Built-in shopping cart, catalog management, credit card processing, shipping calculation, template customization and other powerful tools come standard.

So join the community and see what you can learn and what you can share!

O'Reilly Webcast: Ten Things Every Software Architect Should Know

This is the slide deck used in Richard Monson-Haefe more

Monday, July 6, 2009

What is ASP.NET Dynamic Data?

ASP.NET Dynamic Data is a technology from Microsoft that expands the toolset of ASP.NET starting with ASP.NET 3.5 SP1. Use it to build data entry web forms that interact with a database or classes that resemble a database.

READ MORE...

Wednesday, July 1, 2009

s3Slider jQuery plugin

ABOUT

The s3Slider jQuery plugin is made by example of jd`s smooth slide show script. I needed something like that for jQuery (for my web site kruskica.net). Since i didnt find it after a small research i decided to build it by my self.

HOW TO USE

It is very easy. First include the jQuery library then include the s3Slider javascript in the head of the page(s) where you want to use s3Slider.

jQuery can be download from jQuery`s homepage.

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/s3Slider.js" type="text/javascript"></script>

Important: For the script to work properly there is a set of rules that must be followed.

HTML

<div id="s3slider">
   <ul id="s3sliderContent">
      <li class="s3sliderImage">
          <img src="#" />
<span>Your text comes here</span>
      </li>
      <li class="s3sliderImage">
          <img src="#" />
<span>Your text comes here</span>
      </li>
      <div class="clear s3sliderImage"></div>
   </ul>
</div>

+ show all of the code

Explanation

If you set that main div id is s3slider as we did here, that is the name that must be prefix for all other classes and id`s for that specific gallery (slide show). For example, if you set an id for main div as your_name, the inner id must be your_nameContent and the class .your_nameImage like in example above.

The second thing is that every .your_nameImage element in it self must have span. Also, the last div with class clear must also have an class of image holder in this case .your_nameImage. if you dont put that, the last image will NOT be shown in the slide show.

CSS

#s3slider {
   width: 400px; /* important to be same as image width */
   height: 300px; /* important to be same as image height */
   position: relative; /* important */
   overflow: hidden; /* important */
}
#s3sliderContent {
   width: 400px; /* important to be same as image width or wider */
   position: absolute; /* important */
   top: 0; /* important */
   margin-left: 0; /* important */
}
.s3sliderImage {
   float: left; /* important */
   position: relative; /* important */
   display: none; /* important */
}
.s3sliderImage span {
   position: absolute; /* important */
   left: 0;
   font: 10px/15px Arial, Helvetica, sans-serif;
   padding: 10px 13px;
   width: 374px;
   background-color: #000;
   filter: alpha(opacity=70); /* here you can set the opacity of box with text */
   -moz-opacity: 0.7; /* here you can set the opacity of box with text */
   -khtml-opacity: 0.7; /* here you can set the opacity of box with text */
   opacity: 0.7; /* here you can set the opacity of box with text */
   color: #fff;
   display: none; /* important */
   top: 0;
   /*
       if you put
       top: 0; -> the box with text will be shown at the top of the image
       if you put
       bottom: 0; -> the box with text will be shown at the bottom of the image
   */
}
.clear {
   clear: both;
}

+ show all of the code

Then you need to initalize s3Slider and set the duration of how long will one picture be shown on the page (value is in miliseconds).

JS

$(document).ready(function() {
   $('#s3slider').s3Slider({
      timeOut: 4000
   });
});

Take a look at the live example.

COPYRIGHT

This script is licensed under Creative Commons Attribution 2.5. So you can use it in all you projects even commercial ones.

More example:

http://www.jsconf2009.com/

Tuesday, June 30, 2009

Kill Bugs Like a Frog

GIBRALTAR is very cool! Learn more on their website.

Part logging tool, part application monitor, part profiler.All frog.

Gibraltar isn't really a frog, and it won't turn you into one, either. It just reminds us of one with its simple, natural bug-spotting powers. You can also think of Gibraltar as a flight recorder that monitors your .NET applications making it easier for you to test and support them.

We're proud of Gibraltar, and we'd like to tell you more about it. You can download a full-featured trial now, or check out this short video to learn how Gibraltar can streamline your software testing and support processes for any .NET application.

Gibraltar records and sends error and usage information to your support staff and provides powerful, yet simple analysis and visualization tools so you can triage customer issues faster, better optimize development priorities and continuously improve software quality.

With Gibraltar, you will find and kill software bugs faster and easier than ever before. You'll also provide more effective customer support and have new insights into how users interact with your applications.

So please, click the large triangular play button to the right and watch a short video demonstration of Gibraltar in action. Or click the links to learn more, or download a free trial.

Original post can be found here

SocioFluid