Chit chat

———-

Still like to use lpq to check on print queues.

You feel foolish when you have installed applications on a #web server a zillion times, but you make simple mistakes like typing in a url of phpmysql when it should of been phpmyadmin. Been a while, but the app is installed.
#linux
Oldie, but goodie…. #internet   #linux   #mswindows #computers

——————————————————–

Source code for the file permissions application shown a while back.

<html>
<body>

<script type="text/javascript">
<!--
/* chmod helper, Version 1.0
 * by DK of able-design
* Last Modified: recently
*/

function do_chmod(user) {
 var field4 = user + "4";
 var field2 = user + "2";
 var field1 = user + "1";
 var total = "t_" + user;
 var symbolic = "sym_" + user;
 var number = 0;
 var sym_string = "";

 if (document.chmod[field4].checked == true) { number += 4; }
 if (document.chmod[field2].checked == true) { number += 2; }
 if (document.chmod[field1].checked == true) { number += 1; }

 if (document.chmod[field4].checked == true) {
  sym_string += "r";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field2].checked == true) {
  sym_string += "w";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field1].checked == true) {
  sym_string += "x";
 } else {
  sym_string += "-";
 }

 if (number == 0) { number = ""; }
 document.chmod[total].value = number;
 document.chmod[symbolic].value = sym_string;

 document.chmod.t_total.value = document.chmod.t_owner.value + document.chmod.t_group.value + document.chmod.t_other.value;
 document.chmod.sym_total.value = "-" + document.chmod.sym_owner.value + document.chmod.sym_group.value + document.chmod.sym_other.value;
}
//-->
</script>


<form name="chmod" action="">
<table cellpadding="0" cellspacing="0" summary="Chmod calculator"><tr><td width="100%" valign="top"><table width="100%" cellpadding="5" cellspacing="2" border="0" summary=""><tr><td width="100%" bgcolor="#8e97b4" align="center" colspan="5"><font color="#ffffff" size="3"><b>chmod (File Permissions) helper</b></font></td></tr>
 <tr bgcolor="#bcbcbc">
  <td align="left"><b>Permission</b></td>
  <td align="center"><b>Owner</b></td>
  <td align="center"><b>Group</b></td>

  <td align="center"><b>Other</b></td>
  <td bgcolor="#dddddd" rowspan="4"> </td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Read</b> (r = 4)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner4" value="4" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group4" value="4" onclick="do_chmod('group')"></td>

  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other4" value="4" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Write</b> (w=2)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner2" value="2" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group2" value="2" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other2" value="2" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">

  <td align="left" nowrap><b>Execute</b> (x=1)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner1" value="1" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group1" value="1" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other1" value="1" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Octal:</td>
  <td align="center"><input type="text" name="t_owner" value="" size="1"></td>

  <td align="center"><input type="text" name="t_group" value="" size="1"></td>
  <td align="center"><input type="text" name="t_other" value="" size="1"></td>
  <td align="left"><b>=</b> <input type="text" name="t_total" value="" size="3"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Symbolic:</td>
  <td align="center"><input type="text" name="sym_owner" value="" size="3"></td>
  <td align="center"><input type="text" name="sym_group" value="" size="3"></td>

  <td align="center"><input type="text" name="sym_other" value="" size="3"></td>
  <td align="left"><b>=</b> <input type="text" name="sym_total" value="" size="10"></td>
 </tr>
</table></td></tr></table>
</form>
</body>
</html>

——————————————————–

Tried to use the famous Kipkay’s method for a sort of megaphone for the pad. Not stable enough. Used tees instead of right angles. Also sealed off the back side of the tees to concentrate sound.

——————————————————–

One of the things I like about a home web server is the ability enhance the capabilities of a touchpad. You can use the server to do all the heavy lifting. In this case cookdojo recipe program is running from the server (where all the data is kept), but allows the touchpad as an interface or thin client. You can easily move the touchpad to another location for some other web based application such as home automation or even a game.

——————————————————–

While back I did an article about doing parabolas. Here is a web page that can help in printing parabola sections.

 

SUNP0008

 

SUNP0010

The code: (use at your own risk)

