Tumgik
xacheri · 11 months
Text
21/05/23 - Day 51
Tumblr media
Today I learned different methods used to import modules and the difference between them.
48 notes · View notes
xacheri · 1 year
Text
Validation Received!
At work today, we had to use the data submitted by our semester cost calculator to build a new table that goes into a detailed breakdown.
My co-worker's solution was to rewrite the table construction function (which I had written already in JavaScript) in PHP.
My solution was much quicker to implement. I just used PHP to echo the POSTed values I needed into the JavaScript variables required to run the table construction function I had already written. When I had finished, my coworker said "wow you blew right past me."
It feels good to receive that kind of validation and to know that I am not just a contributing member of the development team but a valuable and clever one! This is one of those developer successes I get to hold with me as I move forward in my journey.
Tumblr media
5 notes · View notes
xacheri · 1 year
Text
I track the way he uses class time in my notes. Today, barely-adjacent tirades on Wal-Mart, Data Science, and cyber security risks eclipsed time spent on Computer Architecture by around 10 minutes.
But we did get to watch a video about programming a PDP-11 from the 1970s which was cool.
About to brave another 3 hour lecture on Computer Architecture. Godspeed.
4 notes · View notes
xacheri · 1 year
Text
About to brave another 3 hour lecture on Computer Architecture. Godspeed.
4 notes · View notes
xacheri · 1 year
Text
Today, at work, I created dynamic SQL queries in PHP so that I could retrieve credit hours and cost information for whatever courses were selected in a financial calculator we're building.
This was a challenge because my experience with PHP is limited and with SQL it is non-existent. The SQL part, ironically, was a little easier than figuring out how to integrate it with my php using the classes I was given to interact with my database.
However, it is a challenge I overcame! I had to ask my boss for specifics on how the class constructed the queries and how I should format the parameters but he was very helpful and I was able to get it done right before he left for the day.
1 note · View note
xacheri · 1 year
Text
I've been using php at my work study. It's so weird. Like "why do we" . " concatenate strings with a " . "period". Also it's just inconvenient to have to type a dollar sign when you want to reference a $variable.
That being said, I've been enjoying it. Other than strange syntax, it feels very similar to JavaScript.
6 notes · View notes
xacheri · 1 year
Text
SkillsUSA Districts Problem - Consecutive Coin Flips
Hello Tumblr,
Here goes the second take of my skillsUSA districts blog post. The SkillsUSA district competition was fun! I spent about 4 hours total between the two programming problems, and I will be going over one of the problems that I really enjoyed solving. I did my work for this problem in C#.
The Problem:
Our task was to make a program that would ask a user how many times they wanted to flip a coin, flip a coin that many times for heads or tails (with a 50/50 shot of either,) and record and output their longest streak of consecutive heads or tails flips. Additionally this program also needed to keep track of and output the longest consecutive heads or tails record between all rounds.
My Planning Process:
To flip a coin I knew I was going to use a random number generator to generate 2 values, use one of those for heads and one for tails. We will iterate through this however many times our user asks us to each round.
But consecutive streaks? How do you track those? Well, I thought, you really only need two main pieces of information to determine a consecutive streak of things. To determine if it has rained 2 days consecutively, you need to know if it is raining today AND if it rained yesterday. To know if it has rained 3 days, you just notice that it is still, in fact raining, and that we were previously on a count of 2 days, then you just add on from there. This kind of logic, when you catch yourself using numbers and words like “if” “and” and “then”, is usually pretty intuitive to implement into code.
So in our coin flip problem, we want a variable that keeps track of the flip we’re doing now, and a variable that has the value from the previous flip. We will probably call these flip and lastFlip. Our rounds could proceed as follows: We flip the coin for this iteration, we display the result, we check to see if our flip and lastFlip are the same, if they are, we add +1 to the relevant consecutive counter. If they aren’t we set our counters to zero.
Wait, but I need to store the consecutive streak somewhere before we reset it! So that we can keep track of the highest streak this round, not just the current ongoing streak. This will require 2 variables to store our highest heads and tails streaks during the round. These will be updated every time the current streak of heads or tails exceeds it.  
Then, at the very end of the iteration, we will set our lastFlip equal to the flip value from this iteration. Because lastFlip won’t be updated until after it is compared to the next iteration’s flip value, you can use it to compare the coin flips across iterations. Of course, you then repeat this flip, compare, update process however many times as the user told the program to do it.
And to keep track of our records between rounds? Two more variables can hold the heads record and tails record and then be checked and updated after the completion of a round using our consecutive streak variables from inside the round. 
So now that I had an idea of what this would look like, I started typing. I will go over each function I made, then review the Main Method last.
The Flip() function
The idea here was to use the languages RNG to get a 1 or a 0 and have this function return (output) a true or false value depending on the result. 
Tumblr media
The most interesting thing here is the way the Random class works. You can see we are initializing a new object called ‘rand’ of the Random class. This object can be used, with the .Next(min, max) method to create a pseudorandom number within a given range.
It uses the exact date and time on the computer’s clock as a seed value in an algorithm that shoots out a pretty much random number between 0 - 0.999(repeating.) Then it uses that number, alongside a small amount of arithmetic, to give you a value from and including your min value all the way to but NOT including your max value. This is a “side effect” of using a seed that can be anywhere from 0 - 0.999(repeating) but not 1. 
This function gets a random number, with a max value of 2 (so it will return a zero, or a one, but NOT a two.) If that number is 1, return the boolean value of true. Otherwise (when it is zero) return the value of false. 
FlipResult(bool flip)
Tumblr media
You might notice that there is no conditional statement (<. >. ==, etc) in our if( ) block. If you put a boolean variable in there without a conditional, it will just operate the if when the boolean is true and the else when it is false. 
PlayGame(int rounds, out int consecHeads, out int consecTails)
This function will run through 1 round (n iterations, based on user input) of the coin flip game. Remember the steps “flip, display, update counters, store flip to last flip, repeat.” This will be the basis of this function. 
Tumblr media Tumblr media
First we set our consecutive counters to zero, just so we are making sure we start off with a clean slate. We declare our flip variables as well. lastFlip starts out as false, because the C# compiler wanted a value there. I commented on it though, so that fact wouldn’t confuse me later. 
The meat of our program is a for loop that starts a counter at zero, runs our code, then adds one to that counter. The loop will stop once the counter reaches the number of rounds. 
We store the result of a Flip() to our variable, named flip. You may notice in the code, I flipped the “update” and “display” steps around, this is okay I determined because the display step doesn’t change any data and the update step doesn’t change data the display step uses.
Anyways, we check if it is the first iteration, because if it is, we don’t want to run any operations that use lastFlip, because the value in there means nothing at the moment. The if (i != 0) statement makes sure our consecutive streak counting code is run on every iteration except the first. 
This code adds 1 to the headsCount if it is already initialized, or greater than zero (we will get to that later,) and the current flip and last flip are both true. Adds to the tailCount if the same conditions are met but both flips are false. If the flips are not equal to each other, it resets the relevant streak counter.
We also have code that initializes the counts when either our counts have just been reset or it is the first iteration. These two if blocks will initialize either our heads or tails streak counter  
Now, we update the largest consecutive heads and consecutive tails trackers if the streak we’re on is bigger than the streak in the tracker already.
Then display the result of the flip. Afterwards set the lastFlip = to the flip value. Then we iterate this process until we have done every iteration we were asked to do.
Afterwards display those largest streak trackers we were updating earlier. 
Notice that we output the consecHeads and consecTails streaks. This is because we need to know them for other functions that track the highest streaks between each game the user plays. 
UpdateHeads(int consecHeads, int headsRecord)
And UpdateTails(int consecTails, int tailsRecord)
These functions update our record by checking the consecHeads or tails value, comparing it to its record, and replacing that record if the value was higher. In retrospect, these are literally the same function. The variable names change but nothing else. This could just be one function.
Tumblr media
DisplayRecords(int consecHeads, int consecTails, ref int headsRecord, ref int tailsRecord)
Here we display the changes to our record, and THEN we update them in memory using our Update functions from earlier. We pass the record variables by reference because we want to use and change their values in a scope beyond that of this particular function. 
Main Method
This method is mainly control structures and the “glue” that holds all the other functions together.
Tumblr media
We declare our program wide variables at the top. These include gameRounds, consecHeads, consecTails, headsRecord, tailsRecord, validInput, playAgain, PlayAgainAnswer.
Our game happens in a do/while loop that uses the playAgainAnswer as a sentinel to break out of the loop. 
We prompt our user, then use a do/while loop that validates their input. If you aren’t familiar with TryParse, it takes an input variable, returns a true boolean if it is a correct type and false if not, and sets the output variable to the input if it is the correct type and -1 if not.
Then we play the game, this will do as many iterations of coin flips as the user inputs. We display the records. Then we use a do/while loop to validate our users input on whether or not they want to play again, if they do, playAgainAnswer will be Y or  y and the loop will repeat.
Output:
Here is what the program looks like in practice:
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Conclusion:
My code did the job, and was written with in the time-limit so I was satisfied but upon further review, there are definitely some redundancies that could be removed.
I had a lot of fun at the competition. Also, I won first place! These kind of things are important to remember and hold onto, because programming is hard and you will be discouraged. It's these kinds of achievements that can preserve your confidence through the harder challenges.
1 note · View note
xacheri · 1 year
Text
I was making the post explaining my solution to the problem I mentioned and my post editor snagged so I lost a couple hours of progress on a very long blog post.
I am disheartened by this, but fear not, I will deliver the content at a later date, after writing it in a separate word processor and then transferring it over. It's just too late at night right now for me to restart it.
Computers are a lot of things, forgiving is not one of them.
SkillsUSA Districts Results
I found out recently that in the district SkillsUSA programming competition I competed in, I won first place in the college division!
I feel very proud for this accomplishment, and I think it's emblematic of the passion I feel for the craft. The first and second place winners advance to the State SkillsUSA competition.
To prepare for the competition, I will try and practice programming problems on LeetCode so I can get my brain in a problem-solving groove and I will try and work more deeply with my C# assignments.
I am drafting a post right now to go over one of my problems from the competition and how I solved it.
4 notes · View notes
xacheri · 1 year
Text
SkillsUSA Districts Results
I found out recently that in the district SkillsUSA programming competition I competed in, I won first place in the college division!
I feel very proud for this accomplishment, and I think it's emblematic of the passion I feel for the craft. The first and second place winners advance to the State SkillsUSA competition.
To prepare for the competition, I will try and practice programming problems on LeetCode so I can get my brain in a problem-solving groove and I will try and work more deeply with my C# assignments.
I am drafting a post right now to go over one of my problems from the competition and how I solved it.
4 notes · View notes
xacheri · 1 year
Text
Quick Update:
Hi guys!
Sorry I haven't posted in a minute, things have been a little crazy in the life and times of Xach.
I completed the onboarding for my Web Development work-study. I'm excited for my first day soon!
I attended a programming contest through SkillsUSA! I wrote a couple of C# programs for the class and I hope to make a post about one of them. I feel pretty confidant that I will advance to the next level but we don't know the results yet.
In my web development class, we're working with JavaScript to manipulate the attributes of HTML objects (Changing src on images, text in <p> tags, things like that.)
I've fallen a little behind in Systems Analysis and design. I might try and talk about the content here to motivate myself with a concrete goal.
Anyways, stay tuned! We'll be back to your regularly scheduled programming shortly.
5 notes · View notes
xacheri · 1 year
Text
AAA RPGs: Story is incomprehensible because it's a 100-hour game with maybe ten hours of actual content, so by the time you've ground your way to the next scrap of lore you've forgotten what the previous one said; true ending is locked behind $30 "season pass" DLC.
Indie RPGs: Story is incomprehensible because a large piece of the necessary context exists only in a forum thread from 2007; ends on a sequel-teasing cliffhanger which will never be resolved because the dev burned out and quit game development to become a lumberjack.
3K notes · View notes
xacheri · 1 year
Text
Thank you very much! I'm pretty excited. I had a small celebration by visiting a nearby sandwich shop.
I had an interview earlier today for a Web Development work-study with my college and it went very well!
We're waiting now for the work-study eligibility to go through, and for HR to do their thing. I'm so excited to be able to program professionally!
10 notes · View notes
xacheri · 1 year
Text
I had an interview earlier today for a Web Development work-study with my college and it went very well!
We're waiting now for the work-study eligibility to go through, and for HR to do their thing. I'm so excited to be able to program professionally!
10 notes · View notes
xacheri · 1 year
Note
Your website is coming along very nicely! Are you in university or any bootcamps? You mention your web dev classes, wondering if it’s part of a uni course 👀
Also, are you enjoying it? Are there parts you like the most?
That’s all! Have a nice day! 💗✨
I go to a community college/ trade school in the United States and work at an arcade at night.
I enjoy it more than any other creative/intellectual venture I've ever done, to be honest. It energizes, excites, and challenges me. My favorite part is when I come across unexpected issues and learn something new about the language/framework I am working with.
Also, I am so psyched that you sent me an ask! Your codeblr is what inspired me to start my own! :)
8 notes · View notes
xacheri · 1 year
Text
About Me - Commit #3 - For Fun
We also had to add a page to our site "for fun," I still needed to include a form so I made a "Be My Friend" application where I ask for the important things: Names, Secrets, and Favorite Snacks.
I know I have been dragging Bootstrap through the mud in these last couple of posts but it really did come in clutch by doing most of the styling for my form for me. Sorry for everything I said, praise the art of convenience.
Mobile:
Tumblr media
Desktop:
Tumblr media
Pretty simple, which fits with the motif of the NameBoy.
The HTML:
Tumblr media
We have a new carousel item with a new id to boot. The h2 tag of this page has a unique id.
The form is centered in a centered justified flexbox. The inputs have types, names, ids, and matching labels. They are all text imputs besides the secret input, which is a password. The submit box uses the same centering trick as the form.
We have regular and reverse navhints.
The CSS:
Tumblr media
There were only three pieces of custom CSS, for the margins and colors.
Conclusion:
This project was very fun but not very demanding. It was a great way to dust off my skills and use the "first-project-of-the-semester" privilege to build something I wanted to build without jumping through too many hoops. I may convert this design later to be a digital resume-type site. I am excited to present to class tomorrow!
10 notes · View notes
xacheri · 1 year
Text
About Me - Commit #2 - Goals and Education
This commit, I built the goals and education pages on the NameBoy. It was easier than the last commit because I spent most of last commit building the responsiveness and spent much of this one just taking advantage of it.
Mobile (Goals):
Tumblr media
Mobile (Education):
Tumblr media
Desktop (Goals):
Tumblr media
Desktop (Education):
Tumblr media
I love how it's coming together!
The HTML:
Tumblr media
All I had to do here was add two new carousel items with some stylized text.
The goals screen has a centered heading with three separately identified (and styled) subheadings. We have our nav hints absolutely positioned on the corners.
The education screen is mostly the same thing. The heading is centered but non of the text is colored. There are 2 unordered lists, with list items that contain the "edItem" class. We have another navhint and a navhintReverse.
The CSS
Tumblr media Tumblr media
On the goals screen, our h2 is pink, our h3 is 16px and underlined with a margin all around.
Learn is blue, Build is red, Play is orange.
On the education screen, I made the heading green and the h3 tags 16px in font-size. The edItems have a small margin to help space them.
I moved the #homeScreen > p statement to a general p {} statement. I also added navhintReverse to do nav hints on the left side of the screen.
Conclusion:
HTML/CSS is not very quick in making artistic webpages but it is pretty fast at styling plain-text like this. It was a breeze.
The makers of the languages had great ideas, and did a good job, but they never could have predicted that the web would evolve the way it did.
Check it out on github: https://github.com/Xacheri/aboutme
7 notes · View notes
xacheri · 1 year
Text
About Me - Commit #1 - NameBoy and Homepage
I've gotten to grinding out the code for my About Me page design, which I've decided to call the NameBoy. The challenging part was building in responsiveness where Bootstrap's features weren't helpful. This happened a lot because I was making a design that does not look like a Bootstrap app. Maybe I need to learn Tailwind.
Here's what it looks like!
Desktop:
Tumblr media
Mobile:
Tumblr media
The left and right D-Pad keys work! They switch between the pages. I'll show ya how.
The HTML:
First we have a pretty basic head tag but we cdn Bootstrap and add a font.
Our NameBoy consists of 2 main parts: the screen and the controls. The screen is a bootstrap carousel with controls mapped to the virtual d-pad.
Within the screen, we've written a home screen with centered headings and a flexbox containing my list of titles and a picture of my Stardew Valley character. We use justify-content-around so that it spaces well on all sizes of NameBoy screen.
The navhint at the bottom of the "homepage" has a class because the custom CSS there will be used later-on as well.
The controls are mapped using the relevant bootstrap classes and targeting the #NameBoyScreen. The data-bs-slide attribute tells it what direction to move the carousel.
The middle, A, and B button are just cosmetic.
And, of course, we have our Bootstrap script.
Tumblr media Tumblr media
Now time for the fun part
The CSS:
Tumblr media Tumblr media Tumblr media Tumblr media
First, our basic font will be white Press Start 2P. It's retro, fun, and free.
Our background color is blue, like the GameBoy color I would emulate on my $20 android phone when I was younger.
Our screen is positioned Absolute, so that it's children can be too. A small margin on top, with a fixed-pixel height and width based on our Figma ratios. A non-jarring black color is used for the background of the screen.
We use inheritance so we can pass that fixed pixel size down through the carousel for convenience with absolute positioning.
The home screen has some basic text formatting. The yellow is a kind of Pac-Man yellow.
The image of my SV avatar has a fixed pixel size as well.
Our navhints will be absolutely positioned near the corner of the screen.
The controls were fun to figure out. They're positioned with fixed positioning on the edges of the screen. The next and back buttons are 60px wide and 35 pixels tall.
They are overriden to be opaque because BS wants their controls to be translucent but I disagree in this situation.
The middle button is a plain rectangle positioned toward the middle of the actual, functional, sideways controls.
The A and B buttons are circles (border-radius: 50%) positioned with the same technique as the other controls and set up so that the text labeling them will center.
Our query changes button positioning, font-sizes, and screen sizes to turn our NameBoy Color into a NameBoy Advance when the controls move too far to the sides of our NameBoy's screen.
Conclusion:
I love when I have a fun idea, and it works. It's been happening more lately with CSS. I also feel that this is a very cumulative project of last semester's skills. I'm excited for it.
The github repo for the project is here, if you wanna look: https://github.com/Xacheri/aboutme
4 notes · View notes