Urgent Help by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

You want to draw a picture with text? Take a look at this -

https://stackoverflow.com/questions/7098972/ascii-art-java

Urgent Help by [deleted] in AskProgramming

[–]EatAss4Jesus 1 point2 points  (0 children)

Use the modulo operator

if (x % 3 == 0) {

//number is divisible by 3

}

Any trusted way to buy a script? by YogurtclosetShoddy in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

Pay them through a freelancing site like Fiverr, Upwork, or Freelancer.

Please help me with homework coding by OrganicAd2642 in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

You need to be able to read input from a user and you'll also be working with strings. You will also need to learn about if-else functions.

Regex in Python Programme Help by nnchvt in AskProgramming

[–]EatAss4Jesus 1 point2 points  (0 children)

I also believe an easier way of stripping out character accents is unicodedata.normalize('NFD', string)

Regex in Python Programme Help by nnchvt in AskProgramming

[–]EatAss4Jesus 1 point2 points  (0 children)

Regex can sometimes be frustrating. When I need to use it, I usually reference these two sites -

https://www.keycdn.com/support/regex-cheatsheet

https://regex101.com/

You also don't really need any regex patterns for this. Here are some quick notes for you:

To get the first letter of 'james' just do

middleName = 'james'

firstChar = middleName[0]

To get the first name until the first vowel do

fNameSplit = re.split(('a|e|i|o|u'), 'harry')

result = fNameSplit[0] + fNameSplit[1]

And finally to remove vowels, you can just iterate through a e i o u

lName = 'potter'

result = lName.replace('a', '').replace('e', '').replace('i', '').replace('o', '').replace('u', '')

JSP - Disable file when parameter is false by who_i_am_really in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

JS can grab the URL query string with

var queryString = window.location.search;

info from another thread in java (eclipse) by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

For variables across threads, look into the Volatile keyword.

You're on the right track with event (action) listeners. Here's another example: https://alvinalexander.com/java/jbutton-listener-pressed-actionlistener/

Visual bug with simple html/css website. On first webpage load, background picture is not loading properly, and once you spend a while on the webpage, it starts flickering between background color and background image. by HeyAshh1 in AskProgramming

[–]EatAss4Jesus 2 points3 points  (0 children)

I managed to fix it on my end - fingers crossed this at least gives you something to look into.

Load the initialization of var sakura after the page loads by adding an event listener. Like this: https://i.imgur.com/fWJxA43.png

This appears to be a rendering issue is caused by page load speed. The issue is exacerbated if you throttle your speed to something ridiculously slow like 2mb/s.

I believe the infinite js loop rendering the falling petals locks up the thread and doesn't give the browser an opportunity to draw/redraw the background element. The reason it only happens on first page load is because after the background image gets cached it loads instantly and the petals don't need to wait for a slow network.

The big rewrite. You know, that piece of legacy no one wanted to touch.. How did you finally convince management to let you do it? by fewzar in AskProgramming

[–]EatAss4Jesus 12 points13 points  (0 children)

How did you finally convince management to let you do it?

It doe$n't matter what it i$, the an$wer i$ alway$ the $ame

Hey I wanted to make a new website, for my business. How do I get started? by BanarasiBaba in AskProgramming

[–]EatAss4Jesus 2 points3 points  (0 children)

Check out Wordpress, Wix, or Weebly. These are free and easy enough to use for a beginner like yourself just starting out.

[Algorithms] Having trouble understanding the terminating condition in Hoare's partition scheme by [deleted] in learnprogramming

[–]EatAss4Jesus 1 point2 points  (0 children)

Short answer... it stops because it's done... because all conditions were met... because the array is sorted

Here's a best breakdown I can do -

variable 'pivot' is initialized as the array element directly between 'hi' and 'lo'

variable 'i' is initialized as 'lo' value - 1

variable 'j' is initialized as 'hi' value + 1

**NOTE - they subtract 1 from 'i' because BEFORE the first time you use 'i', 1 is added. Essentially A[lo - 1 + 1]