<!DOCTYPE html>
<html>
<head>
<title>                  Parabola Segments    </title>
<script>
function                 drawPicture(form)
{ var canvas =           document.getElementById('example'); // link to id='example'
  var context =          canvas.getContext('2d');               // create graphic context
  var scale =            350;
  var gain =             1;
  var radius =           1;
  var focal =            form.foc.value; 
  var step =             0.1;
  var Num_seg =          24;
  var a =                1/(4*focal);
  var x0 =               scale*.6;
  var y0 =               scale*2;
  
  var x ,y, dx ,dy,ds,angle,x_g,y_g;
  var s     =              0;
  var x_last=              0;
  var y_last=              0;
  
  
  var X_calc =           new Array(11);
  var Y_calc =           new Array(11);
  var S_calc =           new Array(11);
  

  for                    (i=0; i<=10; i++)                               //Calc Parabola data
{ x =                    step*i;
  y =                    a*x*x;
  dx =                   x-x_last;
  dy =                   y-y_last;
  ds =                   Math.pow(dx*dx+dy*dy,.5);
  s =                    s + ds;
  X_calc[i] =            x;                                              //X_data
  Y_calc[i] =            y;                                              //Y_data
  S_calc[i] =            s;                                              //Surface_data
  angle =                (x/s)*2*Math.PI/Num_seg;
  x_last=                x;
  y_last=                y;
}

  gain =                 1.99/S_calc[10];
  
  context.clearRect(     0,0,scale*2,scale*2);                            //ÊclearÊcanvasÊ
  context.strokeStyle =  "Black"; 
  
  context.beginPath();  
  context.fillStyle =   "rgb( 255, 255, 255)";                         // red, grn, blu
  context.fillRect (     0, 0, scale*2, scale*2);                      // or draw white box
  context.fill();
  
  if                    (form.s1[0].checked)                          //Draw segements?
{ context.moveTo(        x0,   y0);                                   // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  -gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  context.strokeStyle =  "Black"; 
  context.moveTo(        x0,   y0);                                     // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  -gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  -gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  //context.strokeStyle =  "Black"; 
  for                    (j=1; j<=10; j++)
{ angle =                (X_calc[j]/S_calc[j])*2*Math.PI/Num_seg;
  y_g =                  -gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  -gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                                // move to origin 
} context.stroke();
  y_g =                  -gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                  // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  -gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                           // move to origin 
} context.stroke();
}

  x0 =                   scale*1.4;                                      // draw second segment                            
  y0 =                   0;
  context.moveTo(        x0,   y0);                                     // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  context.moveTo(        x0,   y0);                                    // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  -gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  for                    (j=1; j<=10; j++)
{ angle =                (X_calc[j]/S_calc[j])*2*Math.PI/Num_seg;
  y_g =                  gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                         // move to origin 
} context.stroke();
  y_g =                  gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                         // move to origin 
} context.stroke();
}
}


if                       (form.s1[1].checked)                             // draw left side
{ x0 =                   50;
  y0 =                   scale*2-100;
  context.moveTo(        x0,   y0); 
  for                    (i=0; i<=10; i++)
{ x_g =                  gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[i];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[0];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  y_g =                  -gain*scale*Y_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*X_calc[0];
  y_g =                  -gain*scale*Y_calc[i];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  x_g =                  gain*scale*X_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
}    



if                       (form.s1[2].checked)                             // draw left side
{ x0 =                   2*scale-50;
  y0 =                   scale*2-100;
  context.moveTo(        x0,   y0); 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[i];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   -gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[0];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  y_g =                  -gain*scale*Y_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   -gain*scale*X_calc[0];
  y_g =                  -gain*scale*Y_calc[i];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  x_g =                  -gain*scale*X_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
}    
    
  context.closePath();  
    
 // form.REC.value  =      form.REC.value +"S_calc[i]"+S_calc[10]+" \n" ;
  
}
</script>

<style                   type = "text/css">
canvas {                 border: 2px solid gray; }           
</style>

</head>
<body> 

