VFPConversionLogo
HomeBlogLearnProductsEventsServicesAbout UsFAQ
Mike Yeager's Blog

Friday, August 18, 2006
I got a new phone the other day

I replaced my PocketCP phone with a new Windows mobile phone.

It's really just what I was looking for.  Previously I had an iPaq 6315 that I bought for development work on a proof of concept app.  It had the big screen, a 1GB SD card, all the stuff, but as a phone, it was marginal.  You couldn't lock the touch-screen, so when you held it up against your face to make a phone call, it would start doing all kinds of things, making appointments, editing your contacts, etc...  I bought a BlueTooth headset which helped the situation, but everyone I called told me that I sounded like I was 50 feet inside of a cave.  The problem was even worse with the hands-free BlueTooth in my Prius.

I headed down to the T-mobile store to find a plain old wire headset for it since it uses an oversize jack - the kind that makes it easy to plug in a standard computer headset, but not any of the cell phone headsets.  They didn't have one, but they did have a great deal on a new phone.  Markus Egger really loves his SDA and I could pick one up for $150 after the rebate, so I went ahead, signed away and got a new phone that really works more like a phone.  The SDA is about the same size as the original Nokia cell phones when cell phones were just coming out so it's large by todays standards, but it's got a great screen.  Not as large as my old PocketPC phone, but it has better resolution.

The hardest thing to get used to is not having an on-screen keyboard.  Typing on a numeric keypad just isn't as easy and on my old phone, I could out-type a high school kid sending a text mesage.  I was hoping they had some software that would let me configure the whole thing on my computer and sync the settings with the phone, but no such luck.  It does however sync my inbox, calendar, contacts, task list, etc...  And since we use Exchange at work, I can sync inbox, calendar and contacts over the cell network at all times.  I added the ClearView programs to let me view Word, Excel and PDF attachments and was in pretty good shape for staying connected out of the office.  I'll miss being able to actually edit these documents on my phone, but I'll get by.  The only thing I REALLY MISS is that 1GB SD card.  I used to be able to download the latest .NET Rocks radio shows and listen to them while I traveled, but no more.

I can't wait to do a little programming on this one and see how I like that.  Not having the touchscreen or keyboard will be a challenge - I was a little bit spoiled there. But I really can't complain.  The best part about my new phone is that when I call someone, they can now hear me and I can hear them.  It's the simple things in life!

Mike

Posted @ 9:29 AM by Yeager, Mike E (myeager@eps-software.com) - Comments


Thursday, August 10, 2006
Mmmmmmm Fried Pickles

This is one of those southern things that I just can't figure out.  My wife is from the south and I've been living in the south for about 6 months now.  In a lot of ways I love the south.  I really love those little expressions they have for everything.  Like when my wife says, "you're just as handy as a pocket on a shirt".  You don't hear that much growing up in New Jersey.  But there are still many things that bewilder me about the south. 

Today at lunch I noticed "fried pickles" on the specials board.  I'd seen this at other restaurants, but the idea never sat quite right with this boy from South Jersey, so I said something about it to our waiter Ken who insisted that they're really good.  The idea of it scared me so much that I ammended my order from what until then looked pretty good to a cheeseburger, the most conventional thing I could find on the menu and would listen no more to tales of fried pickles.

A few minutes later a very nice young woman came by and delivered a complimentary order of fried pickles, courtesy of our waiter Ken (thanks Ken).  If you've never had fried pickles, they're dill pickle chips, dipped in a spicy batter, deep fried and served with a side of Ranch dressing.  Curiosity quickly overcame us and we treid them.  To my shock and dismay, they taste exactly as you'd expect, like a deep fried dill pickle slice with Ranch dressing on it.  No sudden, "Hey this is really great"or "Wow, I really didn't expect this".  Nope, none of that.

What I didn't expect is that over the course of the next several minutes, we all KEPT eating the fried pickels, all the while commenting on how they weren't very good.  Pretty soon, pickle by pickel, they were all gone.  Only in the south!  It was like an out-of-body experience, watching your arm reach for another one of those damn things.  I don't know that I'd order them again  voluntarily.  Then again, I actually watched myself eat several of them this afternoon as if I had no control of myself.  Did I mention that they taste exactly like fried pickles?  Fried pickles!  You can't make this stuff up!



Posted @ 3:26 PM by Yeager, Mike E (myeager@eps-software.com) - Comments


Tuesday, August 08, 2006
More SQL Everywhere ... stuff

