|
No Comments »
Problem: Help! How can I pass parameters in my Bindings?
Solution: By using lambda functions in python(Check your PL’s manual for anything similar), you would be able to create on-the-fly functions that returns your bindings with the extra parameters/arguments you want to pass.
Example 1: Passing an argument to a wx Button Event
btn = wx.Button(self, 10, “Button”, (10, 10))
self.Bind(wx.EVT_BUTTON, lambda event: self.OnClick(event, ‘passthis’))
def OnClick(self, event, somearg):
print somearg
Example 2: Passing an argument to Pyhook’s HookManager.KeyUp Event
hook = pyHook.HookManager()
hook.KeyUp = lambda event: OnKeyboardEvent(event, ‘Pass Me.’)
hm.HookKeyboard()
def OnKeyboardEvent(event, myarg)
print myarg
That’s It!
|
No Comments »
Problem: Help! My mask clipping isn’t working because of the my layer’s overlay effect! I need to rasterize my effects first but I don’t know how!
Solution:
Step 1: Select the layer with the effects you want rasterized.
Step 2: Press Control(CMD for Mac)+Shift+N to create a new layer.
Step 3: Add the layer from Step 1 to your selection by holding Shift and clicking on the Layer.
Step 4: Press Ctrl(CMD for Mac)+E to merge the two layers and voila! your effects are now rasterized.
__Note__: This tip is especially useful for mask clipping to a layer that have some gradient/color overlays.
|
3 Comments »
Problem: Help! I’ve pasted some text from Microsoft Word and saved it to my SQL database! Now whenever I print my text there’s a bunch of diamonds with a question mark symbols appearing!
Solution: You are trying to display characters that are outside your page’s character set, you have to tell your browser that you need to display characters from the iso-8859-1 set so it will know how to render them correctly.
Simply put the following inside your website’s <head></head>
<META http-equiv="Content-type" content="text/html; charset=iso-8859-1">
and in PHP(or any other similar language), simply put this at the top of your page(for other languages, look for an identical function):
<? header("Content-type: text/html; charset=iso-8859-1"); ?>
and voila! Your characters should now be displayed correctly.

|
No Comments »
The directory structure of Mac and Linux(both are UNIX) tends to get really _really_ long. But don’t worry, by using the ln -s, or Symbolic Link command in the terminal(unix shell), creating “shortcuts” to your folders or files is now a breeze.
ln -s
Here’s an example:
ln -s /Library/Python/2.5/ /shortcuts/PYTHON
The effect: cd /shortcuts/PYTHON is now the same as cd /Library/Python/2.5/, removing a shortcut is similar to removing a file: rm /shortcuts/PYTHON… that’s it!