Tuesday, February 20, 2007

Firefox & IE - Copy Context Menu Plugin

I have created a set of browser plugins that are pretty helpful for developers and I thought that I should share them. I have created basically the same plugin for both IE and Firefox. What it does is add a "Copy As Html" and "Copy As Plain Text" to the context (right-click) menu. It is useful if you want to copy the text or underlying html from a web page into word, outlook or visual studio. Below is a setup file that sort of automates the installation. It will install the IE plugin completely and it will copy the file for the Firefox plugin. You will have to manually open the firefox plugin using firefox and choose "Install" to complete the firefox plugin installation. The plug-in should be installed here: "C:\Program Files\Fillmore Technology Group\Utilities\Firefox\copyMenu_- 1.3.0-fx.xpi", but the actual location will be on the bottom of the last form in the setup wizard. Since there are plenty of resources on the web that explain how to program these, I am not going to go into any detail on how it was accomplished. I will say that the end result was pretty simple to do, but finding all the information took a little time.
Copy Menu (MSI Installer) - About 106 KB
Copy Menu (Full Windows Installer) - About 3.39 MB - not recommended
Update: The Firefox plugin can be installed from the Firefox Add-on site (It now works with 3.6): https://addons.mozilla.org/firefox/4554
or from here: Install Extended Copy Menu 1.3 - out dated
Firefox Internet Explorer

Tuesday, October 24, 2006

Online Time Travel

If you are like me, then you enjoy traveling into the future from time to time. The biggest problem that I faced is when I was away from my time machine but I needed to go to the future. In order to help facilitate my time traveling I created a web-based time machine. Now I can travel into the future from any place that has an internet connection.

The time machine is currently in beta so you can only go short distances into the future at a time. You can use it free of charge by going to: BestTimeMachineEver.com

Good Luck!

Tuesday, August 15, 2006

CNC Router

This is off topic, but I really dont care. I got a new CNC router from IMService. Overall it seems to work pretty well, however I still have some kinks to work out. Below is a link to some picks of the router as well as my first item that I made.
IMService Router
Aug 15, 2006 - 42 Photos

Saturday, April 01, 2006

D3DControl - Update

There is an update that I have not made completely public yet. It addresses many issues such as multiple controls on a form (swap chains) and adjustable pivot points on the mesh objects. Linking meshes together and all that stuff. The url where you can get the download and more info is at:

http://quamtar.googlepages.com/d3dcontrols-main
and
http://www.ryanscook.com/D3DControl.html

I am planning on putting up some info when I get the chance. But its hard to find time.




Friday, September 30, 2005

Managed DirectX - Direct3D Windows Control written in C#

I created a windows control to hopefully simplify adding Direct3D to .Net applications. This control has a lot of functionality, but it by no means has everything that I intended on putting in. It is my first real Managed DirectX project so be a little forgiving if you find something that is not done just right.

The purpose of this control is to provide a Direct3D surface that can be added to any .Net windows form. It has a lot of features that can do most of the busy work for you. One thing to note is that this library is not intended for hard core games, but more for windowed applications.

This library has been sitting around for the last six months unfinished, but still in a good working state. I have been to busy with other things to work on it, so I decided to put it up here in case some one could learn from it. I know I learned a lot making it.

The library consists of a user control which handles the render loop, direct3d initialization on so on, as well as a bunch of mesh classes and a camera class. I don't have a lot of time to go over how to use it but included in the download are four sample applications that use the control, so you should be able to figure it out.

To use it all you have to do is add the control to your tool box. Add event handlers for the OnSceneUpdateReady and OnRender events and then you are ready to go. By default a camera class will be created and set in the controls ActiveCamera property. The default settings is to automatically add the transforms for the active camera before the OnRender event is fired, however this is configurable. The OnSceneUpdateReady event is fired before teh OnRender and is intended for updating the scene and doing all of your program logic. The OnRender event is fired between the BeginScene and Present methods and is intended for rendering the objects.

The included mesh objects all implement the ID3DMesh interface and can be rendered using the Render() method. There is a RenderSettings property that you can use to sett some render settings such as wireframe, solid, autoset transform, and so on. The ID3DMesh interface also has a parameter for rendering planar shadows as well as a bunch of other stuff.

One of the best features of the control is that it enumerated all the supported hardware configurations on start up and stores all the combinations in a DataTable, which can be used for setting the best device settings. In addition to this there is a ShowDeviceSettingsForm() method which will open a dialog that will allow the user to choose from the supported settings. It can be seen in the Mesh Viewer screen shot below. The Mesh Viewer is one of the test apps that is included in the download.

Please send all feed back and code updates to rccode [at] gmail . com

Download Here - Updated 10/4/2005: This has been compiled using the October SDK, for other releases a recompile may be needed.













Sunday, June 12, 2005

SearchMySites.com