I've recently had a chance to actually work with SQL Everywhere (basically the SQL CE/SQL Mobile file based database that can run on a desktop as well as a mobile device) and I've learned a few things that I found interesting.

This entry from the FAQ caught my eye immediately.  Beetween this feature and LINQ, it would almost seem that they're trying to create FoxPro 10, dot NET style.
Q: Does SSEv have any unique features from its SQL Server products?
A: Yes.  Because SSEv is focused on local, in-proc data scenarios we can expose features that would otherwise be difficult to expose without scaling limitations.  SSEv will support the SqlCeResultSet api that was shipped in SQL Mobile 2005.  This feature enables developers to create a databindable, updatable, scrollable cursor.  As a user makes a change to a row, the values are immediately pushed back to the database. There’s no need for DataAdapters or DataSets.  SqlCeCommand includes some Seek like features that allow developers to leverage specific indexes as well.

On the minus side, I found one really annoying thing:
Nowhere have I found a topic like "Differences between developing for SQL Server and SQL Server Mobile".  They used to have a topic like this in the SQL CE docs and I found it very helpful.  Instead there is a lot of talk about the features it does support and nothing about the ones it doesn't.  If you're wondering if something is supported or not, just keep looking through the docs and at some point, if you don't find it - it's not.

Did you know that SQL E only supports 1 SQL command at a time and doesn't support stored procs or user defined functions?
Therefore, things like DECLARE aren't supported - why DECLARE a variable if you can't use it?  This makes sense if you think of it in terms of putting the logic of batches and stored procedures in your .NET code instead.  It takes a minute to make this philosophy shift in your head, but once you do, things get easier.  You simply can't do things interactively in the query window like you're used to in SQL Server.  Instead of

DECLARE @MyVar VARCHAR(50)

IF @MyVar IS NOT NULL

BEGIN

    SET @MyVar = (SELECT SUM(price*quantity) FROM lineitems)

    IF @MyVar > 50.00

    BEGIN

        SET @MyVar = @MyVar + 10.00

    END

END

SELECT @MyVar

You write it in code, using SQL E to hit the db when necessary:

public decimal GrandTotal()

{

    SqlCeConnection conn = new SqlCeConnection("DataSource='Northwind.sdf'");

    SqlCeCommand cmd = new SqlCeCommand("SELECT SUM(price*quantity) FROM lineitems", conn);

    decimal grandTot = (decimal)cmd.ExecuteScalar();

    if (grandTot > 50.00M)

        grandTot += 10.00M;

    return grandTot;

}

Did you know that SQL E only supports subqueries as part of a WHERE IN clause?
SELECT * FROM customers WHERE PKcustomers IN (SELECT FKcustomers FROM orders) this works as expected
UPDATE customers SET amount = (SELECT SUM(price*qty) FROM orderdetails WHERE FKcustomer = customers.PKcuatomers) doesn't work
Again, if you want to do something like this, you have to do it in two steps in code.

The UI in SQL Server Management Studio is REALLY LIMITED.
SQL E doesn't support SMO or DMO, so there's a lot of coding that has to go into making the UI work like the other versions so it's not nearly as full featured yet.  For instance, you can't reorder columns, change column names, easily see foreign key constraints, or even do a simple "open table" to view the data.  You CAN do these things in code and you can do some of them in the query window.  SQL E doesn't support user defined views, but it does provide some INFORMATION_SCHEMA.??? views so that you can get a list of tables, columns, indexes, referential constraints, etc...

SQK E does support transactions
It's basic support, but it's great to have for free!

SQL E only supports a limited set of data types
Oddly enough for a product designed for limited storage constraints, it only supports unicode types, NCHAR, NVARCHAR, NTEXT.  Still, you can store most everything you need including IMAGE types.

SQL E does support Reporting Services!
Reporting Services requires a DataSet to run and you can create DataSets from SQL E, so it works fine!



Posted @ 10:06 AM by Yeager, Mike E (myeager@eps-software.com) - Comments


Friday, August 04, 2006
Team System Static Analysis and Acronyms
I'm working on some projects for converting Visual FoxPro applications to .NET, so naturally the acronym "VFP" comes up in code, along with our company name "EPS" and Team System's static analysis engine doesn't like it.  I could set attributes all over the code to suppress this or I could turn off the rule, but that disn't seem elegant.  I thought that I'd just do what I did in FxCop and create a CustomDictionary.xml file that added the acronym to FxCop''s dictionary.  So I created the file like this:

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
  <Acronyms>
  <CasingExceptions>
   <Acronym>VFP</Acronym>
   <Acronym>EPS</Acronym>
  </CasingExceptions>
 </Acronyms>
