This is how I delete duplicate rows from the database.
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)
Something incredibly disappointing that I found out today. When you create a selector in Android, there is currently no way to set styles via a selector.
What do I mean? Well look below:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
style="@style/CategoryButtonPressedStyle" /> <!-- pressed -->
<item android:state_focused="true"
style="@style/CategoryButtonFocusedStyle" /> <!-- focused -->
<item style="@style/CategoryButtonStyle" /> <!-- default -->
</selector>
I currently have the styles set in a selector for a button. From what I found out you can only set drawables attributes to selectors instead. What if I don’t want a graphic overlaying my button. I want to do it programmatically instead. This is incredibly disappointing because well CSS can do this.
Looks like they don’t have plans for this either.
Just a rant.
Scott
I was pushing large files to the Android Emulator lately. We are talking above 100mbs a piece or more. When I uploaded them in Eclipse, they would break and not upload about half way through. It took me a few hours to keep trying till I got frustrated.
So I found a tool inside the Android SDK Folder under the platform tools folder. Its call adb and it needs to be run with the command line. This tool actually worked and I was able to watch it work via the Eclipse DDMS view.
So if you need to upload large files for any reason and eclipse is failing you, use the adb tool.
Example:
C:\Program Files (x86)\eclipse\android-sdk-windows\platform-tools>adb push C:\UsersAndroidCs2\Map.db /mnt/sdcard/mapdata/Cycle_Map.db
One Error I received before I found this tool:
[2011-03-10 16:10:17] Failed to push the items
[2011-03-10 16:10:17] (null)
Something I had to learn the hard way when unit testing in Android.
When using this tutorial for testing in Android: http://developer.android.com/resources/tutorials/testing/helloandroid_test.html
Something that they don’t tell you is to you must declare that the methods are tests. Well since I was also used to adding attributes to C# tests in Visual Studio. You don’t have attributes in java. Sadly.
So whats the next step in declaring that your method is a test?
public void testAssertions(){}
You must declare it in the syntax. By preceding the method name with the word “test” like the method above, you declare that it is a test. I know, this sounds stupid and the darn tutorial doesn’t even explain that this is required, but it is. This little problem took me a day to figure out.
Some errors I received because of this little problem are below:
Test run failed: Test run incomplete. Expected 1 tests, received 0.
To All Developers of a Mobile Mapping Tool,
Will you please build into the map a button to zoom out?
Let me give you all a scenario I find my self in all the time. I am walking down the road and I have a mobile device in one hand, while carrying a bag of something in the other. I am trying to find out where I exactly need to go. I look at my mobile map and it has the directions on it. I click on the map with my ‘opposable thumb’ to zoom into the location, But oh wait, I zoomed in to see what corner its on and now I need to zoom back out to watch where I am walking.
Can you please tell me how to do this efficiently without pulling up my other hand to use two fingers to zoom out? I can’t even use my ‘efficiently nature given opposable thumb’. I have to use two fingers to zoom out. Did someone expect me to zoom in with my thumb, but never wanting to zoom back out? The hand held device should be capable of being used with just one hand. The Zooming on maps does not allow this ability.
This scenario can happen anywhere and bite you in the butt.
- Walking with groceries.
- Driving with GPS.
- Its cold out side and I have gloves on. Why would I want to remove both pairs?
- I am a War veteran and I lost my arm in battle. Not to mention if I just lost my hand.
- I have a Beer in one hand and walking down some downtown street at a festival and I need to find my friends. I would never put my beer down. That’s just disrespectful to the beer.
This is a PLEA. Please implement a ZOOM OUT button by default or just enabling it in settings. I personally develop for Android and WM7 and make sure I put that Zoom out button on the same screen as the map. Zoom in is a totally different scenario since I can just click on the map to zoom in.
Please, Just think about it!
Scott
I received this error while working on some ArcObjects Code.
Objects in this class cannot be updated outside an edit session.
It had to do with the relationships that I established inside the File Geodatabase I was saving to.
So I had to add a few lines and open up an EDIT SESSION on the workspace. I guess if you don’t have any relationships, you don’t need an edit session, but when you start using relationships you have to start opening up an edit session.
So here is my code. You will notice the 3 lines that open the IWorkspaceEdit and the last two lines that stop editing.
//First thing is to create a generic fGDB workspace factory class
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass();
//Create a workspace and point it to the fGDB file
IWorkspace workspace = workspaceFactory.OpenFromFile(DATABASE_PATH_WITH_ATTACHMENTS, 0) as IWorkspace;
IWorkspaceEdit edit = (IWorkspaceEdit)workspace;
edit.StartEditing(true);
edit.StartEditOperation();
//Add some EDIT code here to the DB...
edit.StopEditOperation();
edit.StopEditing(true);
//Remove references to the fGDB
workspaceFactory = null;
workspace = null;
datasets = null;
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
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?
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