Skip to main content

Yousef Wadi

Go Search
Home
  

TinyMCE For Beginners

After trying to run TinyMCE for myself it took 2 HOURS to know how it works, I downloaded the ASP.NET Package and guess what?, I ended up not using it cause it didn’t work well.

So to get it running, download the JAVASCRIPT Control from the website for TinyMCE, and download yourself the Main package. Now unzip the folder and place the folder in your project. Once you do that you need to refrence to it by adding this to your page in the head of the page

<script language="javascript" type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>

<script language="javascript" type="text/javascript">

tinyMCE.init({

    mode : "textareas",

    theme : "advanced"

});

</script>

Now the part that says ("textareas") means that all html textareas and textboxes that are configured to multiline will become a TinyMCE Control. Now you should us the TextArea and make it run at server side just as follows

        <textarea id="TextArea1" name="S1" runat =server></textarea></p>

This will give u a rich text editor that you can access from the code behind, Now to get what the user typed in HTML Format you SHOULD turn of request validation as follows

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" ValidateRequest="false"%>

 

This will allow you to deal with HTML Formats.

And now to get the text just get it from the TextArea.InnerText.

Now to test it lets just send the Rich Text back to the page so create a table on the top of the page with one cell and make that cell run at the server side as follows;

<table class="style1">

        <tr>

            <td id="MyCell" runat=server>

                &nbsp;</td>

        </tr>

    </table>

Now on the code behind we need to render the cell with html that was sent from the TinyMCE by doing this.

        MyCell.InnerHtml = TextArea1.InnerText.ToString();

 

This is it! It is very EASY but no one explained it for starts on TinyMCE so here it is ENJOY.

 

MSRS Gettin connected for NXT
MSRS (Microsoft Robotics Studio)
This is a hint blog for everyone that is willing to try the NXT with the MSRS. Before we start a fast tutorial on that I should let you know that you must upgrade the robots firmware first to 1.5 and you can download the new firmware from the Mindstorm website. Tomorow hopefully Ill have a preview for MSRS on the blog for you to follow.
German Minister Visiting GJU Tomorrow
Special Vist From Germany to the GJU

Dr. Anette Schawan - German minister of education  will visit GJU tomorrow to talk about our university, and the students that will be going to Germany or Finland will be meeting with her to talk about the first actual government university student exchange programs. As the Student Representitive of the GJU and IT_Club president we will be discussing how this 1 year exchange will impact our education. I will also be a side representative to the TEMPUS project done by my Dean Dr.Salem Al-agtash as a contributor to the study since I had a role to be done within that project.

NXT Controlled Over C# Part 1 (Make IT Beep)

Sending Data Over Serial Direct Commands

We will start off with raw Commands to control the NXT over Bluetooth and C#. This is done by opening the Bluetooth as a serial port to the NXT after you connect it to the PC. You can see an Image in BlueSoleil application on how to connect the NXT over Bluetooth. The Serial Communication is then added through C# as a serial port control. Let’s take it step by step.

After you have your NXT and PC Connected you will need to then open a serial port from C# and lets do this step by step...

Create your windows application form for C# and then add to the form a serialport control

After doing that you will need to configure the serial port to take the COM that your connected through bluetooth.

Now on the FormLoad event we will connect the serial port control by

serialPort1.Open();

Now the button click event will be sending bytes to tell the NXT to beep. The beep command is given to us by the lego website, you can download the SDK documents here, and then we send the byte string as follows in the code:

private void button1_Click(object sender, EventArgs e)

{

byte[] byteOut = new byte[8];

byteOut[0] = 0x06; //'6 bytes in output message

byteOut[1] = 0x00; //'should be 0 for NXT

byteOut[2] = 0x80;//'&H0 = reply expected &H80 = no reply expected

byteOut[3] = 0x03; //'PLAYTONE

int freq = 300;

byteOut[4] = Convert.ToByte(freq - (freq / 256) * 256);//'low byte of freq

byteOut[5] = Convert.ToByte(freq / 256);//'high byte of freq

byteOut[6] = Convert.ToByte(0x64);//'low byte of duration = 100 ms

byteOut[7] = Convert.ToByte(0x01);//'high byte of duration

serialPort1.Write(byteOut, 0, 8);

}

Thats it! Now run the application, give it a while so it can connect to the NXT and then click the button and hear it beep! This is a simple example on how to connect, next we wont be using the Direct Commands over serial port cause it takes LOTS of time to develop, but we will be using mindsqualls library to do all the datasending.

 

Festo Robotino Ferrari
This is how its done using the Robotino View VPL ...
Robotnio View has many tools, you can see that it has Hardware Parts on the menu. You will need the following as indicated in the image, build the same schematic and your off to play with it, one more thing, according to the Joystick control you will need to configure the axes and choose the buttons depending on your own Steering type, /you might even need to change the equation as well to amplify the signal to the motor from the Steering. Tomorow ill show you how to make it work with a gearbox software where you can shift up and down gears.
 
