tag:blogger.com,1999:blog-63757100264823539962024-02-29T08:26:33.482+01:00powered by caffeineprogrammer: a device to convert coffee into software<br>
programmers: fixing other people's mistakes since 1908<br>
programmer: are expected to know how to do things they've never done before<br>and estimate how long they will take<br>
There are 10 types of people in this world. Those who know base 3, those who don't & those who expected a binary joke.Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.comBlogger49125tag:blogger.com,1999:blog-6375710026482353996.post-87987514880485457022014-07-26T22:39:00.002+02:002014-07-27T11:03:45.427+02:00Coffee machine code kataCode a bean-to-cup coffee machine. You can decide how much capacity the watertank has and how much half a cup / a cup is. (<i>Aside: Why? Because I've always wanted to do it.</i>)<br />
<br />
<h3>
Lights </h3>
<ul>
<li>brewing</li>
<li>heating up</li>
<li>clean waste container</li>
<li>refill water</li>
<li>no beans</li>
<ul>
</ul>
</ul>
<h3>
Featues (grinding + brewing = duration until cup is finished)</h3>
<ul>
<li>grinding (how much coffee)</li>
<ul>
<li>strong: 7 seconds</li>
<li>normal: 5 seconds</li>
<li>mild: 3 seconds</li>
<ul>
</ul>
</ul>
<li>brew half a cup, 15 seconds</li>
<li>brew a cup, 30 seconds</li>
<li>hot steam to preheat cups (blocks brewing and visa versa)</li>
<ul>
</ul>
</ul>
<h3>
Buttons</h3>
<ul>
<li>on / off (starts heating, heating always takes 20 seconds)</li>
<li>half a cup / cup (default: half a cup)</li>
<li>grinding</li>
<ul>
<li>pressed once: thin</li>
<li>pressed twice: normal (default)</li>
<li>pressed thrice: strong</li>
<ul>
</ul>
</ul>
<li>steam</li>
<li>start</li>
<ul>
</ul>
</ul>
So if you turn it on and the heating light shows that it's heated up and you press the start button it would brew half a cup normal coffee. It would take: 20 seconds (heatup) + 5 seconds (grinding) + 15 seconds (brewing) = 40 seconds.<br />
<br />
<div>
<br /></div>
<div>
Imagine it as something like the thing shown below:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWFUbfy7UyvO7OxKtc-RqnViyL7SMSUb3Pj4hO0U87MW9ZpP8mx5Wmmmyhn4CjyILOm-6XOEbRsJC8XuQVcz2_TFlsM0C8abS9Updelo-TYgR3Ku9dB3cxEjzwzTizW5TdZ19Fa5vdOPQ/s1600/coffeemachine.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWFUbfy7UyvO7OxKtc-RqnViyL7SMSUb3Pj4hO0U87MW9ZpP8mx5Wmmmyhn4CjyILOm-6XOEbRsJC8XuQVcz2_TFlsM0C8abS9Updelo-TYgR3Ku9dB3cxEjzwzTizW5TdZ19Fa5vdOPQ/s1600/coffeemachine.jpg" height="320" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<b><span style="font-size: large;">If you like to improve this kata, fork it on <a href="https://github.com/mdix/Coffee-machine-code-kata" target="_blank">github</a> and make a pullrequest.</span></b></div>
<div>
<br /></div>
Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-53801655955554871142013-03-20T10:28:00.003+01:002013-03-27T22:57:46.180+01:00Query wordpress posts by id and return array of entire post objectsCaused me some headache. I had to query posts inside a wordpress extension by their id and return an array of the corresponding post objects. At the moment this is the best solution I found for the problem, even if the code doesn't clearly state what I am doing:<br />
<br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> query_posts(array('post__in' => $this->postids, 'post_type'=> ''));</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> $posts = array();</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></span>
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> while (have_posts()) {</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> the_post();</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> $posts[] = get_post(get_the_ID());</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> }</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></span>
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> wp_reset_query();</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace;"> return $posts;</span></span><br />
<span style="background-color: #d0e0e3;"><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></span>
So first we query the posts by id. Then we start with the loop and use get_post() to get the post. get_post() sadly doesn't return the current post by default, so we have to pass it the id of the current post (this is so stupid). Once we pass the id it returns a post object which we store inside the $posts array which is returned at the end of the method.<br />
<br />
Check <a href="http://codex.wordpress.org/Function_Reference/get_post">http://codex.wordpress.org/Function_Reference/get_post</a>, you might also return the posts as an numeric / associative array instead of an object if you like.<br />
<br />
<br />Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-79845612736055448342012-12-20T22:47:00.004+01:002012-12-20T22:48:30.878+01:00Number of pages inside a pdf<span style="background-color: #d9ead3; color: #362b36; font-family: Helvetica, Arial, sans-serif; font-size: 13px;">$ grep -o "'Page[0-9]*'" your.pdf | tail -1 | grep -o "[0-9]*"</span>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-21664110115340603362012-11-09T18:22:00.003+01:002012-11-09T18:33:48.360+01:00wildcard && brace expansion -eq <3<span style="background-color: #d9ead3;">mplayer *s05e0{1,2,3}*</span><br />
<span style="background-color: #d9ead3;"><br /></span>
Queues the following files:<br />
xyz.s05e01.someformat<br />
abc.s05e02.someotherformat<br />
123.s05e03.format<br />
...<br />
<br />
Check <a href="http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html" target="_blank">http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-60291768863569308852012-10-22T08:32:00.003+02:002012-11-09T18:34:10.381+01:00undefined symbol: apr_reslist_maintain after upgrading httpd on Slackware 13.37After upgrading apache to the latest patch (<a href="ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/">ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/</a>) you get that error: "/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_reslist_maintain" when starting httpd / apache.<br />
<br />
In order to resolve it you have to update apr (<span style="background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.200000762939453px;"><b>Apache Portable Runtime</b>, makes sense, huh? ;))</span> and apr-util to the latest patched versions (get them here <a href="ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/">ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/</a>).Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-40491655572564282972012-10-18T21:51:00.001+02:002012-11-09T18:34:20.895+01:00"QGtkStyle was unable to detect the current GTK+ theme." [SOLVED]Finally found the solution:<br />
<br />
<span style="background-color: #d9ead3; font-family: Courier New, Courier, monospace;">gconftool-2 --set --type string /desktop/gnome/interface/gtk_theme your-theme-name</span><br />
<span style="background-color: #d9ead3; font-family: Courier New, Courier, monospace;"><br /></span>
Source: <a href="https://bbs.archlinux.org/viewtopic.php?pid=1067521">https://bbs.archlinux.org/viewtopic.php?pid=1067521</a><br />
Source: <a href="http://forums.opensuse.org/english/get-technical-help-here/network-internet/455664-errors.html">http://forums.opensuse.org/english/get-technical-help-here/network-internet/455664-errors.html</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-45222248319342495532012-09-25T22:17:00.000+02:002012-12-01T14:23:37.850+01:00Show single image with xlockTook me a while to figure out how to simply show an image when locking with xlock:<br />
<br />
<span style="background-color: white;">$ xlock </span><span style="background-color: #fce5cd;">-mode image</span><span style="background-color: white;"> </span><span style="background-color: #d9ead3;">-bitmap image.xpm</span><span style="background-color: white;"> </span><span style="background-color: #cfe2f3;">-count 1</span><br />
<br />
<span style="background-color: #fce5cd;">-mode image</span>: sets the mode to only display random sun images<br />
<span style="background-color: #d9ead3;">-bitmap image.xpm</span>: replace the random sun images with image.xpm (*)<br />
<span style="background-color: #cfe2f3;">-count 1</span>: sets the amount of images that shall be shown at the screen at once to 1<br />
<br />
* use ImageMagicks 'convert' method to convert to xpm:<span style="background-color: white;"> $ convert input.jpg output.xpm</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">Have fun!</span><br />
<br />Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com2tag:blogger.com,1999:blog-6375710026482353996.post-24319379202972462502012-07-04T13:30:00.000+02:002012-07-04T13:31:24.416+02:00x121e Cardreader (rtl_pstor) - Kernel 3.4.4 menuconfigTook me a while to figure out where the driver for my cardreader resides. In menuconfig go this path:<br />
<br />
<b>Device Drivers -> Staging drivers</b><span style="background-color: white;"><b><br /></b><br />and check this one, either as module or builtin:</span><br />
<br />
<b>RealTek PCI-E Card Reader support</b>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-13740393343744392822012-06-22T17:05:00.000+02:002012-07-04T10:29:18.778+02:00Easy rounding with Javascript round() wrapperReally simple method to easily round with javascript:<br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;">function round (number, fractionalDigits) {</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> "use strict";</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> if (!number) {</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> return; </span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> var multiplicator = 1;</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> while (fractionalDigits--) {</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> multiplicator *= 10;</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> return Math.round(number * multiplicator) / multiplicator;</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;">}</span><br />
<br />
Just pass in the number to round and the number of fractionalDigits you'd like to keep, like:<br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">round(95.12345, 2); will return 95.12</span><br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">round(95.54555, 4); will return 95.55</span><br />
<br />
If you omit the last param, you'll get no fractionalDigit, like:<br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">round(95.12345); will return 95</span><br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">round(95.50000); will return 96</span><br />
<br />
<b>One last call: Don't use it as is, create a namespace for it to reside in! </b><br />
<b style="background-color: white;"><br /></b><br />
<b style="background-color: white;">Or append it to Number, then you can remove the number param. ;)</b><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;">Number.prototype.round = function(fractionalDigits) {</span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> "use strict";</span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> var multiplicator = 1; </span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> while (fractionalDigits--) { </span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> multiplicator *= 10; </span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> } </span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;"> return Math.round(this * multiplicator) / multiplicator;</span></span><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;">}</span></span><br />
<br />
<span style="background-color: white;">Call it like:</span><br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">var number = 8.12345;</span><br />
<span style="background-color: #fce5cd; font-family: 'Courier New', Courier, monospace;">number.round(2); will return 8.12</span><br />
<b><br /></b><br />
<b>Have fun! </b>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-9144937368557972322012-06-21T13:39:00.000+02:002012-06-21T13:39:59.751+02:00Aw, snap when searching with omnibox on chromiumFor some days now I get that annoying "Aw, snap" window when I try to search with the omnibox in chromium. What I tried so far:<br />
- clear /tmp<br />
- rm ~/.config/chromium<br />
- rm ~/.cache/chromium<br />
- install another version (19, 20, 21..)<br />
<br />
Nothing helped. In a fit of despair I rushed to the settings and checked "<b>Enable Instant for faster searching</b>" (even if I really really don't like that feature). This seems to be a good workaround because the "Aw, snap" page stays away...Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-80731823874699103202012-06-18T09:24:00.001+02:002012-07-03T12:38:13.323+02:00No longer Skype beta on Linux - Skype 4.0!Skype 4.0 has been released.<br />
Of course, there's no Slackware-Package available from the Skype homepage. (Who knew? ;))<br />
<br />
<b>If you want to upgrade to Skype 4.0 today, you can use this Source-Package:</b><br />
<a href="http://download.skype.com/linux/skype-4.0.0.7.tar.bz2" target="_blank">http://download.skype.com/linux/skype-4.0.0.7.tar.bz2</a><br />
<br />
<b>and build it by using this SlackBuild:</b><br />
<a href="https://github.com/willysr/SlackHacks/tree/master/SlackBuild" target="_blank">https://github.com/willysr/SlackHacks/tree/master/SlackBuild</a><br />
<br />
The SlackBuild script linked above has also been submitted to slackbuilds.org, but currently it's in the <a href="http://slackbuilds.org/pending/" target="_blank">pending queue</a> (and I've seen script in the pending queue for about two months, so don't count on that :)).<br />
<br />
<b>NOTE:</b> If you're on a 64 bit Slackware you need to add 32 bit librarys. See this page for further information: <a href="http://www.linuxquestions.org/questions/slackware-14/skype-4-0-on-slackware-13-37-64bit-4175411533/" target="_blank">http://www.linuxquestions.org/questions/slackware-14/skype-4-0-on-slackware-13-37-64bit-4175411533/</a><br />
<br />
Have fun... well, you have fun, I mean, you're using Slackware. :)<br />
<br />
<b><span style="color: #990000;">Edit: Ahh, finally there's a fresh, warm, approved <a href="http://slackbuilds.org/repository/13.37/network/skype/" target="_blank">Slackbuild</a> available.</span></b>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-76177219797716438732012-06-10T20:38:00.000+02:002012-06-10T20:38:31.702+02:00Beat me! (laptop power consumption)<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuKwwJo2pkyfESH0EYzBsAFLq6J1hPHBt8JUzOuxOmYVLWAktL-6sovoci3gWNPfZzb1AP8fwznyE6fRJHtLCFUrfQWuyHyP_t7jje1R8nxpb_tCAmX4T1jpNEMsx4upJdn_m3mK-USNE/s1600/7_62_powertop.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuKwwJo2pkyfESH0EYzBsAFLq6J1hPHBt8JUzOuxOmYVLWAktL-6sovoci3gWNPfZzb1AP8fwznyE6fRJHtLCFUrfQWuyHyP_t7jje1R8nxpb_tCAmX4T1jpNEMsx4upJdn_m3mK-USNE/s320/7_62_powertop.png" width="320" /></a></div><br />
<b>Settings:</b><br />
- Display off (don't know why backlight still consumes power, any suggestions?)<br />
- wifi blocked via rfkill<br />
- powersave governor<br />
- disabled cpu 123, only 0 active (on the fly)<br />
- hdparm -B 1 -S 1<br />
- vm writeback (60 seconds, stock Slackware)<br />
- disabled fan (loading thinkpad_acpi module via options thinkpad_acpi fan_control=1 (yeah, I cheated :)))<br />
<div style="text-align: left;">- mounted root with 'relatime' param to reduce disk spin-up</div><div style="text-align: left;">- enabled GPU RC6 mode via kernel params (<span style="background-color: #f0f0f0; color: #302b2b; font-size: 15px; line-height: 1.3; text-align: justify; white-space: pre-wrap;">pcie_aspm=force acpi=noirq i915.i915_enable_rc6=1)</span></div><div style="text-align: left;"><br />
</div><div style="text-align: left;">Look at the right to see what laptop I use!</div>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-57481947448707581692012-02-17T07:29:00.007+01:002012-02-17T07:52:46.476+01:00No need for temporary variable (Javascript)Assume you have a function, and that function has a param (called 'config' herein) which may be a string or an object. Inside your function, you check for the type and if it's a string, you want to make this strings value a property of your object.<br />
<div><br />
</div><div>My first, fast approach was this one:</div><div><div><span style="background-color: #f4cccc; font-family: 'Courier New', Courier, monospace;">var url = config;</span></div><div><span style="background-color: #f4cccc; font-family: 'Courier New', Courier, monospace;">config = {};</span></div><div><span style="background-color: #f4cccc; font-family: 'Courier New', Courier, monospace;">config.videoLink = url;</span></div></div><div><span style="background-color: #f4cccc; font-family: 'Courier New', Courier, monospace;"><br />
</span></div>My second approach looked like this:<br />
<div><div><span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">var url = config;</span></div><div><span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">config = {videoLink: url};</span></div><div><span style="font-family: 'Courier New', Courier, monospace;"><br />
</span></div></div>I thought about what's happening in those statements and realized that the temporary variable 'url' is not needed, because javascript is executing the assignement from right to left, means I can override 'config' with an object that keeps the original value of config as a property. See this third & final approach:<br />
<div><span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"><span class="nx" style="color: #333333; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">config</span><span style="color: #333333; line-height: 16px; white-space: pre;"> </span><span class="o" style="color: #333333; font-weight: bold; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">=</span><span style="color: #333333; line-height: 16px; white-space: pre;"> </span><span class="p" style="color: #333333; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">{</span><span class="nx" style="color: #333333; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">videoHash</span><span class="o" style="color: #333333; font-weight: bold; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">:</span><span style="color: #333333; line-height: 16px; white-space: pre;"> </span><span class="nx" style="color: #333333; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">config</span><span class="p" style="color: #333333; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: pre;">};</span></span> </div><div><br />
So Javascript builds the object, assigns the value of config (string) to videoHash and assigns this object to config, which now is a object as desired.</div>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-25739376213473815512012-02-01T18:53:00.001+01:002012-02-01T18:54:52.439+01:00xfce4-screenshooter 1.7.9 - Segmentation Fault on startupWhen starting xfce4-screenshooter, there's an segmentation fault message and it (of course) doesn't start up. The solution is pretty simple:<br />
<br />
<span style="-webkit-text-size-adjust: none; background-color: #d9ead3; white-space: pre-wrap;"><span style="font-family: 'Courier New', Courier, monospace;">touch ~/.config/xfce4/xfce4-screenshooter</span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="-webkit-text-size-adjust: none; white-space: pre-wrap;"> </span></span><br />
Source: <a href="http://www.linuxquestions.org/questions/slackware-14/where-to-get-xfce4-8-goodies-etc-885538/#post4382696">http://www.linuxquestions.org/questions/slackware-14/where-to-get-xfce4-8-goodies-etc-885538/#post4382696</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-51291918685108772452012-01-21T23:35:00.001+01:002012-01-21T23:35:20.730+01:00wicd-gtk / wicd-client (tray) not starting, glib.GError: Unable to connect to serverStart wicd-client with '-n' - disable notifications and everything is fine. See source below if you want to use notifiations:<br />
<br />
Source: <a href="https://bbs.archlinux.org/viewtopic.php?id=108666">https://bbs.archlinux.org/viewtopic.php?id=108666</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-28533333257146531062012-01-13T22:05:00.000+01:002012-01-13T22:05:45.858+01:00Headphonejack not working on x121 w. Slackware 13.37 - Kernel 2.6.37-6Use alsaconf to create config file. Edit the created config file /etc/modprobe.d/sound.conf , add the following line:<br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">options snd-hda-intel model=thinkpad</span><br />
<br />
Save and either reload modules or reboot.<br />
<div><br />
</div>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-42462853139901534942012-01-09T22:19:00.001+01:002012-01-09T22:19:50.951+01:00Keycodes & XCool tutorial on keycodes and how they are noticed by the kernel (& passed to X). <a href="http://fail2fail.com/archives/2-Hardware-Tasten-unter-Linux-unabhaengig-von-Desktop-Umgebung-nutzen.html">http://fail2fail.com/archives/2-Hardware-Tasten-unter-Linux-unabhaengig-von-Desktop-Umgebung-nutzen.html</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-31230609101546279332012-01-02T07:55:00.004+01:002012-01-02T07:59:16.946+01:00Building latest Chromium on SlackwareNice Slackbuild on Github, frequently updated:<br />
<a href="https://github.com/yucatan/chromium">https://github.com/yucatan/chromium</a><br />
<br />
Edit: Don't forget to replace make with make -j2 in file chromium.SlackBuild on a dualcore system to use both cores. :)Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-23438102090787003992012-01-01T18:52:00.001+01:002012-01-01T18:52:25.042+01:00pm-tools - dig deeperNice howto, even if it's for gentoo:<br />
<br />
<a href="http://www.gentoo.de/doc/de/power-management-guide.xml">http://www.gentoo.de/doc/de/power-management-guide.xml</a>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-14143050633487217032011-12-28T11:28:00.000+01:002011-12-28T11:28:32.752+01:00Install xfce4-power-manager Slackware 13.37 - shows no Battery statushttp://goodies.xfce.org/projects/applications/xfce4-power-manager needs upower (http://slackbuilds.org/repository/13.37/system/upower/) - install upower, restart power-manager and battery state is fine.Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-29797262498070353632011-12-21T10:54:00.000+01:002011-12-21T10:54:30.043+01:00setTimeout() && setInterval() scope problem solver<pre class="default prettyprint" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: left; vertical-align: baseline; width: auto;"><code style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span style="font-family: Arial, Helvetica, sans-serif;">This is so handy from time to time:</span></span></code></pre><pre class="default prettyprint" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: left; vertical-align: baseline; width: auto;"><code style="background-attachment: initial; background-clip: initial; background-color: #d9ead3; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span style="font-family: 'Courier New', Courier, monospace;"><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">setInterval</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">function</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">() </span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> myVar </span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> document</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">getElementById</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">(</span><span class="str" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">"givenID"</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
setTimeout</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">function</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">() </span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="com" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">// myVar is available because the inner closure </span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="com" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">// gets the outer closures scope</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
myVar</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">innerHTML </span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> </span><span class="str" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">"Junk"</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> },</span><span class="lit" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">2000</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">},</span><span class="pln" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> </span><span class="lit" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">10000</span><span class="pun" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">);</span></span></code></pre><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Source: <a href="http://stackoverflow.com/questions/237350/how-to-solve-var-out-of-scope-within-settimeout-call" target="_blank">Stackoverflow</a></span>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-53035761885991385022011-12-20T10:26:00.008+01:002011-12-21T21:03:15.266+01:00Sencha Touch 1.1 - Adding a record and removing it doesn't work<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>I did the following and it worked well:</b></span><br />
<div><span style="font-family: Arial, Helvetica, sans-serif;">Add an entry - reload the app - delete that entry</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>I did the following and it didn't work:</b></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">Add an entry - delete that entry</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Why?</b></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">I started to debug both cases paralelly. In both cases I found the new record in the object that is used to determine what has to be done, but for some strange reason in the case of adding and directly deleting that entry Sencha Touch doesn't find the entry. </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">What I did is really simple: After running the </span><span style="font-family: 'Courier New', Courier, monospace;">store.remove(record)</span><span style="font-family: Arial, Helvetica, sans-serif;"> method I check if there's a record in the </span><span style="font-family: 'Courier New', Courier, monospace;">store.removed</span><span style="font-family: Arial, Helvetica, sans-serif;"> property. If not, I add that record manually. You can as well fully remove the </span><span style="font-family: 'Courier New', Courier, monospace;">store.remove(record)</span><span style="font-family: Arial, Helvetica, sans-serif;"> method call and write the record directly into the property. It's up to you.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
After you did that you just need to call </span><span style="font-family: 'Courier New', Courier, monospace;">store.destroy()</span><span style="font-family: Arial, Helvetica, sans-serif;"> to remove the record.</span></div>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-63332356055784432192011-12-20T09:18:00.003+01:002011-12-21T15:27:13.040+01:00Sencha Touch 1.1 - CRUD actions & callbacks via REST proxy<b><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">CRUD actions</span></b><br />
<b><span style="font-family: Arial, Helvetica, sans-serif;">Methods without value param (update, destroy):</span></b><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;">store.update({</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> callback: function(answer, object, success) {</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> if (success) { ... }</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="background-color: #d9ead3;">});</span><br />
</span><br />
<span style="background-color: #fff2cc;"><span style="font-family: 'Courier New', Courier, monospace;">store.destroy</span><span style="font-family: 'Courier New', Courier, monospace;">({</span></span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> callback: function(answer, object, success) {</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> if (success) { ... }</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">});</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<b><span style="font-family: Arial, Helvetica, sans-serif;">Methods with value param (create, load):</span></b><br />
<span style="background-color: #d9ead3;"><span style="font-family: 'Courier New', Courier, monospace;">store.create</span><span style="font-family: 'Courier New', Courier, monospace;">(values, {</span></span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> callback: function(answer, object, success) {</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> if (success) { ... }</span><br />
<span style="background-color: #d9ead3; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="background-color: #d9ead3;">});</span><br />
</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">store.load</span><span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">({</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> callback: function(answer, object, success) {</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> if (success) { ... }</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="background-color: #fff2cc; font-family: 'Courier New', Courier, monospace;">});</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CRUD action executes only once?</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you can run some of these functions once and after that no XHR is made, it may be because you encountered this bug: <a href="http://www.sencha.com/forum/showthread.php?144404-Store.loadData-doesn-t-update-Snapshot-when-loadData-is-called-second-time" target="_blank">Bug @ Sencha Forum</a></span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">I solved this bug by setting store.snapshot to false, so the function that engages the XHR is no longer looking for changes in the snapshot but in the store object.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-70314560154060679192011-12-11T16:15:00.004+01:002011-12-20T09:20:01.876+01:00Enable cups<pre class="code">chmod +x /etc/rc.d/rc.<span class="search_hit">cups</span>
/etc/rc.d/rc.<span class="search_hit">cups</span> start
</pre><pre class="code"><span style="font-family: Arial, Helvetica, sans-serif;">Source: <a href="http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:cups#setting_up_the_cups_service%20">alien slackbook</a> </span></pre>Marchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0tag:blogger.com,1999:blog-6375710026482353996.post-89637191787671445452011-12-11T15:38:00.000+01:002011-12-11T15:38:59.055+01:00Slackware local shutdown script (to wipe out /tmp etc.)Doesn't exist, but according to rc.local it's ok to create & use it :)<br />
<br />
/etc/rc.d/rc.local_shutdownMarchttp://www.blogger.com/profile/15971736016995618943noreply@blogger.com0