Thursday, August 26, 2010

Neuro-Programmer 3

Neuro Programmer (Formally known as neural noise synthesizer) is a cool program that was has audio clips to help do various tasks. For example there are audio clips ranging from 10 to 50 minutes to help fall a sleep faster, get motivated, get energized, concentrate to be creative, learn or prepare for tests, etc.

Once installed you have a trial for 15 days at which point your required to buy a license.

I'm experimenting with various clips to see if they work, so far the sleep thing didn't work for me but it has in the past.

Download the program here:

To get fuller version you may or may not be able to use a peer to peer program but you didn't hear it from me!

P.s. you can also record the audio straight from the program while playing it using Audacity.

Let me know about your experiences :)

Sunday, August 22, 2010

PHP never expire vs timeout cookies vs sessions

As mentioned earlier I have a newly found hobby with PHP MySQL programming, and after lots of trial and error in the development of this project I found a working method for a 'remember me' button and the expiring cookies and sessions.

The first part is login script, here you will determine if they want to be remembered in our terms this means to never time out the user. This is done with simple cookie to set the expiration a week from now, here is my code:

$long=time()+60*60*24*7; //Setting up the expiration time
$short=time()+60*25; //short time (25 minutes) for those without 'rememberme'
$username = $params['username'];
//Check whether the remember me box is checked
if (isset($params['rememberme']) && $params['rememberme'] == "on"){
setcookie('username',$username,$long); //username cookie and long expiration
setcookie('expire','no',$long); //expire is set to no
setcookie('expire','yes',$short); //expire is set to no
setcookie('username',$username,$long); //username cookie with short expiration

Easy right?
Next setting the users that will be timed out after inactivity I decided 25 minutes are enough because it is also the time default sessions get timed out.
Notice that the username cookie is still with a long expiration, the expire cookie is in control of expiration and the username just saves the username data which is required in various places to determine access and such.

After the login page you will need a function that is called every time something is requested, (in order not to annoy the users and only time out after inactivity) this can look something like this:

function check_login(){
if ($_COOKIE['expire'] == "no"){
$_SESSION['user'] = userInfo($_COOKIE['username']); //reset the session
}elseif ($_COOKIE['expire'] == "yes"){
setcookie('expire','yes',time()+60*25); //reset the cookie time
$_SESSION['user'] = userInfo($_COOKIE['username']); //and session
echo " Session timed out. To login  input type=\"button\" value=\"Reload Page\" onClick=\"window.location.reload()\"";     //use the tag opening before input, blogger messes here lol

More coming soon...

Monday, August 16, 2010

Ultimate FTP/SFTP text editor winSCP

Today's cloud computing put to the max by my newly found hobby of coding in PHP/MySQL and JavaScript (plus a little CSS) but it was only made more enjoyable when I found the great way to edit the code visually.

So I thought to share it with the loyal eduboris blog followers!

First component is the FTP/SFTP, the free and open source windows application I found is WinSCP
Second is the editing, while the default editor is OK for quick fixes it definitely is not something you can use to code, so for many years now I used Notepad++.

To combine the two and have a truly cloud computing coding environment go to WinSCP (while logged in) Options>Preferences>Editor>select the first one and click Edit> choose external editor and browser to your Program files and find notepad++ directory, and executable (if you installed it, otherwise go to the extracted folder)

From here on in consider your ultimate sftp text editor setup and ready to use!
The features I really like about Notepad++ are:

  • Default language detection with color coding
  • Default line count and word wrap
  • Great stability under huge files (6k+ lines)
Anyway feel free to comment about this and let me know what you think below.