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.


Messages - Stickly Man!

Pages: [1] 2 3 ... 67
1
Off-Topic / Re: Learning Python
« on: January 10, 2017, 09:49:52 AM »
Double post, but I wanted to keep this very separate.

PHP pop (trick) quiz! The following snag happened at my workplace, in a much larger and more complex block of code. Look at the following PHP code and write down what you think the result of (a) (b) and (c) should be, without running the code directly. Now check your results with the actual results below, and run the code yourself if you don't believe me. Can you figure out what when wrong and why?
Code: PHP
  1. $a = ['one', 'two', 'three'];
  2.  
  3. foreach ($a as &$number) {
  4.   if ($number == 'one') {
  5.     $number = 'test';
  6.   }
  7. }
  8.  
  9. // (a) What is the value of $a?
  10.  
  11. foreach ($a as $number) {
  12.   // (b) What is the value of each item in array $a?
  13.   var_dump($number);
  14. }
  15.  
  16. // (c) What is the value of $a again? (Sanity check)

Actual results! Copy the following lines to a separate text editor:

(a) = ['test', 'two', 'three']
(b) = "test", then "two", then "two" ..?
(c) = ['test', 'two', 'two'] ...?


Answer and explanation:

(a) is as we expect, because the point of the first loop is to replace any string "one" with "test".
(b) Now we do a "read only" foreach of $a to print each value separately, but specifically, our last value changed from "three" to "two"! How did that happen?
(c) After doing that "read only" foreach, our original array has been modified with the bad value. Why?

This is all caused by PHP's lack of proper variable scope, made worse by variable references.

On the first foreach, note that we use a reference for $number, as noted by the ampersand &. This makes it so when we set $number directly in the line below, the change gets passed along to the original array. If we didn't have that ampersand, the first foreach would effectively do nothing.

Now, since there is no function scope, PHP treats that &$number variable as if it were created at the top of the entire block of code. This means when we reuse the variable $number in the second foreach, it's stuck as being a reference to the last object in the array (where it was left at after the first foreach completed). So, as PHP internally sets $number throughout the second foreach, it's actually modifying the last value of array $a.

The best solution? Change the variable name of $number in the second foreach to something else. Yup. Thanks PHP.


2
Off-Topic / Re: Learning Python
« on: January 10, 2017, 09:26:10 AM »
Having used PHP professionally for a few years all I can say is.. PHP is a mess and avoid it if at all possible. :P  The following rant is, well, a rant, but it brings up some very good TECHNICAL reasons why PHP is inconsistent. Also note that it is a bit dated- some concerns have been addressed especially as of PHP 7
https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

However, it is nice in that you can get something up and running with fairly minimal effort. PHP is very beginner friendly, and they have built in libraries and functions that cover most of the common needs in web development. Plus, it is widely used in the industry, so as bad as it may be, it's useful to know.

(On topic) We also use Python at work, and while I haven't been working on projects that use it, I've heard good things, especially form Zyklus. :)

3
Glad I could help you figure it out!

<offtopic>Huh, nice visualization.
I wonder how hard text-based graphing, especially in Lua, would be. Having a ULX command to draw the inheritance tree to console or something would be useful in visualizing branching inheritance trees like the above.</offtopic>

The whole concept of auto-generated graphs via text descriptions is a fascinating one to me, but it is pretty complex. We do actually have ULib.ucl.getInheritanceTree that you can use with PrintTable as a poor man's graph though. This website uses Graphviz, I highly recommend checking it out and trying it out on a Linux box.

Stickly, for ULX 4, I want that data text visualization method incorporated into XGUI.
So basically, I could take groups like that, drag/drop the ovals in between, and have XGUI adjust the inheritance like so.
Imagine Scratch programming language, but, for XGUI and group management. Snap.... click .. inherit set .. can_target default to not above.
:P

Mmm... That would be nice. Complex to implement, but very nice!

4
Off-Topic / Re: Rank Image Issue
« on: December 22, 2016, 08:40:54 AM »
This feature is not a part of ULX or ULib, but likely a part of DarkRP or an addon for it.

