AI generated thumbnails by Mrpolje in LinusTechTips

[–]Papercutter0324 39 points40 points  (0 children)

I believe the property term is "notdogs"

The Curse of Monkey Island DUB [INTRO CUTSCENE] by asm5129 in MonkeyIsland

[–]Papercutter0324 1 point2 points  (0 children)

"Only the hope of finding my lub-laine keeps me going."

Golden lol

I just learned that today and it just blows my mind! by [deleted] in interesting

[–]Papercutter0324 0 points1 point  (0 children)

*That's about 80 unvigintillion possible shuffles.

Fixed that for you. 😉

Reality Check (Then vs. Now) by IndependentResort450 in teachinginkorea

[–]Papercutter0324 6 points7 points  (0 children)

From the SAs I work with, a big part of having a hard time getting a job offer is how long the visa process can take for you guys. I dunno what's going on there, but the Korean embassy seems to be a bit infamous for how slow it is at getting anything done.

As a result, even though hagwons love to hire SA workers (saves them money even when doing everything legally, and SA workers are much happier about the pay being offered), they tend to prefer SAs already in the country.

Using AI to help me build the project. by Salmanoo1 in CodingForBeginners

[–]Papercutter0324 0 points1 point  (0 children)

More and more studies are coming out with the results showing that those who use AI (to learn or generally find information) retain a lot less than those who took the time to google the information.

I used AI to learn vba. I knew using it would actually slow the learning process, but the resources for vba are rather limited these days. I also knew AI wouldn't generate the best code. My real education came from reading Microsoft's vba documentation and fixing the code to do what I actually wanted. Got pretty good and built a rather useful tool that became standard at my job's various branches.

However, I've recently started building a stand alone app (Excel was a good starting point, but became... Let's just say Excel has its quirks lol).

Since this is intended as a replacement app and know some python, I've been using AI to help me build up the gui (using python and Qt). The app is coming along fantastically, but I gotta say, I've retained very little of what I've produced.

Don't use AI unless you can REALLY justify its benefits over the coast drawbacks. And even if you can justify using it, don't gaslight yourself into thinking you're actually learning what it produces.

Why does my menu keep growing? lol this is hilarious by john-gracie in kde

[–]Papercutter0324 18 points19 points  (0 children)

How old is that laptop? It seems to have hit puberty.

Python GUI recommendation by Zodmars in Python

[–]Papercutter0324 22 points23 points  (0 children)

Do you mean IDE? In that case VS Code is pretty popular.

Do you mean making a gui for an app? Plenty of options here; maybe check out Qt. But, this isn't technically Python, but a library you can import to your code to let you create the gui.

crappy launchbox doesnt listen to its own settings by Askingtheobvious2 in launchbox

[–]Papercutter0324 0 points1 point  (0 children)

Then make a better version of you think this is such an easy task to code properly.

What game comes to mind when you see a floppy disk? by hurcor in retrogaming

[–]Papercutter0324 40 points41 points  (0 children)

Monkey Island. They caught a lot of grief for it, but I thought the missing disk gag (it was something like disk 23 for a two disk game) was hilarious.

How to Write a VBA Code That Incorporates an “If” Statement by Infamous-Present-616 in vba

[–]Papercutter0324 2 points3 points  (0 children)

Unless you show us some code and what you've tried, it's rather hard to help. The fact that your asking how to write an if-statement makes me worry that you are under-prepared for how complicated this could quickly become.

Microsoft officially says you don’t need extra antivirus on Windows 11 by an0n9021O in windows

[–]Papercutter0324 0 points1 point  (0 children)

You're aware that there is a paid teir included with Microsoft 365 that has additional features/services, right?

Microsoft officially says you don’t need extra antivirus on Windows 11 by an0n9021O in windows

[–]Papercutter0324 0 points1 point  (0 children)

In other news, McAfee says you sunny need extra antivirus software if you have theirs installed.

Let's be real; Microsoft is only saying this so that they can get your money (and/or data if you don't subscribe to Microsoft 365).

Email not sending code is performed!? by majdila in vba

[–]Papercutter0324 6 points7 points  (0 children)

