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
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!!!
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.
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.
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...
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.
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.
don't use an english keyboard,
don't use a canadian keyboard and
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:
` e => è
^ e => ê
' e => é
" e => ë
` a => à
^ a => â
' a => á
" i => ï
` i => ì
^ i => î
' i => í
` A => À
' E => É
^ E => Ê
~ n => ñ
~ N => Ñ
` <SPACE> => `
' <SPACE> => '
^ <SPACE> => ^
" <SPACE> => "
~ <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...
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.
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.
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...
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);
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).
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!?
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.
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
Inside bitfast.h:
// with /* */, malloc and new[]
o rt
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
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_s
Your function should be in a file.c or be inline.
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!!!
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.
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__
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.
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.
Seriously, why not extend XHTML to support missing features?
l a
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>
blablab
<footer pos=".5in"><center>Page 2</center></page>
</page>
</body>
</html>
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.
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:
- ` e => è
- ^ e => ê
- ' e => é
- " e => ë
- ` a => à
- ^ a => â
- ' a => á
- " i => ï
- ` i => ì
- ^ i => î
- ' i => í
- ` A => À
- ' E => É
- ^ E => Ê
- ~ n => ñ
- ~ N => Ñ
- ` <SPACE> => `
- ' <SPACE> => '
- ^ <SPACE> => ^
- " <SPACE> => "
- ~ <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.
Impossible, I tough the toughest glue on earth was an ex-wife sticking her nose on 50% of a man's paycheck!
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.
>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.
In fact this is one of the regexp that I find easy to read.
/i is just for case insensitive...
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
of course, you could also rewrite it as a large sequence of small regexp if you prefer that...
For those who don't remember playing
Duke Nukem 3D, when you picked up an RPG weapon.
The player said: "Hmmmm... Groovy!"
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!
#include "stdio.h"
// my global variables
// get/set functions to access "global vars"
#include "stdlib.h"
typedef struct gamedata_s
{
} gamedata_t;
class GameData
{
public:
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;
};
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!?
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.
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!
Not working right... like killing all humans on earth!?
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