Showing posts with label workaround. Show all posts
Showing posts with label workaround. Show all posts

Friday, 17 April 2020

How to fix notch overlap in Flutter Basic Widgets example code

Problem:

I am learning Flutter, and the app bar on top in the Basic Widgets section of the Introduction to widgets section of the Flutter docs is being blocked by the notch of an iPhone or phone simulator, as seen below. How can I fix this?

Notes:

This bug was confirmed in April 2020. It's possible that the Flutter team has updated their documentation by the time you are reading this. (If so, thank you Flutter team!)

Also note that this how-to is just one way to workaround the issue. The later code in the Flutter documentation shows better practices on which widgets to use, etc., to avoid the notch. That being said, this workaround is for anyone who is trying to debug this before moving on.

Workaround:

The workaround is highlighted below, followed by a brief explanation:

import 'package:flutter/material.dart';

class MyAppBar extends StatelessWidget {
  MyAppBar({this.title});

  // Fields in a Widget subclass are always marked "final".

  final Widget title;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 56.0, // in logical pixels
      padding: const EdgeInsets.symmetric(horizontal: 8.0),
      decoration: BoxDecoration(color: Colors.blue[500]),
      // Row is a horizontal, linear layout.
      child: Row(
        //  is the type of items in the list.
        children: [
          IconButton(
            icon: Icon(Icons.menu),
            tooltip: 'Navigation menu',
            onPressed: null, // null disables the button
          ),
          // Expanded expands its child to fill the available space.
          Expanded(
            child: title,
          ),
          IconButton(
            icon: Icon(Icons.search),
            tooltip: 'Search',
            onPressed: null,
          ),
        ],
      ),
    );
  }
}

class MyScaffold extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Material is a conceptual piece of paper on which the UI appears.
    return Material(
      child: SafeArea(
        // Column is a vertical, linear layout.
        child: Column(
          children: [
            MyAppBar(
              title: Text(
                'Example title',
                style: Theme.of(context).primaryTextTheme.title,
              ),
            ),
            Expanded(
              child: Center(
                child: Text('Hello, world!'),
              ),
            ),
          ],
        ),
      ), // SafeArea
    ); // Material
  }
}

void main() {
  runApp(MaterialApp(
    title: 'My app', // used by the OS task switcher
    home: MyScaffold(),
  ));
}

The above code encloses the other widgets in the example code within the safe area of the device via the SafeArea widget - a class that adds appropriate insets for a given device.

If all went well, your results should now look similar to the image below and you can now move on to learning more Flutter, free from the iPhone-notch-overlap.

If you'd like to learn more, please check out the references below.



References:

Thursday, 19 March 2020

Meteor VSCode esversion 6 jslint error

Problem:

When using Visual Studio Code to edit my Meteor project, I keep seeing the error:

'import' is only available in ES6 (use 'esversion: 6'). (W119) jshint(W119)

For example:

Workaround:

  • To hide the jshint errors: in the main folder of your Meteor project, if the file named ".jshintrc" does not exist then add it
  • In this .jshintrc file, add the following text:
    {
        "esversion": 6
    }
    

You may need to close and reopen the project in VSCode. If the workaround is successful, you should no longer see the esversion 6 error.

Notes:

This workaround was verified to help remove the jslint errors while using Visual Studio Code version 1.43.1 with Meteor 1.10.1. Your results may vary given different versions. Please also note that this workaround hides the jshint error from being highlighted, but it won't fix compilation errors if your Meteor project isn't properly setup to compile esversion 6.

References:

Tuesday, 30 January 2018

Cannot type into Spotlight in macOS

Problem:

I suddenly cannot type anything into Spotlight.

It opens and closes, and even does so with the Command-Space shortcut. I just can't type in it when it's open.

Workaround:

  • Open Terminal
  • Use the following command:
    killall Spotlight
  • If all goes well, the magnifying glass for Spotlight will disappear and reappear, and you'll be able to type into Spotlight again

Notes:

This was tested to work in macOS 10.12.6.

Friday, 20 January 2017

Restore my Xamarin project's NuGet and Xamarin-Component dependencies using CLI

Problem:

How do I restore all of my Xamarin project dependencies when neither Visual Studio's "extensions and updates", nor NuGet package manager GUI have the versions my project requires?

Similarly, how do I restore these packages in the command line so Jenkins can automatically build my Xamarin project?

