tag:blogger.com,1999:blog-62718410569648769842024-03-06T09:17:32.546+01:00Zeta Orioniscluster your knowledge...zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-6271841056964876984.post-41364035336822360142020-08-07T15:56:00.001+02:002020-08-07T16:10:21.258+02:00Block particular application from accessing internet Ubuntu 20.04<p>Create group no-internet. Members of this group will work in offline mode. <br />$ sudo addgroup no-internet</p><p>Allow members of no-internet group to use sudo without password.<br />$ sudo visudo</p><p>Add this line at then end and save changes:<br />%sudo ALL=(:no-internet) NOPASSWD: ALL</p><div><div>Allow everyone to change iptables rules:</div><div>$ which iptables</div><div>/usr/sbin/iptables</div><div>$ readlink -f /usr/sbin/iptables</div><div>/usr/sbin/xtables-legacy-multi</div><div>$ ls -l /usr/sbin/xtables-legacy-multi</div><div>-rwxr-xr-x 1 root root 99296 Feb 28 15:16 /usr/sbin/xtables-legacy-multi</div><div>$ sudo chmod u+s /usr/sbin/xtables-legacy-multi</div><div>$ ls -l /usr/sbin/xtables-legacy-multi</div><div>-rwsr-xr-x 1 root root 99296 Feb 28 15:16 /usr/sbin/xtables-legacy-multi</div><div><br /></div><div>Add iptables rules for no-internet group</div><div>$ iptables -A OUTPUT -m owner --gid-owner no-internet -j DROP</div><div>$ ip6tables -A OUTPUT -m owner --gid-owner no-internet -j DROP</div><div><br /></div><div>Create store directory for iptables rules and change ownership to current user and it's group:</div><div>$ sudo mkdir /etc/iptables</div><div>$ sudo chown -Rv 1000:1000 /etc/iptables</div><div><br /></div><div>Save iptables entries to created directory:</div><div>$ iptables-save > /etc/iptables/rules.v4</div><div>$ ip6tables-save > /etc/iptables/rules.v6</div><div><br /></div><div>Install application you want to block, for example:</div><div>$ sudo snap install phpstorm</div><div><br /></div><div>Copy application desktop launcher to local desktop launchers so we can override it:</div><div>$ cp /var/lib/snapd/desktop/applications/phpstorm_phpstorm.desktop ~/.local/share/applications/</div><div><br /></div><div>Edit local desktop launcher and set Exec line to: sh -c "iptables-restore < /etc/iptables/rules.v4; ip6tables-restore < /etc/iptables/rules.v6; sudo -g no-internet existing-exec-command". For example:</div><div>$ vi ~/.local/share/applications/phpstorm_phpstorm.desktop</div><div><br /></div><div>Exec=sh -c "iptables-restore < /etc/iptables/rules.v4; ip6tables-restore < /etc/iptables/rules.v6; sudo -g no-internet env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/phpstorm_phpstorm.desktop /snap/bin/phpstorm %f"</div></div><div><br /></div>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-245397506489140182016-09-05T22:56:00.000+02:002016-09-06T19:08:06.005+02:00Teambuildings, conferences and pulling your hair out over simple update<div dir="ltr" style="text-align: left;" trbidi="on">
So, you've been invited to spend a weekend with your <a href="http://am2studio.hr/">company</a> colleagues. There is also a <a href="https://2016.split.wordcamp.org/">conference</a> event scheduled at destination. You can learn something, meet new people, exchange ideas, have fun. Well yes, splendid, lets do this.<br />
<br />
Early morning, still dark, driving by bus. Developers like developers, still dreaming without it's first coffee. So everyone got back to sleep. First words could be heard over a coffee on a gas station. And adventure begins...<br />
<br />
Arrived at our destination. Smell of sea, fresh wind and warm sun were so overwhelming so decision has been made to go to beach and relax first. Couple of drinks and conversations are on fire. Couple of minutes later, first phones got into action with some texting and taking photos. Amazing how we made without them so far :)<br />
<br />
Next step conference. While listening to presentations of various subjects I've decided to take some time and update my Tumbleweed. Of course you don't do it on work days and weekends you use for some other activities so it was a perfect time. Well at least it was looked like one... :)<br />
<br />
Booted my openSuSE Tumbleweed, set valid repositories and with confidence started Software application and clicked 'Update and Restart' under Updates section. Fast restart, and then hang on boot.. Waited for couple of minutes. Nothing. WiFi for sure, I was thinking. Never mind, lets do this again manually with zypper.<br />
<br />
Restart has booted it again. Started zypper update process.<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ zypper up</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
And here we go. God ol' zypper working just fine. 1/1227 packages. Well that will take some time. And than it showed error stating he can't write to disk. Why not? Let's try again. This time only 200 packages. Should be fast. Going nicely and again at the end same error. So you can download and install some packages but others can't? Is it a repo problem?<br />
Oh, presentation is over. Launch time, never-mind I'll continue later..<br />
<br />
Conference day was coming to the end. One more try and now I got error again stating can't write to disk but this time on first package. Than in occurred to me to check disk. Quick:<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ df -h </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">Filesystem Size Used Avail Use% Mounted on</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">/dev/sdb6 40G 39G 50MB 100% /</span><br />
<div>
<br /></div>
So it was problem all along. Trying to delete some unused journal logs to free some space.<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ journalctl --vacuum-time=0d</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ df -h </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">Filesystem Size Used Avail Use% Mounted on</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">/dev/sdb6 40G 36G </span><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">50MB</span><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> 100% /</span><br />
<div>
<br /></div>
Hm, I have available space but usage is on 100%? Is my filesystem corrupted?<br />
No, as it turns out root is on btrfs partition and it behaves differently as opposed to traditional filesystems. It has the concept of allocating space on the underlying device, but not actually using it for files.<br />
<br />
Also root partition was filled with update snapshots. To check the problem volume use:<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ btrfs subvolume list /</span><br />
<br />
To delete snapshot you do not need use:<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">$ btrfs subvolume delete -c path</span><br />
<br />
Where path is from previous command subvolume list that says "snapshot". We are using -c flag to commit changes immediately to btrfs file system.<br />
Finally, after reboot zypper update passes.<br />
<div>
<br /></div>
<div>
Last presentation is over, and this reminds me again why I don't do updates on work days :D</div>
<a href="https://www.youtube.com/watch?v=3zoXJLrhu2A">And now, after-party and some team strengthening time.</a><br />
Until next time, happy updating ;)</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-35660889941688803912016-04-15T22:00:00.004+02:002016-04-16T08:19:47.032+02:00Acer R5 471T and Tumbleweed/Windows dual boot<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="separator" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;">
<img border="0" height="273" src="https://s2.graphiq.com/sites/default/files/840/media/images/_7008994.jpg" width="320" /></div>
<br />
First what you notice is that laptop is very slim design. Keyboard looks so thin, make you think they don't actually move while typing at all :) But when you start to type, it is really great! Screen is very glossy so even a smallest light reflection will make you move your head to proper angle. But it is great for indoor use.<br />
<br />
After pushing power button, Windows has booted in couple of seconds. Great, everything works, even keyboard back-light and multi touch screen! And now let's install Linux along with installed Windows 10.<br />
<br />
First install <a href="http://www.partition-tool.com/personal.htm">partition manager</a> and resize 250GB parition to 150GB to make 100GB of unpartitioned space.<br />
<br />
Next you want to make a USB installation stick. For OpenSUSE Tumbleweed you need to use <a href="http://www.osforensics.com/tools/write-usb-images.html">ImageUSB</a>.<br />
Download Tumbleweed DVD ISO image from <a href="https://en.opensuse.org/openSUSE:Tumbleweed_installation">HERE</a>.<br />
<br />
Stick your flash drive with Tumbleweed installation to usb slot. Enter BIOS with F2 end enable Boot select with F12, or continue to Boot section and move USB Flash drive to first position.<br />
<br />
After that installation will start. Because we have UEFI secure boot enabled it will ask us for confirmation to trust opensuse binaries for booting. After that installation will find unpartitioned space and suggest partition setup for root, home and swap paritions. Also it will set a boot mount point to EFI boot partition. This will install EFI binaries to proper place inside EFI boot parition.<br />
<br />
After installation is finished it will reboot to windows again. It is because windows is overriding grub boot settings. To get around this open command prompt as administrator and execute:<br />
<blockquote class="tr_bq">
<strong style="background-color: white; border: 0px; font-family: 'Open Sans', sans-serif; font-size: 13.92px; line-height: 22.272px; margin: 0px; outline: 0px; padding: 0px;">bcdedit /set {bootmgr} path \EFI\opensuse\shim.efi</strong></blockquote>
<br />
Finally grub menu! Tumbleweed has booted but WiFi is not showing any networks found, and it says WiFi not available.<br />
<blockquote class="tr_bq">
$ sudo lspci</blockquote>
01:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)<br />
<br />
There is problem in firmware for this WiFi card and it does not work with 4.5.x kernel.<br />
Solution is to download <a href="https://bugzilla.kernel.org/attachment.cgi?id=196391">Windows firmware binary</a> and replace it with current linux version like so:<br />
<br />
<blockquote class="tr_bq">
$ sudo cp /lib/firmware/ath10k/QCA6174/hw3.0/board.bin /lib/firmware/ath10k/QCA6174/hw3.0/board.bin.orig<br />
$ sudo mv ~/Downloads/eeprom_ar6320_3p0_NFA364xp.bin /lib/firmware/ath10k/QCA6174/hw3.0/board.bin<br />
$ sudo reboot</blockquote>
<br />
Finally fully operative dual boot!<br />
Enjoy!</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-84593831461064719722016-03-02T15:24:00.000+01:002016-03-06T11:22:55.807+01:00AngularJS Single Page App with Laravel API<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Idea is to create Single Page App in AngularJS to demonstrate basics such as:<br />
<br />
<ul style="text-align: left;">
<li>custom directives</li>
<li>routing capabilities using hashtag</li>
<li>controllers for particular routes</li>
<li>making HTTP requests and handling responses</li>
<li>CRUD operations on frontend and API calls to the backend</li>
<li>uploading a file/image</li>
<li>pagination and accordion Boostrap UI components</li>
</ul>
<div>
<div class="separator" style="clear: both; text-align: center;">
<img border="0" height="180" src="https://www.codetutorial.io/wordpress/wp-content/uploads/2015/02/angularLaravel-1.jpg" width="320" /></div>
<div>
<br /></div>
<div>
AngularJS SPA files:</div>
<div>
<ul style="text-align: left;">
<li>resources/views/index.blade.php</li>
<li>public/js/module/module_spa.js</li>
</ul>
<div>
Complete code can be found <a href="http://github.com/momic/musicarchive">HERE</a>.</div>
<div>
<br /></div>
<div>
Step by step Laravel work log for backend, can be found <a href="http://bit.ly/1oYeP7t">HERE</a>.</div>
</div>
</div>
</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-5434907030029279302016-02-18T10:05:00.001+01:002016-03-11T17:12:25.869+01:00PHP solutions for Codility lessons<div dir="ltr" style="text-align: left;" trbidi="on">
<pre style="box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"></pre>
<pre style="box-sizing: border-box; color: #333333; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Hi Codilitiers!</span></pre>
<pre style="box-sizing: border-box; color: #333333; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"></pre>
<pre style="box-sizing: border-box; font-stretch: normal; overflow: auto; text-align: justify;"><span style="color: #333333; font-family: "arial" , "helvetica" , sans-serif; font-size: 15px; white-space: pre-wrap;">I want to share with you solutions for Codility lessons as result of my preparations for Codility test. If you are using PHP to go through <a href="https://codility.com/programmers/lessons/">Codility lessons</a> and tasks, <a href="https://github.com/momic/php-codility">THIS COULD HELP</a>.</span></pre>
<pre style="box-sizing: border-box; font-stretch: normal; overflow: auto;"><span style="color: #333333; font-family: "arial" , "helvetica" , sans-serif; font-size: 15px; white-space: pre-wrap;">
</span></pre>
<h3 style="box-sizing: border-box; font-stretch: normal; overflow: auto; text-align: center;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://github.com/momic/php-codility">PHP-Codility</a></span></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://codility.com/programmers/lessons/"><img border="0" height="70" src="https://codility.com/static/nux-img/logo.jpg" width="200" /></a></div>
<pre style="box-sizing: border-box; font-stretch: normal; overflow: auto;"><span style="color: #333333; font-family: "arial" , "helvetica" , sans-serif; font-size: 15px; white-space: pre-wrap;">
</span></pre>
<pre style="box-sizing: border-box; font-stretch: normal; overflow: auto;"><span style="color: #333333; font-family: "arial" , "helvetica" , sans-serif; font-size: 15px; white-space: pre-wrap;"><a href="https://codility.com/programmers/lessons/">Codility tasks</a> have been solved using PHP as preparation for <a href="http://www.toptal.com/">TopTal</a>.</span></pre>
<pre style="box-sizing: border-box; color: #333333; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"><span style="font-family: "arial" , "helvetica" , sans-serif;">There could be multiple 100% solutions for particular task and
there are separated partial solutions in ./partial folder which
represents solutions before perfect score was hit.</span></pre>
<pre style="box-sizing: border-box; color: #333333; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"></pre>
<pre style="box-sizing: border-box; color: #333333; font-size: 15px; font-stretch: normal; overflow: auto; white-space: pre-wrap;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Hope it helps!</span></pre>
</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-70928314815158354322016-02-18T09:50:00.000+01:002016-03-11T17:16:27.367+01:00Play Chrome Chess at work<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="background-color: #fefefe; font-size: 14px; line-height: 20px; white-space: pre-wrap;">As a practice in NodeJS/SocketIO I've made simple Chrome extension to play chess online with your friends. It is still in beta but I will continue with development and support as much as spare time allows it.</span></span></div>
<div style="text-align: center;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="background-color: #fefefe; font-size: 14px; line-height: 20px; white-space: pre-wrap;"><a href="https://chrome.google.com/webstore/detail/chrome-chess/hpahaceigpcebiefmijneimenbgbcjcn">Chrome Chess</a></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="background-color: #fefefe; font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://chrome.google.com/webstore/detail/chrome-chess/hpahaceigpcebiefmijneimenbgbcjcn"><img border="0" height="252" src="https://raw.githubusercontent.com/momic/boardgame/master/screenshots/SmallPromotionalTile.png" width="400" /></a></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="background-color: #fefefe; font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;">ChromeChess is simple PVP version of good old chess where game of chess is just click away. </span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;">This extension acts as simple chess user interface inside small popup window.</span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="background-color: #fefefe; font-size: 14px; line-height: 20px; white-space: pre-wrap;"></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;">So, basically you can continue your daily work inside Chrome while still playing chess. When opponent makes his move you will be notified so you can open chess board and make your move.</span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;">Hope you like it. Enjoy!</span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #212121; font-family: "roboto" , "robotodraft" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px; line-height: 20px; white-space: pre-wrap;">P.S. For developers that want to help with development you can find me <a href="https://github.com/momic/boardgame">HERE</a>.</span></span></div>
<div style="text-align: justify;">
<br /></div>
</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-9483481588379435442015-12-26T01:33:00.001+01:002016-03-03T09:00:32.929+01:00Ready for freelancing?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
I’ve been a professional software/web developer for more than a decade, and up until now I mostly worked as full time employee in several companies and one contracting project as freelancer, where I gained expertise in many technologies and Scrum Master management skills. Latest technologies were mostly web development oriented.<br />
<br /></div>
<div style="text-align: justify;">
After a decade of my professional life I could say that full time corporate job is right choice if you don't have much experience or you just got out of school. After gaining initial experience in corporate jobs, you will want to make portfolio populated with projects you have worked on. You will need a portfolio to show to future clients that you are right choice for them. Experience proves both client and you that you are capable of finishing projects.<br />
<br /></div>
<div style="text-align: justify;">
After that you could try yourself working by contract or as freelancer, having flexible working hours, where the end result counts. You need to have self-discipline to work when needed and be reliable and responsible while communicating to clients. This will also help you make time to stay sharp and in step with technology edge, because you are in control of your availability. All this is just what I always wanted so I decided that it is time to dive into freelance world.<br />
<br /></div>
<div style="text-align: justify;">
In corporate culture, if you think in terms of financial part of software and its price, then of course you would like to finish it ASAP to reduce its cost. Companies driven by that notion only, will often threat its developers as necessary evil. For those companies, it is not the product that is in focus and value it brings to client, but rather the points of contracted work and its unreasonable deadlines.<br />
<br /></div>
<div style="text-align: justify;">
Often under management pressure to follow deadlines, developers reduce products quality to gain speed. Not the career plan you would like to follow, because you don't have time to improve and work is not fun in such stressed environments.<br />
<br /></div>
<div style="text-align: justify;">
Then I searched for freelance market sites. And I found sites like UpWork and Elance which are great but they don't guarantee you constant work because first you need to build your reputation and even than you have to compete with some very low unreasonable offers.<br />
<br /></div>
<div style="text-align: justify;">
If only there could be some intermediate which will connect self-organizing teams of professionals with right customers, willing to pay for good quality product along with reasonable deadlines (so we don't need to compete with immoral offers to jobs like to make a copy of popular social network for 30$, or less, in couple of days). With financial aspect covered, team job is to handle time and quality aspect and gets job done. Team than incrementally develops software and brings value to customer so they together can steer product in right direction.<br />
<br /></div>
<div style="text-align: justify;">
And then I heard of <a href="http://www.toptal.com/web">TopTal</a> while attending presentation with freelancing as topic. It was scheduled at gathering of developer community of Banja Luka. Ines Avdic Zekic from Sarajevo held informative presentation about TopTal. Less than 3% passes screening process, she said. Nobody likes to be tested, but if this is what I have to pass to put financial aspect in background than by all means, let’s do this.<br /></div>
<div style="text-align: justify;">
<h4>
Why join TopTal?</h4>
</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>If you pass TopTal screening process, then <u>TopTal stands for you</u>. TopTal takes care of finding jobs and paying you upon completed work, even in such cases where the customer refuses to pay. Take worries about not being paid away, and just commit yourself to finish your job.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Yours is to <u>get job done</u>. Money should be just a side effect of your work.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>You can set higher or lower price per hour and frequency of jobs you receive will depend on that. <u>Higher the price per hour, lower frequency of jobs</u>.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>It enables you to <u>connect with other freelance professionals</u> and do work together for TopTal trusted customers and companies.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>You are<b> </b><u>not tied to location</u>, as long as you have reliable internet connection.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Market is dictating new technologies, and that technology edge is exactly what you want to learn and contribute in. <u>TopTal enables you to grow</u> as IT professional. It provides you with courses and webinars to learn technologies with highest demand on market. </div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>It enables you to <u>grow your software using edge technologies</u> to bring better value to its users. You don’t wont to end up in companies just to maintain some piece of software until time and new technologies overrun them.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span><u>Availability and commitment can be changed</u>. Your availability varies and you can reduce your availability while you are travelling or on vacation, and also increase it when you are eager to work.</div>
<div style="text-align: justify;">
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Working 9-5 is not necessary what will bring the most out of developer. I want to use morning hours for work because I'm well rested. Then after lunch I could take a nap, do some physical activities and then go back to work and finish work refreshed and sharp minded.<br />
<br /></div>
<div style="text-align: justify;">
In Banja Luka, there is still no developers working for TopTal. This would be a great opportunity to make a first step to connect TopTal with talented developers from this region and Banja Luka developer’s community. What I’ve heard so far, convinced me more that TopTal is right fit for me. I’m eager to learn new technologies and improve myself through active communication with TopTal clients and deliver them good piece of useful software. Later on my ambitions would be to gather people around me so we could provide TopTal services in a wide range of technologies as a self-organized team.<br />
<br /></div>
<div style="text-align: justify;">
Now I'm heading back to <a href="https://codility.com/programmers/lessons/">Codility</a> for some more practice. TopTal is also providing <a href="http://www.toptal.com/php">guide for interviewing PHP developers</a>.<br />
<br /></div>
<div style="text-align: justify;">
Wish me luck!</div>
<div style="text-align: justify;">
<br /></div>
</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-43730069282893024862015-07-14T21:59:00.001+02:002015-07-17T15:14:53.811+02:00Simple blog using Laravel - Part I<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Migrations</h2>
<div>
Create articles migration:</div>
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ php artisan make:migration create_articles_table --create="articles"</span></blockquote>
Inside database/migrations find created migration and edit:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">2015_07_13_192755_create_articles_table.php</span></blockquote>
and add these lines to up() method:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Schema::create('articles', function (Blueprint $table) {</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->increments('id');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->string('title');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->text('body');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->text('excerpt')->nullable();</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->timestamp('published_at');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $table->timestamps();</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">});</span></blockquote>
To execute created migration do:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ php artisan migrate</span></blockquote>
<h2 style="text-align: left;">
Routes</h2>
Edit<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">app\Http\routes.php</span></blockquote>
and add this line:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::resource('articles', 'ArticlesController');</span></blockquote>
Which is easier way and equal to manually supply all CRUD routes following REST convention like so:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::get('articles', 'ArticlesController@index');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::get('articles/create', 'ArticlesController@create');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::get('articles/{id}', 'ArticlesController@show');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::post('articles', 'ArticlesController@store');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::get('articles/{id}/edit', 'ArticlesController@edit');</span></blockquote>
<h2 style="text-align: left;">
Model</h2>
We have articles table, so lets create Article model:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ php artisan make:model Article</span></blockquote>
Edit our model <span style="font-family: Verdana, sans-serif; font-size: x-small;">app\Article.php</span> and add <span style="font-family: Verdana, sans-serif; font-size: x-small;">$fillable</span> fields so we can mass assign them while creating article. Also specify <span style="font-family: Verdana, sans-serif; font-size: x-small;">published_at</span> field inside <span style="font-family: Verdana, sans-serif; font-size: x-small;">$dates</span> so Laravel threat this field as Carbon date object instead of simple string representation.<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">class Article extends Model</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">{</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> protected $dates = ['published_at'];</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> protected $fillable = [</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>'title',</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>'body',</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>'published_at'</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> ];</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">}</span></blockquote>
<br />
Add two rows to article table using Laravel interactive tinker tool:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ php artisan tinker;</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ App\Article::create(['title' => 'My first article', 'body' => 'Article body', 'published_at' => Carbon\Carbon::now()]);</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ App\Article::create(['title' => 'New article', 'body' => 'New body', 'published_at' => Carbon\Carbon::now()]);</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ App\Article::all();</span></blockquote>
Update first article:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$article = App\Article::find(1);</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$article->body = 'Lorem ipsum';</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$article->save();</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">App\Article::all();</span></blockquote>
Get collection of articles:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$articles = App\Article::where('body','Lorem ipsum')->get();</span></blockquote>
Get first article:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$article = App\Article::where('body','Lorem ipsum')->first();</span></blockquote>
<h2 style="text-align: left;">
Controller</h2>
Let's create plain ArticlesController:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">$ php artisan make:controller ArticlesController --plain</span></blockquote>
So now we will create index action to fetch list of articles.<br />
Edit <span style="font-family: Verdana, sans-serif; font-size: x-small;">app\Http\Controllers\ArticlesController.php:</span><br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">public function index()</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">{</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $articles = Article::latest('published_at')->published()->get();</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> return view('articles.index', compact('articles'));</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">}</span></blockquote>
We want to use <span style="font-family: Verdana, sans-serif; font-size: x-small;">published()</span> scope while fetching articles to get only those published until today and sort them descending from newest to oldest by <span style="font-family: Verdana, sans-serif; font-size: x-small;">published_at</span> using <span style="font-family: Verdana, sans-serif; font-size: x-small;">latest()</span>. So let's create <span style="font-family: Verdana, sans-serif; font-size: x-small;">published()</span> scope in <span style="font-family: Verdana, sans-serif; font-size: x-small;">app\Article.php</span> model. Notation is keyword scope followed by scope name, like this:<br />
<blockquote class="tr_bq">
use Carbon\Carbon;<br />
public function scopePublished($query)<br />
{<br />
$query->where('published_at', '<=', Carbon::now());<br />
}</blockquote>
To show details of selected article we need show() action. Edit <span style="font-family: Verdana, sans-serif; font-size: x-small;">app\Http\Controllers\ArticlesController.php:</span><br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">public function show($id)</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">{</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> $article = Article::findOrFail($id);</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> return view('articles.show', compact('article'));</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">}</span></blockquote>
<h2 style="text-align: left;">
View</h2>
<div>
Inside <span style="font-family: Verdana, sans-serif; font-size: x-small;">resources</span> folder create <span style="font-family: Verdana, sans-serif; font-size: x-small;">app.blade.php:</span></div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><!doctype html></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><html lang="en"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><head></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><meta charset="UTF-8"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><title>Document</title></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></head></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><body></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><div class="container"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@yield('content')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></div></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"></span>@yield('footer')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></body></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></html></span></blockquote>
<div>
<span style="font-family: inherit;">Inside </span><span style="font-family: Verdana, sans-serif; font-size: x-small;">resources\articles</span><span style="font-family: inherit;"> create </span><span style="font-family: Verdana, sans-serif; font-size: x-small;">index.blade.php</span><span style="font-family: inherit;">:</span></div>
</div>
<div>
<blockquote class="tr_bq" style="text-align: left;">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@extends('app')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@section('content')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><div class="col-md-12 staff-header"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><h5>Articles</h5></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></div></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><div class="col-xs-12 col-md-12"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@foreach( $articles as $article)</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><article></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><h4></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><a href="{{ action('ArticlesController@show', [$article->id]) }}">{{ $article->title }}</a></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></h4></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><h6>{{ $article->body }}</h6></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><br/></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></article></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@endforeach</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></div></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@stop</span></blockquote>
<div>
Inside <span style="font-family: Verdana, sans-serif; font-size: x-small;">resources\articles</span> create <span style="font-family: Verdana, sans-serif; font-size: x-small;">show.blade.php</span>:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@extends('app')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@section('content')</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">div class="col-md-12 staff-header"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">h5>{{ $article->title }}</span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">/h5></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">/div></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">div class="col-xs-12 col-md-12"></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">article></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">h6>{{ $article->body }}</span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">/h6></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">/article></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><</span><span style="font-family: Verdana, sans-serif; font-size: x-small;">/div></span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">@stop</span></blockquote>
</div>
</div>
</div>
zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-67310103680850582532015-06-30T23:53:00.000+02:002015-07-13T21:21:57.926+02:00Laravel on Debian Wheezy<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<span style="font-weight: normal;">
LAMP</span></h3>
First we need LAMP packages installed.<br />
Laravel requires PHP >= 5.5.9 so we will install php56.<br />
<br />
Add package repositories to apt sources. <br />
Edit sources.list<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi /etc/apt/sources.list</span></blockquote>
and add these two lines:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">deb http://packages.dotdeb.org wheezy-php56 all</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">deb-src http://packages.dotdeb.org wheezy-php56 all</span></blockquote>
<br />
Add dotdeb.gpg key so apt can authenticate packages from added sources.<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ cd</span><br />
<span style="font-family: Verdana, sans-serif;">$ wget http://www.dotdeb.org/dotdeb.gpg</span><br />
<span style="font-family: Verdana, sans-serif;">$ apt-key add dotdeb.gpg</span><br />
<span style="font-family: Verdana, sans-serif;">$ apt-get update</span></blockquote>
<br />
Install Apache, MySQL and PHP<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ apt-get install mysql-server mysql-client</span><br />
<span style="font-family: Verdana, sans-serif;">$ apt-get install apache2</span><br />
<span style="font-family: Verdana, sans-serif;">$ apt-get install php5 libapache2-mod-php5 php5-mcrypt</span></blockquote>
<br />
Enable rewrite apache modul<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ a2enmod rewrite</span><br />
<span style="font-family: Verdana, sans-serif;">$ /etc/init.d/apache2 restart</span></blockquote>
<br />
Confirm that php is working well with apache by creating info.php file:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi /var/www/info.php</span></blockquote>
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></span>add this line:<br />
<blockquote class="tr_bq">
<?php phpinfo(); ?></blockquote>
Access inside browser: http://localhost/info.php<br />
<br />
<h3 style="text-align: left;">
<span style="font-weight: normal;">
Laravel</span></h3>
# To install laravel we need composer:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ sudo curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer</span></blockquote>
<br />
* Use composer to install laravel:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ composer global require "laravel/installer=~1.1"</span></blockquote>
<br />
* Add laravel bin to your PATH so you can use laravel executable from any location. Edit bash_profile file:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi ~/.bash_profile</span></blockquote>
and add these lines:
<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">PATH=$PATH:~/.composer/vendor/bin</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">export PATH</span></blockquote>
<br />
* Create new base for web application<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ cd ~/NetBeansProjects</span><br />
<span style="font-family: Verdana, sans-serif;">$ laravel new LaravelDemo</span></blockquote>
<br />
# Or we could skip installing laravel and using it's executable to create base for web application (steps marked with asterisk *), and go ahead do all that with composer directly:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ rm -rf ~/NetBeansProjects/LaravelDemo</span><br />
<span style="font-family: Verdana, sans-serif;">$ cd ~/NetBeansProjects</span><br />
<span style="font-family: Verdana, sans-serif;">$ composer create-project laravel/laravel LaravelDemo --prefer-dist</span></blockquote>
<br />
# Create Apache VirtualHost by:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi /etc/apache2/sites-available/laraveldemo.org</span></blockquote>
and add these lines:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">ServerAdmin webmaster@laraveldemo.org</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">ServerName laraveldemo.org</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">ServerAlias *.laraveldemo.org</span><br />
<br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">DocumentRoot /home/{user}/NetBeansProjects/LaravelDemo/public</span><br />
<br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> Options Indexes FollowSymLinks MultiViews</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> AllowOverride All</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> Order allow,deny</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> allow from all</span><br />
<br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">ErrorLog ${APACHE_LOG_DIR}/laraveldemo_error.log</span><br />
<br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"># Possible values include: debug, info, notice, warn, error, crit,</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"># alert, emerg.</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">LogLevel warn</span><br />
<br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">CustomLog ${APACHE_LOG_DIR}/laraveldemo_access.log combined</span></blockquote>
</div>
<span style="font-family: Verdana, sans-serif; font-size: x-small;"></span><br />
# Enable virtual host:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ a2ensite laraveldemo.org</span></blockquote>
<br />
# Add virtual host to hosts file by editing:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi /etc/hosts</span></blockquote>
add this line:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">127.0.0.1 laraveldemo.org</span></blockquote>
<br />
# Restart apache<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ service apache2 restart</span></blockquote>
<br />
# Create simple /about route and appropriate controller, action and view<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ cd ~/NetBeansProjects/LaravelDemo</span><br />
<span style="font-family: Verdana, sans-serif;">$ vi app/Http/routes.php </span></blockquote>
add this line to routes.php:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Route::get('about', 'PagesController@about');</span></blockquote>
<br />
# Create PagesController by:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ php artisan make:controller PagesController --plain<br />$ vi app/Http/Controllers/PagesController.php</span> </blockquote>
add about() method to PagesController.php:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> public function about() {</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>return view('about');</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;"> }</span></blockquote>
<br />
# Create about view by editing about.blade.php:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi resouces/views/about.blade.php</span></blockquote>
add this line:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">Hello World</span></blockquote>
<br />
# Make local configuration<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ copy .env.example to .env</span></blockquote>
<br />
# Generate app key<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ php artisan key:generate</span></blockquote>
<br />
# Set Directory Permissions<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ cd ~/NetBeansProjects/LaravelDemo</span><br />
<span style="font-family: Verdana, sans-serif;">$ chgrp www-data -Rv storage/</span><br />
<span style="font-family: Verdana, sans-serif;">$ chmod g+w -Rv storage/</span><br />
<span style="font-family: Verdana, sans-serif;">$ cd bootstrap/</span><br />
<span style="font-family: Verdana, sans-serif;">$ chgrp www-data -Rv cache</span><br />
<span style="font-family: Verdana, sans-serif;">$ chmod g+w -Rv cache</span><br />
</blockquote>
<br />
Test it by pointing browser to:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">http://laraveldemo.org/about</span></blockquote>
<br />
Create database<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">mysql> create database laraveldemo;</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">mysql> CREATE USER 'laraveldemouser'@'localhost' IDENTIFIED BY 'laraveldemopass';</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">mysql> GRANT ALL ON laraveldemo.* TO 'laraveldemouser'@'localhost';</span></blockquote>
<br />
# Add mysql authentication data to .env<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">$ vi .env</span></blockquote>
change these lines:<br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif; font-size: x-small;">DB_HOST=localhost</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">DB_DATABASE=laraveldemo</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">DB_USERNAME=laraveldemouser</span><br />
<span style="font-family: Verdana, sans-serif; font-size: x-small;">DB_PASSWORD=laraveldemopass</span></blockquote>
</div>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-9554502455757647162010-08-09T23:10:00.017+02:002010-09-08T09:08:04.567+02:00How to load/write XML using JAXB?<div style="text-align: justify;">Every now and then you need to load or write some XML files. It is very effective way to put data in machine-readable form. XML is text format file which is well formatted using standardized rules.<br /></div><br />So to demonstrate use of JAXB we will:<br />1) create XML file with some data (<a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOZGQyMjY4MjctYTZmNS00ZTI1LTg3OWMtNWIxYmEwNTAzYjlk&hl=en">bookmarks.xml</a>)<br />2) create XML schema file to validate our XML file (<a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOOTE4NjgxMGMtNTFhZS00ZmFmLWFjODgtNjc4MzQ3NTAwNmMx&hl=en">bookmarks.xsd</a>)<br />3) create XML object model using xjc utility (<a href="https://docs.google.com/document/edit?id=13H_GP_qL4ZFrecLmEz6xIxkMplyMEgODnqg2of_8tjg&hl=en#">xjc.txt</a>)<br />4) load that XML file into JAXB object (<a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOYzA1Mzg1MjctODM1YS00NjdjLWJlM2QtMDdkNmUzYTQ2M2Ew&hl=en">XMLUnmarshall.java</a>)<br />5) write JAXB object back over original XML file (<a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOMjkzZjY0ZjYtYWVhNC00MDI1LWJjODAtZThiNTRlOTNmMGIy&hl=en">XMLMarshaller.java</a>)<br />6) create main java class to call these functions in appropriate order (<a href="http://docs.google.com/leaf?id=0BzAlT4mbAawONWQ5ZmE5YjAtYjRiNS00ZDcxLThiMGItNmEwZGM4Y2QwMTEx&hl=en">JAXBLoader,java</a>)<br /><br /><span style="font-size:130%;">Create XML file</span><br />Lets create a simple xml file for storing bookmark data organized through sets. It will contain root element bookmarks with bookmark elements inside and list of attribute elements for storing href values. Also for every bookmark element there will be a attribute set which will identify current bookmark set. Example of this xml can be found here: <a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOZGQyMjY4MjctYTZmNS00ZTI1LTg3OWMtNWIxYmEwNTAzYjlk&hl=en">bookmarks.xml</a>.<br /><br /><span style="font-size:130%;">Create XML schema file</span><br /><span style="font-size:100%;">To validate bookmark.xml we need to create schema file. Example for this example can be found here: </span><a href="http://docs.google.com/leaf?id=0BzAlT4mbAawOOTE4NjgxMGMtNTFhZS00ZmFmLWFjODgtNjc4MzQ3NTAwNmMx&hl=en">bookmarks.xsd</a>.<br /><br /><span style="font-size:130%;">Create object model</span><br />To create object model for our xml we need to run xjc utility and supply it with xsd schema file as argument at command line.<br /><blockquote><br />zlaja@orion:~/NetBeansProjects/JAXBLoader> xjc ./data/bookmarks.xsd -p com.blogspot.zetaorionis.bookmarks.model -d ./src<br />parsing a schema...<br />compiling a schema...<br />com/blogspot/zetaorionis/bookmarks/model/AttributeType.java<br />com/blogspot/zetaorionis/bookmarks/model/Bookmark.java<br />com/blogspot/zetaorionis/bookmarks/model/Bookmarks.java<br />com/blogspot/zetaorionis/bookmarks/model/ObjectFactory.java<br />com/blogspot/zetaorionis/bookmarks/model/package-info.java<br />zlaja@orion:~/NetBeansProjects/JAXBLoader><br /></blockquote><br /><span style="font-size:130%;">Unmarshalling / loading XML data to object model instance</span><br />This utility class will help you read xml file into it's object representation. It will work with every xml file. You just need to supply it with uri path to xml file:<br /><blockquote>data/bookmarks.xml</blockquote><br />and root element class of object model:<br /><blockquote>Bookmarks.class</blockquote><br />Here is XMLUnmarshaller.java utility class:<br /><blockquote><br />package com.blogspot.zetaorionis.util.xml;<br /><br />import java.io.FileNotFoundException;<br />import java.io.InputStream;<br />import java.io.IOException;<br />import java.net.URI;<br /><br />import javax.xml.bind.JAXBContext;<br />import javax.xml.bind.JAXBElement;<br />import javax.xml.bind.JAXBException;<br />import javax.xml.bind.Unmarshaller;<br />import javax.xml.transform.stream.StreamSource;<br /><br />import org.apache.log4j.Logger;<br /><br />/**<br />*<br />* @author zlaja<br />*/<br />public class XMLUnmarshaller {<br /><br />private static final Logger logger = Logger.getLogger(XMLUnmarshaller.class);<br />/**<br />* The bookmark file.<br />*/<br />protected URI uri;<br /><br />/**<br />* Create an xml based loader of bookmarks.<br />* @param uri the bookmark file<br />*/<br />public XMLUnmarshaller(final URI uri) {<br />this.uri = uri;<br />}<br /><br />//<br />// BookmarksXMLLoader<br />//<br />/**<br />* Load bookmarks into a action list.<br />*<br />* @throws IOException<br />* If an I/O error occurred.<br />* @throws FileNotFoundException<br />* If the resource was not found.<br />*/<br />public <t> T load(Class<t> docClass) throws IOException {<br />final InputStream in = getClass().getResourceAsStream("/" + uri.getPath());<br /><br />if (in == null) {<br /> throw new FileNotFoundException("Cannot find resource: " + uri);<br />}<br /><br />try {<br /> return load(docClass, in);<br />} finally {<br /> in.close();<br />}<br />}<br /><br />protected <t> T load(Class<t> docClass, final InputStream in) {<br />T o = null;<br />try {<br /> o = unmarshal(docClass, in);<br />} catch (JAXBException ex) {<br /> logger.error("Error while unmarshalling.", ex);<br />}<br />return o;<br />}<br /><br />public <t> T unmarshal(Class<t> docClass, InputStream inputStream)<br /> throws JAXBException {<br />String packageName = docClass.getPackage().getName();<br />JAXBContext jc = JAXBContext.newInstance(packageName);<br />Unmarshaller u = jc.createUnmarshaller();<br />JAXBElement<t> doc = u.unmarshal(new StreamSource(inputStream), docClass);<br />return doc.getValue();<br />}<br />}<br /></t></t></t></t></t></t></t></blockquote><br /><span style="font-size:130%;">Marshalling / writing data to xml from object model instance</span><br />This utility class will help you write data from object representation to xml file. It will work with every xml file. You just need to supply it with uri path to xml file:<br /><blockquote>data/bookmarks.xml</blockquote><br />and root element class of object model:<br /><blockquote>Bookmarks.class</blockquote><br />Here is XMLMarshaller.java utility class:<br /><blockquote>package com.blogspot.zetaorionis.util.xml;<br /><br />import java.io.FileNotFoundException;<br />import java.io.OutputStream;<br />import java.io.FileOutputStream;<br />import java.net.URI;<br />import java.io.IOException;<br /><br />import javax.xml.bind.JAXBContext;<br />import javax.xml.bind.JAXBElement;<br />import javax.xml.bind.JAXBException;<br />import javax.xml.bind.Marshaller;<br /><br />import org.apache.log4j.Logger;<br /><br />/**<br />*<br />* @author zlaja<br />*/<br />public class XMLMarshaller {<br /><br />private static final Logger logger = Logger.getLogger(XMLUnmarshaller.class);<br />/**<br />* The output XML file.<br />*/<br />protected URI uri;<br /><br />/**<br />* Create an xml based writer for specified jaxbObject.<br />* @param uri - uri for output XML file<br />*/<br />public XMLMarshaller(final URI uri) {<br /> this.uri = uri;<br />}<br /><br />//<br />// XMLMarshaller<br />//<br />/**<br />* Write JAXBElement representation of object to XML file.<br />*<br />* @param jaxbObject - object for marshalling to xml, converted to JAXBElement.<br />* Conversion is done using function inside ObjectFactory.java which is<br />* created with xjc utility<br />* @param docClass - class for object that is going to be marshalled to XML<br />*<br />* @throws IOException<br />* If an I/O error occurred.<br />* @throws FileNotFoundException<br />* If the resource was not found.<br />*/<br />public <t> void write(final JAXBElement<t> jaxbObject, Class<t> docClass) throws IOException {<br /> final OutputStream os = new FileOutputStream(uri.getPath());<br /><br /> if (os == null) {<br /> throw new FileNotFoundException("Cannot create resource: " + uri);<br /> }<br /><br /> try {<br /> write(jaxbObject, docClass, os);<br /> } finally {<br /> os.close();<br /> }<br />}<br /><br />protected <t> void write(final JAXBElement<t> jaxbObject, Class<t> docClass, final OutputStream os) {<br /> try {<br /> marshall(jaxbObject, docClass, os);<br /> } catch (JAXBException ex) {<br /> logger.error("Error in marshalling to XML.", ex);<br /> }<br />}<br /><br />private <t> void marshall(final JAXBElement<t> jaxbObject, Class<t> docClass, final OutputStream os)<br /> throws JAXBException {<br /> String packageName = docClass.getPackage().getName();<br /> JAXBContext context = JAXBContext.newInstance(packageName);<br /> Marshaller m = context.createMarshaller();<br /> m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);<br /> m.marshal(jaxbObject, os);<br />}<br />}</t></t></t></t></t></t></t></t></t></blockquote><br /><span style="font-size:130%;">Call utility classes inside main class</span><br /><blockquote>package com.blogspot.zetaorionis.jaxbloader;<br /><br />import com.blogspot.zetaorionis.bookmarks.model.Bookmarks;<br />import com.blogspot.zetaorionis.bookmarks.model.ObjectFactory;<br />import com.blogspot.zetaorionis.util.xml.XMLMarshaller;<br />import com.blogspot.zetaorionis.util.xml.XMLUnmarshaller;<br />import java.net.URI;<br />import org.apache.log4j.Logger;<br /><br />/**<br />*<br />* @author zlaja<br />*/<br />public class JAXBLoader {<br /><br />private static final String LOG4J_PROPERTIES = "data/log4j.properties";<br />private static final Logger logger = Logger.getLogger(JAXBLoader.class);<br />private Bookmarks bookmarks = new Bookmarks();<br /><br />public JAXBLoader() {<br /> Log4J.init(LOG4J_PROPERTIES);<br />}<br /><br />/**<br />* Loads XML data to object<br />*/<br />private void loadBookmarks() {<br /> try {<br /> final String path = "data/bookmarks.xml";<br /> final URI uri = new URI(path);<br /><br /> final XMLUnmarshaller xmlBookmarks = new XMLUnmarshaller(uri);<br /> this.bookmarks = xmlBookmarks.load(Bookmarks.class);<br /> logger.info("Info: Bookmarks loaded successfuly.");<br /> } catch (Exception ex) {<br /> logger.error("Error: Loading bookmarks XML file failed", ex);<br /> }<br />}<br /><br />/**<br />* Writes object data to XML<br />*/<br />private void writeBookmarks() {<br /> try {<br /> final String path = "data/bookmarks.xml";<br /> final URI uri = new URI(path);<br /><br /> final XMLMarshaller xmlBookmarks = new XMLMarshaller(uri);<br /> ObjectFactory of = new ObjectFactory();<br /> xmlBookmarks.write(of.createBookmarks(this.bookmarks), Bookmarks.class);<br /> logger.info("Info: Bookmarks written successfuly.");<br /> } catch (Exception ex) {<br /> logger.error("Error: Writing bookmarks XML file failed", ex);<br /> }<br />}<br /><br />/**<br />* @param args the command line arguments<br />*/<br />public static void main(String[] args) {<br /> JAXBLoader loader = new JAXBLoader();<br /> loader.loadBookmarks();<br /> loader.writeBookmarks();<br />}<br />}</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-78687132959243185042010-02-20T12:37:00.012+01:002010-02-20T13:28:18.223+01:00Use yubikey for safer and less painful browsing<span style="font-weight:bold;">What is yubikey?</span><br />Yubikey is usb powered piece of hardware with one action button to generate OTP (one time passwords). <br /><br /><span style="font-weight:bold;">Main advantages:</span><br />- There is no need to remember credentials for different sites on the web. Just plug in the yubikey and press action button which will create random OTP password with unique header number of that particular yubikey.<br />- It will guarantee user inviolability and thus disable fishing attacks and credential information interception.<br /><br /><span style="font-weight:bold;">Main disadvantages:</span><br />- You have to carry it with you :), but you can access your web portals without using it in old fashion way by typing your credentials.<br /><br /><span style="font-weight:bold;">Settings things up:</span><br />You need to register your account at KeyGenius:<br /><blockquote>http://kg.yubico.com/</blockquote><br />You can use basic or standard account type. Basic will not ask you for any password when logging and all you need is one touch on your yubikey for every login on the web. You are released of typing. Standard account is more secure. It will ask you on first access for your KeyGenius credentials, and after supplying it you can use yubikey like in basic account for every other portal on the web.<br /><br />Under your account you need to supply information like username, passsword and domain for every domain and credential information. <br /><br />So it's like this. You want to login on e.g. facebook.com. You will open facebook in browser. Your username will be remembered by your browser. Instead of typing passwords you plug your yubikey and touch button. Login process will continue automatically. First it will send request to KeyGenius to return real password for facebook and after receiving password browser will log you to facebook.<br /><br />Browser will need to know how to get password from KeyGenius. That is accomplished with java script which can be installed to browser using GreasyMonkey addon. Script can be found here:<br /><blockquote>http://kg.yubico.com/keygenius.user.js</blockquote><br />And thats it. Enjoy your safe browsing... :)zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-4700061792124795032010-02-20T12:22:00.003+01:002010-02-20T12:33:28.606+01:00Database synchronization using TableSyncer<span style="font-weight:bold;">Prerequisites:</span><br /><blockquote>ruby<br />ruby-devel<br />ruby-mysql<br />rubygems<br />libmysqlclient<br />libmysqlclient-devel<br />libopenssl-devel<br />zlib-devel<br /></blockquote><br /><span style="font-weight:bold;">Installation:</span><br /><blockquote>sudo gem install mysql<br />sudo gem install table_syncer<br /></blockquote><br /><span style="font-weight:bold;">Settings:</span><br /><blockquote>cd /usr/lib64/ruby/gems/1.8/gems/table_syncer-0.3.1/lib<br />cp table_syncer.rb table_syncer.rb.orig<br />vi table_syncer.rb<br /></blockquote><br />Add and change these lines:<br /><blockquote>local_source_db = {:host => '127.0.0.1', :user => 'user', :password => 'password', :db => 'SourceDatabase'}<br />local_test_db = {:host => '127.0.0.1', :user => 'user', :password => 'password', :db => 'test'}<br /></blockquote><br /><span style="font-weight:bold;">Executing</span><br /><blockquote>table_syncer --from=local_source_db --to=local_test_db --tables=account<br /></blockquote><br /><span style="font-weight:bold;">Reference:</span><br /><blockquote>http://code.google.com/p/ruby-roger-useful-functions/wiki/TableSyncer<br />http://www.freelinuxtutorials.com/quick-tips-and-tricks/sync-mysql-tables-via-ruby-gem-tablesyncer/<br />http://forums.mysql.com/read.php?116,178217,198518#msg-198518<br /></blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-25296924675269504192010-02-20T12:14:00.007+01:002010-06-25T09:20:58.272+02:00SCP & SSH<span style="font-weight:bold;">At local machine:</span><br /><blockquote>ssh-keygen -t rsa<br />cd ~/.ssh<br />cp id_rsa.pub authorized_keys<br />scp -p ~/.ssh/authorized_keys username@remoteMachine:.ssh/<br /></blockquote><br />Note that before executing scp you need to make sure there is ~/.ssh at remote machine also and create it if neccecery with<br /><blockquote>mkdir ~/.ssh<br /></blockquote><br /><span style="font-weight:bold;">At remote machine:</span><br /><blockquote>cd<br />ls -ld . .ssh .ssh/authorized_keys<br />drwxr-xr-x 36 username username 4096 Jul 25 02:24 .<br />drwxr-xr-x 2 username username 512 Apr 10 02:30 .ssh<br />-rw-r--r-- 1 username username 1674 Apr 10 02:29 .ssh/authorized_keys<br /><br />cd<br />chmod go-w . .ssh .ssh/authorized_keys</blockquote><br /><span style="font-weight:bold;">At local machine:</span><br /><blockquote>scp -p file username@remoteMachine:path/to/file</blockquote><br /><span style="font-weight:bold;">Reference:</span><br /><blockquote>http://kimmo.suominen.com/docs/ssh/</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-81490315699876767992010-02-20T11:31:00.007+01:002010-02-20T12:09:28.958+01:00Mounting remote windows station<font style="font-weight: bold;">1) Using mount command:</font><br /><blockquote>mount -t cifs //192.168.0.4/Movies ~/Desktop/movies/</blockquote><br /><span style="font-weight: bold;">2) Using /etc/fstab file:</span><br /><blockquote>//192.168.0.4/Movies /media/remote/movies cifs file_mode=0777,dir_mode=0777,password=******** 0 0</blockquote><br /><font style="font-weight: bold;">Mounting iso file image:</font><br /><blockquote>mkdir /media/iso<br />mount -o loop -t iso9660 ~/file.iso /media/iso</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-2201288049731262882009-03-30T20:02:00.003+02:002009-03-30T20:11:18.633+02:00Installing Plone True Gallery<span style="font-weight:bold;">Problem</span><br />It should be simple as editing buildout.cfg and runing buildout again.<br />Edit buildout.cfg with:<br /><blockquote>$ joe buildout.cfg</blockquote><br />Under eggs and zcml sections add collective.plonetruegallery string like:<br /><blockquote>eggs =<br /> collective.plonetruegallery<br />...<br />zcml =<br /> collective.plonetruegallery<br /></blockquote><br />Run buildout again with:<br /><blockquote>$ ./bin/buildout -v</blockquote><br />This will give you the error:<br /><blockquote>Error: Couldn't find a distribution for 'gdata.py>=1.2.3'.</blockquote><br />Problem is gdata.py package doesn't exists because it is now known as gdata only.<br /><br /><span style="font-weight:bold;">Solution</span><br /><blockquote>$ wget http://pypi.python.org/packages/source/c/collective.plonetruegallery/collective.plonetruegallery-0.6b2.4.tar.gz<br />$ tar xfz collective.plonetruegallery-0.6b2.4.tar.gz<br />$ cd collective.plonetruegallery-0.6b2.4<br />$ joe setup.py<br />Change gdata.py to gdata under dependency part so it looks like this:<br />install_requires=[<br />'setuptools',<br />'gdata>=1.2.3',<br />'flickrapi>=1.2',<br />'simplejson',<br />'elementtree'<br />],<br />$ sudo python2.4 setup.py install<br />$ joe buildout.cfg<br /></blockquote><br />Add zcml slug like:<br /><blockquote>zcml =<br /> collective.plonetruegallery<br /></blockquote><br />Run buildout again with:<br /><blockquote>$ ./bin/buildout -v</blockquote><br />Run your instance with:<br /><blockquote>$ ./bin/instance fg</blockquote><br />Now, it should be under 'add on products' so you can install it.zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-56720029744570305512009-03-29T23:55:00.006+02:002009-03-30T16:14:52.515+02:00Managing projects using buildout<span style="font-weight:bold;">Directories in the buildout</span><br />Before we dive into buildout.cfg, let us take a quick look at the directories that buildout has created for us:<br /><blockquote>bin/</blockquote><br /> Contains various executables, including the buildout command, and the instance Zope control script.<br /><blockquote>eggs/</blockquote><br /> Contains eggs that buildout has downloaded. These will be explicitly activated by the control scripts in the bin/ directory.<br /><blockquote>downloads/</blockquote><br /> Contains non-egg downloads, such as the Zope source code archive. <br /><blockquote>var/</blockquote><br /> Contains the log files (in var/log/) and the file storage ZODB data (in var/filestorage/Data.fs). Buildout will never overwrite these.<br /><blockquote>src/</blockquote><br /> Initially empty. You can place your own development eggs here and reference them in buildout.cfg. More on that later.<br /><blockquote>products/</blockquote><br /> This is analogous to a Zope instance's Products/ directory (note the difference in capitalisation). If you are developing any old-style Zope 2 products, place them here. We will see how buildout can automatically download and manage archives of products, but if you want to extract a product dependency manually, or check one out from Subversion, this is the place to do so.<br /><blockquote>parts/</blockquote><br /> Contains code and data managed by buildout. In our case, it will include the local Zope installation, a buildout-managed Zope instance, and Plone's source code. In general, you should not modify anything in this directory, as buildout may overwrite your changes.<br /><br /><span style="font-weight:bold;">The main [buildout] section</span><br />The [buildout] section is the starting point for the file. It lists a number of "parts", which are configured in separate sections later in the file. Each part has an associated recipe, which is the name of an egg that knows how to perform a particular task, e.g. build Zope or create a Zope instance. A recipe typically takes a few configuration options.<br /><br />Our global settings are as follows:<br /><blockquote>[buildout]<br />parts =<br /> plone<br /> zope2<br /> productdistros<br /> instance<br /> zopepy<br />find-links =<br /> http://dist.plone.org<br /> http://download.zope.org/ppix/<br /> http://download.zope.org/distribution/<br /> http://effbot.org/downloads<br />eggs =<br /> elementtree<br />develop =</blockquote><br />This specifies that the parts plone, zope2, productdistros, instance and zopepy will be run, in that order. Then, we tell buildout that it can search one of a number of URLs when it is looking for eggs to download. In addition, it will always search the Cheese Shop.<br /><br />Next, we can list any eggs that buildout should download and install for us. This may include version specifications. For example, if you want sqlalchemy 0.3, but not 0.4, you could list;<br /><blockquote>eggs = <br /> elementtree<br /> sqlalchemy>=0.3,<0.4dev<br /></blockquote><br />Finally, we can list development eggs, by specifying a directory where the egg is extracted in source format. For example:<br /><blockquote>eggs =<br /> elementtree<br /> my.package<br />develop = <br /> src/my.package<br /></blockquote><br />This presumes that there is an egg called my.package in the src/ directory. We will learn how to create such eggs a little later in this tutorial. Notice how we must also list my.package as an actual egg dependency: development eggs are not automatically added to the "working set" of eggs that are installed for Zope.<br /><br /><span style="font-weight:bold;">The [plone] section</span><br />This is very simple - it just uses plone.recipe.plone to download Plone's products and eggs.<br /><blockquote>[plone]<br />recipe = plone.recipe.plone<br /></blockquote><br />It will use the latest release available. Version numbers for plone.recipe.plone correspond to version numbers for Plone itself. Therefore, to make sure you always get a 3.0.x release, but not a 3.1, you can do:<br /><blockquote>[plone]<br />recipe = plone.recipe.plone>=3.0,<3.1dev<br /></blockquote><br />When the recipe is run, Plone's products will be installed in parts/plone. The eggs are made available via buildout variable ${plone:eggs}, which we will reference in the [instance] section later, and the URL of a "known good" version of Zope is available in the variable ${plone:zope2-url}.<br /><br /><span style="font-weight:bold;">The [zope2] section</span><br />This part builds Zope 2, using plone.recipe.zope2install. If you specified an existing Zope installation, you will not have this part. Otherwise, it looks like this:<br /><blockquote>[zope2]<br />recipe = plone.recipe.zope2install<br />url = ${plone:zope2-url}</blockquote><br />Here, we reference the download location for Zope as emitted by the [plone] part. This ensures that we always get the recommended version of Zope. You could specify a download URL manually instead, if you wanted to use a different version of Zope.<br /><br />When the recipe is run, Zope 2 is installed in parts/zope2. The Zope software home becomes parts/zope2/lib/python.<br /><br /><span style="font-weight:bold;">The [productdistros] section</span><br />This uses the plone.recipe.distros recipe, which is able to download distributions (archives) of Zope 2 style products and make them available to Zope. It is empty to begin with:<br /><blockquote>[productdistros]<br />recipe = plone.recipe.distros<br />urls =<br />nested-packages =<br />version-suffix-packages =</blockquote><br />However, you can list any number of downloads. The recipe is also able to deal with archives that contain a single top-level directory that contains a bundle of actual product directories (nested-packages), or packages that have a version number in the directory name and thus need to be renamed to get the actual product directory (version-suffix-packages).<br /><br />Consider the following distributions:<br /><br /># A typical distribution <br /><br />ExampleProduct-1.0.tgz<br /> |<br /> |- ExampleProduct<br /> | |<br /> | |- __init__.py<br /> | |- (product code)<br /><br /># A version suffix distribution<br /><br />AnotherExampleProduct-2.0.tgz<br /> |<br /> |- AnotherExampleProduct-2.0<br /> | |<br /> | |- __init__.py<br /> | |- (product code)<br /><br /># A nested package distribution<br /><br />ExampleProductBundle-1.0.tgz<br /> |<br /> |- ExampleProductBundle<br /> | |<br /> | |- ProductOne<br /> | | |- __init__.py<br /> | | |- (product code)<br /> | | <br /> | |- ProductTwo<br /> | | |- __init__.py<br /> | | |- (product code)<br /><br />Here is what the part would look like if we try to install the three distributions above:<br /><blockquote>[productdistros]<br />recipe = plone.recipe.distros<br />urls =<br /> http://example.com/dist/ExampleProduct-1.0.tgz<br /> http://example.com/dist/AnotherExampleProduct-2.0.tgz<br /> http://example.com/dist/ExampleProductBundle-1.0.tgz<br />nested-packages = ExampleProductBundle-1.0.tgz<br />version-suffix-packages = AnotherExampleProduct-2.0.tgz</blockquote><br />You can specify multiple downloads on separate lines. When the recipe is run, the product directories for downloaded products are found in parts/productdistros.<br /><br /><span style="font-weight:bold;">The [instance] section</span><br />The instance section pulls it all together: It configures a Zope instance using the plone.recipe.zope2instance script. Here is how it looks:<br /><blockquote>[instance]<br />recipe = plone.recipe.zope2instance<br />zope2-location = ${zope2:location}<br />user = admin:admin<br />http-address = 8080<br />debug-mode = on<br />verbose-security = on<br />eggs =<br /> ${buildout:eggs}<br /> ${plone:eggs}<br />zcml = <br />products =<br /> ${buildout:directory}/products<br /> ${productdistros:location}<br /> ${plone:products}<br /></blockquote><br />Here, we reference the Zope 2 installation from the [zope2] part - if you specified a location yourself when creating the buildout, you would see that one here. Then, we specify the initial admin user and password, and the port that Zope will be bound to. We also turn on debug mode and verbose security. These options are used to generate an appropraite zope.conf file for this instance. See the recipe page in the Cheese Shop for more details on the options available.<br /><br />Next, we specify which eggs that will be made available to Zope. This references the "global" eggs from the [buildout] section, as well as the eggs specified by Plone. You could add additional eggs here, though it is generally easier to specify these at the top of the file, so that they get included in the ${buildout:eggs} working set.<br /><br />As explained previously, Zope 3 configure.zcml files are not loaded automatically for eggs or packages not the Products namespace. To load ZCML files for a regular package, we can make buildout create a ZCML slug by listing the package under the zcml option:<br /><blockquote>zcml =<br /> my.package<br /> my.package-overrides<br /></blockquote><br />This assumes that my.package was previously referenced in the buildout. This would load both the main configure.zcml and the overrides.zcml file from this package.<br /><br />Finally, we list the various directories that contain Zope 2 style products - akin to the Products/ directory in a traditional instance. Notice how the products/ directory in the main buildout directory comes first, followed by the products downloaded with the [productdistros] part, followed by the products downloaded by the [plone] part. This means that even if Plone ships with a product, you could override it (e.g. with a newer product) by putting a product with the same name in the top-level products/ directory.<br /><br />When the recipe is run, the Zope instance home will be parts/instance, and a control script is created in ./bin/instance.<br /><br /><span style="font-weight:bold;">The [zopepy] section</span><br />This final section creates a Python interpreter that has all the eggs and packages (but not Zope 2 style products) that Zope would have during startup. This can be useful for testing purposes.<br /><blockquote>[zopepy]<br />recipe = zc.recipe.egg<br />eggs = ${instance:eggs}<br />interpreter = zopepy<br />extra-paths = ${zope2:location}/lib/python<br />scripts = zopepy</blockquote><br />Here, we copy the eggs from the [instance] section, and include in the pythonpath the Zope instance home.<br /><br />When the recipe is run, the script will be created in ./bin/zopepy.<br /><br /><span style="font-weight:bold;">Managing ZCML files</span><br />It is important to realize that Zope will not load configure.zcml files automatically for packages that are not in the Products.* namespace. Instead, you must explicitly reference the package. Buildout can create such a reference (known as a ZCML slug) with the zcml option under the [instance] part. Here is how to ensure that borg.project is available to Zope:<br /><blockquote>[buildout]<br />...<br />eggs =<br /> elementtree<br /> borg.project<br />...<br />[instance]<br />...<br />zcml = <br /> borg.project<br /></blockquote><br />Should you need to load an overrides.zcml or a meta.zcml, you can use a syntax like:<br /><blockquote>zcml =<br /> some.package<br /> some.package-overrides<br /> some.package-meta</blockquote><br /><br />Resources:<br />http://plone.org/documentation/tutorial/buildout/tutorial-all-pageszlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-47224458514342546612009-03-25T09:52:00.009+01:002009-03-26T08:55:17.342+01:00GnuPG<span style="font-weight:bold;">Create your public and private keys</span><br />In case you do not have '.gnupg' direcotry under your Home directory, create it with:<br /><blockquote>$ mkdir .gnupg</blockquote><br />and set up permissions with:<br /><blockquote>$ chmod 700 .gnupg</blockquote><br />Then generate keys with:<br /><blockquote>$ gpg --gen-key</blockquote><br />Choose key type, key length and key expiration.<br />Then enter your 'User-ID' which consists of 'Name Surname', 'e-mail' and 'comment'. <br />Then enter your password for using keys.<br /><br />To publish your public ID:<br /><blockquote>$ gpg --keyserver pgp.mit.edu --send-keys [e-mail]</blockquote><br /><span style="font-weight:bold;">Backing up your secret key</span><br />This will list keys on your secret keyring:<br /><blockquote>$ gpg --list-secret-keys</blockquote><br />To make backup use:<br /><blockquote>$ gpg --output [outfile] --armor --export-secret-key [key_identifier as gleaned from above]<br /></blockquote><br />This will list keys on your public keyring:<br /><blockquote>$ gpg --list-keys</blockquote><br />To make backup use:<br /><blockquote>$ gpg --output [outfile] --armor --export [key_identifier as gleaned from above]<br /></blockquote><br />key_identifier is usually in the form of something like: ABCDFE01<br /><br />Depending on your host, you could also just copy the entire .gpg directory if you wanted to do it that way also.<br /><br />Of course there is the paperkey utility if you need to make a paperkey backup of your secret key: <br /><blockquote>http://www.jabberwocky.com/software/paperkey/</blockquote><br /><span style="font-weight:bold;">Evolution integration</span><br />At security tab in settings dialog of your email account enter your key identifier.<br />You can find it by listing keys with:<br /><blockquote>$ gpg --list-keys</blockquote><br />Search for eight characters where now stands 'XXXXXXXX' <br /><blockquote>pub 1024D/XXXXXXXX 2004-01-01 Name Surname (comment) [email]</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-89759233776785035712009-03-20T20:51:00.030+01:002009-03-26T09:27:30.278+01:00Testing WEP and WPA protectionAircrack is one of the easiest software bundles which let's you to access wireless protected networks. I have laptop HP Pavilion dv6500 with Intel PRO/Wireless 3945ABG [Golan] Network Connection wireless card. I'm using openSUSE 11.1 64bit as OS with kernel 2.6.27.19-3.2-default.<br /><br /><span style="font-weight:bold;">Wireless card features</span><br /> * Chipset: Intel WM3945AG<br /> * IEEE Standards: 802.11a, 802.11b, 802.11g<br /> * PCI ID: 8086:4227 <br /><br /><span style="font-weight:bold;">Prerequisites</span><br /> * gcc<br /> * libopenssl-devel<br /> * sqlite3-devel >=3.6.10<br /> * iw<br /> * http://trac.aircrack-ng.org/attachment/ticket/572/sha-compile-fix-64bit.patch<br /><br /><span style="font-weight:bold;">Installation</span><br /><blockquote>$ wget http://download.aircrack-ng.org/aircrack-ng-1.0-rc2.tar.gz<br />$ tar -zxvf aircrack-ng-1.0-rc2.tar.gz<br />$ cd aircrack-ng-1.0-rc2<br />Patch source file sha1-sse2.S using instructions in sha-compile-fix-64bit.patch<br />$ make SQLITE=true<br />$ sudo make SQLITE=true install</blockquote><br /><span style="font-weight:bold;">Using airmon-ng</span><br />Stop previously started monitoring:<br /><blockquote>$ sudo airmon-ng stop wlan0 <br />$ sudo airmon-ng stop mon0 <br /></blockquote><br />Change MAC of your wlan interface<br /><blockquote>$ sudo ifconfig wlan0 down <br />$ sudo macchanger -A wlan0 <br />$ sudo ifconfig wlan0 up <br />$ ifconfig</blockquote><br />Create additional wireless interface mon0 in monitor mode<br /><blockquote>$ sudo airmon-ng start wlan0 <br />$ iwconfig<br /></blockquote><br />Change MAC of newly created interface<br /><blockquote>$ sudo ifconfig mon0 down <br />$ sudo macchanger -A mon0 <br />$ sudo ifconfig mon0 up <br />$ ifconfig<br /></blockquote><br />From now on you'll be using mon0 interface.<br /><br /><span style="font-weight:bold;">Using airodump-ng</span><br />Find wireless network which is protected with:<br /><blockquote>$ sudo airodump-ng mon0 </blockquote><br />and write down target ssid (ESSID), MAC adress of access point (BSSID), channel number (CH), encryption type (ENC). When finished CTRL+C to exit.<br /><br />Create directory for dumping information with:<br /><blockquote>$ cd ~/Documents<br />$ mkdir data<br />$ cd data<br /></blockquote><br />Run airodump-ng to capture packets from your access point to dumpfile*.cap. You should always specify a channel with airodump, because otherwise it will try to scan through all channels, and that will break your injection attack. <br /><blockquote>$ sudo airodump-ng --channel [Access Point channel] --bssid [Access Point bssid] -w [dumpfile] [device]<br /></blockquote><br />After a few seconds in airodump-ng, you should notice that there are clients connected to the access point. Connected clients will be listed under "STATION" at the lower half of the screen. <br />Take note of the MAC address of one of the clients - you will use it in the next step. This could be your faked MAC if there is no clients connected.<br /><br /><span style="font-weight:bold;">Using aireplay attack 3 - ARP Injection</span><br />Open another terminal window to run an ARP replay attack. After some time, an ARP packet will come through and the #/s figure in the airodump-ng window will increase. If the RXQ (receive quality %) column is >90 then you should be getting #/s of 200 or higher, but more importantly, it should be much higher than what it was before.<br /><blockquote>$ aireplay-ng -3 -b [Access Point bssid] -h [client MAC addr. noted in previous step] [device]<br />-3 - is the number attack we're using. This attack keeps record of ARP packets which are used later on for decifering. There are 6 attacks numbered from 0 - 5.<br /></blockquote><br /><span style="font-weight:bold;">Using aireplay attack 1 - Fake Authentication Attack</span><br />Usually attacks, 1 and 0, work together. There are situations when attack 1 will not work (i.e. MAC filtering is on), but it will work most of the time, and it's real quick. Currently, if you're following along, you should have two terminal windows open and running airodump and aireplay attack 3. If not, go back and follow the directions again.<br />To initiate attack 1 type:<br /><blockquote>$ aireplay-ng -1 0 -e [essid] -a [Access Point bssid] -h [yours faked client MAC addr] [device]<br /></blockquote><br />-1 - This is the number attack we're using. It is a fake authentication attack, making us authenticated with the AP so that we can deauthenticate, as you'll soon see.<br />0 - This is the delay between tries, if it doesn't happen on the first try, for a variety of reasons.<br /><br />You must have fairly good power showing in airodump for this to work. It needs to be over 40 showing in the power column. Your experience may differ greatly. If all goes well, when you press Enter you should see something like:<br /><blockquote>10:13:24 Sending authentication request (Open System)<br />10:13:24 Authentication successful<br />10:13:24 Sending Association Request<br />10:13:24 Association successful :-)<br /></blockquote><br />What just happened is that you became associated with the AP, meaning that if you lose association, the AP will send out a call to get you back. This is what will usually start the ARP request. If you take a look at you console running attack 3, it possibly started getting lots of data in #Data and #/s columns. More often than not, you'll have to wait for the next step.<br /><br />There can be many reasons that you won't be able to associate with the AP, meaning this attack failed. First of all, the AP may have MAC filtering on, which may be able to be circumvented. Or you may not be close enough to the AP to associate. It can also be that the encryption is WPA, not WEP, so you cannot use this method to inject.<br /><br /><span style="font-weight:bold;">Using aireplay attack 0 - Deauthentication Attack</span><br />If your #Data count is flying up, then you can skip this step. If not, or you are trying to crack WPA then read on.<br />If you followed up until now, you should a few windows open. One is running airodump, another is running aireplay attack 3. The last one ran aireplay attack 1 and you're back at the prompt now.<br /><br />At the prompt type: <br /><blockquote>$ aireplay-ng -0 10 -e [essid] -a [Access Point bssid] [device]</blockquote><br />-0 - is the attack number we're using. It is a deauthentication attack, meaning it tells the AP that we've disassociated and it tries to reconnect, sending out an ARP, which is what attack 3 is waiting for.<br />10 - is the amount of times it should send out the deauthentication. It may not reach the AP on the first try or what, so we like to do it a couple of times, hence the number 10.<br /><br />This attack is best to use for WPA ecryption while waiting for HANDSHAKE to appear in upper right part of dumping screen.<br /><br />If all went well then attack 3 should have picked up an ARP request, and it should be injecting very, very quickly. Go to the window with airodump, and watch with delight as the #Data count flies up.<br /><br /><span style="font-weight:bold;">Using aireplay attack 2 - Interactive Packet Replay</span><br />If your #Data count is not flying up, try this attack in which we are looking for large packet to use:<br /><blockquote>$ aireplay-ng -2 -p 0841 -c FF:FF:FF:FF:FF:FF -b [Access Point bssid] -h [client MAC addr. noted in previous step] [device]<br /></blockquote><br />When ask to use this packet say yes:<br /><blockquote>Use this packet: y</blockquote><br /><span style="font-weight:bold;">Final step - aircrack</span><br />For WEP encryption wait a few minutes until the #Data reaches 50 000. This should be enough, but we leave the attack running just in case. Just remember that if you are cracking WEP encryption you are waiting for more data and if you are cracking WPA encryption you are waiting for HANDSHAKE to appear in upper right part of dumping screen when some client is connecting on access point. So for WEP you should use aireplay attacks 3, 1 and 0 in that order and for WPA you should use aireplay attacks 3 and 0.<br /><br />After collected enough data or got a handshake you can disconnect and go to another location with data. Open another terminal window and run aircrack-ng to initiate key searching: <br /><blockquote>$ sudo aircrack-ng -r masterdb wpa*.cap -w '/path/to/password.lst'</blockquote><br />After some time you will have the key.<br /><br /><span style="font-weight:bold;">Resources</span><br />http://www.aircrack-ng.org/doku.php?id=tutorial<br />http://docs.lucidinteractive.ca/index.php/Cracking_WEP_and_WPA_Wireless_Networkszlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-14155538515767938562009-03-10T22:18:00.010+01:002009-03-26T09:35:36.036+01:00Doom on Linux<span style="font-weight:bold;">Doom 1 and 2</span><br /><br />Prerequisites:<br /> * SDL-32bit<br /> * SDL_mixer-32bit<br /><br />Download Doom legacy engine from:<br /><blockquote>$ wget http://prdownloads.sourceforge.net/doomlegacy/legacy_142_win32.zip</blockquote><br />Copy *.wad files (doom.wad, doom2.wad, etc.) to extracted directory.<br /><br />Start game with:<br /><blockquote>$ ./lsdldoom -opengl -IWAD doom.wad</blockquote><br />where doom.wad is the name of *.wad file which you want to start.<br /><br /><span style="font-weight:bold;">Doom3 and RoE</span><br /><br />Download doom3 installer from<br /><blockquote>$ wget ftp://ftp.idsoftware.com/idstuff/doom3/linux/</blockquote><br />Create directory structure with:<br /><blockquote>$ mkdir -p /usr/local/games/doom3/base<br />$ mkdir -p /usr/local/games/doom3/d3xp<br /></blockquote><br />Now copy installer to doom3 directory with:<br /><blockquote>$ sudo cp doom3-linux-1.3.1.1304.x86.run /usr/local/games/doom3/</blockquote><br />Start installer and install doom3<br /><blockquote>$ cd /usr/local/doom3<br />$ sudo sh doom3-linux-1.3.1.1304.x86.run<br /></blockquote><br />Start game with:<br /><blockquote>$ ./doom3 +set s_driver oss<br />$ ./doom3 +set s_driver oss +set fs_game d3xp<br /></blockquote><br />Create symbolic links with:<br /><blockquote>$ sudo ln -s /media/doom3/base/pak000.pk4 /usr/local/games/doom3/base<br />$ sudo ln -s /media/doom3/base/pak001.pk4 /usr/local/games/doom3/base<br />$ sudo ln -s /media/doom3/base/pak002.pk4 /usr/local/games/doom3/base<br />$ sudo ln -s /media/doom3/base/pak003.pk4 /usr/local/games/doom3/base<br />$ sudo ln -s /media/doom3/base/pak004.pk4 /usr/local/games/doom3/base<br /><br />$ sudo ln -s /media/doom3/d3xp/pak000.pk4 /usr/local/games/doom3/d3xp<br /></blockquote><br />Resource:<br /><blockquote>http://zerowing.idsoftware.com/linux/doom/</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-72433180048992291152009-03-08T09:38:00.012+01:002009-03-26T09:32:32.377+01:00Wolfenstein on Linux<span style="font-weight:bold;">Wolfenstein 3D</span><br /><br />Well, this is the first FPS I played on PC 386, more then 15 years back at 1993. This was extraordinary experience. Although new games are much more real and gives you better atmosphere and reality, I can't forget this little fellow. So I tried to revive him after 15 years on my linux machine.<br /><br />You'll need to download source code for wolf engine:<br /><blockquote>$ wget http://www.stud.uni-karlsruhe.de/~uvaue/chaos/bins/Wolf4SDL-1.6-src.zip</blockquote><br />Additional System Requirements:<br /> * Original game data files<br /> * libSDL<br /> * libSDL_Mixer <br /><br />Using YaST or any other package manager install SDL-devel and SDL_mixer-devel package.<br />Extract downloaded source code and copy original game files *.wl6 to extracted directory. Don't forget to put original game file names to lowercase.<br /><blockquote>$ cd /path/to/extracted/source/Wolf4SDL-1.6-src<br />make</blockquote><br />If you can't find original game files, then download shareware 1.4 version from:<br /><blockquote>$ wget http://www.users.globalnet.co.uk/~brlowe/wolf3d14.zip</blockquote><br />and copy *.wl1 files instead. Again, rename file names to lowercase representation. If you are using shareware game files you will also need to change version.h file before compiling. Define CARMACIZED and UPLOAD and comment others. It is well documented and editing won't be problem.<br /><br />After compiling, start game by starting wolf3d executable:<br /><blockquote>$ ./wolf3d</blockquote><br />Reference:<br /><blockquote>http://www.happypenguin.org/show?Wolf4SDL</blockquote><br /><br /><span style="font-weight:bold;">Return to Castle Wolfenstein</span><br /><br />Additional System Requirements:<br /> * Original game data files<br /> * libstdc++-libc6.2-2.so which you can get by installing compat package using YaST or using zypper<br /><blockquote>$ zypper in compat</blockquote><br />Create directory structure with:<br /><blockquote>$ mkdir -p /usr/local/games/wolfenstein/main</blockquote><br />Download installer from:<br /><blockquote>$ wget ftp://ftp.idsoftware.com/idstuff/wolf/linux/wolf-linux-1.41b.x86.run</blockquote><br />Copy installer to main directory with:<br /><blockquote>$ sudo cp wolf-linux-1.41b.x86.run /usr/local/games/wolfenstein</blockquote><br />Run installer with:<br /><blockquote>$ sudo sh wolf-linux-1.41b.x86.run</blockquote><br />Copy or create links for game data files:<br /><blockquote>$ sudo ln -s /media/Wolfenstein/Main/mp_pak0.pk3 /usr/local/games/wolfenstein/main<br />$ sudo ln -s /media/Wolfenstein/Main/pak0.pk3 /usr/local/games/wolfenstein/main<br />$ sudo ln -s /media/Wolfenstein/Main/sp_pak1.pk3 /usr/local/games/wolfenstein/main<br /></blockquote><br />Start single player with:<br /><blockquote>$ sudo bash -c 'echo "wolfsp.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss'<br />$ sudo bash -c 'echo "wolfsp.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss'<br />$ ./wolfsp<br /></blockquote><br />Start multiplayer with:<br /><blockquote>$ sudo bash -c 'echo "wolf.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss'<br />$ sudo bash -c 'echo "wolf.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss'<br />$ ./wolf<br /></blockquote><br />Resource:<br /><blockquote>http://zerowing.idsoftware.com/linux/wolf/<br />http://www.happypenguin.org/show?Return%20To%20Castle%20Wolfenstein<br /></blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-80884825075492020412009-03-03T10:25:00.005+01:002009-03-26T09:37:42.958+01:00Kernel upgrade removes NVIDIA moduleUsing YOU (YaST Online Update) on openSUSE, I upgraded to new kernel version and after restarting system, NVIDIA module cannot be found. I was back to runlevel 3.<br />To go back to runlevel 5 you have to edit your /etc/X11/xorg.conf and comment the line with # like this:<br /><blockquote># driver "nvidia"</blockquote><br />or change "nvidia" to "nv" so it looks like this<br /><blockquote>driver "nv"</blockquote><br />Restart your system or try to start X server using:<br /><blockquote>$ startx</blockquote><br />After you reached init 5, go to YaST and serach installed packages with NVIDIA search key. Remove that installed packages to remove old uncompatibile drivers.<br /><br />From NVIDIA download page, download latest driver that fits your system:<br /><blockquote>http://www.nvidia.com/object/unix.html</blockquote><br />If you are not sure wich driver is right for you, try using this link:<br /><blockquote>http://www.nvidia.com/Download/index.aspx</blockquote><br />Prerequisites<br /><blockquote> * compiler gcc,<br /> * program make and<br /> * package kernel-source<br /></blockquote><br />If you don't have them installed you can do it using YaST.<br /><br />Go to runlevel 3 by typing the following comand as root in one of the consoles (which you can access by pressing ctrl-alt-f1)<br /><blockquote>$ init 3</blockquote><br />Now go to the directory containing the drivers.<br /><blockquote>$ cd /the/path/where/you/saved/the/drivers/from/nvidia/website</blockquote><br />Now simply type the following and follow instructions<br /><blockquote>$ sh NVIDIA-Linux-x86_64-180.29-pkg2.run -q</blockquote><br />Installer will try to compile nvidia module for your new version of kernel.<br /><br />The next step is to configure the X.org to use the new nvidia drivers. To do this, type the following<br /><blockquote>$ sax2 -r -m 0=nvidia</blockquote><br />To go back to runlevel 5 type:<br /><blockquote>$ init 5</blockquote><br />After each kernel update you need to run<br /><blockquote>$ sh NVIDIA-Linux-x86_64-180.29-pkg2.run -K</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com1tag:blogger.com,1999:blog-6271841056964876984.post-17431116952563575242009-01-30T01:27:00.010+01:002009-03-26T09:45:28.031+01:00Quakes on Linux<span style="font-weight: bold;">Quake I</span><br /><br />Make your destination directory:<br /><blockquote><span style="font-size:85%;">$ sudo mkdir -p /usr/local/games/quake/id1</span></blockquote><br />Download latest stable official release of darkplaces engine and mod from:<br /><blockquote><span style="font-size:85%;">http://icculus.org/twilight/darkplaces/download.html</span></blockquote><br />Engine is enough but if you want some improved lighting effects then you'll need mod too.<br /><blockquote><span style="font-size:85%;">$ wget http://icculus.org/twilight/darkplaces/files/darkplacesengine20090128.zip<br />$ wget http://icculus.org/twilight/darkplaces/files/darkplacesmod20080808.zip<br /></span><br /></blockquote>After extracting to ~/Quake directory copy one of darkplaces executabile files which suits your system:<br /><blockquote><span style="font-size:85%;">$ sudo cp ~/Quake/darkplacesengine20081004/darkplaces-linux-x86_64-sdl /usr/local/games/quake<br /></span><br /></blockquote>Now copy files from original windows Quake CD or destination directory of windows installation:<br /><blockquote><span style="font-size:85%;">$ sudo cp -rv /media/Quake/ID1/* /usr/local/games/quake/id1/ > ~/Desktop/files.txt</span><br /></blockquote>After coping make shure all files specified in files.txt are in small case.<br /><br />Make your launch script with:<br /><blockquote><span style="font-size:85%;">$ joe ~/Desktop/quake</span></blockquote><br />Add this content:<br /><blockquote><span style="font-size:85%;">$ cd /usr/local/games/quake<br />./darkplaces-linux-x86_64-sdl<br /></span><br /></blockquote>Save and make this file executable:<br /><blockquote><span style="font-size:85%;">$ sudo chmod 775 quake</span></blockquote><br />Any mission packs or downloaded mods needs just to be extracted in destination directory /usr/local/games/quake/. Activate installed mods with "Browse mod" menu option inside game.<br /><br /><span style="font-weight: bold;">Quake II</span><br /><br />Make your destination directory:<br /><blockquote><span style="font-size:85%;">$ sudo mkdir -p /usr/local/games/quake2/baseq2</span></blockquote><br />Download binary RPM engine from http://www.chez.com/colinf/rpms/quake2/ :<br /><blockquote><span style="font-size:85%;">$ wget http://www.chez.com/colinf/rpms/quake2/quake2-r0.16.1-io1.i386.rpm<br />$ sudo rpm -Uvh quake2-r0.16.1-io1.i386.rpm</span><br /></blockquote><br />From original QuakeII windows CD or destination directory of windows installation copy content of baseq2 folder to /usr/local/games/quake2/baseq2 :<br /><blockquote><span style="font-size:85%;">$ sudo cp -rv /media/win/games/quake2/baseq2/* /usr/local/games/quake2/baseq2</span><br /></blockquote>Make sure all copied files are in small case.<br /><br />To start game execute:<br /><blockquote><span style="font-size:85%;">$ /usr/local/games/quake2/quake2.sh</span></blockquote><br />For any mission packs you just need to extract pkg files in destination directory for example /usr/local/games/quake2/rogue.<br />After extracting start quake2 with set game 'value' parameter:<br /><blockquote><span style="font-size:85%;">$ ./sdlquake2 +set basedir /usr/local/games/quake2 +set game rogue</span><br /></blockquote><br /><span style="font-weight: bold;">Quake III</span><br /><br />Make your destination directory:<br /><blockquote><span style="font-size:85%;">$ sudo mkdir -p /usr/local/games/quake3/baseq3</span></blockquote><br />From original QuakeIII windows CD or destination directory of windows installation copy pak0.pk3 from content of baseq3 folder to /usr/local/games/quake3/baseq3 :<br /><blockquote><span style="font-size:85%;"><br />$ sudo cp /media/win/games/quake3/baseq3/pak0.pk3 /usr/local/games/quake3/baseq3</span><br /></blockquote><br />Download Quake3 installer:<br /><blockquote><span style="font-size:85%;">$ wget ftp://ftp.idsoftware.com/idstuff/quake3/linux/linuxq3apoint-1.32b-3.x86.run</span><br /></blockquote><br />Move it to destination directory:<br /><blockquote><span style="font-size:85%;">$ mv ~/Desktop/linuxq3apoint-1.32b-3.x86.run /usr/local/games/quake3</span><br /></blockquote><br />Start installation and follow instructions on your screen (you can answer “Yes” to every question you are asked during the installation)<br /><blockquote><span style="font-size:85%;">$ cd /usr/local/games/quake3<br />$ linux32 sh /usr/local/games/quake3/linuxq3apoint-1.32b-3.x86.run<br /></span><br /></blockquote>Download patch:<br /><blockquote><span style="font-size:85%;">$ wget ftp://ftp.idsoftware.com/idstuff/quake3/quake3-1.32c.zip</span></blockquote><br />After extracting copy content of linux directory over files in quake3 destination path<br /><blockquote><span style="font-size:85%;">$ sudo cp ~/Desktop/linux/* /usr/local/games/quake3</span></blockquote><br />To start game execute:<br /><blockquote><span style="font-size:85%;">$ /usr/local/games/quake3/quake3</span></blockquote><br />If you experience problems with sound use:<br /><blockquote><span style="font-size:85%;">$ sudo bash -c 'echo "quake3.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss'<br />$ sudo bash -c 'echo "quake3.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss'<br /></span><br /></blockquote>If you experience hangs during play start quake3 with:<br /><blockquote><span style="font-size:85%;">$ ./quake3.x86 +set s_musicvolume -1<br /></span></blockquote><br /><span style="font-weight: bold;">Quake 4</span><br /><br />Download installer with:<br /><blockquote><span style="font-size:85%;">$ cd ~/Desktop<br />$ wget ftp://ftp.idsoftware.com/idstuff/quake4/linux/quake4-linux-1.4.2.x86.run<br /></span></blockquote>Make your destination directory:<br /><blockquote><span style="font-size:85%;">$ mkdir -p /usr/local/games/quake4/q4base</span></blockquote><br />Quake4 has is very big in size so you may want to create links instead of coping:<br /><blockquote><span style="font-size:85%;">$ sudo ln -s /media/win/games/quake4/Setup/Data/q4base/*.pk4 /usr/local/games/quake4/q4base<br />$ sudo chmod -Rv 775 q4base/*.pk4</span></blockquote><br />Move installer to your destination directory and execute:<br /><blockquote><span style="font-size:85%;">$ cd /usr/local/games/quake4<br />$ sudo mv ~/Desktop/quake4-linux-1.4.2.x86.run .<br />$ sudo sh quake4-linux-1.4.2.x86.run<br /></span></blockquote><br />Start quake with:<br /><span style="font-size:85%;"><blockquote>$ ./quake4 +set s_driver oss</blockquote></span>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-70897339500910679962009-01-12T18:22:00.008+01:002009-03-30T16:17:00.587+02:00Install msn-pecan protocol plugin to PidginIf you have problems with connecting to MSN account with Pidgin and receive error like<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">Unable to retrieve MSN Address Book</span></blockquote><br />then msn-pecam protocol helps.<br /><br />Make sure you have following packages installed<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">libpurple-devel<br />autoconf<br />automake<br />gcc<br />gcc-c++<br />make</span></blockquote><br />You can download it by typing:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ sudo zypper install libpurple-devel autoconf automake gcc gcc-c++ make</span></blockquote><br />To download latest version of msn-pecam protocol plugin for Pidgin check this link:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">http://code.google.com/p/msn-pecan/downloads/list</span></blockquote><br />Download latest source tar.bz2 package. In my case:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ wget http://msn-pecan.googlecode.com/files/msn-pecan-0.0.17.tar.bz2</span></blockquote><br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ tar -xvjf msn-pecan-0.0.17.tar.bz2<br />$ cd msn-pecan-0.0.17<br />$ make<br />$ sudo make install<br /></span></blockquote><br />This will install libmsn-pecan.so module in this path /usr/lib/purple-2/libmsn-pecan.so<br />Try restarting Pidgin and find WLM protocol module. If it's not there then probably problem is wrong installation path.<br /><br />Find your module installation path using:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ pidgin --debug</span></blockquote><br />If you're using 64bit OS version then you need to install it to /usr/lib64/purple-2<br />So just do the folowing:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ sudo mv /usr/lib/purple-2/libmsn-pecan.so /usr/lib64/purple-2<br />$ sudo rmdir /usr/lib/purple-2<br /></span></blockquote><br />Restart Pidgin. Change protocol from MSN to WLM. And it works fine.<br />Cheers!zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-14885134641916048892008-12-29T20:51:00.028+01:002009-03-29T20:47:58.800+02:00Plone deployment using buildout<span style="font-weight:bold;">Prerequisites</span><br />* python2.4<br />* python-devel<br />* python-imaging - <a href="http://www.pythonware.com/products/pil/">Python Imaging Library</a><br />* python-setuptools - <a href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools</a><br /><br />Under Ubuntu use:<br /><blockquote><span style="font-size:85%;">$ sudo apt-get install python2.4 build-essential python2.4-dev python-imaging python-setuptools</span></blockquote><br />Under openSUSE use:<br /><blockquote>$ sudo zypper in python-2.4 python-2.4-devel python-2.4-imaging python-2.4-xml</blockquote><br />If you're using Linux and your distribution doesn't provide a package for setuptools, download <a href="http://peak.telecommunity.com/dist/ez_setup.py">ez_setup.py</a> and run it with:<br /><blockquote>$ python2.4 ez_setup.py</blockquote><br />Note: I got error here saying that directory structure doesn't exists. In that case just create it with mkdir command and try again:<br /><blockquote>mkdir -p /usr/local/lib64/python2.4/site-packages</blockquote><br />This will download and install setuptools and the easy_install script. Watch the console output to understand where easy_install is installed. If this is not in your system PATH, you should add this directory to the path as well by adding following to lines to the end of $HOME/.bash_profile for one user, /etc/profile for all users except root, and /root/.bash_profile for root user.<br /><blockquote>PATH=$PATH:/path/to/easy_install<br />export PATH</blockquote><br /><span style="font-weight:bold;">Installation</span><br /><blockquote><span style="font-size:85%;">$ sudo easy_install-2.4 -U ZopeSkel<br />$ cd /home/'your_username'<br />$ paster create --list-templates<br />$ paster create -t plone3_buildout myPloneProject<br />-----------------------------------------------------------------------------------<br />Enter zope2_install (Path to Zope 2 installation; leave blank to fetch one) ['']:<br />Enter plone_products_install (Path to directory containing Plone products; leave blank to fetch one) ['']:<br />Enter zope_user (Zope root admin user) ['admin']:<br />Enter zope_password (Zope root admin password) ['']: passwd<br />Enter http_port (HTTP port) [8080]:<br />Enter debug_mode (Should debug mode be "on" or "off"?) ['off']: on<br />Enter verbose_security (Should verbose security be "on" or "off"?) ['off']: on<br />-----------------------------------------------------------------------------------<br /></span></blockquote><br />Enter directory with created template:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ cd myPloneProject</span></blockquote><br />Create base directory structure, including scripts and latest version of the zc.buildout egg, for created template:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ python2.4 bootstrap.py<br /></span></blockquote><br />Next step is time-consuming so after typing next command go for coffee. If you have some download running in background, stop it before doing online build with:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ ./bin/buildout -v</span></blockquote><br />This reads the generated buildout.cfg file and executes its various "parts", setting up Zope, creating a Zope instance, downloading and installing Plone.<br /><br />You will need to run ./bin/buildout again each time you change buildout.cfg. If you do not want buildout to go online and look for updated versions of eggs or download other archives, you can run it in non-updating, offline mode, with using -o switch:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ ./bin/buildout -o</span></blockquote><br />Start your Zope instance in foreground so you can see debug info in console:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ ./bin/instance fg</span></blockquote><br />Start your Zope instance as background process in daemon mode:<br /><span style="font-size:85%;"></span><blockquote><span style="font-size:85%;">$ ./bin/instance start</span></blockquote><br />To run test use:<br /><blockquote>$ ./bin/instance test -s plone.portlets</blockquote><br />Stop your instance with:<br /><span style="font-size:85%;"><blockquote>$ ./bin/instance stop</blockquote></span><br />Resource:<br /><blockquote>http://plone.org/documentation/tutorial/buildout/tutorial-all-pages</blockquote>zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0tag:blogger.com,1999:blog-6271841056964876984.post-52106328004393264592008-12-17T16:32:00.062+01:002008-12-26T08:11:20.773+01:00Subversion with apache on CentosI used Centos4 as OS on which I installed subversion with apache. It was painful three days but it was sucess at the end. Before we start with this I have to say couple of important things:<br />subversion 1.4.x will work with apache-2.0.x cause they relay on APR 0.9.x module, and<br />subversion-1.5.x will work with apache-2.2.x cause they relay on APR 1.3.x module.<br />APR 0.9.x and APR 1.3.x are not compatibile, and because of that, subversion 1.5.x will not work with apache-2.0.x. Same case is probably with subversion 1.4.x and apache-2.2.x combination. When installing subversion modules for apache from source you'll need to tell to configuration where are APR and APR-UTIL libraries. You can use these libraries from apache source or from subversion. I decided to use APR and APR-UTIL libraries from apache source.<br /><br />Subversion uses a lot of other programs and libraries which need to be installed before using the subversion package. So to simplify things I'll try using yum as much as possible.<br /><br />Update your version of apache and install subversion that fits this version of apache using yum:<br /><blockquote><span style="font-size:85%;">yum upgrade httpd</span></blockquote><br />Add repos to yum:<br /><blockquote><span style="font-size:85%;">joe /etc/yum.repos.d/dag.repo<br /><br />[dag]<br />Name=Dag RPM Repository for Red Hat Enterprise Linux<br />baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag<br />gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt<br />gpgcheck=1<br />enabled=1</span></blockquote><br />Then install these packages:<br /><blockquote><span style="font-size:85%;">yum install httpd-devel<br />yum install subversion</span></blockquote><br />Check the version of your installed apache (2.0.52 in my case) using:<br /><blockquote><span style="font-size:85%;">yum info httpd</span></blockquote><br />and download apropriate source using:<br /><blockquote><span style="font-size:85%;">wget http://apache.blic.net/httpd/httpd-2.0.63.tar.gz</span></blockquote><br />There is no source for 2.0.52 any more so I used 2.0.63 with crossed fingers.<br /><blockquote><span style="font-size:85%;">tar xfz httpd-2.0.63.tar.gz<br />cd httpd-2.0.63<br /><br />cd apr<br />./configure --prefix=/usr/local/apr<br />make<br />make install<br />cd ..<br /><br />cd apr-util<br />./configure --prefix=/usr/local/apr-utils --with-apr=/usr/local/apr/<br />make<br />make install<br />cd ..<br /></span></blockquote><br />Check the version of your installed subversion (1.4.6 in my case) using:<br /><blockquote><span style="font-size:85%;">yum info subversion</span></blockquote><br />and download apropriate source using:<br /><blockquote><span style="font-size:85%;">wget http://subversion.tigris.org/downloads/subversion-deps-1.4.6.tar.gz<br />wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz<br /><br />tar xfz subversion-1.4.6.tar.gz<br />tar xfz subversion-deps-1.4.6.tar.gz<br />cd subversion-1.4.6<br /><br />rm -f /usr/local/lib/libsvn*<br />rm -f /usr/local/lib/libapr*<br />rm -f /usr/local/lib/libexpat*<br />rm -f /usr/local/lib/libneon*<br />sh ./autogen.sh<br /><br />./configure --with-apxs=/usr/sbin/apxs \<br />--with-apr=/usr/local/apr/ \<br />--with-apr-util=/usr/local/apr-utils/<br />make<br />make install<br /></span></blockquote><br />At this point you will have included two svn modules in httpd.conf file which is why we did compiling from source.<br /><br />Make your project for first revision of repository<br /><blockquote><span style="font-size:85%;">mkdir -v /usr/local/svn-projects<br />mkdir -v /usr/local/svn-projects/htdocs<br />joe /usr/local/svn-projects/htdocs/index.html<br />chown -Rv apache.apache /usr/local/svn-projects<br /></span></blockquote><br />Make your repository<br /><blockquote><span style="font-size:85%;">mkdir -v /usr/local/subversion/<br />/usr/local/bin/svnadmin create --fs-type fsfs /usr/local/subversion/repository<br />chown -Rv apache.apache /usr/local/subversion<br />ls /usr/local/subversion/repository<br /></span></blockquote><br />Edit httpd.conf.<br />Check that there are two loaded svn modules.<br /><blockquote><span style="font-size:85%;">LoadModule dav_svn_module /usr/lib/httpd/modules/mod_dav_svn.so<br />LoadModule authz_svn_module /usr/lib/httpd/modules/mod_authz_svn.so<br /></span></blockquote><br />Add this code to apache httpd.conf:<br /><blockquote><span style="font-size:85%;">< Location /subversion><br />DAV svn<br />SVNPath /usr/local/subversion/repository/<br />AuthType Basic<br />AuthName "Subversion repository"<br />AuthUserFile /usr/local/subversion/repository/conf/svn-auth-file<br />Require valid-user<br /></Location><br /></span></blockquote><br />Add new users. For first user:<br /><blockquote><span style="font-size:85%;">htpasswd -cmd /usr/local/subversion/repository/conf/svn-auth-file {user-name}</span></blockquote><br />For every other user:<br /><blockquote><span style="font-size:85%;">htpasswd -md /usr/local/subversion/repository/conf/svn-auth-file {user-name}</span></blockquote><br />Prepare files for repository and import your project to repository:<br /><blockquote><span style="font-size:85%;">mkdir -pv /tmp/subversion-layout/{branches,tags}<br />mv -v /usr/local/svn-projects/htdocs /tmp/subversion-layout/trunk<br />export SVN_EDITOR=joe<br />/usr/local/bin/svn import /tmp/subversion-layout/ http://127.0.0.1/subversion/<br /></span></blockquote><br />Make your working copy:<br /><blockquote><span style="font-size:85%;">cd /usr/local/svn-projects/<br />/usr/local/bin/svn checkout http://127.0.0.1/subversion/trunk/ htdocs<br /></span></blockquote><br />Make post-commit hook to get fresh working copy:<br /><blockquote><span style="font-size:85%;">cp -v /usr/local/subversion/repository/hooks/post-commit.tmpl /usr/local/subversion/repository/hooks/post-commit<br />chmod +x /usr/local/subversion/repository/hooks/post-commit<br /></span></blockquote><br />Edit post-commit hook by commenting two last lines and by adding one line like this:<br /><blockquote><span style="font-size:85%;">#commit-email.pl "$REPOS" "$REV" commit-watchers@example.org<br />#log-commit.py --repository "$REPOS" --revision "$REV"<br />/usr/bin/svn update /usr/local/svn-projects/htdocs/ --username svn_user --password svn_pass --non-interactive >> /usr/local/subversion/repository/logs/post-commit.log<br /></span></blockquote><br />Make log file for created hook:<br /><blockquote><span style="font-size:85%;">mkdir -v /usr/local/subversion/repository/logs/<br />touch /usr/local/subversion/repository/logs/post-commit.log<br />chown -Rv apache.apache /usr/local/subversion/ /usr/local/svn-projects/<br /></span></blockquote><br />Restart your apache and you'll have your first revision working:<br /><blockquote><span style="font-size:85%;">/bin/sbin/httpd -k restart</span></blockquote><br />Cheers!zlyhttp://www.blogger.com/profile/04704304346626136240noreply@blogger.com0