Nugroho's blog.

Tuesday, July 16, 2013

XFCE Display Manager with Opera on FreeBSD

Here is it, from the screenshot below you'll know that I'm trying download chrome but it apparently i got .exe chrome file installer for window albeit it's tell that I'll got linux (Debian, Ubuntu, Fedora, OpenSuSE)









Thursday, July 4, 2013

FreeBSD on VBox with OS X Host

I use boot-only-iso 64 bit and the problem instantly arise because of my impatience.


Yup, I use 32 bit architecture on OS version setting (the first prompt in virtual box when we create new virtual machine). So change to 64-bit solved the problem, in some case, delete the vm and create whole new vm guarantee it.





Nothing special on the installation so, here is it:








Friday, May 3, 2013

Stuck on DFU or Recovery Mode or Connect to Itunes Logo Loop on iPhone




In the recent months, we've seen reports here and there of iPhones getting stuck in a restart loop. The black screen with the Apple logo shows up, holds for a while, and then disappears again; repeat ad infinitum. While it's not clear yet exactly what's triggering the issue (the complainants suspect that it may be a recent application update to blame), there is a tried and true way to get your iPhone, iPod touch, iPad or older iPod back to square one: either use recovery mode or do a DFU restore


DFU (Device Firmware Update) mode is a means to getting your iPhone to interface with iTunes without iTunes automatically loading the latest version of iOS onto it (it skips the iBoot bootloader, for jailbreak aficionados). Differing from recovery mode -- where iTunes restores your iPhone to its original factory settings but with the latest iOS and firmware -- DFU mode allows you to change and choose the firmware you want to install onto your iPhone. For instance, you would use DFU mode if you want to install a previous version of iOS, jailbreak your iPhone or unlock your SIM. If (for whatever reason) standard recovery isn't working for you to get your device back to working condition, DFU may help you out.



Remember, if you restore your phone in any fashion (via the iTunes 'Restore' button, recovery mode or DFU) you will lose any modifications made to unsynced content or in-app data since your last iTunes sync (game states, voice memos, notes etc.). Be cautious.

So, here's the basic info on how to enter DFU mode (and it works for your iPod touch, too). Instructions may vary slightly by year or model.



  • Connect your iPhone to your computer via USB and launch iTunes.
  • Now turn your iPhone off. Hold down the sleep / power button at the top right of your iPhone, then slide your finger across the "slide to power off" button on your iPhone's screen. (If it won't turn off, press Home and Sleep/Power until the screen goes dark, then release.)
  • Once your iPhone is off, hold down both the sleep / power button as well as the home button for 10 seconds. Once 10 seconds has elapsed, release the sleep / power button on your iPhone, but continue to hold the home button until the the above message has appeared in iTunes telling you that your iPhone has been detected in recovery mode. (If you just want to go to recovery mode, skip the 10- second hold on both buttons and simply connect the phone while holding down Home, then wait for 'Connect to iTunes' screen on the phone.)
If you see the Apple logo or the "connect to iTunes" screen on your iPhone, you're not in DFU mode. DFU leaves the screen of the iPhone completely black.

To exit DFU mode, simply hold down the sleep / power button and the home button together until your iPhone disappears from the device list in iTunes, then turn on the iPhone as normal.

Again, for most purposes (save jailbreaking) there's no practical difference between DFU and a regular restore, except and unless you're in a situation where your phone won't go into restore mode normally.

Now, what if iPhone stuck on restore loop instead of restart loop? It often happen if we upgrade the iOS.  I've tried to exit it using "just" DFU mode with no result. Apparently it needs more step, ... and it is...

