2014-03-12

Level Up - Puzzles: Four Random Cards, Turn All Face-Up, Blindfolded (Solution)

Problem:
You have four cards placed in a 2x2 grid pattern. Each card is randomly placed either face up or face down. Your goal is to flip all the cards face-up. But, there are a few restrictions:

  • You are blindfolded and never know which cards are face up or face down. Nor do you know how many cards are flipped either way.
  • Your movements for flipping cards are limited. Each turn you can flip either one or two cards.
  • You will only be told when all cards are face up. You will get no other notification on how the cards are orientated.

What are the fewest amount of turns required to ensure all four cards are (eventually) flipped face up? And how?


Ascii art on how the layout may look. Each card represents a card:
1 2
3 4

Sidenote: When this brain teaser was first told to me last week, the person explained the possible limited card movements as, roughly, "you can either flip the diagonal cards, a column of cards, or a row of cards. Or, you can flip just a single card.". I'm pretty sure the way I explained it ("each turn, you can only flip one or two cards") is the same and much easier to understand, so I guess that lowers the puzzle difficulty a little bit for you, the reader.


Solution: 

2014-03-11

Level Up - Puzzles: Connect a 4x4 Grid of Dots With 6 Contiguous Lines (Solution)

Before reading this post, you should read my last one which introduces the puzzles better.

A common brain teaser is to connect a 3 by 3 grid of dots with four straight lines without picking up the pencil. After solving a 3x3, try to solve a 4x4, 5x5, etc. I have a proof that all of them have a solution.
Click read more to see the solutions and explanations:

2014-03-10

Learned Experience

Many things learned are useful in other aspects of life.

Recently, I have learned a lot about business taxes and now personal taxes are so much easier to tackle. And, reading the IRS publications aren't that bad anymore. Prior to doing all of the business taxes research, I thought the IRS website and publications were overly complicated. Now, I consider each pub to be light reading even though they are small font, three columns per page, and typically around 5-40 pages.

I feel good.

~ Danial Goodwin ~



2014-03-08

Level Up - Puzzles: Connect a 4x4 Grid of Dots With 6 Contiguous Lines (5x5 w/8, 6x6 w/10)

(TLDR: After solving a 3x3, try to solve a 4x4, 5x5, etc. I have proof that all of them have a solution.)

A common brain teaser is to connect a 3 by 3 grid of dots with four straight lines without picking up the pencil. See image below:

2014-03-06

Published Two New Apps: Flappy Gravity and Gravity Runner

Using Construct 2, I've created two new HTML5 apps which run natively in Windows 8 and Windows Phone. I'd like to encourage you to try the apps. The links go to the store where you can see screenshots of the apps.

Gravity Runner
Gravity has gone crazy. There's only one hope... But, beware, the more times you change gravity, the more your power goes down.
- You are in control of gravity!
- Infinite, randomized levels
- Touch-enabled

Available now:
- Windows 8
- Windows Phone


Flappy Gravity
Gravity gone wrong! Change gravity with every tap! Avoid the obstacles.

2014-03-03

Level Up - Business: How To File the Annual Report (Florida)

When you run a business in Florida, you must submit an Annual Report every year between January 1st and May 1st. It will cost $138.75 to file. And, if not filed in time, then there is a $400 penalty fee and possibility that the company is "administratively dissolved". But, the good news is that the report is easy to fill out and submit, and it's all done online.

When you complete the form online, you'll be able to edit your business address and member(s) address(es). Then you don't need to file a separate form for changing the addresses with the state (an extra $25).

First thing is, you don't need to spend any extra money for a third-party to complete this state requirement for you. They may charge upwards of $35 to complete the form that is easily completed within five minutes.


To complete your Annual Report:
1. You will need, your business's document number, Federal Employer Identification (FEI/FEIN) or Employer Identification Number (EIN), an email address to keep on file, and about five minutes.
2. Go to https://services.sunbiz.org/Filings/AnnualReport/FilingStart
3. Start the form by imputing your document number, then read the directions on the page. It is all straight-forward.
4. Pay the filing fee and submit. Now, you are done.


Disclaimer: This is not legal advice. This post is mainly a pointer to help others who also need to Annual Report for Florida. I'm sure other states in the US also have a page similar to the one linked here.

~ Danial Goodwin ~



2014-03-01

Level Up - Business: How To Change Your Filed Information With The State Government (Florida)

If the information you have filed with the state has changed, then you are supposed to let the state government know about it. This blog post will simply point you to the page where you can find all the information that you need to change your filed emails, addresses, FEI/FEIN/EIN, your business name, and more.

For the state of Florida, you will need to go to the Sunbiz site at http://www.sunbiz.org/address_change.html.

Now that I have this information written down in my blog, next time I need to make a business change I will remember to just look at this post to find the link easily, rather than searching through the different government business websites.

~ Danial Goodwin ~



2014-02-27

Level Up - Android Dev: How To Automatically Extract Hardcoded Strings To res/values/strings.xml

This is just one of the many refactoring features of Eclipse. Using this extract feature, you won't even need to open res/values/strings.xml to add the String resources nor manually write out reference to the resource.

