Slashdot Mirror


User: fprog26

fprog26's activity in the archive.

Stories
0
Comments
20
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 20

  1. Memory leaks... on Sort Linked Lists 10X Faster Than MergeSort · · Score: 4, Interesting

    Inside bitfast.h:
    long *Tail = new long[65535];
    long *Head = new long[65535];

    for(n = 0; n < 65535; n++){ Head[n] = 0; Tail[n] = 0; }

    Memory leak of 128KB for each time the function "Node* BitFast(Node* HeadNode,long run)" is called.

    MISSING: delete[] Tail; delete[] Head;

    Furthermore the following is faster or use memset:
    long Tail[65535] = {0};
    long Head[65535] = {0};

    Unless you are running this in DOS16, DOS32 with Pharlap or smaller 8051, 68000 processor, you do not need to use new[] or malloc() for this.

    In InsertToList, Node *tmpP = (Node*)malloc(sizeof(Node));
    free(tmpP) missing inside FreeList()... no such function

    In main.c:
    Node *L1 = malloc(sizeof(Node));
    Node *L2 = malloc(sizeof(Node));
    MISSING: free(L1); free(L2);

    In main.cpp:
    Node *L1 = new Node;
    Node *L2 = new Node;

    Instead use (no need to use heap, use stack memory):
    Node L1 = {0}, L2 = {0};

    Mixing the usage of std::cout and printf() is not recommanded.
    Use all of the former or the later, else you will have weird display on some run, unless you flush the output buffer. I suggest you use printf() all the way.
    cout << "Ok!!!!" << "\n\n" << "Merge Sort : " << tim1 << " ms\n" << "BitFast : " << tim2 << " ms\n\n";
    becomes:
    printf("Ok!!!!\n\nMerge Sort : %ld ms\nBitFast : %ld ms\n\n", tim1, tim2);

    Furthermore, your implementation of link list, and calling Length(Node*) for every equal is highly inefficient, requires O(n). Store the link list length somewhere when inserting. EqualSplit takes O(1.5n) instead of O(0.5n) because of that.

    Something like:

    typdef struct LinkList {
      Node  head;
      int   length;
    } LinkList;

    As a result, MergeSort recursively call itself, which calls EqualSplit every turn.

    You should make your header file C friendly, and avoid mixing // with /* */, malloc and new[]

    No clue why this header is needed:
    #include <iso646.h>  instead of not/and use use ! and &&
    before:  if(not p) return NULL;
    becomes: if(!p) return NULL;

    Finally, BitFast is not recursive; therefore, you should try to find an implementation of merge sort which is not recursive also, so you save on function calls, if possible.

    "However, iterative, non-recursive, implementations of merge sort, avoiding method call overhead, are not difficult to code." -- Wikipedia

    http://en.wikipedia.org/wiki/Merge_so rt

    Your function should be in a file.c or be inline.

  2. Colourful linux kernel... on Linux Kernel 2.6.20 Released · · Score: 1

    Technically speaking, "Linux" only referes to just the kernel. So there won't be any pretty colors or music to listen to with just a kernel (unless you're on LSD).

    Well, I'm not running BSD, but technically speaking, when you boot the kernel,
    you see all those amazing color, like green [OK] and sometime some red [failed]...
    and yellow and sometime some penguin in the corner...
    Sometime you can listen to the beeping music it does when it panics!

    Sorry to hear that you have only a speaker less monochrome booting console!!!

  3. GPL is BAD on Sun To Choose GPL For Open-Sourcing Java · · Score: -1, Troll

    You cannot GPL Java, if you do, then ***ALL*** the business applications
    that are created using Java will have to ***PAY*** a license fee to use it.
    PERIOD.

    That's BAD news..... REALLY BAD NEWS!

    Think ***Trolltech Qt***.

    The LGPL license would be much better.

  4. Solve it, Fixed version on Wicked Cool Perl Scripts · · Score: 2, Interesting

    Your solution was a bit too C++ and won't compile with perl, so you probably meant the following... :)

    #!/usr/bin/perl
    #
    # Program -- Solve it -- Solves the worlds problems.
    # All of them. At once.
    # This will be a great program when I finish it.
    #

    sub main()
    {
    # no idea at all...
    }

    main();
    exit;
    1;
    __END__

    or the even better, the POD way:

    #!/usr/bin/perl

    =head1 GOAL
    Program -- Solve it -- Solves the worlds problems.
    All of them. At once.
    This will be a great program when I finish it.
    =cut

    sub main()
    {
    # no idea at all...
    }

    main();
    exit;
    1;
    __END__

  5. Word MHTML format and CVS/Subversion on Document Management and Version Control? · · Score: 1

    I would suggest Word HTML or MHTML web format, it's viewable in Internet Explorer,
    you can always put a PDF output on your website like we do for stable releases.

    It's easy to edit with any HTML editor and also directly from Word.

    You can easily convert your Word document to HTML using MS Office 2000 and up.
    Only glitches are small caps and some stuff like that, that won't render properly
    but they are work-arounds, like typing the "small caps" in capital letter in a smaller font.
    These should be solve with CSS3/CSS-print and similar.

    Doing diff on HTML is easy. Using CVS or subversion or similar on HTML is easy.

    If you want a portable printable format, you can print from MS Word
    using PDFCreator to create a PDF of "stable releases".

    Furthermore, you get all the feature of cvsview and similar program.

    BTW, this doesn't stop you of using Microsoft Word and SharePoint if you wish so.

    I never understood why people push OpenDoc, WordML and similar,
    when good old HTML4 with CSS3 does the same job.

    Just my 2 cents.

  6. Virus Spreading Problem... on First StarOffice Virus Sighted · · Score: 1

    The problem may not really be the "payload" as in deleting $HOME,
    which would be annoying or disrupting if you don't rsync, tar or backup it.

    But the fact that someone could maybe abuse it, and start "replicating"
    by sending itself via sendmail or whatever or replicating to all your OO.org documents.
    Think I LOVE YOU virus or similar or maybe I'm just too outlook oriented.

    What's more stupid is that a script kiddy would simply take this proof, take some word/excel virus and simply adapt it...

    I think it is stupid to provide such insecure macro thingy; moreover, displaying a proof of concept to everyone,
    before a CERT is release to the OO.org developer or similar...

    Just my 2 cents.

  7. Why not extend XHTML to support missing features? on OpenDocument Voted In By ISO · · Score: 1

    Seriously, why not extend XHTML to support missing features?

    Why do we need another OpenDocument, OpenXML syntax?

    Like Groklaw pointed why do we need another XML syntax? when people know XHTML/CSS already?

    MS Office can already support HTML for Word and Excel, very nicely.
    It would be much easier to make Microsoft accept a new version of XHTML,
    then to adopt something awkward like OpenDocument.

    The only thing missing are better CSS export for custom types, individual page settings, printer setup, page margin, small caps support, font kerning, MathML and embedded SVG support.

    I guess this is too simple:

    <html><body>
    <page width="8.5in" height="11in"
    margin="1in,1in,1in,1in">blablabla
    <footer pos=".5in"><center>Page 1</center></page>

    <page width="11in" height="8.5in"
    margin="1in,1in,1in,1in"><header pos=".5in"><center>Confidential</center>
    blablabl a
    <footer pos=".5in"><center>Page 2</center></page>
    </page>
    </body>
    </html>

  8. Re:Yes. on Easing Compatibility Between OpenOffice, MS Office · · Score: 1
    In French it's even more obvious. For example before a colon or a semicolon you insert a thin space. in addition to the ASCII character set there are numerous accented characters in use, including capitals (which the braindead French keyboard makes difficult to enter, moreso in Windows where apparently you're supposed to memorize character codes).

    Wrong. If you want something easy, use a US-International keyboard!
    Also known as "keyb br" for brazilian under old DOS6. Especially, if you are 'tired' of switching mode all the time.
    1. don't use an english keyboard,
    2. don't use a canadian keyboard and
    3. don't use a french keyboard either.


    Basically, with that settings you can type as you would using an English keyboard except that the following keys:
    ` ^ ' " ~ are accentuated characters!

    As a result, the followings are easily typable:
    1. ` e => è
    2. ^ e => ê
    3. ' e => é
    4. " e => ë
    5. ` a => à
    6. ^ a => â
    7. ' a => á
    8. " i => ï
    9. ` i => ì
    10. ^ i => î
    11. ' i => í
    12. ` A => À
    13. ' E => É
    14. ^ E => Ê
    15. ~ n => ñ
    16. ~ N => Ñ
    17. ` <SPACE> => `
    18. ' <SPACE> => '
    19. ^ <SPACE> => ^
    20. " <SPACE> => "
    21. ~ <SPACE> => ~
    No more messy, english -> french, especially when Windows decide to change your keyboard settings every 3 seconds, because it thinks it knows better than you...

    My 2 cents.
  9. Impossible on The World's Strongest Glue · · Score: 1

    Impossible, I tough the toughest glue on earth was an ex-wife sticking her nose on 50% of a man's paycheck!

  10. Try a real 50+ MB MySQL DB Test on MySQL to Counter Oracle's Purchase of InnoDB · · Score: 1

    Connection speed and non-transactional ?

    Maybe for a small site.

    Try MyISAM or InnoDB.

    Now create a table with 30 fields:
    userid : int, dataid : int, subdataid: int, someparam : int, a bunch of varchar(30), varchar(255), with 3 of them as FULL TEXT with index.
    Create an index for any where clause field.

    Now take this table, insert 1...50000 rows with incremental data and some field being identical.

    Now create 10000+ rows with the same userid, and a mixture of dataid/subdataid, being equals, like this, (1,1,1), (1,1,2)...(1,1,1000),(1,2,1)...(1,2,1000)... you get the idea.

    Make sure, the RAW DB file is at least 50 MB.

    Now do 6 queries that looks like this:

    select * from test where userid=1
    and somevarchar likes 'test%'
    and somevarchar2 likes 'foo%'
    and someid > 10;

    and let it crawl.

    HTML page load time 30 seconds and up.

    MySQL is great for small sites, but it doesn't scale up.
    We encountered this problem on our LAMP server, when we added a *busy* site to our framework and the busy site was producing 10,000 hits per day... We had to move the site to a new server... with PostgreSQL.

    BTW, I did some similar test with Oracle10g and PostgreSQL 8.1, I couldn't see much difference apart that Oracle seems to create indexes by itself and it cost 45K$ per processor, unless you buy a Dell/Oracle server blade deal.

    You can try Oracle10g from http://otn.oracle.com/

    The only fact that I will agree with you is:
    MySQL Cluster seems to rocks [never test it myself],
    but our friend Google seems to be using it a lot.

    Of course, if your website has less than 1000 hits per month, like almost everyone here, there's no point between MySQL/PostgreSQL, use whatever you want.

  11. Maybe Linux.... on Next Generation Chip Research · · Score: 1

    >Does it runs windows ?

    Nope, but it runs on Linux tough!

    ROTFL

    No Joke, but you could:

    1. Volunteer yourself,
    2. Buy this Titanic II TRIPS chip,
    3. Port GCC to it,
    4. Compile Linux,
    5. Be an hero!
    ???
    6. Sorry, No profit.

  12. Large regular expressions are simple and ugly... on Microsoft's Bold Patent Move · · Score: 2, Informative

    In fact this is one of the regexp that I find easy to read.

    For those who don't like Perl, the same regexp
    is also valid for PHP, Python, Ruby, Java or JavaScript or Qt3.

    Just get rid of the ?: which is just there to say
    that the parenthesis should not be "tagging".

    Basically, it's just a condensed enumeration of all possible numbering nouns with a bunch of -OR- operator all over the place with repetition where the language makes sense.

    and the /i is just for case insensitive...

    of course, you could also rewrite it as a large sequence of small regexp if you prefer that...

  13. Just one thing to say: Hmmmmm Groovy !!! - Duke3D on Microsoft to Acquire Groove Networks · · Score: 1

    For those who don't remember playing
    Duke Nukem 3D, when you picked up an RPG weapon.

    The player said: "Hmmmm... Groovy!"

  14. It's easy! on Randal Schwartz's Perls of Wisdom · · Score: 2, Insightful

    It's not difficult to read at all; however, you wrote it in backward perl syntax with implicit variables. It's easy. It prints a concatenated list of prime numbers between 2 and 100 with no delimiter.

    So, let's rewrite this program without implicit $_ variable, without && comparision and with a temporary variable.

    for my $number (2..100)
    {
    my $unary_string = (1 x $number);

    if ( $unary_string !~ m/^(11+)\1+$/ )
    {
    print $number;
    }
    }

    Which is quite readable now.

    For all numbers between 2 and 100. Take that number convert it into UNARY format. Now, if it doesn't match recursively the first set of ones (at least 2) with the trailling set of ones having the same number of ones (at least once).

    So basically the matching algorithm is like this:

    2 11 insufficient
    3 111 insufficient
    4 11 11 matched 4
    5 11 1 11 mismatch
    6 111 111 matched 6
    7 111 1 111 mismatch
    8 1111 1111 matched 8
    9 111 111 111 matched 9
    10 11111 11111 matched 10
    11 11111 1 11111 mismatch

    It seems to test for prime numbers...

    If it's not a non-prime number since no match is found it prints the number without any delimiter on stdout.

    Conclusion:

    If I was to write this script with this "algorithm", I would write it like this:

    #!/usr/bin/perl -w

    # Print prime numbers between 2 and 100 by converting it into unary format and by testing for matching multiple pairs of double ones or more.

    for (2..100)
    {
    my $unary_string = (1 x $_);

    print if ( $unary_string !~ m/^(11+)\1+$/ );
    }

    BTW, writing a program in C to test for prime number would be quite more complicated!
    Especially if you use this algorithm without a regexp library!

    Enjoy!

    Fred.

    - Long life to Perl!

  15. Implementation on Object-Oriented 'Save Game' Techniques? · · Score: 1

    #include "stdio.h"
    #include "stdlib.h"

    typedef struct gamedata_s
    { // my global variables

    } gamedata_t;

    class GameData
    {
    public: // get/set functions to access "global vars"

    GameData()
    {
    pFile = fopen(fname, "r+b");
    memset( &data, 0, sizeof(data) );
    }

    virtual ~GameData()
    {
    if (pFile)
    fclose(pFile);
    }

    int seek( size_t game_no )
    {
    long offset = game_no * sizeof(data);
    return fseek(pFile, offset, SEEK_SET);
    }

    int load()
    {
    return fread(&data, 1, sizeof(data), pFile);
    }

    size_t save()
    {
    return fwrite(&data, 1, sizeof(data), pFile);
    }

    private:
    static const char* fname = "gamedata.bin";
    FILE* pFile;
    gamedata_t data;
    };

  16. Re:I can't wait for... no NDA specs and drivers! on NVIDIA Gives Details On New GeForce 6 · · Score: 1

    Maybe it would be time now for them to release the specs for GeForce2 MX, GeForce 3 and similar,
    so we can finally develop drivers for more operating systems/platforms!?

  17. How to make virus works on Linux... on Linux in Canada · · Score: 1

    Have uncle bob have his root password in the "KWallet Password manager", because it so more convenient...

    Make Konqueror use some KPart plugins or KIOslave
    like those for cmd or apt-get,
    have a web page that "FORCE" the user to say "YES",
    launch apt-get or cmd with sudo and do some damage.

    Another way would be to fool the user to enter his root password.

    Don't worry experience shows that people are easy to trick.
    Just think about how many people have all those junks like weather thingy,
    internet time synch and similar.

    And for those not realising VBA on KDE is replaced with JavaScript,
    KJSEmbed can do enough harm via DCOP,
    if misused properly much like VBA can do on Windows, so please.

    I never said that it's not convenient,
    much more like VBA was convenient on Windows or WScript for such matter.
    The 'real' problem is educating 'dummy users' who just install, click, accept anything on their box,
    if they do it on Windows... don't worry they will do the same thing on Linux.

    People who don't apply security patches for Konqueror or the Linux Kernel will be as
    problematic as those who don't apply 6 month old
    security patch on Windows and that still get CodeRed infected.

    I know Linux tends to release patch faster and such, but for 'dumb uncle bob' that might
    not save him from some worms that exploit some bug in some Linux applications.

    Let's assume there's a root exploit bug in Konqueror or X11 or KDE.
    Let's assume there's a patch.
    Let's assume user bob, don't know what's a patch, he ask neighboor's X once every 6 months when his in trouble or things get screwed up.
    Let's assume some guy wrote some rootkit exploitable program for that bug as a "convenient" example NOT to be used.
    Let's assume some ScriptKiddie find that webpage and say cool, let's make some worm, just to look cool at school among his geek friends.
    So, he write some worm make use of KJSEmbed, DCOP or whatever he might find
    and send the thing as an innocent HTML attachement to a bunch of people randomly.

    Guess what happened?

    But yeah Linux can't get virus...
    it's just more tricky to trick people out, but not impossible.

    So, think twice!
    You can have easy-to-use, features or security, pick any two.

  18. Free ACM paper here on The New Linux Speed Trick · · Score: 1

    Anticipatory scheduling:
    A disk scheduling framework to overcome deceptive idleness in synchronous I/O (2001)

    Sitaram Iyer, Peter Druschel
    18th ACM Symposium on Operating Systems Principles

    ACM portal

    Using the old citeseer trick, you can read the PDF version here:
    Citeseer paper version
    PDF version

    Don't SLASHDOT citeseer!
    There is more than one citeseer mirrors, use google:
    Google Citeseer paper search

    Enjoy!

  19. Re:Skynet on Speculating About Gmail · · Score: 1

    Not working right... like killing all humans on earth!?

  20. Re:Is my calendar wrong?! on Microsoft WiX Code Released to SourceForge.Net · · Score: 1, Troll

    1. First they laugh at you; 2. then they ignore you; 3. then they fight you; 4. ???? 5. then they embrass you; 6. then they say they did it first? 7. then they win!? 8. profit! - OR - 4. then you win ? 5. profit! Where are we at!? Who would have ever tought that Microsoft would have released software on Sourceforge? Just a guest: How many FOSS projects will "instantly" change from SourceForge.net to Savanah.gnu.org just to NOT reside their project on the same server as Microsoft ? =P