tag:blogger.com,1999:blog-21277942450109161722024-03-06T07:37:51.445+02:00UdeviThis is the blog of the founder of the Udevi community. Here we'll talk about how to develop a big piece of software or a really small project, we'll have discussions with some great technologists in different domains: Java, .NET, Scala, and others as well. Follow the podcasts and the entries on the blog to find out some more stuff.Unknownnoreply@blogger.comBlogger49125tag:blogger.com,1999:blog-2127794245010916172.post-59525456379183320322016-11-30T18:53:00.003+02:002016-11-30T18:53:38.081+02:00Refunds policy<div dir="ltr" style="text-align: left;" trbidi="on">
No Refunds
REFUNDS WILL NOT BE PROVIDED FOR ANY SERVICE. WE DO NOT PROVIDE CREDIT, REFUNDS, OR PRORATED BILLING FOR SERVICES THAT ARE CANCELLED MID-MONTH. In such a circumstance, you will continue to have access to your Service until the end of the monthly billing cycle. Please note that each circumstance is unique and election to make such an offer in one instance does not create the obligation to do so in another.
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-23936177554424100082012-11-12T00:38:00.001+02:002012-11-12T00:38:19.660+02:00Tools #3: Ditto clipboard manager, the ultimate tool in your pocket<style type="text/css">
kbd {
padding:0.1em 0.6em;
border:1px solid #ccc;
font-size:11px;
font-family:arial,helvetica,sans-serif;
background-color:#f7f7f7;
color:#333;
-moz-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-webkit-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
display:inline-block;
margin:0 0.1em;
text-shadow:0 1px 0 #fff;
line-height:1.4;
white-space:nowrap;
}</style> <p>Whether you admit it or not, it doesn’t change the fact that the most frequent operation on our PC is in a way or another copy/paste. I copy and paste all the time: code snippets, files, links, you name it.</p> <p>The problem with copy pasting is that it is one way ticket, you can’t go back and browse all your copy and paste history, search through it and find everything you copied or pasted.</p> <p><a href="http://ditto-cp.sourceforge.net/" target="_blank">Ditto</a> is the tool that solves all your problem and it does that in such a way that you don’t even observe that it exists on your laptop or other devices. In short, <a href="http://ditto-cp.sourceforge.net/" target="_blank">Ditto</a> is a clipboard manager that is managing all your copies and pastes, the number of occurrences it keeps in the SQLite database is configurable. I always have there a 1000. It is relatively good handled by the DB when you do searches, and it is a big enough number for keeping your most important recent copies and pastes.</p> <p><a href="http://lh5.ggpht.com/-2nw5yYlZCqE/UKAozOPoEPI/AAAAAAAAA0s/Sd_ngubObDE/s1600-h/ditto_1%25255B5%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="ditto_1" border="0" alt="ditto_1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCn-am5EQCyU_P3TwI3mCn4Q7qnS6KzvCjn7AKRrFAwX5yDdh-EqjbNTX2ZWKyQebhR-Odx1FoBSOg9eUk1XwZCVFrYJirojO8-lfYJW_5_DnLD7M5hC3eEtRKb_8c-O-n6CYeHedhJQo/?imgmax=800" width="347" height="251" /></a></p> <p>I also like that it contains files and even tables from Excel or Word, that is pretty cool.</p> <p><a href="http://lh5.ggpht.com/-7qhBdY0wlA8/UKAo1XtjEWI/AAAAAAAAA08/MR_znXwe9pA/s1600-h/2012-11-12_0005%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-11-12_0005" border="0" alt="2012-11-12_0005" src="http://lh3.ggpht.com/-MBSrqt8rJ_0/UKAo2TmBy7I/AAAAAAAAA1E/CKm5nxm1G-g/2012-11-12_0005_thumb%25255B2%25255D.png?imgmax=800" width="347" height="289" /></a></p> <p>You call that by pressing <kbd>Ctrl</kbd> + <kbd>~</kbd></p> <p>This way when you want to copy and paste multiple snippets of code, you don’t need to switch between the editors, just copy, copy, copy and than paste, paste, paste, and when you are not sure what you should paste use the search feature.</p> <p>P.S. There are some problems in Windows 8 interactions with Ditto, in short there were made fixes in <a href="http://ditto-cp.sourceforge.net/beta/" target="_blank">beta branch</a> and there is a download for windows 8, here you can find the corresponding thread: <a title="http://sourceforge.net/p/ditto-cp/discussion/287511/thread/2d4c8635?page=1" href="http://sourceforge.net/p/ditto-cp/discussion/287511/thread/2d4c8635?page=1">http://sourceforge.net/p/ditto-cp/discussion/287511/thread/2d4c8635</a></p> <p>Thank you, and I hope you all will have this great tool in your belt, and it will save you a lot of time.</p> Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2127794245010916172.post-37819002200431433832012-10-05T00:37:00.001+03:002012-10-10T00:50:31.000+03:00What is cron and how to configure it with Drupal (secure) on a shared hosting<p>I can’t name myself a heavy Linux user developer, I don’t know by heart hundreds of commands, but recently I had to setup a hosting for <a href="http://nbphpcouncil.org" target="_blank">NetBeans PHP Community Council</a>. You can read my post about it at <a href="https://blogs.oracle.com/netbeansphp/entry/netbeans_php_community_council" target="_blank">NetBeans PHP team blog</a>. And I needed to setup cron to make my notifications in Drupal works.</p> <p>So what is cron? Shortly cron is a time based job scheduler that allows you to run certain bash scripts in a certain frequency. What could we do with it? Well, a lot, think of email sending or verifying a certain flag in a web service, cleansing the database, you name it. </p> <h6>explaining cron configuration: CRONTAB</h6> <p>So cron has a configuration file: crontab, it describes the frequency at which the job runs and also the script that describes what will actually be done.</p> <p>If you are in command line you can access crontab by typing </p> <pre class="brush: php;">crontab -e</pre>
<p>this will open the configuration file in your default Unix editor, usually vi.</p>
<h6>FREQUENCY DESCRIPTION</h6>
<p>Ok so how we describe frequency, there are 5 stars, which by default are placeholders. A star means ‘every’</p>
<p><font size="6"><font color="#ff0000">*</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">* </font></font></p>
<p>Ok so what all these start mean</p>
<p><font color="#ff0000" size="4">* </font> <font size="4">- minutes (from 0 to 59)</font></p>
<p><font size="4"><font color="#9b00d3">* </font></font>– <font size="4">hours (from 0 to 23)</font></p>
<p><font size="4"><font color="#00ff00">* </font>– days of month (from 1 to 31)</font></p>
<p><font size="4"><font color="#f3a447">*</font> – month (from 1 to 12)</font></p>
<p><font size="4"><font color="#c0504d">* </font>– day of week (0 to 6)</font></p>
<p>So the previous example means </p>
<p><font size="3"><font color="#ff0000">*</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">*  </font></font>- every minute</p>
<p><font size="3"><font color="#ff0000">*</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">0 – </font></font>every Sunday</p>
<p><font size="3"><font color="#ff0000">*/5</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">* – </font></font>every 5 minutes</p>
<p><font size="3"><font color="#ff0000">45</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">* – </font></font>every hour on 45th minute</p>
<p><font size="3"><font color="#ff0000">15,45</font> <font color="#9b00d3">*</font> <font color="#00ff00">*</font> <font color="#f3a447">*</font> <font color="#c0504d">* – </font></font>every hour on 15th and 45th minute</p>
<p><font size="3"><font color="#ff0000">*</font> <font color="#9b00d3">*</font> <font color="#00ff00">*/15</font> <font color="#f3a447">*</font> <font color="#c0504d">* – </font></font>twice a month</p>
<p>I hope you got the idea. Also cron has some predefined values like <font size="3">@yearly, @monthly, @weekly, @daily</font> and others.</p>
<h6>CONFIGURE DRUPAL TO WORK WITH CRON</h6>
<p>In Drupal we have different moving parts. One of these are notifications, which are very important and even more important in <a href="http://openatrium.com" target="_blank">OpenAtrium</a>, Drupal’s flavor. Notifications work with cron. To send all the notifications that are in the queue you can go to your Drupal site’s <u><em>cron.php</em></u> script, for example, at <a href="http://somedrupal.org/cron.php">http://somedrupal.org/cron.php</a>. At this point you’ll have in your administration panel, Administer –> Reports –> Recent logs, some entries related to cron script.</p>
<p><a href="http://lh6.ggpht.com/-y_Oat0RB24c/UHScINvV-fI/AAAAAAAAA0U/mGrqXpTRRiY/s1600-h/2012-10-09_2354%25255B7%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-10-09_2354" border="0" alt="2012-10-09_2354" src="http://lh5.ggpht.com/-8Kyz8Zd-9sQ/UHScJEjIQGI/AAAAAAAAA0c/EykXfl58vrE/2012-10-09_2354_thumb%25255B3%25255D.png?imgmax=800" width="644" height="155" /></a></p>
<p>Now to make this script run at a certain frequency we’ll need to create a job for it. <a href="http://drupal.org/node/23714" target="_blank">Drupal’s guide</a> propose to make such an entry in your crontab:</p>
<p>45 * * * * /usr/bin/wget -O - -q -t 1 <a href="http://www.example.com/cron.php">http://www.example.com/cron.php</a></p>
<p>When you set it up in your crontab –e everything should work fine.
<br /></p>
<h6>CONFIGURE SHARED HOSTING TO WORK WITH CRON AnD WGET</h6>
<p>On my shared hosting solution I hadn’t rights to execute wget command from /usr/bin/wget and my cron failed, so I made a ticket and the guys from the hosting made me a simple copy of wget binary into my /home with all the rights I needed. After that I modified the script from crontab so it could work with my local copy of <strong>wget, </strong>and everything cron related was working without a single issue from that day.</p>
<h6>SECURE ACCESS TO CRON.PHP WITH .HTACCESS</h6>
<p>Now that everything works ok, the question is how to configure your site that your cron.php script couldn’t be accessed from the browser. Otherwise anyone could just refresh /cron.php 5 millions time and put a big load on server.</p>
<p>We can avoid it by limiting access to cron.php file via .htaccess file.</p>
<ol>
<li>Find out your server’s name: use the command  <strong><code>uname –n.</code></strong></li>
<li>Put the following in .htaccess file</li>
<p><Files "cron.php">
<br />  Order deny,allow
<br />  Allow from WEBSERVERNAME
<br />  Allow from 127.0.0.1
<br />  Deny from all
<br /></Files></p>
<li>Change the WEBSERVERNAME with your own server’s name.</li>
<li>Test that you can’t access the cron.php from browser</li>
<li>Test that the cron job on linux is running and is executed OK.</li>
</ol>
<p> </p>
<p>That’s all I wanted to share with you today about <strong>cron</strong>, if you have any questions or suggestions please write a comment.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-84625800125463869412012-09-24T05:00:00.000+03:002012-11-19T15:33:41.006+02:00TEDx Chisinau NXT LVL #nxtlvl<p>Hello friends, </p> <p><a href="http://lh3.ggpht.com/-qq6gySgdf_Y/UF--3PyDVRI/AAAAAAAAAy8/RM_uIAjtsqg/s1600-h/TEDx2.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 9px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="TEDx" border="0" alt="TEDx" align="left" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9vkyQQkF4PNxo5ZdeMjcndI1twm9ihJSxFFNYkG4CGnlVf_dsXI02SEiBFq06bgDrWN5-imuapV5rpjOZe5HYwURRvOsjtj9Z__neATy0DZkJnXF289RKQMC29lNShbqir8kz4NhT3Lo/?imgmax=800" width="244" height="101" /></a>Today I was attending an extraordinary event TEDx in my own town, I must say I’ve never been to a TED event before and hardly imagined what it will be like, but it was an unusual event because pretty much a lot of topics where open-ended points to discuss. We were around 400 attendees with 12 speakers, speaking in 3 languages (English, Romanian, Russian) and pretty much everyone was willing to listen, to learn and to evolve as a personality.</p> <p><strong>UPDATE: Here are some videos: <a title="http://www.youtube.com/playlist?list=PLADJSjJ03wMkNQI_B0ARgzqgO5NZnOtpL" href="http://www.youtube.com/playlist?list=PLADJSjJ03wMkNQI_B0ARgzqgO5NZnOtpL">http://www.youtube.com/playlist?list=PLADJSjJ03wMkNQI_B0ARgzqgO5NZnOtpL</a></strong></p> <iframe height="315" src="http://www.youtube.com/embed/videoseries?list=PLADJSjJ03wMkNQI_B0ARgzqgO5NZnOtpL&hl=ro_RO" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe> <p> </p> <p> </p> <p><a href="http://lh6.ggpht.com/-9B-J9TqgleY/UF--5W9RgdI/AAAAAAAAAzI/HoNckeh3A_E/s1600-h/schedule%25255B5%25255D.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="schedule" border="0" alt="schedule" align="right" src="http://lh5.ggpht.com/-4UoU5YJQ2Co/UF--6lG3x2I/AAAAAAAAAzQ/6L1rq_Nrxok/schedule_thumb%25255B3%25255D.png?imgmax=800" width="244" height="164" /></a></p> <p>Before we get started I’d like to thank everyone involved into organizing this event, and I hope we’ll get many other events related or not to IT, I think communication is the key to get to that next level we’ve kept talking about all day long. Don’t think you’re smarter than someone, but if you got an idea that’s burning you inside out, just make it happen, start by small steps and then it will lead you to some kind of lesson learning. </p> <p>The bio of all the speakers is on TED<sup>x </sup>Chisinau official site: <a title="http://www.tedxchisinau.com/speakers/" href="http://www.tedxchisinau.com/speakers/">http://www.tedxchisinau.com/speakers/</a> </p> <p>The photos are taken from <a title="https://www.facebook.com/TEDxChisinau" href="https://www.facebook.com/TEDxChisinau">https://www.facebook.com/TEDxChisinau</a> photos and from <a href="https://www.facebook.com/victorbuzu" target="_blank">Victor Buzu</a>’s <a href="https://www.facebook.com/media/set/?set=a.10151207474660027.506777.624075026&type=3" target="_blank">FB album</a>.</p> <h6></h6> <h6></h6> <h2><font style="font-weight: normal" size="5" face="Magneto">Elena Pahomova – There will be no  future</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/s720x720/546389_10151207475270027_571849734_n.jpg" target="_blank"><img style="margin: 0px 7px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/s720x720/546389_10151207475270027_571849734_n.jpg" width="120" height="180" /></a>An interesting topic for opening of the event – actually the main idea what Elena Pahomova was presenting is that today is the base for our future, we don’t need to wait until it happens with us. Future is happening now, we model it day by day, so we should live as today dreamers, changing something today, living better today, etc. Another good piece of advice for young journalists was “don’t try to chase big money, work for experience, this is why you got here in first place.”</p> <p> </p> <p> </p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Octavian Ticu – Bankrupt state with elite sport</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-ash3/c0.0.788.376.70699881376/p843x403/539390_473401179358614_1630608091_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-ash3/c0.0.788.376.70699881376/p843x403/539390_473401179358614_1630608091_n.jpg" width="240" height="115" /></a>Octavian Ticu presented a very good info about the idea of meritocracy and that it is mostly applicable to sports, because we know for sure who is the best one there, there are seconds, kilograms, kilometers, etc. He also talked about one little village in Moldova: Grimancauti, this village with a population of 4200 people, gave us (moldovan) 3 Olympic medalists and a lot of champions in box. Also he compared the years when the most progress is done, and these are the years before and after the USSR period in Moldavian history. He also expresses the idea that as a community, as a state we are not yet ready, we don’t have conditions to raise champions in team sports as football, basketball, and others, because the team is a micro community with all its strengths and flaws. This is why we fail in these types of sports. In several words a very good presentation I’d advise you to watch it on YouTube when available.</p> <h2><font style="font-weight: normal" size="5" face="Magneto">Onorica Banciu – Get out from the game</font></h2> <p><a href="http://https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash3/548304_10151207475855027_1938597917_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-ash3/548304_10151207475855027_1938597917_n.jpg" width="240" height="160" /></a>Onorica’s insights on our Moldavian budget are very interesting, she indicated several numbers, which seemed very outraged when measuring the price and the value. Getting as an example a simple Moldovan family from a village she presented some of the day-to-day problems and expressed an interesting idea: “Don’t wait until government will give you something, remember when it does, it means that government first took from someone something and than gave that to you”, so basically when you’re doing great, government is putting pressure on your business, when you’re doing bad it will give you some money so you could still be at least on the edge. So don’t get into the game of protesting without changing anything yourself - stop, innovate, create something new and the changes will come.  </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Dave Erasmus – Is giving good for you ?</font></h2> <p><a href="http://lh6.ggpht.com/-amtdiyCslGw/UF--7n7A_5I/AAAAAAAAAzY/Ez8Z9aAc3uY/s1600-h/is_giving_good_4_u%25255B2%25255D.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 7px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="is_giving_good_4_u" border="0" alt="is_giving_good_4_u" align="left" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5zzOf54RjN5Yr3fcoiEsYndGskGewXelr_uyYoRjarj5pODZ1idzs4I3Om5m1ymo1AIkYj0y4nDqwkj6npOQkI2djaCsLmojWiUta0QEegVTb5lWnSo7Cdp9M6WEmCjhwnOAqiRuDIOE/?imgmax=800" width="244" height="164" /></a>Dave mentioned once again that love isn’t just as simple as a resource, each time you give away love, you’re getting it back. Don’t be afraid of giving something without demanding anything in return, which is the essence of true altruism. As an example on the picture he’s talking about a mother giving everything to her 6 months daughter without getting anything material in return from her. Another idea was that if you have a cause or an idea that you support than getting the funds for that cause is not that complicated, isn’t that complex, just let the people know that you’re passionate about it. Nice talk and a profound one.</p> <h2><font style="font-weight: normal" size="5" face="Magneto">Alex Cosmescu – Do you exist ? Really ?</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc7/393731_10151207476370027_1664240600_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc7/393731_10151207476370027_1664240600_n.jpg" width="240" height="160" /></a>Alex gave the most confusing talk, at least for me. The idea is interesting but not the one that I like, so basically the idea is that life is a union of emotions, feelings, stresses, and many many other things, that we can’t control. Basically life is just happening. And this is why it is not fair to say that you have to suffer more or less than someone else, because life’s just happening want it or not, you can’t change it. Anyway I think this talk enlarged a little bit the common pattern for a TEDx speaker.</p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Eugen Boico – Remix your way into  the future</font></h2> <p><a href="https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-snc7/598855_10151207476530027_542473812_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-snc7/598855_10151207476530027_542473812_n.jpg" width="240" height="160" /></a>Once again I loved the presentation. For a beginning artist, designer there is this idea of being unique, that is like a trigger in their mind. But what is the easiest path to express yourself as a creative artist, the answer is simple, that is remix. With loads of data generated every minute on our planet, there is extremely low possibility that you’ve created something unique that was never created before you. But get a piece of art, a track, something that you like a lot, and improve it with your ideas and thoughts, and this way you shouldn’t invest a lot to progress in this area. Remix of course isn’t the only way, but it is the simplest and the most effective one for a beginner. Watch the presentation on YouTube when available.</p> <h2><font style="font-weight: normal" size="5" face="Magneto">Ruslan Cojocaru – Happiness 2.0</font></h2> <p><a href="https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash3/581621_10151207476680027_659854061_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash3/581621_10151207476680027_659854061_n.jpg" width="240" height="160" /></a>Unfortunately I just arrived after the lunch at the end of the presentation, but I got the idea of being positive in everything you do and to succeed you need two components: the passion about the project, the passion about what you do, and the other one is the team. Get the perfect team and when you got it experiment with it to do it better. I hope I’ll get more ideas from YouTube watch.</p> <p> </p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Maria Gaidar – Changing system from the inside</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc6/224397_10151207477025027_355242810_n.jpg" target="_blank"><img style="margin: 0px 7px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc6/224397_10151207477025027_355242810_n.jpg" width="160" height="240" /></a>Maria is talking about being an opposition activist in Russia, and than suddenly things changed when she became vice-governor in the social sector of Kirov region. She talks about her problems and how she tried changing the system from the inside, not breaking it but step by step changing the attitude of the people towards politicians, by listening and making reforms where needed and possible. When asked if she thinks a single person could make the difference, she is a strong believer that a single person can do a lot of things using different tools and techniques.</p> <p> </p> <p> </p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Chad Rogers – Tweeting isn’t enough</font></h2> <p><a href="https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-snc6/248564_10151207477155027_1110531226_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-snc6/248564_10151207477155027_1110531226_n.jpg" width="240" height="160" /></a>Chad Rogers is talking about tweeter and Facebook and other social media that is used by lots of people, what he’s saying about it that you need to be active for sure, but not on social networks because sharing some link or clicking the “Like” button isn’t an action, it is just an excuse for doing nothing. He also says “Remember why everyone hates politicians ? They keep talking but they are taking no action. The same might happen to you”. The word introduced by Chad is “slacktivism” <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0OEKk6I4ufe9ntwuMfNuvb9IYIOjDXNRhdFGaVRx8WwI8ggCDBRSDrBE6PnQw7MPhm_mrkEKL_-k6tffM9dwhg4HemTSR1v0zTy99s7CnlB8D6WU4cWURC8-bSTpT_flVG7CME5p6ePc/?imgmax=800" />.</p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Jennifer Brush – Moldovan Youth: Bricks into  the foundation of  the peace</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc7/403256_10151207477645027_1635310917_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc7/403256_10151207477645027_1635310917_n.jpg" width="160" height="240" /></a>Jennifer Brush is Head of the OSCE in Moldova. She’s talking about the Tighina bridge that can play the key factor of Moldova’s future if opened. There’s a plan of creating a series of European roads from Kiev to Istanbul – <a href="http://en.wikipedia.org/wiki/Pan-European_corridors" target="_blank">Corridor IX</a> and Moldova is right into the center of this road – this road means prosperity and wealth and growing economics, now the bridge is closed because of our past conflict with Transnistria. Also she notice that there’s another organization that involves multiple countries in Danube zone which is also somehow interested in developing the transport routes, and Moldova can get the benefits that comes with that. She’s asking us at least to show to the governors that we’re aware of this problem. Let’s say it straight - I didn’t know about such plans and such organizations till Jennifer told us about those. Now that we’re aware of it what will change ? She answers that at least if this would be on 5th position in the social polls that would be great, and may be our governors will do something about it.</p> <p> </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Dorin Dusciac – Nuclear physics danger comes from ignorance</font></h2> <p><a href="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/560445_10151207477940027_131009210_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/560445_10151207477940027_131009210_n.jpg" width="240" height="160" /></a>A hilarious guy, he’s a research engineer at the French Atomic Energy Commission near Paris. He’s talking about the formulas and the concepts with such an ease that it is truly pleasant to watch him, plus he’s always making jokes. For example he explained about Roentgen and Sievert and than he said “So now everybody knows the difference between Roentgen and Sievert? Right. The Roentgen has beard, and Sievert hasn’t”. Than he talks about the myth that the wine is protecting us from the radiation and that is not correct because wine protects us only from one element in the radiation specter. Also he talks that if we fly pretty often than that dose of 1 mSv can be achieved pretty fast. For example if you get 7 flight of 7 hours you get the dose of radiation that is already higher than the yearly limit. Thanks Dorin, for a great presentation!    </p> <h2><font style="font-weight: normal" size="5" face="Magneto">Dmitry Volosin – Live projects</font></h2> <p><a href="http://https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-snc6/229852_10151207478060027_1641676088_n.jpg" target="_blank"><img style="margin: 0px 6px 0px 0px; display: inline; float: left" align="left" src="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-snc6/229852_10151207478060027_1641676088_n.jpg" width="160" height="240" /></a>A serious person with a big experience in internet portals. A lot of ideas here, ok for starters he enumerated some of the components of a successful project: obsession, enjoying the project, accepting failures/deaths of the project. He says first projects are like calf's teeth but when those fall, from these small projects can grow big projects with a base already. On the question “Is it normal to lose obsession from time to time ?”, he says that it’s normal because we aren’t robots and these periods of sadness and desperation happen from time to time, but if you lost for good you obsession than sooner or later your project will die. “You should be on fire with this idea, like Jeanne d’Arc… but that isn’t the best example” <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXZ9h4QB63-DMmBNJIkKuBy_T3hO5KWLCEFSY2gpLr1eRE94xxeoVTmxao1vyieGqRWd4K-hh2FhvqSEwMC2yp_jz2JCwZAzZfSJ7AC5Ivb0ruwdWWAQjnH2Yg9xEMFVGubEB4xH2kk8I/?imgmax=800" /> A good presentation worth watching on YouTube.</p> <p> </p> <p> </p> <p> </p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIwvxk4QRv2lR4Q04Ob8vo-qBX0C-kcF5LRk_wIq3UKjR4BIVb0j0sZqUkEvNjH9lod-XWpB_XI0tiKvCCIPG-FCMba-2l2LKglhHLzXUg_KodGKp-uh7e4UM9Xg1fMqdkEFFHkjfEsOc/s1600-h/truly_yours%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 0px 6px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="truly_yours" border="0" alt="truly_yours" align="right" src="http://lh6.ggpht.com/-N5kl7J_U1bE/UF-_B4l71FI/AAAAAAAAA0E/p4qGaAZbQ58/truly_yours_thumb%25255B1%25255D.png?imgmax=800" width="178" height="184" /></a>What I would like to say in the end… Please come to these type of events, support this type of movements. Today in parallel with TED<sup>x </sup>Chisinau, in our city was organized “VeloHora”, a great bike event, aside with it, near Opera and Ballet Theatre was running a minifootball European championship, today I felt that our city was really alive and I hope such events will occur more and more often,</p> <p>Best of wishes. </p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-40857798681012017212012-09-18T15:18:00.001+03:002012-09-18T15:18:51.650+03:00X-Share – cool tutorial for learning Symfony2 Framework<p>Hello,</p> <p>At the moment of writing this blog post I’m working in <a href="http://www.pentalog.com/" target="_blank">Pentalog</a>, which is a computer and technology services company, focusing on low cost offshore/nearshore IT engineering and software development.</p> <p align="left">Few days ago I <a href="http://www.pentablog.ro/pepiniera/x-share-tutorial-pentru-studiu-symfony2/" target="_blank">found out</a>, that as a result of our summer internship program some of the developers from our company created a great tutorial called <a href="https://sourceforge.net/p/p5chi-xshare/wiki/Home/" target="_blank">X-Share</a>. Following this tutorial you’ll create a website, that permits sharing of some objects between the members of a group. As an example it could be sharing books, sharing of the discount cards, sports equipment, etc. This tutorial is open sourced and is on <a href="https://sourceforge.net/p/p5chi-xshare/wiki/Home/" target="_blank">SourceForge</a>.</p> <p align="left">I hope you guys will find it useful, because one of you right now could be searching for a practical example of a  Symfony2 working application. And a little disclaimer: <em><u>although I’m very proud of what my colleagues have done and achieved, I wasn’t involved in any way in creation and developing of this tutorial, so all the credits goes to them.</u></em></p> <p align="left">P.S. It is great to see how open source community evolves, and I hope X-Share become your first place to show to your new junior PHP developer for learning Symfony2 basics.</p> Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2127794245010916172.post-24535629511438774032012-08-03T18:12:00.001+03:002012-08-04T01:15:33.371+03:00Unified Udevi Symfony2 Plugin for NetBeans 7.2<p>Hello,</p> <p>I’ve recently created the unified <a href="http://plugins.netbeans.org/plugin/44143/udevi-symfony2-plugin">Udevi Symfony2 Plugin</a> that contains both <a href="http://plugins.netbeans.org/plugin/42127">File Templates</a> plugin as well as <a href="http://plugins.netbeans.org/plugin/42128">Code Templates</a> plugin. This plugin is made for new version of NetBeans - 7.2. It passed the validation today so you can install it directly from NetBeans. Go to Tools –> Plugins –> Available plugins. You might need to update plugins info, so it will contain the latest list of validated plugins.</p> <p><a href="http://lh6.ggpht.com/-_lQa8wAzwk0/UBvqYoCsWRI/AAAAAAAAAx4/gvP814C0PkQ/s1600-h/plugin_udevi_symfony2%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="plugin_udevi_symfony2" border="0" alt="plugin_udevi_symfony2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWb8-JPDMzfHCJnrNzmb3LqmQnfd31oSu_0xAMtPeowHEzkWZRZkTpL0sdRXF0OnFtWG7D_2nnNaVcrXJVbi1EjS7brdYjW8Jvphm52lEhnzSX7TTYl6ezMhOEULW2qku3iwZjbgbQFe0/?imgmax=800" width="597" height="380" /></a></p> <p>The content of the plugin remained the same, just uniting 2 templates content. The current statistic is </p> <p><a href="http://lh3.ggpht.com/-XQzD5xvnpac/UBvqaG4D0eI/AAAAAAAAAyE/TLa9_M0qxBc/s1600-h/chart_1%252520%2525281%252529%25255B8%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="chart_1 (1)" border="0" alt="chart_1 (1)" src="http://lh5.ggpht.com/-7o8CdzKQwbc/UBvqbGeZeDI/AAAAAAAAAyQ/26Qa10iNzKE/chart_1%252520%2525281%252529_thumb%25255B4%25255D.png?imgmax=800" width="610" height="100" /></a></p> <p>In the previous table I counted number of days that this extension is published in the NetBeans Plugins Center until today. So 2.5 downloads per day isn’t so bad I would say. Probably Symfony2 and NetBeans are a good combination and a lot of people know it. But 5.5 per day is definitely better. I guess now when it is validated in Plugins Center it will sustain current number of downloads per day</p> <p><a href="http://lh4.ggpht.com/-nb7QndFDG-o/UBvqb1lRmVI/AAAAAAAAAyY/5-swHIvWWeo/s1600-h/chart_1%25255B5%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="chart_1" border="0" alt="chart_1" src="http://lh3.ggpht.com/-N3p6YTL98eM/UBvqddVy8qI/AAAAAAAAAyc/Q0EX0KiCtpQ/chart_1_thumb%25255B2%25255D.png?imgmax=800" width="590" height="373" /></a></p> <p>I would like to give a shout to <u>first</u> and I hope not the last person making 5 pull requests in total for those 2 plugins: </p> <blockquote> <p><img style="margin: 0px 12px 0px 0px; display: inline; float: left" align="left" src="https://secure.gravatar.com/avatar/20b7c6745fe53dc75bf381259b7ab620?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" width="53" height="53" />   <strong><a href="https://github.com/Smeagol07">Smeagol07</a></strong>     -       Thank you very much I hope that with the input of the community I will improve the quality of the product into something much bigger, than it is today.</p> </blockquote> <p> </p> <p>I would also like to thank NetBeans team, because their 7.2 version has a higher performance than the previous version and made my plugin run much faster without lots of time for processing.</p> <p>I’d also like to hear from you what else would you like to improve in your day to day job with Symfony2 and NetBeans and who knows may be I will be able to fulfill your expectations.</p> <h1>the bad part</h1> <p>While File templates are working fine, the code templates are not completely working, the only code templates that are working are for php editor, example <em>action </em>template, and others. First the code templates for Twig editor don’t work, I’ll see what I can do with it. Second the code completions for with doctrine annotations are not working, probably because for now I set them as a php documentor templates, may be I’ll need to set them as a php code templates.</p> <p><strong><u>The code source is here:</u></strong> <a href="https://github.com/Monomachus/UdeviSymfonyPlugin">https://github.com/Monomachus/UdeviSymfonyPlugin</a></p> <p>If you have any questions or suggestions please share them in comments, it will be great to know what you’re thinking about it.</p> Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2127794245010916172.post-19466868183326795492012-07-24T11:32:00.001+03:002012-07-24T11:34:26.070+03:00Support my feature request for WebMatrix: Possibility to add new file templates<p>Hello guys,</p> <p>I used several time WebMatrix for the development using ASP.NET Web Pages, a lot lighter web technology than ASP.NET MVC. Recently I wanted to use WebMatrix 2 to learn Node.js development. Now there is a view engine in Node.js that is called JsHtml. JsHtml is a Razor-like view-engine that can be used with node.js or Express (node.js based Sinatra-like framework). Now back to the point: I saw that files with *.jshtml extension get no highlighting, though it should be similar with *.cshtml or *.vbhtml. I thought that may be I can create an extension for WebMatrix which will somehow call the highlighting engine. Another point would be creating specific JsHTML file template. <br />But it isn't restricted only to that. It creates and extension point in a free Microsoft product which is used by beginner devs or someone who wants to start playing with NodeJS a little bit.</p> <p>Actually why I am telling you all these, I created a feature request at WebMatrix UserVoice: <a href="http://webmatrix.uservoice.com/forums/128313-webmatrix-suggestions/suggestions/3013216-possibility-to-add-new-file-templates">Possibility to add new file templates</a> and I voted for it. You can maximum give 3 votes to a feature. Please vote for this feature too, it is important. I would really like these features to get in the top of requested features and than implemented in the final version of WebMatrix 2.</p> <p>Plus I think these feature can be useful also for .NET devs and I hope you will support this feature request. Thank you.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-66295915626807220582012-04-11T16:43:00.001+03:002012-04-11T16:43:54.480+03:00Hibernate : Repeated column in mapping for entity error<p>Well I guess I need to explain this error so when I’ll get it one more time I’ll at least have a place to see where the problem was.</p> <p>So I was having this problem because I’ve got an entity and also I’ve got a composed primary key entity that was embedded in the first one. </p> <p>So let’s imagine I’ve had some GridPreferences entity, that had the GridPreferencesPK composed entity as a primary key which contained <em>userId</em>, and <em>gridId.</em></p> <p><em>GridPreferences.java</em></p> <pre class="brush: java;">@Entity
@Table(name = "GRID_PREFERENCES")
public class GridPreferences extends BaseEntity{
private static final long serialVersionUID = 6521799809955099787L;
@EmbeddedId
private GridPreferencesPK id;
@Column(name = "GRPR_GRID_ROWS_PER_PAGE", nullable = false)
private int rowsPerPage;
}</pre>
<p><em></em></p>
<p><em>GridPreferencesPK.java</em></p>
<pre class="brush: java;">@Embeddable
public class GridPreferencesPK extends BaseEntity {
private static final long serialVersionUID = 2499336910059865064L;
@Column(name = "GRPR_USER_ID", nullable = false, precision = 8)
private String userId;
@Column(name = "GRPR_GRID_ID", nullable = false, precision = 250)
private String gridId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "GRPR_USER_ID", insertable = false, updatable = false)
private User user;
}</pre>
<p>Now I got this error  <strong><u>org.hibernate.MappingException: Repeated column in mapping for entity</u></strong>. Which isn’t exactly self-explanatory. But this time Hibernate got it right.</p>
<p>Basically it is an embedded primary key, so it would be logical that all the fields that are in the PK are the fields of the table itself, not the relation tables.</p>
<p>And the solution is to move the connections to other entities into base entity, in our example GridPreference. Doing that will solve the problem.</p>
<p>Hope this will help someone else too.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-52241806268498573892012-03-08T23:37:00.000+02:002012-03-09T00:05:17.389+02:00New Udevi Symfony2 Template NetBeans plugins that will ease your life (hopefully)<p>Hello guys,</p> <p>I got great news for you: I’ve created 2 new NetBeans plugins for increasing the speed of development with Symfony2.</p> <p>First let’s talk about </p> <p><strong><font size="4">Udevi Symfony2 Code Templates</font></strong></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_x1BzAbMJwW3cVPzUM1nEKwsQB8bEyoy4PoDm_dv6SNnlMGpaIgf4LqWsrsD98FNl3B7VdpaXi3fExVR9899m8RgRWxWhdvH8isUtVnlCbyRDlImO1kYysbGsArHDKHXjTxNCeI8Z9gE/s1600-h/1331132011_2012-03-07_1636%25255B5%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="1331132011_2012-03-07_1636" border="0" alt="1331132011_2012-03-07_1636" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHm2DvPcXcQg14uTSa4Su6AgmKgVsmOPgIlKu9w0gmQ5HJdZA8ybV-HVFO5KfXKYOgc-AVmLsr3ScK_XENkUAZvE_hBgbQ8mxkta_wZmRoR_BFSjGwCu92o0j7xM85GyN6fsO-yXyjFCU/?imgmax=800" width="593" height="513" /></a></p> <p><u>Plugin details page:</u> <a href="http://plugins.netbeans.org/plugin/42128/udevi-symfony2-code-templates">http://plugins.netbeans.org/plugin/42128/udevi-symfony2-code-templates</a></p> <p><u>Plugin code:</u> <a href="https://github.com/Monomachus/Symfony2CodeTemplates">https://github.com/Monomachus/Symfony2CodeTemplates</a></p> <p>So this is something I was thinking about when I started developing a real world applications - code templates, snippets of code that will help me create Symfony2 applications in NetBeans faster and more effective, I searched in Google, and I found this one (<a href="http://www.symfony-zone.com/wordpress/netbeans/">http://www.symfony-zone.com/wordpress/netbeans/</a>).</p> <p><a href="http://www.symfony-zone.com/wordpress/members/thaberkern/">Timo Haberkern</a> – is the guy who created a set of code templates and exported them, he also has the <a href="http://www.symfony-zone.com/wordpress/wp-content/uploads/2011/04/Symfony2_PHP_CheatSheet.pdf">CheatSheet</a> that will help you figure out what each template does. Thank you very much Timo ! Great job ! </p> <p>I took those templates, modified them a little bit, removed some, added some new templates and created a new plugin. I was very happy but when I started testing it I found out that the PHP code templates in NetBeans 7.1 were not working. It was a bug in NetBeans <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://lh5.ggpht.com/-IsUVY0xueIw/T1iuwlVixgI/AAAAAAAAAtc/-5NmppPfC6o/wlEmoticon-sadsmile%25255B2%25255D.png?imgmax=800" />. Here’s the original issue: <a href="http://netbeans.org/bugzilla/show_bug.cgi?id=206413">http://netbeans.org/bugzilla/show_bug.cgi?id=206413</a></p> <p>So the issue was fixed in 7.1.1 and you can finally use my plugin <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh6.ggpht.com/-TWzqU7cMyOw/T1iuxJo1LJI/AAAAAAAAAtk/lBgjPljhQ4M/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" />, but the Twig completion is still broken, I will create a new issue for the guys in NetBeans to fix it. So it doesn’t work for Twig, but still works for everything else.</p> <p>I uploaded the plugin to NetBeans Plugin Portal, the verification is pending but I hope it will soon pass. I suggest you use the plugin and say what do you think about it. If there are any bugs please report them on github. Please use NetBeans 7.1.1 .  Soon I’ll make a new post with the complete list of code templates.</p> <p><strong><font size="4">Udevi Symfony2 File Templates</font></strong></p> <p><strong><font size="4"><a href="http://lh3.ggpht.com/-k4XWkeQRkeQ/T1kmrtaXhgI/AAAAAAAAAtw/4Bjfezqia1Y/s1600-h/1331130368_2012-03-07_16223.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="1331130368_2012-03-07_1622" border="0" alt="1331130368_2012-03-07_1622" src="http://lh6.ggpht.com/-A0MOJEdB_lU/T1kmsfxTlgI/AAAAAAAAAt4/MfYwyUQRM_o/1331130368_2012-03-07_1622_thumb1.png?imgmax=800" width="494" height="341" /></a></font></strong></p> <p><u>Plugin details page:</u> <a href="http://plugins.netbeans.org/plugin/42127/udevi-symfony2-file-templates">http://plugins.netbeans.org/plugin/42127/udevi-symfony2-file-templates</a></p> <p><u>Plugin code:</u> <a href="https://github.com/Monomachus/Symfony2FileTemplates">https://github.com/Monomachus/Symfony2FileTemplates</a></p> <h6></h6> <p><u>UPDATE:</u> you can also use the Symfony2 interactive generators. More info here (<a href="http://qpleple.com/code-faster-symfony2s-interactive-generators/">http://qpleple.com/code-faster-symfony2s-interactive-generators/</a>)</p> <p>This one was a little bit harder to do, but the main goal was to avoid writing over and over pluming code that actually could be written or rewritten using file templates and/or code generation… I like this feature in the IDEs because it saves you a lot of time and the task of writing over and over even 20 keystrokes is not fun.</p> <p>So I created 3 file templates by default</p> <ul> <li><u>Symfony2 Entity Template:</u> This template includes generating an entity with guessed namespace: this namespace is guessed by the absolute name of the new file. The name of the table in DB is guessed upon the name of the entity with underscores between words if there are multiple words, the wizard also has the optional table name and the checkbox to create the annotation for repository or not. </li> <li><u>Symfony2 Controller Template:</u> This is just a template of a new controller with guessed namespace and some useful default uses (Symfony2 Controller and Response) and a new default indexAction. </li> <li><u>Php Class with Namespace:</u> This one is the most wanted for me but still not that good because it is based on supposition that all the Php classes you would need to create with namespace are inside of the ‘src’ folder. </li> </ul> <p>Some templates I would also like to create but don’t know how yet</p> <ul> <li><u>Symfony2 Form Type:</u> It would receive as a parameter the entity and than created in buildForm method each method with description. If field is an id automatically suppose it is hidden. I don’t know how to do it now because of the fact that I don’t know how to get metadata of a PHP entity in Java, hope Oracle guys will help me in that. </li> <li><u>A ViewModel for an Entity:</u> Now when I don’t need to show everything I have in the entity to the screen I use view models. I would also need a generator that take an entity and creates a ViewModel with all the fields of the entity. </li> </ul> <p>Thought about creating the template for Repository but the command line function lower helps you generate your Repository class.</p> <pre class="brush: plain;">app/console doctrine:generate:entities BundleNamespace</pre>
<p>The first time you run the New file-> template from my plugin it runs slow (up to 6-8 seconds) because NetBeans need to index all the files in the plugin, next times it is faster, like 3 seconds. Still a bad performance, perhaps someone from Oracle could help me with that.</p>
<p>Please share what other file templates you would like to seen in this plugin, how well did the plugin go, do you have any problems, questions, concerns, ideas related to it? If any bugs found please declare them in github. Thanks a lot.</p>
<p>P.S. Later on will create a post about how to create a new file wizard module plugin, hope it will help someone. Are you interested in something like this ?</p>
<p>P.S.S. Dear guys from PHP NetBeans team, if you are reading this please make PHP Project a Public API that I could use in my plugin. There is a Java Project API in NetBeans, but nothing regards PHP, may be it is the time to change it <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://lh5.ggpht.com/-ufISO-SnKCc/T1kmtBJrcYI/AAAAAAAAAuA/ND2vyvwTU5I/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" />.</p>
<p>Ok guys, next and hopefully the last question do you think I should unify these 2 plugins in 1 ? </p>
<p>Thanks a lot and happy coding !</p> Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2127794245010916172.post-65545936525974871002012-01-25T17:40:00.000+02:002012-01-26T12:12:35.623+02:00Git and NetBeans 7.1 Problem: Everything in the project appears modified, but is not<p>Hi,</p> <p>Recently I started developing a new Symfony2 project on Windows following the tutorial on <a href="http://tutorial.symblog.co.uk">http://tutorial.symblog.co.uk</a></p> <p>I like to use Git in combination with <a href="http://bitbucket.org" target="_blank">BitBucket.org</a>. I used Git integrated in NetBeans in combination with msysGit and recently found a very strange bug. Everything in NetBeans appeared as modified but actually wasn’t. Very strange I thought, and created an issue on NetBeans bugzilla, than I found out that it is a duplicate of the other issue <a href="http://netbeans.org/bugzilla/show_bug.cgi?id=198451">http://netbeans.org/bugzilla/show_bug.cgi?id=198451</a>. </p> <p>It appeared to be a problem related to line endings in different operating systems. Though msysGit is capable of ignoring this differences, it seems to be that JGit, the tool on which integration with Git is made in NetBeans, doesn’t. So now what should we do to make it work is to add the line </p> <pre style="max-width: 600px" class="brush: plain;">[core] autocrlf = false</pre>
<p>to project’s .git/config file. But that’s not enough, also we would need to follow the instructions in <a href="http://help.github.com/line-endings/">http://help.github.com/line-endings/</a>.</p>
<p>So for Windows I needed to run this script in msysGit :</p>
<pre class="brush: plain;"># Remove everything from the index
$ git rm --cached -r .
# Re-add all the deleted files to the index
# You should get lots of messages like: "warning: CRLF will be replaced by LF in <file>."
$ git diff --cached --name-only -z | xargs -0 git add -f
# Commit
$ git commit -m "Fix CRLF"</pre>
<p>Hope this one will save you time and please vote it in NetBeans bugzilla to notify developers that we need it solved.  </p>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW_PwkFSK8VdGA0CZ1P2TemmO8W_aEzM9LYz8eN5wbimlnKaj_ruCLHKln8kmnJwcbYpjwHB3pGbmzsjravT7vCFOnrj58lEokQwsYWYUIaRPyimphBAmNldj7D6AOZs3xF8xh3HrTgcY/s1600-h/2012-01-24_1436%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto 6px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="2012-01-24_1436" border="0" alt="2012-01-24_1436" src="http://lh6.ggpht.com/-NflNeVFnsAw/Tx7SbIcLcCI/AAAAAAAAAsU/rmVdS2rC0Wk/2012-01-24_1436_thumb%25255B2%25255D.png?imgmax=800" width="155" height="283" /></a>For any ideas, concerns, requests please leave a comment. Thank you.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-39504221178402736602012-01-19T16:51:00.000+02:002012-01-26T12:14:26.989+02:00Git and first Symfony2 project in NetBeans<p><strong><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBWrnQxGLPFkNj6AE6VBf6JwbpAZxj9VFLks1dH_WJ2EK88IhOqUWwd5f_bnwNpzYycR7L89Pt_S32vCg1Cd9RkLATvsCFFUs0hqFJnWplXxLltU513ravkvB3uK3XSQO0vHFPeh9FF9s/s1600-h/apple-touch-icon%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 11px 6px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="apple-touch-icon" border="0" alt="apple-touch-icon" align="left" src="http://lh4.ggpht.com/-dR8XoLcdhOI/TxguiSFi_eI/AAAAAAAAAoI/zAgHvi2GP-Y/apple-touch-icon_thumb%25255B1%25255D.png?imgmax=800" width="129" height="129" /></a>This post is a part of series of posts dedicated to developping in Symfony2. If you missed the first part I highly recommend you to go and read that one before you continue with this post.</strong></p> <ol> <li><a href="http://udevi-community.blogspot.com/2012/01/setting-up-windows-environment-for.html" target="_blank">Setting up Windows environment for Symfony2 developing with NetBeans, XAMPP and Git</a> </li> </ol> <p>Hello, today I’ll show you how to create your first Symfony2 project in NetBeans and how to push and pull it to/from Github.</p> <h6></h6> <h6><font size="2">Creating the fiRst SYMFONY2 project IN NETBEANS</font></h6> <p>Ok go File –> New Project –> PHP –> PHP Application. Click Next.</p> <p><a href="http://lh4.ggpht.com/-FOJgpe-T4qs/TxgujV4uY3I/AAAAAAAAAoQ/bsefDNono4I/s1600-h/2012-01-19_1432%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1432" border="0" alt="2012-01-19_1432" src="http://lh6.ggpht.com/-OW-guZJODg8/TxgukDFd30I/AAAAAAAAAoY/H6vUZ-V3ToU/2012-01-19_1432_thumb%25255B1%25255D.png?imgmax=800" width="644" height="439" /></a></p> <p>Create the project directly into your XAMPP server, htdocs folder. Click Next.</p> <p><a href="http://lh6.ggpht.com/-57frLin9YU0/Txguk65urBI/AAAAAAAAAoc/o12z-GcPJCc/s1600-h/2012-01-19_1434%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1434" border="0" alt="2012-01-19_1434" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYJBd_1VzuvQhLP0O8tefmpbap7kHBkRzVpNGnumT49URedFmmDtegwdYiYBE89Z8Y83OorSFcFyMT1DAIPb2UwZZzwyexdWxgsTqbTsDac04MMAue23HUaB_89NXrxGZ2AmblEcvAoIg/?imgmax=800" width="644" height="439" /></a></p> <p>We should modify the starting URL because in Symfony2 the application starting point is <strong>/web/app_dev.php </strong>like that we can assure that when we are running the application it is correctly started. Also give it a descriptive name like “FirstApp”.</p> <p><a href="http://lh3.ggpht.com/-8TOs3XfCa6M/Txgumrgc2jI/AAAAAAAAAow/iX_OkxbHheA/s1600-h/2012-01-19_1445%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1445" border="0" alt="2012-01-19_1445" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1jbIaz1ZhMogCGGSnRO6h6gFrKJJgXGQPbog_ZmbYq9nYOwhPF7Jy8vRvdskjYRv4tTgqQamQJTqnCGuwvp8QTEN-Bjvono1VcpVqJ-rsF1KrFyjZ6ietiIXYXa3b379W7RRjaqN_J3s/?imgmax=800" width="644" height="459" /></a> </p> <p>On PHP Frameworks step select Symfony2 checkbox and click Finish. Now your application should be generated.</p> <h6><font size="2">RUNNING APPLICATION</font></h6> <p>Now start your Apache and MySQL from XAMPP Control Panel. Go to NetBeans and click F6 (Run the application).</p> <p>Hooray!!! Our first application is up and running. Now we need to configure our application, and doing this will change the <strong>app/config/parameters.ini</strong></p> <p><a href="http://lh3.ggpht.com/-mogaSJ4gZjY/Txguos848BI/AAAAAAAAApA/SNakqkrNboc/s1600-h/AccessSymfony2FirstApp%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="AccessSymfony2FirstApp" border="0" alt="AccessSymfony2FirstApp" src="http://lh5.ggpht.com/-7e52vgoLqNc/TxgupbDPPQI/AAAAAAAAApI/YpT_yajuMmE/AccessSymfony2FirstApp_thumb%25255B1%25255D.png?imgmax=800" width="644" height="480" /></a></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj65yzJlE5BMMt7Qq4XDRWHUmTSLinFZZEWXNqwsLVCyBrvzLy93dU5en5AaZshPbkK4iVxoVSSZiaIpaIc9idwc-zVQWWKgwr1KGKWYSC9kbO9mRjxS49ranQxD9cD09cf0EoYzFz2yz4/s1600-h/configure_1_step%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="configure_1_step" border="0" alt="configure_1_step" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFVPkdua260wve5eFkuIcmJBq80mJeIk2cmbhT9vO-TQLL0OsuONEPTo20oDuu3jS7j09ofb5XZc7kBFu0nAdUxL_sRHnm-eIZauv2Tnm64ZVlonbZyqvqVh1roFbWUSFnhiZBOe5_IZw/?imgmax=800" width="498" height="403" /></a><a href="http://lh6.ggpht.com/-kxi3LZRMmco/TxgusfXUPmI/AAAAAAAAApg/AItk3tWK_XM/s1600-h/configure_2_step%25255B33%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="configure_2_step" border="0" alt="configure_2_step" src="http://lh4.ggpht.com/-CKsYC1P1B44/TxgutOQXkqI/AAAAAAAAApo/1MVKwCA1VoI/configure_2_step_thumb%25255B31%25255D.png?imgmax=800" width="498" height="262" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh51O2S6fvEuGDMCgO3LVVx1mHGvGhMBt3LvA53q8tw-83sexK399QfI1LakPhJ2rQ9eZNpHSAFcLcRWv4Eb33zO-kcxGYAXKakv3ksYf3L-FH8NuNEodnXrpVaH-d9cS-RmYV6OavG0Lg/s1600-h/well_done_config%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="well_done_config" border="0" alt="well_done_config" src="http://lh5.ggpht.com/-dRkOKNzWQc4/TxguvcA_9UI/AAAAAAAAAp4/4T6qKxyCLHc/well_done_config_thumb%25255B2%25255D.png?imgmax=800" width="498" height="322" /></a></p> <p>Now here are our new parameters.ini file</p> <p><a href="http://lh5.ggpht.com/-73RYaweUy-U/TxguwJZ0hHI/AAAAAAAAAp8/aY03Rk9dswQ/s1600-h/changed_params_ini%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="changed_params_ini" border="0" alt="changed_params_ini" src="http://lh3.ggpht.com/-0B7R7wRS9bA/Txguw-cvEcI/AAAAAAAAAqI/WT0pXF9Y9Zo/changed_params_ini_thumb%25255B2%25255D.png?imgmax=800" width="704" height="190" /></a></p> <h6><font size="2">working with git. putting the site to github. </font></h6> <p>Now we need to put the site to github I will show you here the NetBeans integration with Git, but I really prefer the command line way from Git Bash (MsysGit). First I will create a repository at Github. I’ll name FirstSymfony2App.</p> <p>Next we’ll add a .gitignore file to our project. But what is to ignore actually ? Well I didn’t knew it either so I found a typical ignore file for Symfony2 project. So I found it in <a href="http://github.com/github/gitignore/blob/master/Symfony2.gitignore" target="_blank">http://github.com/github/gitignore/blob/master/Symfony2.gitignore</a>.</p> <pre class="brush: plain;"># Bootstrap
app/bootstrap*
# Symfony directories
vendor/*
*/logs/*
*/cache/*
web/uploads/*
web/bundles/*
# Configuration files
app/config/parameters.ini</pre>
<p>Copy it and create this file in our project. </p>
<p>Now we can initialize the Git repository directly from NetBeans. Select the project. Right click go to Versioning –> Initialize Git Repository.</p>
<p><a href="http://lh3.ggpht.com/-xL_FO0eWR60/TxguxhPoGqI/AAAAAAAAAqM/zjk7G-XyFwg/s1600-h/init_git%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="init_git" border="0" alt="init_git" src="http://lh4.ggpht.com/-njIeEBYDitg/TxguyZ1m63I/AAAAAAAAAqY/ibM-o0qazFA/init_git_thumb%25255B2%25255D.png?imgmax=800" width="464" height="461" /></a></p>
<ul>
<li>Now we can add the files to Git by “Git –> Add” command. </li>
<li>Also we can commit now by right click Project –> “Git –> Commit”. </li>
<li>Also we can see already made commits by “Git –> Show History” command </li>
</ul>
<p>Now lets push the contents of our site to Github. First we’ll need to use a remote site to which to push. Ok let’s execute Git –> Remote –> Push command.</p>
<p><a href="http://lh4.ggpht.com/-duCXcTgCV4g/TxguzUiWe7I/AAAAAAAAAqg/vebvhph61TU/s1600-h/2012-01-19_1542%25255B19%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1542" border="0" alt="2012-01-19_1542" src="http://lh5.ggpht.com/-uKn8REBJkGA/Txgu0HWgDzI/AAAAAAAAAqk/iyEaB5gPlIk/2012-01-19_1542_thumb%25255B17%25255D.png?imgmax=800" width="644" height="446" /></a><a href="http://lh5.ggpht.com/-TSdOMJ_DUIc/Txgu0kOSOpI/AAAAAAAAAqw/CpH-MpBOSDo/s1600-h/2012-01-19_1543%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1543" border="0" alt="2012-01-19_1543" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPT41d04UCP-IvCPxW3YBPgi-_NS9BtptVLip1eDTOEBu9h2hy7RkME8Gxu0jqa1FIvBIszrKdpBXYjaWE6eGvRJE6SBRgVGrV9JlY575dv9EIlYJDVJVi3PzYULOdnVXginOjNsbdAxw/?imgmax=800" width="644" height="413" /></a></p>
<p><a href="http://lh3.ggpht.com/-OJdoMl08MgY/Txgu28Qj57I/AAAAAAAAAq8/QLRclqbBCOM/s1600-h/2012-01-19_1544%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1544" border="0" alt="2012-01-19_1544" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiq9UdLs4E2rMLCUpu-Bypd0qPkiX-MgE0_zAt6IBCeoZYbeT7kBHWLm8jvHpzUjDkeI6GJOh226YjOPiJQHP2OH_We8SP_bvXmnjYSSZ1PHa8Dn1QJ997vzAuS5GFgR3BbiLiPuM2hSk/?imgmax=800" width="538" height="477" /></a></p>
<p>That’s all folks, our project is on Github. You can see it here <a href="https://github.com/Monomachus/FirstSymfony2App">https://github.com/Monomachus/FirstSymfony2App</a></p>
<h6><font size="2">PULLING Project From GiTHUB AND RUNNING IT</font></h6>
<p>Now let’s see the perspective of another developer who wants to use/participate in the project. For the sake of the experiment I will delete all the sources and will use MsysGit to do all Git-related stuff, though I think I could somehow use NetBeans for it. </p>
<p>I will clone the repository directly into XAMPP server, htdocs folder. Also I will name the folder FirstApp to avoid specific problems. Using Git Bash tool run this command</p>
<pre class="brush: bash;">$ git clone https://Monomachus@github.com/Monomachus/FirstSymfony2App.git FirstApp</pre>
<p>Import the project into NetBeans using File –> Open Project command. Now start Apache and MySql and run the project. We will also need to specify the project URL : <a title="http://localhost/FirstApp/web/app_dev.php" href="http://localhost/FirstApp/web/app_dev.php">http://localhost/FirstApp/web/app_dev.php</a> .</p>
<p>Now we get an error: </p>
<pre class="brush: plain;">Warning: require_once(D:\xampp_server\htdocs\FirstApp\web/../app/bootstrap.php.cache) [function.require-once]: failed to open stream: No such file or directory in D:\xampp_server\htdocs\FirstApp\web\app_dev.php on line 17
Fatal error: require_once() [function.require]: Failed opening required 'D:\xampp_server\htdocs\FirstApp\web/../app/bootstrap.php.cache' (include_path='.;D:\xampp_server\php\PEAR') in D:\xampp_server\htdocs\FirstApp\web\app_dev.php on line 17</pre>
<p><a href="http://lh4.ggpht.com/-MDsPBW5SDjk/Txgu4TNuoRI/AAAAAAAAArQ/6RRBSS7dhZI/s1600-h/2012-01-19_1604%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1604" border="0" alt="2012-01-19_1604" src="http://lh4.ggpht.com/-EtQ5ktUNQ0U/Txgu6VuSteI/AAAAAAAAArY/HJ5MeweSIXA/2012-01-19_1604_thumb%25255B2%25255D.png?imgmax=800" width="644" height="153" /></a></p>
<p>This error is caused by the fact that in our .gitignore file there is this line <u><strong>app/bootstrap*</strong></u>  and this means that our bootstrap.php.cache file was ignored and not committed to the Github. So the question is how can we regenerate this file ? Well, thanks to Beeton from IRC channel <a href="irc://irc.freenode.net/symfony" target="_blank">#symfony</a> from Freenode, I found out that we can generate it using the</p>
<pre class="brush: plain;">php bin/vendors install</pre>
<p> command and that vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php is the file that actually creates it.</p>
<p>But before you run that command please note that we also do not have the app/config/parameters.ini file because it is also in our .gitignore file. Is it really a good idea ? Yes it is if you work with other people, it means that your MySql database configuration can actually differ from your mate’s configuration. </p>
<p>So where do you get the sample file, well almost always in open source world the answer is Github. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFbqIy5ZKvsFftHZBKhn5pc-8GqaIC3jis1Awizcbkl35oSjT5HCaWEDnVLEh1b8GEfLKbGm1JkL2i4Hy-oEvERc3PIch8HT9D_5lleVHQgbidxIZ62TSDk4AF6cyvphljCNmdGpORpGs/?imgmax=800" /> The link to the sample file <a href="https://github.com/symfony/symfony-standard/blob/v2.0.9/app/config/parameters.ini" target="_blank">https://github.com/symfony/symfony-standard/blob/v2.0.9/app/config/parameters.ini</a></p>
<p>Copy that file and add it to the app/config folder. Modify it and than run the command <strong><u>php bin/vendors install</u></strong> </p>
<pre class="brush: plain; collapse: true;">$ php bin/vendors install
> Installing/Updating symfony
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/symfony'...
remote: Counting objects: 109718, done.
remote: Compressing objects: 100% (35141/35141), done.
remote: Total 109718 (delta 68210), reused 102521 (delta 62139)
Receiving objects: 100% (109718/109718), 16.38 MiB | 3.49 MiB/s, done.
Resolving deltas: 100% (68210/68210), done.
f842739d58b649ffbe6543b2eff520327373029d
HEAD is now at 3e9d937 updated VERSION for 2.0.9
> Installing/Updating twig
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/twig'...
remote: Counting objects: 9859, done.
remote: Compressing objects: 100% (2606/2606), done.
remote: Total 9859 (delta 6399), reused 9540 (delta 6122)
Receiving objects: 100% (9859/9859), 1.28 MiB | 444 KiB/s, done.
Resolving deltas: 100% (6399/6399), done.
96596d5c7f6920dc59985c1cba531ae20715baf4
HEAD is now at 5bba149 prepared the 1.5.1 release
> Installing/Updating monolog
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/monolog'...
remote: Counting objects: 1384, done.
remote: Compressing objects: 100% (548/548), done.
remote: Total 1384 (delta 748), reused 1322 (delta 695)Receiving objects: 94% (
Receiving objects: 96% (1329/1384), 52.00 KiB | 90 KiB/s
Receiving objects: 100% (1384/1384), 174.72 KiB | 90 KiB/s, done.
Resolving deltas: 100% (748/748), done.
8e11234066280685e903ea6dcc0d304cd1aec9b9
HEAD is now at b704c49 Only send FirePHP headers to browser advertising support
for it in their user agent
> Installing/Updating doctrine-common
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/doctrine-common'...
remote: Counting objects: 57783, done.
remote: Compressing objects: 100% (14404/14404), done.
remote: Total 57783 (delta 40513), reused 57588 (delta 40349)
Receiving objects: 100% (57783/57783), 15.34 MiB | 834 KiB/s, done.
Resolving deltas: 100% (40513/40513), done.
38c854c37d20b1f67c979772089b2cd30908bcb6
HEAD is now at b886898 Release 2.1.4
> Installing/Updating doctrine-dbal
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/doctrine-dbal'...
remote: Counting objects: 59701, done.
remote: Compressing objects: 100% (15249/15249), done.
remote: Total 59701 (delta 41906), reused 59291 (delta 41520)Receiving objects:
Resolving deltas: 100% (41906/41906), done.
2a9e9943f33610bfde4637abeafe00edd201803c
HEAD is now at ae358bd Merge remote branch 'origin/2.1.x' into 2.1.x
> Installing/Updating doctrine
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/doctrine'...
remote: Counting objects: 69262, done.
remote: Compressing objects: 100% (17611/17611), done.
remote: Total 69262 (delta 48424), reused 68330 (delta 47567)
Receiving objects: 100% (69262/69262), 17.08 MiB | 2.61 MiB/s, done.
Resolving deltas: 100% (48424/48424), done.
febfe35c2315a20534630aa9e5b9c72a0047f569
HEAD is now at da0e343 Release 2.1.5
> Installing/Updating swiftmailer
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/swiftmailer'...
remote: Counting objects: 9620, done.
remote: Compressing objects: 100% (3288/3288), done.
remote: Total 9620 (delta 5536), reused 9458 (delta 5388)
(9524/9620), 4.93 MiB | 876 KiB/s
Receiving objects: 100% (9620/9620), 5.04 MiB | 889 KiB/s, done.
Resolving deltas: 100% (5536/5536), done.
0243dc3b18c784adda72e71f6bd34f11fef69b4b
HEAD is now at 982b4c9 prepared the 4.1.5 release
> Installing/Updating assetic
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/assetic'...
remote: Counting objects: 4714, done.
remote: Compressing objects: 100% (1665/1665), done.
remote: Total 4714 (delta 2787), reused 4492 (delta 2600)Receiving objects: 99%
Receiving objects: 100% (4714/4714), 540.18 KiB | 251 KiB/s, done.
Resolving deltas: 100% (2787/2787), done.
e15a13fe4782caa6566c7f0c34ae10badaf85361
HEAD is now at f829ad2 updated changelog
> Installing/Updating twig-extensions
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/twig-extensions'...
remote: Counting objects: 297, done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 297 (delta 108), reused 270 (delta 84)Receiving objects: 7% (21/
Receiving objects: 8% (24/297)
Receiving objects: 100% (297/297), 40.25 KiB, done.
Resolving deltas: 100% (108/108), done.
a05ab5ed18a51ae45f3dcc2d0c4ec9b3a6386987
> Installing/Updating metadata
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor/metadata'...
remote: Counting objects: 249, done.
remote: Compressing objects: 100% (178/178), done.
remote: Total 249 (delta 118), reused 128 (delta 32)Receiving objects: 91% (227
Receiving objects: 93% (232/249)
Receiving objects: 100% (249/249), 33.70 KiB, done.
Resolving deltas: 100% (118/118), done.
7d97f1725063f04ef1894a86740b261daf229b89
HEAD is now at 8717ad2 release 1.0.0
> Installing/Updating SensioFrameworkExtraBundle
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor//bundles/Sensio/Bundle/Fram
eworkExtraBundle'...
remote: Counting objects: 1064, done.
remote: Compressing objects: 100% (518/518), done.
remote: Total 1064 (delta 582), reused 969 (delta 500)Receiving objects: 94% (1
Receiving objects: 96% (1022/1064), 132.00 KiB | 74 KiB/s
Receiving objects: 100% (1064/1064), 132.52 KiB | 74 KiB/s, done.
Resolving deltas: 100% (582/582), done.
55de01d34c5b95ee07bd511d06e0b171af5fe9ba
HEAD is now at 1c7e92f fixed tests config
> Installing/Updating JMSSecurityExtraBundle
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor//bundles/JMS/SecurityExtraB
undle'...
remote: Counting objects: 1665, done.
remote: Compressing objects: 100% (718/718), done.
remote: Total 1665 (delta 880), reused 1595 (delta 810)
Receiving objects: 100% (1665/1665), 273.00 KiB | 228 KiB/s, done.
Resolving deltas: 100% (880/880), done.
4dc8223afa9a38cc467e0a858ef5741e6cc3987d
HEAD is now at 541a4c2 Merge pull request #36 from everzet/patch-1
> Installing/Updating SensioDistributionBundle
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor//bundles/Sensio/Bundle/Dist
ributionBundle'...
remote: Counting objects: 423, done.
remote: Compressing objects: 100% (201/201), done.
remote: Total 423 (delta 211), reused 414 (delta 206)Receiving objects: 70% (29
Receiving objects: 100% (423/423), 60.86 KiB | 87 KiB/s, done.
Resolving deltas: 100% (211/211), done.
f00c99854ff161b006a200d8dffa0013981d5373
HEAD is now at 20b66a4 fixed version in composer.json
> Installing/Updating SensioGeneratorBundle
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor//bundles/Sensio/Bundle/Gene
ratorBundle'...
remote: Counting objects: 651, done.
remote: Compressing objects: 100% (302/302), done.
remote: Total 651 (delta 343), reused 609 (delta 317)Receiving objects: 77% (50
2/651), 76.00 KiB | 130 KiB/s
Receiving objects: 100% (651/651), 115.97 KiB | 130 KiB/s, done.
Resolving deltas: 100% (343/343), done.
67bf607b41f930f93f2032d069be535ecaa21730
HEAD is now at dd37fc4 merged branch gnomii/use_filesystem_component (PR #88)
> Installing/Updating AsseticBundle
Cloning into 'D:\xampp_server\htdocs\FirstApp/vendor//bundles/Symfony/Bundle/Ass
eticBundle'...
remote: Counting objects: 1741, done.
remote: Compressing objects: 100% (544/544), done.
remote: Total 1741 (delta 1056), reused 1671 (delta 992)Receiving objects: 94%
Receiving objects: 100% (1741/1741), 229.34 KiB | 86 KiB/s, done.
Resolving deltas: 100% (1056/1056), done.
ae7f6f4dc252d37c686584576cc92f07b092d06a
HEAD is now at 41b5913 Merge pull request #27 from stof/disable_profiler
Installing assets for Symfony\Bundle\FrameworkBundle into D:\xampp_server\htdocs
\FirstApp/web/bundles/framework
Installing assets for Acme\DemoBundle into D:\xampp_server\htdocs\FirstApp/web/b
undles/acmedemo
Installing assets for Symfony\Bundle\WebProfilerBundle into D:\xampp_server\htdo
cs\FirstApp/web/bundles/webprofiler
Installing assets for Sensio\Bundle\DistributionBundle into D:\xampp_server\htdo
cs\FirstApp/web/bundles/sensiodistribution
Clearing the cache for the dev environment with debug true</pre>
<p>After these manipulations we can finally run the sample application.</p>
<p><a href="http://lh4.ggpht.com/-tvT02LlQCWM/Txgu7knJbOI/AAAAAAAAAro/mFnOaAy1FzY/s1600-h/2012-01-19_1644%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1644" border="0" alt="2012-01-19_1644" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibBu8DnS4fl2iji0a8le0zFTTbCAwBWqVrHvsRLJFHZ-_4hyphenhyphenCFzwHCjx0Gg3nNI6qhbfJHbgw_rtRXOobtreGG9-DLsWRMLChD4usPnx5T6CrDJkK_TnPMAlYgJd7L_dGiJsGT5fP2yr0/?imgmax=800" width="599" height="484" /></a></p>
<p>Today we learned how to create and run your first Symfony2 project and push and pull it to/from Github.</p>
<p>Hope you liked it, if you have any concerns, ideas for posts, suggestions please post it here. Good coding guys!</p> Unknownnoreply@blogger.com21tag:blogger.com,1999:blog-2127794245010916172.post-56089101849365281582012-01-19T12:13:00.001+02:002012-01-19T17:08:49.787+02:00Setting up Windows environment for Symfony2 developing with NetBeans, XAMPP and Git<p><strong>[UPDATE] This is a series of post in the next one I’ll show you first Symfony2 app and how to make it work with Git. <u>Second post link:</u> <a href="http://udevi-community.blogspot.com/2012/01/git-and-first-symfony2-project-in.html" target="_blank">Git and first Symfony2 project in NetBeans</a></strong></p> <p>Hi, </p> <p>For a long time there was no sign of me here, but I hope this will change… So what do I do these days, well I want to go in Symfony2 to see how it feels like… Lots of guys were telling me PHP is way faster in development than in Java or .NET Web development so I want to try it out too.</p> <p>So what do we actually need ?</p> <h6><font size="2">XAMPP</font></h6> <p>No problem with that one. Get the latest version, install it but please <em><u><strong>don’t install</strong></u></em> MySql and Apache as services. Than add a system environment variable like XAMPP_HOME for example and than add </p><pre class="brush: plain;">;%XAMPP_HOME%\php;%XAMPP_HOME%\mysql\bin\</pre>
<p>to Path environment variable. Now you should be able to check your PHP version from command line. </p>
<p>Try it now</p>
<p><img src="http://img688.imageshack.us/img688/849/201201191010.png"></p>
<h6><font size="2">XDEBUG based on your own phpinfo</font></h6>
<p>A friend of mine showed me a wonderful site for getting your own DLL that is needed for your exactly configuration.</p>
<p>But first start your Apache server from your XAMPP control panel. Go to <a href="http://localhost/xampp/phpinfo.php" target="_blank">http://localhost/xampp/phpinfo.php</a> and go get view source and copy all the HTML. Now go to <a href="http://www.xdebug.org/find-binary.php" target="_blank">http://www.xdebug.org/find-binary.php</a> and insert the HTML into the textarea. Click on “Analyze my phpinfo output” button. And there you go you have your own DLL to download. Download it and put it into your php/ext folder</p>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQQNhksMylHc6K10C3V_-9ielYsqLy_5nMMOEq5H-T37KlN3fsrzTVAEVmz8lAujHNC48sr6voe7uG_JGDTMtCmLPkJ_rO17v2nGdPaBw8bqdaZp_gAG3L7Ur6F4bYs3NE5PB7oJObqg0/s1600-h/find_xdebug_binary%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="find_xdebug_binary" border="0" alt="find_xdebug_binary" src="http://lh5.ggpht.com/-5tHr6msfZUE/TxfsjyrKHsI/AAAAAAAAAm4/Y3Xd7g_eNws/find_xdebug_binary_thumb%25255B2%25255D.png?imgmax=800" width="522" height="527"></a><a href="http://lh3.ggpht.com/-6imGfTQN-lI/Txfsk0VItII/AAAAAAAAAnA/toTIZDmbBcU/s1600-h/find_xdebug_dll%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="find_xdebug_dll" border="0" alt="find_xdebug_dll" src="http://lh4.ggpht.com/-Stwly8ySvGE/TxfsmU7nLiI/AAAAAAAAAnI/r9lKC74Axl4/find_xdebug_dll_thumb%25255B1%25255D.png?imgmax=800" width="522" height="484"></a></p>
<p>Now go to your php.ini location and add these lines + the line starting with zend_extension</p><pre class="brush: plain;">xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
zend_extension = D:\xampp_server\php\ext\php_xdebug-2.1.2-5.3-vc9.dll</pre>
<p>Now your machine should be ready for debug. <pre></pre>
<h6><font size="2">INSTALL mSYSGIT – GIT FOR Windows</font></h6>
<p>Go and get the latest msysgit from and install it <a href="http://code.google.com/p/msysgit/downloads/list" target="_blank">http://code.google.com/p/msysgit/downloads/list</a></p>
<p><a href="http://lh5.ggpht.com/-AqdvaIOTteY/Txfsm_6SF9I/AAAAAAAAAnw/wVCFuIJ_bnU/s1600-h/2012-01-19_1144%25255B6%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1144" border="0" alt="2012-01-19_1144" src="http://lh6.ggpht.com/-_uF82W-sUjw/TxfsoGYS8II/AAAAAAAAAn0/BNctcEuyxZk/2012-01-19_1144_thumb%25255B4%25255D.png?imgmax=800" width="704" height="138"></a></p>
<h6><font size="2">SYMFONY2 Package</font></h6>
<p>Go to <a href="http://symfony.com/download" target="_blank">http://symfony.com/download</a></p>
<p>Download the latest version in a .ZIP package. At the time of writing this it was <a href="http://symfony.com/download?v=Symfony_Standard_Vendors_2.0.9.zip" target="_blank">Symfony Standart 2.0.9.zip</a></p>
<p>Make a separate folder and put this zip into it (in my case symfony2_php_sources). Also unzip it into another folder. (in my case symfony2_php_sources/Symfony).</p>
<h6><font size="2">IDE</font></h6>
<p>Well we have some options like Eclipse and NetBeans also some support in PHPStorm, but I choose NetBeans 7.1.</p>
<p>There are a number of reasons why I chose it:</p>
<ul>
<li>Out of box support for YAML
<li>Support for Symfony2 (plugin)
<li>Support for Twig (templating engine in Symfony2) also plugin
<li>More user friendly than Eclipse (I guess someone could argue that, but I worked in Eclipse for 1 year). </li></ul>
<p>So let’s starts go to <a href="http://netbeans.org/downloads/" target="_blank">http://netbeans.org/downloads/</a></p>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7NKdAWgQywCXRRmMRgKmWQR4P0O9ESNM99Elryz3XZSA6wGu-1XTxN020sbAITi7d2_oleDZ_IGAO8m-bCIYFWy9-BdsZXHbmkdjUdBnb5zIKjB4duxIOLXbArV4gDlLtaEe_YeD-vn0/s1600-h/2012-01-19_1035%25255B7%25255D%25255B2%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-01-19_1035" border="0" alt="2012-01-19_1035" src="http://lh5.ggpht.com/-n2WjlYIKc2Q/Txfsqv7LRAI/AAAAAAAAAn8/e6QE-SgN0ms/2012-01-19_1035%25255B7%25255D_thumb%25255B1%25255D.png?imgmax=800" width="704" height="469"></a></p>
<p><u>Add plugin for Symfony2.</u> Go to Tools –> Plugins –> Tab Available Plugins –> click “Reload Catalog” –: in Search box input “symfony2” and press Enter. Now there should be a plugin there, called PHP Symfony2 Framework. Install it and restart NetBeans.</p>
<p><img src="http://img576.imageshack.us/img576/576/201201191048.png" width="700" height="432"></p>
<p><u>Add plugin for Twig.</u> For now it is available for download from <a href="https://github.com/blogsh/Twig-netbeans/downloads">https://github.com/blogsh/Twig-netbeans/downloads</a> as a NBM file. Download the latest file.</p>
<p><img src="http://img84.imageshack.us/img84/4567/201201191112.png" width="700" height="444"></p>
<p>And install it in NetBeans. </p>
<p><img src="http://img834.imageshack.us/img834/15/201201191117.png" width="700" height="432"></p>
<p>Now let’s tweak it a little bit. Go to Tools –> Options –> PHP.</p>
<p>Here we’ll have a little fun go to General tab –> Indicate your php.exe location in XAMPP. Also add in Global include path unpacked Symfony2 sources.</p>
<p>Go to Unit Testing tab and indicate the location of your phpunit.bat</p>
<p>Go to Symfony2 tab and indicate the location of the downloaded Symfony2 zip file.</p>
<p>Here is the cumulative actions screenshot</p>
<p><img src="http://img198.imageshack.us/img198/9169/netbeansoptions.png" width="700" height="592"></p>
<p>THAT’S ALL. Now your machine is configured.</p>
<p>Next time I’ll show you how to work with your first Symfony2 project and Git.</p>
<p>If you have any concerns, suggestions, ideas for blog posts please comment here.</p> Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-2127794245010916172.post-18820523025834196872011-08-15T15:29:00.001+03:002011-08-15T15:31:49.918+03:00Attendance sample application in PlayFramework – Part 1<p>Hi,</p> <p>Recently I found out a new Java framework which actually suck less than Java overall I think, because it uses the same kind of system as Rails in Ruby.</p> <p>For now I won’t go in too much details, but if you’d like to see the bootstrapping process for a project, and how to integrate with Secure module from PlayFramework, Attendance app, the application I’m doing for my buddy Teejay from Nigeria, is a good example.</p> <p>I've showed in this podcast how to create a sample PlayFramework application. Import a new site template into it, create a User model, import Secure module from PlayFramework and add authentication to the app. Set up the default database to MySQL. <br />Created sample Attendance page, and played with Groovy templates a little bit. <br />In the second part I will continue to work on Attendance page, and admin part.</p> <iframe height="338" src="http://player.vimeo.com/video/27706022?title=0&byline=0&portrait=0&color=c9ff23" frameborder="0" width="600"></iframe> <p> </p> <p>Hope soon the second part of the application will be available too.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-9145947806478671072011-02-28T12:04:00.001+02:002011-02-28T12:04:49.066+02:00I hate Java #2: ClassNotFoundException ?! – Tomcat deployment<p>At least once per day I have this problem with Tomcat and Eclipse.</p> <p>I have a library declared in my pom.xml but Tomcat strangely enough doesn’t deploy it, and at deploy I have this ClassNotFoundException, the problem is that sometimes when the stars are not arranged in one line Tomcat doesn’t deploy all the libraries into its webapps/{PROJECT_NAME} (deployment folder) folder.</p> <p><a href="http://lh5.ggpht.com/_BWELgx6N3yw/TWtzL5g22hI/AAAAAAAAAis/_kQ1mKzmR9U/s1600-h/image%5B4%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_BWELgx6N3yw/TWtzMb2UqcI/AAAAAAAAAiw/ZLM-PeH-1M0/image_thumb%5B2%5D.png?imgmax=800" width="764" height="306" /></a> </p> <p>Why ? I don’t know but I know instead how to solve it. First of all stop the server, remove all the apps from it.  </p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOAWaqrx7pdBcIJq0QkFAZwO-30NS37pe59AbtdW6mB8mf-u61QkQ4Aqo2syzN7ey_5sLy9rA6UOqi4HkhBO0h69yFPZM0PR0xmKECbYeTLNUMVP6MAasYqN-RwnQ7w9dz0xRc8-lyd8E/s1600-h/image%5B8%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGDeJb_bcJchZC25N7cFItVwf_n0eraP2Z4ljmDA-VRBCWeO4IjipZb0bXNb84sus9PG5VzKunv41L7PT1B54CKhz95ywpWVq-jf8Wa_l2q33pFXBvCRzk6p1kjvpr9vRLEBnPij1YdOQ/?imgmax=800" width="378" height="384" /></a> </p> <p></p> <p></p> <p>Click “Finish”.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuL8Qs7IQcVa8weYM6EoLXzRK9_GP15evAjcR-G9SmocwDiK32TR6vRx_xil5xLtN4yZCCCMPm8QRdmvqaPiINn6lu_SiuevA7nuc_MJVpffwfJ4nIGtHyqwifoPWNSqIuX6OIfPKuceg/s1600-h/image%5B12%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBqlSRQw8I3Kc3P2dfSH7IPr_QBU6Q_1lChsU552nwta3Byx9xOOaVmP8yt493Bo0RRmPKBPAhgTtPmJu8-gsiRQEzSKu12kcSWcKVU2NI-NItvGGnBeo5BhfpedXlSzaV36oOOrGJmYQ/?imgmax=800" width="385" height="393" /></a> </p> <p>Make a Tomcat clean.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgozmt7iRUF372DtCcHcJ5B7Gc2WcHH0t1ssr6AlCzXxtnHariqtbg8iD6Di2T9wZk3vrHnZJgHmGbVFfUs1X0edjmwbiKK_medO4SYYtNp0mknysfn7-8peLrALbvKVEM63gLHDfiM5MQ/s1600-h/image%5B18%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_BWELgx6N3yw/TWtzPB7NmdI/AAAAAAAAAjI/Yl8-30Oh_LI/image_thumb%5B10%5D.png?imgmax=800" width="390" height="369" /></a> </p> <p>After the clean is finished add  removed apps back to Tomcat and run the server.</p> <p>As you can see I don’t have the problem now.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOxR0kqV9z3iHSP-FNJogtCUUUwzPO2UyG7mzNG3vpoDq7ByylWIPM-UXc1n8F7aZaamnhU3bV1dtUT6nG3GliGaD01e6RrSb7eI-j9tL15ru-qHHNpn9PHhV4o7eIPgoUEoN6BkdWVbc/s1600-h/image%5B25%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6eL-l8Brx_70LZOAwAJP1A_TmNdOG4Ysxs0saignjeGUQEJrBBkgp1oRWT_FDqUuI3uDF4IsspGfQckFK2-sOkeNZxM8fGLtkgkbo8i7J8xtxxcEBl-DSDI0t8c66_ECklrCymyrhT2s/?imgmax=800" width="578" height="129" /></a> </p> <p></p> <p>Another one why I hate Java, and yes it isn’t related to Java itself but to it environment, but still I don’t fee much happier about it. This shouldn’t be like this, guys. Dear clients, take a look at IIS. Do you see something like that ? No ? Than why do I still have to choose Java ? </p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-15765513321597105162011-02-17T12:40:00.001+02:002011-02-17T12:42:00.054+02:00I hate Java #1: org.hibernate.MappingException: Unknown entity<blockquote> <p>Well, as you might know I started learning/coding Java because I will kinda be working in production and as you might know in my first month in Java I got the idea to write a book about it. Here is how the cover would look.</p> <p><a href="http://lh5.ggpht.com/_BWELgx6N3yw/TVz7FX8vjtI/AAAAAAAAAik/XiAxv86enmU/s1600-h/image%5B8%5D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_BWELgx6N3yw/TVz7GEleQEI/AAAAAAAAAio/sv3ZI0M6JQ8/image_thumb%5B4%5D.png?imgmax=800" width="274" height="329" /></a> </p> </blockquote> <p>Anyway this is not the point of this particular post. So let’s see what we got. We got a very unusual exception: <em>org.hibernate.MappingException: Unknown entity. </em></p> <p>We tried to use annotated hibernate entities, everything seemed to be nice configured in hibernate.xml but it didn’t worked. Our Hibernate should work with Spring. So I’ll put some XML’s and classes before and than I’ll tell you the solution</p> <pre class="brush: xml;"><?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- Hibernate session factory -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/testh" />
<property name="username" value="postgres" />
<property name="password" value="postgres" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="entity" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- The Spring support for Hibernate calls -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans></pre>
<p> </p>
<p>The property “packagesToScan” is used to indicate where the hibernate annotation entities are.</p>
<p>Now the entity java class was like this</p>
<pre class="brush: java;">package entity;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Entity;
@Entity
@Table(name = "emp", schema = "public")
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "emp_userid")
private String id;
@Column(name = "emp_link_date")
private Timestamp date;
@Column(name = "emp_logdel")
private boolean logicalDelete;
@Column(name = "emp_name")
private String name;
@Column(name = "employee_surname")
private String surname;
public Employee() {
// TODO Auto-generated constructor stub
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Timestamp getDate() {
return date;
}
public void setDate(Timestamp date) {
this.date = date;
}
public boolean getLogicalDelete() {
return logicalDelete;
}
public void setLogicalDelete(boolean logicalDelete) {
this.logicalDelete = logicalDelete;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public boolean isLogicalDelete() {
return logicalDelete;
}
}</pre>
<p>Well I got this error which was kind of stupid:</p>
<p>org.hibernate.MappingException: Unknown entity: entity.Employee
<br />    at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:597)
<br />    at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:68)
<br />    at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:879)
<br />    at org.hibernate.impl.SessionImpl.get(SessionImpl.java:816)
<br />    at org.hibernate.impl.SessionImpl.get(SessionImpl.java:809)
<br />    at com.givaudan.persistence.UserDaoBean.getUserById(UserDaoBean.java:12)
<br />    at com.givaudan.masterdata.service.UserRightsServiceBean.getUserById(UserRightsServiceBean.java:12)
<br />    at service.UserRightsServiceTest.testGetUserById(UserRightsServiceTest.java:28)
<br />    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<br />    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
<br />    at java.lang.reflect.Method.invoke(Method.java:597)
<br />    at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
<br />    at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
<br />    at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
<br />    at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
<br />    at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
<br />    at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
<br />    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
<br />    at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
<br />    at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
<br />    at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
<br />    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
<br />    at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
<br />    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
<br />    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
<br />    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
<br />    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
<br />    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
<br />    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
<br />    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) </p>
<p>And I got to this blog post on the net. <a href="http://thejavablog.wordpress.com/2008/05/21/orghibernatemappingexception-unknown-entity/">http://thejavablog.wordpress.com/2008/05/21/orghibernatemappingexception-unknown-entity/</a></p>
<p>Now that explained everything: I shoudn’t use <strong>org.hibernate.annotations.Entity</strong>, but  <strong>javax.persistence.Entity</strong>.</p>
<p>Isn’t that sweet ? For a newbie in Java it’s really hard to understand why Entity annotation which you do use at hibernate, shouldn’t be in org.hibernate.annotations.Entity, but instead in javax.persistence.Entity.</p>
<p>Well looks like java API coders don’t like logical and simple things. And another question when I should use org.hibernate.annotations.Entity? Do I really need it with the same name in this package? </p>
<p>Well may be someone on the Java side would explain this thing. That really would be nice.</p> Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2127794245010916172.post-85503102666771384452011-01-22T16:28:00.000+02:002011-11-27T11:34:57.892+02:00ASP.NET MVC 3 Project with NUnit as Testing framework<p><strong>[UPDATE] Marcus has been able to make a new <a href="http://blog.kimpenhaus.de/asp.net-mvc-nunit-test-template-on-visual-studio-gallery">Visual Studio Extension</a> that add NUnit as an option when </strong><strong>selecting test framework for ASP.NET MVC 3. You can <a href="http://visualstudiogallery.msdn.microsoft.com/7f3bdc82-f418-41aa-ad15-f1d6f89df47a" target="_blank">get that</a> from Visual Studio gallery for free. </strong></p> <p>Don’t you sometimes have this feeling when you need something that Microsoft could make out of the box?</p> <p>I got the same kind of idea today when I was trying to create a new ASP.NET MVC 3 website with NUnit as test framework. And I could find this page <a href="http://msdn.microsoft.com/en-us/library/gg416508(v=VS.98).aspx">How to: Add a Custom ASP.NET MVC Test Framework in Visual Studio</a> but the whole thing wasn’t very easy and it was indicated that you should insert some keys and values into registry.</p> <p>“Man, I don’t like that”, I thought, “Isn’t there an easier solution which could make it all work ?”. </p> <p align="left">I googled a little bit, and I found this blog post: <a href="http://blog.kimpenhaus.de/asp.net-mvc-3-with-nunit-testproject-updated-template" target="_blank">ASP.NET MVC 3 with NUnit Testproject</a> written by <a href="http://www.kimpenhaus.de/">Marcus Kimpenhaus</a>. In the bottom of this blog post there is a link via which you can download and install the NUnit template for ASP.NET MVC 3, this template worked for x64 bit machines, but I left a comment and he was nice to update it for x86 machines too. Thanks very much Marcus this project template is invaluable when need it. I also suggested to publish this template to NuGet feed, and if this will work it would be great and you could install it directly from your NuGet console.</p> <p align="left">So let’s resume what do you need to do in order to have a NUnit Test project template for your ASP.NET MVC 3 project:</p> <ol> <li> <div align="left">Go to blog post  <a href="http://blog.kimpenhaus.de/asp.net-mvc-3-with-nunit-testproject-updated-template">ASP.NET MVC 3 with NUnit Testproject</a> </div> </li> <li> <div align="left">At the bottom of the blog post click the download link for the project template</div> </li> <li> <div align="left">Run install.bat as administrator, now this bat will check the type of your machine : x64 or x86 and will edit registry accordingly to that, it will also update your Visual Studio 2010 cache so please wait a little bit there</div> </li> <li> <div align="left">Go and thank Marcus for his work, and send a mail to ASP.NET team to include this project template in the Visual Studio SP1. After all the SP1 is coming in spring so they still have lots of time to include it.</div> </li> </ol> <p>Hope this will help someone.</p> Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2127794245010916172.post-16427611532516490622011-01-18T23:35:00.001+02:002011-01-18T23:39:43.513+02:00Get used to Mercurial using TortoiseHg and VisualHg<p>Hi, guys today I’m gonna link a little video about another <a href="http://en.wikipedia.org/wiki/Distributed_Version_Control_System">Distributed Versionning Control System (DVCS)</a>, Mercurial. If you don’t know that’s what I decided to use as a source control system for <a href="http://petshelter.codeplex.com/">Pet Shelter</a> – my learning experiment with ASP.NET MVC 3. Read more at <a title="http://lnkd.in/v5uARq" href="http://lnkd.in/v5uARq">http://lnkd.in/v5uARq</a>. </p> <p>Anyway today we’ll talk about Mercurial and TortoiseHg and a little bit about VisualHg which kinda integrates Mercurial into your usual IDE environment.</p> <p>So first video is from vimeo:</p> <iframe style="width: 671px; height: 431px" height="300" src="http://player.vimeo.com/video/10274363" frameborder="0" width="400"></iframe> <p><a href="http://vimeo.com/10274363">Mercurial with TortoiseHG: The Basics</a> from <a href="http://vimeo.com/ragingmon">ragingmon</a> on <a href="http://vimeo.com">Vimeo</a>.</p> <p>Another excellent video is at Rob Conery Tekpub website. Here is the link</p> <p><a title="http://tekpub.com/view/dotnet-oss/7" href="http://tekpub.com/view/dotnet-oss/7">http://tekpub.com/view/dotnet-oss/7</a></p> <p>Only a little problem to view it you need to be registered. And by the way registration literally takes 20 seconds. Please take a look at that wonderful video with the length of 34 minutes.</p> <p>Hope you got it. No matter how far you go, you just need to know Git or Mercurial, and may be in your next project when you’ll be using these tools you could make another video and send to me it’s link and I will share it with the people who read my blog.</p> <p>Take care.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-68494854254603811252011-01-10T12:11:00.001+02:002011-01-10T12:11:33.240+02:00Create a sample Rails 3 application running with JQuery<p>Hi guys,</p> <p>Today I’m going to show you how to combine the power of Rails 3 with JQuery.</p> <p>By default Rails 3 comes with Prototype, but let’s say I don’t know Prototype (I really don’t … a good topic for homework), but I still need to use Javascript in my brand new application and I know JQuery, or may be I need JQuery UI components, for example a <a href="http://jqueryui.com/demos/datepicker/">DateTime picker</a>,  than all I need to do is combine JQuery and Rails 3 right ? Yeah so let’s try it manually.</p> <p><font size="3">1.   First of al we need to create a brand new Rails 3 app :</font></p> <pre class="brush: plain;">$ rails new jquery_demo_app -J
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/.gitkeep
create public/javascripts/application.js
create script
create script/rails
create test
create test/fixtures
create test/functional
create test/integration
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep</pre>
<p>That “-J” option tells Rails that we don’t need Javascript stuff generated.</p>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 40px; display: inline; border-top: 0px; border-right: 0px" title="Application before adding jquery" border="0" alt="Application before adding jquery" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjB-FdLoeMUkvVbsQaT_VeL8kRyJmF927wxvapCHdWovO6b3IdPZAqunELG8xFYHHEY79zcxGUTKko2DqeWHmVbwfIdFnnhnavZQyrjymy8OBQum9n2oN3V7_9y_vVR_4_xzSSc5U0lHA/?imgmax=800" width="180" height="461" /> </p>
<p><font size="3">2.   Next we need to download the latest Jquery version minified and put it under the <strong>public/javascripts</strong> folder.</font></p>
<blockquote></blockquote>
<p>      So all we need is to copy and paste the text from <a title="http://code.jquery.com/jquery-latest.min.js" href="http://code.jquery.com/jquery-latest.min.js">http://code.jquery.com/jquery-latest.min.js</a> to <strong>jquery.js</strong> file.</p>
<p><font size="3">3.   Next we need to copy latest Rails Jquery drivers and put it under <strong>public/javascripts</strong> too.</font></p>
<p>     So we go to <a href="https://github.com/rails/jquery-ujs/blob/master/src/rails.js">https://github.com/rails/jquery-ujs/blob/master/src/rails.js</a> click on raw link and copy it to <strong>rails.js</strong> file.</p>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 30px; display: inline; border-top: 0px; border-right: 0px" title="JQuery UJS driver" border="0" alt="JQuery UJS driver" src="http://lh6.ggpht.com/_BWELgx6N3yw/TSrbUkFxHcI/AAAAAAAAAiY/CfmhZzaAK3k/jquery-ujs%5B8%5D.png?imgmax=800" width="644" height="148" /> </p>
<p>These 2 steps can be done in one shot using curl tool.</p>
<pre class="brush: plain;">$ cd jquery_demo_app/
$ cd public/javascripts/
$ curl http://code.jquery.com/jquery-latest.min.js > jquery.js
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 78601 100 78601 0 0 181k 0 --:--:-- --:--:-- --:--:-- 213k
$ curl https://github.com/rails/jquery-ujs/raw/master/src/rails.js > rails.js
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4150 100 4150 0 0 4429 0 --:--:-- --:--:-- --:--:-- 5313
$ ls
application.js jquery.js rails.js </pre>
<p><font size="3">4.   And the last thing is to edit in config/application.rb file these lines</font></p>
<pre class="brush: plain;"># JavaScript files you want as :defaults (application.js is always included).
config.action_view.javascript_expansions[:defaults] = %w()</pre>
<p>We need to include jquery.js and rails.js into defaults. And optionally you could specify CDN network but this isn’t always required.</p>
<pre class="brush: plain;">config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
config.action_view.javascript_expansions[:cdn] = %w(https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js rails)</pre>
<p>As you can see there are a lot of steps which should be repeated for each application where we want to use JQuery. </p>
<p>Fortunately enough we have another solution.</p>
<h5>Gem “jquery-rails”</h5>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="jquery-rails" border="0" alt="jquery-rails" src="http://lh3.ggpht.com/_BWELgx6N3yw/TSrbVFowPmI/AAAAAAAAAic/qFsBSt4nBRw/jquery-rails%5B12%5D.png?imgmax=800" width="711" height="253" /> </p>
<p>There is a gem created <a href="https://github.com/indirect/jquery-rails">https://github.com/indirect/jquery-rails</a> which will help us to avoid repeating these steps over and over again. </p>
<p>Let’s experiment with another new application.</p>
<p>Add jquery-rails into our Gemfile. </p>
<p>And run bundle install command. And you could also commit it to a git repo, so if something goes wrong you could revert to initial version.</p>
<pre class="brush: plain;">$ rails new another_jquery_app
# In Gemfile add this line
gem 'jquery-rails'
$ bundle install
Fetching source index for http://rubygems.org/
.
.
.
Using jquery-rails (0.2.6)
.
.
.
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
$ git init
$ git add .
$ git commit -am "Initial commit"</pre>
<p>Now let’s install jquery</p>
<pre class="brush: plain; collapse: true;">$ rails generate jquery:install
remove public/javascripts/controls.js
remove public/javascripts/dragdrop.js
remove public/javascripts/effects.js
remove public/javascripts/prototype.js
fetching jQuery (1.4.4)
create public/javascripts/jquery.js
create public/javascripts/jquery.min.js
fetching jQuery UJS adapter (github HEAD)
c:/Ruby192/lib/ruby/1.9.1/net/http.rb:677:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate
ed (OpenSSL::SSL::SSLError)
from c:/Ruby192/lib/ruby/1.9.1/net/http.rb:677:in `connect'
from c:/Ruby192/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
from c:/Ruby192/lib/ruby/1.9.1/net/http.rb:626:in `start'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:769:in `buffer_open'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:671:in `open'
from c:/Ruby192/lib/ruby/1.9.1/open-uri.rb:33:in `open'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:77:in `get'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/jquery-rails-0.2.6/lib/generators/jquery/install/install_generator.rb:34:in `download_ujs
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/generators.rb:163:in `invoke'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/generate.rb:10:in `<top (required)>'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'</pre>
<p> </p>
<p>Because I use Windows I got this <strong>“certificate verify failed (OpenSSL::SSL::SSLError)”</strong>. If you don’t have this error skipped to  I made a little research and found out that I need to point Rails to a certificate to use when dealing with HTTPS. To see more about this issue follow this link:  <a href="http://support.github.com/discussions/repos/4714-jquery-github-ssl">jQuery, GitHub, SSL</a>. Thanks to 19th comment author. He indicated a solution.</p>
<p>So all we need to do is copy file from <a href="https://github.com/Shopify/active_merchant/blob/master/lib/certs/cacert.pem">https://github.com/Shopify/active_merchant/blob/master/lib/certs/cacert.pem</a> somewhere locally and than indicate this URI in C:\Ruby\Ruby192\lib\ruby\1.9.1\open_uri.rb around line 289 </p>
<pre class="brush: plain; highlight: [3];">http.use_ssl = true
http.verify_mode = options[:ssl_verify_mode] || OpenSSL::SSL::VERIFY_PEER
http.ca_file = 'C:\Ruby\certs\cacert.pem' # you should indicate where you’ve set your file locally
store = OpenSSL::X509::Store.new</pre>
<p>Now let’s try again. Before we try again we’ll need to checkout the version before error occurred.</p>
<pre class="brush: plain;">$ git checkout -f
$ rails generate jquery:install
remove public/javascripts/controls.js
remove public/javascripts/dragdrop.js
remove public/javascripts/effects.js
remove public/javascripts/prototype.js
fetching jQuery (1.4.4)
identical public/javascripts/jquery.js
identical public/javascripts/jquery.min.js
fetching jQuery UJS adapter (github HEAD)
conflict public/javascripts/rails.js
Overwrite d:/rails_tutorial_projects/another_jquery_app/public/javascripts/rails
.js? (enter "h" for help) [Ynaqdh] Y
force public/javascripts/rails.js</pre>
<p>Now your application is using JQuery instead of Prototype and all we needed to do is use this little useful gem and I encourage you to use it also.</p>
<p>By the way if you need JQuery ui installed just use </p>
<pre class="brush: plain;">$ rails generate jquery:install --ui</pre>
<p>So that is how you can use Rails 3 with JQuery instead of Prototype. Take care.</p> Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2127794245010916172.post-26745760684000502692011-01-06T23:58:00.001+02:002011-01-06T23:58:51.754+02:00Git in Action<p>Hi, guys found this amazing and quite simple video about using Git. Take a look.</p> <iframe height="300" src="http://player.vimeo.com/video/16395537" frameborder="0" width="400"></iframe> <p><a href="http://vimeo.com/16395537">Git Screencast: Git in Action</a> from <a href="http://vimeo.com/ralfebert">Ralf Ebert</a> on <a href="http://vimeo.com">Vimeo</a>.</p> <p>Give thumbs up to this post if you liked it and please comment about what do you also want to see in my blog.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-82013994102070949462010-12-11T10:39:00.001+02:002010-12-11T10:41:15.052+02:00Ruby Challenge 2010: Creating first application and working with Git<p>Hi all one more time,</p> <p>Last time we stopped by installing Rails. Let’s check one more time it’s current version</p> <pre class="brush: plain;">C:\Users\Monomachus>rails --version
Rails 3.0.3</pre>
<p>You can notice that from the last time we talked about it Rails version changed from 3.0.1 to 3.0.3. That’s because I’ve updated my system.</p>
<p>Now lets create a new application with Rails. We can do it by using “rails new <em>name_of_the_application</em>” command</p>
<pre class="brush: plain; collapse: true;">D:\rails_tutorial_project>rails new first_application
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create log
create log/server.log
create log/production.log
create log/development.log
create log/test.log
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create public/images
create public/images/rails.png
create public/stylesheets
create public/stylesheets/.gitkeep
create public/javascripts
create public/javascripts/application.js
create public/javascripts/controls.js
create public/javascripts/dragdrop.js
create public/javascripts/effects.js
create public/javascripts/prototype.js
create public/javascripts/rails.js
create script
create script/rails
create test
create test/fixtures
create test/functional
create test/integration
create test/performance/browsing_test.rb
create test/test_helper.rb
create test/unit
create tmp
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create vendor/plugins
create vendor/plugins/.gitkeep</pre>
<p>Will get to each of those files in this series posts, this is what I hope at least to achieve. </p>
<p><em>Tip of the day: </em><strong>.gitignore</strong><em> file is used to let git know what kind of files we don’t want to add/commit to repository</em>  </p>
<p>Ok, so we got everything created now and rails made for us a brand new application which should already work so let’s try it with “rails server” command. First we need to cd into the new created directory. </p>
<p>And I got error at first</p>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOiIRMDO7sIyFpzV4b4UkJJ7KDw1DRZ-HiLH13dJraC0S5FZGZzd-5nFpn9ygC1tr3hWpAc4PzIXJA0coGYKckkZeGpgbK_TOXySWJQKvUEOO9mW6b9viUzqnjivrtYfoKCPFxAbwrCRM/s1600-h/railsStartError%5B3%5D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="railsStartError" border="0" alt="railsStartError" src="http://lh3.ggpht.com/_BWELgx6N3yw/TQM4uypYmgI/AAAAAAAAAh4/-8vrVudXVmg/railsStartError_thumb%5B1%5D.png?imgmax=800" width="381" height="149" /></a></p>
<p align="left">And these errors in command line</p>
<pre class="brush: plain; collapse: true;">D:\rails_tutorial_project\first_application>rails server
C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-mingw32/lib/sq
lite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadErr
or)
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-m
ingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.2-x86-m
ingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:64:in `require'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:64:in `block (2 levels) in require'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:62:in `each'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:62:in `block in require'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:51:in `each'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r/runtime.rb:51:in `require'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundle
r.rb:112:in `require'
from D:/rails_tutorial_project/first_application/config/application.rb:7
:in `<top (required)>'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:28:in `require'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:28:in `block in <top (required)>'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:27:in `tap'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'</pre>
<p>After poking a little bit on forums I saw that I need to download the latest version of Sqlite dll’s and put them into my “ruby\bin” folder. Ok no problems, let’s do it. So you can download it <a href="http://www.sqlite.org/download.html">here</a>. </p>
<p align="left"><a href="http://lh5.ggpht.com/_BWELgx6N3yw/TQM4vx7yS-I/AAAAAAAAAh8/Ve13OFE1FYA/s1600-h/sqliteDownloads%5B3%5D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="sqliteDownloads" border="0" alt="sqliteDownloads" src="http://lh3.ggpht.com/_BWELgx6N3yw/TQM4wfCGXeI/AAAAAAAAAiA/dQJc4ENK6JM/sqliteDownloads_thumb%5B1%5D.png?imgmax=800" width="640" height="147" /></a></p>
<p>Downloaded, unziped, xcopied into ruby\bin folder. Let’s try again.</p>
<pre class="brush: plain;">D:\rails_tutorial_project\first_application>rails server
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-12-11 10:00:40] INFO WEBrick 1.3.1
[2010-12-11 10:00:40] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2010-12-11 10:00:44] INFO WEBrick::HTTPServer#start: pid=3560 port=3000</pre>
<p>Ok so now that works fine.</p>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVfju_4aIL1BiujkVhpVsjFQ_wtaeiL2AAkNQfKFiTz00CtL1lO-wMnsMgi3zWZiYhXdEZdGPAhkvdVDQTsnbFCHXfyKNYuyLP8fc-0RHE9NoY28Mhx1IzW0YCunpAcVn27-XgLNS_gUo/s1600-h/runningServer%5B5%5D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="runningServer" border="0" alt="runningServer" src="http://lh5.ggpht.com/_BWELgx6N3yw/TQM4xkivSkI/AAAAAAAAAiI/82pBz2x-oWc/runningServer_thumb%5B3%5D.png?imgmax=800" width="636" height="462" /></a></p>
<p><font size="2"></font></p>
<p><font size="3">P.S. Anyone knows how to run the server and then to detach in windows it also gives me an error in Windows when I try to use “rails server –d” </font></p>
<pre class="brush: plain; collapse: true;">D:\rails_tutorial_project\first_application>rails server -d
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_suppor
t/core_ext/process/daemon.rb:3:in `fork': fork() function is unimplemented on th
is machine (NotImplementedError)
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/
active_support/core_ext/process/daemon.rb:3:in `daemon'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/serv
er.rb:262:in `daemonize_app'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/serv
er.rb:202:in `start'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands/server.rb:65:in `start'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:30:in `block in <top (required)>'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:27:in `tap'
from C:/rubies/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails
/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'</pre>
<h6><font size="2">WORKING WITH GIT</font></h6>
<p>Ok now let’s try to work a little bit with git. I’ll be using now the “Git Bash” command line.</p>
<pre class="brush: plain;">$ git init // initilize the repository
$ git add . // adds everything to repository
$ git commit -m "First commit" // make initial commit</pre>
<p>So here everything should be clear. In git commit command <strong><em>–m</em></strong> means specifying message.</p>
<p>Now we can check the logs</p>
<pre class="brush: plain;">Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ git log
commit 24d181eef79f1c6bd28898bcb0a587ff04a73dca
Author: unknown <Monomachus@.(none)>
Date: Sat Dec 11 10:12:55 2010 +0200
First commit
</pre>
<font face="Helvetica">Now let’s see how can we checkout but first let’s delete some important file (Gemfile for example) and verify the status of git.</font>
<pre class="brush: plain;">Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ rm Gemfile*
Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ ls
README app config.ru doc log script tmp
Rakefile config db lib public test vendor
Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ git status
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: Gemfile
# deleted: Gemfile.lock
#
no changes added to commit (use "git add" and/or "git commit -a")
Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ git checkout -f
Monomachus@MONOMACHUS-PC /d/rails_tutorial_project/first_application (master)
$ ls
Gemfile README app config.ru doc log script tmp
Gemfile.lock Rakefile config db lib public test vendor</pre>
<p> </p>
<p>So you can see here that using “git status” command we checked out the status of repository and with “git checkout –f” command we made a forced checkout and restored everything as it was before.</p>
<p><font size="3" face="Arial">It’s all for today. Next time we’ll play a little with Github and Heroku. I hope you liked it.</font></p>
<p><font size="2" face="Arial"> </font></p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-19803348443854836102010-11-15T12:20:00.001+02:002010-11-15T12:33:45.333+02:00Climate Change – Think about it for a second<p>At least change electricity bulbs in your house. Everyone should be involved. Thumbs up the video.</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:341795af-458e-4250-8272-ad87fc26b084" class="wlWriterEditableSmartContent"><div id="cdd97c16-d5e3-40b7-b7a0-163f4b107333" style="margin: 0px; padding: 0px; display: inline;"><div><a href="http://www.youtube.com/watch?v=FXntPfWi8H0&feature=related" target="_new"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-d2qbKrE_XJPJXIeKVbXal8pDcjIl9HMagb7QrbLCtHsSccpPk7vnd1A2F70wvGBILixeX7Y_yU8stNG401PTomhWQdAZZxmw3744L0Sz_rrxSGrwe67aobV4uMUBgjiG8rzD7cAoAis/?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('cdd97c16-d5e3-40b7-b7a0-163f4b107333'); downlevelDiv.innerHTML = "<div><object width=\"640\" height=\"360\"><param name=\"movie\" value=\"http://www.youtube.com/v/FXntPfWi8H0?hl=en&hd=1\"><\/param><embed src=\"http://www.youtube.com/v/FXntPfWi8H0?hl=en&hd=1\" type=\"application/x-shockwave-flash\" width=\"640\" height=\"360\"><\/embed><\/object><\/div>";" alt=""></a></div></div></div> <p> </p> <p align="left">Also you can check a lot of internet flash games related to eco-system. <a href="http://clevergames.wordpress.com/2009/10/22/eco-games-top-list-new-%E2%80%9Cgreen%E2%80%9D-online-games-for-the-environment/">For example these games</a>.</p> <p align="left">There is also a game which will be out in 2011 which whole subject is Ecology and disastrous state: <a href="http://www.fateoftheworld.net/">Fate of the World</a>.</p> <p align="left">P.S. You can comment out what exactly do you think we could do, to save the planet, but something doable which depends on us, not those big corporations.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-83453528302967728292010-11-02T01:44:00.000+02:002010-11-03T10:01:19.986+02:00Ruby Challenge 2010: Installing Ruby and its tools on Windows<p>Hi, </p> <p>Today I decided to install all the prerequisites and to show you how I’ve done this, may be for some people it will be useful. And I’m doing it by reproducing the Rails 3.0 tutorial but for Windows.</p> <h6>1. Text editor / IDE</h6> <p>From various IDEs and Unix-style editors like vi or emacs or whatever. I decided to go with a full IDE solution so … the nominees are</p> <ol> <li><a href="http://www.aptana.com/" target="_blank">Aptana Studio 2.0</a> – standalone version </li> <li><a href="http://netbeans.org/downloads/index.html" target="_blank">NetBeans 6.9.1</a> – ruby version </li> <li><a href="http://www.jetbrains.com/ruby/" target="_blank">RubyMine 2.0</a> – from JetBrains (creators of Resharper, TeamCity and a lot of other cool software for programmers). </li> </ol> <p>I wanted to go with RubyMine because I already know the difference Resharper brings in my development process, but it’s a 30-days trial, and I don’t want to switch to something new in next few months, so no. I don’t have previous experience with Aptana Studio, and may be I will try it some day, but I had a pleasant experience with NetBeans so for now I will go with that.</p> <p><a href="http://netbeans.org/downloads/index.html"><img title="NetBeansDownload" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="222" alt="NetBeansDownload" src="http://lh5.ggpht.com/_BWELgx6N3yw/TNAFGTwb2vI/AAAAAAAAAgA/LyI0zhftTpo/NetBeansDownload%5B4%5D.png?imgmax=800" width="378" border="0" /></a> </p> <h6>2. Git</h6> <p>Ruby community uses intensely a <a href="http://en.wikipedia.org/wiki/Revision_control">version control system</a> called <a href="http://git-scm.com/">Git</a>, so I will install it too. For windows part it is very simple. You go to <a href="http://code.google.com/p/msysgit/">http://code.google.com/p/msysgit/</a>. Click “Downloads” and choose current version Git.exe installer.</p> <p><a href="http://code.google.com/p/msysgit/"><img title="DownloadingGitForWindows" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="155" alt="DownloadingGitForWindows" src="http://lh4.ggpht.com/_BWELgx6N3yw/TNAFG74UNuI/AAAAAAAAAgE/pqwQcMhCDnY/DownloadingGitForWindows%5B4%5D.png?imgmax=800" width="564" border="0" /></a> </p> <p>Install process is Windows-style - very simple as well. We don’t have to manually compile something or edit, everything goes quite simple.</p> <p><a href="http://lh6.ggpht.com/_BWELgx6N3yw/TNAFHCBpSwI/AAAAAAAAAgI/4LJFl_IWY7Y/s1600-h/InstallingGit%5B3%5D.png"><img title="InstallingGit" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="241" alt="InstallingGit" src="http://lh5.ggpht.com/_BWELgx6N3yw/TNAFHlLy6VI/AAAAAAAAAgM/gmzhgojQAXs/InstallingGit_thumb%5B1%5D.png?imgmax=800" width="311" border="0" /></a> </p> <h6>3. Installing Ruby</h6> <p>First we need to be sure that our system doesn’t already has Ruby installed. Let’s try it.</p> <pre class="brush: plain;">C:\Users\user_name>ruby -v
'ruby' is not recognized as an internal or external command,
operable program or batch file.</pre>
<p>Well looks like I don’t have it installed. Not a problem. First we’ll install Ruby 1.8.7 which works well with Rails 2.3. We’ll go to <a href="http://www.ruby-lang.org/en/downloads/">Download Ruby</a> page search for “Ruby on Windows” section and select Ruby 1.8.7-p302 RubyInstaller. Installation goes smoothly. I associated my *.rb files with ruby and added Ruby executables to my path.</p>
<p>Now we see this in our command line:</p>
<pre class="brush: plain;">C:\Users\user_name>ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]</pre>
<h6>4. Installing and using Pik</h6>
<p><a href="http://lh3.ggpht.com/_BWELgx6N3yw/TNAFIGM-crI/AAAAAAAAAgU/N6loEj8I95s/s1600-h/pikScreenshot%5B7%5D.png"><img title="pikScreenshot" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 15px 0px 0px; border-right-width: 0px" height="149" alt="pikScreenshot" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg47OmS7Ida2M-bsSB3RVewoE64FY7ciVavu_2TZ27uNrsJl17vdAI3jvnsQuejSaAUk8k0qXaCTMX06KFx0mrTWXdWj8yPvu4Anltsm7EarBmrCmmGI1ZWbfhfRq0j-OtE2JbUpG_tpQg/?imgmax=800" width="145" align="left" border="0" /></a> </p>
<p>What is Pik? Pik is a Windows alternative to <a href="http://rvm.beginrescueend.com/">Ruby Version Manager (RVM)</a> which allows us to have multiple Ruby versions installed at the same time, as I said before we need Ruby 1.8.7 to work with Rails 2.3 and Ruby 1.9.2 to work with Rails 3.0.1 and Pik will help us in dealing with this. You can <a href="http://github.com/vertiginous/pik/">download Pik</a> from github. Also be sure to check its Wiki page <a href="http://github.com/vertiginous/pik/wiki/Usage">“Usage”</a>.</p>
<p>Now when we run the first time pik it adds the default Ruby path which right now points to version 1.8.7. I also set Pik default install directory to “C:\Rubies” and I also show how to add an existing ruby installation to pik with the “add” command.</p>
<pre class="brush: plain;">C:\Users\user_name>pik
** Adding: 187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
Located at: C:\Rubies\Ruby187\bin
Usage: pik command [options]
To get help with a command
pik help (command)
To list all commands and descriptions:
pik help commands
-V, --version Pik version
-d, --debug Outputs debug information
C:\Users\user_name>pik config installs="C:\Rubies"
C:\Users\user_name>pik add C:\Rubies\Ruby-1.9.2dev-p3-i386-mingw32\bin
** Adding: 192: ruby 1.9.2dev (2010-05-31) [i386-mingw32]
Located at: C:\Rubies\Ruby-1.9.2dev-p3-i386-mingw32\bin</pre>
<p>Next I show how to install a Ruby version using “install” command. In my particular case I installed IronRuby specifying the version, and then not specifying it. When you don’t specify it then Pik downloads the latest version. (although at the moment the latest version of IronRuby is 1.1.1, don’t know what is wrong there). Than I show how to list all the available Rubies installations (note that * marks the default ruby used at the moment), how to remove a Ruby install from Pik management, and how to switch to another Ruby installation.</p>
<pre class="brush: plain; collapse: true;">C:\Users\user_name>pik install IronRuby 1.0.0
** Downloading: http://rubyforge.org/frs/download.php/69853/ironruby-1.0.0rc.zi
p
to: C:\Users\user_name\.pik\downloads\ironruby-1.0.0rc.zip
ironruby-1.0.0rc.zip: 100% |ooooooooooooooooooo| 4.7MB/ 4.7MB Time: 00:00:06
** Extracting: C:\Users\user_name\.pik\downloads\ironruby-1.0.0rc.zip
to: C:\rubies\IronRuby-100rc
done
Couldn't find a Ruby version at C:\rubies\IronRuby-100rc\bin
C:\Users\user_name>pik add C:\Rubies\IronRuby-100rc\ironruby\bin
** Adding: 100: IronRuby 1.0.0.0 on .NET 2.0.50727.4454
Located at: C:\Rubies\IronRuby-100rc\ironruby\bin
C:\Users\user_name>pik install IronRuby
** Downloading: http://rubyforge.org/frs/download.php/70181/ironruby-1.0v4.zip
to: C:\Users\user_name\.pik\downloads\ironruby-1.0v4.zip
ironruby-1.0v4.zip: 100% |ooooooooooooooooooooo| 2.9MB/ 2.9MB Time: 00:00:04
** Extracting: C:\Users\user_name\.pik\downloads\ironruby-1.0v4.zip
to: C:\rubies\IronRuby-10v4
done
** Adding: 100: IronRuby 1.0.0.0 on .NET 4.0.30319.1
Located at: C:\rubies\IronRuby-10v4\bin
C:\Users\user_name>pik remove C:\Rubies\IronRuby-100rc\ironruby\bin
Quitting...
C:\Users\user_name>pik help commands
add Adds another ruby location to pik.
benchmark|bench Runs bencmarks with all versions that pik is aware of.
config Adds/modifies configuration options.
default Switches back to the default settings.
devkit Configures devkit settings
gem Runs the gem command with all versions that pik is aware of.
gemsync Synchronizes gems from the version specified to the current ve
rsion.
help Displays help information.
implode Removes your pik configuration.
info|checkup|cu Displays information about the current ruby version.
install|in Downloads and installs different ruby versions.
list|ls Lists ruby versions that pik is aware of.
rake Runs the rake command with all versions that pik is aware of.
remove|rm Removes a ruby location from pik.
ruby|rb Runs ruby with all versions that pik is aware of.
run Runs command with all versions of ruby that pik is aware of.
tag Adds the given tag to the current version.
tags Runs the pik command against the given tags.
uninstall|unin Deletes a ruby version from the filesystem and removes it from
Pik.
update|up updates pik.
use|switch|sw Switches ruby versions based on patterns.
For help on a particular command, use 'pik help COMMAND'.
C:\Users\user_name>pik list
100: IronRuby 1.0.0.0 on .NET 2.0.50727.4454
100: IronRuby 1.0.0.0 on .NET 4.0.30319.1
* 187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
192: ruby 1.9.2dev (2010-05-31) [i386-mingw32]
C:\Users\user_name>pik remove 100
Select which Ruby you want:
1. 100: IronRuby 1.0.0.0 on .NET 2.0.50727.4454
2. 100: IronRuby 1.0.0.0 on .NET 4.0.30319.1
? 1
Are you sure you'd like to remove '100: IronRuby 1.0.0.0 on .NET 2.0.50727.4454'
? |yes|
100: IronRuby 1.0.0.0 on .NET 2.0.50727.4454 removed.
C:\Users\user_name>pik use 192
C:\Users\user_name>pik list
100: IronRuby 1.0.0.0 on .NET 4.0.30319.1
187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
* 192: ruby 1.9.2dev (2010-05-31) [i386-mingw32]</pre>
<p>The only thing that I can’t find is an alternative to RVM –create command which is often convenient to create separate <em>gemsets.</em> </p>
<h6>5. Installing and using RubyGems</h6>
<p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif0V9TPjsmS-LPSU-2ZzJqMEZVypg8Iw2HhID8iZSXAf6Co3klr4RAIlCJDNeXyltCna6EhEucWVT3NjYv8x9jw3SN9l4vvLMnegpKeZXDwSyIvUYKqD65yl1xlXe9BjAfE7uRnchsmCQ/s1600-h/gems%5B5%5D.png"><img title="gems" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 10px 0px; border-right-width: 0px" height="106" alt="gems" src="http://lh3.ggpht.com/_BWELgx6N3yw/TNAFI4Bf5II/AAAAAAAAAgg/iL0nWGotQ-g/gems_thumb%5B3%5D.png?imgmax=800" width="106" align="left" border="0" /></a> </p>
<p><strong>UPDATE: </strong><em>After installing any version of Ruby you already should have RubyGems installed. You can check it up by using <font face="Courier New"><strong>“gem –v”</strong></font> command. I talk about installing RubyGems here just because I was having errors with default installation of gem.</em>  </p>
<p>After everything done I already have gems installed but it has some errors so I will download the latest version from <a href="http://rubyforge.org/frs/?group_id=126">here</a>. After that you unpack it somewhere cd into its directory and say</p>
<pre class="brush: plain;">ruby setup.rb</pre>
<p>Now gems should be installed. Next thing you could do is see what is your Gems environment with <font face="Courier New">“gem env”</font> command, or see the gems sources with <font face="Courier New">“gem sources”</font> command. Finally you could do <font face="courier new">“gem list”</font> for list of local gems, <font face="Courier New">“gem list –r”</font> for remote gems, and <font face="Courier New">“gem list STRING”</font> which will bring you the list of gems starting with string.</p>
<h6>6. Installing Rails</h6>
<p><a href="http://lh5.ggpht.com/_BWELgx6N3yw/TNAFJRXjF3I/AAAAAAAAAgk/vcCwTii2FTE/s1600-h/rails%5B6%5D.png"><img title="rails" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 15px 10px 0px; border-right-width: 0px" height="114" alt="rails" src="http://lh4.ggpht.com/_BWELgx6N3yw/TNAFJ9NUxcI/AAAAAAAAAgo/QIML6rMpHEY/rails_thumb%5B4%5D.png?imgmax=800" width="93" align="left" border="0" /></a> </p>
<p>Now having Gems installed it’s really easy to install Rails. You should just say</p>
<pre class="brush: plain;">gem install rails</pre>
<p>Or </p>
<pre class="brush: plain;">gem install rails --version 3.0.1</pre>
<p>Now everything should be prepared and installed. You can verify it by writing “rails –v” and have the rails version.</p>
<p>Well that’s a lot of things to do, especially if you’re used already with Windows way of installing things. Hope this post will help someone.</p>
<p>Next time we’ll do our first application in RoR (Ruby on Rails), so stay tuned! </p> Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2127794245010916172.post-32115330617739293772010-10-26T23:50:00.000+03:002010-11-02T10:06:16.081+02:00Started learning Ruby<p>Hi,</p> <p>Today I decided to start learning Ruby on Rails 3.0.</p> <p>Why? Well, there are a dozen of reasons but the most important are: </p> <ul> <li>I’ve seen and listened enough about this language and all I’ve heard are positive things, well I assume there are also some negative things like debugging for example (debugging is an issue for a lot of dynamic type languages), </li> <li>also I’d like to be able to make things a little bit more easy. I’d like to do it in a faster manner. I’d also like to have an alternative to .NET, because of its initial costs. </li> <li>Well, also it is because of one of the podcasts I listen, <em><a href="http://thisdeveloperslife.com/">This developer’s life</a></em>. In podcast #5 <a href="http://thisdeveloperslife.com/post/1270441885/1-0-5-homerun">Homerun</a> Rob Conery talks with Rails creator David Heinemeier Hansson about Rails creation and about Rails in general, he seems very excited and is very confident about Rails future. Also one listening <a href="http://streaming.ndc2010.no/tcs/?id=44950364-77F8-49AA-91D7-13441F398DD0">was watching the panel discussion of .NET Rocks! from NDC</a> (Norwegian Developer Conference 2010). There were a lot of .NET folks and also Ruby folks as well, the panel topic was “ASP.NET MVC vs Ruby on Rails”, in the end silently everybody agreed that Ruby is simpler for startups, and it costs less (I mean you don’t need Visual Studio licenses and SQL Servers). </li> <li>They all talk about this great Ruby community which is willing to help you if you will have any problems at all. I want to check that out. </li> <li>I hope understanding more ASP.NET MVC 3 after making something practical in Ruby on Rails. </li> <li>We do have now DLR  and IronRuby 1.0 in .NET so I could use my new set of skills in my usual environment. </li> </ul> <p>Now where should I start from?</p> <p>Assuming that I want to learn fast I found these two videos which apparently enough are very famous in Ruby world, and gave me a taste of what kind of power Ruby is:</p> <div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:b5fd9872-b25d-42f4-bccc-734fd06f0dbd" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div id="046c187a-fb9d-4fc3-bc14-6910f52d9b1b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div><embed src="http://www.youtube.com/v/Gzj723LkRJY?hl=en&hd=1" width="564" height="317" type="application/x-shockwave-flash" /></div> </div> <div style="clear: both; font-size: 0.8em; width: 564px">Rails creator David Heinemeier Hansson shows how to make a blog in 15 minutes using Ruby on Rails</div> </div> <p> </p> <p>And the same kind of video but using already Rails 2.0 (it has 2 parts)</p> <p></p> <div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:abf2af21-b7b5-4179-89ba-21545eb4a840" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div id="194ee373-a008-4096-9b72-006232435bab" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div><embed src="http://www.youtube.com/v/tUH1hewXnC0?hl=en&hd=1" width="407" height="227" type="application/x-shockwave-flash" /></div> </div> <div style="clear: both; font-size: 0.8em; width: 407px">Creating blog in 15 minutes by Ryan Bates Part 1</div> </div> <p></p> <p> </p> <p></p> <div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:c17d2ef8-19dc-4022-80e1-e9a8dba0596b" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div id="6f560bb1-f263-49b7-9522-c3adc3d9bb14" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <div><embed src="http://www.youtube.com/v/zG_mvp8u4cI?hl=en&hd=1" width="412" height="231" type="application/x-shockwave-flash" /></div> </div> <div style="clear: both; font-size: 0.8em; width: 412px">Creating blog in 15 minutes by Ryan Bates Part 2</div> </div> <p></p> <p>Now I must admit that I’ve seen it before using ASP.NET MVC but still I think it is very power. By the way the new ASP.NET MVC 3 is in beta now so you can check it out.</p> <p>I also found a nice site on starting Ruby on Rails 3.0 using all modern tools which are used in the community like Git, GitHub and Heroku. And because it is not too long I’ll start to read these tutorial. <a href="http://railstutorial.org/book/ruby-on-rails-tutorial" target="_blank">Learn Rails by Example</a>.</p> <p>Also to be motivated I’ll need to do something real. Because I’m playing in a strategic web game <a href="http://fr.europe1400.com" target="_blank">fr.europe1400.com</a>, and I’m the founder of the guild there I will try to create a web site for this guild.</p> <p>What should this website include:</p> <ol> <li>Authentication </li> <li>User roles: admin, moderator, others </li> <li>User details </li> <li>Informative section: includes videos, pictures </li> <li>Discussion panel: which is pretty much the same as a forum or blog: someone creates a post and then someone else comment this post. </li> <li>Some admin only functionalities. </li> </ol> <p>Well I hope it won’t take too long till this site will be up and running on Heroku. See ya, hope next time I’ll bring some code.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-59303179018299655432010-10-20T01:30:00.001+03:002010-10-20T01:30:59.069+03:00Tools I can’t imagine my dev life without #2: XSLT Debugger in Visual Studio<p>Hi,</p> <p>While a lot of us .NET developers at some point in our life used XSLT, it was never easy. Of course our logic and XSLT syntax should help us to understand different things but that is not always the case. Probably because it’s almost always a black box abstraction. </p> <p>In my last project we use a lot of XSLT for generating all kind of documents with all kind of restrictions and filtering, usually you have an XML document, you got an XSLT and a <a href="http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx">XslCompiledTransform</a> object which you use to actually get your transformed document. But because of the thing that it is like a black box all you can do is sit back and hope you did well the XSLT thing and you’ll get needed document out of the box. At least this is what I thought until this week.</p> <p>This week I needed to change one of my XSLT document templates, because I was getting a very strange error at document generation. I thought at this moment that I couldn’t do it without debugging and I was <em>hoping </em>that somewhere in the world existed a nice tool which could manage XSLT debugging and which would have at least a trial period. I googled “debug XSLT”, and guess what I found? <a href="http://msdn.microsoft.com/en-us/library/ms255605(v=VS.100).aspx">This link</a> which gave me the power I didn’t even imagined to have without having to install some third-party tools. </p> <p>It is incorporated directly in Visual Studio !!! I tried it in VS 2008 and VS 2010, Visual Studio 2010 even got a profiler for XSLT, so you could measure your transformation sheets and make reports on that. Isn’t that great? Plus you got a lot of way to do debugging. And now some screenshots.</p> <p><a href="http://lh3.ggpht.com/_BWELgx6N3yw/TL4cBZN_hNI/AAAAAAAAAe8/jt-j2KKPUwA/s1600-h/DebugXslt%5B5%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="DebugXslt" border="0" alt="DebugXslt" src="http://lh4.ggpht.com/_BWELgx6N3yw/TL4cCMrBlHI/AAAAAAAAAfA/4kaPJy8S3mM/DebugXslt_thumb%5B3%5D.png?imgmax=800" width="551" height="225" /></a> </p> <p><em>1. While stylesheet open click on XML => Debug Xslt</em></p> <p></p> <p><a href="http://lh6.ggpht.com/_BWELgx6N3yw/TL4cDeP-jLI/AAAAAAAAAfE/2vXVevMcmpk/s1600-h/ChooseXml%5B6%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ChooseXml" border="0" alt="ChooseXml" src="http://lh6.ggpht.com/_BWELgx6N3yw/TL4cD_ega5I/AAAAAAAAAfI/gu_W8qjIQ0M/ChooseXml_thumb%5B4%5D.png?imgmax=800" width="515" height="376" /></a> </p> <p><em>2. Choose input XML file</em></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGSvGMA7N3HkLFXyLwb6IO0i1Mk0XSCwl6JyxE8DxMNC7RHdXbjPvv3O7NcsSvsm8BKa-e0f2jfCLKgxSxwA_142vgrp39KKO3kP62WBb0bxECvZh30mRg2iutjFlDwF3jcX-9PdCDh14/s1600-h/Debugging%5B7%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Debugging" border="0" alt="Debugging" src="http://lh5.ggpht.com/_BWELgx6N3yw/TL4cFwG_pUI/AAAAAAAAAfQ/Fj9NV1NYxzA/Debugging_thumb%5B5%5D.png?imgmax=800" width="761" height="382" /></a> </p> <p></p> <p><em>3. Debug and actually see the magic ! In parallel you can see the output.</em></p> <p>Same things could be done in VS 2010</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4-slELsbG6f24c4VUuroX_2lIfc__HmgWM_b7z8BqzskGy3x40eOGEV9PhJGj84r7Bc1jeRLVrcN2bk5A5G25Jh0wdyWbsw9ty4TvgKrzkOxCkfHqfyQ0_qesE7eCSwgqdOf_1MAbuy8/s1600-h/Visual%20Studio%202010%5B3%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Visual Studio 2010" border="0" alt="Visual Studio 2010" src="http://lh3.ggpht.com/_BWELgx6N3yw/TL4cIXKTIdI/AAAAAAAAAfY/sm-o9E3WUD8/Visual%20Studio%202010_thumb%5B1%5D.png?imgmax=800" width="762" height="377" /></a> </p> <p>And you automatically get the html output. Plus you can always see the source of html.</p> <p>So get ready to a new era of XSLT debugging with all the tools you are used to: Locals, Watches, Immediate Window and others as well.</p> <h6><a href="http://www.humyo.com/FFYdqDF/Code4Food%20Projects/XsltDebugging.zip?a=AVnnpfRkCqE">Link for Download</a></h6> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2127794245010916172.post-18331910481944660612010-04-27T16:23:00.001+03:002010-04-27T16:29:32.989+03:00Code4Food #6: How to join multiple CSV files with the same structure ?<p>Hi,</p> <p>Reading another question on <a href="http://bytes.com/topic/c-sharp/answers/886665-how-join-more-than-two-csv-file" target="_blank">Bytes.com</a> I found this question. So assuming these CSV files have the same structure, I can easily join them.</p> <p>Now to test it I split this CSV file into 5 files: CsvFile1.csv … CsvFile5.csv</p> <pre>"REVIEW_DATE","AUTHOR","ISBN","DISCOUNTED_PRICE"
"1985/01/21","Douglas Adams",0345391802,5.95
"1990/01/12","Douglas Hofstadter",0465026567,9.95
"1998/07/15","Timothy ""The Parser"" Campbell",0968411304,18.99
"1999/12/03","Richard Friedman",0060630353,5.95
"2001/09/19","Karen Armstrong",0345384563,9.95
"2002/06/23","David Jones",0198504691,9.95
"2002/06/23","Julian Jaynes",0618057072,12.50
"2003/09/30","Scott Adams",0740721909,4.95
"2004/10/04","Benjamin Radcliff",0804818088,4.95
"2004/10/04","Randel Helms",0879755725,4.50</pre>
<p>Now I made the program which makes the deal. Nothing to special here, just want to mention you do not need joining multiple times the column headers.</p>
<pre class="brush: c#">using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.IO;
using System.Text;
namespace CsvJoiner
{
static class Program
{
public static void Main()
{
string[] csvFileNames = Directory.GetFiles(".", "CsvFile*.csv");
JoinCsvFiles(csvFileNames, "CsvOutput.csv");
}
private static void JoinCsvFiles(string[] csvFileNames, string outputDestinationPath)
{
StringBuilder sb = new StringBuilder();
bool columnHeadersRead = false;
foreach (string csvFileName in csvFileNames)
{
TextReader tr = new StreamReader(csvFileName);
string columnHeaders = tr.ReadLine();
// Skip appending column headers if already appended
if (!columnHeadersRead)
{
sb.AppendLine(columnHeaders);
columnHeadersRead = true;
}
sb.AppendLine(tr.ReadToEnd());
}
File.WriteAllText(outputDestinationPath, sb.ToString());
}
}
}</pre>
Now I'll show the output. To check out this project
<h6><a href="http://www.humyo.com/9591867/Code4Food%20Projects/CsvJoiner.zip?a=Vat1zdkffG0" target="_blank">download the sources here</a></h6>
<pre>"REVIEW_DATE","AUTHOR","ISBN","DISCOUNTED_PRICE"
"1985/01/21","Douglas Adams",0345391802,5.95
"1990/01/12","Douglas Hofstadter",0465026567,9.95
"1998/07/15","Timothy ""The Parser"" Campbell",0968411304,18.99
"1999/12/03","Richard Friedman",0060630353,5.95
"2001/09/19","Karen Armstrong",0345384563,9.95
"2002/06/23","David Jones",0198504691,9.95
"2002/06/23","Julian Jaynes",0618057072,12.50
"2003/09/30","Scott Adams",0740721909,4.95
"2004/10/04","Benjamin Radcliff",0804818088,4.95
"2004/10/04","Randel Helms",0879755725,4.50</pre> Unknownnoreply@blogger.com2