Showing posts with label dev. Show all posts
Showing posts with label dev. Show all posts

Saturday, April 19, 2014

Installing Octave on OS X 10.8

Couldn't find a post that worked for me. All the (will fail)'s are just in case of dependencies, if not you could probably just do these steps: 1, 4, 6, 5, 7.

1) brew update && brew upgrade

2) brew install gfortran (will fail)

3) brew install octave (will fail)

4)
wget https:/raw.github.com/Homebrew/homebrew-science/master/hdf5.rb
mv hdf5.rb /usr/local/Library/Formula
cd /usr/local/Library/Formula
brew install hdf5.rb

5) brew install octave (will fail)

5) brew install gfortran

5) brew install octave (will fail)

6)
wget https:/raw.github.com/Homebrew/homebrew-science/master/qrupdate.rb
brew install qrupdate.rb

7) brew install octave

Now we have everything installed, to run GNUPLOT (since OS X 10.8 has deprecated support for X11)

1) cd /usr/local/share/octave/site/m/startup
2) append "setenv ("GNUTERM", "X11")" to octaverc

Tuesday, December 3, 2013

Git for Windows publish branchfails...

On top of having to deal with Windows 8.1 on Virtual Box atop a Mac (i.e. slow), there's this thing where mid-sized Visual Studios solutions can't be pushed. My stuff is about 65 MB large...

So here's how to get around the "Can't publish branch" error. A "$ git push" won't help here...