While in DFU mode

  • while you plugged your iPhone and opening the itunes go to windows/system32/drivers/etc and open "hosts" file as administrator with notepad (Mac user: use Shift+Command+G and type /etc than open hosts file using TextEdit)
  • remove the last to lines with word apple in it (or add # at the begining of line)
  • safe the change
  • go to itunes shift+ restore choose the custom ipsw (Mac user: alt+ restore)
  • enjoy the restore with out any errors no 3014 or 1600 or any other error
Maybe, on Mac, we couldn't safe the change of hosts file or even worse, couldn't open it. In this case, 

open Terminal Apps
type
sudo cp /etc/hosts ./Desktop (enter your password)
sudo chmod 777 ./Desktop/hosts
edit hosts file in Desktop using TextEdit and safe it, back to Terminal
sudo rm /etc/hosts /etc/hostsOld
sudo cp ./Desktop/hosts /etc/hosts





Thursday, May 2, 2013

Monte Carlo PI

 
c calculating pi by throwing stones
c
PROGRAM stones
IMPLICIT none
c
c declarations
REAL*8 area, x, y, DRAND48
INTEGER i, max, pi, seed
c
c set parameters (number of stones, seed for generator)
max = 1000
seed = 11168
c
c open file, set initial value, seed generator
OPEN(6, FILE='pif.dat')
pi=0
call seed48(seed)
c
c execute
DO 10 i=1, max
x = DRAND48()*2-1
y = DRAND48()*2-1
IF ((x*x + y*y) .LT. 1) THEN
pi = pi+1
ENDIF
area = 4.0 * pi/REAL(i)
WRITE(6,*) i, area
10 CONTINUE
STOP
END

PI on MPI

still trying...
 program main
include "mpif.h"
double precision PI25DT
parameter (PI25DT = 3.141592653589793238462643d0)
double precision mypi, pi, h, sum, x, f, a
integer n, myid, numprocs, i, ierr
c function to integrate
f(a) = 4.d0 / (1.d0 + a*a)

call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, numprocs, ierr)


10 if ( myid .eq. 0 ) then
print *, 'Enter the number of intervals: (0 quits) '
read(*,*) n
endif
c broadcast n
call MPI_BCAST(n,1,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
c check for quit signal
if ( n .le. 0 ) goto 30
c calculate the interval size
h = 1.0d0/n
sum = 0.0d0
do 20 i = myid+1, n, numprocs
x = h * (dble(i) - 0.5d0)
sum = sum + f(x)
20 continue
mypi = h * sum
c collect all the partial sums
call MPI_REDUCE(mypi,pi,1,MPI_DOUBLE_PRECISION,MPI_SUM,0,
& MPI_COMM_WORLD,ierr)
c node 0 prints the answer.
if (myid .eq. 0) then
print *, 'pi is ', pi, ' Error is', abs(pi - PI25DT)
endif
goto 10
30 call MPI_FINALIZE(ierr)
stop
end

Wednesday, April 24, 2013

Mencari Pi



Nilai Pi

Mencoba tanpa webworker. Pi dapat dihitung dengan kode berikut

var Pi=0, n=1, c=100000;
for (var i=0;i<=c;i++) {
Pi=Pi+(4/n)-(4/(n+2));
n=n+4;
}

perintah dalam tag <script> adalah sebagai berikut



function HitungPi()
{
var loop = document.getElementById("loop");
var c = parseInt(loop.value);
var f = parseFloat(loop.value);
var Pi=0, n=1;

try {
if (isNaN(c) || f != c ) {
throw("errInvalidNumber");
} else if (c<=0) {
throw("errNegativeNumber");
}

for (var i=0;i<=c;i++) {
Pi=Pi+(4/n)-(4/(n+2));
n=n+4;
}
document.getElementById("PiValue").innerHTML = Pi;
} catch (e) {
var msg = "Input Error: ";
if (e=="errInvalidNumber")
msg += "harus angka.";
else if (e=="errNegativeNumber")
msg += "Input harus positif.";
else
msg += e.message;

alert(msg);
}
}

.
Perintah dalam <body>

<label for="loop">Jumlah iterasi:</label>
<input id="loop" type="number" value="100" />
<input type="button" onclick="HitungPi()" value="Hitung Pi" />
<div id="PiValue">Nilai Pi</div>

Hello Canvas World

canvas's not supported
Back to first again
Tulisan di atas ditulis dalam canvas seperti kode di bawah. Di sini perintahnya adalah

context.fillText('Hello Canvas World',canvas.width/2-150,canvas.height/2+15);

context adalah '2d' dari canvas, dalam hal ini context kotak yang menyimpan perintah-perintah '2d' canvas seperti contoh diatas, yaitu menulis text.

fillText('tulisan', posisi_x,posisi_y) adalah perintah untuk menampilkan tulisan dengan warna sesuai fillStyle, yaitu 'green'

strokeText('tulisan', posisi_x,posisi_y) adalah perintah untuk menampilkan tulisan dengan warna 'tepi' sesuai strokeStyle yaitu 'red'



var canvas = document.getElementById('canvasexample'),
context = canvas.getContext('2d');

context.font = '38pt Arial';
context.fillStyle = 'green';
context.strokeStyle = 'red';

context.fillText('Hello Canvas',canvas.width/2-150,canvas.height/2+15);
context.strokeText('Hello Canvas',canvas.width/2-150,canvas.height/2+15);
323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)