My questions apply to fresh clones of my team's Xamarin project from Git, where the NuGet nor Xamarin component 3rd party dependencies aren't included in the project's repository.

Before you start:

The solution below assumes that you have knowledge of Xamarin, Xamarin components, NuGet, (Jenkins), the command line, and have a valid account for Xamarin. (It was written as a quick reminder. Please refer to the referenced links if more detail is needed.)

One solution:

One solution is to use the nuget.exe and xamarin-component.exe command line tools to restore NuGet and Xamarin component dependencies.

You can get the Xamarin component CLI executable from here: https://components.xamarin.com/submit/ (you'll need to sign in with your Xamarin account, and follow the instructions Microsoft provided)

You can get the NuGet CLI executable from here: https://dist.nuget.org/index.html

When you have these CLI tools installed (or copied to your project's root - not ideal, but helps to troubleshoot), you can then use them or include them in your script as follows:

  • navigate to the directory where your solution file is (e.g. YourSolutionName.sln)
  • 
    nuget.exe restore
    xamarin-component.exe restore YourSolutionName.sln
    
    
  • (first time) enter your Xamarin account credentials (needed for xamarin-component)

At this point, the output should give an indication of all 3rd party dependencies that were successfully restored.

Notes:

This solution was tested to work on a project that has dependencies about a year old (and are no longer available via the Visual Studio GUI). The versions of the tools tested were Visual Studio 2015 (14.0.25431.01 Update 3), Xamarin 4.2.2.11 (with corresponding Xamarin.Android 7.0.2.42 and Xamarin.iOS 10.3.1.8). Additionally, all 3rd party libraries were originally installed using Visual Studio's "Extensions and Updates..." GUI and NuGet package manager's GUI. Your mileage may vary, depending on versions and how your team has setup your Xamarin project.

This solution also depends on Microsoft/Xamarin still providing the CLI tools, as well as the 3rd party dependency versions specified in your project still existing for download.

Nonetheless, hopefully this has at least come in handy or given some new ideas :)

References:

Thursday, 5 January 2017

Delay lock screen display sleep time in Windows 10

Problem:

In Windows 10, how do I prevent my displays from turning off shortly after locking my screen?

Power savings nor display life are an issue for my situation.

Reason: I have an external dock that causes all my windows to move to my primary display after the displays are turned off.

Cautions:

This how-to assumes you are comfortable with editing the registry. Serious damage can be done if you make a mistake!

Workaround:

  1. enable "Console lock display off timeout" in the Advanced Power Settings via the registry:
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\8EC4B3A5-6868-48c2-BE75-4F3044BE88A7
    • set "Attributes (type DWORD)" to 2
    • (to hide, set Attributes back to 1)
  2. open advanced power options (or close then reopen, if it was already open before the registry change)
  3. change timeout to desired value (example screenshot below):

Notes:

  • This was tested to work in Windows 10 Pro.
  • Changing this setting is strongly discouraged in situations where power saving or monitor life are important.
  • This only works for lock screens while a user is signed in.

References:

Thursday, 24 December 2015

BlackBerry Link El Capitan USB connection unstable

Problem:

My BB10 BlackBerry device won't back up using BlackBerry Link in OS X El Capitan. The USB connection keeps dropping. USB is fine with all of my other devices.

Solution:

  • Make sure BlackBerry Link is installed, and your Mac has been restarted
  • Make sure your BlackBerry is plugged into your Mac via USB
  • Navigate to Apple Logo (top right) -> System Preferences -> Network
  • At the bottom of the list on the left, click the plus button + (this will add a network interface)
  • In the "Interface" drop down, note any BlackBerry interfaces that haven't already been added to the list (in the case of this machine, it was "BlackBerry (en4)")
  • Add the BlackBerry interface, and then hit "Apply"
  • Open BlackBerry Link, it might ask for your device password and then connect properly
  • If successful, operations such as backup will now work without dropping

Notes:

This was verified to work using OS X 10.11.2 (El Capitan), a BlackBerry Passport, and BlackBerry Link 1.2.2 (build 32). Your results may vary.

Some operations, such as syncing photos, might not work (i.e. iPhotos has now been replaced by Photos, and syncing photos requires iPhoto; other changes apply).

Additionally, the above steps worked on a machine with a fresh install of BlackBerry Link, and without BlackBerry Blend installed. If the above steps work or do not work with both software installed, please follow the links in the references section for more information.

References:

Tuesday, 7 January 2014

