How to ask good Stack Overflow questions.

Many new programmers have low opinions of the community on Stack Overflow. For those of you who don’t know, Stack Overflow is a Q&A site meant specifically for coders. However, it has a reputation for… how shall I say it… being a bit of an elitist gatekeeper-esque, unfriendly place. On the flip side, Stack Overflow is the largest repository of developer answers and questions on the internet, and it’s one of the most visited websites for coding questions by developers, if not the most.

Continue reading How to ask good Stack Overflow questions.


It helps me if you share this post

Published 2018-07-28 04:26:07

Small PSA: It’s doubtful hackers are watching you watch

This morning, I received an email from a scrambled Outlook email address that claimed they had explicit recordings of me and demanded I pay them Bitcoin. Their proof? A password of mine from a few years ago. They’d probably acquired it in one of the numerous database leaks that happen all the time. Here’s the message with sensitive information removed:

I do know, [OMITTED], is your password. You do not know me and you're most likely thinking why you are getting this mail, right?

In fact, I actually setup a malware on the adult vids (sexually graphic) site and do you know what, you visited this website to experience fun (you know what I mean). While you were watching video clips, your internet browser began functioning as a RDP (Remote Desktop) with a keylogger which provided me with accessibility to your screen and cam. Immediately after that, my software gathered all of your contacts from your Messenger, Facebook, and email.

What exactly did I do?