This saves a lot of time, and allows the best practice of putting String constants away from the UI/Java files so that localization can be performed easier. This method I'm about to show you is especially productive because it can change all instances of that particular String to point to the xml string resource so that you don't have to do it individually one-by-one. (I'm doing maintenance on code that has everything hardcoded, so this is a lifesaver.)

To automatically extract the String, it's easy enough:

Step 1: Highlight the entire String that you would like extracted and sent to res/values*/strings.xml
Step 2: From the menu bar, select Refactor->Android->"Extract Android String..."
Step 3: Preview options and confirm changes.

Step 2: Automatically extracting string menu option.


Step 3: Many different great refactoring options to choose from.


This works in the XML and Java files for your Android application. And, this is much quicker than manually changing all instances of hardcoded Strings to getString() and @string/.


~ Danial Goodwin ~



2014-02-25

Level Up - Webmaster: How To Get Started With MediaWiki

Want to create your own wiki pages like Wikipedia? You can organize all your thoughts, add notes for your new book you want to write, and more. The wiki can be either public, private, or half and half. You decide.

Going through this process will allow you to edit any and all features that are provided with MediaWiki, the wiki engine for Wikipedia and many other wiki sites.


Step 1. Download MediaWiki, it might be as a .tar.gz file, which in that use 7-Zip to unzip the compressed file, you may have to use 7-Zip twice to fully open it and see the source files.

Step 2. Copy all the files to a directly on your domain.com/mediawiki/w/ directory. One of the easiest ways is using FileZilla, navigating to the public directory using the GUI, then click+drag all the files into the directory. Note: The reason I said that particular directory is because it will allow you to do a lot more later on, like setup the domain.com/wiki site to serve the pages in your wiki. As you wait for all your files to upload to your server,

Step 3. Create a new database and user for that database. This is the method that the MediaWiki instance will be using to save and retrieve all the information for your wiki.

Step 4. Wait until all the files have finished uploading to your domain.com/mediawiki/w/ directory, then navigate to that page in a browser. It'll say LocalSettings.php file not found, so this is where you will use a wizard to setup all the properties of your site, like public/private and more. Each of these properties can always be changed later. I recommend reading through all of them to understand better what is available to you.

Step 5. After going through the entire wiki, the wizard will prompt you to download the LocalSettings.php file which you can then add to the same folder that you previously installed all the files in.

Step 6. In a browser, navigate to your domain.com/mediawiki/w/ and see that you have your main default page show. Congrats, you now have an instance of MediaWiki running on your own server.


If you run into any problems during this process, you can click on the little question marks in the wizard to pop up more information of a section or input area. Another great source of information is on the official install page.


~ Danial Goodwin ~



2014-02-22

Published New App: Wall Ball

I just created a new game using a concept that I haven't seen in any other game. It's almost like a single player pong game with different objectives.

Using the Construct 2 game engine, so that I only have to create the code base once, I've made the game available for Windows 8 and Windows Phone.

Try it out now:
- On Windows 8
- On Windows Phone



~ Danial Goodwin ~



2014-02-21

Level Up - Construct 2: Don't Confuse "+" And "&"

I just spent over an hour debugging a problem in my Construct 2 code. Suffice to say the solution is now ingrained in my brain. Now, I want to explain a little intricacy of C2.

TLDR: In Construct 2, whenever you are dealing with text and you want to concatenate/append additional text (or a variable), then you need to use the ampersand "&" symbol. Using the plus "+" symbol will cause a silent error/bug, i.e. the program won't tell you that there is a bug. Ex: If I try to set text to "Score: " + PlayerScore, then the value of the variable `PlayerScore` will not appear. The correct way to set the text would have been: "Score: " & PlayerScore. Note, the only difference between the two codes was the plus and ampersand.

Other programming languages have "overloaded" concatenaters, meaning the "+" symbol in some languages like Java are contextual. Depending on the value to the right and left of the plus sign, it will act a different way rather than not working at all, as in C2.

In Construct 2, the only time that you should use the plus symbol is when you want to add two numbers together. That is it.

Anyways, the issue that I was trying to solve for over an hour involved using WebStorage and Functions with programmatically assigned parameters. Saving and retrieving values was working great, just not exactly the way I wanted it to. I had a highscores table for easy, medium, and hard difficulties, but they were all staying the same values across each of them. My buggy code included lots of ampersands surrounding the entire area, but basically, this is what it looked like: Save("HighScore" + LevelDifficulty, PlayerPoints). Note: The plus sign is wrong.

No programming languages I use have the ampersand as a String concatenate. So, when I viewed the code snippets a few times, even completely writing them, my mind knew exactly that String + String should be working.

If I hadn't already read the manual/documentation before this point, then I probably wouldn't have found the answer myself.


Experience built through learned mistakes.
~ Danial Goodwin ~

ps - Just in case I haven't said it enough yet... When you are using Construct 2 and dealing with text, use the ampersand, &. Don't use the plus, +, sign!




2014-02-20

Experience Publishing to Different App Platforms

Q: How do you gain experience in publishing apps to a certain platform?
A: You create 100 apps and publish them.

Q: How do you lose experience in publishing apps to a certain platform?
A: You create 100 apps and publish them. (Details below)

I don't think anybody actually asks the second question (but I just did!). Anyways, after the first few publishes, programmers/hackers get tired of the same routines. Our jobs are basically to automate things and makes things easier!

So, that's what I did and am doing. I'm starting to automate the entire process of publishing an app. There is this great tool that is a high-level scripting language called AutoHotkey. With it, I can easily open any program programatically, and send any keyboard and mouse commands that I want to the program. Basically, a macro builder for the entire end-user operating system.

About half of the process is automated now. I'm about halfway to my personal goal of 100 apps. My goal would be to make the entire process from app file to publish a one-click process. I know it's possible, and it'll be fun to build.

Once the process is all automated, I can be free to forget the process and start thinking of other abstractions to make.

;)
~ Danial Goodwin ~