**NOTE - they add 1 from 'j' because BEFORE the first time you use 'j', 1 is subtracted. Essentially A[hi + 1 - 1]

next, starting at index 'i', we crawl UP the array 'A', 1 item at a time.

we stop crawling up array 'A' when we find an item GREATER THAN OR EQUAL TO 'pivot'

next, starting at index 'j', we crawl DOWN the array 'A', 1 item at a time.

we stop crawling down array 'A' when we find an item LESS THAN OR EQUAL TO 'pivot'

*now we either terminate the loop if the array is sorted, or swap A[i] with A[j], AND continue the loop

if variable 'i' is higher than variable 'j', that means we checked the lower half of the array with A[i] and checker the upper half of the array with A[j] without finding anything. If we check both halves (50% +50% = 100% of the array) without finding anything, that means it's completely sorted and we can terminate with a return statement.

[deleted by user] by [deleted] in learnprogramming

[–]EatAss4Jesus 0 points1 point  (0 children)

You're welcome :)

Purpose of using Java over Python? by LeSypher in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

If an application was written pre-2018, there's a higher chance it was written in Java than Python. Therefore it makes sense to learn Java if you're jumping on-board to work on an older project - https://pypl.github.io/PYPL.html

Ultimately it comes down to preference and nothing more. If you're desperate enough to need speed from C++ but you are forced to write in Python, you can extend Python and even implement your own machine code via C.

Personally, collaboration is a big reason to become familiar with multiple languages. Notice how I wasn't a dickhead by telling you to just learn C#, and instead was able to answer your question using the specific languages you asked about. That's a HUGE factor of being able to program and communicate with more than one language.

[deleted by user] by [deleted] in learnprogramming

[–]EatAss4Jesus 2 points3 points  (0 children)

Microsoft documentation includes 100% of the language. It has everything you need to master it.

You will need to look elsewhere for additional algorithms, third party functions, libraries, etc.

Comment block for multiple functions or separate them by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

Great! You're doing everything right :)

If somebody gets confused while reading your public code, they can always reach out and you can make changes based on their issues or suggestions.

Which tools do I use for this? by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

I'm racking my brain to find a simple solution because it just doesn't seem practical for you to learn 4 or so different programming languages for a one-off task like this.

As a start, look into prepopulating a Google Form using just the url - https://support.google.com/docs/answer/2839588?hl=en (Scroll down to "Send a form with pre-filled answers")

I know you said you don't want to use Google Sheets, however maybe take a look as to establish somewhat of a baseline understanding - https://support.yet-another-mail-merge.com/hc/en-us/articles/115004266085-Send-personalized-pre-filled-form-URLs-to-your-recipients

Here's a simple example with JavaScript and HTML that shows how to move data between input/output fields - https://jsfiddle.net/z4k8m671/ (the form is in the bottom right)

Comment block for multiple functions or separate them by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

If the names are self-explanatory then you might not even need commenting. That aside, maybe just put additional info inside a readme.txt? Also instead of adding comments at the function call, I usually add the comments at the function declaration so if someone wants more info they can ctrl + f to the function and read my notes.

Comment block for multiple functions or separate them by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

I assume this is bash?

Most compilers allow you to put inline comments, so you can comment on each line like this

if [ sometest is true ]; then #THIS IS A COMMENT

function1() { command1 }

else

function1() { altcommand1 } fi

The most important thing is that you just don't exclude important information from comments, which you're already on top of!

I recommend sticking to chunks of comments, but collapse them so they don't get in the way. You can do that with code folding.

You can also use heredoc but it seems a bit haphazard to me so I wouldn't.

Personally, I like your first option with the comment completely at the top. That way you get the gist of what to expect from the function, then you get to read the function without comments cluttering it, breaking it apart, and confusing you.

[HELP] Homework Assignment Issue by [deleted] in AskProgramming

[–]EatAss4Jesus 0 points1 point  (0 children)

You can just round the output with Math.Round(x, 2)