Saturday, October 8, 2011

Use Javascript to make two columns the same height


Our web site needed the left and right columns to be the same height because of the background color. We use this simple script which is loaded from an external file.

var x = document.getElementById("column_l").clientHeight;
var y = document.getElementById("column_r").clientHeight;
if (x > y)
document.getElementById("column_r").style.height = x + 'px';
if(x < y)
document.getElementById("column_l").style.height = y + 'px';

Working with Rich Text Format (RTF)


Rich text format allows text to have attributes such as bold, underline, colors, bold etc. It is the formatting code used for Word for Windows and many other text editing programs.If you open a file with an extension of rtf, the file will open Word for Windows or WordPad. You will not see the codes being used to render the text.Database programs, like Notepad, will strip the rtf codes and leave only the text. This gives you a way to copy a web page and paste the text only. Notepad will ignore everything but the text.

Get a trial version of this program.

Storing Rich Text Format in a database

I save the RTF contents to an rtf file and then read it back into a text field.

Contents of RTF textbox

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
' The SaveFile save the rtf text in a coded file which is read by databases as ASCII text so it can be stored.
' Use the C:\Windows\Temp\ folder because it exist on all windows computers and allows all users to write to it.
Me.TextBox1.Text = My.Computer.FileSystem.ReadAllText("C:\Windows\Temp\MyRTF.rtf")
0' Reload the form after save
Me.DateModifiedTextBox.Text = Now
Me.RichTextBox1.Rtf = Me.TextBox1.Text
Catch ex As OleDb.OleDbException
End Try
End Sub
Partial Contents of MyRTF.rtf file
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq1\fcharset0 Courier New;}
{\f1\fnil\fcharset0 Arial;}}{\colortbl ;\red0\green0\blue255;\red0\green128\blue0;\red163\green21\blue21;}
\viewkind4\uc1\pard\cf1\lang1024\f0\fs20 Private\cf0 \cf1 Sub\cf0 SaveButton_Click(\cf1 ByVal\cf0

Windows Form DateTimePicker

This windows control is simple to implement and hard to use in your application until you learn a little about how it works.

Even though you set the format of the date display to Short Date, the date is saved as date plus time. Time is stored in hours, minutes and seconds plus ticks and some other time span data that are not commonly used.

First problem I ran into was trying to set a new DateTime. I finally broke the DateTime down to month, date and year before doing some calculations on it. I then put it back together as new DateTime(m_year, m_month, m_day, 0, 0, 0)where the zeroes(0) are hours, minutes, seconds.

This is my search code:

private void button1_Click(object sender, EventArgs e)


var m_sound = System.Media.SystemSounds.Beep;


string m_date = this.LookFor_dateTimePicker.Value.ToShortDateString();

m_date = m_date + " 12:00:00 AM";

DateTime m_find = Convert.ToDateTime(m_date);

appointmentsTableAdapter.FillByDate(this.reminderDataSet.Appointments, m_find);


This is code to set the time to 12:00:00 AM

private void aptDate_DTPicker_ValueChanged(object sender, EventArgs e)
            DateTime m_date = this.aptDate_DTPicker.Value;
            DateTime m_keep = this.aptDate_DTPicker.Value;
            int m_month = m_date.Month;
            int m_day = m_date.Day;
            int m_year = m_date.Year;
            // set the Datetime picker time to 12:00:00 AM
            DateTime m_keepNew = new DateTime(m_year, m_month, m_day, 0, 0, 0);
            this.aptDate_DTPicker.Value = m_keepNew;
            int m_dayOfWeek = (int)m_date.DayOfWeek;
            if (m_dayOfWeek == 1)
               m_day = m_day - 3;
                m_day = m_day - 1;
            DateTime m_newdate = new DateTime(m_year, m_month, m_day,0,0,0);
            this.sendReminder_DTPicker.Value = m_newdate;
            buildMessage(this.sendToNAME_TextBox.Text, m_date.ToShortDateString(), 
		this.aptTime_DTPicker.Value.ToShortTimeString(), this.aptLength_ComboBox.Text);

Use Javascript to Center a Web Page web site was originally written using the margin-left and margin-right setting of auto to center it's pages. It worked as expected under Explorer 7 and Firefox 2. We could not get it to work correctly in Explorer 8 and Firefox 3 so we went back to basics.

In the old days before word processors, we took the width of a page and subtracted the width of the text and then divided by two and set the left margin to that number. Example: Left Margin = (Window Width - Fixed Design Width) / 2

Your web document needs a Block <div>Tag within the <body> tag. We gave ours an Id of Container. The two columns are floated left and right. The ChangeLeftMargin functions is called by <body onload="ChangeLeftMargin()">

Here is part of the code:

<script type="text/javascript">
< !--
function ChangeLeftMargin()
UserWidth = window.screen.width;
setWidth = (UserWidth - 700)/2;
StringSetWidth = setWidth + "px";
document.getElementById("container").style.marginLeft = StringSetWidth;
< /script>
< !-- #EndEditable -->
< /head>

<body onload="ChangeLeftMargin()">

<!-- Begin Container -->
< div id="container">

News Flash....Cell Phones can read!


The following are excerps from Kaywa FAQ
QR Codes (= Quick Response Codes) are 2D Barcodes (two dimensional Barcodes) developed by Denso and released in 1994 with the primary aim of being easily interpreted by scanner equipment in manufacturing, logistics and sales applications.

Japan, the first country with a highly developed 3G network and high usage of the mobile internet, was also the country where telecoms like NTTDoCoMo and KDDI achieved a breakthrough by bringing QR code readers to mobile phones. By installing QR code readers on consumer phones, if was suddenly possible for everyone to create and read QR codes and to connect easily to mobile sites. Today QR Codes are so pervasive in Japan that it's almost impossible not to see one. You can find them in advertisements, mobile campaigns, on maps, in magazines, on billboards etc. In that sense the QR Code revolution is comparable to SMS. It's an easy and simple tool, the cost of the connection to a mobile site is below the price of an SMS and it's up to you to decide whether or not you want to scan it.

The QR code is about to become widely used in the United States as well. Google Maps already uses them and offers posters for clients to use. Facebook is starting a location service that relies on QR code. We recommend that all our clients start using QR code on their web sites, front door and in advertising as we are on our contact page.
This is a video demonstration of QR code being used in Elle© magazine advertisement.
We have developed a program which will generate the code for you. It is web based and very easy to use. Just enter your contact information and QR code will be downloaded to your browser.

Click here to get your QR code.
QR Code:
Click this QR code
to get Kawa Reader

I don't get it!


Why do people not tell you when they do not have a clue what you are talking about? There is no shame in not understanding the subject that someone is speaking or writing about.

We get that in these rough times you could use from FREE HELP SO WE ARE GIVING AWAY SOME OF OUR SOFTWARE:

Create a vCard

Generate a QRcode image from your information

A file search, folder file print and open from your desktop

Visit our free software web page for more stuff and instructions.

GPS for small businesses


Global Positioning System (GPS) hardware and software are cost effective for small businesses. The GPS units have evolved into amazing units as prices continue to fall. We would like to tell you how one small business has incorporated a Garmin C350 GPS unit and some software into their logistics systems
Garmin has about 50% of the GPS market. Their C350 unit has a unique software feature for small businesses. It lets the user declare the type of vehicle they are driving. If that vehicle is a truck, the unit will not route you onto a route that is for passenger vehicles only. Mapquest and Google maps can not do this.
Each week the office staff sets up the routes for the coming week. The coordinates for each delivery are looked up and recorded in a GPX file which can be transferred to the companies multiple GPS units. All units have the same information in them. The drive selects the Point of Interest (POI) for that delivery location and follows the verbal directions. Should the driver make a wrong turn, the unit will alert him and update the route. It is pretty hard to get lost
This company uses Street Atlas USA to look up coordinates, enter POI descriptions and generate GPX file.

This file can be loaded directly to the Garmin unit using their POIloader. You can also use this file to draw Google maps showing your points of interest. This is the best site for GPS tasks such as drawing maps from GPX files and translating one file format into another.
This is a Free Program from Garmin for loading Points of Interest into their GPS units.

These are screen captures of Garmin Atlas 2009 in use

How to reposition Microsoft© Access report controls at print time

The example I am using is an estimate which has a footer with Installation, Tax, Total of Estimate and Deposit. Many of the estimates do not have Installation or Taxes. The problem is how to print the footer without showing the items not in the estimate.
This code in the designer will set the control text to blank if there is no value returned from the data source:

The problem is that this blank control will print on the report as an empty line so to complete the solution you need to move the visible controls up and move the blank controls to a empty spot on the report footer otherwise the blank controls will over print the controls you just moved. The last issue is that the Microsoft© Access report, by default, uses a twips as it's unit of measure. "Twip" is a unit of measurement equal to 1/20th of a printers point. There are 1440 twips to and inch, 567 twips to a centimeter.

The following is my solution to this problem if you a using Microsoft Access 2007©. If you are using 2000 or 2003 you have to make two modifications. First, the position must be in a variable of type LONG. For some reason, the "top" position does not accept a literal. Second, put the code in the format section to the section the controls are in. (i.e. ReportFooter_format ). I used DIM v72,v490,v900, v2000 as LONG.

TIP: Put your controls where you want them in design mode and then add msgbox(me! for each control to get exact position.

Appointment scheduler with appointment reminders sent via email and text messages

My firm, Small b Systems, is always writing programs that will help our small business clients run their business more profitably. Many of them have an employee spend a great deal time calling people to remind them of their upcoming appointment.

A computer can easily do the same job in less time and with a record of the appointment and reminder so we wrote a program for our clients. We are now offering it to the everyone for only $24.99. There is a 30 days free, fully functional trial also.