Some useful date hacks
- Display only date when receiving full datetime type from MySQL
echo date('Y-m-d',strtotime($mysql_datetime)); |
2. Add or subtract x days or months to a date.
link
Some useful date hacks
echo date('Y-m-d',strtotime($mysql_datetime)); |
2. Add or subtract x days or months to a date.
link
After you select a dropdown, you might want the next dropdown to be filtered.
Some resources:
Quick notes (I’m using a Mac)
composer dump-autoload – to regenerate autoload files. especially when error run migrate or db seed.
This is my notes on digital ocean.
Click here to register with DigitalOcean and get free USD10 to start using the service.
I used to install Ubuntu 14.04 with LAMP on it. With this also get SFTP ready.
Change root password. If logged in as root
Add new user
Manage groups for user
Connect to server via SSH, in terminal type the following:
To get default MySQL root password, write this in terminal. Remove the file once done change the MySQL root password.
To enter mysql console
Secure MySQL server. Run following command and answer all the questions.
To change MySQL root password:
To only allow certain IP to access directly to database
Enable .htaccess (mod rewrite)
To restart services (can also use stop and start)
Install sendmail service (used by PHP mail function)
Change permission for directory (especially for ‘upload’ directory)
Change the timezone. By default using US time zone
To turn off server
find / -size +50M -ls
To update/upgrade OS
Disable root login on SSH
Block IP’s from accessing certain services
Other measures:
vi, vim, nano
Click here to register with DigitalOcean and get free USD10 to start using the service.
2 simple steps.
1. Create or update the .htaccess as follow
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
OR
RewriteEngine On
RewriteBase /app/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /app/index.php [L]
OR
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
ErrorDocument 404 /index.php
2. Update the config/config.php file to this
$config[‘index_page’] = ”;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<title>Title here</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div>
<h1>Heading here</h1>
<p>Content here</p>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html> |
Some of useful functions but not all the time use. Will be a quick reference everytime want to use them.
URI segment
http://example.com/index.php/news/local/metro/crime_is_up $this->uri->segment(3); //will produce: metro
DB SQL
$query = $this->db->query("YOUR QUERY");
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->body;
}
}
$this->db->select('title, content, date');
$this->db->from('blogs');
$this->db->join('comments', 'comments.id = blogs.id');
$this->db->where('name !=', $name);
$this->db->where('title', $title);
$query = $this->db->get('mytable');
end
Use this code to display all post titles in your blogspot.com. You can place this code using widget in sidebar.
Replace YOUR___BLOG with your own blog url.
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2FYOUR___BLOG.blogspot.com%2Ffeeds%2Fposts%2Ffull+&utf=y" charset="UTF-8" type="text/javascript"></script> <noscript> <a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2FYOUR___BLOG.blogspot.com%2Ffeeds%2Fposts%2Ffull+&utf=y&html=y">View RSS feed</a> </noscript>
Sample insert
$data = array( 'title' => $title, 'name' => $name, 'date' => $date ); $this->db->insert('mytable', $data);
Sample update
$this->db->update('mytable', $data, "id = 4"); OR $this->db->update('mytable', $data, array('id' => $id));
Sample delete
$this->db->delete('mytable', array('id' => $id));
Sample to get data
$where = "name='Joe' AND status='boss' OR status='active'"; $this->db->where($where);
Now I’m doing some research to start developing mobile applications.
There are several tools came out when I was doing the search.
Drag and drop tools
Website to APK conversion tools
Registration to place app on market
Other related tools
Other tools (need to filter all the ads etc)
html5 mobile app