GEPlugin does not load KML files on VB.NET - vb.net

I have developed an app using the GEPlugin located at https://code.google.com/p/winforms-geplugin-control-library/.
I use the GEWebBrowser and the GETreeView, and both works nicely.
I only load local kml files on the controls, so the way to do this, is to copy the "KML_Samples.kml" file into the webroot directory, and call the function as follows:
GeWebBrowser.FetchKml(http://localhost:8080/KML_Samples.kml)
Each time I call this method, the event GeWebBrowser_KmlLoaded is launched in the correct way.
However, I have checked lately that this works fine for the two or three first kml files loaded. After this two or three files, when I try to load a new kml file, I can see that the the KML_Samples.kml file has been updated, but the GeWebBrowser_KmlLoaded event IS NOT LAUNCHED!
I have tried to execute the app step by step setting a breakpoint on the line
GeWebBrowser.FetchKml(http://localhost:8080/KML_Samples.kml)
and in this case, I can load the kml files!!.
I have tried to execute some code after this line in order to execute all the pending events, with the following line:
Application.DoEvents()
However, this has not the expected result, and the trouble remains: I'm only able to load the two or three first kml files.
I wonder if something is missing by my side using this control, but I have not found anything on the documentation that could help me.
If anyone could help me with this issue, I would be very thankful .

I answer my own question.
I have detected the GEControl does not works fine with the built-in server. I can load local kml files by sopying them at webroot\KML_Samples.kml, but this only works for the first two or three files to be loaded.
For the following kml files, it doesn't work. I suppose there is some mistake inside the control, so I'm going to develop all the code that load the kml file into a TreeView (I'll try to use the KmlTreeView), and load all the separated points of each kml file into the plugin.

Related

Play sound with Oboe with .obb file

Hello sorry I'm begginer.
I don't have my sound files in my assets folder but in my .obb
I'm using the RythmGame sample who is using only assets folder.
I'm trying to use DataSound but only AAssetDataSource is used in my sample for create a DataSound.
I look at Asset and NDKExtractor for the decode function, but can only be use with an AAsset from an AssetManager...
How can I play sound from an .obb with Oboe ?
Can someone help me with that problem ?
Thanks
You should be able to do this by getting the path to your expansion file and passing that through JNI to your native code, opening it as a normal file object and passing the contents to the extractor.
You're right about the NDKExtractor::decode methods - they take an AAsset *, however it should be pretty easy to update them to take the file descriptor from your open file instead.

The location of .config for geotiler on Windows

I'm working in jupyter notebook on Windows with matplotlib basemaps and I want to use geotiler with the basemaps. I'm writing a program and as part of it, it will generate a map and plot data points on it. However, the maps that my code generates often are over a small part of the world and have no defining features. My solution was to import the geotiler library and display it over the map with an alpha so the maps generated would be identifiable. However, when I use the geotiler.Map() function, I get a message saying that the configuration file does not exist.
The code and the error message
How do I locate the .config folder on Windows, if it exists, and where should I create it if it doesn't? I already tried my user folder but that didn't seem to work. Thanks in advance.
Figured it out.
The read_config() method in the source code tries to get the HOME environment variable, which for Windows is blank, and appends the path for the config to that. Importing os and manually setting the HOME variable to wherever you placed your .config folder seems to do the trick. You can do this with os.environ['HOME'] = 'C:\Users\YourName'.

Monogame and .fx files?

I'm currently following this tutorial but using MonoGame :
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_from_file.php
As said in the tutorial, my main goal is to render a terrain from an image file.
There is a .fx provided with the tutorial which I included in my project.
I had some issues using MonoGame to load the bmp file for example and now I managed to load it. The problem comes now from the fx file. MonoDevelop tells this : The MGX File is Corrupt !
Here is the original code from the writer of the article :
effect = Content.Load<Effect> ("effects");
And here is how I used it with MonoGame :
effect = Content.Load<Effect> ("effects.fx");
I am really lost about the usage of the effects file in MonoGame. Is there any good tutorial about this ? Anyway I'm really lost with MonoGame. How come there is no clear tutorials for MonoGame has it is widely used ?
You need to convert your shader .fx to appropriate file format for monogame using 2MGFX tool. You can find the tool inside installed monogame directory C:\Program Files (x86)\MSBuild\MonoGame\v3.0
How to use:
Create a .bat file and write code as shown below:
2MGFX.exe effects.fx effects.mgfxo
pause
Execute the .bat file
Note that the shader file, .bat file and 2MGFX.exe must be in same directory.
Here is how to use compiled .mgfxo file as effect:
Put the effects.mgfxo into Assets\Content folder of your project
Load a file as shown below
Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("ProjectNameSpace.Assets.Content.effects.mgfxo");
BinaryReader Reader = new BinaryReader(s);
Effect effect = new Effect(graphics, Reader.ReadBytes((int)Reader.BaseStream.Length));
If you have problems converting a shader .fx to .mgfxo please leave comments.
I've been trying to follow Riemers tutorial myself, like you, I struggled with the effects.
I had to make a couple changes to the original effects file before I successfully managed to compile and use it without any exceptions.
Renamed the following:
vs_2_0 to vs_4_0
ps_2_0 to ps_4_0
POSITION to SV_POSITION
Once these changes were made I used the compile tool like following:
2MGFX.exe effects.fx effects.mgfxo /Profile:DirectX_11
Once compiled I moved the mgfxo file into my contents folder and assigned following parameters:
Build action: Embedded resource
Copy to output directory: Copy always
It took me a couple of attempts until I managed to use the shader without MonoGame throwing any exceptions at me.
byte[] bytes = File.ReadAllBytes("Content/effects.mgfxo");
effect = new Effect(GraphicsDevice, bytes);
Using the 2MGFX tool is optional, you can either use the tool or the Content pipeline, personally I prefer the Content pipeline because it will automatically process the shader file everytime I (re)build the Content project.
How to do this?
First: add a MonoGame Content project,
Then add the .FX file in this project
Set the Content processor to: "MonoGame effect content processor" in properties
Then, in your game project Add a Reference to this Content project.
And use the shader like so:
var myEffect = Content.Load<Effect>("shaderFileNameWithoutExtension");
or if you have folders in your content project:
var myEffect = Content.Load<Effect>("FolderName\\shaderFileNameWithoutExtension");
I'm seeing you're working on Linux. Compiling shaders on Linux is a little difficult. In my own projects, I find the following resource especially helpful.
http://www.infinitespace-studios.co.uk/general/monogame-building-fx-shaders-on-a-mac-and-linux/
Following this, you're able to build shaders using the MonoGame Pipeline as normal (provided you have added the pipeline reference).
Hope this helps!

ProcessingJS - loadImage() and loadStrings() path problem

I have a path problem when using loadImage() and loadStrings() in Processingjs. I would like to have my sketches and their associated files (images, text files) in one place and to be able to call them from another on my site.
For example, I am trying to run a Processingjs sketch located at
www.example.com/sketches/mysketch.pde from the page www.example.com. This works fine when there are no external files.
Alas the problem starts when I need to use loadImage() and loadStrings() to look for images and texts to load. It defaults to www.example.com/image.jpg and not to the sketch location, www.example.com/sketches/image.jpg.
The need for #pjs preload makes matters worse.
Without moving the files and without hardcoding, is there a way to
tell Processingjs to look for the files to load in the same folder as
the .pde and not the .html?
I hope this is clear. Any help would be appreciated!
Short answer: no.
Even native Processing won't behave the way you want in this sense, because you'll be executing your sketch from [...]/sketches/ and any resource call is local to that directory.
Similarly, with processing.js your resources are located relative to the "directory" you're in, which for www.example.com/ is just the base dir. What you can do, however, is place your .pde file in the same dir as your .html file, or vice versa.
#pjs preload is necessary to effect "immediate" file loading. If you don't preload it, your sketch will have to deal with asynchronous load instructions. Quite literally, loadImage without a preload directive behaves the same as requestImage (http://processing.org/reference/requestImage_.html)

Detecting corrupted jpg files before or during upload

I have an ASP application that uses ASPImage.Image to resize the uploaded image and then save the file to the server and save it in the database. However, it appears that if a user uploads a corrupted file the resulting image is blank white image.
I need a way to check if the file is corrupted before the image is passed to ASPImage.Image, that will then inform the user that the file is corrupted.
Can this be done with javascript, vbscript or ASPImage.Image itself?
Any assistance would be greatly appreciated.
Best Regards,
Paul Jacobs
There is no way to detect a corrupt image in either javascript or vbscript - you will need to try using ASPImage.Image directly.
It has an Error property, this will probably have an error detailing that a corrupt file has been loaded - did you try that? That is, if it is populated, chances are that the file was corrupt.
Additionally, the LoadImage method returns a boolean - I assume it will return false if the image couldn't be loaded due to corruption.
You can use the code here: http://forums.aspfree.com/code-bank-54/pure-asp-upload-script-with-additional-features-94647.html
Then check the image Width and Height - if 0 it means the uploaded file was not a valid image.
This is pure classic ASP code without third party components.