Tags » Code Snippet

min() / max() problems in C++

항상 C++로 코딩을 하면서 min()이나 max() 함수(최소값/최대값을 리턴하는 함수)를 쓸때 이상한 에러를 맞닥뜨리곤 한다.

나중에 안 사실이지만 이 것은 min()/max() 라는 이름으로 선언된 함수들끼리 서로 충돌을 일으키기 때문이다. 301 more words

C

Get Browser Details Using PHP

This PHP function can be used to get the details of the browser.


function getBrowser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";

//First get the platform? 321 more words
Code Snippet

Go back to the previous page in PHP

Although there are many methods to do this, I prefer the following code to go back to the previous page in PHP.


session_start();
$url = basename($_SERVER['PHP_SELF']);
$query = $_SERVER['QUERY_STRING'];
if($query){
$url .= "?".$query;
}
$_SESSION['current_page'] = $url;

… 109 more words
Code Snippet

Re-sampling Image In PHP

When a user uploads a high quality image, you might have to reduce the image size or re-sample to show it in smaller screens or as thumbnails so the loading time can be reduced. 110 more words

Code Snippet

Codeigniter - Placing assets folder

While many practices are followed while placing the assets folder in Codeigniter, I feel that the best place is in the root folder along with the application directory as shown below. 61 more words

Code Snippet

Remove index.php from URL in Codeigniter

Open applications/config/config.php and make the following changes :

Replace


$config['index_page'] = 'index.php';

With


$config['index_page'] = '';

And add the following code to a new file and save it as .htaccess inside the root folder : 21 more words

Code Snippet

Add Overlay For A Background Image In CSS

If you are looking for a cross browser solution to add an overlay to a background image with css, look no more. Here I’m adding a black transparent overlay to the header image. 64 more words

Code Snippet