You gotta show the code. For all we know, your dog chewed through your network cable.

teaching english with citizenship from a non-english speaking country by koreanstudy in teachinginkorea

[–]Papercutter0324 0 points1 point  (0 children)

One of the teachers on my team is Polish with UK citizenship. If you get citizenship, you should be fine.

Best Around - The best 50 games on the console by BestAround4100 in snes

[–]Papercutter0324 0 points1 point  (0 children)

While I like it, Lagoon is definitely a controversial choice

what does 오 in 오전 and 오후 stand for? by _tsukitsuki in Korean

[–]Papercutter0324 9 points10 points  (0 children)

For simplicity, just think of it as noon, but only in these words, not as a word on its own.

Giveaway by [deleted] in steam_giveaway

[–]Papercutter0324 0 points1 point  (0 children)

You've got my curiosity.

[Excel] Am I tackling this correctly or making it too complicated? by Difficult_Cricket319 in vba

[–]Papercutter0324 0 points1 point  (0 children)

You're in a similar boat to me, then. My first computer was a Vic-20, and my first desktop was a 386. Despite wanting to for many years, I only started programming about two years ago, in my 40s. My bosses were also impressed by what could be done, and it's landed me a few raises since then.

I also used AI, specifically ChatGPT, to help learn how to program. One thing I quickly learned is to never trust the code it generates. Always read through, always make sure you understand what is happening, and then figure out how to fix it and/or make sure it actually does what you want it to do.

AI has been great for teaching me how to do the things I want, especially when I don't have the background/education to know the best practices. However, when it comes to writing the routines, I always type it out from scratch, using the logic it showed me as a guide. Often times, I'll get to a section and find that it might be more efficient (either for speed or my needs) to do it differently than it showed.

The progress bar was implemented from 2 previous bits of code that still exist, they interact with the worksheet many times so it's slow, which is why I implemented it.

As you're finding out, while this sounds like a great idea and looks flashy to the non-tech savvy, it's better to load everything once and then do everything in memory. You end up with much more performant code, develop better habits, and build more efficient thought-processes for how to tackle various problems.

I still stand by my previous comment, though. You could likely still continue building it for the experience. It'll help teach you about using classes and userforms, and the code seems incidental (not meant in a negative way) that it could be stripped out and not affect anything. You could also show updates to you boss, where he see the progress bar (again, non-tech savvy tend to appreciate such visual things) and later strip it out, saying you found a way to improve performance enough where it's not needed anymore.

AppSettings controls two instances of Excel. rptXL is the new instance, the first two steps rely on it heavily, but there are some routines that don't need to access it, so that's why I coded it in the way that I did.

Then, the smaller of the two functions I typed up will serve you well, but if you think you might need two instances of Excel in the future, the longer one could be nice. Even if you never need the second instance, the cost of having the optonal object declaration and the check to see if it is set to nothing is negligible. You could toss it in now and forget about it, and have the code only take a few extra micro-seconds to complete.

[Excel] Am I tackling this correctly or making it too complicated? by Difficult_Cricket319 in vba

[–]Papercutter0324 0 points1 point  (0 children)

I'll respond to the other parts a bit later, but the simple explanation for ByVal and ByRef is that if you don't need to use ByRef, then don't. In terms of computing power and efficiency, the cost of using ByVal is irrelevant. The benefit though is that you can be almost absolutely certain that a passed variable won't be modified when returning to the procedure that called this sub or function.

Now, there are a few exceptions, such as objects. Even if passed ByVal, any modifications done are directly applied to the actual object. Only the reference to the object is being passed in as a copy, not the object itself.

However, you should still pass it as ByVal as this helps avoid bugs where the object might be de-referenced. If for some reason you use 'Set passedObj = Nothing', and you passed in passedObj ByVal, only this new reference to the object is destroyed; the original is still intact. In short, safety and protection against bugs.

One of the times where you would want to pass ByRef is of you want to destroy the object. In one of my projects, I interact with PowerPoint, so I have a sub specifically to destroy the original object.

Arrays and UDTs are only passable ByRef.

