Old things and their beauty

There are weeks when work is just over your head, when you feel like you need something new … but sometimes old will be as good as new. I was skeptic about the fact that a walk in a museum of old country side houses would give my mood a tremendous boost, but it really did. Hope it will do the same to other people.


[rb] Removing textframe linkage with applescript

You may sometimes need to be able to remove linkage between text frames in a particular document in Indesign. this script might come to the rescue:

tell application "Adobe InDesign CS2"
	set theObjs to selection
	if theObjs is equal to {} then
		set theObjs to every text frame of document 1
	end if
	tell document 1 to set thebaseframe to make new text frame
	repeat with tos in theObjs
		if (class of tos as string) = "text frame" then
			if end text frame of tos is not tos then
				set next text frame of tos to next text frame of thebaseframe
				set previous text frame of tos to previous text frame of thebaseframe
				set autoflow thread orphaned of tos to true
			end if
		end if
	end repeat
	tell document 1 to delete thebaseframe
end tell

Extending illustrator capabilities with applescript

While Illustrator offers a range of selection options that most of the time are enough for a particular scope, you might sometimes need to deal with a lot of stuff that come from other programs. This tiny script scrap might  come to the rescue in many occasions:

tell application "Adobe Illustrator"
	set sel to selection
	set target to item 1 of sel
	set cls to class of target
	set objs to every page item of document 1
	repeat with o in objs
		if (class of o is equal to cls) then
			set selected of o to true
		end if
	end repeat
end tell

Getting content from a signed pdf document

While most of the time the person that adds a signature for the document, disabling the editing of that document has good reasons for doing so, you sometimes might need to get that content to make some changes. For that you’ll need Acrobat Professional and OSX (tested on 10.4 … might work on 10.5 too):

First step: Open you pdf document with Preview and select the “Select tool” and select the part of the document that you need to edit and copy it.

Second step: Create a new document, hit paste and save it.
Note: at this point the document is editable but the fonts might come as garbage. However you can use the next steps to overcome that.

The next steps are only for flattening/outlining fonts.

Third step: Open the newly created document with Acrobat Professional and add a background to the document from Document -> Background – > Add and set the Opacity to 0(this is needed most of the time if you want to flatten the document).

Fourth step: Flatten the document from Advanced -> Print Production -> Flattener preview (check Convert all text to outlines if you want the fonts to be outlined) and save the document.

This should be it … now you should have an unlocked and working file.

[rb]Debug a symfony object

While the symfony framework is quite intuitive and mostly easy to understand you might sometimes need to debug an object to see it’s methods or simply have a general overview(if you’r lazy enough not to check the official documentation). This might come handy sometimes:


class Debugger {
 public static function debug($class, $exiting = true) {
if(!is_object($class)) return; 
$methods = get_class_methods($class);
 echo '<h1>' . get_class($class) . '</h1>';
 echo '<hr size="1" />';
 array_walk($methods, array(self, "format"));        
 if($exiting) exit();

 public static function format(&$item1, $key) {
 if(strpos($item1,"__") > -1) $item1 = '<span style="background: #ff0000">' . $item1 . '</span>';
 elseif(strpos($item1, "get") > -1) $item1 = '<span style="background: #cceeff">' . $item1 . '</span>';
 elseif(strpos($item1, "set") > -1) $item1 = '<span style="background: #eeffcc">' . $item1 . '</span>';
 else $item1 = '<span style="background: #ddd">' . $item1 . '</span>';
 echo $item1 . "<br />";


Save it in the lib dir of your application under the name Debugger.php then call it like this


[rb] Load all forms/links within tabs in the same place with jquery

One of the things that probably most of the people stumbled upon while working with jquery tabs is reloading the content of a form submit/link within the same window/tab window. That’s pretty simple to achieve with the following code:

//this one will work for forms
$("#tabs form").live( 'submit' , function() {
		var self = this;
		  type: (!$(this).attr('method') ? 'post' : $(this).attr('method')),
		  url: $(this).attr('action'),
		  data: $(this).serialize(),
		  success: function(data) { $('.ui-tabs-panel:visible').html(data); }	 
		return false;
//this one will work for links
$("#tabs > div a").live( 'click' , function() {
		var self = this;
		  type: 'get',
		  url: $(this).attr('href'),
		  success: function(response) { $('.ui-tabs-panel:visible').html(response); }	 
		return false;

While there might be some other implementations with a smoother code, this will do what is supposed to …

[rb]Get relative url with symfony

While using symfony in a subdirectory of your domain you might want to get the absolute URL path of you web directory. This should help you:

function getUrlLocation() {
	$t = explode(DIRECTORY_SEPARATOR, sfConfig::get('sf_web_dir'));
	$tx = explode(DIRECTORY_SEPARATOR,$s);
	$dif = array_diff($t,$tx);
	return implode(DIRECTORY_SEPARATOR, $dif);

A practical example would be redirecting from a public module to the backend module for example. That would be accomplished by using the following code:

header("Location: /". getUrlLocation() . "/backend.php"); exit();