Collection of unedited thoughts and bits of knowledge I can't seem to remember
Search This Blog
Wednesday, December 31, 2008
Yahoo Maps API Summary
Documentation
Map Image API from Yahoo! Maps
Simple API Maps
AJAX API Maps
Examples from Zamples
somewhat Related: Silverlight based mapping control DeepEarth
Tuesday, December 30, 2008
Monday, December 29, 2008
Creating Universial Zoom levels
From http://code.davidjanes.com/blog/2008/11/08/switching-between-mapping-apis-and-universal-map-levels/
Table of map zoom level equivalents
Google Maps and Virtual Earth the same zoom levels, excepting that Google has a level 0. Bigger numbers are closer to the ground, smaller numbers are up into space. Yahoo Maps has fewer levels to work with - it doesn’t let you drill down below the block level. Yahoo numbers its zoom levels the opposite of Google and Virtual Earth, small numbers being closer to the ground and so on and so forth.
To allow seamless switching of data between APIs, I propose here universal zoom levels, which can be used as-is on any of these mapping APIs. To avoid confusion of which type of zoom level one is using, we use the negative number range for universal zoom levels. As Google and Microsoft are using the same zoom levels, I’ve decided that the universal zoom levels should simply be the inverse of their zoom levels, bounded by (-1, -19) inclusive.
Conversion Formulae
Here’s Javascript to convert between your favorite mapping API’s zoom levels and universal zoom levels. Note that all to_native functions accept positive numbers as-is.
zoom = {
google : {
to_univeral : function(native) {
return Math.min(-1, -native);
},
to_native : function(universal) {
return universal > 0 ? universal : -universal;
}
},
virtual_earth : {
to_univeral : function(native) {
return Math.min(-1, -native);
},
to_native : function(universal) {
return universal > 0 ? universal : -universal;
}
},
yahoo : {
to_univeral : function(native) {
return Math.min(-1, native - 18);
},
to_native : function(universal) {
return universal > 0 ? universal : Math.max(universal + 18, 1);
}
}
};
End Notes
A truly universal zoom level would just use altitude; dealing with a simple integer is easier and less complication prone though. MapQuest is not included in this post as its tiles do not line up with the other APIs.
Mapping APIs
Geonames
The GeoNames geographical database is available for download free of charge under a creative commons attribution license. It contains over eight million geographical names and consists of 6.5 million unique features whereof 2.2 million populated places and 1.8 million alternate names. All features are categorized into one out of nine feature classes and further subcategorized into one out of 645 feature codes. (more statistics ...).
The data is accessible free of charge through a number of webservices and a daily database export. GeoNames is already serving up to over 11 million web service requests per day.
WCF example from CodeProject: GeoNames .NET WCF Client
Topocoding
This service is an extension of existing mapping APIs in Javascript. It serves for querying the altitude information
and other topological information about places on the Earth.
The topo data is a combination of SRTM and GTOPO30, its typical horizontal resolution is about 90 meters. The data includes all continents but Antarctica.
Currently the service is in the beta stage of testing, the throughput of the shared server might be limited.
For business users, we offer paid servers with dedicated capacity.
EarthTools.org
Here's a collection of webservices for finding out geographical-related information. There are currently three services available for finding the time zone or local time, the sunrise and sunset times, and the elevation/height above sea level at a given latitude and longitude.
Wednesday, December 24, 2008
LeoCad 3rd party libraries
http://www.imagemagick.org/download/delegates/libjpeg-6b.zip
On my skydrive
Use these specific versions. Ziplib 1.1.4 is needed not 1.2.3+
Thursday, December 18, 2008
Research: Creating VB6 compliant OCX with .net
MAKING .NET CONTROLS - OCX VB6 COMPLIANT
Similar article: how to make ocx for FoxPro using .Net
The Visual Basic Team
Interop Roadmap – UserControls, MDI, and Data
InteropUserControl.zip
Using App.config with -interop-forms-toolkit in VB6
Interop Forms Toolkit - Your New Best Friend
Tuesday, December 16, 2008
Setup SVN server the easy way!
http://www.visualsvn.com/server/
Also
RapidSVN - You can use RapidSVN on a memory stick as a graphical SVN client.
http://rapidsvn.tigris.org/
Very cool stuff
Monday, December 8, 2008
Installing Esker API Components
CD 1
- Select Server components
- Select Esker API Components
This is only required for a development or client machine where Esker DeliveryWare platform server is not installed.
Saturday, December 6, 2008
Use SkyDrive to add live app updates
SKyDrive now changes URLs to files several times a day.
I altered my design by fetching the URL of the folder containing my update file and then parsing out the file URL from there. Bit more work but I can still host updates from a Skydrive folder.
Microsoft is offering large amt of disk space with an Windows Live acount (25 GB) where you can host files or any type for in private, shared or public folders.
Uploaded files get a GUID like URL. It you re-load the file it will get a new URL! This caused me abit of grief trying to implement an live update feature in my Digital Rockhound's companion application. To solve this problem, I decided to add meta content name value pairs for current version of the application and the URL path where the update is located on SkyDrive. My application simplies downloads a specific blog entry, reads the version and path from the meta conent and then determines if the user has the latest version. A bonus of this method, is with site tracking, I can tell how many users are updating the software and when. Nice to have these stats.
As of 12/06/2008 Microsoft has not published documentation for SkyDrive API. I hope they do so soon. (Lets see how SkyDrive API searches this blog entry generates...)
Wednesday, December 3, 2008
Change Where statment for report
>>select reports menu
>>>> Selection Formula
>>>>>>Row
In designer type of select criteria
Add new table to report schema
Click links table and correct table for new table
Changing cached database name in Report
Use Field explorer, expand to a table, right-click and select Set Datasource location
Crystal Reports sucks
You must apply SP1, SP2, SP3 to fix a host of issues including table alias not handled properly when crystal renders its internal report query.
Also: If table schema has changed for an existing report, connect to database with current schema and use database expert to sync cached schema in report to actual schema.
Why anyone stills uses this product is beyond me? At least editor ingration into VSS.NET makes it 2% less painful.
Crystal 9 will connect to SQL Server 2008 database.
Friday, November 28, 2008
Tuesday, November 25, 2008
Monday, November 24, 2008
Saturday, November 22, 2008
Wednesday, November 19, 2008
Tuesday, November 18, 2008
Wednesday, November 12, 2008
Tuesday, November 11, 2008
How to Debug Hydrid VB6 and C# project
in C# code in class with COM interop that is used in VB6 project.
Allow code to debug using .net 2005/2008 but not .net 2003
Used this approach to debug call center scheduler.
Monday, November 10, 2008
Friday, November 7, 2008
Microsoft Analysis Management Objects
Audience(s): Customer, Partner, Developer
X86 Package(SQLSERVER2008_ASAMO10.msi) - 2659 KB
X64 Package (SQLSERVER2008_ASAMO10.msi) - 4317 KB
IA64 Package(SQLSERVER2008_ASAMO10.msi) - 6055 KB
Microsoft SQL Server 2008 Analysis Services 10.0 OLE DB Provider
Note: Microsoft SQL Server 2008 Analysis Services 10.0 OLE DB Provider requires Microsoft Core XML Services (MSXML) 6.0, also available on this page.
Audience(s): Customer, Partner, Developer
X86 Package(SQLServer2008_ASOLEDB10.msi) - 19490 KB
X64 Package (SQLServer2008_ASOLEDB10.msi) - 43945 KB
IA64 Package(SQLServer2008_ASOLEDB10.msi) - 50682 KB
Microsoft ADOMD.NET ADOMD.NET
Note:The English ADOMD.NET setup package installs support for all SQL Server 2008 languages.
Audience(s): Customer, Partner, Developer
X86 Package(SQLSERVER2008_ASADOMD10.msi) - 4312 KB
X64 Package (SQLSERVER2008_ASADOMD10.msi) - 9263 KB
IA64 Package(SQLSERVER2008_ASADOMD10.msi) - 6776 KB
SQLDMO cannot connect to Anaysis Services version 10.0.1600.22
Found this posting Need AMO update:
The C# application was written for SSAS 2005 and thus references the 2005 version of Microsoft.AnalysisServices.dll (AMO). The 2008 version of AMO was just released at this link: http://www.microsoft.com/downloads/details.aspx?FamilyID=228DE03F-3B5A-428A-923F-58A033D316E1&displaylang=en
Scroll down to "Microsoft Analysis Management Objects" and install. The 2008 version of AMO will install to ...\Program Files\Microsoft SQL Server\100\SDK\Assemblies. In the C# solution, remove the reference to the 2005 version of this DLL and replace it with the 2008 version. BTW, this should open both 2005 and 2008 cubes.
Thursday, November 6, 2008
Rebuild SQL Server 2005 Master database
start /wait setup.exe /qn INSTANCENAME=MSSQLSERVER REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=mypassword
Microsoft Suggestion:
Use of the Setup command to rebuild the master database has changed in this Microsoft SQL Server release. Run Setup.exe to rebuild, verify, and repair a SQL Server instance, and rebuild the system databases. This procedure is most often used to rebuild the master database for a corrupted installation of SQL Server.
Wednesday, November 5, 2008
Debug TimeSlotscheduler
Friday, October 31, 2008
Reduce in Flicker in Rich Text Box
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
this.Load += new System.EventHandler(this.Form1_Load);
this.button1.Click += new System.EventHandler(this.button1_Click);
}
private void Form1_Load(object sender, EventArgs e) {
for (int ix = 0; ix < 200; ++ix) richTextBox1.Text += "nobugz waz here\r\n";
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private extern static IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
private void button1_Click(object sender, EventArgs e) {
richTextBox1.Focus();
SendMessage(richTextBox1.Handle, 0xb, (IntPtr)0, IntPtr.Zero);
for (; ; ) {
int pos = richTextBox1.Find("bugz", richTextBox1.SelectionStart + 1, RichTextBoxFinds.None);
if (pos < 0) break;
richTextBox1.SelectionStart = pos;
richTextBox1.SelectionLength = 4;
richTextBox1.SelectionBackColor = Color.Aqua;
}
richTextBox1.SelectionStart = 0;
richTextBox1.SelectionLength = 0;
SendMessage(richTextBox1.Handle, 0xb, (IntPtr)1, IntPtr.Zero);
richTextBox1.Invalidate();
}
}
}
STop Form Flickr on XP and Vista
Add this to form
protected override CreateParams CreateParams
{
get
{ //WS_EX_COMPOSITED XP AND Vista Only
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}
Saturday, October 25, 2008
FlowLayoutPanel FLickers when Controls added
Potential Solution:
Add the following code to add being added.
Add following code to Class Constructor
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
protected override CreateParams CreateParams {
get {
// Turn on the WS_EX_TRANSPARENT style
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
example:
public PhotoAccount(Account acct)
{ _acct = acct;
InitializeComponent();
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
RefreshAccountSpace();
txtAccount.MouseClick += new MouseEventHandler(txtAccount_MouseClick);
txtAccount.MouseDoubleClick += new MouseEventHandler(txtAccount_MouseDoubleClick);
}
protected override CreateParams CreateParams
{
get
{
// Turn on the WS_EX_TRANSPARENT style
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
Tuesday, October 21, 2008
VB6 IDE Make/Build menu disabled
VB6 IDE can get into a state when the Make XXXX menu option under the File Menu is disabled.
Solution:
Right click on your toolbar, goto Customize and reset toolbars.
Monday, October 20, 2008
Wednesday, October 15, 2008
C# - Create Custom Exception
Sample from http://www.blackwasp.co.uk/CSharpThrowingExceptions.aspx
using System;
namespace BlackWasp
{
class TestApp
{
static void Main(string[] args)
{
// Check that a parameter was provided
if (args.Length == 0)
{
throw new ArgumentException("A start-up parameter is required.");
}
Console.WriteLine("{0} argument(s) provided", args.Length);
}
}
}
C# Equivalent of VB's IsNumeric()
Int32.TryParse() Method
int result;
if (int.TryParse("123", out result))
{
Debug.WriteLine("Valid integer: " + result);
}
else
{
Debug.WriteLine("Not a valid integer");
}
// throws ArgumentNullExceptionint
result1 = Int32.Parse(null);
// doesn't throw an exception, returns 0
int result2 = Convert.ToInt32(null);
Tuesday, September 30, 2008
Register exe as Windows Service
Application.exe -install
installutil Application.exe
To remove
Application.exe -uninstall
installutil Application.exe /u
Friday, September 26, 2008
BCP and SMO for SQL 2008
When installing SS2008, if you remove your only instance of SQL 2000 or SQL 2005, DMO may disappear. Here is an article of how to reinstall it. I understand that there is an upgrade to DMO which fixes a bug so it can talk to SS2005 & SS2008. That is not referred to in this document. We may want to create this package to use in the future.
BCP – Install the Microsoft SQL Server 2008 Command Line Utilities from net prod dev\tool\sql2008…
Tuesday, September 23, 2008
SQL Server 2000 sysindexes Table Columns
Column name | Data type | Description |
---|---|---|
id | int | ID of table (for indid = 0 or 255). Otherwise, ID of table to which the index belongs. |
status | int | Internal system-status information. |
first | binary(6) | Pointer to the first or root page. |
indid | smallint | ID of index: 0 = Heap = Table Data (not Index) |
root | binary(6) | For indid >= 1 and < indid =" 0" indid =" 255,"> |
minlen | smallint | Minimum size of a row. |
keycnt | smallint | Number of keys. |
groupid | smallint | Filegroup ID on which the object was created. |
dpages | int | For indid = 0 or indid = 1, dpages is the count of data pages used. For indid=255, it is set to 0. Otherwise, it is the count of index pages used. |
reserved | int | For indid = 0 or indid = 1, reserved is the count of pages allocated for all indexes and table data. For indid = 255, reserved is a count of the pages allocated for text or image data. Otherwise, it is the count of pages allocated for the index. |
used | int | For indid = 0 or indid = 1, used is the count of the total pages used for all index and table data. For indid = 255, used is a count of the pages used for text or image data. Otherwise, it is the count of pages used for the index. |
rowcnt | bigint | Data-level rowcount based on indid = 0 and indid = 1. For indid = 255, rowcnt is set to 0. |
rowmodctr | int | Counts the total number of inserted, deleted, or updated rows since the last time statistics were updated for the table. |
xmaxlen | smallint | Maximum size of a row. |
maxirow | smallint | Maximum size of a nonleaf index row. |
OrigFillFactor | tinyint | Original fillfactor value used when the index was created. This value is not maintained; however, it can be helpful if you need to re-create an index and do not remember what fillfactor was used. |
reserved1 | tinyint | Reserved. |
reserved2 | int | Reserved. |
FirstIAM | binary(6) | Reserved. |
impid | smallint | Reserved. Index implementation flag. |
lockflags | smallint | Used to constrain the considered lock granularities for an index. For example, a lookup table that is essentially read-only could be set up to do only table level locking to minimize locking cost. |
pgmodctr | int | Reserved. |
keys | varbinary(816) | List of the column IDs of the columns that make up the index key. |
name | sysname | Name of table (for indid = 0 or 255). Otherwise, name of index. |
statblob | image | Statistics BLOB. |
maxlen | int | Reserved. |
rows | int | Data-level rowcount based on indid = 0 and indid = 1, and the value is repeated for indid >1. For indid = 255, rows is set to 0. Provided for backward compatibility. |
Find Primary Key in SQL 2000
In SQL Server 2000 it is difficult to see as primary key and a foreign key.
Try running this script, which will give you all primary key on all tables in the database including column information.
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS A, INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE B
WHERE CONSTRAINT_TYPE = 'PRIMARY KEY' AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
ORDER BY A.TABLE_NAME
Thursday, September 18, 2008
How to Alter Blogger Template
Increase over width of page:
/* Wrapper */
#outer-wrapper {
margin: 0 auto;
border: 0;
width: 1200px;
text-align: $startSide;
background: $mainBgColor url(http://www.blogblog.com/moto_son/innerwrap.gif) top $endSide repeat-y;
font: $bodyFont;
}
Previous value width: 692px;
Thursday, July 24, 2008
Using ListView Control
ListView lv = listView1;
ColumnHeader colHead;
colHead = new ColumnHeader();
colHead.Text = "Filename";
lv.Columns.Add(colHead);
colHead = new ColumnHeader();
colHead.Text = "Size (KB)";
lv.Columns.Add(colHead);
colHead = new ColumnHeader();
colHead.Text = "Last accessed";
lv.Columns.Add(colHead);
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.RootFolder = Environment.SpecialFolder.MyComputer;
dlg.SelectedPath = @"e:\";
if (dlg.ShowDialog() == DialogResult.OK)
{
DirectoryInfo di = new DirectoryInfo(dlg.SelectedPath);
foreach (DirectoryInfo subdi in di.GetDirectories())
{
ListViewGroup lvg = new ListViewGroup(subdi.Name);
lvg.Name = subdi.Name;
lv.Groups.Add(lvg);
foreach (FileInfo fi in di.GetFiles())
{
ListViewItem lvi = new ListViewItem();
lvi.Text = fi.Name;
lvi.Tag = fi.FullName;
lvi.Group = lvg;
ListViewItem.ListViewSubItem lvsi = new ListViewItem.ListViewSubItem();
lvsi.Text = string.Format("{0}", fi.Length/1024);
lvi.SubItems.Add(lvsi);
lvsi = new ListViewItem.ListViewSubItem();
lvsi.Text = fi.LastAccessTime.ToShortDateString();
lvi.SubItems.Add(lvsi);
lv.Items.Add(lvi);
}
}
lv.View = View.Details;
}
Friday, July 11, 2008
Using FolderBrowserDialog
dlg.RootFolder = Environment.SpecialFolder.MyComputer;
dlg.SelectedPath = Settings.Default.IntialFolder;
What button was pushed:
dlg.ShowDialog() == DialogResult.OK
Using:
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.RootFolder = Environment.SpecialFolder.MyComputer;
dlg.SelectedPath = Settings.Default.IntialFolder;
if ((dlg.ShowDialog() == DialogResult.OK)
{
\\ Some code
}
Using Gimp to Create Tattoos
Easy to do!
Using Gimp to Create Tattoos
Friday, March 21, 2008
GetDate() with Millisecs
use Convert() with FormatOption=20
Sunday, January 27, 2008
Notes for Customizing .net DataGridView
From Microsoft:
How to: Host Controls in Windows Forms DataGridView Cells
DataGridView Custom Column Sample
From /www.devnewsgroups.net:
Implementing a Calendar Control in DataGridView
From Code Project:
VB DataGridView Automatically Saving Updates to a Bound Database