</Dictionary>

... and I dropped it in the solution folder ... nope ... dropped it in the project folder ... nope ... searched the help file ... nope.  I eventually found a post http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=371884&SiteId=1 that explained that if you drop the file into the FxCop folder C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop, it will work.

Team System does a good job of hiding it, but it uses a new version of FxCop to run static analysis and right now, that folder is the only place it will look for a custom dictionary file.  It looks like something they'll have fixed for the next release.  For now, it's a work-around that works.

Mike



Posted @ 9:28 AM by Yeager, Mike E (myeager@eps-software.com) - Comments (2)


Thursday, August 03, 2006
WPF? XAML? How do I get my head around these?
I installed XAMLPad several months ago and started playing with it armed only with a CoDe Magazine article that had some examples in it.  It was pretty cool stuff.  I later had a need to validate some XAML-like content I was producing for another project, so I pasted my XAML-like text into XAMLPad, eliminated the non-XAML parts and tweaked it until it displayed properly.  I was getting some work done, but I still didn't have my head around XAML.  I knew that each object I created in XAML text was really a .NET 3.0 object like a textbox or a checkbox or a line.  I knew that you start with a "layout" object like DockPanel, ViewPanel or Border and add other objects to it.  I was looking for a reference where I could see a list of what was possible so that I could try things out as they caught my eye. 

The docs seemed to consist of the "Windows Microsoft SDK" help file which seemed like an odd place to find them.  I was expecting a Windows Presentation Foundation help file or a XAML help file or something along those lines.  In any case, if you set the help filter to "WinFx Development" and look for the topic "Windows Presentation Foundation Controls Gallery", you can download a sample application that you can open, build and run in Visual Studio.  It's a pretty cool little app that shows you many, but not all of the layouts and controls available.  the best part is that you can edit the XAML for the samples and try things out.  This is just the thing I was looking for as a learning tool.  I have the tool open on one monitor and the help file open on the other (yea Napolean, "LUCKY...").  I noticed that the ScrollViewer control sample has a vertical scroll bar, but not a horizontal scroll bar, so I looked up the ScrollViewer control in the help file, found the "ScrollViewer Members" topic (which crashed Help the first time, but later opened) and found the HorizontalScrollBarVisibility Public Property.  I tried adding an attribute that looked like HorizontalScrollBarVisibility="ScrollBarVisibility.Auto", but that didn't work, neither did HorizontalScrollBarVisibility=ScrollBarVisibility.Auto without the quotes.  After a couple of tries, I found that HorizontalScrollBarVisibility="Auto" did what I wanted it to do.  It's a learning experience!

If you're looking for a learning tool for XAML, try this one for a start.  You might just learn something!  Oh, 1 thing.  The project doesn't have a default namespace configured so if you find yourself messing wwith the project itself and you add a new WinFx Form or Page, it won't run.  Set the namespace in the properties for the project first!



Posted @ 9:23 AM by Yeager, Mike E (myeager@eps-software.com) - Comments


Tuesday, August 01, 2006
Client Side Reports in SQL Server Reporting Services

From what I can tell, there aren't a whole lot of people using this feature (yet).  With Reporting Services in SQL Server 2000, everything was server based.  With the 2005 version, you can run everything on the client side without SQL Server.  OK, it's a little bit confusing for something named SQL Server Reporting Services, but this is Microsoft, so you almost have to expect something like this every now and then. 

I've been doing a lot of work, both in the designer and working directly with the RDLC files (which are XML files) and I've found a few interesting "features" I wanted to share:

PROPERTIES!

  • Yes, you have the properties sheet, but there isn't much on it that's very useful.  The only thing I've found really useful there so far is the abiltity to specify the text alignment, so that I can center or right justify things in a textbox.
  • Most of the time, you right-click on a report item and choose Properties - which give you a dialog that is quite different than the properties sheet!

LABELS!

  • Reporting Servies doesn't use the concept of labels.  If you want a label, use a textbox and type your text in.

