Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - jWeb

#121
Huh? The coca happened here?
#122
Just include "Hacking Allowed" into your server name and I promise you that your server will be full of bots.
#123
Quote from: Thijn on Oct 12, 2016, 07:12 PMI'm not sure what your question is

Was there ever a question? It's just a topic so that something can be debated. Doesn't have to be anything specific. Just something where you can post when you get bored. Anyway, I'll start first:



Cool bro. But what's setting default values to members when constructor already for all instances because the system load would already overwrite INI:
Open = ::INI_Open(File);
  File = ["????????.ini", "????????.ini", "????????.ini", "????????.ini"]; 
  Close = ::INI_Close(File);

Also, return close does not close because if you close then you open too.

Also, the system is a nice system. This system could help the system when you load and because INI is function you can use tables. I heard You can tables because only single inheritance is to do in Squirrel.

Also, for INI to load INI does not help because Squirrel crash when you use pointer as array `return Open[1];`.

Also, do not forget the system.
#124
Off-Topic General / Re: mysql or sqlite
Oct 11, 2016, 06:55 PM
@Thijn My point was that the results of initial posted benchmark did not reflect the true performance that can be obtained through SQLite. I'm not saying that SQLite is better or worse. What I'm saying is that in the case where performance is your true goal, that you should strive to actually use an efficient implementation. Instead of writing some plain code and expecting it to run fast.
#125
Off-Topic General / Re: mysql or sqlite
Oct 11, 2016, 10:26 AM
@Doom_Kill3R That benchmark is a bit misleading because it's limited by the official SQLite plugin. Had you been using transactions, the situation would've been entirely different. Not to mention that the test itself is flawed because it does not decrease the time from previous operations from the time of current operation. Therefore, the current operation time also includes the sum of all previous operations.

Here's the SQLite test translated to a plugin that takes advantage of the features that SQLite has to offer:


function sqlite()
{
    local t = SqTimer();

    print( "SQLite Benchmark" );
    printf( "Start: %dms", t.RestartRaw() / 1000);

    local db = SQLite.Connection("test.sqlite");
    printf( "Connection made: %dms", t.RestartRaw() / 1000 );

    db.Exec(@"CREATE TABLE IF NOT EXISTS `benchmark` (`testInt` INTEGER, `testChar` TEXT, `testFloat` REAL);");
    printf( "Table made: %dms", t.RestartRaw() / 1000 );

    {
        // Pre-compile the query
        local query = db.Query("INSERT INTO `benchmark` (testInt, testChar, testFloat) VALUES(@testInt, 'test string omfg', 123456.789);");
        // Cache the parameters
        local p_testInt = query.Param("@testInt");
        // Begin transaction
        local transaction = SQLite.Transaction(db);

        for( local i = 0; i < 10000; i++ )
        {
            query.Reset(); // Reset the query
            p_testInt.SetInteger(i); // Update parameter value
            query.Exec(); // Execute query
        }

        // Commit changes
        transaction.Commit();

        printf( "10.000 records inserted: %dms", t.RestartRaw() / 1000 );
    }

    {
        // Pre-compile the query
        local query = db.Query("SELECT * FROM `benchmark` WHERE `testInt` = @testInt;");
        // Cache the parameters
        local p_testInt = query.Param("@testInt");

        for( local i = 0; i < 10000; i++ )
        {
            query.Reset(); // Reset the query
            p_testInt.SetInteger(i); // Update parameter value
            query.Step(); // Step query
        }

        printf( "10.000 records selected: %dms", t.RestartRaw() / 1000 );
    }

    print( "SQLite finished." );
}

sqlite();

Output (time is in milliseconds):
[USR] SQLite Benchmark
[USR] Start: 1ms
[USR] Connection made: 1ms
[USR] Table made: 79ms
[USR] 10.000 records inserted: 150ms
[USR] 10.000 records selected: 4353ms
[USR] SQLite finished.

The kind of impact that transactions bring to the table when you insert and also using pre-compiled queries and cached parameters to the overall performance.

Although, I'll have to also run the MySQL benchmark so you can have a point of reference. But still, the difference is quite dramatic, don't you think?

And there's still a lot more to optimize in that benchmark.
#126
Community Plugins / Re: SimpleIni
Oct 11, 2016, 12:02 AM
I know we're going off topic here and the posts will most likely get removed, but I had to highlight this portion of code:
Quote from: Mötley on Oct 10, 2016, 11:41 PM local ip = player.IP.tostring();
local sliceip = split( ip, "." );
local ip1 = sliceip[ 0 ], ip2 = sliceip[ 1 ];
local subnet = format( ip1 + "." + ip2 );

player.IP is already a string. What's the point of format()?  What's the point of creating `ip1` and `ip2` variables? Actually, I don't even wanna know.
#127
General Discussion / Re: TF?
Oct 10, 2016, 09:27 PM
Attachments are not enabled, it's as simple as that. Use an external direct link to specify your avatar.
#128
Sure, think of them as namespaces. Although, if you want to access it in other files, you might want to make it global `Peripheral <- {  };`
#129
If you're all so attached to using INI, this one seems to have built in INI functionality.

Assuming this test.ini file:
[test]
name=squirrel
age=19
ratio=2.3
active=false

[option]
max=99
count=322153

With code:
local document = SqIni.Document();
local result = document.LoadFile("test.ini");

if (!result.Valid)
{
    throw "cannot load ini file";
}

print(document.GetValue("test", "name", "unknown"));
print(document.GetValue("test", "n@me", "unknown"));

print(document.GetInteger("test", "age", 17));
print(document.GetInteger("test", "ag3", 42));

print(document.GetFloat("test", "ratio", 4.3));
print(document.GetFloat("test", "rtio", 1.34));

print(document.GetBoolean("test", "active", false));
print(document.GetBoolean("test", "act!ve", true));

print(document.GetInteger("option", "max", 0));
print(document.GetInteger("option", "count", 0));

document.SetValue("test", "name", "mikado");
document.SetInteger("option", "stage", 27);

result = document.SaveFile("test2.ini");

if (!result.Valid)
{
    throw "cannot to save ini file";
}

Outputs:
[USR] squirrel
[USR] unknown
[USR] 19
[USR] 42
[USR] 2.3
[USR] 1.34
[USR] false
[USR] true
[USR] 99
[USR] 322153

And results with test2.ini file:
[test]
name = mikado
age = 19
ratio = 2.3
active = false


[option]
max = 99
count = 322153
stage = 27

Everything seems to work fine, there are no bugs, and most features are available. Which means, that it's your fault for choosing the wrong tools to work with in the first place. Using deprecated software and expecting to work flawlessly.
#132
Quote from: Thijn on Oct 09, 2016, 04:28 PMPeople actually still play this?

Considering how sh!ty and boring this game was even from day 1. I'm still surprised some people even played it a month later. Playing this now is just... wrong.

There's absolutely nothing fun about this game. You just walk around with your phone and swipe your screen.
#133
What dafuq just happened? :-\

*Wipes mouth after puking from that code.

Missing portions of the code, context, intention and altered syntax/signature, weird style. How do you expect anyone to understand anything here?

`onclientscriptdata` is only called with a player instance. How did you manage to fart the rest of the parameters and what they mean is beyond me.
#134
RIP Documentation
RIP Debugging
RIP Common Sense
#135
Sprites and Textdraws have been removed. Which means that some critical limitations from that implementation have also been removed. However, the code worn't work without changes to deal with the lack of Sprites and Textdraws. At least from what I see in the code and the fact that it was posted a long time ago.