dConstructing

Cleaning WordPress of malicious code

I run a few WordPress sites, and every now and then one of them gets hacked. Most recently I found that Google Chrome was warning visitors to my web site that there was malicious code on my site. Here’s the process I went through to clean out my site running WordPress 3.2.1 (though I’m sure it applies to others as well).

Accepting the Problem

Since Google was warning that I was linking to a URL that contained malware, I assumed the link came from an outside source. I’ve heard that Google AdSense can sometimes be the culprit (they blacklist URLs, but sometimes there are AdWords ads pointing to the URLs and those ads don’t get pulled from AdSense, so they end up on your site), so I decided to take the lazy route wait until Google realized it wasn’t my fault and cleared my good name...

Read in full

Giving a ReadyNAS NV+ share a default user group

The Situation

There’s a Netgear ReadyNAS NV+ unit in the office here running ReadNAS Frontview 4.1.7 that houses files for multiple departments.

  • Account Dept Share
  • Sales Dept Share

The ReadyNAS NV+ has multiple groups established:

  • Accounting
  • Sales
  • Admin

Employees are put into one of these groups and the groups are given access to various shares (Admin has universal access):

  • Account Dept Share – Accounting
  • Sales Dept Share – Sales

The Problem

In time we started getting a lot of file access errors...

Read in full

Integrity constraint violation when enabling/disabling Magento modules

Background

I’ve been working on a new custom Magento payment module and having a lot of headaches along the way. I decided to start from scratch using the template provided here: http://inchoo.net/ecommerce/magento/how-to-create-magento-payment-module/.

I’m doing this using Magento Community Edition (the free one) version 1.5.0.1.

Setting Up

I got all the code copied into place with a few modifications:

  • In the modules block of config...
Read in full

Allowed memory size exhausted when running PHP from the command line

I’m trying to test a Magento cron job by running the target file from the command line. When I do, I get this error:

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0

Line 0? Nothing happens before Line 27 (on this script). This isn’t a problem with my code. It’s a problem with PHP.

The Fix

It’s actually a problem with the PHP Command Line Interface (CLI). The server was recently upgraded to Ubuntu 10...

Read in full

Sort grouped products in Magento by "in stock" status

Many of the products in our Magento catalog are grouped products. We’ve noticed that unless they’re looking for a specific variation of a specific product, they tend to just order the first of the grouped products listed on the product details page. We want to avoid customers moving on to other products (or *gasp* other web sites) to order, so we want any out of stock products moved to the bottom of the grouped products table...

Read in full

Sort Magento catalog by date added

I haven’t worked with Magento in over a year, and even then it wasn’t very much. Now I’ve got a project that will teach me the inner works of the system.

First task

When users view a list of products on a Magento site, Magento displays them in the order they were added to the system (after other sorting filters have been applied). We want to reverse that order so the newest products are displayed at the top of the list...

Read in full

Location of Android icons and images

I spent far too long this afternoon trying to hunt down some Android 2.3 notification icons for me to use in my app development. They were already on my computer. Here is where I found them:

C:\path\to\android-sdk-windows\platforms\android-9\data\res\drawable-????\stat_notify_*

The icons for the notification area are all prefixed with stat_notify_. I went ahead and copied all of them (just in case). Each icon comes 3 versions (for low, medium, and high pixel density devices)...

Read in full

Encoding a URI in an NFC NDEF payload

An NDEF message is made up of TLVs. The TLVs can contain the data that should be transmitted over NFC, but can also be a signal that the message is over. Here’s where the NDEF paylod fits in to the TLV.

  • T = Type
  • L = Length
  • V = Value – the NDEF payload

For this post we’ll encode a URI as the NDEF payload. To read about creating the rest of the NDEF record TLV, or terminal TLVs, read my post on Read in full

Encoding a URI in an NFC NDEF record TLV

A TLV is a segment of data included in an NFC message. This is what a TLV consists of:

  • T = Type – the type of record
  • L = Length – the length of the payload
  • V = Value – the data

There different kinds of TLVs, but when constructing a basic NDEF message we only need to be concerned with two, and NDEF record TLV and the terminal TLV.

NDEF Record TLV

This TLV is where you store the data you want to transmit via NFC. The next three sections describe what makes up the TLV...

Read in full

Encoding a URI in an NFC NDEF message

The whole point of Near Field Communication (NFC) is the NDEF message (or NFC Data Exchange Format message). That’s where the goods are stored. You can’t just type in any old text though. You have to use the right format, and you have to encode it in hexadecimal. It’s not the most fun thing in the world, but it is doable. I’ve written a series of blog posts to help you do it.

Encoding the Data

An NDEF message is made up of multiple chunks of data called TLVs...

Read in full