It is currently April 24th, 2024, 7:45 pm

Questions About Calc Measure

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Questions About Calc Measure

Post by Yincognito »

Lssg97 wrote: March 6th, 2020, 5:18 amOnce I even used Shape Mater to draw a picture myself to remove the picture files in the folder!
Wow, that's really good looking. :thumbup: Never imagined one could actually do this with shapes...
Lssg97 wrote: March 6th, 2020, 4:07 amYou're right, negative numbers can be represented in two's complement for binary. And octal or hexadecimal can use binary conversion directly. As for the other bases, I honestly can't imagine how to represent negative numbers.
I see. So it's all based on binary and two's complement. I guess the "inversion" of the binary could be done easily in regex, the addition of 1 could be trickier though. I was curious in regard to the complexity of the conversion process for negative numbers, so thanks for the info. Lua is probably best suited for this, if you need negative number conversion. If you only try to convert positive numbers, either way (through Rainmeter code or Lua) is just as simple. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Brian
Developer
Posts: 2681
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Questions About Calc Measure

Post by Brian »

Yincognito wrote: March 6th, 2020, 10:19 am Wow, that's really good looking. :thumbup: Never imagined one could actually do this with shapes...
Fun with shapes.

-Brian
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Questions About Calc Measure

Post by Yincognito »

Brian wrote: March 6th, 2020, 10:29 am Fun with shapes.

-Brian
Haha, I already checked that, but for a different reason. Great looking piece of art, and a beautiful / inspirational "gift" for jsmorley! :great:
By the way, he should have told you to make all that in Lua, instead of "torturing" yourself in Rainmeter code like this... :lol:
Yes, I know you used a couple of tools to simplify the job, but still ... how could you do this without Lua, huh Brian? :D Just joking, of course. Nice job! ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Questions About Calc Measure

Post by balala »

Yincognito wrote: March 5th, 2020, 11:50 pm By the way, in your sample 111 becomes 111st, which is incorrect, as it's 111th (one hundred and eleventh), same for numbers ending in 12 or 13.
Right, my bad, however jsmorley's solution looks same way incorrect, isn't it? At least for me it seems to give the same sufix for those numbers as mine.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Questions About Calc Measure

Post by Yincognito »

balala wrote: March 6th, 2020, 4:51 pm Right, my bad, however jsmorley's solution looks same way incorrect, isn't it? At least for me it seems to give the same sufix for those numbers as mine.
Well, I though the part:

Code: Select all

if (num - n) == 10 then
		suffix = 'th'
"protects" from such a result, but I guess you're right: for num = 111, n = 111 % 10 = 1, and num - n = 111 - 1 = 110 (and not 11 and such, to be able to cover the exception). I think setting n = num % 100 and then testing for n > 10 and n < 20 should solve this. I didn't test the code, but from my (modest) programming intuition, it should do it...

EDIT: But then the other conditions below would fail :D, since n needs to be num % 10 for the following tests. Anyway, the solution is trivial, I'm sure of it. Like modifying the above into if (num - n) % 100 == 10 then suffix = 'th'. Damn, I just wrote my first Lua line of code! :jawdrop
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Questions About Calc Measure

Post by balala »

Yincognito wrote: March 6th, 2020, 5:41 pm Damn, I just wrote my first Lua line of code! :jawdrop
Good job, congratulations. :thumbup:
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Questions About Calc Measure

Post by Yincognito »

balala wrote: March 6th, 2020, 6:08 pm Good job, congratulations. :thumbup:
LOL - thanks. So it works, right?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Questions About Calc Measure

Post by balala »

Yincognito wrote: March 6th, 2020, 6:24 pm So it works, right?
Yep, it does. Your substitution look promising and it does work well, at least as far as I tested it.
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Questions About Calc Measure

Post by Yincognito »

balala wrote: March 6th, 2020, 6:30 pm Yep, it does. Your substitution look promising and it does work well, at least as far as I tested it.
No, I meant the replacement in jsmorley's Lua code, i.e. if (num - n) % 100 == 10 then suffix = 'th'. I'm curious if this works, because I already know that my regex substitute does the job. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Questions About Calc Measure

Post by balala »

Yincognito wrote: March 6th, 2020, 6:39 pm No, I meant the replacement in jsmorley's Lua code, i.e. if (num - n) % 100 == 10 then suffix = 'th'. I'm curious if this works, because I already know that my regex substitute does the job. ;-)
Yep, just tested and it does.