i have to switch one of my scripts to use getopts instead of just a case statement pray for me ;_;
i have to switch one of my scripts to use getopts instead of just a case statement pray for me ;_;
This is how I roll when I need to mark models as "completed", or anything else:
1. Allow the marking to be idempotent
2. If not idempotent, throw exceptions on duplicated calls
3. Save is opt-out, to avoid more than one update query.
#Programming #PHP #Laravel #Database #DB #WebDevelopment #WebDev #SoftwareDevelopment #Software #Codeing #code
โ๏ธ Day 19/100: #Leetcode daily question
๐จ Question: 670. Maximum Swap
The question was good and I was able to do it but went for the solutions tab because I was not feeling like solving anymore. The solution was using a greedy approach.
๐โโฌ Check out my #GitHub where I post all the daily streak ๐ฅ questions and #LeetcodeContest ๐ solutions
๐ Solution Link: https://github.com/akshatsingh1718/leetcode/tree/main/maximumSwap
๐ My Leetcode Github: https://github.com/akshatsingh1718/leetcode
Check out my latest article: Is http://main.py == main.txt? ๐๐ป https://linkedin.com/pulse/mainpy-maintxt-akshat-singh-ux0yc
Im currently working on my dlang serialization framework and just thought about adding maybe yaml, but the spec is so fucking complex, half the time it even dosnt know what it wants to even say. Like, it cannot tell you straigt what characters are allowed in an key, heck it dosnt even can decide how keys should be parsed. For example you can put a `?` at the start of a line (after indentation ofc) and then write arbitary yaml that then gets parsed and used as the key! Like wtf!
So I tought: "maybe try toml instead", but theyre just the same insane but in a different way; like keys and tables/sections cannot have the same value since a table is just syntactic sugar for a key with an inline-table aka object. End bc it's not enough already we invented that it would be nice to put another pair of brackets (`[]`) around the section/table to say: hey this is now an **array of tables**! Like very nice for serializers and stuff.... *sigh*
#programming #technology #serialization #fileformats #code #codeing #dlang
Unpopular opinion: business logic is boring.
Compilers, kernels, drivers, hardware, parallelism / async, tooling & frameworks, how things interact, integrate and complement each other; now **thats** the interesting shit!
#developer #programming #development #IT #code #codeing #unpopularopinon #frameworks #tooling #parallelism
AHAHAHAHAHA IT'S WORKING!!!!
Hurray! I figured out a project's process for contributing and submitted a pull request.
It was promptly rejected but that's ok!!! i am still a shit coder
okay i've been banging my head against "turn HTML headings into properly nested list" for DAYS to no avail, a nudge in right direction would help
so, just a reminder, a properly nested HTML list looks like
<ul><li>Item
<ul><li>Sub-item</li></ul>
</li></ul>
(note the entire sub-list is contained within a parent <li>)
for the purposes of this, the headings can just be various numbers between 1 and 6. so an array might look like
[1, 2, 3, 4, 2, 4, 1, 2, 3, 2]
(they aren't necessarily sequential but let's just pretend they more or less are), and should ideally look like
[1 [2 [3 [4]], 2 [4] ], 1 [2 [3], 2]]
i was trying to do something like,
for each $number in $numbers,
if $number > $previous,
make $number the start of a new list;
if $number = $previous, put in existing list;
if $number < $previous, close outer list;
set $previous to value of $number and start loop again.
but it was too hard to close the outer lists the right number of times.
i think i need to do a recursion but i don't know what part should be recursive (i think it's the part that generates the start of the list)? nor how to actually do it. like literally how do i tell it to do the thing, and tell it to do itself, at the same time??
is it easier to make 6 nested tiers and put each number in the matching tier and somehow tell it not to show empty tiers/levels?
??? am i on the right track?
(yes i've read all the php documentation, stackoverflow posts, and examples of other people's php code doing similar things i could find [it all seems to rely on importing other libraries/tools rather than doing everything all in one place], and i still can't fucking figure it out. i have no training and little experience in programming. i have to do it because no one else in this project cares about properly nested html. aldjf;lakjdf;lakjd;fkj)