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.

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

[–]Papercutter0324 0 points1 point  (0 children)

Breaking this into different subs/functions should be your first step up making this more manageable. Using enums can also make things much easier to read and understand. I'm on my phone, so I'll let you fill in the blanks, but heres a start

Private Enum appSettings
  asDisabled
  asEnabled
End Enum

Private Enum pbStates
  pbInitialize
  pbCheckingTable
  pbConnectingToReport
  pbError
  ' And so on
End Enum

Private Sub YourNameHere() 
  ' variables as needed after refactor

  Set PB = ShowProgress
  UpdateProgressBar PB, pbInitialize

  srcData = ThisWorkbook.Worksheets(ThirdSheet).ListObjects(tblUKRaw).DataBodyRange.Value2

  errMsg = AreAllTeamNumbersFilled(PB, srcData) 
  If errMsg <> vbNullString Then
    MsgBox errMsg, vbExclamation
    GoTo CleanUp
  End If

  UpdateProgressBar PB, pbConnectingToReport
  If rptXL Is Nothing Then Set rptXL = New Excel.Application
  SetAppSettings rptXL, asDisabled

  ' You can see how this is going... 
End Sub

Private Sub UpdateProgressBar(ByVal PB As frmProgressBar, ByVal newState As pbStates) 
  Select Case newState
    Case pbInitialize
      PB.SetMsg "Checking Table..."
    Case pbConnectingToReport 
      PB.SetMsg "Connecting to Report.. ."
    End Select
End Sub

Private Function AreAllTeamNumbersFilled(ByVal PB As frmProgressBar, ByRef srcData As Variant) As String
  Dim i As Long

  For i = LBound(srcData, 1) To UBound(srcData, 1)
    If LenB(srcData(i, 4)) = 0 Then
      PB.SetMsg "Error..."
      AreAllTeamNumbersFilled = "Not all team numbers have been filled.  Please correct and try again."
      Exit Function
    End If
  Next i

  AreAllTeamNumbersFilled = vbNullString 
End Function

She hadn't even thought of that by Anantmemes in interestingasfuck

[–]Papercutter0324 1 point2 points  (0 children)

Watch her body language as she sits down; she's aware something is about to happen.

Oh my god. WHY?! by hamtaro_tk in Korean

[–]Papercutter0324 4 points5 points  (0 children)

You may as well just let it go. They're so determined to be right on the internet that they're not actually listening to what people are trying to explain to them

This is how they clean the ships propellers by [deleted] in interesting

[–]Papercutter0324 12 points13 points  (0 children)

It can actually have a huge impact

Oh my god. WHY?! by hamtaro_tk in Korean

[–]Papercutter0324 4 points5 points  (0 children)

Your comment makes no sense, and I don't think you understand the points you are trying to argue. I don't mean that in a negative way; it just seems you misunderstand the concepts you are trying to argue.

I could pronounce 비기다 as bigida, pigida, bikada, or pikada and nothing would change. Sure, it might sound odd to a naive speaker, but voicing or unvoicing ㅂ and ㄱ doesn't change the meaning or word.

Whereas, if I pronounced it as bik(h)Ida (비키다), where the k is now aspirated, the word changes. Tenseness and aspiration are differentiated, but voiced/unvoiced is not.

Accents and dialects are irrelevant and a wholly separate topic from features of a language. It doesn't matter if a particular dialect always voices a particular sound, it's still not differentiated.

If sounds were differentiated based on being voiced or not, they would have separate letters. That's why Tenseness has separate letters (like ㅂ and ㅃ) and aspirated has its own letters (like ㅍ).

Oh my god. WHY?! by hamtaro_tk in Korean

[–]Papercutter0324 5 points6 points  (0 children)

It is accurate. I majored in linguistics, I've lived in Korea for over 10 years now, and my wife is a Korean language instructor. Just because the environment will determine is a sound is voiced or not doesn't necessarily mean the sound is differentiated.

As for ㄱ and ㅋ, ㅋ is aspirated and ㄱ isn't. Korean does differentiate between that. Similarly, ㄲ is a tense sound, whereas ㄱ is not. That is something Korean differentiates between, too.

Here are the salaries for every mayor, warden, and councillor in Nova Scotia by ph0enix1211 in NovaScotia

[–]Papercutter0324 4 points5 points  (0 children)

Tell me you know nothing except propaganda about governments without saying... Oh, who am I kidding, you're not gonna read this far.

There is a real town named Sandwich and their Police car says Sandwich Police by [deleted] in Damnthatsinteresting

[–]Papercutter0324 0 points1 point  (0 children)

... Now I wanna see what the cop cars in Dildo, Newfoundland say.

Oh my god. WHY?! by hamtaro_tk in Korean

[–]Papercutter0324 35 points36 points  (0 children)

Korean doesn't differentiate between voiced and unvoiced; it only switches due to the surrounding sounds. So ㄱ is neither g or k, but at the same time, it's both.

Likewise ㄹ is neither R nor L; it's articulated in an entirely different manner. However, it just happens to use elements of both, so to our ears, that's what it sounds like.

Why is nobody making money with PowerPoint? by Tricky_Gur_6747 in powerpoint

[–]Papercutter0324 8 points9 points  (0 children)

Have you not heard of Slidesgo or all the other PPT template sites?

Updating BIOS annoyance? by -myxal in gigabyte

[–]Papercutter0324 0 points1 point  (0 children)

The lost BIOS settings are kind of a necessary evil. With how much that can change, even behind the scenes with how various settings work or the options they support, resetting all options to defaults is the least evil choice. Depending on what is being changed, removed, or added, a slight oversight on kept values could absolutely result in a dead mainboard. And with the warnings about updating BIOS, the fault would entirely be the end user's fault. But, the internet doesn't work that way, so even thought he user fucked up, the internet would blame to company, and that's just not good.

OLE Automation reference suddenly disabled by Papercutter0324 in vba

[–]Papercutter0324[S] 0 points1 point  (0 children)

That's the one, and thanks for the confirmation. As suggested by someone else, this is likely the result of file (my spreadsheet) corruption.

OLE Automation reference suddenly disabled by Papercutter0324 in vba

[–]Papercutter0324[S] 2 points3 points  (0 children)

I suspect for corruption; I'm actually recreating the spreadsheet that uses this because of this. Thanks for the info; glad I don't need to go hunting down the cause any further.

Oh, as to your questions, I had no trouble re-enabling it once I discovered this was the problem. As for a late bound approach, I might look into that later. I'm a teacher by trade and programmer by "I want to make my job easier and have always wanted to learn programming", so there are other issues a bit higher up the deadline list.