I asked a question on probably one of the higher traffic forums, and it was answered within an hour. It still took 3 people to put together the answer because one line of code couldn’t work without the other. I had to have about the same level of technical knowledge to make use of the information and ask the question. What made this answer question style different was that the question was answered immediately unlike some other forums I’ve used. You can see it for yourself here:
Python FTP Most Recent File – Stack Overflow
Coincidence? It was on this website that I first heard of dive into python, the online book I used to learn the language. Except I learned dive into python 3 and asked the question from Google. A lot can be said about the use of the democratic process where knowledge matters.
While working on a word search generator that translated letter symbols (sort of like cryptograms, except this one’s impossible to solve without the key), php ran out of memory on a rather ordinary function.
function uniord
($c) {
$h = ord($c{0});
if ($h <
;= 0x7F) {
return $h;
} else if ($h <
; 0xC2) {
return false;
} else if ($h <
;= 0xDF) {
return ($h &
; 0x1F) <
;<
; 6 | (ord($c{1}) &
; 0x3F);
} else if ($h <
;= 0xEF) {
return ($h &
; 0x0F) <
;<
; 12 | (ord($c{1}) &
; 0x3F) <
;<
; 6
| (ord($c{2}) &
; 0x3F);
} else if ($h <
;= 0xF4) {
return ($h &
; 0x0F) <
;<
; 18 | (ord($c{1}) &
; 0x3F) <
;<
; 12
| (ord($c{2}) &
; 0x3F) <
;<
; 6
| (ord($c{3}) &
; 0x3F);
} else {
return false;
}
}
function unichr
($c) {
if ($c <
;= 0x7F) {
return chr($c);
} else if ($c <
;= 0x7FF) {
return chr(0xC0 | $c >
;>
; 6) . chr(0x80 | $c &
; 0x3F);
} else if ($c <
;= 0xFFFF) {
return chr(0xE0 | $c >
;>
; 12) . chr(0x80 | $c >
;>
; 6 &
; 0x3F)
. chr(0x80 | $c &
; 0x3F);
} else if ($c <
;= 0x10FFFF) {
return chr(0xF0 | $c >
;>
; 18) . chr(0x80 | $c >
;>
; 12 &
; 0x3F)
. chr(0x80 | $c >
;>
; 6 &
; 0x3F)
. chr(0x80 | $c &
; 0x3F);
} else {
return false;
}
}
function asc_shift
($string, $amount) {
$key = substr($string, 0, 1);
if(strlen($string)==1) {
return unichr
(uniord
($key) + $amount);
} else {
return unichr
(uniord
($key) + $amount) . asc_shift
(substr($string, 1, strlen($string)-1), $amount);
}
}
Now I understand why there is a need for a lower level implementation of UTF-8 strings by default in php 6. Python support of UTF-8 support has already been included in Python 3.0 released December 3rd, 2008.
If you ever wanted to include PEAR.php in a script, but never installed it before on a shared host, a google search for pear.php download should have solved the problem. On the contrary, following the first links on google is a huge waste of time. In my situation, I only needed pear.php to instantiate a class. The intuitive solution is to just download the file and ftp it to the same location as the file that includes it. That works, except the official installation guide never says that.
As far as searchme goes, it now redirects to google. It did a better job of showing search result previews than GooglePreview.
Just a few things to note on Quirks:
- IBM’s Eclipse x86-64 for Windows is hidden. I can understand that the majority of Windows users don’t care about x86 or x86-64, but why keep the download hidden so that there’s no way to find it through links on the website? Now, the x86-64 version works fine and requires Java x86-64. You won’t have trouble finding Java x86-64 for Windows. It’s a drop-down menu under Operating System.(… I doubt the one for Linux works.) If you google search eclipse 3.5 64 bit, you get Eclipse Downloads and Eclipse IDE for 64-bit Windows and 64-bit Java « LingPipe Blog on Jul 21. I’d pick the second choice.
- eclipse Python 3: Python Development with PyDev and Eclipse – Tutorial or Python development with Eclipse and Ant. Again, IBM’s links are outdated.
- Becareful, Don’t Look BACK! If you want to write code that can be used on most installations, you’d better write it in Python 2 and use 2to3 whenever you want it to run on Python 3. Try searching for it. You get junk. And more hard to spell stuff.
If you want to make your system rock solid it’s a long process, but you have to do it sooner or later.
- This step is optional if you know how to edit USE flags. http://www.gentoo-wiki.info/Euse
- add glibc-omitfp and nptonly to your USE flages in /etc/make.conf. www.gentoo-wiki.info/HOWTO_Optimise_glibc#Enabling_further_optimizations
- if your are keen and want to save 90% of the space taken up by localization settings and some compile time, edit the locales. nano -w /etc/locale.gen http://www.gentoo.org/doc/en/guide-localization.xml
- delete unnecessary languages
- emerge glibc
- still staying very basic, add -malign-double to your CFLAGS, and test it by emerging dillo. www.gentoo-wiki.info/CFLAGS_matrix
Type dillo at the console and press enter.
Tryout the powersave or “standby” in windows.
http://powersave.sourceforge.net/kpowersave/introduction.html#starting
If you still have time, you might like stable transparencies.
http://fluxbox-wiki.org/index.php/Transparency
Do not use kuroo or emerge before completing the following steps :
Simply the console or terminal, type the commands, and hit enter.
su –
sabayon (sudo passwd to change)
emerge –sync
emerge portage
dispatch-conf
u (update)
layman -S
glsa-check -f all
dispatch-conf
u (update)
http://wiki.sabayonlinux.org/index.php?title=Tips
If you are bored with the above, start with detecting your hardware.
cat /proc/cpuinfo
http://www.gentoo-wiki.info/Detecting_your_Hardware
nano -w /etc/make.conf NOTE: ^ is ctrl
http://gentoo-wiki.info/Safe_Cflags