I have put up a simple (but hopefully useful) site. SearchMySites.com allows you to create multiple lists of urls, then you can choose one of the lists and perform a google search only within the sites in the list.

For example: if you create a News group and add cnn.com and msnbc.com to the group, you can then select the news group, enter your search terms and when you click search it will return results found in msnbc.com or cnn.com only.

The site was just put up and has not had any real testing so feel free to send your feedback or bugs.

Friday, May 27, 2005

.Net Remote Script Request

Have you ever wanted an easy way to call a server side method from javascript? If so this class may be just what you need.

I have created a simple and easy to use method for accomplishing this task. All you have to do is have your webform inherit from the remote script page, make your call using a simple javascript object (will be included automatically), and when you execute the request in javascript the OnRemoteScriptRequest event will be raised in your server side code, you then process the request and write the result out on the response stream. The result will be returned by the javascripts execute method.

This .Net class library uses a combination of C# code and javascript to accomplish the task in an easy to use manner. The call uses Microsoft.XMLHTTP, Msxml2.XMLHTTP or XMLHttpRequest objects (depending on the browser) to do the underlying call back to the server. Because of this it will work in all recent IE and Mozilla based (Firefox, Netscape, Mozilla, etc.) browsers.

Try It Here!

Here it is step by step
  1. Include a reference to RemoteScript.dll
  2. Have your webform inherit from the remote script page:
      public class WebForm1 : RemoteScript.Pages.RemoteScriptPage
  3. Add the event handler in the InitializeComponent method
      this.OnRemoteScriptRequest += new RemoteScript.Pages.RemoteScriptEventHandler(RemoteScriptTest_OnRemoteScriptRequest);
  4. Add the event handler method
      private void RemoteScriptTest_OnRemoteScriptRequest(object sender, ...
  5. After you add your code to the event handler you will be able to call it from javascript using the RemoteScriptRequest javascript object, Example:

      objRS = new RemoteScriptRequest();
      strReturnValue = objRS.Execute();


Donload the source code and a sample webform here

You can view the documentation here: html - chm






Thursday, May 26, 2005

C# / .Net Gmail Tools

I have created a gmail class library that provides some tools for getting gmail atom feeds and for sending emails through gmail using the .Net framework. These tools are not very complicated, but they are simple to use and should save a user some time if they want to integrate an application with gmail.

GmailMessage
Sending email using the System.Web.Mail namespace is very simple, but there is not a straight forward way of sending email using a secure connection or on different ports, which is required by gmail. Because of these drawbacks I created the GmailMessage object that inherits from the MailMessage object, all you have to do is set up the message object and call its send message.

I also added a couple of static methods that allow you to send a email through your gmail account in as little as one line of code. Below are some examples of it's usage.
//Send a message with one line of code RC.Gmail.GmailMessage.SendFromGmail("username", "password", "toAddress@gmail.com", "subject", "message body"); //Send a message with one line of code with a MailMessage object RC.Gmail.GmailMessage.SendMailMessageFromGmail("username", "password", mailMessageObject); //User the GmailMessage object to create and send your message RC.Gmail.GmailMessage gmailMsg = new RC.Gmail.GmailMessage("username", "password"); gmailMsg.To = "RCcode@gmail.com"; gmailMsg.From = "fromAddress@gmail.com"; gmailMsg.Subject = "C# Test Message"; gmailMsg.Body = "Test body"; MailAttachment attachment = new MailAttachment(@"c:\testfile.txt"); gmailMsg.Attachments.Add(attachment); gmailMsg.Send();


GmailAtomFeed
The GmailAtomFeed class provides a simple object layer for programmatic access to gmails atom feed. In just a couple lines of code the feed will be retreived from gmail and parsed. After that the entries can be accessed through an object layer AtomFeedEntryCollection, plus access to the raw feed and the feeds XmlDocument is also available.

Below are some examples of it's usage. // Create the object and get the feed RC.Gmail.GmailAtomFeed gmailFeed = new RC.Gmail.GmailAtomFeed("username", "password"); gmailFeed.GetFeed(); // Access the feeds XmlDocument XmlDocument myXml = gmailFeed.FeedXml // Access the raw feed as a string string feedString = gmailFeed.RawFeed // Access the feed through the object string feedTitle = gmailFeed.Title; string feedTagline = gmailFeed.Message; DateTime feedModified = gmailFeed.Modified; //Get the entries for(int i = 0; i < gmailFeed.FeedEntries.Count; i++) { entryAuthorName = gmailFeed.FeedEntries[i].FromName; entryAuthorEmail = gmailFeed.FeedEntries[i].FromEmail; entryTitle = gmailFeed.FeedEntries[i].Subject; entrySummary = gmailFeed.FeedEntries[i].Summary; entryIssuedDate = gmailFeed.FeedEntries[i].Received; entryId = gmailFeed.FeedEntries[i].Id; }
That's about it short and sweet, I hope this saves you time integrating with gmail from your applications.

Download the source code here: GmailHelper.zip

You can view the documentation here: html - chm




Wednesday, May 25, 2005

Simple C# RSA Encryption Class

Well, you can figure this out yourself, use it if you like, tell me how much it sucks, what ever you want.

What it does is takes data and encrypts it using DES encryption and then encrypts the DES Keys using RSA and stores everything in an XML string to be saved for later decryption. There are also classes to hold the encrypted data and to create and save the RSA keys. This seems to be a pretty good solution for encrypting data or files.

I wrote this code and am now posting it because I did not find any simple snippets on the web for encrypting data in C#. Everything seemed too complicated or was not robust enough. I am sure that many people may have problems with this code or the lack of explaination in the code, but oh well... Its here for those who want to look it over. Remember, use at your own risk!

Code:





Tuesday, May 24, 2005

C# LateBound COM

I made a very simple wrapper for calling com objects in c# and I thought you may find it useful. Currently there are only a couple methods, but they are the most useful items.

Sample usage:
//Create object object myComObject = ComUtil.CreateObject("SomeObject.SomeClass");

//Call Method
object[] parameters = new Object[]{paramValue1, paramValue2, paramValue3, paramValue4};
ComUtil.CallMethod(myComObject, "MethodName", parameters);

//Get a property
Int16 returnValue = (Int16)ComUtil.GetProperty(myComObject, "PropertyName");

//Set a property
ComUtil.SetProperty(myComObject, "PropertyName", value);

//Call a method with a ByRef parameter (recordset)
ADODB.Recordset rs = null;

ParameterModifier byRefParamMod = new ParameterModifier(1);
byRefParamMod[0] = true;

ParameterModifier[] pmArray = {new ParameterModifier(1), byRefParamMod, new ParameterModifier(1),new ParameterModifier(1)};

object[] parameters = new Object[]{paramValue1, rs};
ComUtil.CallMethod(myComObject, "MethodName", parameters, pmArray);



//Call a method with a return value
ADODB.Recordset rs = (ADODB.Recordset)ComUtil.CallMethod(myComObject, "MethodName", null);

Here is the class:

Monday, May 23, 2005

QueryString Encryptor HTTPModule

I wrote an HttpModule that Encrypts querystrings.  This module is seamless to the web developer. You can create html that looks like this: myPage.aspx?id=1&customer=2 and the source on the client will automatically be converted to this: myPage.aspx?eqs=KS%2bthrckechBKT%2bZ8IB44Bz3qvW3853f. Then to access the value in the code behind page you would use QueryString["id"] or QueryString["customer"].

To install it add QSHttpModules.dll to your bin directory and then add the following to your web.config (any where in <system.web>):

<httpModules>
   <
add type="QSHttpModules.QueryStringEncryptor, QSHttpModules" name="QueryStringEncryptor" />

</httpModules>


The module does this by finding the links and replacing them with the encrypted version as the page is sent out to the client. Then on every request the module looks for an encrypted querystring, if found it decrypts it and rewrites the url.

The code is listed below, but you can also download it from my message board at: http://csharpboard.com/ShowPost.aspx?PostID=44. This module of course takes some overhead to process and it is not recommended to be used as a full security feature. Rights checking should always be in place. But, if a little cpu time is worth hiding the contents of your querystring, this may be for you.

As always, use at your own risk.


Code:

Sunday, May 22, 2005

Javascript Color Picker

I wrote a javascript color picker. I know that there are plenty out there, but I just did not like the way they looked or worked very much. So, I decided to add one more color picker to the world. The down side to this color picker is that it uses external files, but to me it is worth it. It has a photoshop feel that I like.

You will find a working sample below and you can download the code and a test page here. As always you will have to figure the code out yourself and you must use at your own risk.

Sample:





Saturday, May 21, 2005

C# - Loading and creating an object instance from a file

This sample is pretty simple. It is basically loading a latebound object. I am not sure how often most people will have to do this, but I did so I will share it.

This method does not do that much. It will load an assembly from the provided file path and then attempt to create an instance of the type specified. If an empty string is provided for the type, it will create an instance of the first type in the assembly. If there is an error then null is returned.

Use: myType myObj = (myType)CreateLateBoundObjectFromFile(@"c:\myFilePath.dll", "myType");

Code:

Friday, May 20, 2005

.NET Zip Library #ziplib (SharpZipLib)

.NET Zip Library #ziplib (SharpZipLib)

I have used the SharpZipLib for some time now and it is great. It's easy to use and does everything that you may need; Zip, GZip, Tar, etc.

Lately, I have seen quite a few third party .Net zip components for sale and its hard for me to believe that someone would buy a component when such a good one exists for free. It must be that not enough people know about this free library. Well, here it is: http://icsharpcode.net/OpenSource/SharpZipLib/Default.aspx