Category: Coding

  • Log the date & time each time you turn on your Windows computer

    Log the date & time each time you turn on your Windows computer

    In the morning, I sometimes forget the time I log into the time-tracking system in my workplace so I stay a bit longer to make sure I don’t get an “undertime”.

    I thought that my computer at work could help me with this issue somehow. I hoped there was a Windows program that can record the dates and times I turn my computer on. I tried searching for an application like this on Google but couldn’t find any, and wasn’t sure what keywords to search for. (^_^) Someone suggested that I make a Windows Batch File. And so after some web search I came up with this Windows Batch File, which I will later set up to be run each time Window starts.

    This Windows batch file doesn’t tell me exactly what time I came into the office, but it helps, because it logs the date and time I turned my computer on. And turning my computer on is the first thing I do on my office desk. 🙂

    What is a Windows batch file?

    How does this Windows batch file work?

    The Windows batch file is run every time Windows starts, and each time the file is run, it gets the current date and time then saves it into a file. Each time Windows starts, it creates one file with the date and time.

    Like I said, turning my computer on is the first thing I do when I arrive at the office, so the time in the text file written by the program gives me an idea of the approximate time I came in.

    Here’s a preview

    Save files with current date and time with Windows batch file
    Save files with current date and time with Windows batch file
    of the results:

    How to make a batch file that logs current date & time when Windows starts

    Before we begin, please note that I implemented this in a Windows 7 machine.

    Create a folder where you’d like the files to be created. Name it anything you like. I named mine “Time-in” since I’m using the batch file to estimate the time I come into the office.

    Open a text editor such as Notepad.

    Copy the following codes and then paste it into Notepad.

    Save it into the folder you created as “time_in.bat”

    Now, go to that folder and right click on the icon of “time_in.bat” then choose “Create Shortcut”.

    You’ll now see a new file “time_in.bat – shortcut”. Move that shortcut file into your Windows’ startup folder. My Startup folder is in C:\Users\MyUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup so try looking for yours there.

    With what we have done, a file named with current date and time should be created in your folder each time you start Windows.

    Some notes when using this Windows batch file

    You will eventually have a folder with a large number of files because our batch file creates one file per Windows startup. Please find a way to manage those files. You may move older files into an archive folder, or you may delete older files that you no longer need.

    Another note if you’ll use the batch file to track your office time in the morning like I do: the batch file will not create any file if you just hibernate your computer before leaving work instead of shutting down. This is because the “startup” only happens when you start Windows, and this does not happen when you wake your Windows up from hibernation. Possible solution for this may be creating a task in the Task Scheduler of Windows, making the “on wake up” the “trigger” and pointing to the batch file to let it execute. The following settings are what I’ve tried and nothing has worked yet so far… so maybe some of you may come up with a solution that will work. 🙂

    Task scheduler in Windows 7 for the batch file
    Task scheduler in Windows 7 for the batch file
    • Go to Task Scheduler
    • Create Basic Task
    • Fill out name and description
    • Start the task when a specific event is logged
    • Log: System
    • Source: Power-Troubleshooting (or try Kernel-Power with Event ID 42, or try Kernel-General with Event ID 1)
    • Event ID: 1
    • Action: Start a program (then choose program).
    • Finish

    The batch file’s function is good the way it is for me so I didn’t look further into it, but here’s a link to Trigger Task Scheduler in Windows 7 when computer wakes up from sleep/hibernate.

  • How to make a basic “Login via Facebook” with PHP & JavaScript

    How to make a basic “Login via Facebook” with PHP & JavaScript

    You’ve seen how some popular websites let you register or login via Facebook — Pinterest, Vimeo, Lifehacker, and many more.

    In this blog post, I’ll show you the very basic setup of the Facebook login button for your website. It is up to you to enhance the functions of your registration system.

    Note: There are periodic updates to the Facebook API, sometimes resulting to issues with previously working implementations of the API. So please note that this tutorial was written in the third week August 2015. 🙂

    I began writing this tutorial late in August, but because of other projects, was able to publish it when it’s already September.

    (more…)

  • How to install Laravel 5 in Windows with XAMPP

    How to install Laravel 5 in Windows with XAMPP

    This short tutorial is based on my own installation of Laravel 5 on XAMPP that is running on Windows 7.

    In this Laravel 5 tutorial, you will need:

    There have been major changes in the following: New Folder Structure, Contracts, Route Cache, Route Middleware, Controller Method Injection, Authentication Scaffolding, Event Objects, Commands / Queueing, Database Queue, Laravel Scheduler, Tinker / Psysh, DotEnv, Laravel Elixir, Laravel Socialite, Flysystem Integration, Form Requests, Simple Controller Request Validation, New Generators, Configuration Cache, Symfony VarDumper.

    To learn more about the Laravel 5.0 update, read about it here.
    (more…)

  • SSH: Basic usage of Shell Screen

    SSH: Basic usage of Shell Screen

    If you are often running scripts in SSH, especially ones that have a long execution time, you might have experienced termination of your script before it actually finishes its task(s). Maybe you closed the terminal window by accident, or you lost Internet connection for a moment.

    What you can do is run your script persistently with the help of Shell Screen.
    (more…)

  • Facebook App Development tips, guides, and possible solution to issues

    In July 2013, I began learning about developing apps that run in Facebook. For a web developer especially one who works in a marketing agency, learning about Facebook app development is important nowadays because numerous amounts of campaigns are ran on Facebook.

    At first Facebook app development confused me, but after some exposure to it and some help from colleagues who have been doing it for years, I got the feel of it.

    Following are some blog entries on my Code Playground that are related to Facebook app development. (more…)

  • SMTP: Test emails from local computer during development stage using smtp4dev

    Web developers need to work on their website locally once in a while. I use XAMPP in my computer to work on my web projects locally.

    I’m about to begin working on a project which sends emails when users register for an account. From the live site, I downloaded it to my computer so I could do updates. I tested the registration form and it failed because email could not be sent. I would usually use phpmailer, but that’s a bit time-consuming to configure, so I wondered if my colleague who worked on it before used a simpler solution. Lucky me, she did find a simpler way to test the emails sent/received on her computer during development.
    (more…)

  • Free PDF Download: AJAX for Dummies

    Learn AJAX (Asynchronous JavaScript and XML) using the Ajax for Dummies ebook.

    (more…)