Editing Mika/Notes
From WikiDotMako
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
=[[http://wiki.mako.cc/Mika/Notes/Public_Health Public Health]]= | |||
The page got too long, so I moved it to a subpage. | |||
= | =Movies= | ||
I liked these movies: | |||
* | * Trouble the water | ||
* Cube | |||
* MST3K Pumaman | |||
---- | |||
==Computer Stuff== | |||
Writing down things I've learned. Some miscellaneous stuff are: | |||
* | * AJAX example: Checks if the username you entered is taken. | ||
: | * Javascript example: Drag choices up and down. | ||
= | ===MySQL=== | ||
====Cheat Sheet==== | |||
* mysql_connect() | |||
* mysql_select_db() | |||
* mysql_query() | |||
* mysql_num_rows() | |||
* [http://php.net/manual/en/function.mysql-free-result.php mysql_free_result()] | |||
* mysql_close() | |||
'''Problem''' | |||
I tried to write a php and connect to mysql in it but I got an error: | |||
= | Fatal Error: undefined function mysql_connect() | ||
'''Solution''' | |||
[http://www.webmasterworld.com/forum88/5216.htm This page] suggested that mysql isn't enabled by dafault in php5. I installed php5-mysql and restarted apache2 (don't know if that was necessary) and now it works. | |||
---- | |||
'''Problem''' | |||
I restarted my computer because I couldn't start gimp unless I was root. Clint told me that I should sudo /etc/init.d/dbus restart , which basically restarted my whole computer. Since then, I couldn't use mysql because I kept getting this error: | |||
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) | |||
'''Solution''' | |||
I followed [http://forums.mysql.com/read.php?11,42525,46765#msg-46765 this] and restarted mysql by: | |||
/etc/init.d/mysql restart | |||
But it fails. It seems like I touched my.cnf and didn't restart mysql, so when my computer restarted, it incorporated the changes I made in my.cnf and mysql stopped working. I reinstalled mysql-server through apt-get, restarted mysql and now it's fine. | |||
---- | |||
'''Problem''' | |||
I have a bunch of text files from USDA, which contain bits and pieces USDA ASCII databases. I want to put them into mysql. | |||
'''Solution''' | |||
1. I found schema.sql that Erik created, so I'm going to borrow it rather than creating my own. | |||
mysql databasename < schema.sql -p | |||
'''Problem:''' | |||
mysql> create database newdatabase; | |||
ERROR 1044 (42000): Access denied for user 'user'@'localhost'... | |||
'''Solution:''' | |||
[http://dev.mysql.com/doc/refman/5.1/en/creating-database.html mysql] | |||
1. Check grants for 'user'@'localhost' in mysql: | |||
mysql> show grants for 'user'@'localhost'; | |||
2. Log into mysql as root (has all privileges) and change grants for a specific user: | |||
mysql> grant all privileges on *.* to 'user'@'localhost'; | |||
Query OK, 0 rows affected (0.00 sec) | |||
3. Log back into mysql as user (now has all privileges) and try creating a new database again. | |||
---- | |||
===Django=== | |||
---- | |||
*Tried setting up Django on my computer by following this [http://itpro.nikkeibp.co.jp/article/COLUMN/20081031/318265/?ST=develop&P=4 tutorial] | |||
'''Problem:''' | |||
It worked mostly ok but I couldn't go further than the second to the last coding box on page 4. I kept getting long error messages. | |||
'''Solution:''' | |||
[http://docs.djangoproject.com/en/dev/intro/tutorial02/ Django tutorial about django.contrib.admin] | |||
I | 1. Check if I typed in the correct codes. | ||
2. Check if the output are the same everwhere: | |||
Although the codes were correct, they didn't create all the necessary things, so it couldn't find the index.html. | |||
* | * I went to setting.py to specify: | ||
* | ** the absolute path for Template_Dir. Don't forget the , after '/path/' . | ||
* | ** two additional Installed_Apps: myprj_myapp (where I save my project) and django.contrib.admin . Run python manage.py syncdb afterwards. | ||
* | |||
* | |||
This created myapp_post and django_admin_log in mysql database. | |||
---- | |||
= | ===Javascript=== | ||
---- | |||
[http://java-script.seesaa.net/category/2493027-1.html JS Tutorial] | |||
---- | |||
===HTML=== | |||
'''Problem:''' | |||
I didn't know what <td> meant. | |||
'''Solution:''' | |||
[http://www.w3schools.com/TAGS/tag_td.asp This website] says: An HTML table has two kinds of cells: | |||
* Header cells - contains header information (created with the th element) | |||
* Standard cells - contains data (created with the td element) | |||
---- | |||
'''Problem:''' | |||
I didn't know what <form name="form1"> meant. | |||
'''Solution:''' | |||
"A form is an area that can contain form elements. | |||
Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form." | |||
[http://www.tohoho-web.com/js/index.htm とほほのjavascript] | |||