Search Results

Search found 42 results on 2 pages for 'matthieu'.

Page 2/2 | < Previous Page | 1 2 

  • Most efficient method to query a Young Tableau

    - by Matthieu M.
    A Young Tableau is a 2D matrix A of dimensions M*N such that: i,j in [0,M)x[0,N): for each p in (i,M), A[i,j] <= A[p,j] for each q in (j,N), A[i,j] <= A[i,q] That is, it's sorted row-wise and column-wise. Since it may contain less than M*N numbers, the bottom-right values might be represented either as missing or using (in algorithm theory) infinity to denote their absence. Now the (elementary) question: how to check if a given number is contained in the Young Tableau ? Well, it's trivial to produce an algorithm in O(M*N) time of course, but what's interesting is that it is very easy to provide an algorithm in O(M+N) time: Bottom-Left search: Let x be the number we look for, initialize i,j as M-1, 0 (bottom left corner) If x == A[i,j], return true If x < A[i,j], then if i is 0, return false else decrement i and go to 2. Else, if j is N-1, return false else increment j This algorithm does not make more than M+N moves. The correctness is left as an exercise. It is possible though to obtain a better asymptotic runtime. Pivot Search: Let x be the number we look for, initialize i,j as floor(M/2), floor(N/2) If x == A[i,j], return true If x < A[i,j], search (recursively) in A[0:i-1, 0:j-1], A[i:M-1, 0:j-1] and A[0:i-1, j:N-1] Else search (recursively) in A[i+1:M-1, 0:j], A[i+1:M-1, j+1:N-1] and A[0:i, j+1:N-1] This algorithm proceed by discarding one of the 4 quadrants at each iteration and running recursively on the 3 left (divide and conquer), the master theorem yields a complexity of O((N+M)**(log 3 / log 4)) which is better asymptotically. However, this is only a big-O estimation... So, here are the questions: Do you know (or can think of) an algorithm with a better asymptotical runtime ? Like introsort prove, sometimes it's worth switching algorithms depending on the input size or input topology... do you think it would be possible here ? For 2., I am notably thinking that for small size inputs, the bottom-left search should be faster because of its O(1) space requirement / lower constant term.

    Read the article

  • .net VS2008 compilation analyzer tool ?

    - by Matthieu
    Hi, I'm looking for a tool that allows me to analyze the compilation of a VS Solution (about 30 VS projects inside). I would like to know after the global solution compilation, which projets fail and forward errors to developers. Of course, I could analyze the compilation report... but I'm pretty sure that great tools are available ! What is for you the best one ? Thanks a lot !

    Read the article

  • Retrieve specific preceding sibling nodes attributes

    - by Matthieu BROUILLARD
    Is there an XPath way of recovering directly one specific attribute of preceding sibling nodes of an XML node using an XPath query? In the following example, I would like to retrieve the values of the alt attribute of each img nodes that precede the div element marked with the id=marker. <content> <img alt="1" src="file.gif" /> <img alt="2" src="file.gif" /> <img alt="3" src="file.gif" /> <img alt="4" src="file.gif" /> <div id='marker'></div> </content> For this example, I want to retrieve the values 1 2 3 4. I use the following XPath query //div[@id='marker']/preceding-sibling::img in order to retrieve the node list I want <img alt="1" src="file.gif"/> <img alt="2" src="file.gif"/> <img alt="3" src="file.gif"/> <img alt="4" src="file.gif"/> As it is a node list I can then iterate on the nodes to retrieve the attribute value I am looking for, but is there an XPath way of doing it? I would have expected to be able to write something like: //div[@id='marker']/preceding-sibling::img@alt or //div[@id='marker']/preceding-sibling@alt::img but I don't even know if it is possible once you have used an XPath Axe like preceding-sibling.

    Read the article

  • [XPATH] Retrieve specific preceding sibling nodes attributes

    - by Matthieu BROUILLARD
    Is there an XPath way of recovering directly one specific attribute of preceding sibling nodes of an XML node using an XPath query? In the following example, I would like to retrieve the values of the alt attribute of each img nodes that precede the div element marked with the id=marker. <content> <img alt="1" src="file.gif" /> <img alt="2" src="file.gif" /> <img alt="3" src="file.gif" /> <img alt="4" src="file.gif" /> <div id='marker'></div> </content> For this example, I want to retrieve the values 1 2 3 4. I use the following XPath query //div[@id='marker']/preceding-sibling::img in order to retrieve the node list I want <img alt="1" src="file.gif"/> <img alt="2" src="file.gif"/> <img alt="3" src="file.gif"/> <img alt="4" src="file.gif"/> As it is a node list I can then iterate on the nodes to retrieve the attribute value I am looking for, but is there an XPath way of doing it? I would have expected to be able to write something like: //div[@id='marker']/preceding-sibling::img@alt or //div[@id='marker']/preceding-sibling@alt::img but I don't even know if it is possible once you have used an XPath Axe like preceding-sibling.

    Read the article

  • In Eclipse, how can spaces behave as tabs ?

    - by Matthieu
    I have replaced all my tabs by spaces. But now, when I hit backspace to remove an indentation level, it removes only one space. So I have to hit 4 times space to remove an indentation level. That is one of the most absurd thing I've seen in Eclipse, so I guess there is an option somewhere to enable us to remove 4 spaces as if it where a tab ? (because we use spaces instead of tabs for practical reason, 4 spaces is supposed to mean "1 tab") Thanks Note : I use Eclipse PDT

    Read the article

  • Using Windows header files within Netbeans 6.8

    - by Matthieu Steffens
    I'm trying to make an windows application within Netbeans. When using Visual studio it is no problem to use files like tchar.h I have receaved a basic file structure containing those and I'm trying to get them to work on Netbeans IDE but it seems that Netbeans won't allow using files from Visual Studio. I have tried to add the tchar.h file and all other file it required (including some C++ core files) and commenting the errors written in those care files: #error ERROR: Use of C runtime library internal header file. But netbenas can't find the tchar.h file while being in same folder...

    Read the article

  • A PHP object server for business logic

    - by Matthieu
    I wonder if such a thing is possible or even exist : In the MVC pattern, I would like to have the Model part to be persistant in memory, instead of reloading my instances at each execution. So I want only the Controller and View part to be executed. Is there any solution of server that would provide PHP objects (just like a Mysql server provides data records), and that keeps these objects in memory ? A problem would be also : how to have a constructed query to get objects ? Maybe PHP Linq ?

    Read the article

  • Where to put plugins in a Zend Framework website

    - by Matthieu
    Hi all, The question is quite simple : I have a plugin for Zend Framework. Should I put it in the "library/Plugin" folder, or in "application/plugins". (btw for now it is in library/Plugin but this works on Linux and Mac Os X, but not Windows so i figured maybe that is not the right place) Thank you

    Read the article

  • PHP ORM library based on the Data Mapper pattern

    - by Matthieu
    For a PHP application with a complex domain model, I don't want to use the Active Record pattern, I need instead the Data Mapper pattern (as presented in Zend Framework). Do you know any library that could help me for the ORM part, or else a link to a documentation on "how to do it right" ? Thanks

    Read the article

  • interactive (adding listeners to) DAE model in flex + papervision

    - by G. Matthieu
    I have a DAE model that is parsed into several parts. I am able to deal with them separately, such as changing their material or colour but I am having problems adding click or hover listeners over the children. For example, lets say I have a model of a kitty where each facial feature is a child. I want to be able to hover or click the features and have a window pop up explaining the feature. I've tried parsing the model and adding listeners but it doesn't seem to work. Thanks in advance! L

    Read the article

  • How to recover from a fatal error "Allowed memory size exhausted"

    - by Matthieu
    Hi everybody, Do you know any solution to recover from the PHP fatal error : "Allowed memory size ... exhausted" I have a shutdown function that is called when a fatal error appear. This function create an ErrorException from it, and logs it. The problem is : when there is no more memory available, it can't log the error (I log in Firebug, via FirePHP, with Zend Framework). So what i mean by "how to recover from it", is how to perform basic error log, and let Zend Framework send the Headers, so that the error is logged (in Firebug in my case) as any other error ? Thanks

    Read the article

  • Undefined template methods trick ?

    - by Matthieu M.
    A colleague of mine told me about a little piece of design he has used with his team that sent my mind boiling. It's a kind of traits class that they can specialize in an extremely decoupled way. I've had a hard time understanding how it could possibly work, and I am still unsure of the idea I have, so I thought I would ask for help here. We are talking g++ here, specifically the versions 3.4.2 and 4.3.2 (it seems to work with both). The idea is quite simple: 1- Define the interface // interface.h template <class T> struct Interface { void foo(); // the method is not implemented, it could not work if it was }; // // I do not think it is necessary // but they prefer free-standing methods with templates // because of the automatic argument deduction // template <class T> void foo(Interface<T>& interface) { interface.foo(); } 2- Define a class, and in the source file specialize the interface for this class (defining its methods) // special.h class Special {}; // special.cpp #include "interface.h" #include "special.h" // // Note that this specialization is not visible outside of this translation unit // template <> struct Interface<Special> { void foo() { std::cout << "Special" << std::endl; } }; 3- To use, it's simple too: // main.cpp #include "interface.h" class Special; // yes, it only costs a forward declaration // which helps much in term of dependencies int main(int argc, char* argv[]) { Interface<Special> special; foo(special); return 0; }; It's an undefined symbol if no translation unit defined a specialization of Interface for Special. Now, I would have thought this would require the export keyword, which to my knowledge has never been implemented in g++ (and only implemented once in a C++ compiler, with its authors advising anyone not to, given the time and effort it took them). I suspect it's got something to do with the linker resolving the templates methods... Do you have ever met anything like this before ? Does it conform to the standard or do you think it's a fortunate coincidence it works ? I must admit I am quite puzzled by the construct...

    Read the article

  • Facebook "->api" permissions

    - by Matthieu Marcé
    I have trouble using Facebook auth on my website... I'm using the PHP Sdk and I don't understand why I can use some functions like "getLoginUrl"/"getLoginStatusUrl"/"getUser" (with right answers : the facebook session is started, i get the user's facebook ID) and when I want to use something like $me = $facebook->api("/me/permissions"); or just $me = $facebook->api("/me"); there's always an exception and nothing works ... I guess it has something to do with permissions or token maybe, but I don't know what. When the user sign up on my website, I ask permissions I need with this scope : "email,user_about_me,user_location,read_friendlists,publish_stream" A clue that the permissions seem to be ok is that when the exception occures, I ask the user to sign in again (facebook connect) and no window appears as if everything's ok, but still, the page is reloaded and the exception appears again and again... Please help, Thank you !

    Read the article

  • Which trick uses Apple to show icons in the dock contextual menu ?

    - by Matthieu Riegler
    My question is quite simple : To use a custom menu for the apps icon on the dock, - (NSMenu*) applicationDockMenu: (id) sender; of the NSApplicationDelegate has to return the menu that the dock will display. Using setImage on a NSMenuItem, you can normaly add icons to the menu. They show up on the normal menu, but not on in contextual menu of the app's dock icon. Then how did Apple manage QuickTime, XCode, Preview to show icons in the list of recent opened files accessible in their dock contextual menu ? Thx.

    Read the article

  • Zend Metadata Cache in file

    - by Matthieu
    I set up a metadata cache in Zend Framework because a lot of DESCRIBE queries were executed and it affected the performances. $frontendOptions = array ('automatic_serialization' => true); $backendOptions = array ('cache_dir' => CACHE_PATH . '/db-tables-metadata'); $cache = Zend_Cache::factory( 'Core', 'File', $frontendOptions, $backendOptions ); Zend_Db_Table::setDefaultMetadataCache($cache); I can indeed see the cache files created, and the website works great. However, when I launch unit tests, or a script of the same application that perform DB queries, I end up with an error because Zend couldn't read the cache files. This is because in the website, the cache files are created by the www user, and when I run phpunit or a script, it tries to read them with my user and it fails. Do you see any solution to that? I have some quickfix ideas but I'm looking for a good/stable solution. And I'd rather avoid running phpunit or the scripts as www if possible (for practical reasons).

    Read the article

  • cannot output a json encoded dict containing accents (noob inside)

    - by user296546
    Hi all, here is a fairly simple example wich is driving me nuts since a couple of days. Considering the following script: # -*- coding: utf-8 -* from json import dumps as json_dumps machaine = u"une personne émérite" print(machaine) output = {} output[1] = machaine jsonoutput = json_dumps(output) print(jsonoutput) The result of this from cli: une personne émérite {"1": "une personne \u00e9m\u00e9rite"} I don't understand why their such a difference between the two strings. i have been trying all sorts of encode, decode etc but i can't seem to be able to find the right way to do it. Does anybody has an idea ? Thanks in advance. Matthieu

    Read the article

< Previous Page | 1 2