Category Archives: windows

GMap.NET component : Moving Marker

WTH is GMap.NET?

Simply put: it’s an open source .net component that can show online mapping service (such as Google Map, Bing Map, OpenStreetMap) in your .NET app.
Download the binary here: http://greatmaps.codeplex.com/
Extract it. You’ll get the .net 2.0 and .net 4.0 version, since I’m using VS 2015, we’ll use the .net 4.0 version.

What will we do now is about how to move a marker inside the map (for tracking/visualizing object movement, etc). We’ll just move the marker randomly in this tutorial.

  • Create new VB Windows Form project
  • Add GMap.NET component into your project reference
GMap.NET component reference

GMap.NET component reference

  • Add GMap.NET component into your toolbar.
Add GMap.NET component step 1

Add GMap.NET component step 1

Add GMap.NET component step 2

Add GMap.NET component step 2

  • Now drag and drop the GMap.NET control into your Form, I name it myMap
  • We’ll also add another controls: 1 Button (name: btnMove), 1 Timer (name: tmr1), 1 Label (name: lblInfo)
List of components

List of components

I also add new bitmap resource into our project properties. This will be used as our marker symbol.

Resource for marker symbol

Resource for marker symbol

You can see the Form’s full source code at the bottom of this post. I’ll just point out some important parts:

  • Map initialization is on Form1_Load event code (zoom level, initial position, provider used, marker type, etc)
  • When you click on the btnMove, it’ll start generating new random position for our marker. The random change is happened in the timer event (tmr1_Tick)
  • The process to update the map visual is delegated into function update_map(), so it will run in different thread and the form still responsive
  • In this tutorial, we are using BingSatelliteMapProvider, you can use another provider such as GoogleMapProvider or OviSatelliteMapProvider. Just see MapProviders namespace to see all supported providers.

Running the app

Running the app


Here’s the full source code:

cygwin: failed to build ArduPilot because of isnan / isinf

Upon building SITL on Windows 10 via cygwin following this tutorial: Setting up SITL on Windows, I encountered build error in this step :

Something like these (the original error is very long):

So, it seems the libraries is trying to use isnan function but can’t find it.
The solution is quite simple (although I’m not sure if it’s the correct way, but hey.. my solution works!): we edit all .cpp and .h files inside ardupilot/libraries/ folder (and subfolders) and replace all isnan and isinf appearance into std::isnan and std::isinf, for example inside ardupilot/libraries/AP_AHRS/AP_AHRS.cpp line #271, replace:

into

to find files that references isnan and isinf, you can use find command (from within ardupilot/libraries/ folder) like this one:

find all .h and .cpp files that contain "isnan" reference

find all .h and .cpp files that contain “isnan” reference

and for isinf:

It’ll show you the files that need to be edited. (You might need to install nano to edit the files — just for convenience).

And done! You are good to go to build SITL in Windows!!

SITL running in windows 10 64bit

SITL running in windows 10 64bit

Windows Installer Cleaner

Some background:

My SSD drive is almost full, after checking with TreeSize Free, it seems a lot of space is taken by files inside c:\windows\installer\. Searching around, I conclude that some of files is safe to be deleted from that particular place. There is a VB script in http://blogs.msdn.com/b/heaths/archive/2007/01/31/how-to-safely-delete-orphaned-patches.aspx that detect which files that shouldn’t be deleted from c:\windows\installer.

I also know an application named WiCleanup from KZTechs that detect and delete the “safe” files but after I tried it, the confirmation of deletion for files one-by-one makes me uncomfortable. So, I decide, why not programming the application by myself? And this application is born!

Implementation:

I programmed the application in VB .NET language using the free Microsoft Visual Studio 2013 Community Edition. Without further a do, you can download the application here:

