I’m working on a weather app for Android. The data for wind direction that I get from the weather API is in form of degrees (0 to 360). I want to display wind direction in a user-friendly format such as N (North), NNE (North-northeast), NE (Northeast), ENE (East-Northeast), E (East), ESE (East-Southeast), SE (Southeast), SSE […]
Author: Catzie
Android app development: click a ListView item programmatically
I’m going to share a code snippet that you may use to programmatically click a ListView item in your Android app. This will not simply highlight the desired ListView item, but also trigger the onItemClick listener. This code is what I placed in a Fragment’s onLoadFinished() method:
|
1 2 |
int default_position = 2; listView.performItemClick(listView.getChildAt(default_position), default_position, listView.getItemIdAtPosition(default_position)); |
Simply replace the default_position value with the […]
PHP: Parse Dates in CSV with inconsistent date formats
A friend was having trouble with a CSV file that she needs to process via PHP before saving to database. The CSV files uploaded to the server have inconsistent date formats such as:
|
1 2 3 4 5 |
November 1, 2016 Dec.6,2016 nov-10-2016 12122016 12/10/2016 |
So I prepared a PHP script that lists possible date formats in an array $possible_date_formats and then iterates through the dates […]
Android app dev: Add ActionBar to Preference Activity
When I converted an activity into PreferenceActivity, I noticed that its ActionBar disappeared. I’ll show you how I brought the ActionBar back to my PreferenceActivity. In this guide I will assume that the name of the file that contains your is SettingsActivity.java, and that the view assigned to your SettingsActivity.java is named . First, create […]
Install & config Apache, MySQL and PHP on your Mac (MAMP)
There’s a Mac computer that I want to use as local development server for web apps. I don’t want to use bundled installers like XAMPP or MAMP because I feel that I will learn more about Apache if I install each component of the LAMP stack separately. By the way, one of my goals is […]
Read & write to NTFS from your Mac computer
My external HDD is in NTFS format and the Mac I’m using at work cannot write files to it. I solved this issue by running NTFS-3G on my Mac OS X version 10.11. Follow these simplified instructions to mount your NTFS drive as writeable in your Mac. If you encounter any problem, scroll down below […]
Interesting dishes at “Your Local” in Legazpi Village, Makati (review)
Friend: “is your office close to your local?” Me: “close to… my local?” Friend: “no, the place’s name is ‘your local’!” Me: “ohh!” I searched for the place Your Local and found our that it’s a restaurant in Esteban St. in Makati’s Legazpi Village. They had interesting dishes like laksa fettuccine, torched salmon donburi, and […]
Web Security: How SQL Injection is done
SQL injection is one of the most common website exploits. For us developers to prevent SQL injection attacks, we must first understand how it’s done. Together, let’s review the basics of SQL injection. Remember, let’s use our knowledge on good things only, okay? The scope of this post is only a MySQL injection sample from […]
Prevent direct access to directories of subdomains
From my hosting platform (e.g. cPanel), I created two subdomains for web apps. The web apps reside in the following directories: /foo/bar/app_one/ /foo/bar/app_two/ And the subdomains I created are accessed through these URLs: http://app_one.bar.domain.com (pointing to /foo/bar/app_one/ directory) http://app_two.bar.domain.com (pointing to /foo/bar/app_two/ directory) For security purpose, I don’t want anyone to access the web app […]
How to open BPI savings account without maintaining balance (requirements & steps)
I wanted to open a joint account with someone, and our choice is a BPI savings account with ATM card. We failed to make it a BPI “joint” savings account (I’ll tell you why later), but I successfully opened a BPI savings account without maintaining balance. Want a BPI savings account without maintaining balance? I’ll […]