<h1>Parabola 1/12 Segments or Sides </h1>
<form >
<input type=text size = "10" value=".5" name="foc" onkeypress="drawPicture(this.form)">
=>Define a parabola focal point =>
<input type=button value="Plot_it" onClick="drawPicture(this.form)">
<input type="radio" Name=s1 checked="checked"  Value = "Seg" />     segments</label>
<input type="radio" Name=s1                    Value = "LSide"  /> <label for="sidecheck"> Left Side</label>
<input type="radio" Name=s1                    Value = "RSide"  /> <label for="sidecheck"> Right Ride</label>
<p> 
<canvas  id   =         "example" width="700" height="700">   </canvas> <br>
</form>

</body>
</html>

12 

3 4

6 5
Other code to look at: (This will help you to calculate the focal point. .5 gives a focal point
within the parabola. I think I used 1.9 for focal point away from the parabola to work better
 as a solar oven.

<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>                  Plot A Parabola      </title>
<script>
function                 drawPicture(form)
{ var canvas =           document.getElementById('example'); // link to id='example'
  var context =          canvas.getContext('2d');               // create graphic context
  var scale =            300;
  var radius =           1;
  var focal = form.foc.value; 
  
  var step =             0.1;
  var a =                1/(4*focal);
  var x0 =               scale;
  var y0 =               scale*2;
  
  
  context.clearRect( 0,0,scale*2,scale*2); //ÊclearÊcanvasÊ

  context.strokeStyle =  "yellow";                              // set stroke to red
  context.beginPath();                                          // new geometry
  context.moveTo(        x0,   y0);                             // move to origin
  context.lineTo(        x0,   -scale*2 + y0 );                 // second point
  context.stroke();
  context.moveTo(        x0-scale,   -scale+ y0 );              // move to origin
  context.lineTo(        x0+scale,   -scale+ y0 );              // second point
  context.stroke();
  
  context.closePath();                                          // end geo

  context.fillStyle =   "rgb( 0, 255, 0)";                      // red, grn, blu

  context.strokeStyle =  "Black"; 
  context.beginPath();                                          // new geometry
  context.moveTo(        x0,   y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ var x  =               i*step;
  var y  =               -a*x*x;
  context.lineTo(        scale*x + x0,  scale*y + y0 );           // second point
} context.stroke();                                                // stroke lines

  context.moveTo(        x0,   y0);                                 // move to origin 
  for                    (i=0; i<=10; i++)
{ var x  =              -i*step;
  var y  =              -a*x*x;
  context.lineTo(       scale*x + x0,  scale*y + y0 );             // second point
} context.stroke();                                                // stroke lines
  
  context.moveTo(       x0,   -scale*focal + y0 +5);               // move to focus 
  context.lineTo(       x0,   -scale*focal + y0 -5);               // plot focus 
  context.stroke();
  
  context.moveTo(       x0 +5, -scale*focal + y0 );                // move to focus 
  context.lineTo(       x0 -5, -scale*focal + y0 );                // plot focus 
  context.stroke();

  
  context.font =         "10px Times New Roman";                 // set font
  context.fillStyle =    "Black";                                // define fill using "black"
  context.fillText(      "-1", 10, 2*scale);                     // write "Sample String"  
  context.fillText(      "0",  scale, 2*scale);              // write "Sample String"  
  context.fillText(      "1",  1.97*scale, 2*scale);              // write "Sample String" 
  context.fillText(      "1",  1.97*scale, 1*scale);              // write "Sample String" 
  context.fillText(      "2",  1.97*scale, 10);              // write "Sample String" 
  context.fillText(      "focus",  x0-10, -scale*focal + y0 -10);              // write "Sample String" 


  
}
</script>

<style type="text/css">
canvas {                 border: 2px solid violet; }           
</style>

</head>
<body> 

<h1>Plot a Parabola With A +/-Unity Radius </h1>

<br>
<form>
<input size="10" value=".5" name="foc" onkeypress="drawPicture(this.form)" type="text">
=&gt;Define a parabola focal point =&gt;
<input value="Plot_it" onclick="drawPicture(this.form)" type="button">
<p>    
</p></form>

<canvas id="example" width="600" height="600"> 
</canvas> <br>
Radius is set to +/- 300 points.....A Parabola follows the equation  y = x^2/(4*focal)


</body></html>

——————————————————–

Fake #beer for those of us who do not drink.

Good day.

Advertisements