0.4.1.2e
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

0.4.1.2e

Started by PPK, 06 February, 2011, 03:52:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PPK

Windows version with GUI: http://www.ptokax.org/files/0.4.1.2e.7z
Windows x64 version with GUI: http://www.ptokax.org/files/0.4.1.2e-x64.7z
Windows service: http://www.ptokax.org/files/0.4.1.2e-service.7z
Windows x64 service: http://www.ptokax.org/files/0.4.1.2e-service-x64.7z
Source for unix systems: http://www.ptokax.org/files/0.4.1.2e-nix-src.tgz


Quote from: ChangesAdded: Column sorting to registered users list in registered users frame.
Added: Filter to registered users frame.
Added: Missing maximize icon to script editor window.
Added: Registered users window.
Fixed: Crash when script throw error on startup (thx TiMeTrAVelleR for report).
Fixed: Possible memory leak in script editor on script loading.

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

P_pan

great job PPK!  thank you!

mariner

#2
Great job, PPK, but when do you fix your spaghetti code? For example:
hashBanManager.cpp:249 uint16_t ui16dx = ((uint16_t *)&Ban->ui32IpHash)[0];

This code doesn't work on big-endian architectures. And it's fails with strict-aliasing (O2 level in g++)
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

#3
I don't have any big-endian arch for testing, so it is hard to fix something for that ::) And PtokaX don't use O2, so i have nothing to fix :P And when you want to call something as "spaghetti code" then first read what spaghetti code is  8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PPK

I'm miss that code is related to ip hashtable... in future (maybe this year) will be added tcp/ip v6 support, and for that all ip related things will be rewritten :D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

With O2 level PtokaX work faster.  I think, that's is better, then O0 level. You can fix this error easy.
hashBanManager.cpp:249 uint16_t ui16dx = (uint16_t ) Ban->ui32IpHash;
This code don't fails on O2 and O3 levels and works on big-endian arch. Keep it simple.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

PtokaX can't work faster with O2. Test with performance profiler show that most time is used in send and recv socket function. Higher optimization level can't make that faster ::)
I can't test if is really not working on big-endian, i don't see any reason why this code should fail. Number will be different, but that should be all :o
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

But this code fail. On b-e arch you code will take other part of numeric variable. So, if you have Ban->ui32IpHash less then 65536, you will have zero in ui16dx.  On the l-e arch you will have value of Ban->ui32IpHash  in  ui16dx (if value less then 65536). Read about big-endian.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

#8
Quote from: mariner on 07 February, 2011, 20:08:58
So, if you have Ban->ui32IpHash less then 65536, you will have zero in ui16dx.
And that is perfectly acceptable for me, because lower than 65536 are ip addresses below 0.1.0.0 :P That is not fail, that is how it works ;)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Snooze

Hi PPK,Will you be making x64 libs available for the x64 build as well?Libs I'm interested in:- lfs- socket- sqliteThanks,Snooze

PPK

Why me ? ::) Source for libs is available. Visual studio express is free download on ms site. I have better things to do than compile libs.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

#11
Dear PPK, compile this code and test it. You will have equal result
#include <iostream>
#include <stdint.h>

using namespace std;

int main() {
uint32_t a;
uint16_t b, c;
cout << "Insert the value: " << endl;
cin >> a;
b = (uint16_t) a;
c = ((uint16_t *)&a)[0];
cout << "Mariner code result: " << b << endl << "PPK code result: " << c << endl;
return 0;
}

Now about compilation
Quotegyrt ~ % g++ -O0 -Wall -Wextra test.cpp -o test                            9:09
gyrt ~ % ./test                                                            9:09
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:10
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:10
Insert the value:
65537   
Mariner code result: 1
PPK code result: 1
gyrt ~ % g++ -O1 -Wall -Wextra test.cpp -o test                            9:10
gyrt ~ % ./test                                                            9:10
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:10
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:11
Insert the value:
65537
Mariner code result: 1
PPK code result: 1
gyrt ~ % g++ -O2 -Wall -Wextra test.cpp -o test                            9:11
test.cpp: In function ?int main()?:
test.cpp:12: warning: dereferencing type-punned pointer will break strict-aliasing rules
test.cpp:12: warning: dereferencing pointer ?a.60? does break strict-aliasing rules
test.cpp:12: note: initialized from here
gyrt ~ % ./test                                                            9:11
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:11
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:11
Insert the value:
65537
Mariner code result: 1
PPK code result: 1
gyrt ~ % ./test                                                            9:11
Insert the value:
67000
Mariner code result: 1464
PPK code result: 1464
So, you can see, that your code fails, when we use optimizations. Futhermore, after optimization didn't work some LUA API functions.

Why do you use difficult code instead of simple?
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

Where it's that fail  ??? In all cases it is giving same values, or i'm missing something ?
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

PtokaX fails when we use flag -O2 with your code. If I use simple code from my example - ptokax works correctly. I can send you 2 binaries, compiled on Debian and you can test it.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

As you show with your example there is no fail with -O2 and your code is giving same result as my code. All what you do was wasting my time. So if you don't show any fail i will not reply to you anymore...
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

sphinx_spb

