Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, 26 December 2011

Connecting Arduino to Flight Simulator X


Introduction

Welcome to my tutorial on how to connect Arduino to Microsoft Flight simulator.
This is the easiest method I found.
FSX SDK exists but lacks of documentation, is not useful as it requires huge amount of code. I wanted something easy and after some research I was able to connect to FSX using the FSUIPC API. Please note that to get some of the functionality you have to register FSUIPC. And I thought sharing this with the world, maybe someone will benefit. In this ``tutorial`` I will explain the process and not just give you the code. I believe in understanding not just knowing.

 

System design

Amazing system design :)


Sorting files with php


This function will sort files in the directory passed as arguments by the last modified or created time
function sortFilesByDate($dirname)
{
clearstatcache();
$files = array();
if ($handle = opendir($dirname))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$files[filemtime($dirname."/".$file)] = $file;
}
}
closedir($handle);
}
// sort
ksort($files);
end($files);
$tot = count($files);
$i = 0;
$EXITSTR = "";
while ($tot != $i)
{
$EXITSTR = $EXITSTR . current($files);
prev($files);
$i ++;
$EXITSTR = $EXITSTR . "<br/>";
}

 

return $EXITSTR;
}

MSN Style for user attention


What if your application is minimized and you want user attention
You can always do it with a message box.
But there is the msn style
That the icon in the taskbar "blinks"
How to do it??
Declaration

Imports System.Runtime.InteropServices

     _

Public Function FlashWindow(ByVal hwnd As Integer, ByVal bInvert As Integer) As Integer

    End Function

When you want to call this function you just FlashWindow(Me.Handle, 1)

But when you call this function the windows and the taskbar will "blink" one time
To achieve "msn style" put the call method into a timer (VB) for 490 ms and enable the tick tock :)
And when the user interacts with your form (got Focus???Click??? Your call but i suggest got Focus)
Hope this is useful 

Visual Basic .net enter key on textbox


If you ever wanted to capture the key Enter on a text box, here is the code

Private Sub txtsearch_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtsearch.KeyPress
   If Asc(e.KeyChar) = 13 Then
   'Your code goes here...
   End If
End Sub
The best method i found is to create a sub process and call it from both of your codes. Both codes i mean the button that you press the Enter key and the button that you have to handle the user input

Sunday, 4 October 2009

jQuery Sliding / Toggle Effect on Divs



Watch this video to learn how you can make your website slide content on the press of link just like facebook

How to do a Javascript AJAX loader with jQUERY


Very nice video on how to use the jquery in your website
saves you time and money

Monday, 31 August 2009

Javascript code for the status bar

In the status bar of the browser you can set a text the time or what ever its up to you.
If you complete this `tutorial` and you still dont see the status bar message 
go to enable-javascript-to-change-status-bar
how to use this feature
Create a new html file create a new script area (javascript) and create a function
i will name my function startScript()
the code for changing the status message is window.status = text

<html>
  <head>
    <title>
      http://cycomptech.blogspot.com/
    </title>
    <script type="text/javascript">
      function startScript()
      {
        var stavros = "This is a test!";
        window.status = stavros;
      }
    </script>
  </head>
  <body onload="startScript();">
    <center>
      This page demonstrate the status bar of the browser<br>
      using javascript<br>
      <a href="http://cycomptech.blogspot.com/">http://cycomptech.blogspot.com/</a>
    </center>
  </body>
</html>

Enable javascript to change status bar in Firefox

While designing a website and test it in firefox most of the programmers found that if the their site has a script for the status bar it doesnt work.
in internet explorer it just ask the user to activate the ActiveX content.

To enable this feature in firefox just open Tools -> Options Open The tab Content and then press the button Advanced next to the javascript option and select the change status bar text

its so simple.

Q: Why should i display the status bar message?

A: Most of the users ignore this feature But a developer should have it on if he/she wants to test different version of the website and i mean on different browsers

Saturday, 29 August 2009

Smart Device part 4

View the data

Smart Device Part 3

During the last weeks we made our GUI we create our form to insert records in our database now we must make our program to check if the database exist and if no to create it in the same directory.
First of all add reference System.Data.SqlServerCe 

Smart Device Part 2

At part 1 we specify what the program will do and we create the SQL statement that will create the database, now we will start building our GUI.

Smart Device Part 1

We will start our application that will connect a smart device program to a database.
The program when it will start will search in the application directory if the database exists if not will create the database.
The connection will be accomplished with code....
During the development of the program I will take screen shots.
What the program will do:
The program will accept new customers and display them in a list the user will be able to select the customer and update all information about the customer.
It's simple.
Now what we need to create our database
Step one: Design the database

Id
Name
Surname
Address
Telephone
Type
Number Primary key
String
String
String
Number
Sql compact type
Int primary key
Nvarchar
Nvarchar
Nvarchar
int

Friday, 28 August 2009

VB Net Smart Device Tutorials

Php tutorials are paused temporally and soon i will start vb net smart device tutorials on how to handle databases

i will start because a friend of mine ask me to post.....

For the tutorials i will use Visual studio 2008 professional

Visual studio express does not include Smart device development

Reset numbering for Screenshots Win+PrtSc

I was using today the screen shot functionality of Windows 8.1 Win Key + PrtSc How to reset the numbering?