Festo Robotino Ferrari
This morning I am working on making the Robotino From Festo work on a Joystick steering and I will be posting later today how its made. Its working for now but has some small bugs that I will fix and post.
SARCOS-Iron man comes to life
SARCOS is a suit that has been under-construction for 6 years now and its almost ready! Ironman is alive! Check it out
 
Get Your NXT Ready its time to start Robotics
Lets Start Robotics on NXT Blocks from LEGO

                Many people underestimate Lego robotics and think its just for kids, well trust me it’s not, off course it’s not like a Festo Robotino or a Fujitso HOAP-2 but for 300 dollars it’s a great system for robotic enthusiasts and do not have large robust to work on it. In my blog I will be showing you examples on how to work with the NXT on its original VPL (Visual Programming Language), on MSRS (Microsoft Robotics Studio) VPL and Pure C# as well as some community libraries. One library I find amazing is http://www.mindsqualls.net/ . It’s a great library to control your robot remotely through Bluetooth serial communications. I’m not sure you might find the NXT in Jordan and you might need to order it from other countries. To start you will need to download the following;

-MSRS (Microsoft Robotics Studio) which is free

-You will need Visual Studio (Express Edition will do great) FREE AGAIN

-You will need the Mindsqualls Library which is free again

-Pay yourself a visit to NXT website and download the SDK for Advanced Users

From now on I will be posting many robotic tutorials on NXT from beginners to advanced users and as well as intermediate FESTO Robotino posts.

Enjoy …

How to make an IR Camera

IR Camera's are becoming more and more popular every day. We have seen them in the wiimote and we can even use it. I have used the IR camera within the wiimote as an HID for varies HCI techniques and I will be showing some of them. Sometimes you just need to use an IR camera that binds to a robot and a wiimote won’t be the best option, so you’ll need to either buy an IR cam or build your own!

 

Let’s start… First buy yourself a cheap webcam, if you live in Jordan go check out Fun Directory where you can get a webcam for around 2JDS. Once you do that get yourself a screwdriver. To point something out; the cheaper the camera the better chance you have to convert it. This blog is based on “Turkey Tek’s” Instructable.

 

First of all open up the Webcam, look for the IR-Cut-Filter, and then remove it, in the picture you can see that the IR filter is in the Green Circle, Now get your self a camera film and then open it up, don’t worry about burning it since you don’t need to take pictures with it… Cut a piece of film as big as the IR-Cut-Filter and place it where the IR-Cut-Filter was in the camera and Close it up. Now you got yourself an IR webcam. Al you have left is to Image proccess what you get, and whats better than A-Forge to do that.

 

Now build your self IR Sources that will be glowing infornt of the webcam to detect it,  and then procces the images from the cam to detect the white light source which is the IR light source, the best thing to use is IR leds. Now make your application to detect the IR-White lights and translate it as a relative location to the camera.

If you need more details do not hesitate to ask...

 

ASP.NET Tips and Tricks
These are 2 of the tips and tricks I woud like to share with every one, these came up when I was developing the German Jordanian Universities TEMPUS project portal singal handed. I should be deploying it on the 7th of July, and by then I will be adding a link to it on my blog.
 
Tip #1: Image resizing (A BIG ISSUE TO MANY PEOPLE) well so people have trouble resizing images and making thumbnails. I built a simple class that you can use, just remmber to change the namespace ;). It works by getting the image file opening it and getting its dimenssions and then disposing the instance of the image so as not to lock it from other users. It then returns the new dimesions after you give it the width you want. So to use it you do the following
Thumbgen tb = new Thumbgen(int WidthYouWant, string ImagePath);
ImageToResize.Width = tb.GetNewWidth();
ImageToResize.Height= tb.GetNewHeight();
 
By doing that YOUR IMAGE IS RESIZED WITH Correct ratios....
Download the class here:
NOTE: I personaly belive its good for medium work loaded websites but not sure about very high amounts of hits, so to prevent trouble its best you use the class to generate thumbnails and SAVE them to a folder then use them. Since if you use the class directly and 2 Simultaneous hits occured it MIGHT crash. So practice it safe and let the website generate the thumbnail once and save it to prevent error.
 
Tip #2: Saving MD5 Passwords to a database as a string. I personally got sick of this issue due to repetetion. so just to save code space I use this static class to save and compare strings. Download it here:
 
Tip #3: Most Beginners and intermediate  ASP.NET developers do not know that a Fileupload control is limited to 4mb upload as default. to make it upload more you will need to configure the web config with the following:
 
 <system.web>
      <httpRuntime executionTimeout="700" maxRequestLength="11000" />
 
Change the maxRequestLength to the size you want and the executionTimeout to give e time limit to the upload.
1 - 10 Next

 ‭(Hidden)‬ Admin Links