WebIT.ca

Montreal Web Development

Google+ releases pages

Monday, November 7th, 2011

Google+ may not be Facebook or Twitter but it still has steam. Today, the Plus team released Google+ Pages. Very much like Facebook Pages, Google+ Pages allow your business to broadcast itself and connect with followers via the Circles functionality.

For more on this new feature, check out Google’s own press release below.

http://googleblog.blogspot.com/2011/11/google-pages-connect-with-all-things.html

Pages are not open for everyone yet. Send your email to info@webit.ca and we’ll notify you when they are ready.

Update

Google+ Pages now online.

British Airways In-Flight Entertainment

Wednesday, October 26th, 2011

BA released today their brand new inflight entertainment section. Developed by Spafax and WebIT.ca.

British Airways inflight entertainment screenshot

The site features a monthly update to the entertainment on every BA flight to dozens of destinations.

enRoute Eats Dining Guide App

Wednesday, October 19th, 2011

After two months of loving labor, the new enRoute Dining Guide app is up on iTunes. Be sure to check it out and download yourself a copy.

Home screen of the enRoute Eats iPhone app

Splash screen of the enRoute Eats iPhone app

Download the enRoute Eats iPhone app.

Content by: Sarah Steinberg (enRoute Online)
Design by: Adrian Kronowetter (Land of Visions)
Development by: Dimitry Zolotaryov (WebIT.ca)

Find large files on Mac OSX

Thursday, October 13th, 2011

The following terminal command is great for finding those large, hidden files on your hard drive:

cd / && sudo find . -size +1024k -ls

Substitute 1024 with a size you consider big for a file (in kilobytes). In the example, the command sequence will find all files over a megabyte in size.

Variable height UIView

Sunday, September 4th, 2011

In the latest iPhone app, it was necessary for a particular view to grow or shrink with respect to its visible subviews. Bellow is a quick snippet from a class called VariableHeightView, a subclass of UIView.

- (CGRect)frame
{
    CGRect frame = [super frame];
 
    float height = 0.0f;
    for (UIView *asubview in self.subviews) {
        if (![asubview isHidden]) {
            float subviewBottom = asubview.frame.size.height
                                    + asubview.frame.origin.y;
            if (subviewBottom > height) {
                height = subviewBottom;
            }
        }
    }
 
    CGRect newFrame = CGRectMake(frame.origin.x, frame.origin.y,
                                 frame.size.width, height);
    return newFrame;
}

The code is fairly simple. For a view built using the Interface Builder, the VariableHeightView’s (a superview) frame function will iterative over all subviews, looking for the one lowest in the screen. Once found, it will expand to match that sub-view’s Y origin plus height.

The drawRect function of UIView will take care of rendering the VariableHeightView using the dimension of the frame function.

PHP array_remove and array_remove_assoc

Thursday, August 25th, 2011

The array_remove and array_remove_assoc PHP functions allow your code to remove an element from an array (or associative array) given the element’s value. See the comments in the code bellow on how to use the two functions.

Download the code

<?php
/**
 * Removes the given value from the given array.
 *
 * Returns either FALSE if the value was not found in the array
 * or the index at which the value was found and removed.
 * 
 * $array = array('a', 'b', 'c', 'd');
 * assert( array_remove( 'b', $array ) == 1 );
 * assert( array( 'a', 'c', 'd' ) == $array );
 * assert( array_remove( 'z', $array ) === false );
 * assert( array( 'a', 'c', 'd' ) == $array );
 *
 * @param mixed $val The value to remove
 * @param array $array The array from which to remove the value
 * @author Dimitry Zolotaryov, http://webit.ca
 * @returns FALSE or the index at which the value was found
 */
function array_remove( $val, &$array ) {
    foreach ( $array as $i => $v ) {
        if ( $v == $val ) {
            array_splice( $array, $i, 1 );
            return $i;
        }
    }
    return false;
}
 
/**
 * Removes the given value from the given associative array.
 *
 * Returns either FALSE if the value was not found in the array
 * or the key at which the value was found and removed.
 *
 * $array2 = array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 );
 * assert( array_remove_assoc( 1, $array2 ) == 'a' );
 * assert( array( 'b' => 2, 'c' => 3, 'd' => 4 ) == $array2 );
 * 
 * @param mixed $val The value to remove
 * @param array $array The associative array from which to remove the value
 * @author Dimitry Zolotaryov, http://webit.ca
 * @returns FALSE or the index at which the value was found
 */
function array_remove_assoc( $val, &$array ) {
    foreach ( $array as $key => $value ) {
        if ( $value == $val ) {
            unset( $array[ $key ] );
            return $key;
        }
    }
    return false;
}

Download the code

Plus’d

Friday, July 8th, 2011

Definition:
To be voted on in Google+
Past tense of the verb To Plus. eg. “I plus’d you on Google+”

Synonyms:
Plus One’d, One Plus’d

Open Source and Business Strategy

Monday, June 20th, 2011

A recent interview I did for Web Central Station.

http://www.webcentralstation.ca/2011/06/10/open-source-oss-business-strategy-interview-with-dimitry-zolotaryov/

Firefox won’t load a webpage?

Wednesday, April 27th, 2011
Screenshot of Facebook not loading in Firefox

So your Firefox web browser refuses to load a page? Perhaps you’ve recently updated to the latest Firefox and now things don’t work as you expected. Bellow is a list of solutions that I use when Firefox won’t load a page.

1) Clear the cache and reload the page (Ctrl + Shift + R).

2) Disable all your Add-Ons. Check if the webpage loads. If it does, then one of the Add-Ons is at fault. Start re-enabling them one by one until you find the culprit. For more, see the Firefox Add-On troubleshooting page.

3) The problem is a browser misconfiguration or some problem with the installation, perhaps. Download another copy of Firefox, uninstall your current version (back up those bookmarks!) and install the downloaded version (Add-Ons will have to be re-installed afterward).

Hope these tips help you resolve your Firefox page loading issues.

Limit user email domains in BuddyPress

Friday, March 4th, 2011

One of my upcoming projects is an intranet. For many reasons, I have chosen to use BuddyPress as the starting point and customize it for specific needs.

One such need is a restriction on which email address domains can be used to register a user. For instance, if I were to create such a system for webit.ca, I would want only users with a @webit.ca email address to register. Anyone else would simply not be allowed.

After some digging around, it seemed like there was no plugin that would quickly do what I was looking for. There were options, but most felt complicated or hacks. That is, until I found the following line in bp-core-signup.php:

// in function bp_core_validate_user_signup
$limited_email_domains =
    get_site_option( 'limited_email_domains', 'buddypress' );

Great! All that is left is a quick plugin to populate ‘limited_email_domains’.

<?php
/*
Plugin Name: Restricted Email Domains
Description: Restricts registration user email addresses to @webit.ca
*/
add_option('limited_email_domains', array('webit.ca'));

Activate the plugin and you’re good to go.