Search Results

Search found 247 results on 10 pages for 'bart burg'.

Page 8/10 | < Previous Page | 4 5 6 7 8 9 10  | Next Page >

  • How to build a C++ Dll wrapper that catches all exceptions?

    - by bart de vries
    Like the title says, we’re looking for a way to catch all exceptions from a piece of C++ code, and wrap this in a dll. This way we can shield of the application that uses this dll, from any errors occurring in this dll. However, this does not seem possible with C++ under Windows. Example: void function() { try { std::list<int>::iterator fd_it; fd_it++; } catch(...) {} } The exception that occurs is not caught by the standard C++ try/catch block, nor by any SEH translator function set by _set_se_translator(). Instead, the DLL crashes, and the program that uses the DLL is aborted. We compiled with Visual C++ 2005, with the option /SHa. Does anyone know if it’s possible in C++/Win32 to catch these kind of problems and make a rocksolid DLL wrapper?

    Read the article

  • iPhone: Problems releasing UIViewController in a multithreaded environment

    - by bart-simpson
    Hi! I have a UIViewController and in that controller, i am fetching an image from a URL source. The image is fetched in a separate thread after which the user-interface is updated on the main thread. This controller is displayed as a page in a UIScrollView parent which is implemented to release controllers that are not in view anymore. When the thread finishes fetching content before the UIViewController is released, everything works fine - but when the user scrolls to another page before the thread finishes, the controller is released and the only handle to the controller is owned by the thread making releaseCount of the controller equals to 1. Now, as soon as the thread drains NSAutoreleasePool, the controller gets releases because the releaseCount becomes 0. At this point, my application crashes and i get the following error message: bool _WebTryThreadLock(bool), 0x4d99c60: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now... The backtrace reveals that the application crashed on the call to [super dealloc] and it makes total sense because the dealloc function must have been triggered by the thread when the pool was drained. My question is, how i can overcome this error and release the controller without leaking memory? One solution that i tried was to call [self retain] before the pool is drained so that retainCount doesn't fall to zero and then using the following code to release controller in the main thread: [self performSelectorOnMainThread:@selector(autorelease) withObject:nil waitUntilDone:NO]; Unfortunately, this did not work out. Below is the function that is executed on a thread: - (void)thread_fetchContent { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSURL *imgURL = [NSURL URLWithString:@"http://www.domain.com/image.png"]; // UIImage *imgHotspot is declared as private - The image is retained // here and released as soon as it is assigned to UIImageView imgHotspot = [[[UIImage alloc] initWithData: [NSData dataWithContentsOfURL: imgURL]] retain]; if ([self retainCount] == 1) { [self retain]; // increment retain count ~ workaround [pool drain]; // drain pool // this doesn't work - i get the same error [self performSelectorOnMainThread:@selector(autorelease) withObject:nil waitUntilDone:NO]; } else { // show fetched image on the main thread - this works fine! [self performSelectorOnMainThread:@selector(showImage) withObject:nil waitUntilDone:NO]; [pool drain]; } } Please help! Thank you in advance.

    Read the article

  • Use a folder of xml files as data source for nhibernate

    - by Bart Van Eyndhoven
    I'm going to start writing NUnit tests for a few classes in my project. A certain number of these classes use data gathered through nhibernate from a sql server 2008 database. The part of the program I'm about to test is very specific (and complicated). Therefore I have made a folder of xml files. Combined, the xml files could result in the database structure. I mean each xml file corresponds to a table in the database. The data in the xml files is also consistent with the database. Is there a way to use this folder of xml files as data source for nhibernate? I mean: can I use nhibernate to gather my test data (wich I have specifically chosen) instead of data from the database? In this way, I could usefully test this component without corrrupting the (test) database for future tests.

    Read the article

  • Get coordinates in parent, but not in stage.

    - by Bart van Heukelom
    I know about Flash's localToGlobal and globalToLocal methods to transform coordinates from the local system to the global system, but is there a way to achieve the intermediate? To transform coordinates from an arbitrary system to any other arbitrary system? I have a clickable object inside a Sprite, and the Sprite is a child of the stage. I want to retrieve the clicked point in the Sprite.

    Read the article

  • Adding dlls in VS 2008

    - by Bart
    Hello, i would like to add some external .dll libraries e.g. glut32.dll (but it's only example) in vs 2008 using C#. Can you please tell me what should i do step by step? i am a little bit confused cause i found a lot of solutions to add dll files but they significantly differ.. some of them add dll's only using code, some using properties in vs, add references and in other tutorials there is about registering dlls in system. But how to put it all together? Regards!

    Read the article

  • Flash doesn't connect to socket even though policy allows it

    - by Bart van Heukelom
    In my Flash app, I'm connecting to my server like this: Security.loadPolicyFile("xmlsocket://example.com:12860"); socket = new Socket("example.com", 12869); socket.writeByte(...); ... socket.flush(); At port 12860 I'm running a socket policy server, which (according to this document) correctly serves up my policy like this: 00000000 3c 70 6f 6c 69 63 79 2d 66 69 6c 65 2d 72 65 71 <policy- file-req 00000010 75 65 73 74 2f 3e 00 uest/>. 00000000 3c 63 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f <cross-d omain-po 00000010 6c 69 63 79 3e 3c 73 69 74 65 2d 63 6f 6e 74 72 licy><si te-contr 00000020 6f 6c 20 70 65 72 6d 69 74 74 65 64 2d 63 72 6f ol permi tted-cro 00000030 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f 6c 69 63 69 ss-domai n-polici 00000040 65 73 3d 22 6d 61 73 74 65 72 2d 6f 6e 6c 79 22 es="mast er-only" 00000050 20 2f 3e 3c 61 6c 6c 6f 77 2d 61 63 63 65 73 73 /><allo w-access 00000060 2d 66 72 6f 6d 20 64 6f 6d 61 69 6e 3d 22 2a 22 -from do main="*" 00000070 20 74 6f 2d 70 6f 72 74 73 3d 22 31 32 38 36 39 to-port s="12869 00000080 22 20 2f 3e 3c 2f 63 72 6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma 00000090 69 6e 2d 70 6f 6c 69 63 79 3e 00 in-polic y>. I get no security warnings, which I used to get before the policy server was in place. Still, the connection to port 12869 doesn't work. It's made (I can see with Wireshark and on the server), but no data is sent by Flash. It might be worth knowing that the SWF itself is served from example.com as well.

    Read the article

  • C# - retrieve file path from config file - @ doesn't do it's magic

    - by Bart
    Hi guys, I'm currently working on a web service that retrieves an XML message, archives it and then processes it further. The archive folder is read from the Web.config. This is what the archive method looks like private void Archive(System.Xml.XmlDocument xmlDocument) { try { string directory = System.Configuration.ConfigurationManager.AppSettings.Get("ArchivePath"); ParseMessage(xmlDocument); directory = string.Format(@"{0}\{1}\{2}", @directory, _senderService, DateTime.Now.ToString("MMMyyyy")); System.IO.Directory.CreateDirectory(directory); string Id = _messageID; string senderService = _senderService; xmlDocument.Save(directory + @"\" + DateTime.Now.ToString("yyyyMMdd_") + Id + "_" + System.Guid.NewGuid().ToString().Substring(0, 13) + ".xml"); } The path structure I retrieve is C:\Program Files\Subfolder\Subfolder. In the development, QA, UAT and PRD environments everything works fine. But on another machine I now need to install the web service on (which I cannot debug, unfortunately), the directory string is 'C:Files'. Just to be sure I double checked the .NET version on the different machines (I thought perhaps the usage of @ before a string was version-dependent); all machines use 2.0.50727. Does anyone recognize this problem? Thanks in advance!

    Read the article

  • A* algorithm works OK, but not perfectly. What's wrong?

    - by Bart van Heukelom
    This is my grid of nodes: I'm moving an object around on it using the A* pathfinding algorithm. It generally works OK, but it sometimes acts wrongly: When moving from 3 to 1, it correctly goes via 2. When going from 1 to 3 however, it goes via 4. When moving between 3 and 5, it goes via 4 in either direction instead of the shorter way via 6 What can be wrong? Here's my code (AS3): public static function getPath(from:Point, to:Point, grid:NodeGrid):PointLine { // get target node var target:NodeGridNode = grid.getClosestNodeObj(to.x, to.y); var backtrace:Map = new Map(); var openList:LinkedSet = new LinkedSet(); var closedList:LinkedSet = new LinkedSet(); // begin with first node openList.add(grid.getClosestNodeObj(from.x, from.y)); // start A* var curNode:NodeGridNode; while (openList.size != 0) { // pick a new current node if (openList.size == 1) { curNode = NodeGridNode(openList.first); } else { // find cheapest node in open list var minScore:Number = Number.MAX_VALUE; var minNext:NodeGridNode; openList.iterate(function(next:NodeGridNode, i:int):int { var score:Number = curNode.distanceTo(next) + next.distanceTo(target); if (score < minScore) { minScore = score; minNext = next; return LinkedSet.BREAK; } return 0; }); curNode = minNext; } // have not reached if (curNode == target) break; else { // move to closed openList.remove(curNode); closedList.add(curNode); // put connected nodes on open list for each (var adjNode:NodeGridNode in curNode.connects) { if (!openList.contains(adjNode) && !closedList.contains(adjNode)) { openList.add(adjNode); backtrace.put(adjNode, curNode); } } } } // make path var pathPoints:Vector.<Point> = new Vector.<Point>(); pathPoints.push(to); while(curNode != null) { pathPoints.unshift(curNode.location); curNode = backtrace.read(curNode); } pathPoints.unshift(from); return new PointLine(pathPoints); } NodeGridNode::distanceTo() public function distanceTo(o:NodeGridNode):Number { var dx:Number = location.x - o.location.x; var dy:Number = location.y - o.location.y; return Math.sqrt(dx*dx + dy*dy); }

    Read the article

  • Attributes in XML subtree that belong to the parent

    - by Bart van Heukelom
    Say I have this XML <doc:document> <objects> <circle radius="10" doc:colour="red" /> <circle radius="20" doc:colour="blue" /> </objects> </doc:document> And this is how it is parsed (pseudo code): // class DocumentParser public Document parse(Element edoc) { doc = new Document(); doc.objects = ObjectsParser.parse(edoc.getChild("objects")); for ( ...?... ) { doc.objectColours.put(object, colour); } return doc; } ObjectsParser is responsible for parsing the objects bit, but is not and should not be aware of the existence of documents. However, in Document colours are associated with objects by use of a Map. What kind of pattern would you recommend to give the colour settings back to DocumentParser.parse from ObjectsParser.parse so it can associate it with the objects they belong to in a map? The alternative would be something like this: <doc:document> <objects> <circle id="1938" radius="10" /> <circle id="6398" radius="20" /> </objects> <doc:objectViewSettings> <doc:objectViewSetting object="1938" colour="red" /> <doc:objectViewSetting object="6398" colour="blue" /> </doc:objectViewSettings> </doc:document> Ugly!

    Read the article

  • automaticaly place downloaded files in folder bsed on downloads extention sufix

    - by Bart van Tuÿl
    I’m making a simple web browser for work eeh, what I’d like to know is if its possible to save a file of a particular extension to a particular file. I currently use googels chrome when downloading a file it places this (regardless of extension) in a downloads folder without asking where I ant to download this too. I want to achieve the same except that downloads with the extension .dwg are placed automatically in a folder named DWG DOWNLAODS… Dose anybody know how to achieve this in vb.net?

    Read the article

  • Components don't show in custom JPanel/JComponent

    - by Bart van Heukelom
    I've created a custom swing component. I can see it (the grid from the paint method is drawn), but the buttons that are added (verified by println) aren't shown. What am I doing wrong? Background information: I'm trying to build a tree of visible objects like the Flash/AS3 display list. public class MapPanel extends JComponent { // or extends JPanel, same effect private static final long serialVersionUID = 4844990579260312742L; public MapPanel(ShapeMap map) { setBackground(Color.LIGHT_GRAY); setPreferredSize(new Dimension(1000,1000)); setLayout(null); for (Layer l : map.getLayers()) { // LayerView layerView = new LayerView(l); // add(layerView); System.out.println(l); JButton test = new JButton(l.getName()); add(test); validate(); } } @Override protected void paintComponent(Graphics g) { // necessary? super.paintComponent(g); // background g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); // grid g.setColor(Color.GRAY); for (double x = 0; x < getWidth(); x += 10) { g.drawLine((int)x, 0, (int)x, getHeight()); } for (double y = 0; y < getHeight(); y += 10) { g.drawLine(0, (int)y, getWidth(), (int)y); } } }

    Read the article

  • How to write a custom (odd) authentication plugins for Wordpress, Joomla and MediaWiki

    - by Bart van Heukelom
    On our network (a group of related websites - not a LAN) we have a common authentication system which works like this: On a network site ("consumer") the user clicks on a login link This redirects the user to a login page on our auth system ("RAS"). Upon successful login the user is directed back to the consumer site. Extra data is passed in the query string. This extra data does not include any information about the user yet. The consumer site's backend contacts RAS to get the information about the logged in user. So as you can see, the consumer site knows nothing about the authentication method. It doesn't know if it's by username/password, fingerprint, smartcard, or winning a game of poker. This is the main problem I'm encountering when trying to find out how I could write custom authentication plugins for these packages, acting as consumer sites: Wordpress Joomla MediaWiki For example Joomla offers a pretty simple auth plugin system, but it depends on a username/password entered on the Joomla site. Any hints on where to start?

    Read the article

  • Incompatible classes when loading SWF

    - by Bart van Heukelom
    I have two ActionScript 3 projects, game(.swf) and minigame(.swf). At runtime the main game loads the minigame via Loader. I also have a shared library (SWC) of event classes, included by both, which minigame will need to dispatch and game will need to listen to. First: Is this possible this way? Second: What will happen if I compile the minigame, then change the event classes so they're incompatible, then compile the main game. Will Flash crash when trying to load the minigame SWF? (I hope so) Third: And what will happen if I change the event classes, but in a way that preserves interface-level compatibility?

    Read the article

  • Java respawn process

    - by Bart van Heukelom
    I'm making an editor-like program. If the user chooses File-Open in the main window I want to start a new copy of the editor process with the chosen filename as an argument. However, for that I need to know what command was used to start the first process: java -jar myapp.jar blabalsomearguments // --- need this information Open File (fileUrl) exec("java -jar myapp.jar blabalsomearguments fileUrl"); I'm not looking for an in-process solution, I've already implemented that. I'd like to have the benefits that seperate processes bring.

    Read the article

  • Building a system that allows users to see a video only once

    - by Bart van Heukelom
    My client wants to distribute a video to some people, specifically car dealers, but he doesn't want the video to end up on Youtube or something like that. Therefore he wants the recipients of the video to be able to see it only once. My idea to implement this is: Generate a unique key per viewer Send each viewer a link to a page with a Flash based video player, with their key in the URL Have Flash get the video from the server. On the server the key is checked and the file sent (using php's readfile or something equivalent). Then the key is invalidated. I was thinking this wouldn't take more than a day to build. I know that if you want somebody to be able to play something, you implicitly give them the power to record it as well, but the client just wants me to make it as hard as possible. Do you think this is secure enough for the intended audience? Anything else I can do to add some security without exceeding the development time of 1 day? I'm also interested in ready made solutions, if they exist.

    Read the article

  • Make Java parent class not part of the interface

    - by Bart van Heukelom
    (This is a hypothetical question for discussion, I have no actual problem). Say that I'm making an implementation of SortedSet by extending LinkedHashMap: class LinkedHashSortedMapThing extends LinkedHashMap implements SortedSet { ... } Now programmers who use this class may do LinkedHashMap x = new LinkedHashSortedMapThing(); But what if I consider the extending of LinkedHashMap an implementation detail, and do not want it to be a part of the class' contract? If people use the line above, I can no longer freely change this detail without worrying about breaking existing code. Is there any way to prevent this sort of thing, other than favouring composition over inheritance (which is not always possible due to private/protected members)?

    Read the article

  • Returning a static array without using a class field

    - by Bart Friederichs
    I have the following base and derived (partial, for sake of brevity) classes: class Base { public abstract int[] someArray { get; } } class Derived : Base { private readonly static int[] _someArray = new int[] { 1,2,3,4 }; public override int[] someArray { get { return _someArray; } } } What I would like now, is put the new int[] { 1,2,3,4 } in the return part of the getter. But, that would create a new array every time the getter is called. Is it possible to directly return some kind of object, which stays the same for all objects of class Derived ? Something along the lines of (I know this is invalid C#): get { return (int[]) { 1, 2, 3, 4 }; }

    Read the article

  • Creating a multiplatform webapp with HTML5 and Google maps

    - by Bart L.
    I'm struggling how to develop a webapp for Android and iOS. My first app was a simple todo app which was easy to test in my browser and it only used html, javascript and css. However, I have to create an app which uses Google Maps Api to get the location. I created a simple html5 page to test which places a marker on a map. It works fine when testing it on my local server. But when I create an .apk file for Android, the app doesn't work. So I'm wondering, isn't it possible to use it like this? Do I have the use the phonegap libraries to use their geolocation library? And if so, how do you handle the development of a webapp in phonegap for multiple OS? Do you have to install an Android environment and an iOS environment to each include the right phonegap library and to test them properly? Update: I use the following code on my webserver and it works perfectly. When I upload it in a zip-folder to the photogap cloud and install the APK file on my phone, it doesn't work. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Simple Geo test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> </head> <body> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script> function success(position) { var mapcanvas = document.createElement('div'); mapcanvas.id = 'mapcontainer'; mapcanvas.style.height = '200px'; mapcanvas.style.width = '200px'; document.querySelector('article').appendChild(mapcanvas); var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); var options = { zoom: 15, center: coords, mapTypeControl: false, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL }, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("mapcontainer"), options); var marker = new google.maps.Marker({ position: coords, map: map, title:"You are here!" }); } if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success); } else { error('Geo Location is not supported'); } </script> <article></article> </body> </html>

    Read the article

< Previous Page | 4 5 6 7 8 9 10  | Next Page >