I created a double-screen video. First part shows the video you were watching (you've got a nice taste lol . . .), and next part displays the recording of your webcam.

What should you do?

Well, in my opinion, $3900 is a fair price tag for our little secret. You will make the payment via Bitcoin (if you don't know this, search "how to buy bitcoin" in Google).

BTC Address: [OMITTED]
(It is cAsE sensitive, so copy and paste it)

Note:

You have one day in order to make the payment. (I've a special pixel within this e mail, and now I know that you have read through this email). If I don't get the BitCoins, I will, no doubt send your video to all of your contacts including close relatives, coworkers, and so on. Nonetheless, if I receive the payment, I will destroy the video immidiately. If you need evidence, reply with "Yes!" and I definitely will send out your video to your 12 friends. It is a non-negotiable offer, so please do not waste my personal time and yours by responding to this e mail.

There are a few things wrong here, which is why I immediately knew it was scam.

  1. A keylogger records keystrokes, it doesn’t provide people with the ability to look at my screen and webcam. There are methods to gain access to these, but it is not called a keylogger. Someone knowledgeable enough to pull this off would know this and use the correct terminology.
  2. I don’t have a webcam.
  3. Browsers do not have the authority to share my desktop, nor did I give any one in the last month or two.
  4. I don’t use Messenger or Facebook.
  5. I have 0 friends on my non-existent Facebook account, not 12.
  6. Numerous spelling mistakes all throughout the email.
  7. The generic mention of “adult vids”. Yeah, sorry. No.

But I do have to wonder how many others fell for, and do fall for this kind of scam. Always make sure your antivirus is up to date, use common sense, and make sure you keep your passwords updated.


It helps me if you share this post

Published 2018-07-11 14:42:21

Changing the refresh rate of your monitor or laptop screen dynamically

Frequency Switcher Source Code on Github

I recently purchased a new laptop with a 144hz screen. It looks amazing, but I don’t want to run the 144hz on battery power, because usually on battery you wouldn’t be playing a game or doing anything that demanded that high refresh rate. However, if I plug my laptop in, that’s when I would be doing activities that would benefit from the extra hertz. This is a small program to automate switching frequencies of a monitor.

(UPDATED LINK TO ARCHIVED SOURCE CODE HERE)


It helps me if you share this post

Published 2018-06-30 03:54:27

How to only run a program when your laptop is plugged in

Here’s a tricky one. How do you run a program or exe ONLY when your Windows laptop is plugged in? Additionally, you’d want it to automatically exit when your laptop was unplugged and you were using battery power. I recently stumbled across this problem when I wanted to run Rainmeter on my laptop when it’s plugged in.

The answer is to use the Task Scheduler.

Here’s what you’ll need to do.

  1. Open Task Scheduler.
  2. Click “Create Task…” under Task Scheduler Library.
  3. Name your task and give it a description.
  4. If your application needs admin privileges, make sure to check the box at the bottom, “Run with highest privileges”
  5. Open the Triggers tab at the top. Click “New…” at the bottom.
  6. Change the Begin the task value to “On an event”.
  7. Under “Settings”, change the radio button selection from “Basic” -> “Custom”.
  8. Click “New Event Filter…”.
  9. Disregard the “Filter” tab, and instead change the tab to “XML”.
  10. Check the box at the bottom that states “Edit query manually”.
  11. Paste this XML in:
<QueryList>
  <Query Id="0" Path="System">
    <Select Path="System">*[EventData[Data[@Name='AcOnline']='true']]</Select>
  </Query>
</QueryList>

Click “OK”, and then “OK” again.

Once back on the main page, you may now configure your “Actions” tab to launch your program of choice.

Once finished, proceed to the settings tab and make sure you have these settings:

Congratulations! You can now test it by plugging in your laptop and watching your program launch itself. Unplugging it should quit it instantly.


It helps me if you share this post

Published 2018-06-29 00:09:10

So what happened was…

Okay, so this is an update of what happened with the whole “I accidentally wiped my entire hard drive”.

The Non-Techie Version

If you don’t know much about computers, read this.

I accidentally told the program that the folder it should delete was my main hard drive when it was uninstalling itself. Not much else to it.

The “I know that arrays start at 0” Version

  1. The uninstall string I set for the program in the registry passes the argument “uninstall” to my program.
  2. My program takes the argument and knows it’s about to uninstall itself. It then asks for admin access.
  3. Once achieving admin access, it then copies itself to a temporary directory. This is the TEMP path in Windows.
  4. The original program starts the copy of itself with two arguments: “uninstall”, and the path of the original. In this case, it was “C:/Program Files/Searchifier/searchifier.exe”.
  5. The program knows since it got passed an argument with a path to delete it and uninstall registry keys and the like.
  6. However, the path I passed was not verbatim. Therefore, the arguments passed looked like this: uninstall C:/Program Files/Searchifier/searchifier.exe
  7. This caused a massive problem. Since there is a space between ‘Program’ and ‘Files’, Windows feeds that to my program as THREE separate arguments, not two.
  8. My program receives three arguments:
    1. uninstall
    2. C:/Program
    3. Files/Searchifier/searchifier.exe
  9. The program only cares about the first two. It knows it’s going to uninstall itself, so first it tries to delete the file at the location “C:/Program”. This fails, but the program continues on.
  10. It next attempts to delete the directory at which the program resides. To do this, it gets the parent folder of the path it just tried to delete. This is… the C: drive.
  11. It then calls a recursive delete function on “C:”.
  12. I then spend the next 6 days in deep depression trying to recover all my files. 🙂

With that, SEARCHIFIER is now out! I’ll make another post about this later as well, but it’s now officially [HERE].


It helps me if you share this post

Published 2018-06-07 19:47:12

I never thought this would be me, but…

I remember a while ago (probably a year or two), my sister brought her computer over to my family’s house and thrust it at me. “It’s not working.” Was her wholly unhelpful description of the problem. Being used to this sort of treatment, I pressed the power button to begin troubleshooting. Almost instantly, the screen came to life and displayed nothing else but a missing drive icon. “Looks like a failed hard drive.” Was my response. “You backed up, right?” Of course she hadn’t. Luckily, by analyzing the hard drive from an external source, we were able to recover all of her important information. This was a lesson to me, always back up. Your computer could fail when you least expect it.

Or at least, I thought I learned a lesson. It was eleven o’clock the other night when I was testing out the uninstall function of my new program. It was alllllmost ready for release, 99% done. Just had to get the uninstallation feature correct. Everything was working perfectly. And then I did what no developer should ever do (apparently). Ran it on my main computer/harddrive. As a developer/coder, all sorts of crap can always go wrong, so you should always have a some layer of protection between programs and your main working computer… or a backup. Going with that, you should never test on production (the main server you use for anything, company-wise or not). I ran the program, and everything looked great. Now time to test the uninstallation function. I went to the apps list on Windows, and confidently clicked “Uninstall”. My app, as planned, requested admin permissions. I clicked “Yes” without a second thought. And waited.

Nothing happened. So I clicked uninstall again. Same result. That’s odd. I thought to myself. I’ll check the code. I opened up File Explorer to see that half the folders in my C: drive were missing. …What? Was my first thought. I backed out to “My Computer” view to find that I had an extra 500 GB of space available to me that had been freshly freed up not 10 seconds ago. My hand shakily moused over the Recycle Bin, praying that the files would be there. But no. My code bypassed the Recycle Bin. I still have no idea what happened, but the deletion of my files was so severe that as I was powering down the computer to try and save as much data for data recovery later, Windows was throwing errors about being unable to find critical system files and .dlls.

My guess as to what happened? Actually not sure. You can bet I’m going to post an update when I figure it out though. The data recovery program I’m using says that it’s gonna take 10 more hours at least for just my Documents folder, though. Lesson learned. Always keep backups.


It helps me if you share this post

Published 2018-05-31 23:25:44