Hello again. This time I'm going to present you my latest work. It's a CSS3 framework designed to be as lightweight as possible while maintaining a clear code structure. It's similar to other ones, with responsive grid (of 24 columns), form style, colors, etc. The main difference is that this is quite easy to edit and to extend. I've tried to provide a neutral style, to let the designers personalize it on their own way, or to modify the existing code with no complications at all.
You can check the demo and download it from:
http://rmmfree.github.io/shine_css/
The Github project is:
http://github.com/rmmfree/shine_css
Code and Chocolate
Wednesday, April 27, 2016
Saturday, March 19, 2016
How to optimize Google Fonts load
When using Google Fonts, or any other custom fonts, many users might find an usual and irritating problem: the page doesn't render until the fonts are loaded. The page keeps blank during 2 or more critical seconds while the system fetches the required font files.
There are many ways to solve it but they usually are very complicated. Here I bring you a really easy way to solve it.
What I wanted to do is simply load the page with the default browser fonts (sans, arial or any other) and once is has been rendered, start to request the custom fonts to the server.
The solution is really straightforward:
Firstly create a CSS class for the text sections with the font that you want to use and present the HTML tags without that style:
Then add the following JQuery code in the header of your page:
That's it. What we are doing is to render the h1 tags by default showing the texts immediately and once it's loaded, we look for the Google fonts and apply the style to our text sections.
There are many ways to solve it but they usually are very complicated. Here I bring you a really easy way to solve it.
What I wanted to do is simply load the page with the default browser fonts (sans, arial or any other) and once is has been rendered, start to request the custom fonts to the server.
The solution is really straightforward:
Firstly create a CSS class for the text sections with the font that you want to use and present the HTML tags without that style:
h1.styled { font-family: "Rhodium Libre"; }
Then add the following JQuery code in the header of your page:
<SCRIPT TYPE="text/javascript">
$(document).ready(function()
{
$('head').append("<link href='https://fonts.googleapis.com/css?family=Rhodium+Libre' rel='stylesheet' type='text/css'>");
$('h1').addClass('styled');
});
</SCRIPT>
That's it. What we are doing is to render the h1 tags by default showing the texts immediately and once it's loaded, we look for the Google fonts and apply the style to our text sections.
Wednesday, February 17, 2016
How to set the default return-path and sender values in exim
Migrating a website to a new hosting can be sometimes a little bit problematic. One common problem related to VPS email management is when you try to send messages from PHP with the Exim Mail Transfer Protocol.
Perhaps you have found that in the source of your emails the Return-path and Sender address values are set incorrectly, using the value of your hosting username instead of the real email address, something like:
To solve it you only need to:
1) Access to your VPS by SSH
2) Edit the file: /etc/exim/exim.conf
3) Look for the REWRITE CONFIGURATION section (you can find it in Vi typing /f and entering 'rewrite conf'
4) Create a line under 'begin rewrite' and enter something like this:
If everything went fine your email headings should be set perfectly.
Perhaps you have found that in the source of your emails the Return-path and Sender address values are set incorrectly, using the value of your hosting username instead of the real email address, something like:
Return-path: <hosting-username@your-domain.com>
Sender: <hosting-username@your-domain.com>
Forcing these settings in the headers of your PHP source code might not work, even when forcing the 5th parameter in the mail function, or adding it in the sendmail parameter of you php.ini.To solve it you only need to:
1) Access to your VPS by SSH
2) Edit the file: /etc/exim/exim.conf
3) Look for the REWRITE CONFIGURATION section (you can find it in Vi typing /f and entering 'rewrite conf'
4) Create a line under 'begin rewrite' and enter something like this:
hosting-username@your-domain info@your-domain.com
5) Save it and restart your exim service, typing 'service exim restart'.
If everything went fine your email headings should be set perfectly.
Saturday, January 9, 2016
How to avoid spam in phpBB forums
phpBB is a great forum management software that includes multiple configuration options, with many templates and a huge community. Also, it's open source and free. So, does it has any inconvenience?
Yep, an important one. It get lots of spam. Fortunately, there are several methods of getting rid of it, but they are not very effective and requires some extra effort by the administrator and sometimes by the users: captchas, password strength, cipher files, email filtering and so on. However, they definitely don't stop the huge amount of automatic spam posts.
How do spammers do it? It's quite simple for them. The use an automatic posting software that lets them submit hundreds of posts with just one click. It registers a random username and submit messages without the need of the user interaction. It works because every phpBB forum works internally in the same way, but if you change an important function name, for registration, for example, their software will not work with your forum.
For example they will try to register automatically with this kind of address: http://www.exampleforum.com/ucp.php?mode=register&sid=ef2d8343918da15b0d0df78c05a1a82b
If you change the 'register' word in that link for 'registration', 'signup' or 'hamburger', for example their software will not have access to your forum.
I did this and my spam rate fell to 0%. I have not had a single junk message for more than 3 years. It's easy to do, but requires a little patience and very basic programming skills.
Let's do it!
You only have to download your forum source code. Make a security copy, keep it safe and now we are going to modify some files. You'll need a text editor for that, like Sublime Text, Notepad++ or a similar one. Don't use Wordpad or Microsoft Word because they add extra characters that will corrupt your text files.
We are going to modify the 'register' string and we will replace it by 'registration', 'registr' or any other word in all the files. In your text editor do a search in your phpBB folder (Edit -> Search in Folder) and it will show you that there are 3 files with this string (the content of the following lines may vary depending on your phpBB version. This is for 3.0.11):
/includes/functions.php, the line 4601 of this file will be replaced by this one (it should be identical but modifying mode=register by mode=registr):
'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=registr')
/includes/ucp/ucp_register.php, in lines 132, 133, 137,149 y 471 you have to change mode=register by mode=registr in each of them
/ucp.php, line 61 should by replaced by
case 'registr':
/viewonline.php, in line 289 we will change 'register' by 'registration' as well:
'mode=registration' => 'VIEWING_REGISTER',
That's all. Simply upload these 3 files to your server, replacing the existing ones and test it. Be sure that everything is working fine, for example, creating a new user and check if you can login and post messages.
If everything went fine this will solve your spam problems definitely.
Yep, an important one. It get lots of spam. Fortunately, there are several methods of getting rid of it, but they are not very effective and requires some extra effort by the administrator and sometimes by the users: captchas, password strength, cipher files, email filtering and so on. However, they definitely don't stop the huge amount of automatic spam posts.
How do spammers do it? It's quite simple for them. The use an automatic posting software that lets them submit hundreds of posts with just one click. It registers a random username and submit messages without the need of the user interaction. It works because every phpBB forum works internally in the same way, but if you change an important function name, for registration, for example, their software will not work with your forum.
For example they will try to register automatically with this kind of address: http://www.exampleforum.com/ucp.php?mode=register&sid=ef2d8343918da15b0d0df78c05a1a82b
If you change the 'register' word in that link for 'registration', 'signup' or 'hamburger', for example their software will not have access to your forum.
I did this and my spam rate fell to 0%. I have not had a single junk message for more than 3 years. It's easy to do, but requires a little patience and very basic programming skills.
Let's do it!
You only have to download your forum source code. Make a security copy, keep it safe and now we are going to modify some files. You'll need a text editor for that, like Sublime Text, Notepad++ or a similar one. Don't use Wordpad or Microsoft Word because they add extra characters that will corrupt your text files.
We are going to modify the 'register' string and we will replace it by 'registration', 'registr' or any other word in all the files. In your text editor do a search in your phpBB folder (Edit -> Search in Folder) and it will show you that there are 3 files with this string (the content of the following lines may vary depending on your phpBB version. This is for 3.0.11):
/includes/functions.php, the line 4601 of this file will be replaced by this one (it should be identical but modifying mode=register by mode=registr):
'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=registr')
/includes/ucp/ucp_register.php, in lines 132, 133, 137,149 y 471 you have to change mode=register by mode=registr in each of them
/ucp.php, line 61 should by replaced by
case 'registr':
/viewonline.php, in line 289 we will change 'register' by 'registration' as well:
'mode=registration' => 'VIEWING_REGISTER',
That's all. Simply upload these 3 files to your server, replacing the existing ones and test it. Be sure that everything is working fine, for example, creating a new user and check if you can login and post messages.
If everything went fine this will solve your spam problems definitely.
Hello World!
Hello developers and chocolate lovers. This is the first entry for this blog, that will be related to tips and tricks about computers and software development in general.
After the hard work it's ok to relax a little while and eat some sweets, with your dentist's permission :)
Subscribe to:
Posts (Atom)