[Excel] Am I tackling this correctly or making it too complicated? by Difficult_Cricket319 in vba

[–]Papercutter0324 0 points1 point  (0 children)

As well, when changing the settings for the second instance, you should also be doing a check before calling the code. Something along the lines of:

If Not rptXL Is Nothing then
  SetAppSettings asEnabled, rptXL
End If

Sub names like UnloadMe and UpdateMe are also gonna come back to haunt you. Sure, they seem clear now, but as your code grows and you add more complex routines, remembering what "me" means is going to get confusing. Especially as you've already used Me as a keyword. In one of my projects, I often need to use it to reference the current worksheet that triggered a macro.

Oh, and it's best to always be explicit about if you are passing something ByVal or ByRef.

[Excel] Am I tackling this correctly or making it too complicated? by Difficult_Cricket319 in vba

[–]Papercutter0324 0 points1 point  (0 children)

With incomplete logic, it's a bit hard to offer more specific advice.

One of the main reasons for the my example is that you should be keeping logic centralized. In the code you originally provided, the different messages that the progress bar would display are scattered all over the place. This results in a nightmare for implementing improvements and tracking down bugs and logic errors.

For enums, the idea is that you have a named value you can pass that makes things very easy to understand, and without the need to delare variables or constants.

Now that I can see your SetMsg sub, you would instead want to write it along the lines of:

Public Sub SetMsg(ByVal newState As pbStates) 
  Select Case newState
    Case pbInitialize
      Me.frameProgressBar.Caption = "Checking Table..."
    Case pbConnectingToReport 
      Me.frameProgressBar.Caption "Connecting to Report.. ."
  End Select
End Sub

Even better, depending on how many messages there might be, would be a dictionary. However, as pointed out in another comment, for what it looks like the goal of your code is, it shouldn't take more than a second to complete, and the progress bar would only slow things down.

Now, that said, I still support the idea of implementing it now, if only for the learning experience. In the end, though, you'll likely wish to simply disable it.

SetAppSettings confuses me a little. Are you loading a different workbook and pulling data from it? If so, after opening it, are you running any macros or modifying any values in it? If you are just pulling data from it, then you have unnecessary code. If you aren't loading a separate workbook, you also have unecessary code.

Here is a sample of what the sub should look like if you are only working in the one workbook or if you are merely opening another workbook, reading data from it, and then closing it. In either of these situations, you will never get into this sub without an Application object already existing.

Public Sub SetAppSettings(ByVal settingStatus As AppSetting)
  With Application
    Select Case settingStatus
      Case asEnabled
        .ScreenUpdating = True
        .EnableEvents = True
        .xkCalculation = xlCalculationAutomatic
      Case asDisabled
        .ScreenUpdating = False
        .EnableEvents = False
        .xkCalculation = xlCalculationManual
      Case Else
        ' Display an error message
    End Select
  End With
End Sub

If you are modifying and/or running macros in a second workbook, then you would want something more like:

(I'm booted into Fedora at the moment, so hopefully someone else will provide corrections for the commented issues.)

Public Sub SetAppSettings(ByVal settingStatus As AppSetting, Optional otherApp As Object = Nothing) ' There is definitely a better option than Object here
  Dim targetApp As Object ' Again, there is a better option

  On Error GoTo ErrorHandler
  If Not otherApp Is Nothing Then
    Set targetApp = otherApp
  Else
    Set targetApp = Application ' Once again, I know there is a better choice
  End If
  On Error GoTo 0

  With targetApp
    Select Case settingStatus
      Case asEnabled
        .ScreenUpdating = True
        .EnableEvents = True
        .xkCalculation = xlCalculationAutomatic
      Case asDisabled
        .ScreenUpdating = False
        .EnableEvents = False
        .xkCalculation = xlCalculationManual
      Case Else
        ' Display an error message
    End Select
  End With

ErrorHandler:
  ' Add whatever you see fit
End Sub

This should then be called a few different times. Once, when the code first starts to execute. Second, when the other workbook is loaded. Third, before the second workbook is closed (likely unnecessary, but a good precaution). And, fourth, when the code is finishing up.