5
Here, let me help you visualize the issue:


This is what we mean when we say "inheritance branching"- all of your groups are not connected in a single line. The ULX targeting system does not work well with these kind of setups, unfortunately. It's a known limitation we plan on addressing in ULX 4.

The reason why this doesn't work is, well, let's focus on your can_target for 'dtrialmoderator'. Currently, you have it set to '!%moderator', which means that 'dtrailmoderators' can't target anyone in the group moderator, or any group that inherits from moderator (this is what !% does, the ! just inverts it). So in your terms, it's saying "dtrialmoderator can't target moderator and dmoderator". However, this says nothing about operator, noaccess, or any of your other groups.

Now, you would think you could just specify '!%moderator,!%admin' so that 'dtrialmoderator' can't target moderators or above AND admins and above, but the comma is a SET UNION operator (in terms of players you can target), and the end result is that they cancel each other out, and they'll be able to target anyone.


So, the first (less messy) solution would be to line up all of your groups so they inherit in a single line. This obviously puts some restrictions on which levels you give access to for certain commands (e.g., if you were trying to put operator between donator and trialmoderator, but you wanted operator to have a specific command that you don't want trialmoderator or higher to have, and you don't want operator to have all of the commands that trialmoderator has). But, you can work around that problem by using groupdeny: In my example, you would give operator the command you want, then groupdeny that command at the trialmoderator level.


The other solution which allows you to keep this branching inheritance requires you to manually specify and maintain a list of groups each group can target. It's a bit tedious to set up, and even more tedious to maintain if you change your group structure, but it is fairly straightforward. Basically, for each group, you just keep a list of all of the groups you want to target using the # operator. To get you started:

Code: [Select]
user: ^
noaccess: ^
This will let user and noaccess (if you want) to only target themselves.

Code: [Select]
operator: #user
donator: #user
admin: #operator,#donator,#user
trialmoderator: #donator,#user
dtrialmoderator: #trialmoderator,#donator,#operator,#user
moderator: #dtrialmoderator,#trialmoderator,#donator,#operator,#user
dmoderator: #moderator,#dtrialmoderator,#trialmoderator,#donator,#operator,#user
admin: #dmoderator,#moderator,#dtrialmoderator,#trialmoderator,#donator,#operator,#user
... and so on.

6
Off-Topic / Re: EDM fans - constructive opinions/reviews wanted
« on: November 07, 2016, 08:23:15 AM »
Disclaimer(s): This turned to be more of a rant than I intended. I have a general negative view towards popular "EDM" (much like pop music), mostly because the music I most enjoy is stuff that is unique, creative, and/or I can tell that the artist actually put some effort into it and are not just trying to copy the current "trends".

That being said, digging through this guy's collection, the "Feel Good Mix" and "Charlotte Competition Mix" seem to be just mixes of other peoples work (he likely has some original work/remixes in there, but with no tracklist I can't tell). This tells me that he is a DJ turned music producer (see below).

The rest of his stuff is originals or (mostly) remixes- Out of all of those, the remixes are my favorite since there's more melody to them (he seems to like the Trap genre, which I am not keen on), but those melodies come from the original artists, and likely not from this guy. (Side rant: I've seen far too many "remixes" that are literally HEAVY BASS AWESOME PART then short break of pretty much a copy of a verse from the remixed song, followed by buildup, followed by more COMPLETELY UNRELATED HEAVY BASS AWESOME PART THAT SOUNDS NOTHING LIKE THE ORIGINAL SONG. lol).

Anyways, mostly this is me ranting about what I like. :P But, my honest opinion: I just see another EDM artist jumping on the bandwagon. He seems to do more DJing than music production, but in this industry, in order to be a "successful" DJ, you have to have your own music, so I've seen a lot of small name DJs attempt to make their own music, to mixed results.

Side recommendation: I've always enjoyed BT as an artist, because he does what he wants to, and really knows his way around audio technology and coming up with new sounds. Sure, not all of his music is instant-danceable-party-time (which you just need sometimes ;) ) but, the uniqueness keeps me coming back and listening to it year after year. For reference, here's two new "tracks" on his upcoming (unnamed) "experimental" album. Set aside a good chunk of time to listen to each whole track if you can:
BT - ? (Ohm. Apparently our forums do not support unicode in posts?)
BT - Artifacture