TABLES!

  • If you are used to banded report writers and want to get the same experience, use a Table control. 
  • Tables have pre-defined columns, but very often you don't want every report item in every row to line up exactly the same as the columns on all of the other rows.  Whenever I use a table, I first reduce it to a single column and drop a "Rectangle" control on each row.  This gives me the ability to position report items anywhere on the row that I want and allows me to have rows that are 2 or 3 lines high each.
  • Unlike some banded report writers, the area above and below your table are the report header and footer.  This can be confusing since the page header and footer are shown at the top and bottom of the report - outside of the report header and footer.
  • The report menu allows you to configure Data Sources (which are always DataSets), but you must also set the Data Source property of the table.  The reasoning behind this is that you can have multiple tables on a page, so a table doesn't necessarily correspond to the main table for the report.
  • The properties for a table grouping (including the "detail" band) are accessed by right-clicking on the icon on the left side of the table and choosing "Edit Grouping..."  You might think you'd find this stuff under "Properties", but you'd be wrong!

VISIBILITY!

  • You can set "visibilty" at various levels.  On a report item, on a rectangle on which the report item sits, on a "grouping" (single line) of a table, on the table itself.  There are a lot of places!  You should usually set the visibility at the highest possible level.  In other words, dont' set it for all of the textboxes on a line if you want to suppress the whole line.  Set in on the table "grouping" instead.
  • Visibility can be set to "Visible", "Hidden" or "Expression".  It seemed natural to me that if the expression evaluated to true, then the item would be visible.  Not so.  If the "visibility" expression evaluates to true, the item is hidden.
  • Drill Down is just the act of making things visible and invisible at run time in the viewer control.  You do this by setting the "Visibility can be toggled by another report item" checkbox, and selecting another report item next to which the + / - icon will go.  This works much like a treeview control, but by default, it shows the + when the data is visible, which is the opposite of the way a treeview works.  You can change this setting in the same dialog.

CUSTOM CODE!

  • Is sort of hidden - you'll find it on the Code tab of the Report Properties window under the report menu.
  • It only accepts VB.NET code, sorry , no C#.
  • There is no syntax coloring or intellisense and error reporting is pretty lame.
  • The good news is that you CAN compile .DLLs (in any language you choose) and call them from your report.  You'll find support for that on the References tab of the Report Properties dialog. 
  • The top part of the dialog labeled "References" is where you'll add DLLs with static methods where no instance of the class has to be made.
  • The bottom part of the dialog labeled "Classes" is where you'll add DLLs when you do want Reporting Services to create an instance.
  • By default, you won't be able to get any of your DLLs to run in reporting services.  In my experience, none of the settings suggested for solving this problem for "real" Reporting Services, running on SQL Server work either.  When you think about it, it does make sense.  Running a DLL is a very powerful thing and can have serious security consequences.  After all, the RDLC file is just XML, so it's inherently not secure.  If someone tampered with it and told it to fire up a scary DLL, things might not look so good for your career.  It took me quite a while to find a solution.  In fact, Google listed only 5 instances of the error message that Reporting Services gave me.  Only one of those had a solution.  You have to allow IN CODE each DLL that you want to call prior to rendering the report.  Try putting code like this in your form just before you call this.reportViewer1.RefreshReport():

//You can get the string needed for this parameter from

// "Report" menu --> "Report Properties..." --> "References" tab

// when designing the report.

this.reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain(

"MyFunctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");


Intuitive!  Not!

  • The same security issue will prevent the report from loading image files external to the RDLC.  You can allow that with this line:

this.reportViewer1.LocalReport.EnableExternalImages = true;



ERROR HANDLING!

  • Sucks!
  • Generally, you get a message that an exception occurred and it tells you to look in the log file on the server.  There is no server, there is no log file.
  • If you want any more information than what's displayed on the screen, go to the Properties sheet for the report viewer control and handle the ReportError event.
  • If you modify the RDLC directly WHILE THE REPORT IS OPEN IN DESIGN MODE and mess something up, the designer will often show a big red X across the whole report, beep at you and then lock up the IDE so that you have to kill it off in task manager.  Close the designer before modifying the RDLC by hand.

Once you get used to it, the tool is quite powerful.  There is so much to cover, but these tips are the ones that I spent way too much time on.  These are the ones I couldn't find information on in any of the books I have.



Posted @ 3:38 PM by Yeager, Mike E (myeager@eps-software.com) - Comments


Blog List
VFPConversion Blog
Markus Egger's Blog
Ken Levy's Blog
Claudio Lassala's Blog
Blog Archive
March, 2008 (1)
February, 2008 (1)
October, 2007 (1)
September, 2007 (2)
July, 2007 (1)
May, 2007 (3)
March, 2007 (3)
January, 2007 (2)
December, 2006 (1)
October, 2006 (2)
September, 2006 (2)
August, 2006 (6)
July, 2006 (3)
June, 2006 (2)
May, 2006 (4)