I was trying to compile a C++ Project in Visual Studio
and this project has a post-build step that executes
some batch statements.
And succendly from one day to the other the project failed
and the only message I had was
The input line is too long
After some googling I found that this error is displayed
when the command line in the command prompt
exceeds the maximum number of characters.
(Something quite obvious jeje)
The bottom line was that recenlty I had installed
some software and my PATH variable became TOO long
I fixed it by creating a new environment variable
called EXTRA_PATH where I put some references to
Some big paths and then changed my PATH variable
replacing all those long variables for
%EXTRA_PATH%.
And problem solved!
I recently found this decent tool called
VB6 Reference Explorer.
It even comes with source code.
This tool will show a list of the references for a set of projects in your path.
Here at Artinsoft, some colleagues have develop
some tools that perform even more exhaustive
project analisys like CreateObject dependencies
and others. Maybe I'll post something about those
tools in the future
If you ever had any problems while migrating from VB6 Printer Object or the
PrintForm functionality
we have goods news for you the Microsoft Visual Basic 2005 Power Pack 2.0.
Our version of the Visual Basic Companion already provides and extended
migration of the Printer Object,
and we're now updating it to use this new implementation. This Printer
Compatibility Library makes it a
breeze to migrate Printer Functionality.
This is the description of the PowerPack:
"The new Line and Shape controls included in this version of the Visual
Basic 2005 Power Packs are
a set of three graphical controls that enable you to draw lines, ovals, and
rectangles on forms and
containers at design time making it much easier to enhance the look of your user
interface.
These new shape controls also provide events such as click and double-click
allowing developers
to respond and interact with end users.
The Printer Compatibility Library allows projects that used the Printer and
Printers Collection in Visual Basic 6.0
to be upgraded without having to re-write your printing logic. By simply
adding a reference to the library, declaring a
Printer and making a few minor syntax changes, your project will be able to
print using the Printers collection
and Printer object as it did in Visual Basic 6.0. This version adds a new Write
method to the Printer object which
allows you to print text without a forced carriage return similar to the
semicolon syntax used by Print method in Visual Basic 6.0.
The PrintForm component is designed to bring back the ability to easily print a
Windows Form.
With this the new PrintForm component you can once again layout the Windows Form
exactly as
you want it and allow your users to print the form as a quick report."
You can download the PowerPack from
here
NOTE: there's is another link that only includes the Printer Library but MS
recommends to download the PowerPack
because minor upgrades and fixes will be done on the PowerPack distribution
IE7 has an interesting bug...
Someone decided to change the printing default
to "Shrink to Fit".This is supposed to be good
because it will make printing of web pages better
but it affects several applications develop for
IE, for example if you are using the Web Access
to your Exchange server, or if you have an application
that prints on a page that is not a letter size page
Well a
guy from a forum found an excellent solution.
The only problem is that he refers a hot fix,
but if you have problems with that hotfix, then
do the following:
1. Go to windowsupdate.microsoft.com
2. Make sure you have the following updates:
** Security Update for Internet Explorer 7 for Windows XP (KB938127)
** Cumulative Security Update for Internet Explorer 7 for Windows XP (KB937143)
And then run the following in the command prompt:
reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_STF_Scale_Min" /v iexplore.exe /t REG_DWORD /d 100 /f
As part of the VB Companion Development group, my day to day includes
migrating several project from different clients, to develop custom mappings
and custom functionality for their migration needs or to add new features
for the next VB Companion version.
A long part of the initialization in the migration process consists of the load and
analysis of the COM references indicated in the .VBP project file.
Sometimes I have notice that there are several references that are never used.
Removing these references will provide a great save in time because the migration will
not have to incur in any time for TypeLib and TypeInfo extraction.
I look for a tool that let me get rid of the VB6 unused referencences but I found none.
So I decided to create one myself. And I created the VB6 Project References Cleaner Addin
The concept of the tool is simple, someone from a group posted the idea I just implemented.
The addin goes thru all the references and one by one tries to remove it.
And then compiles the project. It the project compiles,then the reference was not neccesary.
If you mark the remove option the tool will remove the references for you.
This tool will NOT SAVE the project file. You decide if you what to save it.
I'm attaching the source code and the dll. To used it just take the VB6References.dll and run:
regsvr32 VB6References.dll
After that the tool will appear in the Addins menu in VB6
SOURCE CODE and BINARIES
Every SERIOUS VB6 application, ended up requiring
that you import some functionality from the windows API or another DLL.
However if you were looking for a .NET equivalent and
google did not take you to the right page,
there is a document (a little old I might say)
called
Microsoft Win32 to Microsoft .NET Framework API Map
I remember a couple of other pages that were even more complete,
but right know I can only remember
http://pinvoke.net that gives some info about APIs
We had a problem with a cfgrid
Coldfusion8 introduces an HTML cfgrid that is AWESOME!!!
It is something you should use.
It is based in the also excellent library
Ext
But recently we were extruglying with it because when we tried to capture exceptions in the update functions nothing happened and it was terrible because a real life application NEEDS exception handling.
My code was something like this:
First file was places.cfc
<cfcomponent output="false">
<cffunction name="getData" access="remote" output="false">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdirection">
<cfquery name="team" datasource="cfdocexamples">
SELECT Emp_ID, FirstName, EMail
FROM Employees
<cfif gridsortcolumn neq "" or gridsortdirection neq "">
order by #gridsortcolumn# #gridsortdirection#
</cfif>
</cfquery>
<cfreturn QueryConvertForGrid(team, page, pageSize)>
</cffunction>
<cffunction name="editData" access="remote" output="false">
<cfargument name="gridaction">
<cfargument name="gridrow">
<cfargument name="gridchanged">
<cfif isStruct(gridrow) and isStruct(gridchanged)>
<cfif gridaction eq "U">
<cfset colname=structkeylist(gridchanged)>
<cfset value=structfind(gridchanged,#colname#)>
<cfquery name="team" datasource="cfdocexamples">
update employees set aaa<cfoutput>#colname#</cfoutput> =
'<cfoutput>#value#</cfoutput>'
where Emp_ID = <cfoutput>#gridrow.Emp_ID#</cfoutput>
</cfquery>
<cfelse>
<cfquery name="team" datasource="cfdocexamples">
delete from employees where emp_id = <cfoutput>#gridrow.Emp_ID#
</cfoutput>
</cfquery>
</cfif>
</cfif>
</cffunction>
</cfcomponent>
and the second file was grid2.cfm:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function errorhandler(id,message) {
alert("Error while updating\n Error code: "+id+"\n Message: "+message);
}
</script>
</head>
<body>
<cfform name="form01">
<cfgrid format="html" name="grid01" pagesize=11
stripeRows=true stripeRowColor="gray"
bind="cfc:places.getData({cfgridpage},{cfgridpagesize},
{cfgridsortcolumn},{cfgridsortdirection})"
onerror="errorhandler"
delete="yes" selectmode="edit"
onchange="cfc:places.editData({cfgridaction},{cfgridrow},{cfgridchanged})">
<cfgridcolumn name="Emp_ID" display=true header="Employee ID"/>
<cfgridcolumn name="FirstName" display=true header="Name"/>
<cfgridcolumn name="Email" display=true header="Email"/>
</cfgrid>
</cfform>
</body>
</html>
And the problem where was it!!
It was not in any of those files it was in the application.cfm
There was an onError handler. So it was commented out and everything work perfect!
Well I just like to write down these little details so I don't make this silly things twice.
I hope this can be of any help
I felt so stupid today. Because when for a couple of months,
every now and then, when someone asked me for a copy of the source code
I just made a copy of my src directory and then searched for the .svn* folder
and then I erased them,
until by mistake i found the
EXPORT function.
I use SmartSVN and I was creating a new project
and then the light came to me :S
Well if it happens to you just remember there is a
svn export
command. This will get the code from the repository without all the nasty files.
In the VB world previous to .NET a concept you probably had to deal with was
TWIPS.
What were Twips? Well if you do not remember those happy VB6 times, let me
refresh your memory:
Twips are screen-independent units to ensure that the proportion of screen
elements are the same on all display systems.
A twip is defined as being 1/1440 of an inch.
A Pixel is a screen-dependent unit, standing for 'picture element'.
A pixel is a dot that represents the smallest graphical measurement on a screen.
In .NET everything is pixels. So if you migrated something from VB6 using the
Upgrade Wizard you might found several expressions like:
VB6.TwipsToPixelsX(ctrl.Left)
or VB6.PixelsToTwipsY(ctrl.Height)
There is an X and a Y version of this function, because the conversion factor
is not the same for both axis.
Sadly you can even found some expressions like:
VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(ctrl.Left))
In a strict sense there could be minor differences because of the conversion
factors. But in it seams that things like that can be removed because all
controls Bound properties like Left, Top, Bottom, Right are in pixels. So why
will you convert your pixels units to Twips units to then convert them back to
Pixels if they where already in Pixels????
Also you can find something like:
VB6.TwipsToPixelsX(ctrl.Left + ctrl.Width + 30)
which should be something
like:
ctrl.Left + ctrl.Width + VB6.TwipsToPixelsX(30)
If you have an application migrated with the Upgrade Wizard you can use some
regular expressions to improve those expressions. If the conversion is something
like:
VB6.TwipsToPixelsY(VB6.PixelsToTwipsX(ctrl.Left))
then be careful because
conversion factor might produce a different value, due to the change of axis.
jeje Or you can uset the VBCompanion, the extensible version of the Upgrade
Wizard!!!
.NET has a more strict typing than VB6
So you must check in some circumstances if your object implements an interface
or not.
So I had used the as and is operators in C# but I did not know
how to do that.
I did I little research and I discovered some things about casting operators for
VB.NET
Operator |
Example |
Observations |
CType |
Dim testNumber
As Long
= 1000
' The following line of code sets testNewType
to 1000.0.
Dim testNewType
As Single
= CType(testNumber, Single)
|
Throws InvalidCastException or OverflowException It could
be less eficient due to VB.Net helper routines.
This is a Narrowing and Widening operator.
It can be overloaded
Public
Structure digit
Private dig
As Byte
Public
Sub New(ByVal
b As Byte)
If
(b OrElse b > 9)
Then Throw
New _
System.ArgumentException("Argument outside
range for Byte")
Me.dig
= b
End
Sub
Public
Shared Widening Operator CType(ByVal
d As digit)
As Byte
Return
d.dig
End Operator
Public
Shared Narrowing Operator CType(ByVal
b As Byte)
As digit
Return
New digit(b)
End Operator
End Structure
|
DirectCast |
Dim f
As New
System.Windows.Forms.Form
Dim c As
System.Windows.Forms.Control
' The following conversion succeeds.
c = DirectCast(f,
System.Windows.Forms.Control)
|
Throws InvalidCastException. Is more
efficient than CType because it does not depend on the Visual
Basic helper runtime functions. It can even detect some errors as
invalid casts during compile time
However it requires a relationship of inheritance of implementation
For example:
Dim q As
Object = 2.37
Dim i As
Integer = CType(q,
Integer)
' The following conversion fails at run time
Dim j As
Integer =
DirectCast(q, Integer)
The run-time type of q is Double. CType
succeeds because Double can be converted to Integer.
However, the first DirectCast fails at run time because the
run-time type of Double has no inheritance relationship with
Integer, even though a conversion exists
|
TryCast |
Dim
obj As MyType = TryCast(obj, MyType)
If obj
Is Nothing
Then
' Object could not be cast
Else
' Object was casted
End If |
Throws no exceptions. |
All this information has been taken from the MSDN site. This is just a quick
summary. For more information see:
Type Conversion Functions
Conversion Functions (Visual Basic)
Widening and Narrowing Conversions
Implicit and Explicit Conversions