Search Results

Search found 1112 results on 45 pages for 'recursive'.

Page 17/45 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • What if we run out of stack space in C# or Python?

    - by dotneteer
    Supposing we are running a recursive algorithm on a very large data set that requires, say, 1 million recursive calls. Normally, one would solve such a large problem by converting recursion to a loop and a stack, but what if we do not want to or cannot rewrite the algorithm? Python has the sys.setrecursionlimit(int) method to set the number of recursions. However, this is only part of the story; the program can still run our of stack space. C# does not have a equivalent method. Fortunately, both C# and Python have option to set the stack space when creating a thread. In C#, there is an overloaded constructor for the Thread class that accepts a parameter for the stack size: Thread t = new Thread(work, stackSize); In Python, we can set the stack size by calling: threading.stack_size(67108864) We can then run our work under a new thread with increased stack size.

    Read the article

  • How can I test a parser for a bespoke XML schema?

    - by Greg B
    I'm parsing a bespoke XML format into an object graph using .NET 4.0. My parser is using the System.XML namespace internally, I'm then interrogating the relevant properties of XmlNodes to create my object graph. I've got a first cut of the parser working on a basic input file and I want to put some unit tests around this before I progress on to more complex input files. Is there a pattern for how to test a parser such as this? When I started looking at this, my first move was to new up and XmlDocument, XmlNamespaceManager and create an XmlElement. But it occurs to me that this is quite lengthy and prone to human error. My parser is quite recursive as you can imagine and this might lead to testing the full system rather than the individual units (methods) of the system. So a second question might be What refactoring might make a recursive parser more testable?

    Read the article

  • Faking Display tree (Sprite) parent child relationships with rasters (BitmapData) in ActionScript 3

    - by Arthur Wulf White
    I am working with Rasters (bitmapData) and blliting (copypixels) in a 2d-game in actionscript 3. I like how you can move a sprite and it moves all it's children, and you can simultaneously move the children creating an interesting visual effect. I do not want to use rotation or scaling however cause I do not know how that can be done without hampering with performance. So I'm not simulating Sprite parent-child behavior and sticking to the movement on the (x, y) axis. What I am planning to do is create a class called RasterContainer which extends bitmapData that has a vector of children of type Raster(extending bitmapData), now I am planning to implement recursive rendering in RasterContainer, that basically copyPixels every child, only changing their (x, y) offset to reflect their parent's offset. My question is, has this been implemented in an existing framework? Is this a good plan? Do I expect a serious performance hit for using recursive methods this way?

    Read the article

  • Samba user does not have folder read permission

    - by user289455
    I have set up a special user for read only samba shares. I set him up in Samba and as a system user. I shared a couple of folders but that user cannot access them. I know samba is working because I also shared them with the main user of the system which is an admin account and it works fine. How can I allow this user to have read permissions on all the directories I want to share without changing anything for any other users of the system? For example, I don't want to give him ownership of any of the files/directories. Just ongoing recursive read access. ongoing recursive is important. If someone adds a file or directory, I still want him to automatically be able to read it.

    Read the article

  • Installing Monodevelop from the SVN on Ubuntu 10.04

    - by celil
    I wrote the following script to install the svn version of MonoDevelop #!/usr/bin/env bash PREFIX=/opt/local check_errs() { if [[ $? -ne 0 ]]; then echo "${1}" exit 1 fi } download() { if [ ! -d ${1} ] then svn co http://anonsvn.mono-project.com/source/trunk/${1} else (cd ${1}; svn update) fi } download mono download mcs download libgdiplus ( cd mono ./autogen.sh --prefix=$PREFIX make make install check_errs ) ( cd libgdiplus ./autogen.sh --prefix=$PREFIX make make install check_errs ) download monodevelop export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig ( cd monodevelop ./configure --prefix=$PREFIX --select check_errs make check_errs ) Everything works fine until the last make step for the monodevelop pacakge, where the script exits with the error: ./MonoDevelop.WebReferences/MoonlightChannelBaseExtension.cs(320,82): error CS1061: Type `System.ServiceModel.Description.OperationContractGenerationContext' does not contain a definition for `SyncMethod' and no extension method `SyncMethod' of type `System.ServiceModel.Description.OperationContractGenerationContext' could be found (are you missing a using directive or an assembly reference?) ./MonoDevelop.WebReferences/MoonlightChannelBaseExtension.cs(325,49): error CS1061: Type `System.ServiceModel.Description.OperationContractGenerationContext' does not contain a definition for `SyncMethod' and no extension method `SyncMethod' of type `System.ServiceModel.Description.OperationContractGenerationContext' could be found (are you missing a using directive or an assembly reference?) ./MonoDevelop.WebReferences/MoonlightChannelBaseExtension.cs(345,115): error CS1061: Type `System.ServiceModel.Description.OperationContractGenerationContext' does not contain a definition for `SyncMethod' and no extension method `SyncMethod' of type `System.ServiceModel.Description.OperationContractGenerationContext' could be found (are you missing a using directive or an assembly reference?) ./MonoDevelop.WebReferences/MoonlightChannelBaseExtension.cs(365,82): error CS1061: Type `System.ServiceModel.Description.OperationContractGenerationContext' does not contain a definition for `BeginMethod' and no extension method `BeginMethod' of type `System.ServiceModel.Description.OperationContractGenerationContext' could be found (are you missing a using directive or an assembly reference?) Compilation failed: 4 error(s), 1 warnings make[4]: *** [../../../build/AddIns/MonoDevelop.WebReferences/MonoDevelop.WebReferences.dll] Error 1 make[4]: Leaving directory `/home/drufat/Desktop/Checkout/mono/monodevelop/main/src/addins/MonoDevelop.WebReferences' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/drufat/Desktop/Checkout/mono/monodevelop/main/src/addins' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/drufat/Desktop/Checkout/mono/monodevelop/main/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/drufat/Desktop/Checkout/mono/monodevelop/main' make: *** [all-recursive] Error 1 Any ideas on how to fix this? I suppose the build gets mixed up with the default installation of mono in Ubuntu, and is looking for a symbol that is not present there. My build configuration looks as follows: 1. [X] main 2. [ ] extras/JavaBinding 3. [ ] extras/BooBinding 4. [X] extras/ValaBinding 5. [ ] extras/AspNetEdit 6. [ ] extras/GeckoWebBrowser 7. [ ] extras/WebKitWebBrowser 8. [ ] extras/MonoDevelop.Database 9. [ ] extras/MonoDevelop.Profiling 10. [ ] extras/MonoDevelop.AddinAuthoring 11. [ ] extras/MonoDevelop.CodeAnalysis 12. [ ] extras/MonoDevelop.Debugger.Mdb 13. [ ] extras/MonoDevelop.Debugger.Gdb 14. [ ] extras/PyBinding 15. [ ] extras/MonoDevelop.IPhone 16. [ ] extras/MonoDevelop.MeeGo

    Read the article

  • Selecting merge strategy options for git rebase

    - by porneL
    git-rebase man page mentions -X<option> can be passed to git-merge. When/how exactly? I'd like to rebase by applying patches with recursive strategy and theirs option (apply whatever sticks, rather than skipping entire conflicting commits). I don't want merge, I want to make history linear. I've tried: git rebase -Xtheirs and git rebase -s 'recursive -Xtheirs' but git rejects -X in both cases.

    Read the article

  • Eclipse CDT Linuxtools gives broken pipe error

    - by ole
    I am running Eclipse CDT 6.0.2 on a SLES 11 x86_64 platform. My project is of linuxtools type. I am getting the following error running builds: " ../libtool: line 747: echo: write error: Broken pipe make[2]: write error make[1]: *** [all recursive] Error 1 make[1]: write error make: *** [all recursive] Error 1 " Any help is appreciated.

    Read the article

  • Extracting specific files from ZIP in PHP

    - by Michael
    If I have a ZIP file whose structure is: -directory1 DIR -files in here -directory2 DIR -more files in here Using pclzip.lib.php how can I open up this ZIP file and extract directory1 (recursive) into a directory and then extract directory2 (recursive) into another directory.

    Read the article

  • Git ignore all folders apart from

    - by digital
    I want to ignore all the files in my folder structure apart from the following conditions: profiles (and all folders/files recursive) sites/xxx (and all folders/files recursive) Currently my gitignore file looks like: `*` !sites/xxx !sites/xxx/modules !sites/xxx/modules/* !profiles !profiles/xxx !profiles/xxx/* This doesn't allow me to track sites/xxx/modules/new though, is there anyway round this.

    Read the article

  • Octree subdivision problem

    - by ChaosDev
    Im creating octree manually and want function for effectively divide all nodes and their subnodes - For example - I press button and subnodes divided - press again - all subnodes divided again. Must be like - 1 - 8 - 64. The problem is - i dont understand how organize recursive loops for that. OctreeNode in my unoptimized implementation contain pointers to subnodes(childs),parent,extra vector(contains dublicates of child),generation info and lots of information for drawing. class gOctreeNode { //necessary fields gOctreeNode* FrontBottomLeftNode; gOctreeNode* FrontBottomRightNode; gOctreeNode* FrontTopLeftNode; gOctreeNode* FrontTopRightNode; gOctreeNode* BackBottomLeftNode; gOctreeNode* BackBottomRightNode; gOctreeNode* BackTopLeftNode; gOctreeNode* BackTopRightNode; gOctreeNode* mParentNode; std::vector<gOctreeNode*> m_ChildsVector; UINT mGeneration; bool mSplitted; bool isSplitted(){return m_Splitted;} .... //unnecessary fields }; DivideNode of Octree class fill these fields, set mSplitted to true, and prepare for correctly drawing. Octree contains basic nodes(m_nodes). Basic node can be divided, but now I want recursivly divide already divided basic node with 8 subnodes. So I write this function. void DivideAllChildCells(int ix,int ih,int id) { std::vector<gOctreeNode*> nlist; std::vector<gOctreeNode*> dlist; int index = (ix * m_Height * m_Depth) + (ih * m_Depth) + (id * 1);//get index of specified node gOctreeNode* baseNode = m_nodes[index].get(); nlist.push_back(baseNode->FrontTopLeftNode); nlist.push_back(baseNode->FrontTopRightNode); nlist.push_back(baseNode->FrontBottomLeftNode); nlist.push_back(baseNode->FrontBottomRightNode); nlist.push_back(baseNode->BackBottomLeftNode); nlist.push_back(baseNode->BackBottomRightNode); nlist.push_back(baseNode->BackTopLeftNode); nlist.push_back(baseNode->BackTopRightNode); bool cont = true; UINT d = 0;//additional recursive loop param (?) UINT g = 0;//additional recursive loop param (?) LoopNodes(d,g,nlist,dlist); //Divide resulting nodes for(UINT i = 0; i < dlist.size(); i++) { DivideNode(dlist[i]); } } And now, back to the main question,I present LoopNodes, which must do all work for giving dlist nodes for splitting. void LoopNodes(UINT& od,UINT& og,std::vector<gOctreeNode*>& nlist,std::vector<gOctreeNode*>& dnodes) { //od++;//recursion depth bool f = false; //pass through childs for(UINT i = 0; i < 8; i++) { if(nlist[i]->isSplitted())//if node splitted and have childs { //pass forward through tree for(UINT j = 0; j < 8; j++) { nlist[j] = nlist[j]->m_ChildsVector[j];//set pointers to these childs } LoopNodes(od,og,nlist,dnodes); } else //if no childs { //add to split vector dnodes.push_back(nlist[i]); } } } This version of loop nodes works correctly for 2(or 1?) generations after - this will not divide neightbours nodes, only some corners. I need correct algorithm. Screenshot All I need - is correct version of LoopNodes, which can add all nodes for DivideNode.

    Read the article

  • Marshalling C# com items when using recursion

    - by Kevin
    I am using the SourceSafe COM object (SourceSafeTypeLib) from C# to automate a SourceSafe recursive get (part of a larger build process). The recursive function is shown below. How do I ensure that all the COM objects created in the foreach loop get released correctly? /// <summary> /// Recursively gets files/projects from SourceSafe (this is a recursive function). /// </summary> /// <param name="vssItem">The VSSItem to get</param> private void GetChangedFiles(VSSItem vssItem) { // 'If the object is a file perform the diff, // 'If not, it is a project, so use recursion to go through it if(vssItem.Type == (int)VSSItemType.VSSITEM_FILE) { bool bDifferent = false; //file is different bool bNew = false; //file is new //Surround the diff in a try-catch block. If a file is new(doesn't exist on //the local filesystem) an error will be thrown. Catch this error and record it //as a new file. try { bDifferent = vssItem.get_IsDifferent(vssItem.LocalSpec); } catch { //File doesn't exist bDifferent = true; bNew = true; } //If the File is different(or new), get it and log the message if(bDifferent) { if(bNew) { clsLog.WriteLine("Getting " + vssItem.Spec); } else { clsLog.WriteLine("Replacing " + vssItem.Spec); } string strGetPath = vssItem.LocalSpec; vssItem.Get(ref strGetPath, (int)VSSFlags.VSSFLAG_REPREPLACE); } } else //Item is a project, recurse through its sub items { foreach(VSSItem fileItem in vssItem.get_Items(false)) { GetChangedFiles(fileItem); } } }

    Read the article

  • Why do people hate SQL cursors so much?

    - by Steven A. Lowe
    I can understand wanting to avoid having to use a cursor due to the overhead and inconvenience, but it looks like there's some serious cursor-phobia-mania going on where people are going to great lengths to avoid having to use one for example, one question asked how to do something obviously trivial with a cursor and the accepted answer proposed using a common table expression (CTE) recursive query with a recursive custom function, even though this limits the number of rows that could be processed to 32 (due to recursive call limit in sql server). This strikes me as a terrible solution for system longevity, not to mention a tremendous effort just to avoid using a simple cursor. what is the reason for this level of insane hatred? has some 'noted authority' issued a fatwa against cursors? does some unspeakable evil lurk in the heart of cursors that corrupts the morals of the children or something? wiki question, more interested in the answer than the rep thanks in advance! Related Info: http://stackoverflow.com/questions/37029/sql-server-fast-forward-cursors EDIT: let me be more precise: I understand that cursors should not be used instead of normal relational operations, that is a no-brainer. What I don't understand is people going waaaaay out of their way to avoid cursors like they have cooties or something, even when a cursor is a simpler and/or more efficient solution. It's the irrational hatred that baffles me, not the obvious technical efficiencies.

    Read the article

  • Asymptotic runtime of list-to-tree function

    - by Deestan
    I have a merge function which takes time O(log n) to combine two trees into one, and a listToTree function which converts an initial list of elements to singleton trees and repeatedly calls merge on each successive pair of trees until only one tree remains. Function signatures and relevant implementations are as follows: merge :: Tree a -> Tree a -> Tree a --// O(log n) where n is size of input trees singleton :: a -> Tree a --// O(1) empty :: Tree a --// O(1) listToTree :: [a] -> Tree a --// Supposedly O(n) listToTree = listToTreeR . (map singleton) listToTreeR :: [Tree a] -> Tree a listToTreeR [] = empty listToTreeR (x:[]) = x listToTreeR xs = listToTreeR (mergePairs xs) mergePairs :: [Tree a] -> [Tree a] mergePairs [] = [] mergePairs (x:[]) = [x] mergePairs (x:y:xs) = merge x y : mergePairs xs This is a slightly simplified version of exercise 3.3 in Purely Functional Data Structures by Chris Okasaki. According to the exercise, I shall now show that listToTree takes O(n) time. Which I can't. :-( There are trivially ceil(log n) recursive calls to listToTreeR, meaning ceil(log n) calls to mergePairs. The running time of mergePairs is dependent on the length of the list, and the sizes of the trees. The length of the list is 2^h-1, and the sizes of the trees are log(n/(2^h)), where h=log n is the first recursive step, and h=1 is the last recursive step. Each call to mergePairs thus takes time (2^h-1) * log(n/(2^h)) I'm having trouble taking this analysis any further. Can anyone give me a hint in the right direction?

    Read the article

  • How can I create a "dynamic" WHERE clause?

    - by TheChange
    Hello there, First: Thanks! I finished my other project and the big surprise: now everything works as it should :-) Thanks to some helpful thinkers of SO! So here I go with the next project. I'd like to get something like this: SELECT * FROM tablename WHERE field1=content AND field2=content2 ... As you noticed this can be a very long where-clause. tablename is a static property which does not change. field1, field2 , ... (!) and the contents can change. So I need an option to build up a SQL statement in PL/SQL within a recursive function. I dont really know what to search for, so I ask here for links or even a word to search for.. Please dont start to argue about wether the recursive function is really needed or what its disadvanteges - this is not in question ;-) If you could help me to create something like an SQL-String which will later be able to do a successful SELECT this would be very nice! Iam able to go through the recursive function and make a longer string each time, but I cannot make an SQL statement from it.. Oh, one additional thing: I get the fields and contents by a xmlType (xmldom.domdocument etc) I can get the field and the content for example in a clob from the xmltype

    Read the article

  • Compile Apache 2.4.3 on Centos 6.2 (64bit)

    - by RiseCakoPlusplus
    I attempt to compile Apache 2.4.3 with apr-1.4.6 and apr-util-1.5.1 on Centos 6.2 (64bit). ./configure --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib64 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --without-pear --with-bz2 --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --with-t1lib=/usr --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --with-libxml-dir=/usr --enable-xml --with-system-tzdata --with-mhash --with-apxs2=/usr/sbin/apxs --libdir=/usr/lib64/php --enable-pdo=shared --with-mysql=shared,/usr --with-mysqli=shared,/usr/lib64/mysql/mysql_config --with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config --without-pdo-sqlite --without-gd --disable-dom --disable-dba --without-unixODBC --disable-xmlreader --disable-xmlwriter --without-sqlite3 --disable-phar --disable-fileinfo --disable-json --without-pspell --disable-wddx --without-curl --disable-posix --disable-sysvmsg --disable-sysvshm --disable-sysvsem ./configure --with-included-apr --with-included-apr-util and when I issue make this happen: /root/httpd-2.4.3/srclib/apr/libtool: line 5989: cd: yes/lib: No such file or directory libtool: link: cannot determine absolute directory name of yes/lib' make[3]: *** [libaprutil-1.la] Error 1 make[3]: Leaving directory/root/httpd-2.4.3/srclib/apr-util' make[2]: * [all-recursive] Error 1 make[2]: Leaving directory /root/httpd-2.4.3/srclib/apr-util' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/root/httpd-2.4.3/srclib' make: * [all-recursive] Error 1 anything I missed?

    Read the article

  • Installing Midnight Commander from sources (no root privileges)

    - by ouroboros
    I tried to configure ./configure --prefix=/localfolder glib-2.26.1/ make make install but it fails at make stage. trying to configure mc-4.6.1/ and make doesn't obviously work. What are the steps I need to make in order to install midnight comander for my local user in a custom folder? Make for glib gives me these errors /usr/bin/msgfmt: found 2 fatal errors cp: cannot stat `test.mo': No such file or directory gmake[4]: *** [test.mo] Error 1 gmake[4]: Leaving directory `/remote/folder/mc/glib-2.26.1/gio/tests' gmake[3]: *** [all-recursive] Error 1 gmake[3]: Leaving directory `/remote/folder/mc/glib-2.26.1/gio' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/remote/folder/mc/glib-2.26.1/gio' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/remote/folder/mc/glib-2.26.1' gmake: *** [all] Error 2

    Read the article

  • rsync - How to exclude one .htaccess but not all of them

    - by Cory Gagliardi
    I have an rsync command for copying my files from dev to production. I don't want to copy the .htaccess file that's in the root of the HTML directory but, I do want to copy the few .htaccess files that are in its sub directories. I'm using the argument --exclude .htaccess which is stopping all of the files from getting copied. The other arguments I'm including are -a --recursive --times --perms. Is it possible to configure rsync to do this? Edit: Here is my full command: rsync -a --recursive --times --perms \ --exclude prop_images --exclude tracking --exclude vtours \ --exclude .htaccess --exclude .htaccess_backup --exclude "*~" \ /home/user/dev_html/* /home/user/public_html/

    Read the article

  • Recursively apply ACL permissions on Mac OS X (Server)?

    - by mralexgray
    For years I've used the strong-armed-duo of these two suckers... sudo chmod +a "localadmin allow read,write,append,execute,\ delete,readattr,writeattr,readextattr,writeextattr,\ readsecurity,writesecurity,chown" sudo chmod +a "localadmin allow list,search,add_file,add_subdirectory,\ delete_child,readattr,writeattr,readextattr,\ writeextattr,readsecurity,writesecurity,chown" to, for what I figured was a recursive, and all-encompassing, whole-volume-go-ahead for each and every privilege available (for a user, localadmin). Nice when I, localadmin, want to "do something" without a lot of whining about permissions, etc. The beauty is, this method obviates the necessity to change ownership / group membership, or executable bit on anything. But is it recursive? I am beginning to think, it's not. If so, how do I do THAT? And how can one check something like this? Adding this single-user to the ACL doesn't show up in the Finder, so… Alright, cheers.

    Read the article

  • Problems compiling scangearmp

    - by maat
    I have already installed some missing packages, but i still get that error. Can anyone help me identify what is missing ? Thanks a lot psr@psr-EasyNote-TM85:~/Downloads/scangearmp-source-2.10-1/scangearmp$ make make all-recursive make[1]: Entering directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp' Making all in po make[2]: Entering directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp/po' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp/po' Making all in backend make[2]: Entering directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp/backend' /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I. -I./include -DV_MAJOR=2 -DV_MINOR=1 -O2 -D__GIMP_PLUGIN_ENABLE__ -D_FILE_OFFSET_BITS=64 -MT libsane_canon_mfp_la-canon_mfp_tools.lo -MD -MP -MF .deps/libsane_canon_mfp_la-canon_mfp_tools.Tpo -c -o libsane_canon_mfp_la-canon_mfp_tools.lo `test -f 'canon_mfp_tools.c' || echo './'`canon_mfp_tools.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I./include -DV_MAJOR=2 -DV_MINOR=1 -O2 -D__GIMP_PLUGIN_ENABLE__ -D_FILE_OFFSET_BITS=64 -MT libsane_canon_mfp_la-canon_mfp_tools.lo -MD -MP -MF .deps/libsane_canon_mfp_la-canon_mfp_tools.Tpo -c canon_mfp_tools.c -fPIC -DPIC -o .libs/libsane_canon_mfp_la-canon_mfp_tools.o canon_mfp_tools.c:40:17: fatal error: usb.h: No such file or directory #include ^ compilation terminated. make[2]: *** [libsane_canon_mfp_la-canon_mfp_tools.lo] Error 1 make[2]: Leaving directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp/backend' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/psr/Downloads/scangearmp-source-2.10-1/scangearmp' make: *** [all] Error 2 psr@psr-EasyNote-TM85:~/Downloads/scangearmp-source-2.10-1/scangearmp$

    Read the article

  • Fibonacci numbers in F#

    - by BobPalmer
    As you may have gathered from some of my previous posts, I've been spending some quality time at Project Euler.  Normally I do my solutions in C#, but since I have also started learning F#, it only made sense to switch over to F# to get my math coding fix. This week's post is just a small snippet - spefically, a simple function to return a fibonacci number given it's place in the sequence.  One popular example uses recursion: let rec fib n = if n < 2 then 1 else fib (n-2) + fib(n-1) While this is certainly elegant, the recursion is absolutely brutal on performance.  So I decided to spend a little time, and find an option that achieved the same functionality, but used a recursive function.  And since this is F#, I wanted to make sure I did it without the use of any mutable variables. Here's the solution I came up with: let rec fib n1 n2 c =    if c = 1 then        n2    else        fib n2 (n1+n2) (c-1);;let GetFib num =    (fib 1 1 num);;printfn "%A" (GetFib 1000);; Essentially, this function works through the sequence moving forward, passing the two most recent numbers and a counter to the recursive calls until it has achieved the desired number of iterations.  At that point, it returns the latest fibonacci number. Enjoy!

    Read the article

  • Building/Installing Required a52 Plugin

    - by user71139
    I am trying to compile and install the a52 plugin following the instructions from here: https://help.ubuntu.com/community/DigitalAC-3Pulseaudio This worked on Ubuntu 11.10 but gives me some errors when I try to compile the plugin on Ubuntu 12.04. I've searched for a solution however I couldn't find much on this topic in general, not to talk about a solution. I would really appreciate some help on this: bogdan@bogdan-desktop:~$ cd ~/tmp/ bogdan@bogdan-desktop:~/tmp$ cd alsa-plugins-1.0.25/ bogdan@bogdan-desktop:~/tmp/alsa-plugins-1.0.25$ make make all-recursive make[1]: Entering directory `/home/bogdan/tmp/alsa-plugins-1.0.25' Making all in oss make[2]: Entering directory `/home/bogdan/tmp/alsa-plugins-1.0.25/oss' /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -Wall -g -I/usr/include/alsa -g -O2 -MT ctl_oss.lo -MD -MP -MF .deps/ctl_oss.Tpo -c -o ctl_oss.lo ctl_oss.c ../libtool: line 831: X--tag=CC: command not found ../libtool: line 864: libtool: ignoring unknown tag : command not found ../libtool: line 831: X--mode=compile: command not found ../libtool: line 997: *** Warning: inferring the mode of operation is deprecated.: command not found ../libtool: line 998: *** Future versions of Libtool will require --mode=MODE be specified.: command not found ../libtool: line 1141: Xgcc: command not found ../libtool: line 1141: X-DHAVE_CONFIG_H: command not found ../libtool: line 1141: X-I.: command not found ../libtool: line 1141: X-I..: command not found ../libtool: line 1141: X-Wall: command not found ../libtool: line 1141: X-g: command not found ../libtool: line 1141: X-I/usr/include/alsa: No such file or directory ../libtool: line 1141: X-g: command not found ../libtool: line 1141: X-O2: command not found ../libtool: line 1141: X-MT: command not found ../libtool: line 1141: Xctl_oss.lo: command not found ../libtool: line 1141: X-MD: command not found ../libtool: line 1141: X-MP: command not found ../libtool: line 1141: X-MF: command not found ../libtool: line 1141: X.deps/ctl_oss.Tpo: No such file or directory ../libtool: line 1141: X-c: command not found ../libtool: line 1192: Xctl_oss.lo: command not found ../libtool: line 1197: libtool: compile: cannot determine name of library object from `': command not found make[2]: *** [ctl_oss.lo] Error 1 make[2]: Leaving directory `/home/bogdan/tmp/alsa-plugins-1.0.25/oss' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/bogdan/tmp/alsa-plugins-1.0.25' make: *** [all] Error 2 bogdan@bogdan-desktop:~/tmp/alsa-plugins-1.0.25$

    Read the article

  • SUM of metric for normalized logical hierarchy

    - by Alex254
    Suppose there's a following table Table1, describing parent-child relationship and metric: Parent | Child | Metric (of a child) ------------------------------------ name0 | name1 | a name0 | name2 | b name1 | name3 | c name2 | name4 | d name2 | name5 | e name3 | name6 | f Characteristics: 1) Child always has 1 and only 1 parent; 2) Parent can have multiple children (name2 has name4 and name5 as children); 3) Number of levels in this "hierarchy" and number of children for any given parent are arbitrary and do not depend on each other; I need SQL request that will return result set with each name and a sum of metric of all its descendants down to the bottom level plus itself, so for this example table the result would be (look carefully at name1): Name | Metric ------------------ name1 | a + c + f name2 | b + d + e name3 | c + f name4 | d name5 | e name6 | f (name0 is irrelevant and can be excluded). It should be ANSI or Teradata SQL. I got as far as a recursive query that can return a SUM (metric) of all descendants of a given name: WITH RECURSIVE temp_table (Child, metric) AS ( SELECT root.Child, root.metric FROM table1 root WHERE root.Child = 'name1' UNION ALL SELECT indirect.Child, indirect.metric FROM temp_table direct, table1 indirect WHERE direct.Child = indirect.Parent) SELECT SUM(metric) FROM temp_table; Is there a way to turn this query into a function that takes name as an argument and returns this sum, so it can be called like this? SELECT Sum_Of_Descendants (Child) FROM Table1; Any suggestions about how to approach this from a different angle would be appreciated as well, because even if the above way is implementable, it will be of poor performance - there would be a lot of iterations of reading metrics (value f would be read 3 times in this example). Ideally, the query should read a metric of each name only once.

    Read the article

  • Recursion in F#

    - by MarkPearl
    Things are slowly coming together – I was able to look at a bit of F# code and intuitively know what it was going to do (yay)… So today I saw a blog post by Bob Palmer on Fibonacci numbers in F# which inspired me to look at bit into recursion. First the C# example… class Program { public static void CountDown(int n) { switch (n) { case 0: Console.WriteLine("End of Count"); break; default: Console.WriteLine(n); CountDown(n-1); break; } } static void Main(string[] args) { CountDown(10); Console.ReadLine(); } }   In F#, the equivalent would look something like this… open System let rec CountDown n = match n with | 0 -> Console.WriteLine("End of Count"); | n -> Console.WriteLine(n); CountDown (n-1); CountDown 10 Console.ReadLine()   Pretty simple stuff. With F# you when making recursive calls you need to explicitly declare that the function is recursive with the “rec” keyword. Otherwise the code is pretty easy to read and self explanatory.

    Read the article

  • to upgrade / install wine 1.55 on ubuntu 12.04 or any distro

    - by user67550
    Wine news and installation 1.5.5 on ubuntu Now available in PPA wine version 1.55, an application that lets Windows programs run on any distribution with GNU / Linux. Wine (recursive acronym in English for Wine Is Not an Emulator, which means "Wine Is Not an Emulator") is a reimplementation of the application programming interface for Win16 and Win32 operating systems based on Unix. Allows execution of programs designed for MS-DOS and Microsoft Windows Version 3.11, 95, 98, Me, NT, 2000, XP, Vista and 7 The name was originally an acronym Wine Windows Emulator. This meaning was later changed to the current recursive acronym. These are some of the highlights: Support for the installation of Mono as a complement to wine in the package. The dither pattern brushes in the motor DIB. Support to install the runtime. NET 4.0. D3dx9 DDS files supported. Several bug fixes. To install on Ubuntu just open the console and type: sudo add-apt-repository ppa: ubuntu-wine/ppa sudo apt-get update sudo apt-get install wine1.5 Source: ubuntutips If you enjoyed this post share it with your friends, thanks

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >