Simplest Way To Connect to CMU Wireless
Posted in post on June 30th, 2010 by Aditya – Be the first to commentI have read and understand the agreement blablalba
http://rawr.net.cmu.edu/
I have read and understand the agreement blablalba
http://rawr.net.cmu.edu/
Today, I discovered how easy it is to share my school’s Mac OS X (10.5.x) screen with another non-Mac OS computer. I know it is not a sophisticated or such but I’m posting it here as I know this might not be obvious to most Windows user or even Mac user who often live in their own world.
My first attempt to do this screen sharing thing is by following this super complex tutorial. http://howto.diveintomark.org/remote-mac/
The tutorial by Mark Pilgrim comes with videos and links and nice background music and such – making it looks highly reliable for beginner like me. It sounds like a very secure procedure, with explanation about SSH, man-in-the-middle and many more. However, this tutorial miss one crucial aspect regarding setting up fixed domain, tcp-forwarding and those ip related stuff that might confuse 99% of world population. Not to mention his tutorial only shows configuration for home internet with a particular ISP. The mac that I use for example was located behind CMU’s firewall and some other obstruction, making his tutorial to be only for geeks.
I could not set up the screen sharing capability through his tutorial.
*swearing phase*
For some reason all the VNC client that I use, RealVNC, TightVNC, UltraVNC does not seems to work properly. The clients fails with message like: ”Server did not offer supported security type” (tightVNC), ”No matching security types” (realVNC), ”Incompatible Version” (UltraVNC).
Then I google this error message only to found out this very long tutorial on how to tweak Mac to accept screen sharing. The tutorial can be found in this forum:
http://forums.macrumors.com/showthread.php?t=380251
In short, the tutorial asks me to perform some kind of surgery to the mac machine which obviously I was not so keen of doing so.
*swearing phase*
Then Justin, one of my research mentor pointed out that for mac, there should be no additional set up other than setting up screen sharing. He suspects its a mac-windows uneasy relationship thing.
After few googling I stumble upon one of the forum post somewhere – I forgot from where but it basically said I need to set the password for screen sharing so that those windows based client can actually connect to the mac.
IT WORKS… wtf
Here is how.
Go to (top-left-apple)-> system preferences->sharing->tick screen sharing together with the users that can be allowed to screen share.
Click Computer Setting to set up the password for allowing screen share.
http://wiki.apache.org/tomcat/TomcatOnMacOS
note
./startup.sh && tail -f ../logs/catalina.out
This is a quick and painless way to remove duplicate rows from a MySQL database table. It requires no programming or PHP coding whatsoever. Without further ado…
STEP 1
CREATE TABLE new_table as SELECT * FROM old_table WHERE 1 GROUP BY [column to remove duplicates by];
STEP 2
DROP TABLE old_table;
STEP 3
RENAME TABLE new_table TO old_table;
STEP 4
DO NOT FORGET TO RESET THE PRIMARY KEY AND FOREIGN KEY AGAIN
from
http://www.justin-cook.com/wp/2006/12/12/remove-duplicate-entries-rows-a-mysql-database-table/
based on the tutorial here
http://viralpatel.net/blogs/2010/02/create-url-shortner-in-java-struts2-hibernate.html
its said
You can download all of the above JARs from http://www.ibiblio.org/maven/
yeah rite… it takes me quite some time to download the correct jars.
below is the jar that you might need.
http://rapidshare.com/files/399870721/lib.zip
Controller
function index()
{
$this->load->model('Gallery_model');
if($this->input->post('upload')){
$this->Gallery_model->do_upload();
}
$this->load->view('gallery');
}
view
<?php
echo form_open_multipart('gallery');
echo form_upload('userfile'); //userfile is default... dont bother changing
echo form_submit('upload', 'Upload bebs!');
echo form_close();
?>
class Gallery_model extends Model {
var $gallery_path;
var $gallery_path_url;
function Gallery_model()
{
parent::Model(); // a must for constructor
//APPPATH IS AVAILABLE IN THE ENTIRE CODEIG
$this->gallery_path = realpath(APPPATH . '../images');
$this->gallery_path_url = base_url().'images/'; //dunno for what
}
function do_upload()
{
$config = array(
'allowed_types' => "jpg|jpeg|gif|png",
'upload_path' => $this->gallery_path,
'max_size'=>2000
);
$this->load->library('upload', $config);
$this->upload->do_upload(); //do upload
//want to create thumbnail
$image_data = $this->upload->data(); //get image data
$config = array(
'source_image' => $image_data['full_path'], //get original image
'new_image' => $this->gallery_path . '/thumbs', //save as new image //need to create thumbs first
'maintain_ratio' => true,
'width' => 150,
'height' => 100
);
$this->load->library('image_lib', $config); //load library
$this->image_lib->resize(); //do whatever specified in config
}
}
Using version 1.7.2 from one of the video sample
in controller…
function create_member()
{
$this->load->library('form_validation');
// field name, error message, validation rules
$this->form_validation->set_rules('first_name', 'Name', 'trim|required');
$this->form_validation->set_rules('last_name', 'Last name', 'trim|required');
$this->form_validation->set_rules('email_address', 'Email address', 'trim|required|valid_email');
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
$this->form_validation->set_rules('password2', 'Password confirmation', 'trim|required|matches[password]');
if($this->form_validation->run() == FALSE )
{
$this->signup();
}
else
{
$this->load->model('membership_model');
if($query = $this->membership_model->create_member())
{
$data['main_content'] = 'signup_successful';
$this->load->view('includes/template', $data);
}
else
{
$this->load->view('signup_form');
}
}
}
function signup()
{
$data['main_content'] = 'signup_form';
$this->load->view('includes/template', $data);
}
in membership_model
<?php
class Membership_model extends Model {
function validate()
{
$this->db->where('username', $this->input->post('username'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('membership');
if($query->num_rows == 1)
{
//$this->load->model('membership_model');
return true;
}
}
function create_member()
{
$new_member_insert_data = array(
'first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'email_address' => $this->input->post('email_address'),
'username' => $this->input->post('username'),
'password' => md5($this->input->post('password'))
);
$insert = $this->db->insert('membership', $new_member_insert_data);
return $insert;
}
}
version used 1.7.2
in controller
function index()
{
$this->load->library('pagination');
$this->load->library('table');
$this->table->set_heading('id', 'Title', 'The Content');
$config['base_url'] = 'http://localhost/ci/index.php/site/index';
$config['total_rows'] = $this->db->get('data')->num_rows();
$config['per_page'] = 10;
$config['num_links'] = 20;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
//db, limit , segment
$data['records'] = $this->db->get('data', $config['per_page'], $this->uri->segment(3) );
$this->load->view('site_view', $data);
}
in view
<body>
<div id="container">
<h1>super pagination with code igniter</h1>
<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
</body>
from http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-7-pagination/
function Index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'SuperAwesomeAccount@gmail.com',
'smtp_pass' => 'SuperAwesomePassword'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n"); /* for some reason it is needed */
$this->email->from('SuperAwesomeAccount@gmail.com', 'Aditya Lesmana Test');
$this->email->to('SuperAwesomeReceiver@gmail.com');
$this->email->subject('This is an email test');
$this->email->message('it is working Darling
');
if($this->email->send())
{
echo 'Your email was sent, dammit';
}
else
{
show_error($this->email->print_debugger());
}
}
notice that I load the email library everytime this class is called and not via application/config/autoload.php
$this->load->library('email', $config);
and pay attention to
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'SuperAwesomeAccount@gmail.com',
'smtp_pass' => 'SuperAwesomePassword'
);
can be moved (not copy, MOVED) more ood-ly into config/email.php (in this case CI will try to look for config for ‘email’ controller at config folder named ‘email’. Inside config/email.php the code wil turn something like
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'SuperAwesome@gmail.com';
$config['smtp_pass'] = 'Alamak';
in which you need to change controller/email.php, removing unnecessary $config
$this->load->library('email', $config);
to
$this->load->library('email');
the first line is to prevent unauthorized access while the rest is pretty self explanatory.
ps: the closing statment for php is not mandatory. Omitting them is considered best practice
via
http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-3
I keep getting this error whenever I want to run tutorial created by Jeffery http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-3/
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1652
Based on cursory research, I try to fix it by enabling php_openssl from my wamp’s php.ini … and it works like charm.