Disable Mac start-up chime in OS X 10.9 Mavericks ("Band-Aid" workaround only, for now)

Problem:

I would like to disable the start-up chime my OS X Mavericks-based Mac makes so that restarting the computer will not be so loud.

Notes:

  • The solutions below were tested on OS X 10.9 Mavericks and may work on other versions, but there is no guarantee.
  • This how-to was written as a reminder for myself in case this needs to be replicated or undone later. It is not a full solution and still a bit advanced for the average OS X user to follow, which makes it unacceptable to post as a "solution" (in my opinion).
  • You're welcomed to follow the solutions below, but use the more permanent one at your own risk.

Solution 1 (temporary):

Turn the volume of your computer down before shutdown or restart. The start-up chime should match your system's volume.

Note that muting seems to have mixed reported results in forums and other online posts, where some systems will chime at the same volume as the system volume, even when muted (resulting in lots of surprise chimes), yet others report that muting works.

Solution 2 (advanced workaround, but a bit more permanent):

This solution goes through the steps to write a script that turns the system volume to 0, and rigs it to run upon the user selecting to shutdown or restart the machine via the apple menu.

Warnings:

  • Make sure you are comfortable with Terminal, shell scripts, file permissions, and reading manual pages (if you get stuck). If you are not comfortable using Terminal (or are prone to making typos), you should probably not try this. Attempt at your own risk.
  • Every time you start up OS X, the volume will be set to 0 (which may not be a bad thing if you're already trying to avoid surprises by turning the chime sound off to begin with)

This is a modification of the solution found here, but modified in a way that should work on more OS X setups. The modified steps are posted below as a reminder in case the link ever goes down.

Steps:

  1. Run the Terminal app with an administrator account
  2. Create a script for muting (replacing "/path/to/" with a valid path -- if you're not sure what this means, do not proceed with the rest of the steps)
    sudo nano /path/to/volume-off.sh
    
  3. Write the volume-off script (or copy and paste the following into it):
    #!/bin/bash
    
    osascript -e "set Volume 0"
    
  4. Make file executable with following command (replacing "/path/to/" with where the script is saved):
    sudo chmod u+x /path/to/volume-off.sh
    
  5. Check that we can hook this to the OS X logout (see if any hooks exist - only one or none can exist, not more). In Terminal, use the command:
    sudo defaults read com.apple.loginwindow LogoutHook
    

    You should end up with something similar to "The domain/default pair of (com.apple.loginwindow, LogoutHook) does not exist".

  6. Add hook to run script at logout, replacing "/path/to/" with where the script is saved:
    sudo defaults write com.apple.loginwindow LogoutHook /path/to/volume-off.sh
    

To Undo Solution 2:

  1. Check that the logout hook exists in Terminal with the following command:
    sudo defaults read com.apple.loginwindow LogoutHook
    

    You should end up with something similar to "/path/to/volume-off.sh" with "/path/to/" being where your script is saved.

  2. Delete the logout hook in Terminal with the following command:
    sudo defaults delete com.apple.loginwindow LogoutHook
    

Notes on solution 2:

  • Just like in the original solution, the volume-off.sh script is also saved in /Library/Scripts/
  • Make sure the permissions of the script is set so that only the owner can write to the file, since the script is run as sudo (and would be an obvious security risk if it can be re-written by just anyone).
  • The script must be owned by root.
  • Again, this will turn the volume to 0 upon logout rather than simply mute. This is because many people online seem to report mixed success with muting.
  • The commands for setting both a login and a logout hook, as well as removing them are as follows:
    • sudo defaults write com.apple.loginwindow LoginHook /path/to/your-login-script.sh
    • sudo defaults write com.apple.loginwindow LogoutHook /path/to/your-logout-script.sh
    • sudo defaults delete com.apple.loginwindow LoginHook
    • sudo defaults delete com.apple.loginwindow LogoutHook
  • The commands for checking if a hook exists for login or logout are as follows:
    • sudo defaults read com.apple.loginwindow LoginHook
    • sudo defaults read com.apple.loginwindow LogoutHook

Very brief discussion on problems with other solutions found online:

The following will only make sense to anyone who has Googled how to disable the start-up Mac chime and read through the various proposed solutions. It briefly outlines why these workarounds weren't posted here. You can skip this section if you'd like.

nvram SystemAudioVolume method:

  1. too dangerous for most users (you can easily accidentally turn your computer into an expensive paperweight with the nvram command)
  2. many mixed results and uninformed posts online on why that solution used to work (read: everyone seems to be guessing. If you don't want to be one of those guessers, you can read up on nvram in the slightly out-of-date book "Mac OS X for Unix Geeks (Leopard)" in Google Books as that section appears to be viewable for free, at least as of January 2014)
  3. the solution doesn't work on all OS X and Mac combinations
  4. the solution does NOT work in Mavericks (tested) as the system will change the SystemAudioVolume value automatically

rc startup/shutdown script method:

  1. does not work in Mavericks as start-up has been moved to launchd instead (see Apple developer documentation on Launch Daemons and Agents
  2. any daemon-supporting mechanism may change in future versions of OS X, making this solution possibly unreliable (and worse, it will leave potentially unwanted files dangling deep within the system)
  3. this solution is way too complicated to post for the average user

existing software:

  1. many don't work on all versions of OS X (mixed results reported in forums, etc.)
  2. all software Googled do not describe exactly what system-wide changes are being made, making it hard to determine how permanent they are, as well as how well do they handle OS upgrades
  3. Mavericks seems to have broken a lot of the existing software, so it's hard to recommend a good one

the solution 2 in this blog post:

  1. it's not possible to do if you are not the system administrator
  2. it's not possible to do if you or your system administrator has already hooked something to com.apple.loginwindow LogoutHook
  3. it's possible that it won't work if you shut down your computer using a different mechanism than the usual Apple UI ways
  4. it's still inaccessible to most users
  5. if permissions are not set correctly, you could potentially create a security hole

an official Apple "turn off start-up sound" preferences item:

  1. does not exist/was eliminated
  2. if you're from Apple, perhaps you could help out with this? =)

References:

Thursday, 5 December 2013

Workaround to place XQuartz/X11 apps on second monitor in OS X Mavericks (apps like Inkscape)

Problem:

I've upgraded to OS X Mavericks and I can't place apps such as Inkscape on my second monitor any longer. I don't want to turn off "Displays have separate Spaces."

Before trying this workaround ...

This workaround was written as a reminder for myself. Even if you get it to work, X11 programs will be riddled with bugs because of how Mavericks currently treats Spaces coordinates, gravity, etc., with XQuartz. Thus, I'd recommend not following it for the time being unless you're curious. A better workaround is to simply turn off "Displays have separate Spaces" in: System Preferences ... -> Mission Control

This workaround only works under very specific conditions right now, and there is no guarantee that it will work under other conditions. The following are the conditions under which this workaround worked:

  • The OS X Team nor the XQuartz team have not addressed the issue yet (test this out to make sure that you're not using a workaround when things actually work)
  • OS X version is 10.9
  • XQuartz is installed and works
  • XQuartz version is XQuartz 2.7.4 (xorg-server 1.13.0) or under (haven't tested it with newer versions, and newer versions may fix this problem rendering this workaround pointless)
  • Inkscape and other X11 apps run
  • "Displays have separate Spaces" is checked under: System Preferences -> Mission Control
  • You haven't already dragged the application window out of bounds in one of your spaces (in which case you'll need to figure out how to reset its position first -- can't help there at the moment since each app handles its position in different ways. Advanced: Try resetting or reinstalling the X11 app, or editing its config file?)
  • You know what the following terms mean: "dock", "desktop", "mission control", "spaces", "X11", "XQuartz", "secondary click"

If you're here to try to get Inkscape or other X11 apps to work in Mavericks in the first place, try this post first: http://grammarofdev.blogspot.ca/2013/10/how-to-run-inkscape-in-os-x-109.html

Disclaimer:

This is hardly a permanent solution, nor is it guaranteed to work under all versions of OS X, XQuartz, etc. This workaround is just posted here in case anyone else finds it useful to be able to use X11 apps on their second monitor once again after upgrading to Mavericks, and doesn't mind jumping through a few hoops. Hopefully by the time you read this, someone at Apple or XQuartz would have fixed this issue. (If you're one of said Apple or XQuartz people, please fix this =) lol.)

Also note that because the bug seems to be related to coordinates, weird things can happen with this workaround, such as windows, child-windows, etc., opening out of bounds and therefore off-screen. Hopefully someone out there will be able to debug this problem as this workaround can't work around bugs like that.

Workaround:

  • Launch the X11 app so that XQuartz and the app's icon show up in the OS X dock
  • In the dock, secondary click the XQuartz icon and select: Options -> Assign To: None
  • In the dock, secondary click the app icon and select: Options -> Assign To: None
  • Go to mission control (hit f3 on most Macs, or triple-swipe upwards if that gesture is enabled)
  • Do NOT attempt to drag the app to the space/desktop on the other monitor as you do with native apps, as all this will do is set the window out of bounds on the current space/desktop. (At least, as of XQuartz 2.7.4 (xorg-server 1.13.0) or earlier.)
  • Drag the X11 app window (such as Inkscape's window) to the desktop/space mini-window on top of the other monitor (the one on top with the labelled "Desktop __" with the desktop number in place of __ -- not to the big desktop area below)
  • If all worked out, the app should now actually display on your second monitor
  • (Optional step - if you work for Apple) Program a patch to allow drag-and-drop of X11 apps to spaces residing on second monitor
  • (Optional step - if you work on the XQuartz project) Detect bounds of monitors and imitate native drag-and-drop behaviour (I'd like to help out, but I'm not entirely sure how to right now =/)

More:

As this issue hasn't been solved yet as of the time this post was written, I've decided instead to link to the closest bug report that I could find: https://discussions.apple.com/message/23717540#23717540

If you happen to have a better fix, please feel free to update us all in the comments below! =)

Saturday, 7 September 2013

VirtualBox OS X Host Ubuntu Guest - USB device captured but not mounting/showing - One workaround

Problem:

I am using VirtualBox 4.2.x on OS X 10.7.x running an Ubuntu Guest. When I try to plug in a USB device, such as a USB drive, USB MIDI keyboard such as the Keystation 88-es, etc., VirtualBox shows the device as captured (with a checkmark in the USB devices list), yet Ubuntu can't find it. I've already tried things such as installing VirtualBox Guest Additions, setting proper user permissions, etc.

One Workaround:

If you've managed to mount and capture the USB device but it's still not showing, you've probably already made it past most How-To's Googling will offer. One bug fix that seems harder to come across is this: Set the number of virtual CPUs to 1.

Apparently after VirtualBox version 3.2.0, a bug has caused USB devices to not show up in some Linux-based guests when the number of virtual CPUs is set to more than 1.

If this obscure bug fix doesn't help, check out the references below to lots of other potential solutions to the USB-won't-mount problem.

Good luck!

Notes:

I realize that this post isn't complete, however it was this one somewhat obscure bug that caused many hours of attempted debugging and Googling until it was found. So to save others the trouble of finding it buried in a page full of instructions and fixes, I opted to highlight only this one bug, and link to other pages full of good solutions.

Hopefully by the time you've reached this blog page Oracle, VirtualBox, Apple, or some others have managed to fix the problem!

This workaround is version specific so your mileage may vary depending on the version of OS X, VirtualBox, VirtualBox Guest Additions, Linux, etc., that you are running.

References:

Friday, 6 September 2013

Facebook Android SDK v3.5 tutorial workaround for error regarding android.support.v4.content.LocalBroadcastManager.getInstance

Problem:

In the very first Facebook SDK tutorial, when I finish the final steps to get a MainActivity.java that looks like the tutorial, instead of getting the message "Hello !" the app crashes and gives an error like "Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.facebook.Session.postActiveSessionAction", then followed by a bunch of exceptions, starting with "java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager".

My code looks exactly like the tutorial found at https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/. (For reference, the tutorial code as of September 6, 2013 is below, as it could be revised by now:)

package com.firstandroidapp;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;
import com.facebook.*;
import com.facebook.model.*;

public class MainActivity extends Activity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // start Facebook Login
    Session.openActiveSession(this, true, new Session.StatusCallback() {

      // callback when session changes state
      @Override
      public void call(Session session, SessionState state, Exception exception) {
        if (session.isOpened()) {

          // make request to the /me API
          Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
              if (user != null) {
                TextView welcome = (TextView) findViewById(R.id.welcome);
                welcome.setText("Hello " + user.getName() + "!");
              }
            }
          });
        }
      }
    });
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
  }

}

