Monday, December 27, 2010
How to show octave line by line output in real time
Tuesday, November 30, 2010
How to install google chrome browser behind firewall, download standalone
Here is the link:http://www.google.com/chrome/eula.html?standalone=1&hl=en&brand=CHMA
Saturday, November 27, 2010
Thursday, November 4, 2010
Python max index numpy.argmax(asarray(
[A I]=max(Array)
And get I the index of the maximum value. To do this in sage (python) I finally ended up with this command:
I=numpy.argmax(asarray(Array))
Where Array is my python list, I have to use asarray() to convert it to a numpy array. Then the argmax returns the first occurrence of the maximum.
Wednesday, October 20, 2010
apache2 and sagemath both on port 80 using mod_proxy etc..
Put this in your HTTP.conf
DocumentRoot /var/www/sage/
ServerName sage.mysite.com
ServerAlias www.sage.mysite.com
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass / http://mysite.com:8000/
ProxyPassReverse / http://mysite.com:8000/
Sunday, October 17, 2010
Ubuntu server send SMS text messages to cell phone
10-digit wireless number@mms.att.net
For example
If my area code was 775 and my phone number was 111-3333 I would do:
7751113333@mms.att.net
So if I was using PHP my code would be:
$phoneNumber=7751113333
$to = $phoneNumber."@mms.att.net"; //combine phone number to send message
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("
Message successfully sent!
");} else {
echo("
Message delivery failed...
");}
Wednesday, October 13, 2010
Running sage math on android OS / phone
Here is a photo:
The build took 14.5 days and the conlcusion was for now you are much better off having a sage notebook
server. Maybe as stats continue to improve you can run one locally.
The original post can be read here:
I have compiled and run Sage 3.2.3 on my T-Mobile G1 cell phone, and
large portions of it actually work.
300 files had failing doctests; this means that all doctests passed in
864 files. A lot of the failing doctests are with pexpect (maxima,
gap, etc.); I don't know why these fail. When I try simple things
with gap and maxima, they do work. Many more tests fail due to
timeouts; the 300-second timeout is far too short for the G1.
(Doctesting any file with doctests takes >50 seconds; doctesting a
file with no doctests takes >4 seconds. The entire doctest run took
270724 seconds, or a little over 3 days.)
Unfortunately, it's far too slow to be useful for anything (just
starting Sage takes about a minute, if there's enough free memory; but
since Android likes to keep the memory full all the time, there never
is enough free memory, and it takes much longer to start). So I don't
plan to do anything further with the project.
Of course, the sensible way to do this is to find some nice fast
computer and set up a cross-compiler. I didn't do this the sensible
way; I actually did the build on the cell phone. And of course, the
build would stop every once in a while due to a bug, which I would
then patch around. So, adding up the 14 chunks of compilation
involved, the entire compile took 20943 minutes of real time (about
14.5 days) and 9438 minutes (about 6.5 days) of CPU time. You'll note
that the CPU time adds up to less than half of the real time; most of
the rest of the time was spent swapping. The G1 has about 100MB of
RAM; I set up a swap file on my micro-SD card, to allow the build to
proceed at all. On several files, the compiler uses more than 300MB.
While compiling those files, the CPU is typically less than 1% active;
I'm pretty sure that there were files that took more than a day to
compile. The phone was essentially unusable for smartphone activities
(web browsing, etc.) while the build was running. In fact, the whole
smartphone UI crashed and restarted on a fairly regular basis during
the build (I'm guessing it has some sort of watchdog timer and reboots
itself if it detects that some operation is taking an unreasonably
long time), but the build just continued anyway (running inside a
screen session).
The ATLAS tuning process took about 3.2 days (with almost as much CPU
time as real time; that didn't swap much). Skimming through the logs,
I see reports of numbers like 3 to 6 MFLOPs.
The build was performed inside a Debian armel testing chroot; it's
pretty nice being able to run real Debian on my cell phone.
(Everything works; I can ssh in and out, etc., although when it's on
the cell phone network, inbound connections are problematic because
it's behind a NAT.)
To make the whole project even more pointless, since the phone is
running real Debian (inside the chroot), I can probably just wait a
few weeks or months for Tim Abbott to get all the portability issues
fixed in the sagemath Debian package, and then install Sage on the
phone with apt-get.
Here's the processor:
cwitty@localhost:/tmp$ cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 2 (v6l)
BogoMIPS : 383.38
Features : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 6TEJ
CPU variant : 0x1
CPU part : 0xb36
CPU revision : 2
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size : 32768
I assoc : 4
I line length : 32
I sets : 256
D size : 32768
D assoc : 4
D line length : 32
D sets : 256
Hardware : trout
Revision : 0080
Serial : 0000000000000000
http://groups.google.com/group/sage-devel/browse_thread/thread/243dfd4ab25a2779/ea5b45f313b46460
Wednesday, October 6, 2010
javascript replace all character occurances in one line
var myOldString = "x%=
%%%%0.4218%%%%0.7922
%%%%0.9157%%%%0.9595
";
And I want to replace all of the % with space I can use javascript and use the '/g' modifier to replace all:
temp = myOldString.replace(/%/g,' ');
If I had done:
temp = myOldString.replace('%',' ');
It would have only replaced the first occurance which was not what I wanted.
Tuesday, October 5, 2010
matlab eval 2 string linebreak to
eval2str.m
The evalc() Matlab function returns a character array, but I wanted a string I could send through a socket to a website.
I had an issue with finding the exact line break, I tried char(10) and '\n' but that did not work so I cheated. Here is my cheat:
function STR2=eval2str(msg)
STR=evalc(msg) %eval input
A=evalc('X=2') %eval to get character? char(10) and \n did not work for me?
STR=strrep(STR,' ','%') %I justed used this to temporarily replace the spaces
STR2=strrep(STR,A(4),'
') %ln2br
So if I input eval2str('X=rand(2,2)') I get a string like this:
x%=
%%%%0.4218%%%%0.7922
%%%%0.9157%%%%0.9595
Which is a string I can pass through my socket and then replace the % with ' ' on the otherside. So I can use Matlab to eval to a string output and send over a socket for a matlab server :).
Tuesday, August 24, 2010
Create great latex PDF figs using Open Office Draw
1: Export your as PDF from OpenOffice Draw
If I saved my file as CoolFigure.pdf then I would do:
2. pdftops -eps CoolFigure.pdf
3. cat CoolFigure.eps | ps2eps > CoolFigure.eps && epstopdf CoolFigure.eps
Then to include it in my Latex document I just do:
4. \begin{figure}
\includegraphics[width=4in]{CoolFigure}
\end{figure}
Saturday, July 31, 2010
How to install Matlab on ubuntu server 10.04 via command line
./install -t
for the text install but I got an error after the license agreement:
update/bin/glnxa64/xsetup: error while loading shared libraries: libXp.so.6 cannot open shared object file: No such file or directory
I did this:
apt-get install libxp6
and then it worked just fine using ./install -t
Hopefully this saves somebody some time, and stops them from doing a ubuntu-desktop install on a server just to install Matlab
Thursday, July 8, 2010
True multithreading in PHP! Spawn new threads in webpage
Here is an example:
So from the command line I can do:
php -r 'PUT_YOUR_PHP_CODE_HERE_WITHOUT_ESCAPES;'
well there is no reason you can't call the a system call from your website, so I am doing something like this:
$exec_string="php -r 'PUT_YOUR_PHP_CODE_HERE_WITHOUT_ESCAPES' > /dev/null 2>&1 &";
exec($exec_string,$output);
The command: 2>&1 & at the end is what I am using the escape the string rather than waiting for it to finish.
$exec_string="php -r 'mail(\"".$_POST['user']."\",\"".$string1."\",\"".$bericht."\",\"".$string2."\");' > /dev/null 2>&1 &";
exec($exec_string,$output);
Monday, January 11, 2010
How to install SAPPHIRE HD5770 on ubuntu 9.10 and get it working
ati-driver-installer-9-12-x86.x86_64.run
Now run:
ati-driver-installer-9-12-x86.x86_64.run
Then:
sudo aticonfig --initial -f
Then reboot and settings worked just fine allowing me to configure advanced desktop settings
Wednesday, January 6, 2010
IP addresses you should hack and not feel bad about
Edit Delete 1 213.79.93.188
Edit Delete 2 193.63.181.11
Edit Delete 3 69.32.139.171
Edit Delete 4 72.3.139.247
Edit Delete 5 85.140.185.219
Edit Delete 6 157.138.204.166
Edit Delete 7 128.243.21.224
Edit Delete 8 129.194.8.73
Edit Delete 9 68.68.104.34
Edit Delete 10 85.140.65.67
Edit Delete 11 147.156.98.148
Edit Delete 12 66.147.136.40
Edit Delete 13 194.82.16.252
Let me help you get started:
Using the UNIX command NMAP you can do:
nmap -A -T4 147.156.98.148 to find out what services are running. The ouput for this IP is:
SCRIPT ENGINE: Aborting script scan.
Interesting ports on open9.irobot.uv.es (147.156.98.148):
Not shown: 1708 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh (protocol 2.0)
80/tcp open http Apache httpd 2.2.11 ((Ubuntu) PHP/5.2.6-3ubuntu4.2 with Suhosin-Patch)
443/tcp closed https
5900/tcp closed vnc
5901/tcp closed vnc-1
5902/tcp closed vnc-2
5903/tcp closed vnc-3
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
SF-Port22-TCP:V=4.62%I=7%D=1/6%Time=4B44D19C%P=i686-pc-linux-gnu%r(NULL,27
SF:,"SSH-2\.0-OpenSSH_5\.1p1\x20Debian-5ubuntu1\r\n");
Some areas to start would be trying to do a brute force on the SSH server, or VNC server incase the password was simple, or find vulnerabilities in the webserver, the kernel may have a security hole since it is older... etc.. etc..
Friday, January 1, 2010
You have not chosen to trust "Thawte Premium Server CA", the issuer of the server's security certificate (SSL error 61) ubuntu citrix ICA client FIX
I use a citrix ICA client to remote into work and I began to get the error:
You have not chosen to trust "Thawte Premium Server CA", the issuer of the server's security certificate (SSL error 61)
To fix this I downloaded the new root certificates:
wget https://www.verisign.com/support/thawte-roots.zip
unzip thawte-roots.zip
Now we need to find were we need to put the new cert file, I found this by searching doing this:
find -name *cacert*
I copied the new file using this command:
sudo cp -v Thawte\ Roots/Thawte\ SSLWeb\ Server\ Roots/Thawte\ Premium\ Server\ CA.cer ~/./ICAClient/linuxx86/keystore/cacerts/ThawtePremiumServerCA.crt
Then I retried the citrix ICA client, did not even need to restart my browser, and it worked!