2014-02-19

Level Up - Webmaster: How To Randomly Redirect Visitors To Different Websites

There is a very simple method using PHP to have visitors automatically redirected to another site.

Why this is useful:
- User clicks "Take me to a random" page. You can finely-tune the random outcome.
- You are doing some A/B testing and want to sent users to different locations to test.
- Or, like me, you want to share your various websites/games, from a single button.

Try clicking
Ex: http://apps.simplyadvanced.net/windows8/redirect

Step 1: Here's all the PHP code that you need:

$urls = array("siteA.com",
              "siteB.com",
              "www.example.com"); $url = $urls[array_rand($urls)]; header("Location: http://$url"); ?>

Step 2: Done

Or, if you want to redirect the visitor after they visit a certain URL on your domain, then simply create an "index.php" file in the public directory that you want users to be redirected from, then the above code is all that you need to put in it.

Try it: Random Windows 8 Games created by me.
Try it: Random Windows Phone Games created by me.

~ Danial Goodwin ~



2014-02-18

Published New App: One-Click Saga

Today (and yesterday), I created this "One-Click Saga" game using the Construct 2 game engine. C2 definitely allows great games to be created with ease.

Description:
Three games to master. Flappy's too tired to flap anymore, so he is taking a ride on different airborne vehicles. Rules are the same: tap to save the clone bird's life! But, in each game a tap does something different...

Available Now:
- Windows 8
- Windows Phone
- HTML5


~ Danial Goodwin ~



2014-02-17

Level Up - Programmer: How To Quickly Setup And Use Git And GitHub

A long time ago, the first time I started trying to learn Git and GitHub, I thought it was an unnecessarily complex process. All I wanted was simple version control and easy collaboration. So, instead of learning Git, I just made everything really modular. For one of my teams, we even just worked in completely different files, and it worked out okay.

But, now, I want to explain the absolute basics on how to start, in order to drastically reduce the learning curve. You can always find more detailed information later. And, you can get started right now!

Assumptions:
- You already know what Git is.
- You are running Windows OS.
- You already have folder/file(s) in mind for added a version control system to or want to do easy collaboration on code projects.
- You want to get started with GitHub.
- You are okay with basic instructions meant for the easiest use of Git/GitHub.

Git
Step 1: Download Git.
- Make sure you have "Git Bash" to be installed also, and you can add it to your [right-click] contextual menu also during the install process. (And/or you can add Git to your Path.)


Step 2: Configure Git.
- Open Git Bash (either right-click in file explorer or find it through search)
- Type the following two lines into the console, and change the red parts to your own information:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Step 3: Setup project to work with Git.
- Navigate (using cd) the console to the directory where you want to enable Git.
- Run the following lines to setup the folder to work with Git and "save" all the files in the directory.
git initgit add . 
git commit -m "Initial commit"

And, now you have version control. Just do those last two lines again whenever you want to save a new version. Change the red part to something descriptive of the change.



GitHub
Step 4: Create a GitHub account.
- If this is your first time using GitHub, you will need to create an SSH key. After entering the following, hit enter again to save to default location (your user folder/.ssh).
ssh-keygen -t rsa -C "your@email.com"
- The console tells you where the public key has been saved. Open that file in Notepad++ and save the contents to GitHub.com->Profile->Edit Profile->SSH Keys->Add SSH Key. (Each arrow -> is basically another click.)
- Check for success by running:
ssh git@github.com

Step 5:  Create a new repository (sometimes called a "repo")
- Click the big green button somewhere on GitHub that says "New repository"
- Name the repo and create it.
- On the page you are navigated to, find/copy the "SSH clone URL". This will be used in the next step and looks something like, "git@github.com:danialgoodwin/MyFirstRepoNameHere.git"


Step 6: Pull From GitHub, then Push To GitHub.
- Setup the location that you will push to and pull from. The part in red should be substituted with your info from step 5. (The following should all be on one line.)
git remote add origin git@github.com:andrew8088/Shazam.git
- You always want to "pull" from GitHub before you begin your work because others may have updated the code:
git pull origin master
- Now, you can finally update your code to GitHub!
git push origin master


For more great information and details, please visit:
- Easy Version Control with Git
- Official GitHub site, there should be large buttons wanting to help you further.



~ Danial Goodwin ~