OMNET++ tk-gui wrong icon placement - tk-toolkit

I am working with Artery / VEINS (I do not think this matters) and SUMO and OMNET++ :)
As you can see, my OMNET TK-GUI is no longer showing my network correctly, all icons are in the same place!
The World.ned
TK-GUI showing wrong
Two days ago, this was not happening, I could see the vehicles moving around the OMNET TK-GUI.
So, what have I done? I installed the new NVIDIA driver but I do not think this affects.
Any suggestion? :) Have a really nice day!

This is a known issue in Tkenv. For some reason the zoom level gets reset to 0.00x from time to time. Just zoom in (press and hold Ctrl+M) until the network gets magnified to a reasonable size.
Also, please note that Tkenv is getting retired in newer versions of OMNeT++, in favor of the more modern Qtenv interface.

Related

PIC32 becomes unresponsive after a few hours

I have a PIC32MX340F512 board developed by another company for us, The board has a DS1338 RTCC and 24LC32A eeprom, and display unit on an I2C bus, on this bus i included a TSL2561 I2C light sensor, i wrote code in c to poll the light sensor continously , when the light sensor reaches a certain level i save the time and date and light sensor value on SD card. This all works fine but if i leave the system without exposure to light inside tunnel where incident light on one end of the tunnel is ought to be monitored the system becomes unresponsive no matter how much amount of light you apply and then if i switch power off and back on again everything starts to work normal. i am a one man development team and have been trying to find out the problem for months, i activated the watchdog timer to prevent the system from hanging but the problem still persisted. i then decided to find out if the problem is with the sensor by including a push button to activate light measurement but still when 4-5 hours elapse the PIC cant even detect a change in the the input pin. Under the impression that a hardware reset overrides anything going on i included a reset button and it also works ok for the first few hours after that the PIC doesn't seem to be responding to anything including a reset. I was getting convinced that there is nothing wrong with the firmware but also with all this happening the display unit (pic16f1933 and lcd) on the I2C shares power with the main unit and doesn't seem to be affected as it alternates between different messages constantly Does anybody have an idea what could be wrong (hardware/firmware or my sensor). I am using a 24v DC power supply purchased seperately. The PIC seems to go into a deep sleep although i dd not implement any kind of SLEEP mode in my code. Nb We use the same board for many other projects and i haven't come across such a problem . Thanks in advance.
I think you need to (if you haven't already) explore the wonderful world of in-circuit-debugging (such as with the ICD3 or PICkit 2/3). It allows you to run the processor in a special mode that lets you pause execution, see exactly which line of code is being executed, inspect variable values, and step through the code to see which parts are running and not running, or see exactly where execution takes a wrong turn. If the problem takes hours to reproduce, that's okay. You can just leave it overnight running in debug mode and hopefully it will be locked-up or 'sleeping' in the morning. At this point, you will be able to pause the processor and poke around to see if you got caught in some kind of infinite loop or something. This is often the only way to dig inside a running piece of code to see why things aren't working as you expect. But as you say, those bugs that take hours or days to manifest are the trickiest. Good luck!
It sounds like you can break up your design into two main parts, sd card interfacing, reading the rtc and reading the light sensor. If it were me I would upload a version of the code that mimics reading the light sensor but only returns fake data and see if that cures the problem. Additionally do the same with the other two modules separately and see if any of the three versions of your project not show this problem. From there just keep narrowing it down until you find the block of code thats causing problems.
if Two or more versions of your debug code show the same problem then my guess is it has to do with one of the communication protocols. I had a problem with a Pic32 silicon version blocking when using the DMA in conjunction with the SPI peripherals. So I would suggest checking the errata for your chip.
If you still cant find the problem, my only suggestion would be to check for memory leaks or arrays that are growing into reserved memory.
Hope that helps, good luck!

Firefox OS device gps

I'm currently searching a way for device using firefox OS to communicate with device's gps, so it can get the exact location positioning, rather than the w3c geolocation api which is not as accurate as gps realtime.. Thanks!
Simple answer: it isn't possible to access the "device's GPS" directly. You only have the Geolocation API that you already know.
Long answer: My experience with it is not bad at all. So, I think only of two possibilities for not getting "exact location positioning", as you name it:
maybe you're not using the right options to get a precise position. In this case, you could tweak your options a bit to get better results;
maybe you're not waiting until the underlying software can use your GPS instead of some less accurate instrument/estimation (like Wi-Fi positioning estimation).
It can be a combination of both =P
In the first case, you can verify if you're using enableHighAccuracy, like this:
navigator.geolocation.watchPosition(
successCallback,
errorCallback,
{ enableHighAccuracy: true }
);
This will ask the browser for better results, as the standard indicates. Watch out that this may use more battery, and this may not be available anyway. This may take more time too, which is related to my other observation.
In the second case, you may be using a value for timeout that is too small, and maybe it's combined with a maximumAge that may be too high.
If maximumAge is high and timeout is small, you get an out dated position, as there won't be enough time to get a new position and you accept an old one.
If both are small, you'll start to get lots of TIMEOUT errors (the value is 3), as there'll be no positions for you.
You need to find the right balance between all 3 options to get the best positions. And you have to be patient sometimes.
Play with all 3 options and take a look at the errors you get. They'll tell you a lot about your issue getting precise and accurate coordinates.
The position object has some attributes that may come in handy to analyze what's happaning:
the position.timestamp attribute will tell you how old that position object is. If this is old, you know you should tweak the options
the position.coords.accuracy attribute will tell you the accuracy level of the lat/long coordinates. If this is too big (it's in meters), you know you should tweak the options
If you wait forever, on a place where the GPS should work well (say, outdoors, on a clean field), and you keep getting inaccurate results, maybe you can't do much better anyway. I'd say it's not possible anyway, with your software+hardware =(
As of now, Firefox OS only has support for GPS positioning (with the latest addition of A-GPS in the mix). That results in the fact, that most of the time you will have to wait from 1 to several minutes at least for the GPS module to acquire lock on your location, and you will need clear look at the sky for the lock to be acquired.
That said, after a lock is acquired, by using the right settings in the call itself (like setting the enableHighAccuracy flag to true) the GPS should provide as accurate position as any other device would.
Right now cell-based and wifi-based geolocation is not available in the current version of the OS (1.0.1 or 1.1.0, either) but is in the pipeline.
You can use the Geolocation API Firefox OS or Google Maps (I do not remember where I got it)

FMX Direct 2D Issue

Good afternoon all!
I'm experiencing a rather annoying issue with one of my current projects. I'm working with a hardware library (NVAPI Pascal header translation by Andreas Hausladen) in one of my current projects. This lib allows me to retrieve information from an NVIDIA GPU. I'm using it to retrieve temperatures, and with the help of Firemonkey's TAnimateFloat, i'm adjusting the angle on a custom-made dial to indicate the temperature.
As FMX defaults to Direct 2D on Windows, i can monitor the FPS with any of the various "gamer" tools out there (MSI Afterburner, FRAPS, etc).
The issue i'm having is that when i put the system into sleep mode (suspend to RAM/S3), and then start it up again, the interface on my application is blacked out (partially or completely), and nothing on the UI is visibly refreshing. I'm calling the initialization for the NVAPI library regularly and checking the result via a timer, but this doesn't fix the issue. I'm also running ProcessMessages and repaint on the parent dial and it's children controls (since i can't seem to find a repaint for the form or even an equivalent).
I tried various versions of the library, and each one presents the same issue. The next paragraph indicates that this was in fact NOT the issue, and that it's actually the renderer at fault.
I have one solution, but i want to know if there's something more... elegant, available. The solution i have involves adding FMX.Types.GlobalUseDirect2D := False; before Application.Initialize in my projects source. However, this forces FMX to use GDI+ rather than Direct2D. It works of course, but i'd like to keep D2D open as an option if i can. I can use FindCmdLineSwitch to toggle this on/off dependant on parameters, but this still requires me to restart the application to change from D2D to GDI+ or vice-versa.
What's weird about it is that the FPS counter (from FRAPS in my case) indicates that there's still activity happening in the UI (as the value changes as would be expected), but the UI itself isn't visibly refreshing.
Is this an issue related to Direct2D, or a bug with Firemonkey's implementation? More importantly, is there a better method to fixing it than disabling D2D? Lastly, also related, is it possible to "reinitialize" an application without terminating it first (so perhaps i can allow the user to switch between GDI+ and D2D without needing to restart the application)?
This is may be of the issues with FM prior to the update 4 hotfix - 26664/QC 104210
Fixes the issue of a FireMonkey HD form being unresponsive after user unlock - installing this might resolve the issue for you.
The update should be part of your registered user downloads from the EDN (direct link http://cc.embarcadero.com/item/28881).

OpenAL randomly stops playing some sounds, can only fix with reboot

THE APPS: Two Cocos2d universal iOS games with a large customer base.
THE PROBLEM: Several months back (in 2011) reports started coming in, sounds would randomly cut out, only some of the sounds would play in the app, others wouldn’t. This problem can ONLY be fixed by a device reboot.
IMPORTANT NOTES & DETAILS:
The SAME code and SAME sound files played fine for over a year with
NO bug reports of this sort. I wish I could pinpoint a date, but I
believe the problem started with an iOS update.
The bug is incredibly hard to reproduce. I have personally seen it
once, but I have had no luck causing it again. Yet we get 1-2
support emails a day with the same issue, some of which come in the
form a bad reviews. If I had to pull a number out of the air, I’d
guess we’re looking at a 1 in 1000 incidence. It seems maybe more
common on the iPad, but I’m not sure.
Restarting the device is the ONLY way to fix the problem.
Restarting the app does nothing, deleting the app and reinstalling
does nothing, has to be a power down and turn back on.
A few weeks ago in an attempt to blindly fix I dumped the Cocos2d
Sound engine and switched one of the apps over to ObjectAL (another
openAL based sound engine), hoping it might have fixed the problem.
It did not, same issue is occurring. As you'd note, both of these
are just interfaces for OpenAL.
The sound files themselves were converted from wavs to cafs using
Apple’s recommend method (
https://developer.apple.com/library/ios/#codinghowtos/AudioAndVideo/_index.html
), although we also used the -c 1 flag to make them single channel.
Just to be clear, the bug has nothing to do with the usual sound
issues (mute switch, volume). A portion of the sounds continue
playing fine, but they will never all play again until the device is
powered down and restarted.
If anyone has any ideas I’d all, I’d be very grateful for the help. I’m at wits end here trying to fix a persistent bug I can’t recreate and that appears to be caused by something outside my control.
I've had similar problems with OpenAL, as the commenters stated. We had spurious problems on different hardware and on different OS releases. Really, it was nearly impossible to reproduce. The only reason we even found out about the problem was the significant percentage of users who experienced crashes or other severe audio problems. We tried for months trying to make it work, but in the end the stability problems we experienced just weren't manageable. We ended up going with another library and took OpenAL completely out of the picture. I certainly would not recommend it for new projects.

Delphi, TPopupMenuItems behaving strangely after the application is idle for a long time

I have a problem I cannot solve. Of course here I just expect to have a suggestion that can help me to find a solution.
Basically my application is full of runtime generated TPopupMenuItems (while all the TPopupMenus are hardcoded). In some cases what I do is simply hide/show or enable/disable items, in other cases I create items at runtime.
In some machines only, after leaving the application running for days (2 or more) the popupmenus don't work anymore correctly.
The behaviour is:
all the TPopupmenu items look are the same, and execute the same action.
The action is the one performed by the first TPopupMenuItem of the application (the first generated at runtime when the application starts, this is the only hint I have).
Imagine in correct scenario I have (in a 3-items-TPopupMenu):
Item23
Item24
Item25
after the problem I see:
Item1
Item1
Item1
(where Item1 is the TPopupMenuItem belonging to another TPopupMenu).
Does this tell you something?
Thanks.
Update:
I tried to look at the code of my popupmenus and I found what could be a common cause, and this explains also why FastMM4 didn't find this:
while mnuItem.Count > 0 do
mnuItem.Delete(0);
Delete (I just read in the documentation) doesn't free the item, I should call free instead. Anyway when closing the application the main popupmenus are freed correctly, and FastMM4 doesn't complain. So this is probably the solution, now I don't know why Delete was used, I didn't write that code.
Further update:
I tried to make a sample application, I couldn't reproduce the problem, but for sure I noticed that using this is much more performant (I tried a loop with 10000 recursions):
while mnuItem.Count > 0 do
mnuItem.Items[0].Free;
I will try for this in my app (but I need to let some days pass to really know if I got the problem, ayway for sure this is a major improvement anyway).
I confirm that the problem was linked to Delete instead of Free. Popupmenu wsa refreshed every minute on the machines that had the problem (so it was not OS or HW specific, just config specific). Then according to user settings the menu could have 10 to 100 items, so leaving it idle for days made it possible to hit the handle limit.
By the way it also makes no sense to refresh the popupmenu in that way, so I found also an optimizaion removed a bug.
Did you check for memory leakage and handles that aren't freed?

Resources