<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>insightmedia</title>
	<atom:link href="http://insightmed.eu/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://insightmed.eu/blog</link>
	<description>be the change you want to see in the world</description>
	<lastBuildDate>Fri, 18 May 2012 17:24:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Connecting to various printers from mac cups</title>
		<link>http://insightmed.eu/blog/general-stuff/connecting-printers-mac-cups_2012_05.html</link>
		<comments>http://insightmed.eu/blog/general-stuff/connecting-printers-mac-cups_2012_05.html#comments</comments>
		<pubDate>Thu, 17 May 2012 13:34:38 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[General stuff]]></category>
		<category><![CDATA[mac cups connect printer]]></category>
		<category><![CDATA[mac cups windows connect printer]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=236</guid>
		<description><![CDATA[Connect to windows spool Go to: http://localhost:631 Administration &#62; Add printer &#62; Windows printer via spools &#62; smb://username:password@printer_ip/printer_name. Connect to Lexmark printer Administration &#62; Add printer &#62; Internet printing protocol &#62; ipp://192.168.1.69/printers/Lexmark_E232 Connect to HP printer Administration &#62; Add printer &#62; AppSocket/HP JetDirect &#62; socket://printer_ip:9100]]></description>
			<content:encoded><![CDATA[<h4>Connect to windows spool</h4>
<p>Go to: <a title="CUPS@localhost" href="http://localhost:631">http://localhost:631</a><br />
Administration &gt; Add printer &gt; Windows printer via spools &gt; smb://username:password@printer_ip/printer_name.</p>
<h4>Connect to Lexmark printer</h4>
<p>Administration &gt; Add printer &gt; Internet printing protocol &gt; ipp://192.168.1.69/printers/Lexmark_E232</p>
<h4>Connect to HP printer</h4>
<p>Administration &gt; Add printer &gt; AppSocket/HP JetDirect &gt; socket://printer_ip:9100</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/general-stuff/connecting-printers-mac-cups_2012_05.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic method calling from applescript</title>
		<link>http://insightmed.eu/blog/programming-scripting/dynamic-method-calling-applescript_2012_03.html</link>
		<comments>http://insightmed.eu/blog/programming-scripting/dynamic-method-calling-applescript_2012_03.html#comments</comments>
		<pubDate>Mon, 26 Mar 2012 13:59:01 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[Applescript]]></category>
		<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[applescript call]]></category>
		<category><![CDATA[applescript call function string]]></category>
		<category><![CDATA[applescript dynamic]]></category>
		<category><![CDATA[applescript dynamic invoke]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=222</guid>
		<description><![CDATA[Applescript comes handy sometimes when you need to do some automation job quick within the MAC OS. Though it lacks many of the features offered by the modern languages, you can sometimes simulate them doing some dirty tricks . One of them is dynamic calling of the methods of a particular script. let&#8217;s take the [...]]]></description>
			<content:encoded><![CDATA[<p>Applescript comes handy sometimes when you need to do some automation job quick within the MAC OS. Though it lacks many of the features offered by the modern languages, you can sometimes simulate them doing some dirty tricks <img src='http://insightmed.eu/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . One of them is dynamic calling of the methods of a particular script. let&#8217;s take the case where you want for example to store some options for your script in a separate file though it might look like a fancy way of storing options. so it will look something like</p>
<pre class="brush:javascript">

--script_options.scpt
on AppleOptions()
  return some options
end AppleOptions

on GrapesOptions()
  return some options
end GrapesOptions

....

on Options()
  --this should be a default option
  return some sort of options
end Options
</pre>
<p>Now if the calling of these options depends on some context that changes every time you run your script, you can still call your methods without knowing beforehand what&#8217;s going to be called, like this:</p>
<pre class="brush:javascript">
--main.scpt
set theFruit to some_value_that_came_from_current_context
set selScpt to path_to_the_options_script_file
set selScpt to load script selScpt
set scptOpt to Options() of selScpt
try
set _scptOpt to run script ("on run (inArgs)" &amp; return &amp; "set theCaller to item 1 of inArgs" &amp; return &amp; "tell (item 1 of inArgs) to " &amp; theFruit &amp; "Options()" &amp; return &amp; "end run") with parameters {selScpt}
--optionally check for empty list or string returned in the try block
end try
if (_scptOpt is not "" and _scptOpt is not {}) then
--display dialog "ok"
set scptOpt to _scptOpt
end if
</pre>
<p>Calling the above script with theFruit set as &#8220;Apple&#8221; (no case checking in the above script though) will call your imported script&#8217;s AppleOptions() or if not found will get the default Options method.</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/programming-scripting/dynamic-method-calling-applescript_2012_03.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free barcode generator for mac using postscriptbarcode</title>
		<link>http://insightmed.eu/blog/programming-scripting/free-barcode-generator-mac-postscriptbarcode_2012_03.html</link>
		<comments>http://insightmed.eu/blog/programming-scripting/free-barcode-generator-mac-postscriptbarcode_2012_03.html#comments</comments>
		<pubDate>Fri, 23 Mar 2012 10:22:21 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[applescript barcode free]]></category>
		<category><![CDATA[mac applescript barcode]]></category>
		<category><![CDATA[mac barcode free]]></category>
		<category><![CDATA[mac barcode postscript]]></category>
		<category><![CDATA[mac batch barcode free]]></category>
		<category><![CDATA[postscriptbarcode]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=215</guid>
		<description><![CDATA[What&#8217;s this? Simply a barcode generator made up from a few open-source tools. It works and it&#8217;s written with Applescript(but it&#8217;s easy portable to other platforms and/or languages because of the great library behind &#8230; PostScript Barcode written by Terry Burton). How it works? Well it simply uses the barcode.eps procedures for the dirty work [...]]]></description>
			<content:encoded><![CDATA[<p>What&#8217;s this?<br />
Simply a barcode generator made up from a few open-source tools. It works and it&#8217;s written with Applescript(but it&#8217;s easy portable to other platforms and/or languages because of the great library behind &#8230; <a title="PostScript Barcode" href="http://code.google.com/p/postscriptbarcode/" rel="nofollow" target="_blank">PostScript Barcode</a> written by Terry Burton).</p>
<p>How it works?<br />
Well it simply uses the barcode.eps procedures for the dirty work of drawing the barcodes, and exports only the needed bits to an .eps file named after the barcode. Then <a title="Ghoscript" href="http://pages.cs.wisc.edu/~ghost/" rel="nofollow" target="_blank">ghostscript</a>( the script uses the one provided by <a title="Macports project" href="http://www.macports.org/">macports</a> &#8230; you can however use the the gs library provided by mac replacing the /opt/local/bin/gs in the below script with the output of the <strong><em>which gs</em></strong> command executed in terminal ) helps us get the bounding box of the new created barcode and <a title="Sed Unix Tool" href="http://en.wikipedia.org/wiki/Sed" rel="nofollow" target="_blank">sed</a> will make the needed replacements for us inside the .eps file.</p>
<p>What is needed?<br />
Basic knowledge of a few unix tools and some applescript. Also the documentation of PostScriptBarcode must be read in order to find out the options that can be applied to a particular barcode.</p>
<p>Does it really work?<br />
Well i used with success a modified version of the below script for a long time, and the results were at least as good as the ones from a commercial software for my particular case.</p>
<p>Some pointers &#8230;<br />
My version of postscript barcode is slightly changed in order to fix some problems like missing fonts. The first part of my barcode.eps looks like this:</p>
<pre class="brush:javascript">%!PS-Adobe-3.0 EPSF-3.0
%%Creator: spherix v0.6.1
%%BoundingBox%%
%%DocumentPaperSizes: a4
%%DocumentFonts: OCRB
%%DocumentNeededFonts: OCRB
%%DocumentProcessColors: Black
%%EndComments

% Barcode Writer in Pure PostScript - Version 2011-05-10</pre>
<p>this script might need refining (make sure you change the defined paths to the ones of your system):</p>
<pre class="brush:javascript">property the_save_dir : "/Volumes/Data/data/EANs"
--this is the path to the barcode.eps file
property the_posix_dir : "/Volumes/Data/Barcode App/"

on DoRun(symbology, theBarcodesFile, indexFieldIndex, separatorChar, theFont, theOptions)
	--display dialog separatorChar
	set symbology to do shell script ("echo '" &amp; symbology &amp; "' | sed 's/[-\\s]//g'")
	set oDelim to AppleScript's text item delimiters

	do shell script ("sed -e s/\\r\\n/\\r/g '" &amp; theBarcodesFile &amp; "'")
	set theContents to my readfile(theBarcodesFile)
	set psLine to "10 10 moveto (%s) (%s) /%s /uk.co.terryburton.bwipp findresource exec"
	set master to "barcode.eps"

	repeat with i from 1 to (count of (paragraphs of theContents))
		repeat 1 times
			set options to {}
			if (paragraph i of theContents is "") then
				exit repeat
			end if
			set AppleScript's text item delimiters to {separatorChar}
			set options to options &amp; {text item indexFieldIndex of paragraph i of theContents}
			--display dialog "Options:" &amp; options

			if theFont is not "" then
				do shell script ("sed \"s/Helvetica/" &amp; theFont &amp; "/g\" '" &amp; the_posix_dir &amp; "/" &amp; "barcode.ps' &gt; '" &amp; the_posix_dir &amp; "/barcode_" &amp; theFont &amp; ".ps'")
				set master to "barcode_" &amp; theFont &amp; ".ps"
			end if

			set _options to {}
			repeat with opt in items of theOptions
				if item 2 of opt is not false then
					set _opt to item 1 of opt
					set _opt2 to item 2 of opt

					if (_opt2 is not "" and _opt2 is not true and _opt2 is not false) then
						--display dialog "not null"
						set _opt to _opt &amp; "=" &amp; _opt2
					end if
					set _options to _options &amp; _opt
				end if
			end repeat

			set AppleScript's text item delimiters to {" "}
			--display dialog theOptions as string
			set options to options &amp; {("'" &amp; _options as string) &amp; "'"}
			set options to options &amp; {symbology}

			set psLineComp to do shell script ("printf '" &amp; psLine &amp; "' " &amp; (options as string))
			set AppleScript's text item delimiters to {separatorChar}

			--display dialog psLineComp
			if (text item indexFieldIndex of paragraph i of theContents is "") then
				exit repeat
			end if
			my makeEPS(master, the_save_dir &amp; "/" &amp; text item indexFieldIndex of paragraph i of theContents, psLineComp, symbology)
		end repeat
	end repeat
	set AppleScript's text item delimiters to oDelim
end DoRun

on readfile(unixPath)
	set foo to (open for access (POSIX file unixPath))
	set txt to (read foo for (get eof foo))
	close access foo
	return txt
end readfile

on writeFile(unixPath, content)
	set foo to open for access (POSIX file unixPath) with write permission
	set eof of foo to 0
	write content to foo
	close access foo
end writeFile

on getRequirements(targetFile, symbology)
	set requirements to "sed -n -e \"/% --BEGIN ENCODER " &amp; symbology &amp; "--/,/% --END ENCODER " &amp; symbology &amp; "--/p\" " &amp; targetFile &amp; " | sed -n -e \"s/^dup \\/\\([^\\s]\\)/\\1/p\""
	set reqlines to do shell script (requirements)
	set oDelim to AppleScript's text item delimiters
	set reqList to {}
	set renderers to {"renlinear", "renmatrix", "renmaximatrix"}

	repeat with i from 1 to (length of paragraphs of reqlines)
		set AppleScript's text item delimiters to {" "}
		set _req to text item 1 of paragraph i of reqlines
		if _req is in renderers then
			set reqList to reqList &amp; {"-e \"/% --BEGIN RENDERER " &amp; _req &amp; "--/,/% --END RENDERER " &amp; _req &amp; "--/p\"" &amp; " "}
		else
			set reqList to reqList &amp; {"-e \"/% --BEGIN ENCODER " &amp; _req &amp; "--/,/% --END ENCODER " &amp; _req &amp; "--/p\"" &amp; " "}
		end if
	end repeat

	set command to "sed -n -e \"/%\\!PS-Adobe-2.0/,/% --END PREAMBLE--/p\" "
	if (length of reqList &gt; 0) then

		repeat with j in reqList
			set command to command &amp; j &amp; " "
		end repeat
	end if

	set command to command &amp; "-e \"/% --BEGIN ENCODER ean13--/,/% --END ENCODER ean13--/p\" " &amp; targetFile

	set fileContents to do shell script (command)

	return fileContents
end getRequirements

on makeEPS(master, unixPath, content, symbology)
	set EPInstr to my getRequirements("/Volumes/Data/Barcode App/" &amp; master, symbology)
	set EPInstr to EPInstr &amp; content
	my writeFile(unixPath, EPInstr)
	set bbox to "%%BoundingBox: 0 0 97 76"
	try
		set bbox to do shell script ("/opt/local/bin/gs -dNOPAUSE -dBATCH -q -sDEVICE=bbox " &amp; unixPath &amp; " 2&gt;&amp;1")
	end try
	do shell script ("sed -i \"\" 's/%%BoundingBox%%/" &amp; bbox &amp; "/g' " &amp; unixPath)

	set theFile to POSIX file unixPath as string
	tell application "Finder" to set file type of alias theFile to "EPSF"
end makeEPS</pre>
<p>Calling the script to generate barcodes from a particular file:</p>
<pre class="brush:javascript">my DoRun("the symbology: eg ean13 - must match postscript's barcode intern definitions", "csv data file", "index of the barcode field in csv file", "csv file separator", "font to use with barcode", "options as a list where every option is defined as a list eg: {postscript barcode option, value of the option - in case there is no value put true in the second value(false will ignore option)} =&gt; example of an option list {{\"includetext\", true}, {\"height\", cheight / 25.4}, {\"textsize", 11}}\") of myBarcodeGenerator</pre>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/programming-scripting/free-barcode-generator-mac-postscriptbarcode_2012_03.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing chosen jquery select box replacement</title>
		<link>http://insightmed.eu/blog/programming-scripting/removing-chosen-jquery-select_2012_03.html</link>
		<comments>http://insightmed.eu/blog/programming-scripting/removing-chosen-jquery-select_2012_03.html#comments</comments>
		<pubDate>Wed, 21 Mar 2012 08:29:39 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[remove chosen]]></category>
		<category><![CDATA[unchosen]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=212</guid>
		<description><![CDATA[$("select").removeClass("chzn-done").css('display', 'inline').data('chosen', null); $("*[class*=chzn]").remove();]]></description>
			<content:encoded><![CDATA[<p><code>$("select").removeClass("chzn-done").css('display', 'inline').data('chosen', null);<br />
			$("*[class*=chzn]").remove();</code></p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/programming-scripting/removing-chosen-jquery-select_2012_03.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN checkout failed</title>
		<link>http://insightmed.eu/blog/uncategorized/svn-checkout-failed_2012_02.html</link>
		<comments>http://insightmed.eu/blog/uncategorized/svn-checkout-failed_2012_02.html#comments</comments>
		<pubDate>Mon, 20 Feb 2012 09:17:49 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[svn checkout failed]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=210</guid>
		<description><![CDATA[Normally this error occurs when you&#8217;re running under some sort of proxy environment. The fix is pretty simple: Open a terminal window: type sudo pico ~/.subversion/servers scroll down until you find the [global] line (should be at the end of the file) and uncomment if commented (aka preceded by ###) the following lines: http-proxy-host = [...]]]></description>
			<content:encoded><![CDATA[<p>Normally this error occurs when you&#8217;re running under some sort of proxy environment. The fix is pretty simple:</p>
<p>Open a terminal window:</p>
<p>type sudo pico ~/.subversion/servers</p>
<p>scroll down until you find the [global] line (should be at the end of the file) and uncomment if commented (aka preceded by ###) the following lines:</p>
<pre><code>
http-proxy-host = your_proxy_address
http-proxy-port = your_proxy_port
http-proxy-username = your_proxy_user
http-proxy-password = your_proxy_pass
http-compression = no</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/uncategorized/svn-checkout-failed_2012_02.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compile parameters for php 5.3.10 under MacOS Lion</title>
		<link>http://insightmed.eu/blog/uncategorized/compile-parameters-php-5-3-10_2012_02.html</link>
		<comments>http://insightmed.eu/blog/uncategorized/compile-parameters-php-5-3-10_2012_02.html#comments</comments>
		<pubDate>Fri, 17 Feb 2012 10:26:24 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php compile lion]]></category>
		<category><![CDATA[php compile options mac]]></category>
		<category><![CDATA[php parameters lion]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=205</guid>
		<description><![CDATA[Prequisites: MacPorts for latest libpng, iconv and openssl libraries ./configure \ &#8211;prefix=/usr/local \ &#8211;with-apxs2=/usr/sbin/apxs \ &#8211;with-ldap=/usr \ &#8211;with-kerberos=/usr \ &#8211;enable-cli \ &#8211;with-zlib-dir=/usr \ &#8211;enable-exif \ &#8211;enable-ftp \ &#8211;enable-mbstring \ &#8211;enable-mbregex \ &#8211;enable-sockets \ &#8211;with-iodbc=/usr \ &#8211;with-curl=/usr \ &#8211;with-config-file-path=/etc \ &#8211;sysconfdir=/private/etc \ &#8211;with-mysql=mysqlnd \ &#8211;with-mysqli=mysqlnd \ &#8211;with-pdo-mysql=mysqlnd \ &#8211;with-openssl=/usr \ &#8211;with-xmlrpc \ &#8211;with-xsl=/usr \ &#8211;without-pear \ [...]]]></description>
			<content:encoded><![CDATA[<p>Prequisites:<br />
<a title="Mac Ports" href="http://www.macports.org/install.php" rel="no-follow">MacPorts</a> for latest libpng, iconv and openssl libraries</p>
<p>./configure \<br />
&#8211;prefix=/usr/local \<br />
&#8211;with-apxs2=/usr/sbin/apxs \<br />
&#8211;with-ldap=/usr \<br />
&#8211;with-kerberos=/usr \<br />
&#8211;enable-cli \<br />
&#8211;with-zlib-dir=/usr \<br />
&#8211;enable-exif \<br />
&#8211;enable-ftp \<br />
&#8211;enable-mbstring \<br />
&#8211;enable-mbregex \<br />
&#8211;enable-sockets \<br />
&#8211;with-iodbc=/usr \<br />
&#8211;with-curl=/usr \<br />
&#8211;with-config-file-path=/etc \<br />
&#8211;sysconfdir=/private/etc \<br />
&#8211;with-mysql=mysqlnd \<br />
&#8211;with-mysqli=mysqlnd \<br />
&#8211;with-pdo-mysql=mysqlnd \<br />
&#8211;with-openssl=/usr \<br />
&#8211;with-xmlrpc \<br />
&#8211;with-xsl=/usr \<br />
&#8211;without-pear \<br />
&#8211;with-libxml-dir=/usr \<br />
&#8211;with-iconv-dir=/usr/local \<br />
&#8211;with-gd \<br />
&#8211;with-jpeg-dir=/opt/local \<br />
&#8211;with-png-dir=/opt/local \<br />
&#8211;with-freetype-dir=/opt/local \<br />
&#8211;with-mcrypt=/opt/local<br />
&#8211;with-iconv=shared,/opt/local<br />
&#8211;with-ssl=shared,/opt/local</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/uncategorized/compile-parameters-php-5-3-10_2012_02.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pin problem with eclipse-php in Windows 7</title>
		<link>http://insightmed.eu/blog/programming-scripting/pin-problem-eclipse-php-windows_2012_02.html</link>
		<comments>http://insightmed.eu/blog/programming-scripting/pin-problem-eclipse-php-windows_2012_02.html#comments</comments>
		<pubDate>Sun, 12 Feb 2012 21:05:20 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming / Scripting]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=202</guid>
		<description><![CDATA[Eclipse 3.0.2 tends to be stubborn about pinning nicely to the Windows 7 taskbar &#8230; the solution for me was to add these to the eclipse-php.ini &#8211;launcher.vm C:\Program Files\Java\jre7\bin where C:\Program Files\Java\jre7\bin is the path of the installed jre on your system.]]></description>
			<content:encoded><![CDATA[<p>Eclipse 3.0.2 tends to be stubborn about pinning nicely to the Windows 7 taskbar &#8230; the solution for me was to add these to the eclipse-php.ini<br />
&#8211;launcher.vm<br />
C:\Program Files\Java\jre7\bin</p>
<p>where C:\Program Files\Java\jre7\bin is the path of the installed jre on your system.</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/programming-scripting/pin-problem-eclipse-php-windows_2012_02.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding multiple forms with symfony &#8230; hardcore :)</title>
		<link>http://insightmed.eu/blog/programming-scripting/embedding-multiple-forms-symfony_2011_06.html</link>
		<comments>http://insightmed.eu/blog/programming-scripting/embedding-multiple-forms-symfony_2011_06.html#comments</comments>
		<pubDate>Thu, 30 Jun 2011 21:13:01 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming / Scripting]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[embed form symfony]]></category>
		<category><![CDATA[embed multiple forms symfony]]></category>
		<category><![CDATA[embed relation symfony]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=190</guid>
		<description><![CDATA[Well this should be one of the last posts about branch 1.x of symfony. The 2nd version should come to alpha soon so there is no real need to go further with it. Anyway &#8230; some time ago I desperately needed a quick and reliable way to embed multiple symfony forms on one page and [...]]]></description>
			<content:encoded><![CDATA[<p>Well this should be one of the last posts about branch 1.x of symfony. The 2nd version should come to alpha soon so there is no real need to go further with it. Anyway &#8230; some time ago I desperately needed a quick and reliable way to embed multiple symfony forms on one page and submit them at once. I generally take the time to look into the source files, but this time i was in a hurry. So this is the &#8220;hacky&#8221; way i got around:</p>
<pre class="brush:php">
function executeMoo(sfWebRequest $request) {
$this-&gt;forms = array();

$it = 0;

foreach($some_model as $s) {

$f = new MooForm($s);

$f-&gt;getWidgetSchema()-&gt;setNameFormat('foo[' . $form-&gt;getName() . $it . '][%s]');

$this-&gt;form-&gt;embedForm($it, $form);
$this-&gt;forms[] = $this-&gt;form;
$it++;

}
}</pre>
<p>The presentation part should be as simple as:</p>
<pre class="brush:php">
&lt;form ...&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;table&gt;
&lt;?php
foreach($forms as $form) :
   echo $form;
endforeach;
?>
&lt;/table&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/pre&gt;
</pre>
<p>Ok now for the validation part:</p>
<pre class="brush:php">
public function executeSubmit_Foo(sfWebRequest $request) {
         $this->forward404Unless($request->isMethod(sfRequest::POST));

   	$base_forms = $request->getParameter('foo');

	foreach($base_forms as $base_form) {
		$f = new MooForm();
		$f->bind($base_form,null);
		if($f->isValid()) {
			$f->save();
		}
	}
}
</pre>
<p>What&#8217;s the catch?<br />
Well the catch is in this line: $f-&gt;getWidgetSchema()-&gt;setNameFormat(&#8216;foo[' . $form-&gt;getName() . $it . '][%s]&#8216;);<br />
What it really does? it generates the form fields like foo['forms_name1'] &#8230; so the only thing you have to do is grabbing the foo var from request and looping through to get the embedded forms.<br />
Sure there are better ways, but this worked nice with a minimum ammount of time spent.<br />
Hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/programming-scripting/embedding-multiple-forms-symfony_2011_06.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows reloaded or failure reloaded?</title>
		<link>http://insightmed.eu/blog/general-stuff/windows-reloaded-failure-reloaded_2011_06.html</link>
		<comments>http://insightmed.eu/blog/general-stuff/windows-reloaded-failure-reloaded_2011_06.html#comments</comments>
		<pubDate>Fri, 03 Jun 2011 19:07:50 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[General stuff]]></category>
		<category><![CDATA[new windows]]></category>
		<category><![CDATA[windows 8]]></category>
		<category><![CDATA[windows 8 ui]]></category>
		<category><![CDATA[windows reloaded]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=175</guid>
		<description><![CDATA[Today i had some time to look inside of some newsletter i got in the last few days. One of them seemed pretty interesting because it was talking about a totally new Windows, with cool new stuff(yeah heard that before) and a complete new design(same here). While i wasn&#8217;t quite convinced about the last, i [...]]]></description>
			<content:encoded><![CDATA[<p>Today i had some time to look inside of some newsletter i got in the last few days. One of them seemed pretty interesting because it was talking about a totally new Windows, with cool new stuff(yeah heard that before) and a complete new design(same here). While i wasn&#8217;t quite convinced about the last, i took a look at one of the videos presenting the new redesigned UI. In my oppion the changes look good, though they don&#8217;t bring something really spectacular compared to competition (in fact it shouldn&#8217;t, as it has to be still friendly for people coming from prior versions), but it&#8217;s a good change that strengthens my belief that Windows is one of the best choices for most of the people when it comes to daily computer usage. One interesting thing is that Microsoft started to impose restrictions for the Windows 8 tablet chipmakers according to windows8center.com, which in my oppinion is one of the best things they&#8217;ve did in the past decade &#8230; it should bring more quality, lower prices and most of all &#8230; a better experience(did they finally learn the apple philosophy?). &#8211; original post <a href="http://windows8center.com/news/microsoft-to-impose-one-tablet-only-restriction-for-windows-8-tablet-chipmakers/">here</a></p>
<p>Anyway here are the videos.<br />
<object style="height: 390px; width: 640px;"><param name="movie" value="http://www.youtube.com/v/p92QfWOw88I?version=3" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed type="application/x-shockwave-flash" width="640" height="390" src="http://www.youtube.com/v/p92QfWOw88I?version=3" allowfullscreen="true" allowscriptaccess="always"></embed></object></p>
<p>And second one from the Windows 8 presentation in taiwan.<br />

<!-- Iframe plugin v.2.1 (wordpress.org/extend/plugins/iframe/) -->
<iframe src="http://www.microsoft.com:80/presspass/silverlightApps/videoplayer3/standalone.aspx?contentID=win8_preview1&amp;src=/presspass/presskits/windows7/channel.xml" width="640" height="360" frameborder="0" scrolling="no" class="iframe-class"></iframe></p>
<p>More information can be found on windows8center.com</p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/general-stuff/windows-reloaded-failure-reloaded_2011_06.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the right tools at the right time</title>
		<link>http://insightmed.eu/blog/general-stuff/tools-time_2011_05.html</link>
		<comments>http://insightmed.eu/blog/general-stuff/tools-time_2011_05.html#comments</comments>
		<pubDate>Fri, 27 May 2011 07:36:56 +0000</pubDate>
		<dc:creator>dan.hawk</dc:creator>
				<category><![CDATA[General stuff]]></category>
		<category><![CDATA[Usefull stuff]]></category>
		<category><![CDATA[keep it simple]]></category>

		<guid isPermaLink="false">http://insightmed.eu/blog/?p=171</guid>
		<description><![CDATA[Reading my daily dose of feeds on GReader, i came across on an older post from Bruno Lowagie&#8217;s blog (if iText rings any bells) explaining why software needs to be kept simple and oriented to its designed role and not doing a ton of things that don&#8217;t have anything to do with the initial target. [...]]]></description>
			<content:encoded><![CDATA[<p>Reading my daily dose of feeds on GReader, i came across on an older post from Bruno Lowagie&#8217;s blog (if iText rings any bells) explaining why software needs to be kept simple and oriented to its designed role and not doing a ton of things that don&#8217;t have anything to do with the initial target. I don&#8217;t know why but the story amuzes me everytime i read it. here it is:</p>
<p><a title="Don't eat soup with a fork" href="http://www.lowagie.com/node/136" target="_blank">Don&#8217;t eat soup with a fork</a></p>
]]></content:encoded>
			<wfw:commentRss>http://insightmed.eu/blog/general-stuff/tools-time_2011_05.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