Please Note First:

This problem and its workaround appears to be version specific. Your mileage may vary if the error isn't exactly the same as the one encountered. The versions of things used when this error was encountered were Android ADT v22, facebook-android-SDK-3.5, with a build target set to Android 4.2.2. All source code, tool, etc., were unmodified from the versions downloaded from Google and Facebook. This problem was worked around September 6, 2013, so hopefully someone from Facebook or Google's Android team has already made the appropriate fixes (making this post no longer needed =p).

Workaround:

This problem is caused by a missing method that the Facebook SDK is expecting to find in android.support.v4, but cannot find in the current version of the Android libraries. A hint to this is a strange error (which you may or may not have seen when importing the Facebook SDK demos into Eclipse) mentions that the versions of android.support.v4 do not match. The demos seem to run properly when compiled, however the very first Facebook SDK program you write yourself does not.

To work around this problem, the Facebook SDK version 3.5 includes a jar file you need to link to your project, located in "/path/to/facebook-android-sdk-3.5/libs/android-support-v4.jar".

One way to do this is as follows:

  • Go to your project's properties in Eclipse, then go to "Java Build Path"
  • Click on the "Libraries" tab
  • Click on either "Add JARs..." or "Add External JARs...", depending on which of the two you'd like to do
  • Add the android-support-v4.jar that comes with the Facebook Android SDK v3.5
  • Click on the "Order and Export" tab
  • Check the newly-imported android-support-v4.jar
  • Clean the project (Project->Clean...) (this step is important as attempting to re-run the project without cleaning it first or altering its code will simply run the existing binary again, which will give the error once more)

Additional Notes:

There's also another change in the tutorial which you may want to make. The function "Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {....});" is deprecated in the v3.5 SDK. You can get rid of the "deprecated method" warning in Eclipse by changing the above code to "Request.newMeRequest(session, new Request.GraphUserCallback() {...}).executeAsync();".

Hopefully this post helped someone out there. I realize it's a pretty basic problem to debug for experienced coders, but I decided to post this anyway in case it came in handy.

Wednesday, 21 August 2013

Inkscape 0.48.x OS X extensions problem workaround

Problem:

When using extensions with Inkscape 0.48.2 in OS X I get an error similar to: "the fantastic lxml wrapper for libxml2 is required ..." and extensions won't work.

Prerequisites:

This workaround worked on the system it was used on, however the solution is potentially version specific. The versions of stuff installed on this system were:

  • OS X 10.7.5 with the installation of Python that came with it
  • Python 2.7.5 (you can find your version in the terminal by typing "python --version")
  • Fresh install of Inkscape 0.48.2
  • XCode (required to compile the modules that we're going to install)

Notes:

The following steps are not necessarily a permanent fix for this problem, however they worked on the system that they was tested on. Your mileage may vary as the problem seems to be version-specific. Make sure you know what you're doing and follow the instructions at your own risk. If you're unsure, refer to the links in the references for a more complete explanation before starting. Good luck!

Workaround:

This problem is caused by the OS X version of Inkscape not being able to find the version-specific Python module for libxml2 that it was compiled/packaged to use. OS X comes with its own version of python which happens to be missing a few things usually installed in other operating systems. To install the required modules for Inkscape extensions to work, the following steps were taken (though not all may be required for this workaround to succeed.)

This workaround is a combination of two solutions found on internet forums. One of them modifies Inkscape to use version 2.6 of python if it's on the system. (If it is, that modification can be done without installing the libxml modules). The other installs the libxml2 module Inkscape is looking for in version 2.7 of python.

If you're not comfortable with using the terminal, there's an unofficial patch you can install instead of using the below workaround. It can be found at this forum thread: http://boardgamegeek.com/thread/769281/installing-on-osx-lion-the-fantastic-lxml-wrapper (just search for "EggBot2.2.2.r2.mpkg.zip")

Caution: do not proceed if you are not comfortable with the Terminal, command line, or code editing

  • Make sure your install of Inkscape is a fresh, unmodified copy
  • Make sure your python 2 version is at least 2.7.5 (as this workaround was only tested with that version) If it's older, you can get 2.7.5 here: http://www.python.org/download/
  • Open Terminal
  • The following steps may produce errors. If they do, look at the errors and try to fix them to complete the steps before moving on! (The usual: Google if unsure, or do not proceed further)
  • Type the command "sudo easy_install pip" to install the python package manager pip
  • Type the command "sudo pip install virtualenv" (probably not required, but useful)
  • Type the command "sudo pip install lxml"
  • If there are no errors in the above few steps, you're good so far. If there are any errors, try to get the steps to complete without errors (the usual: look at the errors, Google a solution, etc.)
  • In a text editor, open the file "/Applications/Inkscape.app/Contents/Resources/bin/inkscape"
  • Above the line 32 (which reads: "export VERSIONER_PYTHON_PREFER_32_BIT=yes"), add the following line without quotes and save the modified file: "export VERSIONER_PYTHON_VERSION=2.6"
  • (Note that the python version 2.6 specification in the inkscape file may not do anything if version 2.6 isn't on the system, and inkscape may just default to the system's version of python. The above steps to install lxml should make libxml work on the current version of python nonetheless.)
  • Restart Inkscape. The extensions menu should work now.

References:

Monday, 28 January 2013

Change Data Usage Cycle in Android 4.1.1

Problem:

How do I change the data usage cycle in Android 4.1.1? The option to change won't show.

Solution:

The first screenshot below illustrates the problem: it seems as though the option to change the billing cycle does not exist! Notice that mobile data is turned off at this point.

Turning on mobile data at first doesn't seem to fix the problem as seen in the screenshot below. The option to change billing cycles is still not there.

To work around this issue, try the following: exit the preferences to the home screen, and open the data usage preferences again. You should be able to see the option to change the billing cycle now.

Notes:

This seems to be a strange, intermittent problem with the interface. This solution was tested using Android 4.1.1 on a Galaxy Nexus. Your results may vary with other setups.

Wednesday, 2 January 2013

One workaround for Android not receiving MMS

Problem:

My Android (4.1) phone is often not receiving MMS messages in the Messaging app. It stays stuck on the "downloading" message. I have data turned on, so that's not the issue. I was also not roaming at the time. Sometimes Android would download the MMS messages, other times it would just remain on the MMS notification 'download'.

Workaround:

This workaround seemed to have success with my own device after several days of attempting other solutions (turning on/off background data, turning on/off wifi while 3G is turned on, etc.) Your mileage may vary, but hopefully it at least helps someone out there :)

  • in the Messaging app, go to the settings
  • scroll down to the "MULTIMEDIA (MMS) MESSAGES" section
  • uncheck "auto-retrieve"
  • when someone sends a MMS, click the "download" button that appears in place of the 'downloading ...' message
  • your message should now download, rather than forever remain on the "downloading..." message

Notes:

This was tested to work using Android 4.1.1 on a Samsung Galaxy Nexus while on the Fido network in Canada. Again, as many things can contribute to MMS messages not sending, your mileage may vary.

While this is not the ideal solution, most people will usually not be looking at a MMS message until they have the messaging app open in front of them, so hopefully this is an appropriate workaround for those who don't mind waiting a few seconds to manually download a MMS rather than have them automatically download.

By the way, if anyone at Google is reading this, hopefully this bug can be reproduced by your Android Messaging app team =) It's an intermittent bug and I have no idea how to reliably reproduce it, otherwise a bug report would have been filed by now! Have a great day!

Thursday, 15 November 2012

Workaround for Symfony 2.1 composer.phar update timezone error

Problem:

Every time I run "php composer.phar update", I get an error similar to:

Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead in /path/to/symfony21/project/vendor/monolog/monolog/src/Monolog/Logger.php line 112

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

[RuntimeException] An error occurred when executing the "'cache:clear --no-warmup'" command.

What's worse is that my php.ini file has a timezone already set. For instance, when I run the shell command "php -i | grep date.timezone", a timezone is produced, e.g. "date.timezone => America/Los_Angeles => America/Los_Angeles".

Workaround:

A quick workaround to this issue is to explicitly set a timezone in the app/console script. Open the app/console script in a text editor. In app/console, near the top (for instance, right before set_time_limit(0);), add the following line, replacing the example timezone from below with one of the valid PHP timezones found on the PHP docs page:

date_default_timezone_set('America/Los_Angeles');

When you save your changes to app/console and run "php composer.phar update" once more, it should now work.

Notes/Disclaimer:

This workaround isn't by any means an ideal fix, and it will affect the timezone of all Symfony2 commands run using the app/console script. (A fortunate side-effect, however, would be the workaround of timezone issues in other scripts using app/console.) This workaround may or may not also affect any scripts that try to upgrade app/console. To reverse this change, simply remove the "date_default_timezone_set" line you inserted into app/console. (Or even better, prior to modifying app/console, copy the old app/console script, rename the copy to app/console.old, and replace the script with the copy if you need to revert.) This workaround was tested with Symfony 2.1.3, PHP version 5.3.6 using MAMP 2.0.5 under OS X 10.7. Your mileage may vary with other versions.