1. On Github for Windows, go to your repo
2. Open github in shell (there's a settings button on top right)
3. Check that remote already added
(i.e. try:
$ git remote add origin http://github.com//
Expected output: "fatal: remote origin already exists")
4. $ git config http.postBuffer 524288000
This increases the buffer size...
5. git push -u origin master
This should push your new repo.


It's quite late, which might explain all the trailing sentences.

Saturday, November 9, 2013

Ninja Crazy

Been making games for a class. The lecturer's from Microsoft so it's Windows 8 stuff, but other than that in terms of the game design, genre, concept etc. we're free to do anything we want.

So far of my first twenty games, here are my favorite one is this platformer, Ninja Crazy. It evolved from my first scrolling background SHMUP, Space shooter. It's a Windows 8.1 app (keyboard/ mouse/ touch support) written with DirectX and C++. Textures courtesy of the web.

Ninja crazy - a platformer


Basically you're a ninja on the run, but there's an infestation of crabs in your way, so you must kill or avoid them before they eat you up.
- When your HP drops, you'll flash red.
- You can shoot blue fireballs at the crabs.
- You can also jump and multi-jump (appoximately flying).
- To replenish Health, jump up to grab the apples.
Good luck!

Code is on github right now, but am kind of embarassed to show it because the OOD's quite ugly- it's very obvious that I was/ am still figuring out- in Space Shooter and Ninja Crazy- what's the best way to model a game object.

So I'll be refactoring my code, and for my next game, I want to have more static obstacles to jump and run on, more intelligent enemies (instead of arbitrarily positioning them and giving them different starting speeds to make it hard), and obstacles that spew fire that the ninja must avoid.

I also saw this Hyper Light Drifter on Kickstarter, and it's amazing. I would like to have such an exploratory game where there are many beautiful worlds of all kinds to explore. That would be awesome.

Monday, October 22, 2012

Unwaitlist v1.0 at HackOlympics

Unwaitlist is my first app. Currently, the cron jobs are disabled because enrollment period is closed, but the signup, introductory status checking and email/ text works.

I made it at my first hackathon last Saturday. HackOlympics. It was just two blocks from my apartment, and had I think 40 people at least. Didn't know most of them, but met this guy called PA who was really friendly. Among the projects, there was a tutorial aggregation social site TUTE, a text message help site TextGuru that crowd-sources advice, a site that crowd sources for chefs to cook and deliver to you Let Me Cook That For You, and a site that takes your background image or video, then scrapes Google Image search for content-related and color-correct images and makes a collage from those images. RedBananaPenguin.

The winner, music++, was a Tap dance like music game that only uses javascript "because HTML5 is the future, not flash", where the programmers determined the movements captured on the laptop's webcam by comparing frames. They won the Tech award and Grand Prize Winner.

12PM : 12PM

I signed up solo, and there were 4 only other solos, but before the hacking began we had to pitch ideas to each other or get pitched to by teams, because the organizers preferred it. And I agree. So much more can be accomplished. But generally the vibe was either, "I really want to get my idea off" or "I code a lot better than any of you so I wanna do my own thing." A senior teamed up with me. It was also her first hackathon. She didn't know higher-than-C++-level languages, but did a couple of databases classes, so she wanted to make one. I didn't know anything about databases. Unfortunately, she left later without leaving a db, so we didn't mesh our code together.

Anyway, I planted a bug that was very lame when I rooted it out later. The things is, the user inputs a url, and the app parses the html for stuff. But instead of opening the correct page, we were going to a general page. Think of it as searching for 'X' in google, and coming up with 'www.google.com/?=X' but being re-routed to 'www.google.com'. I thought it was redirecting to the main site and taking away my query string. Finally, I suddenly realized that I'd been cgi-escaping the ampersands in the url I was passing, mucking up the url.

After this bug, things went fast. I read up some on NoSQL, but the GAP Datastore was exceedingly easy to use for basic stuff, so I had a database up in like two minutes. Then I wrote up two Cron jobs, one to periodically check for whether or not the class status' hand changed, then to text/email the user; one to clear out the database before and after enrollment period.

Unfortunately, I didn't have the app done by the demo pitch, but I couldn't stop working on it and it pretty much finished itself at home.

Future

The only thing is that I need to see how this app works when enrolling actually happens, because now that enrollment's over, we don't have classes changing from 'Closed' to 'Open' or vice versa. What happens when there are many users? How efficient is my database querying, and Cron jobs? I know that the status-checking, user-input, and text/email functionality is working. I also wish that the user didn't have to paste the url over. While I have a couple of checks to hopefully prevent breakage, it's not the most user friendly implementation.

Sunday, October 21, 2012

Getting started on Heroku with python for Mac

Was trying to get Heroku up and running, but ran into some trouble that's not documented because my Mac >= 10.7. This may be useful for beginners.

To make a heroku app, you need virtualenv, which you need pip to install easily. To get pip:
1. Install homebrew (the instructions provided by heroku's link to installing python for Macs (which have a weaker version of Python) is outdated)
- scroll all the way down to copy and paste the CLI text from the 'Install Homebrew' box
- you may need to run '$ brew link python' if there was a warning saying that it was not linked
-- if prompted to force link because some files already exist, do so:
$ brew link --overwrite python
- run '$ brew doctor' to check your homebrew
- if there is the warning that your PATH prefers 'usr/bin' to 'usr/local/bin', run:
$ echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
then Quit and Open Terminal again, run '$ brew doctor', and the warning should be gone.
- The message 'Your system is raring to brew' would be the most optimal setup of homebrew, but you may have macports and stuff that gets in the way. That's OK, you can still install virtualenv
- This is a great intro to homebrew
2. Install pip
$ brew install pip

Logging into heroku on the CLI with Credentials, throws error 'Cannot allocate memory...'
- Reinstall the heroku Toolbelt. You don't have to uninstall or remove the toolbelt because heroku takes care of it for you.

Setup a virtualenv in your app's folder
- If running '$ virtualenv --distribute venv' outputs that the command virtualenv doesn't exist, it's because virtualenv is in the python package that pip installed.
$ python2.7 ~/../../usr/local/lib/python2.7/site-packages/virtualenv.py --distribute venv

Activate the virtual environment to run your app, which you need to do everytime you open your app for development.
$ source venv/bin/activate

As per the Heroku guide, make your dependencies text with '$ pip freeze > requirements.txt' and  Procfile (file name must be 'Procfile')  with 'web: python <your_file>.py' inside the text editor.

$ foreman start
- Say you have 'import jinja2' but it can't find the library. In your application, if you import libraries like jinja2 or webapp2, run '$ pip install jinja2' in the application folder.
- If using Python, and after '$ foreman start' you don't see anything after 'started with pid XXXX', create an '.env' file with 'PYTHONUNBUFFERED=TRUE' inside.
- Everytime you update <your_file>.py, Ctrl-C, '$ foreman start' to restart the process. The debug log will change on the local site, but not the actual code running underneath. It's not Google App Engine where the dev app is actually live.