Just A Small Guideline

Feel free to browse the site. Don't be afraid to leave comments, they're supportive.
Please follow me on Twitter @ehldmnt and retweet my posts.
Showing posts with label small problems. Show all posts
Showing posts with label small problems. Show all posts

Sunday, June 2, 2013

Returning to my roots: Tidbits on Bash Shell Scripting

Ah, while creating a small shell script to perform three tasks:

  • Upload to the Testing-PyPi Server (http://testinpypy.python.org/pypi))
  • Reduce the amount of typing on the command line.
  • Possibly provide a way that I could use it in another or different python script to automate this process.
  • (BONUS) Take down the task that I'd like to perform in natively python once I become much more proficient.
I quickly googled the means by which to pass user input to STD-IN to set it to a variable in bash and here is how it's done:



To learn more, pay a visit to the all mighty google. ;D

Follow me on Twitter! @ehldmnt

A random coding tidbit... How to pause your Python code.

Ever needed a pause for dramatic effect. Why not use the native "time" module to get the job done?



Sunday, April 28, 2013

UTAU, MMD, PMD/PMX Editor in Linux. -- Status, Installation, and more.

UTAU



If you know of Vocaloid, you probably know of UTAU. UTAU is a singing synthesis shareware application designed for Microsoft windows [With it's recent Mac Implementation which has spurred some rumors of another version to soon come out for Linux], that allows users to create their own "voice banks" and have their personal "UTAU's" sing in harmony. It is known to at times produce better, more realistic results than Yamaha's Vocaloid, amongst others, but requires more effort on part of the user.


MMD [Miku Miku Dance]


If you know of UTAU, you probably know of Miku Miku Dance. Miku Miku Dance is free software that is designed for Microsot Windows that allows users to move models that either they or others created. This can be use to create lipsyncing videos, music and dancing videos, PV's, home made movies (with the models) amongst other things, frame by frame.

PMD/PMX Editor


This program was also designed for Windows. It is for the creation and editing of .PMD/.PMX files that are used to dance/move/sing in MikuMikuDance.


Prerequisites [Required Programs]:


-- Linux Distribution [Any kind will do, really]
-- Playonlinux
-- Wine
-- Winetricks
-- Japanese Locale Enabled

Assuming that you already have a Linux distribution coming to this tutorial, first, download and install the lastest play on linux version. At the time of this tutorial, that would be 4.2.1. The instructions for installation depends upon your distro. If you use Arch like me, then it's no problem! Installation is as simple as popping a terminal and entering in:

pacman -Syu playonlinux wine winetricks

This command, not only updates your system but it also syncs to the repositories and gives you the proper programs that you need for this tutorial.

The Japanese Locale issue [This will demonstrate how to acquire it in Archlinux], is a no brainer. If locale -a yields anything similar to these:

C
POSIX
en_US
en_US.iso88591
en_US.utf8
ja_JP
ja_JP.eucjp
ja_JP.ujis
ja_JP.utf8 # Specifically this one
japanese
japanese.euc

zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8

Then there is really nothing else you have to do.

Otherwise, uncomment the line ja_JP.UTF-8 in the file /etc/locale-gen. And then run:

sudo locale-gen

If you already have these things, then great, skip this step.

Installation of UTAU




To install utau, it is pretty easy.

Steps:

1. Use Playonlinux To Install the Program.
2. Enjoy!

Step 1:

Select the install button as depicted above.



This dialogue should pop up.





Check testing and this dialogue should pop up, just click okay.



Then type into the search bar: UTAU, this should pop up.

Step 2:

Finish the installer and you're done! If it asks to create a virtual drive and/or a shortcut select yes! You can choose to install the English patch or not. Click on UTAU and hit the "run" button in the upper left corner.


Installing Miku Miku Dance/MMD [WIP -- Check back later for an update!


The installation of MMD is a bit more involved.

Prerequisites [Required Programs]:

-- Playonlinux
-- Wine
-- Winetricks
-- MMD

Steps:
1. Correct Settings, Create the 64 Bit Virtual Drive, and put MMD inside of it
2. Adjust the Windows version
3. Debug to figure out the required programs to run
4. Fix The Layout Issue
5. Enjoy MMD!




Step 1:

First, select tools.

Then select x64 and scroll down to the wine version 1.4-rc4-raw3 and install it. Then click on configure.


In the bottom left corner, select new, run through the installer and select 1.4-rc4-raw3 for your wine version.


Take note of the name of your Virtual Drive. The next part will be easier. Open a terminal and Do:

cd /path/to/the/mmdfile.zip
unzip -x *thezipfile*; cp -a *thefolderthatcomesoutofit* ~/.PlayOnLinux/wineprefix/nameofthevirtualdrive/drive_c/Program\ Files\(x86\)/

Now you go into the PlayOnLinux configuration dialogue and you click on "Create shortcut from virtual drive."



Step 2:

Now it's the time to adjust the Windows version. Click on the Wine tab Inbetween "general" and "install components" and select "Configure wine".



Then in the first part of the Windows 98 looking dialogue box on the bottom right, select "Windows 7". It should be towards the top.


You may now press apply and okay, and then close the dialogue boxes. Leave the main Playonlinux window open, the one that has your shortcuts in it.

Finally, you settings must match the ones I have up on my virtual drive. Select the "Display" tab second to last and then change your settings to match.





Step 3:

In order to complete step five, you'll have to select MMD, and then "debug" on the right hand side above "Report a problem". If no errors are returned and MMD runs successfully, congratulations, move to the next step! Otherwise, watch the error messages dialogue to figure out if there are any necessary .dll's.

Step 4:

With MMD open in Linux at the moment, it looks atrocious.

So, to solve this, click on the window and press  alt+ V and then alt+W (view > separate window). Resize them to your heart's content and enjoy MMD in linux.

Step 5:

So far in this wine version that we've selected, there are no issues with even multimodels. In fact, I feel like it ran faster in linux than it ever did on any of my Windows computers. The raw speed is incredible. The controls like on Windows are the same, so enjoy the familiarity of the program!!

Installing PMD/PMX Editor [WIP -- Check back later for an update!]


Sunday, March 24, 2013

Troubles With Learning Modules Python(2) -- Figured out.

In my last post, I had trouble figuring out why the Fibonacci Series wouldn't print. Then suddenly, after spending a bit of time studying and reviewing knowledge that I had acquired, I realized that the issue was in fact the line 6.

# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print b,
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result 
 
Something as simple as this:
 
 
# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print(b),
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result 
 
That pretty much solved everything for me.
 
Update:  Mon Mar 25 21:47:07

I realized that the issue was with the shell using python 3 instead of python 2. 
Python 2 still uses the print function in the way that I'm used to, python 3 does not.

Troubles With Learning Modules Python(2) -- Figured out.

In my last post, I had trouble figuring out why the Fibonacci Series wouldn't print. Then suddenly, after spending a bit of time studying and reviewing knowledge that I had acquired, I realized that the issue was in fact the line 6.

# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print b,
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result 
 
Something as simple as this:
 
 
# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print(b),
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result 
 
That pretty much solved everything for me. 

Trouble with Learning Modules in Python (2)

So, I was reading directly from the python Documentation, and on this page they present a code that actually creates the Fibonacci series:

# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print b,
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result
 
 
This code has worked before, but this is the first time I've ever run into problems with it on the python
 interpreter.
I've actually typed it in manually at first, and then attempted to utilize this code, and got this error:
 
[python_prac_mod]> python 
Python 3.3.0 (default, Dec 22 2012, 21:02:07) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fibo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./fibo.py", line 6
    print b,
          ^
SyntaxError: invalid syntax
>>> 

Strange as hell. I even tried copy pasting the python code into the file and then saving it. 
That didn't work either. And despite my limited knowledge of python programming, I feel that this error is not
quite accurate. Oh, well, I'll have to look up another tutorial or something.

Friday, March 22, 2013

Frustration: AwesomeWM & My Use of Dvorak

Seeing as I have this lovely devotion to the DVORAK keyboard layout (to the extent that I literally rearranged the entire keyboard, upside down keys and all, specifically to facilitate this need), I tend to get extremely frustrated by what seems to be a bug in Awesomewm.

At first, it was just a minor annoyance, and then gradually it became a bit more than a nuisance as I literally have to reach into my 3 - 5 years of qwerty knowledge in order to remember what which key was supposed to be. Mind you, I've memorized the Qwerty and Dvorak style because there are those times in school where I have no choice but to use it.

This is all besides the point,

Which is that awesomewm is a great Window Manager but it doesn't seem to keep to anything I tell it to, which is extremely frustrating when I have to type Mod4 + R. I've looked into Xorg on the archwiki, amongst other things in the AwesomeWiki, but it seems that the only thing that ever solves it is restarting awesome after typing in "setkbmap dvorak" into a terminal. Thankfully, I have zsh, and that helped me through a lot of the worries because once I find the "s" on the keyboard (Which is right next to a for those that are wondering, where it used to be on Qwerty), I just had to press the up arrow key and found what I wanted.

If I find a solution for this, I'll write up a tutorial.

Wednesday, February 27, 2013

Learning To Code: Python & Linux = Awesome & How to get started on a Linux Operating System

So, in the short period of time that I've spend using GNU/linux (the last 7 - 7&1/2 months), I've acquired more than enough knowledge about command line editing and system administration. The only things I'm really still fuzzy about are the commands top and find, and that's just a small portion of my coding knowledge. I recently just barely dabbled in the art of Java, C, C++, and Javascript, I already know my HTML and my CSS so well that I really don't google much code anymore (except for a few subjects here and there that I'm also fuzzy about -- I'm talking to you --moz-border). The "CLI anxiety" came away from me when I destroyed my ubuntu set up to attempt to install Archlinux last summer and at first I was a bit upset but then I quickly got over it once I successfully managed to install arch. My point is, I really wanted to learn how to code something other than a half-assed webpage or a weebly layout for some friends. I wanted to screw around with different kinds of code, and even create an RPG but unsurprisingly, Linux lacks some RPG makers and ever since even before I switched from Vista [Lovely Service pack 2~!] I had been trying to learn this programming language called: Python.

You can acquire Python for *nix, Windows, Mac OSX, *bsd's etc, and it's a great programming language to learn as far as my very limited experiences go. But the point is, for a beginning learner of a programming language, the complexity of C, C++, and Java was too extreme for me, while Javascript, I found, well, useless to what I wanted to do. Now, the Python documentation is perhaps helpful for many people, but to me, it was really just a pain in my a**. It didn't explain much of anything, or at least didn't have many examples that had the potential of showing me how I could possibly utilize the tricks that were listed. Call me retarded if you want, but I couldn't work it for my life! Then I found Learn Python The Hard Way which to me is an amazing guide that taught me everything I wanted/needed to know and even answered some of my questions. It was clear to me after a while of reading the Python Documentation that it was definitely not geared towards newbies to programming and programming languages.

It was useless for me to try and figure out where I was going with it, because it gradually began to confuse me as I read it without any other form of foundation. That is what most linux users aspiring to write code need in my personal belief. For those interested in learning a programming language, for those ubuntu users who just recently switched from Windows, or for those who are in the process of doing so, or even those who just want to know how to use the command line, I suggest to you download the e-book on Linuxcommand.org and get to reading. You don't even have to devote a lot of time to learning what you read because that guide is so basic that it's not even funny. The youtube user metalx1000 has a ton of bash tutorials and such.

Getting back on track, one who is interested in getting started on learning how to program should look into lifehacker's javascript guide, because it teaches some foundational things, especially for those who decide that they want to dive right into Java code. But this is all in my opinion, everyone has a different way of learning and they might actually find the Python Documentation a lot easier to learn than I might. The Internet is crawling with options, do what goes best with you.

Friday, February 22, 2013

Minecraft On Archlinux -- Tutorial

There are a few ways to go about getting minecraft on Archlinux and while the Wiki is there to guide you through . I recommend using my favorite AUR installer yaourt to get the job done.

Here's my Video Tutorial: