Python Challenge Level 14: Italy – Code

Used a NumPy array. Doesn’t work if the diagonal+1s are white of course.

import Image
from numpy import array, zeros, uint8
line ='wire.png')
# third dimension is for colours
a = zeros((100, 100, 3), dtype=uint8)
step = array([0, 1])
position = array([0, 0])
count = 0
# continue until when the next spot expected to be unfilled is filled
while not max(a[tuple(position)]):
	# paint colour
	a[tuple(position)] = array(line.getpixel((count, 0)))
	# if reached a wall
	if max(position + step) > 99 or min(position + step) < 0 or max(a[tuple(position + step)]):
		# change direction
		step = (abs(step) ^ 1) * (-step[0] if step[0] else step[1])
	# advance
	position += step
	count += 1
# convert to image


This tutorial will help you use ABAP to connect to any web service and process the resulting output. ABAP has native support for XML so it will be easiest to get your information in XML format rather than JSON and others. For this example, I will use a CBC’s news feed but it can be Digg top stories, Twitter, anything. The XML should look something like the picture below where each news article is enclosed in <ITEM> tags. Read More…

Ctrl-Alt Hotkey Conflict with Virtual Machines

On most virtualisation software like VMWare’s etc, the guest machine’s hotkeys which requires ctrl-alt (such as ctrl-alt-f1 etc for tty change in Linux) can be blocked because ctrl-alt is used to release mouse/keyboard with the VM software. If you use it only occasionally, you can first temporarily disable the release hotkey by pressing ctrl-alt-space then your intended hotkey such as ctrl-alt-f1


VMWare Tools vmware-open-vm-tools-kmod Install Issue

Trying to install VMWare tools from repository in Ubuntu but getting a error while installing packages? There seems to be package dependency going back to open-vm-tools-kmod-generic but it doesn’t exist. When you try to install the next level of package, it would say

“PreDepends: vmware-open-vm-tools-kmod-… but it is not installable”

Unfortunately the VMWare Installation Guide isn’t clear on this matter whereas the Ubuntu documentation is much better. It shows that you can either use the open source version directly available via apt-get or you can build the kmod (kernel mods) from source using the source files in the VMWare repository.

ABAP Get Columns of a Table with Includes in Structure

There are multiple ways of making use of the subclasses of cl_abap_typedescr to get info on runtime instance data objects in ABAP. This is just one of the ways to get the columns of an internal table where its line structure has includes.

Suppose you start with an internal table named “table

DATA table_descr TYPE REF TO cl_abap_tabledescr.
DATA struct_descr TYPE REF TO cl_abap_structdescr.
DATA columns TYPE abap_compdescr_tab.
<column> LIKE LINE OF columns.
table_descr ?= cl_abap_typedescr=>describe_by_data( table ).
struct_descr ?= table_descr->get_table_line_type( ).
columns = struct_descr->components.
LOOP AT columns ASSIGNING <column>.
    [do something with] <column>-name.

cl_abap_structdescr also has a GET_COMPONENTS( ) method but it doesn’t return a flat structure (doesn’t unpack includes). Of course, this doesn’t do any error checks and would crash if “table” isn’t a table.

Outlook Unread Messages System Tray Envelope Icon Not Showing

The Outlook options structure is pretty arcane with all its n-levels of nesting. It’s pretty hard to find the option you want. So you had a envelope that shows you have unread mails before and it’s not there anymore. Bring it back with:

Tools -> Options -> Preferences -> E-mail Options -> Advanced E-mail Options -> Show an envelope icon in the notification area

Sizing conflicts exist on the screen error in SAP

Getting an annoying dialog box about “Sizing conflicts exist on the screen; For more information see SAP Note 570861” in SAPGUI all the time?

Get rid of the warning at Customize Local Layout (Alt-F12), Options. Then, in SAP Internal, uncheck ‘Enable dialog box for screen size check‘.

I’m running on Frontend 720.

The license code is not compatible with the installed version of Microsoft Dynamics CRM

This potential CRM error should typically appear if you had a CRM database, uninstalled it and then tried to reinstall with a different license type. But it can also appear if you used a different license code during the reinstall. You can get confused if you have access to multiple installations and forgot the key you used for a particular instance. But no worries, you can find you key again in SQL -> MSCRM_CONFIG -> ConfigSettings -> LicenseKey. Use that key and it should solve your problem

Draw Line/Shape in FarPoint FpSpread

If you worked with FarPoint Spread, you know that it uses conventions and APIs entirely different from what’s used in normal Winforms. When it comes to drawing inside a FarPoint spread, CreateGraphics will definitely not work. If only FarPoint made their documentations Google-friendly, you will find that there are in fact APIs specifically made for drawing. Read More…

My Take on the MB2-633 CRM 4.0 Installation and Deployment Exam

Here’s my experience on Microsoft’s MB2-633 exam which I just passed, on the second try.

First of all, as far as I can tell, the Prometric exam has 50 questions and there are only 50 questions in their question pool. The questions I got on my second try are the exact same as on my first exam. Read More…

CRM 4.0 Read-Only / Disable / Hide Fields Based on Security Role

Suppose you want to make some fields editable for only some users in CRM forms, there is a great and simple MSDN blog that outlines how to do it.

Here’s a copy of  their code. Just change _roles and _fields to the fields’ names that you want to disable for _roles. Flip it around and enable it only for those users by changing line x to false.

Put it in your form’s onLoad event at Customization->your entity->Forms and Views->Form->Form Properties->Event, OnLoad->Edit Read More…

CRM Workflows Don’t Work, E-mails Don’t Send…

Symptom: You choose to run a workflow but nothing seems to happen and the new workflow doesn’t appear in the workflow tab.

Theory: If my CRM exam studyage served me right, the Microsoft Dynamics CRM is composed of 3 parts. The application layer producing the business logic, the data layer interfacing with SQL and the async service layer doing stuff like workflows on the background (a bit like SQL agent). If the first 2 break, you won’t get your CRM site at all. When the async service layer breaks, it’s a bit more subtle like in this case. Read More…

Free OBD2 Software for Mac

If you just picked up a generic OBD-II – USB interface on eBay and have a Mac, it is true that it is generally more convenient to access these hardware on Windows. Even embedded device developers tend to use Windows to develop against these generic FT232R chip based USB-UART devices simply because of more available supports. But worry not, it can be done on Mac (really on Linux with a more open-platform framework than Windows), it’s just a bit more complicated since it tends to come in be open-source source code rather than prepackaged self-sufficient binaries. Read More…

1 2 3 4 5 6  Scroll to top