And a couple other links if you want to dig around more:
BT - 13 Angels on my Broken Windowsill (Also "experimental", but very dubsteppy)
BT - A Song Across Wires (Album Sampler) (A few tracks from a more 'mainstream' album)

Side recommendation #2: To bring this thread sorta back on topic, 'Savant' is an artist that has some pretty neat super bassy type stuff. Haven't dug through too much of his stuff, but I like most of what I hear:
Savant - Butterfly
Savant - Fat Cat Shuffle

7
Developers Corner / Re: Command for ulx bring all
« on: October 31, 2016, 10:13:47 AM »
Nice work, Timmy! ;D

8
Off-Topic / Re: Know Python?
« on: October 04, 2016, 08:01:14 AM »
You should check out Windows Subsystem for Linux, AKA Bash (Ubuntu) for Windows:
https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

There are probably some underlying concerns with using this to solve your problems (security, not sure if linux daemons/processes run in the background unless you have a bash window open), but it's pretty fun to play around with, and it at least lets you get something set up right away. ;)

9
Developers Corner / Re: Recommended FTP clients
« on: October 03, 2016, 01:36:20 PM »
I believe WinSCP will save the file as a temporary file (something like 'Avn23b.tmp'), which once the transfer is complete, is renamed and replaces the original file. This might explain the two auto-refreshes that are triggered.

I've never run into this issue in Gmod per se, as I run a local scrds instance for development on my windows machine.

10
General Chat & Help and Support / Re: fban and xban
« on: September 28, 2016, 09:49:22 AM »
They're not official ULX commands, but rather XGUI commands that have chat equivalents. They've been there even since XGUI was integrated with ULX about 5 years ago. :P

But yes, if you have access to "ulx ban", you'll have these 'helper' commands. The most useful case for this is to immediately freeze a troublesome player and give you the option to enter ban reason and duration, rather than banning first, filling in details later., e.g. '!fban stickly'

11
Off-Topic / Re: Staff App [did it in dev section because owner told me to]
« on: September 13, 2016, 08:08:41 AM »
I almost possibly feel like this is a troll, or like the owner of said server trolled him with sending a link to this website. Something seems fishy...

You'd be surprised how many emails we get of people complaining about abuse on servers or requesting for admin. It's likely because of our "This server is running ULX Admin Mod version %ulx_version% by Team Ulysses -- ulyssesmod.net" advert, really. :P

12
Off-Topic / Re: Finding if material is used on Garry's Mod map
« on: September 03, 2016, 10:10:01 PM »
The world should be an entity:
https://wiki.garrysmod.com/page/game/GetWorld

Also found this after a quick search, might be helpful? This is an area of Gmod I'm not familiar with. :P
https://wiki.garrysmod.com/page/Entity/GetMaterials

13
Well, I didn't find anything too interesting, but here's a rough list of addons you have in common with the other guy:
Code: [Select]
workshop ID 104480013 (Weight STool)
workshop ID 104815552 (SmartSnap)
workshop ID 160250458 (Wiremod)
workshop ID 185609021 (atmos)
awarn2
ulib
ulx
urm
utime

You can try removing these first if you like, but I would really like to see ONLY ulx/ulib running on vanilla sandbox to see if the problem goes away. (That is, if this is still an issue since your server data files got messed up). Hope this helps!  :)

14
Run a "ulx debuginfo" on your server, and send me the output (debugdump.txt). I will compare with the addon list from the other guy and see what matches. Good to know that the workshop addons weren't causing the issue, that'll help us narrow it down. If you can try to strip your server down to just ULX/ULib on sandbox temporarily and see if it persists, that'll help too.

15
http://forums.ulyssesmod.net/index.php/topic,9835.0.html

Looks like you're not alone with this issue. Could you post your addon list and (if you have the time) try disabling some addons to see if it starts working again?

Pages: [1] 2 3 ... 67