[button link=”http://www.ahowto.net/wp-content/uploads/2015/03/Release.zip”]Windows Installer Cleaner Binary Only[/button]
(Of course you need .NET framework 4.5 installed if you want to run this application)
[button link=”http://www.ahowto.net/wp-content/uploads/2015/03/wic_winform.zip”]Windows Installer Cleaner Full Source Code[/button]

How to use:

It’s quite straight forward. There are three buttons there, you just need to click on them sequentially.

  1. Click “Get Kept List” to see which files that you should keep on c:\windows\installer
  2. Click “Get Delete List” to get the files that should be safe to be deleted and their size.
  3. Click “Delete Files” to delete the detected files.

What I learn from building this application:

  • how to create .NET application that need Administrator privilege (UAC things) when executed
  • how to use COM object in .NET application
  • how to use/import .dll from MS Windows in .NET
  • some file operation in .NET (FileInfo, deleting files, file’s attribute)
Windows Installer Cleaner Screenshot in Windows 7 64-bit

Windows Installer Cleaner Screenshot in Windows 7 64-bit

The application is already tested on Windows 8.1 64-bit and Windows 7 SP1 64-bit. Both systems is running fine until now. 😀

Play DASH video and DASH audio at the same time using VLC

VLC playing DASH video and DASH audio at the same time

As you may know, you can download youtube video using http://vrank.org/. The advantage of http://vrank.org/ over http://ytconv.net/ is that vrank allow you to download the video in their original format supplied by youtube. The one we will discuss is about DASH video and DASH audio formats. They are high quality video and audio formats but it has drawback: when you download a video in DASH video format you can’t hear any sound AND when you download in DASH audio format, you can’t see any video (obviously!).

DASH video and DASH audio formats option in vrank.org

DASH video and DASH audio formats option in vrank.org

Why? Well, the simple answer is: google/youtube separate the video into two stream: video and audio. So, when you are streaming a youtube video (using browser) in high quality format (720p and up), you actually download/stream from two different files.

Now, how can you play these two files (DASH video and DASH audio) at the same time? We will use VLC to do this!

  • Let’s assume you already downloaded the two files (DASH audio and video)
  • Open VLC
  • Access Menu: Media –> Open Multiple Files…
VLC: Media --> Open Multiple Files...

VLC: Media –> Open Multiple Files…

  • A new empty “Open Media” window will be opened, click on that “Add” button then browse and select your first file (could be DASH video or DASH audio file, not in particular order)
VLC: Open Media window

VLC: Open Media window

  • Check/click/activate “Show more options” checkbox
VLC: show more options checkbox

VLC: show more options checkbox

  • Check/click/activate “Play another media synchronously …” then click on “Browse…” button
VLC: play other media synchronously

VLC: play other media synchronously

  • A new empty “Open Media” window will be opened. Click “Add“, browse to your second files (either DASH audio or DASH video depended on your first opened file). Then click “Select” button (the button will become active/clickable after you choose your second file), this second “Open Media” window will be automatically closed.
VLS: a new empty "Open Media" window

VLS: a new empty “Open Media” window

  • Now, you’ll have the two files chosen and listed on the first “Open Media” window. You may click “Play” button.
VLC: two files is selected

VLC: two files is selected

VLC will play those two files synchronously, you may check it via VLC menu: Tools –> Codec Information, there will be two stream played together.

VLC playing DASH video and DASH audio at the same time

VLC playing DASH video and DASH audio at the same time

 

Downgrading ASUS Notebook BIOS

As I mentioned on my previous post about high CPU usage by audiodg.exe, I highly suspected that the culprit is because I upgrade my ASUS Notebook BIOS. So, here I’ll show you how to downgrade your Asus Notebook BIOS.

Asus Notebook has two way of upgrading/downgrading your BIOS. One way is using EasyFlash via BIOS boot screen and another way is using WinFlash utility. I’ll use WinFlash in this tips. Why? Because I can’t take BIOS boot menu screenshot 😛

WinFlash can be found on your Notebook CD driver companion or from Notebook Asus driver download page.

asus a43sv

Normally, WinFlash would not let you downgrade your BIOS. You’ll get warning and can’t click on “Flash” button. So, we need “unusual” way to start WinFlash utility

  • Make sure your Notebook battery is fully charged or connected to powerline.
  • Open Windows “Run” window by invoking Win+R. Type cmd there. It will open Windows command prompt.
windows run

run cmd

  • cd” to where you install WinFlash utility, usually on “C:\Program Files (x86)\ASUS\WinFlash
  • type this command: WinFlash.exe /nodate
  • See this screenshot for all above commands.
windows run asus winflash

How to run WinFlash via command line

  • The WinFlash window will be opened. Click OK
asus winflash from command line

WinFlash window opened via command line

asus winflash choose bios file

Choose downloaded BIOS file

  • You’ll still get warning about the BIOS you want to Flash is older than the currently installed. But, now you can click on “Flash” button.
asus winflash warning old BIOS

warning from WinFlash

  • Now click on “Flash” button. Flashing will start. After that, you can click on “Exit”. Windows will shutdown automatically.

There you have successfully downgraded your Asus Notebook BIOS!

Tested on: Windows 7 64bit, Notebook Asus A43SV, BIOS Revision 317 downgrading to Revision 314