#15
Dear mariner, if you would create hub-soft better than Ptokax (i.e. more reliable, stable, maybe even without spaghetti) - I would take off my hat.
Until that, your claims looks miserable.

update:
you can also modify sources, they're still open.

PPK

Quote from: sphinx_spb on 19 February, 2011, 13:41:33
you can also modify sources, they're still open.
And that is his problem, he changed source. He switched compiler mode to complainer and bad things happen ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

#17
Quotehe changed source
With out change ptokax lua api works bad.

Check this archive. This is PtokaX for x86_32 Linux.
~/PtokaX % gcc -v                                                                                               
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)

~/PtokaX % dpkg -l G libc6
ii  libc6                                 2.7-10ubuntu8                      GNU C Library: Shared libraries
ii  libc6-dev                             2.7-10ubuntu8                      GNU C Library: Development Libraries and Hea
ii  libc6-i686                            2.7-10ubuntu8                      GNU C Library: Shared libraries [i686 optimi

In the archive you can see a script, wich send a message if you is an unregistred user. So I register user. On standart PtokaX i have no notification after I connected as registred user. After that I start PtokaX compiled with -O2 flag. And after I connected to hub I see a message for unregistred user. So after that I run a PtokaX compiled with my changes in the code. And bot didn't send any notifications for unregistred user.

PS and little forum bag  :P
QuotePtokaX.tar.gz.
You cannot upload that type of file. The only allowed extensions are jpg,gif,png,lua,rar,7z,zip,tar.gz.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

Quote from: mariner on 20 February, 2011, 16:20:00
With out change ptokax lua api works bad.
And nobody noticed it in 3 years ?
Quote from: mariner on 20 February, 2011, 16:20:00
On standart PtokaX i have no notification after I connected as registred user. After that I start PtokaX compiled with -O2 flag. And after I connected to hub I see a message for unregistred user.
First you wrote that without change lua api works bad. Second you wrote that without change it works ok.
For me it works ok, even when that script is crap.
function UserConnected(user)
	if tCfg.ShowToUnreg and not RegMan.GetReg(user.sNick) then
		ToUser(user,tMsg.Unreg)
	end
	UserMenu(user)
end

OpConnected = UserConnected
RegConnected = UserConnected


This is very bad scripting style, way how to cause PtokaX using much more cpu than is needed. Is should be something like:

function UserConnected(user)
	if tCfg.ShowToUnreg then
		ToUser(user,tMsg.Unreg)
	end
	UserMenu(user)
end

function OpConnected(user)
    UserMenu(user)
end
function RegConnected(user)
    UserMenu(user)
end
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

mariner

QuoteFirst you wrote that without change lua api works bad. Second you wrote that without change it works ok.
Without change I cannot compile ptokax with -O2 option. I upload an archive with 3 different binaries.
PtokaX_standart - ptokax from source without any changes.
PtokaX_O2 -  compiled with this g++ flags  -O2 -fomit-frame-pointer -fstack-protector
PtokaX_modified - PtokaX with changes source and compiled with g++ flags  -O2 -fomit-frame-pointer -fstack-protector

PtokaX_standart: Lua API works good but has no optimizations.
PtokaX_O2: PtokaX works faster, but has problems with lua API.
PtokaX_modified: Lua API works good and has some optimizatoins.

Just test it!

Why didn't you want to change code with warnings? I don't understand it. Futhermore, O2-option is a standart flag in many Linux Dists.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

#20
PtokaX compiled from my source don't show any warning (i'm compiled 0.4.1.2e on debian lenny and debian squeeze before release). PtokaX compiled from my source is working correctly (you wrote that multiple times). If you don't want problems then don't modify my source. Source was released to allow users to compile PtokaX on theyr os, not to allow them to modify it and then complains that it is not working correctly because they are stupid and change something that they shouldn't >:( And no, PtokaX is not working faster with -O2, because when he is working faster (as old 0.3.3.x versions), then big hubs can't run on it (faster data sending -> PtokaX will use all upload on startup when is sending userlist to new users -> when all upload is used then many users is disconnected randomly -> they connect again -> again all upload is used -> again drop... neverending story with bad end).

When you want lower cpu usage, then use better scripts. Not crap like that one from your archive :-X
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

bastya_elvtars

I think anyone can contribute patches. It is however better to have conversations in a nice manner, unlike the first comment regarding this spaghetti stuff. Oh and nice snippet, Mutor. ;-)
Everything could have been anything else and it would have just as much meaning.

mariner

It's my last proof for PPK. This is test programm, compiled on mips (be arch). System - debian lenny
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

PPK

Proof that it is working correctly. And you always don't understand how it is working :-X
Is really simple. On little ending it is getting number from second part of ip (0.0.x.x), on big endian from first part of ip (x.x.0.0). That is how it was designed and as you show how it is correctly working  :P
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

bastya_elvtars

Quote from: Mutor on 20 February, 2011, 16:57:25
There is nothing wrong with the Lua API.
To be most efficient make as few API calls as is required.
Consider streamlining your code. For example the user.iProfile
is available in the connect arrivals, there is no need to call RegMan.

Totally agree. As a rule of thumb, make as few function calls as possible in order to have fast code. Table lookups are cheap, function calls aren't.
By the way, ain't UserConnected only called when an unregistered user enters?
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk