Search Results

Search found 57 results on 3 pages for 'seb nilsson'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • How to diff two regions of the same file in Eclipse

    - by Thomas Nilsson
    I'm a TDDer and often have a need to refactor out common or similar code. If it is exactly the same there is no big problem, Eclipse can almost always do that by itself. But to get there I'm finding myself often looking at similar, but not identical, code fragments in the same, or even different, files. It would be very handy if there was a possibility to mark two regions and get Eclipse (or some other tool) to mark the differences. With this information it would be much simpler to iteratively move the regions closer until they are the same and then activate the Extract Method refactoring. It can be done in Emacs of course, but I'd like to have this readily available from Eclipse. Any pointers?

    Read the article

  • Name the pattern - Create, Set, Execute, Destroy?

    - by Seb Nilsson
    I somewhere heard that the .NET Framework was built around specific pattern, which they tried to uphold as much as possible. var rsa = new RSACryptoServiceProvider(); // Create rsa.ImportParameters(GetParameters()); // Set byte[] encrypted = rsa.Encrypt(data, true); // Execute // Destroyed by garbage-collector Are there any variants of this? What are the general pros and cons?

    Read the article

  • opencv fails to open avi with ffdshow codec

    - by Seb
    Hey everyone, I am currently using OpenCV to try and open an AVI file that was made using ffdshow. The program manages to open the video file and play however, the video file is in black and white and is slightly skewed. VLC and windows media player can run it fine. Is there anything that I am able to do to install the ffdshow codec into OpenCV or do I have to covert each file with ffdshow used into appropriate OpenCV codec formats? Thank you in advance for your help.

    Read the article

  • Ruby Regexp: + vs *. special behaviour?

    - by seb
    Using ruby regexp I get the following results: >> 'foobar'[/o+/] => "oo" >> 'foobar'[/o*/] => "" But: >> 'foobar'[/fo+/] => "foo" >> 'foobar'[/fo*/] => "foo" The documentation says: *: zero or more repetitions of the preceding +: one or more repetitions of the preceding So i expect that 'foobar'[/o*/] returns the same result as 'foobar'[/o+/] Does anybody have an explanation for that

    Read the article

  • "Could not register destruction callback" warn message leads to memory leaks?

    - by Séb
    Hello all, I'm in the exact same situation as this old question: http://stackoverflow.com/questions/2077558/warn-could-not-register-destruction-callback In short: I see a warning saying that a destruction callback could not be registered for some beans. My question is: since the beans whose destruction callback cannot be registered are two persistance beans, could this be the source of a memory leak? I am experiencing a leak in my app. Although the session timeout is set (to 30 minutes), my profiler shows me more instances of the hibernate SessionImpl each time I run a thread dump. The number of instances of SessionImpl is exactly the number of times I tried to login between two thread dumps. Thanks for your help...

    Read the article

  • Activator.CreateInstance(Type) for a type without parameterless constructor

    - by Seb
    Reading existing code at work, I wondered how come this could work. I have a class defined in an assembly : [Serializable] public class A { private readonly string _name; private A(string name) { _name = name; } } And in another assembly : public void f(Type t) { object o = Activator.CreateInstance(t); } and that simple call f(typeof(A)) I expected an exception about the lack of a parameterless constructor because AFAIK, if a ctor is declared, the compiler isn't supposed to generate the default public parameterless constructor. This code runs under .NET 2.0.

    Read the article

  • Fast multi-window rendering with C#

    - by seb
    I've been searching and testing different kind of rendering libraries for C# days for many weeks now. So far I haven't found a single library that works well on multi-windowed rendering setups. The requirement is to be able to run the program on 12+ monitor setups (financial charting) without latencies on a fast computer. Each window needs to update multiple times every second. While doing this CPU needs to do lots of intensive and time critical tasks so some of the burden has to be shifted to GPUs. That's where hardware rendering steps in, in another words DirectX or OpenGL. I have tried GDI+ with windows forms and figured it's way too slow for my needs. I have tried OpenGL via OpenTK (on windows forms control) which seemed decently quick (I still have some tests to run on it) but painfully difficult to get working properly (hard to find/program good text rendering libraries). Recently I tried DirectX9, DirectX10 and Direct2D with Windows forms via SharpDX. I tried a separate device for each window and a single device/multiple swap chains approaches. All of these resulted in very poor performance on multiple windows. For example if I set target FPS to 20 and open 4 full screen windows on different monitors the whole operating system starts lagging very badly. Rendering is simply clearing the screen to black, no primitives rendered. CPU usage on this test was about 0% and GPU usage about 10%, I don't understand what is the bottleneck here? My development computer is very fast, i7 2700k, AMD HD7900, 16GB ram so the tests should definitely run on this one. In comparison I did some DirectX9 tests on C++/Win32 API one device/multiple swap chains and I could open 100 windows spread all over the 4-monitor workspace (with 3d teapot rotating on them) and still had perfectly responsible operating system (fps was dropping of course on the rendering windows quite badly to around 5 which is what I would expect running 100 simultaneous renderings). Does anyone know any good ways to do multi-windowed rendering on C# or am I forced to re-write my program in C++ to get that performance (major pain)? I guess I'm giving OpenGL another shot before I go the C++ route... I'll report any findings here. Test methods for reference: For C# DirectX one-device multiple swapchain test I used the method from this excellent answer: Display Different images per monitor directX 10 Direct3D10 version: I created the d3d10device and DXGIFactory like this: D3DDev = new SharpDX.Direct3D10.Device(SharpDX.Direct3D10.DriverType.Hardware, SharpDX.Direct3D10.DeviceCreationFlags.None); DXGIFac = new SharpDX.DXGI.Factory(); Then initialized the rendering windows like this: var scd = new SwapChainDescription(); scd.BufferCount = 1; scd.ModeDescription = new ModeDescription(control.Width, control.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm); scd.IsWindowed = true; scd.OutputHandle = control.Handle; scd.SampleDescription = new SampleDescription(1, 0); scd.SwapEffect = SwapEffect.Discard; scd.Usage = Usage.RenderTargetOutput; SC = new SwapChain(Parent.DXGIFac, Parent.D3DDev, scd); var backBuffer = Texture2D.FromSwapChain<Texture2D>(SC, 0); _rt = new RenderTargetView(Parent.D3DDev, backBuffer); Drawing command executed on each rendering iteration is simply: Parent.D3DDev.ClearRenderTargetView(_rt, new Color4(0, 0, 0, 0)); SC.Present(0, SharpDX.DXGI.PresentFlags.None); DirectX9 version is very similar: Device initialization: PresentParameters par = new PresentParameters(); par.PresentationInterval = PresentInterval.Immediate; par.Windowed = true; par.SwapEffect = SharpDX.Direct3D9.SwapEffect.Discard; par.PresentationInterval = PresentInterval.Immediate; par.AutoDepthStencilFormat = SharpDX.Direct3D9.Format.D16; par.EnableAutoDepthStencil = true; par.BackBufferFormat = SharpDX.Direct3D9.Format.X8R8G8B8; // firsthandle is the handle of first rendering window D3DDev = new SharpDX.Direct3D9.Device(new Direct3D(), 0, DeviceType.Hardware, firsthandle, CreateFlags.SoftwareVertexProcessing, par); Rendering window initialization: if (parent.D3DDev.SwapChainCount == 0) { SC = parent.D3DDev.GetSwapChain(0); } else { PresentParameters pp = new PresentParameters(); pp.Windowed = true; pp.SwapEffect = SharpDX.Direct3D9.SwapEffect.Discard; pp.BackBufferFormat = SharpDX.Direct3D9.Format.X8R8G8B8; pp.EnableAutoDepthStencil = true; pp.AutoDepthStencilFormat = SharpDX.Direct3D9.Format.D16; pp.PresentationInterval = PresentInterval.Immediate; SC = new SharpDX.Direct3D9.SwapChain(parent.D3DDev, pp); } Code for drawing loop: SharpDX.Direct3D9.Surface bb = SC.GetBackBuffer(0); Parent.D3DDev.SetRenderTarget(0, bb); Parent.D3DDev.Clear(ClearFlags.Target, Color.Black, 1f, 0); SC.Present(Present.None, new SharpDX.Rectangle(), new SharpDX.Rectangle(), HWND); bb.Dispose(); C++ DirectX9/Win32 API test with multiple swapchains and one device code is here: http://pastebin.com/tjnRvATJ It's a modified version from Kevin Harris's nice example code.

    Read the article

  • Post microphone input from Flash to server

    - by Seb
    We're trying to get microphone input in a Flash movie and the post it to the server so it can be saved in a file. Currently, we're using PHP in the server, but I guess the key thing here is: How to post the audio to the server? After a post is made, then I guess it'd be a matter of handling the encoding and saving to a file, which can be done with pretty much any server-side language. Any idea if this is at all possible?

    Read the article

  • Are Sphinx & thinking_sphinx really stable? Not indexing Columns

    - by seb
    I'm encountering strange behaviour from thinking_sphinx/sphinx. My define_index block is about 100 lines, so quite a lot of columns i'm indexing. For full-text searching I only need about 10 attributes, for sorting and filtering I have another approximately 50 columns, mostly floats and integers. By filtering I mean using the "with" or "without" options. Searching does not really work consistently. All of a sudden, one attribute fails to filter. Or if I add a new one, it does not work. Only after a lot of tinkering it suddenly starts working. I cannot really reproduce it. Steps I that sometimes lead me to success where: rm -rf db/sphinx change the attribute definition e.g. has some_attribute = has some_attribute, :sortable = true or = has some_attribute, :sortable = true, :as = "some_attribute" restarting the server assigning a new :as name = has some_attribute, :as = "some_attribute_new" (yes, I did rake ts:rebuild or rake ts:in after every step) Does anybody else encounter similar problems?

    Read the article

  • Can I use MSBUILD to investigate which dependency causes a source unit to be recompiled?

    - by Seb Rose
    I have a legacy C++ application with a deep graph of #includes. Changes to any header file often cause recompiles of seemingly unrelated source files. The application is built using a Visual Studio 2005 solution (sln) file. Can MSBUILD be invoked in a way that it reports which dependency(ies) are causing a source file to be recompiled? Is there any other tool that might be able to help?

    Read the article

  • Ruby 1.9 GarbageCollector, GC.disable/enable

    - by seb
    I'm developing a Rails 2.3, Ruby 1.9.1 webapplication that does quite a bunch of calculation before each request. For every request it has to calculate a graph with 300 nodes and ~1000 edges. The graph and all its nodes, edges and other objects are initialized for every request (~2000 objects) - actually they are cloned from an uncalculated cached graph using Marshal.load(Marshal.dump()). Performance is quite an issue here. Right now the whole request takes in average 150ms. I then saw that during a request, parts of the calculation randomly take longer. Assuming, that this might be the GarbageCollector kicking in, I wrapped the request in GC.disable and GC.enable, so that the request waits with garbagecollecting until calculating and rendering have finished. def query GC.disable calculate respond_to do |format| format.html {render} end GC.enable end The average request now takes about 100ms (50 ms less). But I'm unsure if this is a good/stable solution, I assume there must be drawbacks doing that. Does anybody has experience with a similar problem or sees problems with the above code?

    Read the article

  • EMF ecore and xsd out of sync, how to resolve ?

    - by SeB
    Hi there, My application is using a model base on an xsd that have been converted to an ecore before generation of the java classes. One of my team member modified the .ecore metamodel in a previous version ,one attribute that used to be generated. He modified the attribute name but not the Extended MetaData specifying the element name used for xml persistance. <eStructuralFeatures xsi:type="ecore:EReference" name="javaDocsAndUserApi" upperBound="-1" eType="#//JavaDocsAndUserApi" containment="true" resolveProxies="false"> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> <details key="kind" value="element"/> <details key="name" value="docsAndUserApi"/> </eAnnotations> </eStructuralFeatures> so we have an attribute name which is javaDocsAndUserApi and the persisted element named docsAndUserApi, and of course if I create change the attribute in the xsd to be named javaDocsAndUserApi, the ecore transformation will generate a metadata name javaDocsAndUserApi as well, which will break compatibility with previously persisted models. I have looked at xsd authoring guide to find an ecore:som_attribute that would allow me to specify which key to use in the xsd to force the metadata to be named docsAndUserApi during the xsd to ecore transformation but did not find anything. Does anybody have an idea to help me? Thank you.

    Read the article

  • How can I determine which dependency would cause a C++ compilation unit to be rebuilt?

    - by Seb Rose
    I have a legacy C++ application with a deep graph of #includes. Changes to any header file often cause recompiles of seemingly unrelated source files. The application is built using a Visual Studio 2005 solution (sln) file. Can MSBUILD be invoked in a way that it reports which dependency(ies) are causing a source file to be recompiled? Is there any other tool that might be able to help? NOTE: I'm only looking for a tool to tell me why a file would be rebuilt, not some restrospective magic telling me why it was rebuilt.

    Read the article

  • Is there a template engine for Node.js?

    - by Seb
    I'm kind of falling in love with Node.js not because you write app code in javascript but because of its performance. I really don't care a lot about how beautiful a server side language might be but how much requests per second it can handle. So anyway I'm looking forward to experiment building an entire webapp using Node.js (and going back to the actual question) is there a template engine similar to let's say the django template engine or something similar (that at least allows you to extend base templates) available for Node.js?

    Read the article

  • PHP using count() with array

    - by seb
    Hi there, Im trying to get the amount of elements in an array using the count() function, the result is a bit puzzling to me, considere the following example. Assume that the user ID provided is wrong, and therefore had no matches, wouldnt then the result of the count function be 0? yet it is 1. can you explain to me why? thanks $q = mysql_query("select password from users where user_name = '" . $userID . "'"); $check = mysql_fetch_array($q); $result = count($check); echo "RESULT:" . $result;

    Read the article

  • linebreak in url with Bibtex and hyperref package

    - by Tim
    Why is this item not shown properly in my bibliography? @misc{ann, abstract = {ANN is an implbmentation of nearest neighbor search.}, author = {David M. Mount and Sunil Arya}, howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}}, keywords = {knn}, posted-at = {2010-04-08 00:05:04}, priority = {2}, title = {ANN.}, url = "http://www.cs.umd.edu/~mount/ANN/", year = {2008} } @misc{Nilsson96introductionto, author = {Nilsson, Nils J.}, citeulike-article-id = {6995464}, howpublished = {\url{http://robotics.stanford.edu/people/nilsson/mlbook.html}}, keywords = {*file-import-10-04-11}, posted-at = {2010-04-11 06:52:28}, priority = {2}, title = {Introduction to Machine Learning: An Early Draft of a Proposed Textbook.}, year = {1996} } EDIT: I am using \usepackage{hyperref}, not \usepackage{url}. I don't know what changes I just made made the first item appear properly now @misc{ann, abstract = {ANN is an implbmentation of nearest neighbor search.}, author = {David M. Mount and Sunil Arya}, howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}}, keywords = {ann}, posted-at = {2010-04-08 00:05:04}, priority = {2}, title = {The \textsc{A}pproximate \textsc{N}earest \textsc{N}eighbor \textsc{S}earching \textsc{L}ibrary.}, url = "http://www.cs.umd.edu/~mount/ANN/", year = {2008} } EDIT: Since I am using hyperref package, it produces error when using url package together with it. So the two cannot work together? I would like to use hyper links inside pdf file, so I would like to use hyperref package instead of url package. I googled a bit, and try \usepackage[hyperindex,breaklinks]{hyperref}, but there is still no line break just as before. How can I do it? Is there conflict in the packages that I am now using?: \usepackage{amsmath} \usepackage{amsfonts} \usepackage[dvips]{graphicx} \usepackage{wrapfig} \graphicspath{{./figs/}} \DeclareGraphicsExtensions{.eps} \usepackage{fixltx2e} \usepackage{array} \usepackage{times} \usepackage{fancyhdr} \usepackage{multirow} \usepackage{algorithmic} \usepackage{algorithm} \usepackage{slashbox} \usepackage{multirow} \usepackage{rotating} \usepackage{longtable} \usepackage[hyperindex,breaklinks]{hyperref} \usepackage{forloop} \usepackage{lscape} \usepackage{supertabular} \usepackage{amssymb} \usepackage{amsthm}

    Read the article

  • Get current timepoint from Totem application

    - by ??O?????
    I want to find the exact time where a media file is currently paused at (or playing) in a running Totem instance using D-Bus. To be precise, what I want is available from the Totem python console (if the plugin exists and is enabled) by the following command: >>> print totem_object.props.current_time 732616 which I understand is milliseconds. So far: I've never used D-Bus before, so I'm in the process of going through D-Bus and python-dbus documentation. I've also fired up D-Feet and found that the org.gnome.Totem bus name and the /Factory object I can use the org.freedesktop.DBus.Properties interface methods. I'm currently at this point: >>> import dbus >>> seb= dbus.SessionBus() >>> t= seb.get_object('org.gnome.Totem', '/Factory') >>> tif= dbus.Interface(t, 'org.freedesktop.DBus.Properties') >>> tif.GetAll('') dbus.Dictionary({}, signature=dbus.Signature('sv')) I can't find even a proper how-to, so any help will be greatly appreciated.

    Read the article

  • WPF DataGrid extended "copy and paste"

    - by MadSeb
    Hi, How can I make the WPF DataGrid have some sort of improved "copy and paste" where I can select a single cell , copy using Ctrl-C , select a bunch of cells of columns and paste using Ctrl-V ??? So for example...in the image bellow ...I want to be able to copy the "Tech" word to all the highlighted cells just by a Ctrl-C on tech, a select of the cells, and a Ctrl-V ... Regards, Seb

    Read the article

  • Why am I getting the extra xmlns="" using LinqToXML?

    - by Hcabnettek
    Hello all, I'm using LinqToXML to generate a piece of XML. Everything works great except I'm throwing in some empty namespace declarations somehow. Does anyone out there know what I'm doing incorrectly? Here is my code private string SerializeInventory(IEnumerable<InventoryInformation> inventory) { var zones = inventory.Select(c => new { c.ZoneId , c.ZoneName , c.Direction }).Distinct(); XNamespace ns = "http://www.dummy-tmdd-address"; XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; var xml = new XElement(ns + "InventoryList" , new XAttribute(XNamespace.Xmlns + "xsi", xsi) , zones.Select(station => new XElement("StationInventory" , new XElement("station-id", station.ZoneId) , new XElement("station-name", station.ZoneName) , new XElement("station-travel-direction", station.Direction) , new XElement("detector-list" , inventory.Where(p => p.ZoneId == station.ZoneId).Select(plaza => new XElement("detector" , new XElement("detector-id", plaza.PlazaId))))))); xml.Save(@"c:\tmpXml\myXmlDoc.xml"); return xml.ToString(); } And here is the resulting xml. I hope it renders correctly? The browser may hide the tags. - <InventoryList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dummy-tmdd-address"> <StationInventory xmlns=""> <station-id>999</station-id> <station-name>Zone 999-SEB</station-name> <station-travel-direction>SEB</station-travel-direction> <detector-list> <detector> <detector-id>7503</detector-id> </detector> <detector> <detector-id>2705</detector-id> </detector> </detector-list> </StationInventory> </InventoryList> Notice the empty namespace declaration in the first child element. Any ideas how I can remedy this? Any tips are of course appreciated. Thanks All, ~ck

    Read the article

  • Design Pattern for "Context Sensitive" Right Click Menu

    - by MadSeb
    Hi, What is a design pattern I can use for generating "context-sensitive" right click menus ? I have in mind a "Windows Explorer"-like application where a user can right click on a folder and get a list of menu items but right click on a drive and get a totally different list. What design pattern should I use ? Would the factory design pattern be appropiate for handling such a menu ? Regards, Seb

    Read the article

  • apt-get install fails due to dependency issues but apt-get -f install won't fix it

    - by user71941
    I've just installed Ubuntu 12.04 and was about to manually install Rawstudio with the packages from SourceForge repo, but I've been stuck with dependency issues and I am short on apt command lines to sort this out. Here's the report I'v got : installArchives() failed: dpkg: dependency problems prevent configuration of libgphoto2-2: libgphoto2-2 depends on libjpeg62; however: Package libjpeg62 is not installed. libgphoto2-l10n (2.4.13-1ubuntu1) breaks libgphoto2-2 (<= 2.4.10.1-4) and is installed. Version of libgphoto2-2 to be configured is 2.4.10.1-0ubuntu3~maverick. dpkg: error processing libgphoto2-2 (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already dpkg: dependency problems prevent configuration of libgphoto2-2-dev: libgphoto2-2-dev depends on libgphoto2-2 (= 2.4.10.1-0ubuntu3~maverick); however: Package libgphoto2-2 is not configured yet. dpkg: error processing libgphoto2-2-dev (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already Errors were encountered while processing: libgphoto2-2 libgphoto2-2-dev Error in function: SystemError: E:Sub-process /usr/bin/dpkg returned an error code (1) dpkg: dependency problems prevent configuration of libgphoto2-2: libgphoto2-2 depends on libjpeg62; however: Package libjpeg62 is not installed. libgphoto2-l10n (2.4.13-1ubuntu1) breaks libgphoto2-2 (<= 2.4.10.1-4) and is installed. Version of libgphoto2-2 to be configured is 2.4.10.1-0ubuntu3~maverick. dpkg: error processing libgphoto2-2 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libgphoto2-2-dev: libgphoto2-2-dev depends on libgphoto2-2 (= 2.4.10.1-0ubuntu3~maverick); however: Package libgphoto2-2 is not configured yet. dpkg: error processing libgphoto2-2-dev (--configure): dependency problems - leaving unconfigured I've tried "apt-get -f install" but without success. What is the mahick command line that will unblock the situation ? Thanks Seb

    Read the article

  • C# ProgressBar design pattern

    - by MadSeb
    Hi, I'm working on a database upgrader application. The upgrader updates the schema of a database ( adds new columns, renames columns , adds new tables, new views to an existing database by executing SQL statements ). When a user wants to upgrade from version 1.0 to 2.0 , "Upgrader" objects are taken from an object factory and the "Execute" method of each "Upgrader" is called. The GUI of the application has a progress bar and each time an upgrader object performs a SQL statement the progress bar gets incremented. while (!version.Equal(CurrentVersion)) { IUpgrader myUpgrader = UpgraderFactory.GetUpgrader(version); myUpgrader.Execute(UpgradedFile,progressbar); version.Increment(); } My question is very simple : how should the upgrader object communicate with the progressbar. In the code above, the upgrader object is given direct access to the progressbar but I'm wondering if some better way of doing this or better design pattern exists. Regards, Seb

    Read the article

< Previous Page | 1 2 3  | Next Page >