Wednesday, April 29, 2015

Working smart, not hard

I'm currently interning at Loadmaster, an oil rig design company based in Houston. Yesterday I was tasked with writing a script to delete files in our scanned files directory that were over 45 days old.

Doesn't sound too complicated right? Well a quick google search revealed that many others have done similar projects.

Starting with a script from TechnicalKeeda as a base, I saved time by tweaking his script to my needs instead of starting from scratch. After adding a few printlns to readout more information, increasing the scan to target all file types in the directory, and changing the days required for deletion eligibility I had a working script in 15 minutes.

After that I wrote a simple batch file to run the .jar, set it up on our server's task scheduler and voilĂ . Here's my finished code, and an example of the readout.
.

/**
 *
 * deletes files in the scan directory
 */
import java.io.File;


public class ScanDelete {


  private String dirPath = "\\\\utility\\scans";

  public static void main(String[] args) {
    ScanDelete deleteFiles = new ScanDelete();
    deleteFiles.delete(45, "");
  }

  public void delete(long days, String fileExtension) {
 
    File folder = new File(dirPath);
 
    if (folder.exists()) {
   
      File[] listFiles = folder.listFiles();
   
      long eligibleForDeletion = System.currentTimeMillis()
        - (days * 24 * 60 * 60 * 1000L);
   
      for (File listFile : listFiles) {
        System.out.println("browsing...");    
        System.out.println("File Name: " + listFile.getName());
        System.out.println("Last modified: " + listFile.lastModified());
        System.out.println("Eligible for deletion: " + eligibleForDeletion);
        if (listFile.lastModified() < eligibleForDeletion) {
          System.out.println("Deleting File" );
          System.out.println("-----------------------------------" );
          listFile.delete();
        } else {
          System.out.println("File Spared" );
          System.out.println("-----------------------------------" );
        }
      }
    } else {
      System.out.println("Error: Folder Doesn't Exist!");
    }
  }

Here's the point: One of the most valuable skills you can learn as a programmer is resource management. Take advantage of the fact that there have been thousands before you trying to solve the same problems, and don't waste time writing small scripts that have already been written for you.

Tuesday, April 28, 2015

[Release] Juche! The North Korean RPG

"The interactive text based informative thriller Juche will keep you enthralled for minutes! Nay, tens of minutes! - I.G.N.

Info about the story and earlier posts showing the progression of Juche

Dislaimer: The game isn't fully complete. Inventories, quests, and shops haven't been finished. You're welcome to do anything you'd like with the source as long as I'm credited if you release anything.

Features: 
  • Amazing randomized fighting dialog
  • 6 maps, 10 enemies, tons of NPC's and Tons of Bugs  other features :)
  • Load & Save system
  • Admin command system
  • Unique NPC dialog (Including North Korean News NPC's and the tip giving Sensei of ultimate wisdom)
  • Minimalistic game art
  • Tray message system that drops alerts in the bottom right corner of screen when needed




Spoiler - Inside the source there's a list of admin commands you can use to cheat if you'd like. Enjoy!

Sunday, April 26, 2015

Pass Phrase Lite!

With the addition of grueling bug fixes, a tutorial, and the credits page, the free version of Pass Phrase is now complete! (Pass Phrase Lite)

Featuring 5 unique categories and hundreds of phrases P.P.L. sports a surprising amount of entertainment.

Unfortunately Pass Phrase Lite won't be released until Pass Phrase Plus has been finished.
Pass Phrase Plus will be available for $1 in the Windows Store, features 10 categories, anti-phrase repeat algorithms and over 800 phrases.

Tutorial & Credits page screenshots:



Sunday, March 15, 2015

Pass Phrase Rev. Two & Becoming Official!

Continuing towards my goal of being a published programmer I'm now a registered Windows Developer. As fancy as that sounds it just means I gave Windows $20 and a bunch of my personal information to gain the ability to publish apps in the store. WOO

Pass Phrase has received heavy updates as the release date closes in:
- New Simplified GUI
- Bug fixes and sound effects
- Refurbished graphics
- Hundreds of new phrases


As of right now I've been using Windows Visual Studio 2012 but I'm thinking of switching to Unity as it makes porting to other platforms incredibly easy and has better graphics handling.

Tuesday, February 17, 2015

More Windows Phone Development? Pass Phrase!

Don't worry folks, Juche is still in progress. However as the result of a recent chain of events I'm taking a semester off from school & I'm going to use this time to get a few more lucrative apps onto the Windows Marketplace.

Pass Phrase is a phrase game similar to Catch Phrase(But with way more innuendo!), where the person in possession of the phone has to make the others on their team guess the phrase using words other than those on the screen.

I've recently joined a development group called Final Turn Studios, and plan to release Pass Phrase at the end of the month under that name. Here's a few screenshots of the game as is (WIP)