The Art of Programming

How To Get All Features in FeatureClass with ArcObjects

2. February 2011 18:27 by Scott in   //  Tags:   //   Comments (65)

Something I couldn’t easily find on the interwebs so I decided to post it just incase anyone else had trouble with it.

 

                        //gets all features in featureclass
                        IFeatureCursor featureCursorGet = featureClass.Search(null, false);
                        //starts the first feature
                        IFeature feature = featureCursorGet.NextFeature();
                        //gets the column ID where we can find the report ID
                        while (feature != null)
                        {
                           feature = featureCursorGet.NextFeature();
                        }
Scott

You say use a Uid and I say, use a Guid! Uid v.s. Guid

26. January 2011 18:21 by Scott in   //  Tags: , ,   //   Comments (0)

An Email I wrote to one of my developers.  Thought I would share.

So, lets just bring it down to one scenario.

I have a People's table and a Building's table.  One table has a various amount of people including names, DOB and various other small tidbits about their life.  The building has the same.  Its name, its type, and address and various other tidbits.

Now, lets say I have an Images Table.  I want to link images to the buildings and to the people.  But all people and buildings have more than one image.  Instead of adding a new column in that image table to describe the type of image it is for (also adding another table to describe the types of images).  I just have one relation and that is a Item_Id.  That image table is then queried when ever buildings or people are queried.  Only searching for the people Guid or the Building Guid.

Now, lets say I have the images table again, but the people table and buildings table have INT's as their identifier.  If I pull from the Images table all images that have an Item_Id == 5, I could get both personal pictures and building pictures.  Including any other type of picture I take.  And thats why I don't like to use INT's unless I am positively sure it won't cause adverse affects later on.

Make sense?

Google Chrome Bug with CSS– background-color

17. January 2011 11:44 by Scott in   //  Tags: , , ,   //   Comments (27)

I found a Chrome bug today in the browser.

The background-color tag in CSS doesn’t seem to update when using hoverover or onclick commands.

So If I have something like this: http://demotivatedposters.com/posters/add

I wanted to hover over each image and change the css class to another class that had the background-color tag in it.  But Chrome has a small bug that won’t update that tag.  So I had to change the borders visually instead.

Looks like it was also reported here:  http://stackoverflow.com/questions/425216/problem-with-background-color-and-google-chrome

So it looks like its not just me.

I just wanted to report the bug. 

Scott

java.lang.OutOfMemoryError: GC overhead limit exceeded

17. January 2011 11:34 by Scott in   //  Tags:   //   Comments (71)

For those that are having a similar error to:

java.lang.OutOfMemoryError: GC overhead limit exceeded

Something that worked for me but was hard to figure out:

Increase the max memory. The default CF install sets it to 512 MB, if you have CF standard you can bump this to 1024 MB, with enterprise you can go beyond that, e.g.: -Xmx4096m

Scott

Found a User Bug with WM7

13. January 2011 12:38 by Scott in   //  Tags:   //   Comments (15)

Found a small bug, more with the Zune software in WM7 than actual WM7 software.

The bug is as follows. 

  1. I was playing a song yesterday on my WM7 Samsung Focus. The song never ended before I stopped listening to music.
  2. I plugged my phone into the computer to sync Zune and my music.
  3. I unplugged after the sync had ended.
  4. Tried to play music and it would play visually, but not via audio.
  5. So I could see it playing, but it wasn’t coming out of the headphones.
  6. So I turned the phone off and back on again and everything then worked again.
  7. Looks to me like a minor software bug.

Just thought I would post for the good of the community.

Scott

Windows Phone 7 Transparent Background Sea Shepherds

27. December 2010 14:55 by Scott in   //  Tags:   //   Comments (0)

I created a brand new background for WM7 and figured I would share it out.  This one is interesting because its transparent when unlocking the phone for the first time.  You will have to take the file and either download it to your phone from this site, or send it to your self via email.  The actual background is in the Zip file.  The picture is just to show you what it looks like.

Once done, just open it and “use as wallpaper”.

Know issues with transparency:
1. Does not work with pin lock set
2. With certain apps open (like email for instance), you will see the bottom soft buttons through the wallpaper

sheppards_thumb1

The Best Damn Visual Studio Add-In Ever

14. December 2010 01:43 by Scott in   //  Tags:   //   Comments (75)

So way back when Scott Hansleman released RockScroll, I loved it.  Now that I have upgraded to Visual Studio 2010, it isn’t compatible.  So I went searching for another one just like it.  I found a tool called AllMargins and I must say its by far the best damn tool for Visual Studio!  I can’t get enough of it.  It adds on to your scroll bar give you vast amounts of information to view right away.  Its soo wonderful.  Go ahead and give it a try!  I sure did and love it!

 screenshot

OpenFire Error: Unrecognized Windows Sockets error: 0: JVM_Bind

23. November 2010 09:57 by Scott in   //  Tags:   //   Comments (0)

Got this Error when installing and Starting up OpenFire for the first time with the new Beta release of Openfire 3.7.0.

The Error:

Could not listen on port: 5229
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at org.jivesoftware.openfire.FlashCrossDomainHandler.startServer(FlashCrossDomainHandler.java:101)
    at org.jivesoftware.openfire.FlashCrossDomainHandler.access$000(FlashCrossDomainHandler.java:36)
    at org.jivesoftware.openfire.FlashCrossDomainHandler$1.run(FlashCrossDomainHandler.java:58)
    at java.lang.Thread.run(Unknown Source)

The Fix:

I had to figure out what was already bound to that Port and shut the service down. 

So to figure out what port to release

  1. type 'Netstat -a -n -o' on your command prompt
  2. Note the PID corresponds to the port which you want to release
  3. type the command 'tasklist /svc /FI "PID eq <THEPID>”’
  4. Note the task name listed on command prompt (below Image name)
  5. Kill that task from taskmanager

Hope It helps someone

How to convert a DTED (Elevation) File to a Raster

29. September 2010 12:46 by Scott in   //  Tags:   //   Comments (62)

Since I couldn’t find it on the internet, I decided to post it here.

using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesRaster;
 
string dtedFile = @"C:\Examples\DTED Level 2\E35\N82.DT2";
IWorkspaceFactory workspaceFactoryShape = new RasterWorkspaceFactoryClass();
IRasterWorkspace rasterWorkspace = (IRasterWorkspace)workspaceFactoryShape.OpenFromFile(System.IO.Path.GetDirectoryName(dtedFile), 0);
IRasterDataset ds = rasterWorkspace.OpenRasterDataset(System.IO.Path.GetFileName(dtedFile));
IRaster raster = ds.CreateDefaultRaster();

A few things to point out:

  1. The OpenFromFile method is only looking for the directory and not actually the file name.  It has to open a workspace before it opens the file.
  2. The OpenRasterDataset method is where you give just the file name of the dted file.  Remember it already has the file path I stated in the first point.

This code took me almost a full day to figure out.  Its not easily findable on the internet.  Hope it helps someone else out there.

Scott

If you liked this post, please be sure to subscribe to my RSS Feed.