<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>DevRecipes</title>
	
	<link>http://www.devrecipes.com</link>
	<description>Tips, How-tos and hacks for software developers</description>
	<pubDate>Mon, 24 Jan 2011 03:00:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Devrecipes" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="devrecipes" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Wireless switch not working on Linux ? Try rfkill.</title>
		<link>http://www.devrecipes.com/2011/01/23/wireless-switch-not-working-on-linux-try-rfkill/</link>
		<comments>http://www.devrecipes.com/2011/01/23/wireless-switch-not-working-on-linux-try-rfkill/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 02:58:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=223</guid>
		<description><![CDATA[I have been using Ubuntu on my laptop without any problems but recently ran into a weird issue- my wireless would not switch on. Usually turning off and turning on the wireless switch on my laptop used to solve this problem but this time that did not work. Next, I tried the usual ifconfig wlan0 [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using Ubuntu on my laptop without any problems but recently ran into a weird issue- my wireless would not switch on. Usually turning off and turning on the wireless switch on my laptop used to solve this problem but this time that did not work. Next, I tried the usual <i>ifconfig wlan0 up</i> command, that didn&#8217;t work either.</p>
<p>Looking further at the dmesg logs I saw the following:</p>
<blockquote><p>
Operation not possible due to RF-kill<br />
iwlagn 0000:07:00.0: RF_KILL bit toggled to enable radio.
</p></blockquote>
<p>So did a quick google search on RF kill and I stumbled upon the <a href="http://wireless.kernel.org/en/users/Documentation/rfkill">rfkill</a> tool which solved the problem. I ran the following on the terminal</p>
<blockquote><p>
sudo rfkill unblock wifi
</p></blockquote>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/bm_W-eqPK_4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2011/01/23/wireless-switch-not-working-on-linux-try-rfkill/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Date/Time/Timezone manipulation and conversion in Java: a few examples</title>
		<link>http://www.devrecipes.com/2010/02/14/datetimetimezone-manipulation-and-conversion-in-java-a-few-examples/</link>
		<comments>http://www.devrecipes.com/2010/02/14/datetimetimezone-manipulation-and-conversion-in-java-a-few-examples/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 03:02:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java/J2EE]]></category>

		<category><![CDATA[J2EE]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=186</guid>
		<description><![CDATA[Java date/time manipulation, formatting and conversion can be very tricky with things getting even more complicated when timezones are taken into consideration. A lot of developers (even seasoned ones) often run into problems when playing with date/time values. Provided are a ready reference of some common date manipulation/formatting tricks that have been tested in java 1.5]]></description>
			<content:encoded><![CDATA[<p>Java date/time manipulation, formatting and conversion can be very tricky with things getting even more complicated when timezones are taken into consideration. A lot of developers (even seasoned ones) often run into problems when playing with date/time values.</p>
<div class="related">
<h4>Related Posts</h4>
<p>   <a href="http://www.devrecipes.com/2009/08/14/environment-specific-configuration-for-java-applications/">Environment Specific configuration for Java Applications</a><br />
   <a href="http://www.devrecipes.com/2009/10/19/jstl-and-struts-logic-tags-iteration-quick-reference/">JSTL and Struts logic tags: a quick reference</a><br />
 <a href="http://www.devrecipes.com/2009/05/10/flex-chart-from-xml-data-using-httpservice-with-java-servlets/">Flex Chart from xml using Java Servlets</a><br />
 <a href="http://www.devrecipes.com/2009/07/19/get-system-information-using-java/">Get System Information using Java</a>
 </div>
<p>Here&#8217;s a ready reference of some common date manipulation/formatting tricks that can be quite handy. They have been tested on <b>Jdk 1.5.</b> </p>
<ul>
<li>
<b>Convert a String to a java.util.Date object:</b> </p>
<pre class="brush: java; toolbar: false;">
Date doStringToDate(String date,String inFormat){
  DateFormat df = new SimpleDateFormat(inFormat);
  Date dt=null;
  try
   {
	  dt= df.parse(date);
   } catch (ParseException e)
  {
   //handle exception
  }
     return dt;
	}
</pre>
</li>
<p>In the above, the inFormat parameter must exactly match the format of the date represented by the date parameter, for example if date is &#8220;13/12/2007&#8243; then inFormat must be &#8220;dd/MM/yyyy&#8221;, if date is &#8220;13 Dec 07&#8243; then format must be &#8220;dd MMM yyyy&#8221; and so on. See the javadocs for <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a> for more.</p>
<li>
<b>Convert java.util.Date object to a String:</b><br />
Specify the format of the String that you want using the SimpleDateFormat. </p>
<pre class="brush: java; toolbar: false;">
 String doDateToString(Date dt){
    SimpleDateFormat formatter=new SimpleDateFormat(&quot;MMM d KK:mm a E Z&quot;);
    String s=formatter.format(dt);
    return s;
 }
</pre>
</li>
<li>
<b>Convert a date String in one format to a different format:</b><br />
The following will convert the String inDate in inFormat to a date String in outFormat. Again remember that inFormat must exactly match the format of inDate.</p>
<pre class="brush: java; toolbar: false;">
 String oneFormatToAnother(String inDate,String inFormat,String outFormat){
   DateFormat inDf = new SimpleDateFormat(inFormat);//input date is in this format
   Date dt=null;
   String outDate;
   try
     {
	  dt= inDf.parse(inDate);
	 } catch (ParseException e)
	 {
	    //handle exception
	}
	DateFormat outDf=new SimpleDateFormat(outFormat);
	outDate=outDf.format(dt);
		return outDate;

   }
</pre>
<p>So calling the above method in the following way- oneFormatToAnother(&#8221;02/11/2009&#8243;,&#8221;dd/MM/yyyy&#8221;,&#8221;E MMM d KK:mm a Z&#8221;)  will return &#8220;Nov 2 00:00 AM -0500&#8243; if your JVM  is in EST.
</li>
<li>
<b>Date and Time calculation:</b><br/> Use the methods of the Calendar class if you need to perform date Calculations. An example is given below:</p>
<pre class="brush: java; toolbar: false;">
  void dateCalculationExample(Date d1){

    	  Calendar c= Calendar.getInstance();
    	  c.setTime(d1);
    	  c.add(Calendar.YEAR, 2);
    	  c.add(Calendar.HOUR,5);
    	  c.add(Calendar.DAY_OF_MONTH,-4);

    	  Date d2=c.getTime();
    	  System.out.println(&quot;modified date=&quot;+d2.toString());

      }
</pre>
</li>
<li>
<b>Timezone conversion of a date String:</b><br />
Changing the timezone of a Date object is not recommended and might produce unexpected results. What will work however is timezone conversion of a date string. The following will convert a date string &#8216;inDateStr&#8217; which is in &#8216;inTz&#8217; Timezone and in format &#8216;inFormat&#8217; into another date string in &#8216;outTz&#8217; timezone and formatted as in &#8216;outFormat&#8217;.</p>
<pre class="brush: java; toolbar: false;">
String changeTimeZone(String inTZ,String outTZ, String inDateStr, String inFormat,String outFormat){
   //convert the incoming date string to a date object
   Date inDate=null;
   DateFormat inDf=new SimpleDateFormat(inFormat);
   inDf.setTimeZone(TimeZone.getTimeZone(inTZ));
   try{
      inDate=inDf.parse(inDateStr);
   }catch(ParseException e){
      //handle exception
     }
//System.out.println(&quot;inDate tostring=&quot;+inDate.toString());//Note this will give you time in default TZ and not in inTZ

  DateFormat outDf=new SimpleDateFormat(outFormat);
  outDf.setTimeZone(TimeZone.getTimeZone(outTZ));

  String st=outDf.format(inDate);
  return st
  }
</pre>
<p>Example: changeTimeZone(&#8221;America/Denver&#8221;,&#8221;Asia/Calcutta&#8221;,&#8221;02/08/2010 15:00:20&#8243;,&#8221;MM/dd/yyyy HH:mm:ss&#8221;,&#8221;dd/MM/yy HH:mm:ss z&#8221;); will result in &#8216;09/02/10 03:30:20 IST&#8217;.
</li>
<li>
<b>Convert timezones of a timestamp when storing into a database: </b><br />
Very often date/time information in an application must be stored in a fixed timezone even though users may enter time from any timezone. Therefore there is always a need to convert time into this fixed timezone. It is not a good idea to use the database default timezone in this case as this may change due to administrative reasons. Instead the conversion should be done explicitly.<br />
If you have a date string &#8216;inDateStr&#8217;  in Timezone &#8216;inTz&#8217; and need to convert it to a different timezone(outTz) when storing in a database column of type Timestamp use the following, paying particular attention to lines 24 and 25.</p>
<pre class="brush: java; highlight: [24,25]; toolbar: false;">
 public void loadTimeInDB(String inDateStr, String inTz,String inFormat,String outTz){                          

  Connection oraConn=null;
  PreparedStatement stmt=null;
  Date inDate=null;

   //convert to Date object
    DateFormat inDf=new SimpleDateFormat(inFormat);
    inDf.setTimeZone(TimeZone.getTimeZone(inTz));
    try{
         inDate=inDf.parse(inDateStr);
      }catch(ParseException e){
	   //handle exception
	}

   try{
        //do DB stuff
	Class.forName(&quot;oracle.jdbc.OracleDriver&quot;);
	oraConn = DriverManager.getConnection(&quot;jdbc:oracle:thin:@host:port:sid&quot;, &quot;username&quot;,&quot;pw&quot;);
	stmt=oraConn.prepareStatement(&quot;insert into test_date values(?,SYSDATE)&quot;);

      //timezone conversion takes place here with a Calendar Object
      Timestamp dbTs=new Timestamp(inDate.getTime());
      Calendar cal=Calendar.getInstance(TimeZone.getTimeZone(outTz));
       stmt.setTimestamp(1,dbTs,cal);

       //update and close connection
       stmt.executeUpdate();
       stmt.close();
       oraConn.close();
     }catch(Exception e){
	  //handle exception

	   }

	 }
</pre>
<p>So if you call the above method with the parameters <b>loadTimeInDB(&#8221;02/08/2010 15:36:20&#8243;,&#8221;America/New_York&#8221;,&#8221;MM/dd/yyyy HH:mm:ss&#8221;,&#8221;Europe/Paris&#8221;)</b>  the timestamp column in the databse should show as <b>08-FEB-10 09.36.20.000000000 PM.</b> or something similar.<br />
<b>Caveat: The above was tested in Oracle 10g and did the conversion correctly, but in MySQL it did not. So use it carefully.</b> If this did not work for you, you might try manually calculating the offset of your target timezone as described next.
</li>
<li>
 <b>Convert timezones using offset and store in database:</b><br />
Timezone conversions can also be achieved by calculating the time difference between the two timezones (using java.util.Timezone&#8217;s getOffset() method) and adding this difference to the time that needs to be converted. So you might think this should be pretty straight forward.<br />
<i>However in our example above, when you do a inDate.getTime(), this automatically converts the time given by &#8216;inDateStr&#8217; and &#8216;inTz&#8217; to the application&#8217;s (jvm) timezone</i>.<br />
In other words if the time component &#8216;inDateStr&#8217; is &#8220;16:15:20&#8243; and &#8216;inTz&#8217; is &#8220;America/Denver&#8221;, then when you do a inDate.getTime(), the time is implicitly converted to &#8216;18:15:20&#8242; if your jvm&#8217;s default timezone is &#8220;America/New_York&#8221; (+2 hours). <b>For this reason, the time difference between the target timezone &#8216;outTz&#8217; and jvm&#8217;s timezone is used in the calculateOffset() method below, instead of the time difference between &#8216;inTz&#8217; and &#8216;outTz&#8217;.</b> Note that this behavior might differ from jvm to jvm, so make sure to test thoroughly.  The modified code is as below:</p>
<pre class="brush: java; highlight: [23,24]; toolbar: false;">
void loadTimeInDB(String inDateStr, String inTz,String inFormat,String outTz){                          

  Connection oraConn=null;
  PreparedStatement stmt=null;
  Date inDate=null;

   //convert to Date object
    DateFormat inDf=new SimpleDateFormat(inFormat);
    inDf.setTimeZone(TimeZone.getTimeZone(inTz));
    try{
         inDate=inDf.parse(inDateStr);
      }catch(ParseException e){
	   //handle exception
	}

   try{
        //do DB stuff
	Class.forName(&quot;oracle.jdbc.OracleDriver&quot;);
	oraConn = DriverManager.getConnection(&quot;jdbc:oracle:thin:@host:port:sid&quot;, &quot;username&quot;,&quot;pw&quot;);
	stmt=oraConn.prepareStatement(&quot;insert into test_date values(?,SYSDATE)&quot;);

      //timezone conversion takes place here using the calculateOffset method
      Timestamp dbTs=new Timestamp(inDate.getTime()+calculateOffset(inDate,outTz));
       stmt.setTimestamp(1,dbTs);

       //update and close connection
       stmt.executeUpdate();
       stmt.close();
       oraConn.close();
     }catch(Exception e){
	  //handle exception

	   }

	 }

 long calculateOffset(Date onDate,String outTz){
    //First get offset from UTC of Target Timezone
   TimeZone Tz1=TimeZone.getTimeZone(outTz);
   long outTzOffset= Tz1.getOffset(onDate.getTime());

   //Now get the offset from UTC of your application (JVMs) default timezone
   Calendar cal=Calendar.getInstance();
   TimeZone jvmTz=cal.getTimeZone();
   long inTzOffset=jvmTz.getOffset(onDate.getTime()); 

   //calculate offset of target timezone from jvm timezone
   long offset=(outTzOffset - inTzOffset);
   //double offsetInHrs=offset/(1000*60*60); //offset in hours: use for debugging
   return offset;

   }
</pre>
<p>So calling the above function with these parameters:<b> loadTimeInDB(&#8221;02/09/2010 22:34:20&#8243;,&#8221;Europe/Paris&#8221;,&#8221;MM/dd/yyyy HH:mm:ss&#8221;,&#8221;Asia/Shanghai&#8221;)</b> will store the time as <b>&#8220;10-FEB-10 05.34.20.000000000 AM&#8221; </b> in the database, which is the time that corresponds to 10:34 PM of the previous day (Feb 9th) in Paris.</p>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/f8sanJi77wg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2010/02/14/datetimetimezone-manipulation-and-conversion-in-java-a-few-examples/feed/</wfw:commentRss>
		</item>
		<item>
		<title>5 common image manipulation tricks using ImageMagick</title>
		<link>http://www.devrecipes.com/2009/11/15/5-common-image-manipulation-tricks-using-imagemagick/</link>
		<comments>http://www.devrecipes.com/2009/11/15/5-common-image-manipulation-tricks-using-imagemagick/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 03:46:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ImageMagick]]></category>

		<category><![CDATA[Shell Scripting]]></category>

		<category><![CDATA[Add new tag]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=183</guid>
		<description><![CDATA[Webmasters/Webdesigners often need to do repetitive image manipulation tasks like resizing for thumbnails, image borders etc. Even though a plethora of image manipulation software are available, nothing beats ImageMagick when you need to perform simple tasks, especially since it lends itself well to automation using shell scripts. We outline here 5 common image manipulation techniques with ImageMagick. ]]></description>
			<content:encoded><![CDATA[<p>Webmasters/Webdesigners often need to do repetitive image manipulation tasks like resizing for thumbnails, image borders etc. Even though a plethora of image manipulation software are available, nothing beats ImageMagick when you need to perform simple tasks, especially since it lends itself well to automation using shell scripts. We outline here 5 common image manipulation techniques with ImageMagick. The scripts have been tested with ImageMagick <b>version 6.4.5.4</b>.</p>
<ul>
<li>
<b>Create thumbnails (i.e resize images):</b><br />
 The following resizes a picture (given by picturename) to a 62&#215;47 image called picturename_thumb.</p>
<blockquote><p>
  convert pitcurename -resize 62&#215;47! picturename_thumb;
 </p></blockquote>
<p>Note the &#8220;!&#8221; after the 47.  By default, ImageMagick maintains the aspect ratio while resizing, so if you omit the !, the height may not be 47px. Adding the ! forces the height to that specified.<br />
You can automate the above to resize a bunch of images using a shell script. For example, the following script will resize all .jpg images in the current directory, append a _thumb to the resized images and put them in a directory called thumbs.</p>
<blockquote><p>
 for photos in `ls *.jpg`;<br />
  do base=`basename $photos .jpg`;<br />
  convert $photos -resize 62&#215;47! thumbs/&#8221;$base&#8221;_thumb.gif;<br />
done
</p></blockquote>
<p>Note: For the above script to work your OS must support basename.<b> You can use the above script as a template for automating the other ImageMagick tricks described here.</b>
</li>
<li>
<b>Add a border to an image</b><br />
Add a 2 pixel border (with color #00FF7F) to photo.jpg and call it framed.jpg</p>
<blockquote><p>
convert photo.jpg -bordercolor &#8216;#00FF7F&#8217; -border 2 framed.jpg
</p></blockquote>
</li>
<li>
<b>Convert an image to black &#038; white</b></p>
<blockquote><p>
  convert -type Grayscale main2.jpg main2_bw.jpg
</p></blockquote>
</li>
<li>
 <b>Add a label in the image</b><br />
The following will add the label &#8216;Copyright © John Doe&#8217; at the bottom of the image </p>
<blockquote><p>
 convert myimage.jpg -gravity south -fill white -annotate 0 &#8216;Copyright: © John Doe&#8217; myimage_labeled.jpg
</p></blockquote>
<p>Use the gravity attribute to specify the position of the label. Besides the four obvious directions you can also specify SouthEast, NorthEast etc.<br />
Note: To add the © symbol from the command line terminal, press down ALT key and type 0169 on the NUM keypad.
</li>
<li>
<b>Add a drop shadow</b></p>
<blockquote><p>
convert picture.jpg \( +clone -background black -shadow 80&#215;3+5+5 \) +swap -background white -layers merge +repage shadow.jpg
</p></blockquote>
<p>Vary the numbers(80&#215;3+5+5) to change the shadow weight, direction etc.
</li>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/DBcs018EuMc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/11/15/5-common-image-manipulation-tricks-using-imagemagick/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pass values from a pop up (modal window) to parent page</title>
		<link>http://www.devrecipes.com/2009/11/01/pass-values-from-a-pop-up-modal-window-to-parent-page/</link>
		<comments>http://www.devrecipes.com/2009/11/01/pass-values-from-a-pop-up-modal-window-to-parent-page/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 02:34:38 +0000</pubDate>
		<dc:creator>RonJon</dc:creator>
		
		<category><![CDATA[Web UI Programming]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=179</guid>
		<description><![CDATA[Like it or not pop ups are there to stay and often values need to be passed from the pop up to the parent window. Although modal window based popups are currently less popular and being replaced by (slicker?) div based 'pseudo' popups, its still worthwhile to know how to pass values from a popup to its parent window.]]></description>
			<content:encoded><![CDATA[<p>Like it or not pop ups are there to stay and often values need to be passed from the pop up to the parent window. Although modal window based popups are currently less popular and being replaced by (slicker?) div based &#8216;pseudo&#8217; popups, its still worthwhile to know how to pass values from a popup to its parent window.</p>
<ul>
<li>
<b>In the parent window: </b>Explanations are inline</p>
<pre class="brush: html;">
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 function showPopup(){
   //opens the pop up from where values will passed to this page
     window.showModalDialog('popup.html',window,'center:yes');
  }

function setTheVal(valFromPopup){
  //this function will be called from the popup and the value passed in (valFromPopup).
  //Value of someElement in someForm in this page will be set to valFromPopup.
  document.aForm.aField.value=valFromPopup;
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name='aForm' method='post'&gt;
&lt;input type='text' name='aField' /&gt;
&lt;a href='javascript:showPopup()'&gt;Show popup&lt;/a&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<li>
<b>In the popup:</b> Use the dialogArguments property as follows</p>
<pre class="brush: html; highlight: [5,6];">
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 function submitVal(val){
     var myObj=window.dialogArguments;
      myObj.setTheVal(val); //calls the js method in the main page.
      window.close();
 }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;input type='button' onclick='submitVal(&quot;value from popup&quot;)' value='Put value in parent screen' /&gt;

&lt;/body&gt;

&lt;/html&gt;
</pre>
</li>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/zYzEokspgT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/11/01/pass-values-from-a-pop-up-modal-window-to-parent-page/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JSTL and Struts logic tags iteration quick reference</title>
		<link>http://www.devrecipes.com/2009/10/19/jstl-and-struts-logic-tags-iteration-quick-reference/</link>
		<comments>http://www.devrecipes.com/2009/10/19/jstl-and-struts-logic-tags-iteration-quick-reference/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 00:07:32 +0000</pubDate>
		<dc:creator>RonJon</dc:creator>
		
		<category><![CDATA[Java/J2EE]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=145</guid>
		<description><![CDATA[Iterating through collections in jsp using JSTL and Struts tags can be confusing, especially since the attributes can be a little hard to figure out. Here's a ready reference of some iteration examples that may help.]]></description>
			<content:encoded><![CDATA[<p>Iterating through collections in jsp using JSTL and Struts tags can be confusing, especially since the attributes can be a little hard to figure out. Here&#8217;s a ready reference of some iteration examples that may help.</p>
<div class="related">
<h4>Related Posts</h4>
<p> <a href="http://www.devrecipes.com/2010/02/14/datetimetimezone-manipulation-and-conversion-in-java-a-few-examples/">Java Date/Time/Timezone manipulation and conversion</a><br />
  <a href="http://www.devrecipes.com/2009/08/14/environment-specific-configuration-for-java-applications/">Environment Specific configuration for Java applications</a><br />
<a href="http://www.devrecipes.com/2009/07/19/get-system-information-using-java/">Get System Information using Java</a>
</div>
<p>For our examples here let us assume that ClassA and ClassB are associated in the following way, and that these two classes have the getters and setters defined for the properties shown here.</p>
<p><img src="http://www.devrecipes.com/wp-content/uploads/2009/10/iterationwithtags.jpeg" alt=" JSTL and Struts logic tags iteration quick reference" title="iterationwithtags" width="531" height="108" class="alignnone size-full wp-image-176" /></p>
<h3>1. Code examples of looping using JSTL</h3>
<ul>
<li>Loop through a List of objects and access (print) a property of every object contained at an even index:
<pre class="brush: xml; light: true;">
&lt;jsp:useBean id=&quot;beanA&quot; class=&quot;ClassA&quot; scope=&quot;request&quot;/&gt;
&lt;c:forEach items=&quot;${beanA.listA2}&quot; var=&quot;eachItem&quot; varStatus=&quot;status&quot; &gt;
    &lt;c:if test='${(status.index)%2 == &quot;0&quot;}' &gt;
     &lt;c:out value=&quot;${eachItem.aProperty}&quot; /&gt;
   &lt;/c:if&gt;
&lt;/c:forEach&gt;
</pre>
</li>
<li>
  Same as the above but using the <b>step</b> attribute instead of the if condition:</p>
<pre class="brush: xml; light: true;">
  &lt;c:forEach items=&quot;${beanA.listA2}&quot; step=&quot;2&quot; var=&quot;eachItem&quot; varStatus=&quot;status&quot; &gt;
   &lt;c:out value=&quot;${eachItem.aProperty}&quot; /&gt;
  &lt;/c:forEach&gt;
</pre>
</li>
<li>
   Loop through a map and print key and value:</p>
<pre class="brush: xml; light: true;">
&lt;jsp:useBean id=&quot;beanA&quot; class=&quot;ClassA&quot; scope=&quot;request&quot;/&gt;
  &lt;c:forEach items=&quot;${beanA.mapA1}&quot; var=&quot;eachItem&quot;&gt;
    &lt;c:out value=&quot;${eachItem.key}&quot; /&gt;:&lt;c:out value=&quot;${eachItem.value}&quot; /&gt;
&lt;/c:forEach&gt;
</pre>
</li>
<li>Loop through a HashMap containing objects (as value) and access a simple property contained in each object:
<pre class="brush: xml; light: true;">
&lt;jsp:useBean id=&quot;beanA&quot; class=&quot;ClassA&quot; scope=&quot;request&quot;/&gt;
&lt;c:forEach items=&quot;${beanA.mapA2}&quot; var=&quot;eachItem&quot;&gt;
    &lt;c:out value=&quot;${eachItem.value.aProperty}&quot; /&gt;;
&lt;/c:forEach&gt;
</pre>
</li>
<li> Nested Loops: Loop through a hashmap of objects and for each of these objects loop through a HashMap property of the object.
<pre class="brush: xml; light: true;">
&lt;jsp:useBean id=&quot;beanA&quot; class=&quot;ClassA&quot; scope=&quot;request&quot;/&gt;
&lt;c:forEach items=&quot;${beanA.mapA2}&quot; var=&quot;eachItem&quot;&gt;
  &lt;c:set var=&quot;bObj&quot; value=&quot;${eachItem.value}&quot; /&gt;
  &lt;c:forEach items=&quot;${eachItem.value.mapB1}&quot; var=&quot;anItem&quot;&gt;
     &lt;c:out value=&quot;${anItem.key}&quot; /&gt; : &lt;c:out value=&quot;${anItem.value}&quot; /&gt;
  &lt;/c:forEach&gt;
 &lt;/c:forEach&gt;
</pre>
</li>
</ul>
<h3>2. Code Examples of looping using Struts Iterate tag</h3>
<p>We assume here ClassA is the form bean (or is in page scope).</p>
<ul>
<li> Loop through a list:
<pre class="brush: xml; light: true;">
&lt;logic:iterate  id=&quot;eachItem&quot; name=&quot;ClassA&quot; property=&quot;listA1&quot;&gt;
  &lt;bean:write name=&quot;eachItem&quot;/&gt;
&lt;/logic:iterate&gt;
</pre>
</li>
<li>Loop through a list and print a property contained in each item in the list
<pre class="brush: xml; light: true;">
&lt;logic:iterate id=&quot;eachItem&quot; name=&quot;ClassA&quot; property=&quot;listA2&quot; &gt;
  &lt;bean:write name=&quot;eachItem&quot; property=&quot;aProperty&quot;/&gt;
&lt;/logic:iterate&gt;
</pre>
</li>
<li>
  Loop through a hashmap and display key value pairs:</p>
<pre class="brush: xml; light: true;">
&lt;logic:iterate id=&quot;eachItem&quot; name=&quot;ClassA&quot; property=&quot;mapA1&quot;&gt;
  key:&lt;bean:write name=&quot;eachItem&quot; property=&quot;key&quot;/&gt;
  value:&lt;bean:write name=&quot;eachItem&quot; property=&quot;value&quot;/&gt;
&lt;/logic:iterate&gt;
</pre>
</li>
<li>Loop through a HashMap containing objects (as value) and access a simple property contained in each object.
<pre class="brush: xml; light: true;">
 &lt;logic:iterate id=&quot;eachItem&quot; name=&quot;ClassA&quot; property=&quot;mapA2&quot;&gt;
  &lt;bean:define id=&quot;bObj&quot; name=&quot;eachItem&quot; property=&quot;value&quot; /&gt;
  &lt;bean:define id=&quot;akey&quot; name=&quot;eachItem&quot; property=&quot;key&quot; /&gt;
  aProperty for object at key &lt;bean:write name=&quot;akey&quot; /&gt; is &lt;bean:write name=&quot;bObj&quot; property=&quot;aProperty&quot;/&gt;
&lt;/logic:iterate&gt;
</pre>
</li>
<li>Nested loop: Looping though a HashMap contained in a HashMap:
<pre class="brush: xml; light: true;">
 &lt;logic:iterate id=&quot;eachItem&quot; name=&quot;ClassA&quot; property=&quot;mapA2&quot;&gt;
  &lt;bean:define id=&quot;eachBObj&quot; name=&quot;eachItem&quot; property=&quot;value&quot; /&gt;
  &lt;logic:iterate name=&quot;eachBObj&quot; id=&quot;eachMapB1Entry&quot; property=&quot;mapB1&quot;&gt;
   &lt;bean:write name=&quot;eachMapB1Entry&quot; property=&quot;key&quot;/&gt;:&lt;bean:write name=&quot;eachMapB1objInB&quot; property=&quot;value&quot;/&gt;
  &lt;/logic:iterate&gt;
 &lt;/logic:iterate&gt;
</pre>
</li>
<li>
Loop demonstrating how to access indexes using indexId:</p>
<pre class="brush: xml; light: true;">
&lt;logic:iterate id=&quot;eachItem&quot; indexId=&quot;index&quot; name=&quot;ClassA&quot; property=&quot;listA2&quot;&gt;
     &lt;c:if test=&quot;${index % 2 == 0}&quot;&gt;
     &lt;bean:write name=&quot;eachItem&quot; property=&quot;aProperty&quot;/&gt;
    &lt;/c:if&gt;
 &lt;/logic:iterate&gt;
</pre>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/YxirEfxvXyk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/10/19/jstl-and-struts-logic-tags-iteration-quick-reference/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JSTL Error: Unable to find a value for property in object of class using operator “.”</title>
		<link>http://www.devrecipes.com/2009/09/30/jstl-errorunable-to-find-a-value-for-property-in-object-of-class-using-operator/</link>
		<comments>http://www.devrecipes.com/2009/09/30/jstl-errorunable-to-find-a-value-for-property-in-object-of-class-using-operator/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 01:42:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Errors]]></category>

		<category><![CDATA[Java Errors]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=137</guid>
		<description><![CDATA[<b>Problem:</b> You get this error while trying to access a property of an object in JSTL but you are absolutely sure that the property is present in the Class.
<b>Solution:</b> It is likely that the culprit is your getter method for the property or the way you are trying to access it in JSTL . 
]]></description>
			<content:encoded><![CDATA[<p><b>Problem:</b> You get this error while trying to access a property of an object in JSTL but you are absolutely sure that the property is present in the Class.</p>
<div class="related">
Related Posts:<br />
<a href="http://www.devrecipes.com/2009/08/09/eclipse-error-project-jetemitters-is-missing-required-library">Eclipse error: Project .jetemitters is missing required library</a><br />
<a href="http://www.devrecipes.com/2009/08/27/eclipse-error-javautilenumeration-cannot-be-resolved/">Eclipse error: java.util.Enumeration cannot be resolved.</a>
</div>
<p><b>Solution:</b> It is likely that the culprit is your getter method for the property or the way you are trying to access it in JSTL . This usually occurs if your property name or your getter method has more than one consecutive letter in caps.<br />
Say your bean is BeanA with a property called usProperty. If your getter method is getUSProperty() and in the JSTL you have something like ${beanA.usProperty}, then this will fail. Either set the getter to something like getUsProperty() OR change the JSTL to read: ${classA.USProperty}</p>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/9JnuuCCUr4g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/09/30/jstl-errorunable-to-find-a-value-for-property-in-object-of-class-using-operator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shell script to remove spaces in file names</title>
		<link>http://www.devrecipes.com/2009/09/23/shell-script-to-remove-spaces-in-file-names/</link>
		<comments>http://www.devrecipes.com/2009/09/23/shell-script-to-remove-spaces-in-file-names/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 03:12:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Shell Scripting]]></category>

		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=131</guid>
		<description><![CDATA[Ever ftp'd Windows files into a unix box and then found that some of your scripts break because the file names have spaces in them? Here are couple of one liners that will help fix this by removing one or more spaces in the file names.
]]></description>
			<content:encoded><![CDATA[<p>Ever ftp&#8217;d Windows files into a unix box and then found that some of your scripts break because the file names have spaces in them?</p>
<div class="related">
<h4>Related Posts</h4>
<p> <a href="http://www.devrecipes.com/2009/09/15/connect-to-oracle-database-and-run-sql-from-a-shell-script/">Run oracle sql scripts from shell scripts</a><br />
 <a href="http://www.devrecipes.com/2009/04/23/execute-a-perl-script-from-a-vbscript/">Execute a Perl script from a vbscript</a>
</div>
<p>Here are couple of one liners that will help fix this by removing one or more spaces in the file names.</p>
<p>In  bash shell:</p>
<blockquote><p>
#replace spaces with underscores in the file names<br />
 for file in *\ *; do  mv &#8220;$file&#8221; &#8220;${file// /_}&#8221;; done<br />
#remove all spaces in the file names<br />
for file in *\ *; do  mv &#8220;$file&#8221; &#8220;${file// /}&#8221;; done
</p></blockquote>
<p>The following will work in both k-shell and bash shell:</p>
<blockquote><p>
#replace spaces with underscores in the file names<br />
for file in *\ *; do target=&#8221;$(echo $file | sed -e &#8217;s/ /_/g&#8217;)&#8221;; mv &#8220;$file&#8221; &#8220;$target&#8221;;done;</p>
<p>#remove all spaces in the file names<br />
for file in *\ *; do target=&#8221;$(echo $file | sed -e &#8217;s/ //g&#8217;)&#8221;; mv &#8220;$file&#8221; &#8220;$target&#8221;;done;</p>
</blockquote>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/BjzYDkE6rEA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/09/23/shell-script-to-remove-spaces-in-file-names/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Connect to Oracle database and run SQL from a shell script</title>
		<link>http://www.devrecipes.com/2009/09/15/connect-to-oracle-database-and-run-sql-from-a-shell-script/</link>
		<comments>http://www.devrecipes.com/2009/09/15/connect-to-oracle-database-and-run-sql-from-a-shell-script/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 05:01:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Shell Scripting]]></category>

		<category><![CDATA[Unix]]></category>

		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=128</guid>
		<description><![CDATA[Although it is not usual (or preferred) to use a shell script to execute sql queries in Oracle, this recipe discusses how this can be done for those rare cases when you need to.]]></description>
			<content:encoded><![CDATA[<p>You will need to use sqlplus to connect to Oracle from a shell script. First its a good idea to set the</p>
<div class="related">
<h4>Related Posts</h4>
<p>   <a href="http://www.devrecipes.com/2009/09/23/shell-script-to-remove-spaces-in-file-names/">Shell script to remove spaces in filenames</a><br />
   <a href="http://www.devrecipes.com/2009/04/23/execute-a-perl-script-from-a-vbscript/">Run a perl script from a vb script</a>
 </div>
<p> Oracle environment variables; if not all then set at least the last two of the following: </p>
<blockquote><p>
export ORACLE_BASE=/path/to/oracle<br />
export ORACLE_HOME=$ORACLE_BASE/product/11g<br />
export ORACLE_TERM=xsun<br />
export NLS_LANG=American_America.US7ASCII<br />
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH<br />
export ORACLE_PATH=$ORACLE_HOME/bin<br />
export PATH=$ORACLE_HOME/bin:$PATH
</p></blockquote>
<p><b>To connect using ORACLE_SID</b>, set the oracle SID and run sqlplus in the following manner</p>
<blockquote><p>
export ORACLE_SID=your_oracle_sid<br />
sqlplus -s LOGIN/PASSWD
</p></blockquote>
<p>The -s option suppresses the login banner etc.</p>
<p>However, <b>if you have a Service Name instead </b>and your oracle instance runs off of a different port than the default, then use the following format for connecting.</p>
<blockquote><p>
sqlplus -s LOGIN/PASSSWD@ORACLE_SERVERNAME:ORACLE_PORT/SERVICE_NAME
</p></blockquote>
<p><b>So how do we run sql queries?</b> Check out the following script from lines 10 to 16. The output from the queries is redirected to a file (sqloutput in our case). The pagesize is set to 0 in order to facilitate easier parsing of the output file as this will suppress multiple column headings.</p>
<pre class="brush: text; highlight: [10,11,12,13,14,15,16];">
#!/usr/bin/ksh
export ORACLE_BASE=/path/to/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11g
export ORACLE_TERM=xsun
export NLS_LANG=American_America.US7ASCII
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_PATH=$ORACLE_HOME/bin
export PATH=$ORACLE_HOME/bin:$PATH

sqlplus -s LOGIN/PASSSWD@SERVERNAME:ORA_PORT/SERVICE_NAME &lt;&lt; EOF &gt; sqloutput
set pagesize 0;
select * from blah;
update blah;
commit;
exit;
EOF
</pre>
<p><b>CAVEAT:</b> Your oracle login credentials will be exposed in plain text. It is therefore preferable to read it in from a file stored securely.</p>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/8uwsA6sXvBA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/09/15/connect-to-oracle-database-and-run-sql-from-a-shell-script/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mediawiki configuration: a quickstart tutorial</title>
		<link>http://www.devrecipes.com/2009/09/07/mediawiki-configuration-a-quickstart-tutorial/</link>
		<comments>http://www.devrecipes.com/2009/09/07/mediawiki-configuration-a-quickstart-tutorial/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 03:39:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Mediawiki]]></category>

		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=120</guid>
		<description><![CDATA[This tutorial is a cheatsheet of post install customization of Mediawiki, covers user permissions configuration, look &#038; feel customization and some basic editing configuration. Hopefully this will be of some help to other newbie Mediawiki admins like myself.]]></description>
			<content:encoded><![CDATA[<p>If you have installed Mediawiki but still trying to find your way around on how to customize it for your needs, this cheat sheet describes some of the basic configuration aimed at giving you a head start. The configurations have been tested with Mediawiki 1.15.1.<br />
In the descriptions below, all changes to variables (e.g $wgGroupPermissions etc) are made in <b>LocalSettings.php</b> in the Mediawiki install directory.</p>
<h3>Basic user permissions configuration</h3>
<p> All users, including anonymous users, are in the &#8216;*&#8217; group; all registered users are in the &#8216;user&#8217; group.</p>
<ul>
<li> <b>Prevent anonymous edits (i.e edits by unregistered users):</b><br />
<blockquote><p>$wgGroupPermissions['*']['edit']=false;
</p></blockquote>
<p>NOTE: To disallow anonymous users from viewing any pages, change the &#8216;edit&#8217; to &#8216;read&#8217; above</li>
<li> <b>Block anonymous users from viewing some pages:</b> The following prevents users from viewing all pages except the Main Page the Userlogin special page and a page called Test Page.<br />
<blockquote><p>$wgGroupPermissions['*']['read']=false;<br />
$wgWhitelistRead=array (&#8221;Main Page&#8221;,&#8221;Special:Userlogin&#8221;,&#8221;Test Page&#8221;);</p></blockquote>
</li>
<li> <b>Add users to a custom group</b>:
<ol>
<li> The following will create a group called &#8216;editors&#8217; as well as give it &#8216;edit&#8217; permissions:<br />
<blockquote><p>
  $wgGroupPermissions['editors']['edit']=true;
</p></blockquote>
</li>
<li>
  Then go to  the User Rights special page (http://your_wiki_url/index.php/Special:UserRights), Enter the username of the user to add to the group and click on Edit User Groups button. You should now be able to add users to the editors group by selecting the appropriate checkbox. See below:<br />
<img src="http://www.devrecipes.com/wp-content/uploads/2009/09/mediawikiuserrights.jpg" alt="mediawikiuserrights Mediawiki configuration: a quickstart tutorial " title="mediawikiuserrights" width="580" height="361" class="alignnone size-full wp-image-122" />
</li>
</ol>
</li>
<li>
   <b>Allow only some users to edit:</b></p>
<ol>
<li>
 First create a new group  and add users to it as described above.
</li>
<li>
 Then revoke edit permissions to anonymous users, the &#8216;user&#8217; group and grant it to the new group -&#8217;editors&#8217; in our case- and (optionally) to the sysop group.</p>
<blockquote><p>
$wgGroupPermissions['*']['edit']=false;<br />
$wgGroupPermissions['user']['edit']=false;<br />
$wgGroupPermissions['editors']['edit']=true;<br />
$wgGroupPermissions['sysop']['edit']=true;</p>
</blockquote>
</li>
</ol>
</li>
<li>
<b>Disallow editing of particular pages to all except administrator: </b> Log in as admin, go to your target page(s) and use the protect page option at the top the page.
</li>
<li>
 <b>Change password</b>: Go to the maintenance directory and run: <i> php changePassword.php &#8211;user=someuser &#8211;password=somepass</i> or use the email password option from the user login page.
</li>
<li>
<b>Show list of users:</b> Go to http://your_wiki_url/index.php/Special:ListUsers
</li>
</ul>
<h3>Editing</h3>
<ul>
<li>
<b>Uploading images:</b></p>
<ol>
<li>
 Enable image uploads: Go to LocalSettings.php and add the following line:</p>
<blockquote><p>
  $wgEnableUploads=true;
</p></blockquote>
</li>
<li>
 Change permissions in the images directory: Change the permissions in the images directory so that it is writable by the webserver i.e. in Unix do the following:</p>
<blockquote><p>
  %> chgrp -R apache $MEDIAWIKI_HOME/images<br />
  %> chmod 765 $MEDIAWIKI_HOME/images
</p></blockquote>
<p>NOTE: If you are using the default Ubuntu webserver change &#8216;apache&#8217; to &#8216;www-data&#8217; in the above.
</li>
<li>
 Use the upload file link on the left menu (under toolbox) and upload the file.
</li>
</ol>
</li>
<li>
<b> Embedding images:</b>To embed images in your posts use any of the following</p>
<ol>
<li>
  For a basic image: <em>[[Image:Example.jpg]]</em>
</li>
<li>
  For a thumbnail: <em>[[Image:Example.jpg| thumb]]</em>
</li>
<li>
  For a thumbnail with description: <em>[[Image:Example.jpg|thumb| Example description]]</em>
       </li>
<li>
  To create a gallery:</p>
<blockquote><p>
 &lt;gallery widths=&#8221;100px&#8221; heights=&#8221;100px&#8221; &gt;<br />
  Image:a.gif<br />
  Image:b.gif|a caption<br />
  Image:c.gif<br />
 &lt;/gallery&gt;
</p></blockquote>
</li>
</ol>
<p>NOTE: When text flows around an image but you&#8217;d like it to stop flowing and restart after the bottom of the image, use the following </p>
<blockquote><p>
  &lt;br style=&#8221;clear:both&#8221; /&gt;
</p></blockquote>
</li>
<li>
  <b>Change existing or add a new side menu:</b> Go to http://your_wiki_url/index.php/MediaWiki:Sidebar and edit. The format is:</p>
<blockquote><p>
 *menu header<br />
 **pagename|link text
</p></blockquote>
</li>
<li>
 <b>Add a sitewide notice:</b> set $wgSiteNotice to the notice you want to display.
</li>
<li>
<b>Table of contents:</b> A table of contents is added on top of the page whenever there are more than three headers in the article in the page. You can override this default behavior in the following ways:</p>
<ol>
<li>
 <b>Do not add table of contents:</b> In the page edit mode enter _NOTOC_ anywhere in the page
</li>
<li>
 <b>Place table of contents at a different location:</b> In page edit mode, enter _TOC_ at the location in the page you want it.
</li>
<li>
 <b>Force add table of contents</b> for pages that have fewer than four headers: In page edit mode, enter _FORCETOC_
</li>
</ol>
</li>
</ul>
<h3>Look and feel configuration</h3>
<ul>
<li>
 <b>Change default skin</b> (to cologne blue):</p>
<blockquote><p>
   $wgDefaultSkin=&#8217;cologneblue&#8217;
</p></blockquote>
</li>
<li>
 <b>Disallow users from changing their own skins: </b>users can change their skins by going to preferences->skin tab. If for some reason you don&#8217;t want users to have this feature, set the following:</p>
<blockquote><p>
 $wgAllowUserSkin = false
</p></blockquote>
</li>
<li>
 <b>Adding custom styles:</b> </p>
<ol>
<li>
The easiest way to add your own look &#038; feel is to choose the skin that conforms to the layout you want and then style the elements of your skin.
</li>
<li>
To add your custom styles to your skin, edit the css page of your skin. <b>However, the Mediawiki docs do not recommend directly editing the css files in the skins folders. Edits should be done through the wiki.</b> For example, if you are using the default Monobook skin, use the page: http://your_wiki_url/index.php/MediaWiki:Monobook.css to add your styles. To add styles that are common across all skins, use the page http://your_wiki_url/index.php/MediaWiki:Common.css.<br />
For example adding the following css to MediaWiki:Monobook.css :</p>
<pre class="brush: css;">
/* CSS placed here will affect users of the Monobook skin */

/* the main area that contains the text */
#content {
       background: #F8F2E5;
       color: black;
       border: 1px solid #1B619B;
       line-height: 1.5em;
       width:80%;
}
/* the background of the area outside the main content area */
body {
  background: #D3E0EA;
}
/*stuff that's outside of the main content  area i.e left navigation bar, tabs etc */
.portlet {
   background:#1B619B;
}
/* body of the portlet class */
.pBody{
    background: #ACCBE0;
}
/* tabs on the top */
#p-cactions li a{
  background:#ACCBE0;
}
/*selected tab on the top */
#p-cactions li.selected a {
  background: #F8F2E5;
}
/*The logo style */
#p-logo, #p-logo a, p-logo a:hover{

}
</pre>
<p>results in something similar to the following:<br />
<img src="http://www.devrecipes.com/wp-content/uploads/2009/09/mediawikicustomstyle.jpg" alt="mediawikicustomstyle Mediawiki configuration: a quickstart tutorial " title="mediawikicustomstyle" width="500" height="163" class="alignnone size-full wp-image-121" /><br />
A caveat here: Adding your own styles is not very straight forward. For more complex styles, you may have to befriend a tool like <a href="http://getfirebug.com/">firebug</a>.
</li>
</ol>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/VH94pYcHUbU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/09/07/mediawiki-configuration-a-quickstart-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse error: java.util.Enumeration cannot be resolved</title>
		<link>http://www.devrecipes.com/2009/08/27/eclipse-error-javautilenumeration-cannot-be-resolved/</link>
		<comments>http://www.devrecipes.com/2009/08/27/eclipse-error-javautilenumeration-cannot-be-resolved/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 03:47:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Eclipse Errors]]></category>

		<category><![CDATA[Errors]]></category>

		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.devrecipes.com/?p=115</guid>
		<description><![CDATA[Problem: you get an error during build saying &#8220;Build error java.util.Enumeration cannot be resolved&#8221; even though you have the correct import statement.
Solution:  Set the compiler compliance level to 1.4 (window->preferences->Java->compiler) and rebuild.

]]></description>
			<content:encoded><![CDATA[<p><b>Problem:</b> you get an error during build saying &#8220;Build error java.util.Enumeration cannot be resolved&#8221; even though you have the correct import statement.<br />
<b>Solution:</b>  Set the compiler compliance level to 1.4 (window->preferences->Java->compiler) and rebuild.<br />
<img src="http://www.devrecipes.com/wp-content/uploads/2009/08/compilercompliance1.jpg" alt="compilercompliance1 Eclipse error: java.util.Enumeration cannot be resolved" title="compilercompliance1" width="500" height="482" class="alignnone size-full wp-image-116" /></p>
<img src="http://feeds.feedburner.com/~r/Devrecipes/~4/rZ9jeIj4rAw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.devrecipes.com/2009/08/27/eclipse-error-javautilenumeration-cannot-be-resolved/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
