text:
Q: How to fix leap second sleep issue without reboot I found that after the latest leap second insertion (2016-12-31 23:59:60), our CentOS7 application that has worker threads sleeping for 1 second between jobs, started to wake the sleeping threads immediately instead of in a second.
In general, all sleeps are awake 1 second ahead of expected wake time.
The simplest and working solution is to reboot the box. But that is not desirable in our case.
Is there a way to fix this without rebooting?
PS. For reference, here's a simple program in C++ that reproduces the issue.
#include <boost/date_time.hpp>
#include <boost/thread.hpp>
#include <iostream>

using namespace std;

// this has to be run in a thread to be able to detect the issue
void check_thread()
{
    size_t expected_delay = 1000;
    cout << "Expected delay: " << expected_delay << " ms" << endl;
    boost::posix_time::ptime t1 = boost::posix_time::microsec_clock::universal_time();
    boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
    boost::posix_time::ptime t2 = boost::posix_time::microsec_clock::universal_time();
    size_t actual_delay = (t2 - t1).total_milliseconds();
    cout << "Actual delay: " << actual_delay << " ms" << endl;
    if (abs(expected_delay - actual_delay) > 900) {
        cout << "Too big delay difference: " << (expected_delay - actual_delay) << endl;
        cout << "Possible leap second issue" << endl;
    }
    else {
        cout << "No issues found" << endl;
    }
}

int main()
{
    boost::thread_group g;
    g.create_thread(check_thread);
    g.join_all();
    return 0;
}

Building:
g++ sleep_test.cpp -Wl,-Bstatic -lboost_thread -lboost_system -lboost_date_time -Wl,-Bdynamic -rdynamic -pthread

A: Is your system time synched with ntpd or ptp? If not, update your tzdata package.

For systems not synchronized by ntpd or ptp an updated tzdata package
  that contains the December 31st leap second is required. The updated
  tzdata package was released as part of RHEA-2016-1982, and any systems
  using RHEL 7 that are not synchronized by ntpd or ptp should update to
  tzdata-2016g-2.el7, or a later version, to receive this fix.

Resolve Leap Second Issues in Red Hat Enterprise Linux

A: In addition to what Troy said, on RHEL7 systems that had not updated tzdata by the moment the leap second is applied, and not running ntpd, an extra step is required - manually set time 1 second forward, then revert it:
date -s "+1 sec"
date -s "-1 sec"


text:
Q: How to detect link in text by php and send default meta information How to detect link in some text which is included from chat database and detect default meta information and put it to text like on discord.
ATTACHMENT
CODE
<?
session_start();
include('../../php/connect.php');
if(isset($_GET['uid']) && isset($_GET['cid']) && isset($_SESSION['user'])) {
        $uid = $_GET['uid'];
        $user = $_SESSION['user'];
        $check = mysqli_query($con, "SELECT * FROM users WHERE id = '$uid'");
        $ch = mysqli_fetch_array($check);
        if($ch['username'] == $user) {
            $cid = $_GET['cid'];
            $uq = mysqli_query($con, "SELECT * FROM users WHERE id = '$cid'");
            $u = mysqli_fetch_array($uq);
            $asd = $u['username'];
            $photo = $ch['photo'];
    $query = mysqli_query($con, "SELECT * FROM users WHERE username = '$asd'");
    $q = mysqli_fetch_array($query);
    $row = mysqli_query($con, "SELECT * FROM messages WHERE (user1,user2,type) = ('$user','$asd','message') OR (user2,user1,type) = ('$user','$asd','message') ORDER BY id ASC");
    while($result = mysqli_fetch_object($row)) { $date = date_create($result->sent); $time = date_format($date, 'H:i'); $date = date_format($date, 'd.m.Y');
?>

            <? echo $date; ?>

<img src="<? if($result->user1 == $asd) { echo '../../img/avatars/'.$q['photo']; } elseif($result->user1 == $user) { echo '../../img/avatars/'.$photo; } ?>">

        <? echo $result->user1; ?>

        <? echo $time; ?>

        <? echo '<xmp>'.$result->content.'</xmp>'; ?>

<?
                    }
            } else {
                header('location: ../index.php');
            }
    } else {
        header('location: ../index.php');
    }
?>

AJAX imports this site to #content-frame every 750ms.
I just want for example paste detected link to  element and then write some meta information like in ATTACHMENT upper

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cannot locate scroller_x.swf file? Path is correct For my website I am trying to use an image scroller. However I have uploaded scroller_x.swf multiple times and to different directories and it still cannot locate it. Also I am having a problem with an "Unexpected tolken ILLEGAL" when debugging with google chrome. Any help would be greatly appreciated.
Website: www.ayaonline.com
Thanks,
Jacob

A: That "Unexpected token illegal" error usually happens when you add whitespace characters around the area where that error appears. Delete those and give it a try. (This also happens when you are copying from one site to another, and you grab invisible characters)
About the other problem, please post your code to see if there is any other mistake that we could help you with.


text:
Q: Oracle - How to add a Record to a Collection of the same Type (Multiset Union) I have used MULTISET UNION in order to load a collection into another collection of the same type however I am now working with Records and want to add a Record into a Collection of the same Type.  For whatever reason I just can't figure out the appropriate syntax or simply the proper way to do this as MULTISET UNION appears to not play nice with Records in the way I'm used to working with Collections.
I've added a summary of how this code works at the end (supposed to work anyway).

Screenshot and Code Below

LINE 44: c_los_ms_tbl_ret  := c_los_ms_tbl_ret MULTISET UNION los_ms_row;

DECLARE

  TYPE t_los_ms_rec IS RECORD(
      appt_id NUMBER DEFAULT NULL,
      appt_name VARCHAR(300) DEFAULT NULL,
      tot_units NUMBER DEFAULT 0,
      new_rentals NUMBER DEFAULT 0,
      term_rentals NUMBER DEFAULT 0,
      avg_los_all NUMBER DEFAULT 0
  );

  TYPE t_los_ms_tbl IS TABLE OF t_los_ms_rec;

  /* Two collections based on Table Type of Record t_los_ms_rec */
  c_los_ms_tbl_ret  t_los_ms_tbl  :=  t_los_ms_tbl();
  c_los_ms_tbl      t_los_ms_tbl  :=  t_los_ms_tbl();

  FUNCTION los_func(p_appt_ids IN VARCHAR) RETURN t_los_ms_tbl
  IS
        los_ms_row  t_los_ms_rec; /* Declare Row based on Record Type */

  BEGIN
    /* Outer loop: iterate through all user selected appartments. */
    FOR los IN
    (
      SELECT 1001 AS appt_id, 45 AS tot_units, 10 AS new_rentals, 3 AS term_rentals, 'Building1' AS appt_name
        FROM dual UNION ALL
      SELECT 1002 AS appt_id, 37 AS tot_units, 6  AS new_rentals, 4 AS term_rentals, 'Building2' AS appt_name
        FROM duaL
    )
    LOOP
      /* Set Row Fields to the Data being returned by Outer Loop.  Fake Table data from dual. */
      los_ms_row.appt_name    := los.appt_name;
      los_ms_row.appt_id      := los.appt_id;
      los_ms_row.new_rentals  := los.new_rentals;
      los_ms_row.term_rentals := los.term_rentals;
      los_ms_row.tot_units    := los.tot_units;
      los_ms_row.avg_los_all  := 45; /* Made up Number */

      /* Output Apartment Name for testing */
      dbms_output.put_line('Apartment Name' || los_ms_row.appt_name);

      /* Save Row Data into Collection */ /* HOW DO I POPULATE COLLECTION WITH A RECORD */
      c_los_ms_tbl_ret  := c_los_ms_tbl_ret MULTISET UNION los_ms_row;

    END LOOP;

    RETURN c_los_ms_tbl_ret; /* Return Populated Collection */

  END los_func;

BEGIN
  /* Call Function and Store Returned Collection into a collection of same type */
  c_los_ms_tbl  :=  los_func(p_appt_ids => '1001,1002');

  FOR r IN c_los_ms_tbl.FIRST .. c_los_ms_tbl.LAST
  LOOP
    dbms_output.put_line(c_los_ms_tbl(r).avg_los_all);
  END LOOP;

END;

Summary

*

*Record Type is Declared. t_los_ms_rec

*Table Type Declared based on Record t_los_ms_tbl

*Two Collections Declared based on Table Type c_los_ms_tbl_ret and c_los_ms_tbl

*In the BEGIN block of the Main script the Function los_func() that returns a Collection of type t_los_ms_tbl is called using the Apartment IDs as it's parameters.

*LINE 20: Within los_func() a Row is Declared named los_ms_row of the Same Type t_los_ms_rec.  The fields of this Row are populated using Fake Data.

*Next is to Populate the Collection one Row at a time.  Can't figure this out.

*At this point when commenting out LINE 44 where I attempt to populate the collection the Apartment names are successfully being sent to the dbms_output. This is where it breaks due to me not knowing how to get the Record which is successfully being populated with data into the Collection c_los_ms_tbl_ret.

Error report -

ORA-06550: line 44, column 32:
PLS-00306: wrong number or types of arguments in call to 'MULTISET_UNION_ALL'

A: MULTISET UNION is used to create one nested table from two nested tables.  You are trying to use MULTISET UNION to join together a nested table and a single record.
There are two ways you can fix this:

*

*Make a one-element table out of the single record:
    c_los_ms_tbl_ret  := c_los_ms_tbl_ret MULTISET UNION t_los_ms_tbl(los_ms_row);

*Forgo the use of MULTISET UNION and just append the new record to the table:
    c_los_ms_tbl_ret.EXTEND(1);
    c_los_ms_tbl_ret(c_los_ms_tbl_ret.COUNT) := los_ms_row;


text:
Q: Remove Need For Carriage Return When Capturing output/errors to Log I have the following code.  I am attempting to capture both output and errors to log file and console.  When the code is ran, it shows the usage but then pauses for a carriage return.  Not a big deal but just wondering how this need for a carriage return can be eliminated?  I have narrowed it down to the exec line as noted below.  How can I achieve this without the need for the carriage return?  Thank you!
#!/bin/bash

log_file=$0.log

# The following line causes need for carriage return
exec > >(tee -a ${log_file} )
exec 2> >(tee -a ${log_file} >&2)

usage()
{
  echo
  echo "usage: $0 --option1 --option2 --option3 --option4 | [-h]"
  echo
}

while [ "$1" != "" ]; do
  case $1 in
    --option1 )            shift
                           OPTION1=$1
                           ;;
    --option2 )            shift
                           OPTION2=$1
                           ;;
    --option3 )            shift
                           OPTION3=$1
                           ;;
    --option4 )            shift
                           OPTION4=$1
                           ;;
    -h | --help )          usage
                           exit
                           ;;
    * )                    usage
                           exit 1
esac
shift
done

usage
exit

A: There is no pause caused by any commands in the script. The script runs successfully until completion. The aparent pause is seen because the shell prompt gets mixed with the script output and the normal prompt waiting point is located after the last logged line emitted by tee. This is more evident running the script with bash -x (the time/date/dir data appears because I configured the prompt to show it):
15:28:38 - mié mar 02 - Dir: ~
user@host$ bash -x testexec.sh
+ log_file=testexec.sh.log
+ exec
+ exec
++ tee -a testexec.sh.log
++ tee -a testexec.sh.log
15:28:38 - mié mar 02 - Dir: ~
user@host$
usage: /home/manto/testexec.sh --option1 --option2 --option3 --option4 | [-h]

+ '[' '' '!=' '' ']'
+ usage
+ echo
+ echo 'usage: /home/manto/testexec.sh --option1 --option2 --option3 --option4 | [-h]'
+ echo
+ exit

The script ended normally and the cursor appears just under the last +exit, where the system is waiting for the next command. You can confirm this by typing pwd and pressing ENTER and the shell will show the current directory. If, instead, you only press ENTER, it is shown the shell prompt again, as expected.
Answering the question, you could show the prompt by including a single sleep 1 command just before each exit command, so the system get some time to flush the output.
This is caused because the logging redirections are configured with process substitutions [ >() and >>() ], and the tee command runs concurrently with the script, so when it ends, tee is still sending text to the terminal and the log file.


text:
Q: Delphi: Sierpinski triangle: procedure not running itself completely I don't understand why this code draws this:

Only the bottom-left triangles seem to draw, however the inner-triangles appear only in the first depth of the top- and bottom-right triangle. I want the procedure to be recursive, but it is somehow cause of my shitty programming skills not recursive. I really want an understanding of what I am doing wrong.
implementation

{$R *.dfm}

var
  count : integer = 0;

procedure DrawTriangle(aCanvas: TCanvas;x,y,size : extended;n : integer);
var
  h : extended;
  w : extended;
  i : integer;
  x1,x2,x3,y1,y2,y3 : extended;
begin
    w := size;
    h := size;
    x1 := x;
    y1 := y;
    //ShowMessage(FloatToStr(w)+' '+FloatToStr(h));
  if aCanvas<>nil then
  try
    //1st - left
    aCanvas.MoveTo(Round(x1),Round(y1));
    aCanvas.LineTo(Round(x1+w*2),Round(y1));
    aCanvas.LineTo(Round(x1+w),Round(y1-h));
    aCanvas.LineTo(Round(x1),Round(y1));
    //2nd - right
    x2 := x1+w*2;
    y2 := y1;
    aCanvas.MoveTo(Round(x2),Round(y2));
    aCanvas.LineTo(Round(x2+w*2),Round(y2));
    aCanvas.LineTo(Round(x2+w),Round(y2-h));
    aCanvas.LineTo(Round(x2),Round(y2));
    //3rd - top
    x3 := x2-w;
    y3 := y2-h;
    aCanvas.MoveTo(Round(x3),Round(y3));
    aCanvas.LineTo(Round(x3+w*2),Round(y3));
    aCanvas.LineTo(Round(x3+w),Round(y3-h));
    aCanvas.LineTo(Round(x3),Round(y3));

    //Run itself
    inc(count);
    if count < n then
    begin
      DrawTriangle(aCanvas,x1,y1,size/2,n);
      DrawTriangle(aCanvas,x2,y2,size/2,n);
      DrawTriangle(aCanvas,x3,y3,size/2,n);
    end;
  except
    on e: exception do raise e;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  size : extended;
  i : integer;
  x,y : extended;
begin
  size := 100;
  x := 100;
  y := 400;
  DrawTriangle(Image1.Canvas,x,y,size,10);
end;
end.

A: The problem is that you draw the first triangle, then you call DrawTriangle to draw the bottom-left part, which does that, and then calls DrawTriangle to draw the new bottom-left part, and so on, until count has reached n. Then we return one procedure at a time to the original procedure, and in each step we draw the remaining two triangles only once.
The following logic works as intended. (Remove the global count variable.)
procedure DrawTriangle(aCanvas: TCanvas; x, y, size: extended; n: integer);
var
  h: extended;
  w: extended;
  x1, x2, x3, y1, y2, y3: extended;
begin
  w := size;
  h := size;
  x1 := x;
  y1 := y;

  //1st - left
  aCanvas.MoveTo(Round(x1), Round(y1));
  aCanvas.LineTo(Round(x1+w*2), Round(y1));
  aCanvas.LineTo(Round(x1+w), Round(y1-h));
  aCanvas.LineTo(Round(x1), Round(y1));
  //2nd - right
  x2 := x1+w*2;
  y2 := y1;
  aCanvas.MoveTo(Round(x2), Round(y2));
  aCanvas.LineTo(Round(x2+w*2), Round(y2));
  aCanvas.LineTo(Round(x2+w), Round(y2-h));
  aCanvas.LineTo(Round(x2), Round(y2));
  //3rd - top
  x3 := x2-w;
  y3 := y2-h;
  aCanvas.MoveTo(Round(x3), Round(y3));
  aCanvas.LineTo(Round(x3+w*2), Round(y3));
  aCanvas.LineTo(Round(x3+w), Round(y3-h));
  aCanvas.LineTo(Round(x3), Round(y3));

  //Run itself
  if n > 0 then
  begin
    DrawTriangle(aCanvas, x1, y1, size/2, n-1);
    DrawTriangle(aCanvas, x2, y2, size/2, n-1);
    DrawTriangle(aCanvas, x3, y3, size/2, n-1);
  end;
end;

I leave it as an exercise to figure out why it works.
Also notice I removed the completely unnecessary try..except block.
Finally, you can write the code much more efficiently, as demonstrated by Sir Rufo.

A: Your attempt to limit the depth of recursion contains an error.
You draw each of the 3 inner triangles and increment count, and then call DrawTriangle again to draw the triangles within those triangles.  Each call increments count again, meaning that count does not reflect the depth of recursion but simply how many times DrawTriangle has been called.  As a result of specifying a limit of 10, you will find that in your results, 10 sets of triangles have been drawn.
Instead of incrementing count to track recursion depth you should decrement n for each call until n = 0.
To make this intention clearer you can use a nested procedure where the outer call accepts the maximum number of levels of recursion specified with the inner, nested procedure doing the actual recursion indicating the number of levels remaining and decrementing this number for the recursive calls themselves:
procedure DrawTriangle(aCanvas: TCanvas;x,y,size : extended; maxLevels: integer);

  procedure Draw(x,y,size: extended; levelsLeft: integer);
  var
    h : extended;
    w : extended;
    i : integer;
    x1,x2,x3,y1,y2,y3 : extended;
  begin
    w := size;
    h := size;
    x1 := x;
    y1 := y;

    //1st - left
    aCanvas.MoveTo(Round(x1),Round(y1));
    aCanvas.LineTo(Round(x1+w*2),Round(y1));
    aCanvas.LineTo(Round(x1+w),Round(y1-h));
    aCanvas.LineTo(Round(x1),Round(y1));

    //2nd - right
    x2 := x1+w*2;
    y2 := y1;
    aCanvas.MoveTo(Round(x2),Round(y2));
    aCanvas.LineTo(Round(x2+w*2),Round(y2));
    aCanvas.LineTo(Round(x2+w),Round(y2-h));
    aCanvas.LineTo(Round(x2),Round(y2));

    //3rd - top
    x3 := x2-w;
    y3 := y2-h;
    aCanvas.MoveTo(Round(x3),Round(y3));
    aCanvas.LineTo(Round(x3+w*2),Round(y3));
    aCanvas.LineTo(Round(x3+w),Round(y3-h));
    aCanvas.LineTo(Round(x3),Round(y3));

    //Run itself
    if (levelsLeft > 0) then
    begin
      Draw(x1, y1, size/2, levelsLeft - 1);
      Draw(x2, y2, size/2, levelsLeft - 1);
      Draw(x3, y3, size/2, levelsLeft - 1);
    end;
  end;

begin
  if Assigned(aCanvas) then
    Draw(x, y, size, maxLevels);
end;

This also allows pre-conditions to be tested in a clearer fashion, in this case limited currently to ensuring that a canvas has been specified, but could also involve normalising or validating other parameters as might be required, before initiating the recursive call.
Since the original parameters remain in scope for the nested procedure it also means that you can limit the parameters in the calls to the recursive procedure to only those which actually change on each call.  (I have updated the code in my answer to incorporate this).
Incidentally, a try..except that simply raises any caught exceptions is exactly equivalent to having no try..except block at all so I removed it from this implementation.
Also you might wish to consider adding an additional condition to halt recursion if the value of size reaches a certain minima (where the inner triangles are indistinct, e.g. size < 2).

A: Just as an addition to the given answers, here is a DRY version:
procedure DrawTriangleDRY( aCanvas: TCanvas; CenterX, CenterY, Width, Height: extended; n: integer );
begin
  aCanvas.MoveTo( Round( CenterX ), Round( CenterY - Height / 2 ) ); // top
  aCanvas.LineTo( Round( CenterX + Width / 2 ), Round( CenterY + Height / 2 ) ); // bottom right
  aCanvas.LineTo( Round( CenterX - Width / 2 ), Round( CenterY + Height / 2 ) ); // bottom left
  aCanvas.LineTo( Round( CenterX ), Round( CenterY - Height / 2 ) ); // top

  // draw childs
  if n > 0
  then
    begin
      // top
      DrawTriangleDRY( aCanvas, CenterX, CenterY - Height / 4, Width / 2, Height / 2, n - 1 );
      // left
      DrawTriangleDRY( aCanvas, CenterX - Width / 4, CenterY + Height / 4, Width / 2, Height / 2, n - 1 );
      // right
      DrawTriangleDRY( aCanvas, CenterX + Width / 4, CenterY + Height / 4, Width / 2, Height / 2, n - 1 );
    end;
end;

Update
I just realized, that this can be optimized to only draw the last childs
procedure DrawTriangleDRY( aCanvas: TCanvas; CenterX, CenterY, Width, Height: extended; n: integer );
begin
  // draw childs
  if n > 0
  then
    begin
      DrawTriangleDRY( aCanvas, CenterX, CenterY - Height / 4, Width / 2, Height / 2, n - 1 ); // top
      DrawTriangleDRY( aCanvas, CenterX - Width / 4, CenterY + Height / 4, Width / 2, Height / 2, n - 1 ); // left
      DrawTriangleDRY( aCanvas, CenterX + Width / 4, CenterY + Height / 4, Width / 2, Height / 2, n - 1 ); // right
    end
  else
    begin
      aCanvas.MoveTo( Round( CenterX ), Round( CenterY - Height / 2 ) ); // top
      aCanvas.LineTo( Round( CenterX + Width / 2 ), Round( CenterY + Height / 2 ) ); // bottom right
      aCanvas.LineTo( Round( CenterX - Width / 2 ), Round( CenterY + Height / 2 ) ); // bottom left
      aCanvas.LineTo( Round( CenterX ), Round( CenterY - Height / 2 ) ); // top
    end
end;

A: I don't know if I understand your question correctly, and I don't know the Sierpinski algorithm. However to represent a filled triangle, so that you can use the function created to represent filled polygons (example: a quadrilateral), since they can always be divided into triangles, it is necessary to be able to exclude the representation of a side, otherwise, it would happen that one side of a triangle is overwritten by the side of the adjacent triangle (problems in displaying transparent polygons).
This, which I propose to you, is the Delphi implementation of my algorithm for the representation of any type of  triangles; unfortunately, if you want to use the Sierpinski algorithm, my answer may not be pertinent. I advise you to try it, because it is very fast, although quite complex, and efficient. it is my variant of the Bresenham algorithm. The implementation of the routine representing a horizontal segment, I remaind it to you (just replace the call to Put(Shadow)HorizLine (), for the representation of the horizontal segment, with the Line () instruction).
Here is it the types of data:
Const R_OBP_Al=16; {16 Byte alignment; it must always be 2^N}
      DimOBP_H=16; {16 Byte of OBP HEADER; it must always be >=4}

Type TShadowTable=Array[0..255] Of Byte; {Array for shadows}

     T_Shadow_Table_Ptr=^TShadowTable; {Pointer to an array for shadows}

     T_Coord_XY=Record {Coordinates of a point}
      X
      Y :SmallInt;
     End;

     T_Pos_Coord_XY=Record {Coordinates of the clipping-region}
      X,
      Y :Word;
     End;

     T_Dim_XY=Record {Dimensions of the clipping-region}
      DimX,
      DimY :Word;
     End;

     T_Clipp_Rect=Record {Clipping-region's type}
      XY {Coordinates of the clipping-region} :T_Pos_Coord_XY;
      Dim_XY {Dimensions of the clipping-region} :T_Dim_XY;
     End;

     T_Clipp_Rect_Ptr=^T_Clipp_Rect; {Pointer to clipping-region's type}

     T_Rect=Record {Rectangle type}
      XY {Coordinates of the rectangle} :T_Coord_XY;
      Dim_XY {Dimensions of the rectangle} :T_Dim_XY;
     End;

     T_Rect_Ptr=^T_Rect; {Tipo PUNTATORE a RECORD RETTANGOLO}

Here it is the body of the triangle routine:
Procedure Triangle_Wind(X1,Y1,X2,Y2,X3,Y3,
                        FillColor,BrdColAB,BrdColBC,BrdColCA:SmallInt;
                        ShadowTable:T_Shadow_Table_Ptr;
                        OBPVBuff:Pointer;
                        Clipp:T_Clipp_Rect_Ptr);

(* AVVERTENZA: Nonostante gli irrilevanti problemi
               nella visualizzazione del bordo, solido o trasparente,
               del triangolo, tuttora esistenti, dato che questa funzione
               è molto complessa, VIETATO APPORTARE MODIFICHE:
               FUNZIONE OTTIMIZZATA (HA RICHIESTO 60 ORE DI TEMPO,
               tra studio, sviluppo di un valido ALGORITMO, implementazione,
               beta-testing, realizzazione del programma
               di debugging ("TstQd.DPR") e debugging) ! *)

Var A,B,C, (* Identificatori vertici triangoli per ordinamento dei colori *)

    C1,C2,C3, (* VAR. temp.: contengono i colori BrdColAB, BrdColBC, BrdColCA *)

    XT, (* X1-XT è il SEGMENTO orizzontale da disegnare *)

    OY2, (* Valore iniziale della coordinata Y del 2° vertice del triangolo *)

    B1L,B1H, (* Coordinata X 1° e ultimo PUNTO del 1° bordo (Segm. orizz.) *)
    B2L,B2H, (* Coordinata X 1° e ultimo PUNTO del 2° bordo (Segm. orizz.) *)

    D0, (* Dimensione 1° bordo (Segm. orizz.) *)
    D1, (* Dimensione parte centrale Segm. orizz. *)
    D2, (* Dimensione 2° bordo (Segm. orizz.) *)

    Tmp, (* Variabile temporanea x scambio di 2 variabili *)

    Col1, (* Colore 1° bordo Segm. orizz. *)
    Col2, (* Colore 2° bordo Segm. orizz. *)

    CntX1, (* Contat. per coord. X 1° PUNTO Segm. orizz. (Bresenham) *)
    IncX1, (* Increm. contat. per coord. X 1° PUNTO Segm. OR. (Bresenham) *)
    CntY1, (* Contat. per coord. Y 1° PUNTO Segm. orizz. (Bresenham) *)
    Lim1, (* Limite per contat. coord. X e Y 1° PUNTO Segm. OR. (Bresenham) *)
    DirX1, (* Increm. coord. X 1° PUNTO Segm. orizz. *)
    IncY1, (* Increm. contat. per coord. Y 1° PUNTO Segm. OR. (Bresenham) *)
    FX1, (* Valore iniziale coord. X1 Segm. orizz. X1-XT *)

    CntXT, (* Contat. per coord. X 2° PUNTO Segm. orizz. (Bresenham) *)
    IncXT, (* Increm. contat. per coord. X 2° PUNTO Segm. OR. (Bresenham) *)
    CntYT, (* Contat. per coord. Y 2° PUNTO Segm. orizz. (Bresenham) *)
    LimT, (* Limite per contat. coord. X e Y 2° PUNTO Segm. OR. (Bresenham) *)
    DirXT, (* Increm. coord. X 2° PUNTO Segm. orizz. *)
    IncYT, (* Increm. contat. per coord. Y 2° PUNTO Segm. OR. (Bresenham) *)
    FXT (* Valore iniziale coord. XT Segm. orizz. X1-XT *):SmallInt;

    Segm (* RECORD per la rappresentazione di un Segm. orizz. *):T_Rect;
    F1, (* 1° condizione iniziale (eccezione), rappresentaz. triang. *)
    F24, (* 2° condizione iniziale (eccezione), rappresentaz. triang. *)
    Overflow, (* FALSE: Sta calc. il Segm. orizz.; TRUE: Ha finito *)
    Internal, (* Variabile temp. che salva il valore iniziale di OVERFLOW *)
    Finished (* FALSE: 2° semi-triang.; TRUE: 1° semi-triang. *) :Boolean;

Begin

 A:=0;
 B:=1;
 C:=2;

 (* Ordina i vertici IN base alla coordinata Y *)

 If Y1>Y2 Then
  Begin
   Tmp:=X1;
   X1:=X2;
   X2:=Tmp;
   Tmp:=Y1;
   Y1:=Y2;
   Y2:=Tmp;
   Tmp:=A;
   A:=B;
   B:=Tmp;
  End;

 If Y2>Y3 Then
  Begin
   Tmp:=X2;
   X2:=X3;
   X3:=Tmp;
   Tmp:=Y2;
   Y2:=Y3;
   Y3:=Tmp;
   Tmp:=B;
   B:=C;
   C:=Tmp;
  End;

 If Y1>Y2 Then
  Begin
   Tmp:=X1;
   X1:=X2;
   X2:=Tmp;
   Tmp:=Y1;
   Y1:=Y2;
   Y2:=Tmp;
   Tmp:=A;
   A:=B;
   B:=Tmp;
  End;

 (* Calcola il colore effettivo dei lati A-B, B-C e C-A del triangolo *)

 C1:=BrdColAB;
 C2:=BrdColBC;
 C3:=BrdColCA;

 Case 27*A+9*B+C Of
   19:Begin
       BrdColAB:=C3;
       BrdColCA:=C1;
      End;
   29:Begin
       BrdColBC:=C3;
       BrdColCA:=C2;
      End;
   45:Begin
       BrdColAB:=C2;
       BrdColBC:=C3;
       BrdColCA:=C1;
      End;
   55:Begin
       BrdColAB:=C3;
       BrdColBC:=C1;
       BrdColCA:=C2;
      End;
   63:Begin
       BrdColAB:=C2;
       BrdColBC:=C1;
      End;
 End;

 (* Calc. gli Incr. e i limiti, inizial. i cont. per il lato A-C (Bresenham) *)

 DirXT:=-1;
 IncXT:=X1-X3;
 If X1<X3 Then
  Begin
   DirXT:=1;
   IncXT:=-IncXT;
  End;
 Inc(IncXT);
 CntXT:=IncXT ShR 1;

 IncYT:=Y3-Y1+1;
 CntYT:=IncYT ShR 1;

 LimT:=IncXT;
 If IncXT<IncYT Then
  LimT:=IncYT;

 (* Imposta i valori iniziali delle VAR. locali *)

 XT:=X1;
 OY2:=Y2;

 Finished:=True;
 F1:=(Y1>=Y2) Or (Y2<>Y3);
 F24:=((Y1<>Y2) Or (Y2>=Y3)) And
      ((Y1>=Y2) Or (Y2>=Y3));

 (* Disegna il primo vertice del triangolo *)

 If (X1=X2) And (X2=X3) And
    (Y1=Y2) And (Y2=Y3) Then
  Begin
   Segm.XY.X:=X1;
   Segm.XY.Y:=Y1;
   Segm.Dim_XY.DimX:=1;
   Col1:=BrdColAB;
   If Col1<0 Then
    Col1:=BrdColCA;
   If Col1<0 Then
    Col1:=FillColor;
   If Col1>=0 Then
   If Col1<256 Then
    PutHorizLine(@Segm,OBPVBuff,Col1,Clipp)
   Else
    PutShadowHorizLine(@Segm,OBPVBuff,ShadowTable,Clipp);
  End;

 (* Disegna il triangolo *)

 Repeat

  (* Calc. gli Incr. e i limiti, inizial. i cont. per il lato A-B (Bresenham) *)

  DirX1:=-1;
  IncX1:=X1-X2;
  If X1<X2 Then
   Begin
    DirX1:=1;
    IncX1:=-IncX1;
   End;
  Inc(IncX1);
  CntX1:=IncX1 ShR 1;

  IncY1:=Y2-Y1+1;
  CntY1:=IncY1 ShR 1;

  Lim1:=IncX1;
  If IncX1<IncY1 Then
   Lim1:=IncY1;

  FX1:=X1;
  FXT:=XT;
  Overflow:=False;

  (* Rappresenta un semi-triangolo *)

  While (X1<>X2) Or (Y1<>Y2) Do
   Begin

    (* Calcola i 4 estremi del SEGMENTO orizzontale da disegnare *)

    Repeat

     Internal:=Overflow;

     If Overflow Then
      Begin

       Dec(CntY1,Lim1);
       Dec(CntYT,LimT);

       Inc(Y1);

      End;

     Overflow:=True;

     Tmp:=CntY1+IncY1;

     If Tmp<Lim1 Then
      Begin

       CntY1:=Tmp;
       Inc(CntX1,IncX1);

       If CntX1>=Lim1 Then
        Begin
         Dec(CntX1,Lim1);
         Inc(X1,DirX1);
        End;

       Overflow:=False;

      End;

     Tmp:=CntYT+IncYT;

     If Tmp<LimT Then
      Begin

       CntYT:=Tmp;
       Inc(CntXT,IncXT);

       If CntXT>=LimT Then
        Begin
         Dec(CntXT,LimT);
         Inc(XT,DirXT);
        End;

       Overflow:=False;

      End;

     If Internal Then
      Begin
       FX1:=X1;
       FXT:=XT;
      End;

    Until Overflow;

    (* Ordina (ordine ascendente) i 4 estremi del SEGMENTO orizzontale *)

    B1L:=FX1;
    B1H:=X1;

    If B1L>B1H Then
     Begin
      Tmp:=B1L;
      B1L:=B1H;
      B1H:=Tmp;
     End;

    B2L:=FXT;
    B2H:=XT;

    If B2L>B2H Then
     Begin
      Tmp:=B2L;
      B2L:=B2H;
      B2H:=Tmp;
     End;

    Col1:=BrdColAB;
    Col2:=BrdColCA;

    If (B2L<B1L) Or (B2H<B1H) Then
     Begin
      Tmp:=B1L;
      B1L:=B2L;
      B2L:=Tmp;
      Tmp:=B1H;
      B1H:=B2H;
      B2H:=Tmp;
      Tmp:=Col1;
      Col1:=Col2;
      Col2:=Tmp;
     End;

    D1:=B1H-B1L+1;
    D0:=B2L-B1H-1;
    D2:=B2H-B2L+1;

    (* Ove possibile unisce i bordi con la parte centrale del Segm. orizz. *)

    If D0>0 Then
     Begin

      If FillColor=Col2 Then (* Parte0 unita a parte2, parte0 esistente *)
       Begin
        Inc(D0,D2);
        D2:=0;
       End;

      If Col1=FillColor Then (* Parte0 unita a parte1, parte0 esistente *)
       Begin
        B1H:=B1L-1;
        Inc(D0,D1);
        D1:=0;
       End;

     End
    Else
     Begin

      D0:=0;

      If Col1=Col2 Then (* Parte1 unita a parte2, parte0 inesistente *)
       Begin
        D1:=B2H-B1L+1;
        D2:=0;
       End;

     End;

    (* Rappresenta il primo bordo del Segm. orizz. *)

    Segm.XY.Y:=Y1;

    Segm.XY.X:=B1L;
    Segm.Dim_XY.DimX:=D1;
    If Col1>=0 Then
    If Col1<256 Then
     PutHorizLine(@Segm,OBPVBuff,Col1,Clipp)
    Else
     PutShadowHorizLine(@Segm,OBPVBuff,ShadowTable,Clipp);

    (* Rappresenta la parte centrale del Segm. orizz. *)

    If (Y1<>OY2) Or
       (Not Finished Or F1) And (Finished Or F24) Then
     Begin
      Segm.XY.X:=B1H+1;
      Segm.Dim_XY.DimX:=D0;
      If FillColor>=0 Then
      If FillColor<256 Then
       PutHorizLine(@Segm,OBPVBuff,FillColor,Clipp)
      Else
       PutShadowHorizLine(@Segm,OBPVBuff,ShadowTable,Clipp);
     End;

    (* Rappresenta il secondo bordo del Segm. orizz. *)

    Segm.XY.X:=B2L;
    Segm.Dim_XY.DimX:=D2;
    If Col2>=0 Then
    If Col2<256 Then
     PutHorizLine(@Segm,OBPVBuff,Col2,Clipp)
    Else
     PutShadowHorizLine(@Segm,OBPVBuff,ShadowTable,Clipp);

   End;

  X2:=X3;
  Y2:=Y3;

  BrdColAB:=BrdColBC;

  Finished:=Not Finished;

 Until Finished;

End;

Here it is the draw horizontal lines' routines:
Procedure PutHorizLine(Segm:T_Rect_Ptr;OBPVBuff:Pointer;
                       Color:Cardinal;
                       Clipp:T_Clipp_Rect_Ptr); Assembler;

Asm

     ClD                  {Direzione ascendente stringhe}

     Push  EBX            {Salva il REG. EBX sullo STACK}
     Push  EDI            {Salva il REG. EDI sullo STACK}
     Push  ESI            {Salva il REG. ESI sullo STACK}
     Push  EBP            {Salva il REG. EBP sullo STACK}

    {-----------------------------}

     Mov   ESI,Segm       {EAX}
     Mov   EDI,OBPVBuff   {EDX}
     Mov   EDX,Color      {ECX}
     Mov   EBP,Clipp

    {-----------------------------}

     Sub   ESP,5          {Alloca 2 VAR. locali sullo STACK}

    {[ESP+1]:              ClippY;
     [ESP]:                Color}

    {-----------------------------}

     Mov   [ESP],DL       {Salva Color}

    {-----------------------------}

     XOr   EAX,EAX        {Annulla EAX}

    {-----------------------------}

    {REG. EAX, EBX, ECX e EDX liberi}

     Cmp   EDI,EAX        {Se OBPVBuff = NIL ...}
     JE    @@00           {Allora Esce}

    {-----------------------------}

     Mov   EBX,EAX        {Annulla EBX}
     Mov   EDX,EAX        {Annulla EDX}

     Cmp   EBP,EAX        {Se Clipp=NIL ...}
     JE    @@01           {Allora Vai @@01}

     Mov   BX,[EBP]             {EBX <- ClippX}
     Mov   AX,[EBP+2]           {EAX <- ClippY}
     Mov   DX,[EBP+4]           {EDX <- ClippDimX}
     MovZX EBP,Word Ptr [EBP+6] {EBP <- ClippDimY}

    {-----------------------------}

@@01:Cmp   Word Ptr [EDI],0     {Se DimScrX<=0 ...}
     JLE   @@00                 {ha finito}

     Cmp   BX,0                 {Se ClippX<0 ...}
     JS    @@00                 {ha finito}

     Cmp   DX,0                 {Se ClippDimX<0 ...}
     JS    @@00                 {ha finito}
     JNE   @@02                 {Se ClippDimX=0 ...}

     Mov   DX,[EDI]             {allora ClippDimX <- DimScrX}

@@02:LEA   ECX,[EBX+EDX]        {Se ClippX+ClippDimX ...}
     Cmp   CX,[EDI]             {>DimScrX ...}
     JA    @@00                 {ha finito}

    {-----------------------------}

     Cmp   Word Ptr [EDI+2],0   {Se DimScrY<=0 ...}
     JLE   @@00                 {ha finito}

     Cmp   AX,0                 {Se ClippY<0 ...}
     JS    @@00                 {ha finito}

     Cmp   BP,0                 {Se ClippDimY<0 ...}
     JS    @@00                 {ha finito}
     JNE   @@03                 {Se ClippDimY=0 ...}

     Mov   BP,[EDI+2]           {allora ClippDimY <- DimScrY}

@@03:LEA   ECX,[EAX+EBP]        {Se ClippY+ClippDimY ...}
     Cmp   CX,[EDI+2]           {>DimScrY ...}
     JA    @@00                 {ha finito}

    {-----------------------------}

     Mov   [ESP+1],EAX          {Salva ClippY}

    {REG. EAX e ECX liberi}

    {-----------------------------}

     XOr   AX,AX          {Annulla EAX}
     Mov   ECX,EAX        {Annulla ECX}

     Cmp   ESI,EAX        {Se Segm=NIL ...}
     JE    @@04           {Allora Vai @@04}

     MovSX EAX,Word Ptr [ESI+2] {EAX <- Segm.XY.Y}
     Mov   CX,[ESI+4]           {ECX <- Segm.Dim_XY.DimX (DimX)}
     MovSX ESI,Word Ptr [ESI]   {ESI <- Segm.XY.X}

    {-----------------------------}

@@04:Cmp   AX,BP          {Se (Segm.XY.Y >= ClippDimY) O (Segm.XY.Y < 0) ...}
     JAE   @@00           {Allora Esce}

     Cmp   SI,DX          {Se Segm.XY.X >= ClippDimX ...}
     JGE   @@00           {Allora Esce}

     Or    CX,CX          {Se DimX <= 0 ...}
     JLE   @@00           {Allora Esce}

    {-----------------------------}

     Add   ECX,ESI        {INC (DimX, Segm.XY.X)}
     JLE   @@00           {Se DimX <= 0, Allora Esce}

     Or    SI,SI          {Se Segm.XY.X >= 0 ...}
     JNS   @@05           {Allora Vai @@05}

     XOr   ESI,ESI        {Segm.XY.X <- 0}

@@05:Cmp   CX,DX          {Se DimX <= ClippDimX ...}
     JBE   @@06           {Allora Vai @@06}

     Mov   CX,DX          {DimX <- ClippDimX}

@@06:Sub   ECX,ESI        {DEC (DimX, Segm.XY.X}
(*   JE    @@00           {Se DimX = 0, Allora Esce} *)

    {REG. EDX e EBP liberi}

    {-----------------------------}

     Mov   BP,[EDI]       {Calcola IN EBP la Dim. X di OBPVBuff^ ...}
     And   BP,R_OBP_Al-1
     Neg   BP
     Add   BP,R_OBP_Al
     And   BP,R_OBP_Al-1
     Add   BP,[EDI]       {allineata ai 16 BYTE (ADimX)}

    {-----------------------------}

     Add   EDI,EBX        {OBPVBuff + Clipp.XY.X}

    {-----------------------------}

     Add   EAX,[ESP+1]    {INC (Segm.XY.Y, Clipp.XY.Y)}

     Mul   EBP            {WAddr <- (Clipp.XY.Y + Segm.XY.Y) * ADimX}

     Add   EDI,EAX        {OBPVBuff + WAddr + ...}

     LEA   EDI,[EDI+ESI+DimOBP_H] {Segm.XY.X + DimOBP_H}

    {REG. EAX, EDX, ESI e EBX liberi}

    {-----------------------------}

     Mov   DL,[ESP]       {Ripristina Color dallo STACK}

     Mov   DH,DL          {Carica IN ogni BYTE di EAX ...}
     Mov   AX,DX
     ShL   EAX,16
     Mov   AX,DX          {il colore Color}

    {REG. EDX, ESI e EBX liberi}

    {-----------------------------}

     Mov   DL,CL          {DL <- Lo(DimX)}
     ShR   ECX,2          {ECX= DimX/4}
     Rep   StoSD          {Riempie ECX DoubleWord}
     SetB  CL             {ECX= resto di (DimX/2)/2}
     Rep   StoSW          {Riempie ECX WORD}
     Test  DL,1           {ECX= ...}
     SetNE CL             {resto di DimX/2}
     Rep   StoSB          {Riempie ECX BYTE}

    {-----------------------------}

@@00:Add   ESP,5          {Dealloca 2 VAR. locali dallo STACK}

    {-----------------------------}

     Pop   EBP            {Ripristina il REG. EBP dallo STACK}
     Pop   ESI            {Ripristina il REG. ESI dallo STACK}
     Pop   EDI            {Ripristina il REG. EDI dallo STACK}
     Pop   EBX            {Ripristina il REG. EBX dallo STACK}

End;

Here it is the representation of a transparent horizontal line:
Procedure PutShadowHorizLine(Segm:T_Rect_Ptr;OBPVBuff:Pointer;
                             ShadowTable:T_Shadow_Table_Ptr;
                             Clipp:T_Clipp_Rect_Ptr); Assembler;

Asm

     ClD                  {Direzione ascendente stringhe}

     Push  EBX            {Salva il REG. EBX sullo STACK}
     Push  EDI            {Salva il REG. EDI sullo STACK}
     Push  ESI            {Salva il REG. ESI sullo STACK}
     Push  EBP            {Salva il REG. EBP sullo STACK}

    {-----------------------------}

     Mov   ESI,Segm       {EAX}
     Mov   EDI,OBPVBuff   {EDX}
     Mov   EDX,ShadowTable{ECX}
     Mov   EBP,Clipp

    {-----------------------------}

     Sub   ESP,8          {Alloca 2 VAR. locali sullo STACK}

    {[ESP+4]:              ClippY;
     [ESP]:                ShadowTable}

    {-----------------------------}

     Mov   [ESP],EDX      {Salva ShadowTable}

    {-----------------------------}

     XOr   EAX,EAX        {Annulla EAX}

    {-----------------------------}

    {REG. EAX, EBX e ECX liberi}

     Cmp   EDI,EAX        {Se OBPVBuff = NIL ...}
     JE    @@00           {Allora Esce}

    {-----------------------------}

     Cmp   EDX,EAX        {Se ShadowTable = NIL ...}
     JE    @@00           {Allora Esce}

    {-----------------------------}

     Mov   EBX,EAX        {Annulla EBX}
     Mov   EDX,EAX        {Annulla EDX}

     Cmp   EBP,EAX        {Se Clipp=NIL ...}
     JE    @@01           {Allora Vai @@01}

     Mov   BX,[EBP]             {EBX <- ClippX}
     Mov   AX,[EBP+2]           {EAX <- ClippY}
     Mov   DX,[EBP+4]           {EDX <- ClippDimX}
     MovZX EBP,Word Ptr [EBP+6] {EBP <- ClippDimY}

    {-----------------------------}

@@01:Cmp   Word Ptr [EDI],0     {Se DimScrX<=0 ...}
     JLE   @@00                 {ha finito}

     Cmp   BX,0                 {Se ClippX<0 ...}
     JS    @@00                 {ha finito}

     Cmp   DX,0                 {Se ClippDimX<0 ...}
     JS    @@00                 {ha finito}
     JNE   @@02                 {Se ClippDimX=0 ...}

     Mov   DX,[EDI]             {allora ClippDimX <- DimScrX}

@@02:LEA   ECX,[EBX+EDX]        {Se ClippX+ClippDimX ...}
     Cmp   CX,[EDI]             {>DimScrX ...}
     JA    @@00                 {ha finito}

    {-----------------------------}

     Cmp   Word Ptr [EDI+2],0   {Se DimScrY<=0 ...}
     JLE   @@00                 {ha finito}

     Cmp   AX,0                 {Se ClippY<0 ...}
     JS    @@00                 {ha finito}

     Cmp   BP,0                 {Se ClippDimY<0 ...}
     JS    @@00                 {ha finito}
     JNE   @@03                 {Se ClippDimY=0 ...}

     Mov   BP,[EDI+2]           {allora ClippDimY <- DimScrY}

@@03:LEA   ECX,[EAX+EBP]        {Se ClippY+ClippDimY ...}
     Cmp   CX,[EDI+2]           {>DimScrY ...}
     JA    @@00                 {ha finito}

    {-----------------------------}

     Mov   [ESP+4],EAX          {Salva ClippY}

    {REG. EAX e ECX liberi}

    {-----------------------------}

     XOr   AX,AX          {Annulla EAX}
     Mov   ECX,EAX        {Annulla ECX}

     Cmp   ESI,EAX        {Se Segm=NIL ...}
     JE    @@04           {Allora Vai @@04}

     MovSX EAX,Word Ptr [ESI+2] {EAX <- Segm.XY.Y}
     Mov   CX,[ESI+4]           {ECX <- Segm.Dim_XY.DimX (DimX)}
     MovSX ESI,Word Ptr [ESI]   {ESI <- Segm.XY.X}

    {-----------------------------}

@@04:Cmp   AX,BP          {Se (Segm.XY.Y >= ClippDimY) O (Segm.XY.Y < 0) ...}
     JAE   @@00           {Allora Esce}

     Cmp   SI,DX          {Se Segm.XY.X >= ClippDimX ...}
     JGE   @@00           {Allora Esce}

     Or    CX,CX          {Se DimX <= 0 ...}
     JLE   @@00           {Allora Esce}

    {-----------------------------}

     Add   ECX,ESI        {INC (DimX, Segm.XY.X)}
     JLE   @@00           {Se DimX <= 0, Allora Esce}

     Or    SI,SI          {Se Segm.XY.X >= 0 ...}
     JNS   @@05           {Allora Vai @@05}

     XOr   ESI,ESI        {Segm.XY.X <- 0}

@@05:Cmp   CX,DX          {Se DimX <= ClippDimX ...}
     JBE   @@06           {Allora Vai @@06}

     Mov   CX,DX          {DimX <- ClippDimX}

@@06:Sub   ECX,ESI        {DEC (DimX, Segm.XY.X}
(*   JE    @@00           {Se DimX = 0, Allora Esce} *)

    {REG. EDX e EBP liberi}

    {-----------------------------}

     Mov   BP,[EDI]       {Calcola IN EBP la Dim. X di OBPVBuff^ ...}
     And   BP,R_OBP_Al-1
     Neg   BP
     Add   BP,R_OBP_Al
     And   BP,R_OBP_Al-1
     Add   BP,[EDI]       {allineata ai 16 BYTE (ADimX)}

    {-----------------------------}

     Add   EDI,EBX        {OBPVBuff + Clipp.XY.X}

    {-----------------------------}

     Add   EAX,[ESP+4]    {INC (Segm.XY.Y, Clipp.XY.Y)}

     Mul   EBP            {WAddr <- (Clipp.XY.Y + Segm.XY.Y) * ADimX}

     Add   EDI,EAX        {OBPVBuff + WAddr + ...}
     LEA   EDI,[EDI+ESI+DimOBP_H] {Segm.XY.X + DimOBP_H}

    {REG. EAX, EDX, ESI e EBX liberi}

    {-----------------------------}

     Mov   EDX,[ESP]      {Ripristina ShadowTable dallo STACK}
     XOr   EAX,EAX        {EAX <- 0}

    {REG. ESI e EBX liberi}

    {-----------------------------}

@@07:Mov   AL,[EDI]       {[WAddr] <- ...}
     Mov   AL,[EDX+EAX]   {ShadowTable^ ...}
     StoSB                {[[WAddr]]; INC (WAddr)}

     Loop  @@07           {Se DimY <> 0, Allora Ripete Ciclo}

    {-----------------------------}

@@00:Add   ESP,8          {Dealloca 2 VAR. locali dallo STACK}

    {-----------------------------}

     Pop   EBP            {Ripristina il REG. EBP dallo STACK}
     Pop   ESI            {Ripristina il REG. ESI dallo STACK}
     Pop   EDI            {Ripristina il REG. EDI dallo STACK}
     Pop   EBX            {Ripristina il REG. EBX dallo STACK}

End;

Represents a triangle A (X1, Y1) -B (X2, Y2) -C (X3, Y3), full or empty, with border, solid or transparent, on the BUFFER VIDEO in OBP format.
FillColor: Interior color of the triangle:
    -1= No filling;
0..255= Solid FillColor color filler;
   256= Transparent fill (use `ShadowTable^`).

BrdColAB: Color of the A-B side of the triangle:
    -1= No border;
0..255= Solid `BrdColAB` border color of side A-B;
   256= Transparent border (use `ShadowTable^`).

BrdColBC: Color of the B-C side of the triangle:
    -1= No border;
0..255= Solid `BrdColBC` border color of side B-C;
   256= Transparent border (use `ShadowTable^`).

BrdColCA: Color of the C-A side of the triangle:
    -1= No border;
0..255= Solid `BrdColCA` border color of side C-A;
   256= Transparent border (use `ShadowTable^`).

You must specify BrdColAB =BrdColBC, BrdColAB =BrdColCA and BrdColAB <>FillColor to represent an bordered triangle.
You must specify BrdColAB=BrdColBC, BrdColAB=BrdColCA, BrdColAB=FillColor to represent an full triangle.
OBPVBuff must be correctly allocated and contains the video buffer in "OBP" format for the screen.
The "OBP" format ("One Byte, one Pixel") it's my image format 8 Bit / Pixel.
The first 2 words contain the image oriented from left to right (X +) and from top to bottom (Y +).
This image has the lines aligned to the 16 Bytes, so the final part of them can contain zeros, when dimension X is not a multiple of 16, since the origin is (OBPVBuff + 16) ^.
I created an allocation function of the memory in mode of OBPVBuff returns always aligned with 16 Bytes.
ADDRESS OUTPUT TO (OBPVBuff + 16) ^.
The clipping-region specified by Clipp, must always have an origin with positive coordinates, but the dimensions of it can exceed that the video buffer. They are not allowed negative dimensions of the clipping region (in any case incorrect values are tolerated for clipping-region).
The COORDINATES Xn andYn of the vertices of the triangle they can be any.
This function uses my own implementation of the generic Bresenham algorithm.


text:
Q: What is the difference between the ODATE and the RDATE? Control-M Does somebody know the difference between the ODATE and the RDATE? The manual says:
ODATE --> Original scheduling date of the job.
RDATE --> Installation current working date.
But that is not helpful for me.
Thanks a lot.

A: The ODATE is when the job is scheduled for originally and you need to take into account 2 things; i) when is your New Day Processing (i.e. if it's 06:00 am each day then the ODATE runs from 6am-6am and will be the same for that whole period) ii) you don't necessarily have to order with the date set as the current date - e.g. today you might want to order in jobs where some are scheduled for the last day of the month due to batch processing considerations.
%%$RDATE or %%RDATE (one value gives the year as yyyy, the other as yy) will resolve to the current system date. Whatever your server is saying the local date is now, regardless of Control-M settings, the RDATE will give you that. Often this setting is used if your job could run on different days but you really need to have today's date in the processing.
Of course, if your New Day Processing runs at midnight, you always clear all jobs away during NDP and you never order jobs into the future - then RDATE and ODATE will be basically the same.


text:
Q: Does using $routeProvider save network bandwidth? Consider this $routeProvider config for navbar and assume no caching
    app.config(function($routeProvider) {
    $routeProvider
        .when('/', {
            templateUrl : 'pages/home.html',
            controller  : 'mainController'
        })
        .when('/about', {
            templateUrl : 'pages/about.html',
            controller  : 'aboutController'
        })
        .when('/contact', {
            templateUrl : 'pages/contact.html',
            controller  : 'contactController'
        });
    });

I read online that one of the advantage of Single Page Application is network bandwidth since it does not need to transfer html tags every time user switch pages.
However, when we have above situation where navbar has home, about, contact that are routed to separate pages, wouldn't it have to transfer html tags every time?
Does it still save up the network bandwidth by eliminating html tag transfer?

A: You could say it does, but in the same breath, it doesn't. If you really need to save network bandwidth, I know of this website but I don't know jQuery well enough to understand what it is doing so I can't do anything there to help you. That website only has one page, but the nav menu hides and shows div's so you get that sort of "multi-page" website only with one page. Hopefully, I answered your question and gave you something you can work off of. I did pull the jQuery off the site, but I can't get it to work, so maybe you can figure it out and PM me what happened.
EDIT:
I figured out the jQuery so i will put my full codepen below ;).

$(function(){
    $("#nav-home").click(function(){
     $("#home").show();
     $("#projects").hide();
     $("#contact").hide();

     $(".selected").removeClass("selected");

     $("#nav-home").addClass("selected");
    });

    $("#nav-projects").click(function(){
     $("#home").hide();
     $("#projects").show();
     $("#contact").hide();

     $(".selected").removeClass("selected");

     $("#nav-projects").addClass("selected");
    });

    $("#nav-contact").click(function(){
     $("#home").hide();
     $("#projects").hide();
     $("#contact").show();

     $(".selected").removeClass("selected");

     $("#nav-contact").addClass("selected");
    });
   });
body {
  padding-top: 4em
}

#navbar {
                    height:100%;
                    width: 14em;
                    padding: 0.5em;
                }

                #navbar h1 {
                    margin-top: 1em;
                    margin-bottom: 2em;
                    display: block;
                }

                #navbar ul li {
                    display: list-item;
                    margin: 0.2em 0em;
                }

                #navbar ul {
                    margin: 1.4em;
                    display: block;
                }

                #page {
                    padding-top: 0;
                    padding-left: 16.5em;
                }
#navbar {
                position: fixed;
                width: 100%;
                height: 3em;
                top: 0;
                left: 0;
                background-color: #282726;
                box-shadow: inset -1em 0 2em rgba(0,0,0,0.2);
                color: #FFFFFF;
                text-shadow: 0 0 1em rgba(0,0,0,0.4);
                text-align: center;
                z-index: 100;
                font-size: 110%;
            }

            #navbar h1 {
                font-size: 2em;
                color: #0077FF;
                margin: 0.2em;
                display: inline;
            }

            #navbar ul {
                list-style: none;
                font-size: 1.4em;
                text-align: left;
                margin: 0.6em;
                display: inline;
            }

            #navbar ul li {
                margin: 0.2em;
                display: inline;
                cursor: pointer;
            }

            #navbar ul li:hover,#navbar ul li.selected {
                color: #0077FF;
            }

Sample Page

- Home

- Projects

- Contact

Home Items Here

Project List Here

Contact Me here

A: By Using $routeProvider you are still maintaining the single page application. Its just changing the content of web page but not refreshing the whole page again.
  - script.js
- index.html
- pages
----- home.html
----- about.html
----- contact.html

In the above code structure only the pages which are injected to index.html will get change by using $routeprovider not the index.html. Hence while switching pages will be fetched from client side not from the server side.


text:
Q: Weird issues when interpolating string output of fabric command Having trouble understanding how to do something I think should be intuitive with Fabric. I want to capture the stdout that results from a remotely executed command, and then use the result in a subsequent remote call.
However, I'm getting really incomprehensible errors. I sense that there's multiple problems with what I'm doing, but I don't know where to start. Perhaps someone can help me break this apart.
What I have:
...
with cd(env.repo):
    abbrev_hash = run('git log -1 --pretty="%h"')
run("rsync -r --exclude '.git/*' %s %s" % (env.repo, abbrev_hash))
...

Relevant output:

[cookcountyjail.recoveredfactory.net] run: git log -1 --pretty="%h"
  [cookcountyjail.recoveredfactory.net] out:
  [cookcountyjail.recoveredfactory.net] out: c6d4ea0
  [cookcountyjail.recoveredfactory.net] out:
  [cookcountyjail.recoveredfactory.net] out:
  [cookcountyjail.recoveredfactory.net] run: rsync -r --exclude '.git/*' > /home/ubuntu/repos/cookcoc6d4ea0l_2.0-dev
[cookcountyjail.recoveredfactory.net] out: /bin/bash: -c: line 1: syntax error near unexpected token newline'
  [cookcountyjail.recoveredfactory.net] out: /bin/bash: -c: line 1:
  [cookcountyjail.recoveredfactory.net] out: '
  [cookcountyjail.recoveredfactory.net] out:
Fatal error: run() received nonzero return code 1 while executing!
c6d4ea0ed: rsync -r --exclude '.git/*' /home/ubuntu/repos/cookcountyjail_2.0-dev
Executed: /bin/bash -l -c "cd /home/ubuntu/website/2.0/websites && export  PATH=\"\$PATH:\"/home/ubuntu/website/2.0/websites/active\"\" && rsync -r --exclude '.git/*' /home/ubuntu/repos/cookcouc6d4ea0_2.0-dev
  "

A: does this not do what you want ?
def t1():
    captured = local('ls -alh')
    print captured

http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.run

run will return the result of the remote program's stdout as a single
  (likely multiline) string. This string will exhibit failed and
  succeeded boolean attributes specifying whether the command failed or
  succeeded, and will also include the return code as the return_code
  attribute. Furthermore, it includes a copy of the requested & actual
  command strings executed, as .command and .real_command, respectively.

there's also this bit in the local docs:
http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.local

local is not currently capable of simultaneously printing and
  capturing output, as run/sudo do. The capture kwarg allows you to
  switch between printing and capturing as necessary, and defaults to
  False.
When capture=False, the local subprocess' stdout and stderr
  streams are hooked up directly to your terminal, though you may use
  the global output controls output.stdout and output.stderr to hide one
  or both if desired. In this mode, the return value's stdout/stderr
  values are always empty.
When capture=True, you will not see any
  output from the subprocess in your terminal, but the return value will
  contain the captured stdout/stderr.
In either case, as with run and
  sudo, this return value exhibits the return_code, stderr, failed and
  succeeded attributes. See run for details.


text:
Q: J-Link GDB Server receving a connection by Python Hello great people of the internets
I am using J-Link GDB Server to accept GDB clients and execute commands via J-link Commander.
I am using a fully automated python code that needs to send write and read requests to change/read registries in a perihfallical whitin the Cortex-M3. I can execute those commands in the J-Link Commander via mem32 and w4, but I want to connect to J-Link GDB Server via TCP/IP in python and send those requests.
How in gods name can I do this?
Thank you!


text:
Q: convert integer key values in a dictionary I have data in a dictionary that is nested inside a Python list as shown below. What I am trying to do is convert some integer values from Degrees Celsius to Degrees Fahrenheit but I know I am doing some wrong in trying to save the converted the temperature value.
data = [{'gas_station/headquarters/12032/Space Temperature Local': 21.368864059448242,
         'gas_station/headquarters/12033/Space Temperature Local': 22.3087215423584,
         'gas_station/headquarters/31/ZN-T': 71.94377136230469,
         'gas_station/headquarters/29/ZN-T': 72.39180755615234,
         'gas_station/headquarters/12028/Space Temperature Local': 22.77256202697754,
         'gas_station/headquarters/27/ZN-T': 71.6547622680664,
         'gas_station/headquarters/30/ZN-T': 69.44559478759766,
         'gas_station/headquarters/26/ZN-T': 71.9398422241211},
         {}]

for key, value in data[0].items():
    if value < 40:
        #print(key, value)
        print(f'*** [INFO] *** -  Celsius found values on {key} is {value}')
        value = (9/5) * value + 32
        print(f'*** [INFO] *** -  New converted temp is {value}')

I am doing something wrong in saving the new converted deg C to deg F temperature data to the original list/dictionary data type. Would anyone have a suggestion? If I print the original data again the original temperature units are present.
for key, value in data[0].items():
    print(key, value)

A: You aren't assigning the value back to the dict. If you want to stick to your loop, do this:
data[0][key] = (9/5) * value + 32

Separately, you might consider using dict comprehension instead of looping
data[0] = {key: (9/5)*value+32 if value<40 else value for key,value in data[0].items()}
>>> data[0]
{'gas_station/headquarters/12032/Space Temperature Local': 70.46395530700684,
 'gas_station/headquarters/12033/Space Temperature Local': 72.15569877624512,
 'gas_station/headquarters/31/ZN-T': 71.94377136230469,
 'gas_station/headquarters/29/ZN-T': 72.39180755615234,
 'gas_station/headquarters/12028/Space Temperature Local': 72.99061164855956,
 'gas_station/headquarters/27/ZN-T': 71.6547622680664,
 'gas_station/headquarters/30/ZN-T': 69.44559478759766,
 'gas_station/headquarters/26/ZN-T': 71.9398422241211}

A: I think you didn't save it to the dictionary. Try following,
for key, value in data[0].items():
    if value < 40:
        #print(key, value)
        print(f'*** [INFO] *** -  Celsius found values on {key} is {value}')
        value = (9/5) * value + 32
        data[0][key] = value
        print(f'*** [INFO] *** -  New converted temp is {value}')

A: except putting their comma you should try 'and'
for key and value in data[0].items():
    print(key, value)


text:
Q: How can I grep in PDF files? Is there a way to search PDF files using grep, without converting to text first in Ubuntu?

A: If you have poppler-utils installed (default on Ubuntu Desktop), you could "convert" it on the fly and pipe it to grep:
pdftotext my.pdf - | grep 'pattern'

This won't create a .txt file.

A: Recoll can search PDFs. It doesn't support regular expressions, but it has lots of other search options, so it might fit your needs.

A: There is a duplicate question on StackOverflow. The people there suggest a variation of harish.venkarts answer:
find /path -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep --with-filename --label="{}" --color "your pattern"' \;

The advantage over the similar answer here is the --with-filename flag for grep. This is somewhat superior to pdfgrep as well, because the standard grep has more features.
https://stackoverflow.com/questions/4643438/how-to-search-contents-of-multiple-pdf-files

A: Take a look at the common resource grep tool crgrep which supports searching within PDF files.
It also allows searching other resources like content nested in archives, database tables, image meta-data, POM file dependencies and web resources - and combinations of these including recursive search.

A: Here is a quick script for search pdf in the current directory :
#!/bin/bash

if [ $# -ne 1 ]; then
  echo "usage $0 VALUE" 1>&2
  exit 1
fi

echo 'SEARCH IS CASE SENSITIVE' 1>&2

find . -name '*.pdf' -exec /bin/bash -c 'pdftotext "{}" - | grep --with-filename --label="{}" --color "$0"' "$1" \;

A: pdfgrep was written for exactly this purpose and is available in Ubuntu.
It tries to be mostly compatible to grep and thus provides "the power of grep", only specialized for PDFs. That includes common grep options, such as --recursive, --ignore-case or --color.
In contrast to pdftotext | grep, pdfgrep can output the page number of a match in a performant way and is generally faster when it doesn't have to search the whole document (e.g. --max-count or --quiet).
The basic usage is:
pdfgrep PATTERN FILE..

where PATTERN is your search string and FILE a list of filenames (or wildcards in a shell).
See the manpage for more infos.

A: You could pipe it through strings first:-
cat file.pdf | strings | grep <...etc...>

A: try this
find /path -iname *.pdf -print0 | for i in `xargs 0`; do echo $i; \
    pdftotext "$i" - | grep pattern; done

for printing the lines the pattern occurs inside the pdf

A: Install the package pdfgrep, then use the command:
find /path -iname '*.pdf' -exec pdfgrep pattern {} +

——————
Simplest way to do that:
pdfgrep 'pattern' *.pdf
pdfgrep 'pattern' file.pdf

A: cd to your folder containing your pdf-file and then..
pdfgrep 'pattern' your.pdf

or if you want to search in more than just one pdf-file (e.g. in all pdf-files in your folder)
pdfgrep 'pattern'  `ls *.pdf`

or
pdfgrep 'pattern' $(ls *.pdf)

A: If you just want to search for pdf names/properties... or simple strings that are not compressed or encoded then instead of strings you can use the below
grep -a STRING file.pdf
cat -v file.pdf | grep STRING

From grep --help:
      --binary-files=TYPE   assume that binary files are TYPE;
                            TYPE is 'binary', 'text', or 'without-match'
  -a, --text                equivalent to --binary-files=text

and cat --help:
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB

A: No.
A pdf consists of chunks of data, some of them text, some of them pictures and some of them really magical fancy XYZ (eg. .u3d files). Those chunks are most of the times compressed (eg. flat, check http://www.verypdf.com/pdfinfoeditor/compression.htm). In order to 'grep' a .pdf you have to reverse the compression aka extract the text.
You can do that either per file with tools such as pdf2text and grep the result, or you run an 'indexer' (look at xapian.org or lucene) which builds an searchable index out of your .pdf files and then you can use the search engine tools of that indexer to get the content of the pdf.
But no, you can not grep pdf files and hope for reliable answers without extracting the text first.

A: gpdf might be what you need if you're using Gnome! Check this in case you're not using Gnome. It's got a list of CLI pdf viewers. Then you can use grep to find some pattern.

A: I assume you mean tp not convert it on the disk, you can convert them to stdout and then grep it with pdftotext. Grepping the pdf without any sort of conversion is not a practical approach since PDF is mostly a binary format.
In the directory:
ls -1 ./*.pdf | xargs -L1 -I {} pdftotext {}  - | grep "keyword"

or in the directory and its subdirectories:
tree -fai . | grep -P ".pdf$" | xargs -L1 -I {} pdftotext {}  - | grep "keyword"

Also because some pdf are scans they need to be OCRed first. I wrote a pretty simple way to search all pdfs that cannot be greped and OCR them.
I noticed if a pdf file doesn't have any font it is usually not searchable. So knowing this we can use pdffonts.
First 2 lines of the pdffonts are the table header, so when a file is searchable has more than two line output, knowing this we can create:
gedit check_pdf_searchable.sh

then paste this
#!/bin/bash
#set -vx
if ((`pdffonts "$1" | wc -l` < 3 )); then
echo $1
pypdfocr "$1"
fi

then make it executable
chmod +x check_pdf_searchable.sh

then list all non-searchable pdfs in the directory:
ls -1 ./*.pdf | xargs -L1 -I {} ./check_pdf_searchable.sh {}

or in the directory and its subdirectories:
tree -fai . | grep -P ".pdf$" | xargs -L1 -I {} ./check_pdf_searchable.sh {}

A: pdfgrep -r --include "*.pdf" -i 'pattern'

A: ripgrep-all (or rga) enables ripgrep functionality on multiple file types, including PDFs.

A: Quickest way is
grep -rinw "pattern" --include \*.pdf *

A: less mypdf.pdf | grep "Hello, World"


text:
Q: Html codes working in editor ckeditor I am using ckeditor with syntaxhighlighter. When i add html code, it's working in editor after submit.
So, i am write this;
<!DOCTYPE html>

    <meta chrset="UTF 8">
    <title>test</title>

{{message}}

After submit return this in editor;
{{message}}

How can i solve ? thankyou.

A: Everything looks fine. Here is working code:

<!DOCTYPE html>

      <meta chrset="UTF 8">
      <title>test</title>

{{message}}


text:
Q: Keep document height I have a series of elements that collapse ondragstart, and then uncollapse ondragend using Bootstrap's Collapse/Show classes
What I'm running into is that if the user is scrolled far enough down the page that removing that element's height makes the bottom of the page higher than the bottom of the viewport, the viewport is forced to scroll up to make up for it, which cancels the drag and calls ondragend, which then un-collapses the element and resizes the document to where it was, making it look like nothing happened.
My question is: How would I force the document/body to always be tall enough to prevent the auto-scroll?
Or, is it possible to somehow maintain the drag even through the scroll?
I have the min-height of the body set to 100vh, but that doesn't account for a page starting out to be taller than the viewport anyway.
Fiddle: https://jsfiddle.net/robertgreenstreet/jcodbv5n/21/

A: I see that your sections are wrapped by a form element.
<form>
  <section

  <section

  <section

  <section

</form>

What if, before you collapse any cards, you detect the form's actual height and force it to maintain that height using element.style.height?
Something like this:
function setHeight(element) {
  element.style.height = element.offsetHeight + "px";
}

function clearHeight(element) {
  element.style.height = "";
}

I haven't tried it, but I suspect it will do what you need.
Here's a little demo, it seems to work just fine.

function setHeight(element) {
  element.style.height = element.offsetHeight + "px";
}

function clearHeight(element) {
  element.style.height = "";
}

const wrapper = document.getElementById('wrapper');
const el2 = document.getElementById('el2');
const el3 = document.getElementById('el3');

function collapse () {
  setHeight(wrapper);
  el2.classList.add('collapse');
  el3.classList.add('collapse');
  setTimeout( () => clearHeight(wrapper), 2000);
}

function expand () {
  clearHeight(wrapper)
  el2.classList.remove('collapse');
  el3.classList.remove('collapse');
}
#wrapper {
  background-color: #ccc;
  padding: 0.5rem;
}
#el1, #el2, #el3, #el4 {
  border: 1px solid gray;
  margin: 2px;
  padding: 0.5rem;
  background: white;
}
.el {
  height: 40px;
}
.collapse {
  height: 12px;
}

  <button onclick="collapse();">Collapse el 2 and 3</button>
  <button onclick="expand();">Expand el 2 and 3</button>

el1

el2

el3

el4

    wrapper


text:
Q: Building XCode From Command Line Issues (Updating Entitlements file location) The first error is a warning for complier 'com.apple.compilers.gcc.4_0' I don't know if this is okay and I can just not worry about it.
The second tells me that my entitlements file is no longer at that location.  I know this and I thought I had correctly updated it in Xcode's info window.  This project builds fine in Xcode.
Michael-Lindahls-Mac:~ michaellindahl$ xcodebuild -project /Users/michaellindahl/Dropbox/Xcode/App/app.xcodeproj -alltargets
2011-01-03 11:41:51.591 xcodebuild[15162:60f] warning: compiler 'com.apple.compilers.gcc.4_0' is based on missing compiler 'com.apple.compilers.gcc.4_0'
=== BUILD NATIVE TARGET app OF PROJECT app WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
[BEROR]CodeSign error: The entitlements file '/Users/michaellindahl/Dropbox/Xcode/deletedAppFile/Entitlements.plist' is missing

** BUILD FAILED **

A: Entitlements.plist is used for ad-hoc distributions.  You're building all targets - does this build work when you do only debug?  I reckon it would.
Also - does the file actually exist in the location suggested?
If you don't need the Entitlements.plist functionality, open up your project, go to Build settings, search for it, and remove the key to it - that will also get rid of the error.


text:
Q: Sending a SOAP Request with Query String & POST Data in PHP using CURL I am trying to obtain a report from a website which actually has a login mechanism in it. So Far I have been able to do it and preserve the cookie in a file.
        $url = 'https://<site>/action/method/blah';
        $options = array(

            'textUsername' => 'alpha',
            'textPassword'  => 'beta',
            'appId'  => 'gama',
            'browser' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko/20100101 Firefox/41.0'
        );
        $cookie_file = APPPATH.'cookies/cookie.txt';
        $postdata = http_build_query($options);

        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt ($ch, CURLOPT_USERAGENT, $options['browser']);
        curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
        curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt( $ch, CURLOPT_COOKIESESSION, true );
        curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie_file );
        curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie_file );
        curl_setopt ($ch, CURLOPT_REFERER, $url);

        curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
        curl_setopt ($ch, CURLOPT_POST, 1);
        $result = curl_exec ($ch);

        echo $result;
        curl_close($ch);

Now I want to extend this to fetch the report, I intercepted the original request in firefox and It looks contains the following.
Headers, Cookies, Query String, POST Data

In the Headers, It says that the request-type : SOAP
Cookie, Query String has key value pairs and POST Data has a XML doc.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>......

Can anyone help me to extend my existing code to send the request to fetch the report?
I need answers to the following questions.
Can we use the existing Curl handler $ch to send the second SOAP Request?
If Yes, How can we specify it to use the cookie file I created?
Also, How can I add the Query String and the XML POST data in the request?
Any help would be much helpful.


text:
Q: Can't get latitude and longitude in AsyncTask I'm working with Weather Underground API where I can get weather of a place in 2 ways:

*

*Writing directly the name of the city and nation (example:http://api.wunderground.com/api/*MyKey*/conditions/q/It/Venice.json)

*Get the weather of every place have latitude/longitude (example:http://api.wunderground.com/api/*MyKey*/conditions/q/45.43972222,12.33194444.json)

I'm interested in the second way so I'm trying to get my position (that works in an Activity).
FirstActivity.java: (the position is displayed with no problem)
public class FirstActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.first_activity);

    GPSTracker gpsTracker = new GPSTracker(this);

    if (gpsTracker.canGetLocation())
    {
        String stringLatitude = String.valueOf(gpsTracker.latitude);
        TextView textview1 = (TextView)findViewById(R.id.fieldLatitude);
        textview1.setText(stringLatitude);

        String stringLongitude = String.valueOf(gpsTracker.longitude);
        TextView textview2 = (TextView)findViewById(R.id.fieldLongitude);
        textview2.setText(stringLongitude);

    }
    else
    {
        // can't get location
        // GPS or Network is not enabled
        // Ask user to enable GPS/network in settings
        gpsTracker.showSettingsAlert();
    }

}

AsyncTask:
public class Conditions extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.weather_conditions);

    new WeatherConditions(this).execute();

}

private class WeatherConditions extends AsyncTask<String, String, String> {
    private Context mContext;
    public WeatherConditions (Context context){
        mContext = context;
    }

    @Override
    protected String doInBackground(String... uri) {

        GPSTracker gpsTracker = new GPSTracker(mContext);
        String latitudine = null;
        String longitudine = null;

        if (gpsTracker.canGetLocation())
        {
            latitudine = String.valueOf(gpsTracker.latitude);

            longitudine = String.valueOf(gpsTracker.longitude);

        }
        else
        {
            // can't get location
            // GPS or Network is not enabled
            // Ask user to enable GPS/network in settings
            gpsTracker.showSettingsAlert();
        }

        String responseString = null;
        try {
            HttpClient client = new DefaultHttpClient();
            URI apiCall = new URI("api.wunderground.com/api/51cda8abeca78e10/conditions/q/"
                    + latitudine
                    +","
                    + longitudine
                    +".json");
            HttpGet request = new HttpGet();
            request.setURI(apiCall);
            HttpResponse response = client.execute(request);
            responseString = EntityUtils.toString(response.getEntity());
        } catch (Exception e) {
            Log.e("TAG", "some sort of problem encountered", e);
        }
        return responseString;
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        ...
        }
    }
}

Where I get this message in the LogCat: Can't create handler inside thread that has not called Looper.prepare()
Here's GPSTracker.java:
public class GPSTracker extends Service implements LocationListener{
private final Context mContext;

boolean isGPSEnabled = false;

boolean isNetworkEnabled = false;

boolean canGetLocation = false;

Location location;
double latitude;
double longitude;

private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; //10 metters

private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute

protected LocationManager locationManager;

public GPSTracker(Context context)
{
    this.mContext = context;
    getLocation();
}

public Location getLocation()
{
    try
    {
        locationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE);

        isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

        isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

        if (!isGPSEnabled && !isNetworkEnabled)
        {
        }
        else
        {
            this.canGetLocation = true;
            if (isNetworkEnabled)
            {
                locationManager.requestLocationUpdates(
                        LocationManager.NETWORK_PROVIDER,
                        MIN_TIME_BW_UPDATES,
                        MIN_DISTANCE_CHANGE_FOR_UPDATES, this);

                Log.d("Network", "Network");

                if (locationManager != null)
                {
                    location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                    updateGPSCoordinates();
                }
            }
            if (isGPSEnabled)
            {
                if (location == null)
                {
                    locationManager.requestLocationUpdates(
                            LocationManager.GPS_PROVIDER,
                            MIN_TIME_BW_UPDATES,
                            MIN_DISTANCE_CHANGE_FOR_UPDATES, this);

                    Log.d("GPS Enabled", "GPS Enabled");

                    if (locationManager != null)
                    {
                        location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                        updateGPSCoordinates();
                    }
                }
            }
        }
    }
    catch (Exception e)
    {
        //e.printStackTrace();
        Log.e("Error : Location", "Impossible to connect to LocationManager", e);
    }

    return location;
}

public void updateGPSCoordinates()
{
    if (location != null)
    {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
    }
}

public void stopUsingGPS()
{
    if (locationManager != null)
    {
        locationManager.removeUpdates(GPSTracker.this);
    }
}

public double getLatitude()
{
    if (location != null)
    {
        latitude = location.getLatitude();
    }

    return latitude;
}

public double getLongitude()
{
    if (location != null)
    {
        longitude = location.getLongitude();
    }

    return longitude;
}

public boolean canGetLocation()
{
    return this.canGetLocation;
}

public void showSettingsAlert()
{
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
    alertDialog.setTitle("Attenzione!");
    alertDialog.setMessage("Abilita il GPS");
    alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
            Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
            mContext.startActivity(intent);
        }
    });
    alertDialog.setNegativeButton("CLOSE", new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
            dialog.cancel();
        }
    });

    alertDialog.show();
}

public List<Address> getGeocoderAddress(Context context)
{
    if (location != null)
    {
        Geocoder geocoder = new Geocoder(context, Locale.ENGLISH);
        try
        {
            return geocoder.getFromLocation(latitude, longitude, 1);
        }
        catch (IOException e)
        {
            //e.printStackTrace();
            Log.e("Error : Geocoder", "Impossible to connect to Geocoder", e);
        }
    }

    return null;
}

public String getAddressLine(Context context)
{
    List<Address> addresses = getGeocoderAddress(context);
    if (addresses != null && addresses.size() > 0)
    {
        Address address = addresses.get(0);

        return address.getAddressLine(0);
    }
    else
    {
        return null;
    }
}

public String getLocality(Context context)
{
    List<Address> addresses = getGeocoderAddress(context);
    if (addresses != null && addresses.size() > 0)
    {
        Address address = addresses.get(0);

        return address.getLocality();
    }
    else
    {
        return null;
    }
}

public String getSubLocality(Context context)
{
    List<Address> addresses = getGeocoderAddress(context);
    if (addresses != null && addresses.size() > 0)
    {
        Address address = addresses.get(0);

        return address.getSubLocality();
    }
    else
    {
        return null;
    }
}

public String getPostalCode(Context context)
{
    List<Address> addresses = getGeocoderAddress(context);
    if (addresses != null && addresses.size() > 0)
    {
        Address address = addresses.get(0);

        return address.getPostalCode();
    }
    else
    {
        return null;
    }
}

public String getCountryName(Context context)
{
    List<Address> addresses = getGeocoderAddress(context);
    if (addresses != null && addresses.size() > 0)
    {
        Address address = addresses.get(0);

        return address.getCountryName();
    }
    else
    {
        return null;
    }
}

@Override
public void onLocationChanged(Location location)
{
}

@Override
public void onProviderDisabled(String provider)
{
}

@Override
public void onProviderEnabled(String provider)
{
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras)
{
}

@Override
public IBinder onBind(Intent intent)
{
    return null;
}

A: In GPSTracker.java, since getLocation() has context of async task attached to it and looper is not attached to it.
A quick workaround to solve this problem is add Looper.getMainLooper() with requestLocationUpdates, this will attach main looper thread callback with request.
locationManager.requestLocationUpdates(
    LocationManager.NETWORK_PROVIDER,
    MIN_TIME_BW_UPDATES,
    MIN_DISTANCE_CHANGE_FOR_UPDATES, this, Looper.getMainLooper()
);


text:
Q: TFS (CI) - Only one branch has just been check-in/pushed to be built I'm trying to deploy a Continuous Integration server where I work.
We used TFVC with the branch to release strategy, but we are having difficulty with something that should be trivial.
We only need the build on the branch that was checked in.
Is it possible to do this without having to change the build definition every time a new branch is created?
I do not want to map the entire folder structure of the repository. Imagine having 10 branches and every check-in, build all? Does not make sense!
Anyone have any idea how to do it?

A: The CI build for TFVC can't map and just build target branch like build for Git.
There are some workarounds:

*

*Clone a build definition and change source mapping, Path filters of triggers for each branch.

*Add a PowerShell step/task to get recent check-in change by calling get changesets Rest API, then store the related solution/project files in a variable by using Logging Commands, then build these solutions/projects


text:
Q: Condition for cyclic quadrilateral given $\sum_{i=1}^{4}{b_i}=0$ and $\sum_{i=1}^{4}{b_iz_i}=0$
Question Statement:-
  Given that $\displaystyle\sum_{i=1}^{4}{b_i}=0$ and $\displaystyle\sum_{i=1}^{4}{b_iz_i}=0$, where $b_i$'s are non zero real numbers, no three $z_i$'s form a straight line, prove that the $z_i$'s are concyclic if
  $$b_1b_2|z_1-z_2|^2=b_3b_4|z_3-z_4|^2$$

Attempt at a solution:-
I was not able to do much to it, so here is my attempt at the solution.
$$\begin{aligned}
&\displaystyle\sum_{i=1}^{4}{b_iz_i}=0
\implies b_1z_1+b_2z_2+b_3z_3+b_4z_4=0 \\
&\implies b_1z_1+b_3z_3=-(b_2z_2+b_4z_4) \hspace{5cm} \ldots (1)
\end{aligned}$$
Also, we have the following relation:-
$$\sum_{i=1}^{4}{b_i}=b_1+b_2+b_3+b_4=0 \implies b_1+b_3=-(b_4+b_5) \tag{2}$$
On dividing $(1)$ and $(2)$, we get
$$\dfrac{b_1z_1+b_3z_3}{b_1+b_3}=\dfrac{b_2z_2+b_4z_4}{b_2+b_4}$$
This denotes that the point that divides the line joining $z_1$ and $z_3$ in the ratio $b_3:b_1$ and the point that divides $z_2$ and $z_4$ in the ratio $b_4:b_3$ are same but I am not able to conclude anything more.
Also other approaches are welcome.

A: The same argument you used also gives
\begin{align*}
\dfrac{b_1z_1+b_2z_2}{b_1+b_2}=\dfrac{b_3z_3+b_4z_4}{b_3+b_4}
\end{align*}
Let this point be $P(z)$. This is the point of intersection of line joining $z_1, z_2$ and $z_3, z_4$. We have
\begin{align*}
z- z_1 = \dfrac{b_1z_1+b_2z_2}{b_1+b_2} - z_1 &= \dfrac{b_2(z_2-z_1)}{b_1+b_2}\\
z- z_2 = \dfrac{b_1z_1+b_2z_2}{b_1+b_2} - z_2 &= \dfrac{b_1(z_1-z_2)}{b_1+b_2}\\
z- z_3 = \dfrac{b_3z_3+b_4z_4}{b_3+b_4} - z_3 &= \dfrac{b_4(z_4-z_3)}{b_3+b_4}\\
z- z_4 = \dfrac{b_3z_3+b_4z_4}{b_3+b_4} - z_4 &= \dfrac{b_3(z_3-z_4)}{b_3+b_4}
\end{align*}
Thus
\begin{align*}
(z-z_1)(z-z_2) &= -\dfrac{b_1b_2(z_1-z_2)^2}{(b_1+b_2)^2} \\
(z-z_3)(z-z_4) &= -\dfrac{b_3b_4(z_3-z_4)^2}{(b_3+b_4)^2}
\end{align*}
From the condition $b_1b_2|z_1-z_2|^2=b_3b_4|z_3-z_4|^2$, it follows that $b_1b_2$ and $b_3b_4$ have the same sign and hence we have
\begin{align*}
|b_1b_2||z_1-z_2|^2=|b_3b_4||z_3-z_4|^2
\end{align*}
We thus have
\begin{align*}
|z-z_1||z-z_2| &= \left|\dfrac{b_1b_2(z_1-z_2)^2}{(b_1+b_2)^2}\right| \\
&= \left|\dfrac{b_3b_4(z_3-z_4)^2}{(b_3+b_4)^2}\right| \\
&= |z-z_3||z-z_4|
\end{align*}
If the given points are $A,B,C,D$, then we have $PA \cdot PB = PC\cdot PD$ and hence $A,B,C,D$ are concyclic.


text:
Q: set a:active style to links which have a name value? When you click a link, a:active style of the clicked link is being applied. So when I've got a link which gets called and activated from the url using its name like whats shown below, why doesn't my code work?
.box{
   display:block;
   width:100px;
   height:100px;
   background:gray;
   margin:20px 0px;
}
a{
   -moz-transition:all 1s ease;
   -webkit-transition:all 1s ease;
}
a:active{
   background:orange;
}

    user
    userbox

I want it to call a:active css for userbox when userbox is called from the url.
Is my code invalid or not an option for these kind of situations?

A:
I want it to call a:active css for userbox when userbox is called from the url. my code is invalid or it's not an option for this kinda situations?

You can't. :active means "While being clicked on or otherwise activated". It does not mean "Having an href attribute that resolves to the current URI".
Use some other mechanism, such as adding a class to the element in the HTML.

A: I think the pseudo-class you want is :focus. :active is applied while a link is being clicked.
-EDIT-
Of the browsers I tested, only Internet Explorer 11 focused the anchor when the URL was updated to include #user. You can use JavaScript to set a class as follows:
window.addEventListener('hashchange', function () {
  var activeElement = document.getElementById(window.location.hash.substring(1));
  if (activeElement) {
    activeElement.className = 'active';
  }
});

This would require using the following CSS:
.active {
  color: orange;
}

And this assumes using id="user" instead of name="user" which both behave the same with regard to the URL hash.

A: We can hack it, we have the technology.
In all seriousness you should use classes and Javascript for this solution, but I put a bit too much of my lunch time into this to just throw it away.
http://jsfiddle.net/DF4VG/
CSS:
#label {
    display: block;
}

#label:hover {
    cursor: pointer;
    text-decoration: underline;
}

#container {
    position: relative;
}

#wrapper {
    z-index: 2;
    position: relative;
}

#user {
    border: none;
    background: transparent;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
    transition: all 1s ease;
}

#user:focus {
    background: orange;
}

HTML:
<form action="">
    User

There is some content in here

And some more

And so forth

        <input type="text" id="user" value="" readonly>

</form>


text:
Q: Console APP migrated from .net core 2.2 to .net core 3.1 stopped allowing external HTTPs calls I have a console APP which is has a hosted service packed up in a docker container in netcore 2.2:
FROM microsoft/dotnet:2.2-sdk AS builder
WORKDIR /service
# copy csproj and restore as distinct layers
COPY . .
RUN dotnet restore ./Project.sln
# copy everything else and build
COPY . .
RUN dotnet publish ./Project/Project.csproj -c Release -o /service/out

# build runtime image
FROM microsoft/dotnet:2.2.0-aspnetcore-runtime
WORKDIR /service
COPY --from=builder /service/out ./
ENV ASPNETCORE_ENVIRONMENT Production
ENTRYPOINT ["dotnet", "Project.dll"]

I have been using RestSharp 106.6 with no issues. Then today I decided to migrate to net core 3.1 so apart from changing the assembly version in all projects with success and running the console app successfully as well, I modified my Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder
WORKDIR /service
# copy csproj and restore as distinct layers
COPY . .
RUN dotnet restore ./Project.sln
# copy everything else and build
COPY . .
RUN dotnet publish ./Project/Project.csproj -c Release -o /service/out

# build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
WORKDIR /service
COPY --from=builder /service/out ./
ENV ASPNETCORE_ENVIRONMENT Production
ENTRYPOINT ["dotnet", "Project.dll"]

Then I started getting the following error when using the restsharp client:
The SSL connection could not be established, see inner exception. Authentication failed

But the inner exception is saying the same. My guess is that there is something missing in the docker image that is preventing the client to work because it works locally - I don't think there is some configuration missing otherwise the local version would not work either.
Have you guys come across this problem before?
Thanks
UPDATE
I'm logging out the actual exception message that I get when using RestSharp:
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
 ---> Interop+Crypto+OpenSslCryptographicException: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
   --- End of inner exception stack trace ---
   at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, Byte[] recvBuf, Int32 recvOffset, Int32 recvCount, Byte[]& sendBuf, Int32& sendCount)
   at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, ArraySegment`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at System.Net.HttpWebRequest.SendRequest()
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at RestSharp.Http.GetRawResponseAsync(IAsyncResult result, Action`1 callback)
   at RestSharp.Http.ResponseCallback(IAsyncResult result, Action`1 callback)

That's just me rolling forward again the project using .NET Core 3.1. If that stays in .NET Core 2.2 it just works.
The code to perform the HTTP Call:
public async Task<MyResponse> GetAsync()
        {
            MyResponse myResponse = null;

            var stopWatch = new Stopwatch();

            stopWatch.Start();

            try
            {
                var request = new RestRequest(Method.GET);

                request.AddHeader("Accept", "application/json");

                var restResponse = await _restClient.ExecuteGetAsync(request);

                if(restResponse.IsSuccessful)
                {
                    gobResponse = JsonConvert.DeserializeObject<MyResponse>(restResponse.Content, DateTimeConverter);

                    Logger.Info($"Retrieved my response. Took: {stopWatch.ElapsedMilliseconds}ms. StatusCode={restResponse.StatusCode.ToString()}");
                }
                else
                {
                    Logger.Error(restResponse.ErrorException.ToString(), "Error performing request");
                }
            }
            catch(Exception ex)
            {
                Logger.Error(ex.ToString(), $"Error executing HTTP client");
            }

            return myResponse;
        }

A: You can try downgrading the TLS version from 1.2 to 1.0 by adding this line into your Dockerfile (runtime image)
RUN sed -i "s|TLSv1.2|TLSv1.0|g" /etc/ssl/openssl.cnf

A: When using net5 and a recent Data.SqlClient lib, only setting TLS to 1.0 can cause a deadlock when executing a query.
# downgrade min TLS version to support older unpatched SQL Server (i.e. SQL Server 2008R2)
# you should patch those machines to support TLSv1.2 though
# see: https://support.microsoft.com/en-us/help/3135244/kb3135244-tls-1-2-support-for-microsoft-sql-server
RUN sed -i "s|MinProtocol = TLSv1.2|MinProtocol = TLSv1|g" /etc/ssl/openssl.cnf && \
    sed -i 's|CipherString = DEFAULT@SECLEVEL=2|CipherString = DEFAULT@SECLEVEL=1|g' /etc/ssl/openssl.cnf

While this workaround probably is what you need immediately, applying the fix for SQL Server is what you (or your ops team) should do in the near future.


text:
Q: What's a better way to initialize with zero or increment for objects? I'm writing analytics and I have to initialize counter counts for (keys) hours, days, weeks, years so as to get frequency of user activity. I need to create a hit count for respective time and increment accordingly. Visits are fed via a loop.
I have this working but I'm not sure if the code below is ideal to do so.
if(!analytics.users[message.user].counts.hourly[hour]) {
    analytics.users[message.user].counts.hourly[hour] = 0;
}
analytics.users[message.user].counts.hourly[hour] += 1;

if(!analytics.users[message.user].counts.daily[day]) {
    analytics.users[message.user].counts.daily[day] = 0;
}
analytics.users[message.user].counts.daily[day] += 1;

...

I've tried the x = x + 1 || 0 method but that hasn't worked.
Also, is there a way I can set up a function for this?

A: You could use a function which take the object and the key and perfoms the check and update.
function increment(object, key) {
    if (!object[key]) object[key] = 0;
    ++object[key];
}

Call with
increment(analytics.users[message.user].counts.hourly, hour);

A:
I've tried the x = x + 1 || 0

You almost got it. It should either be:
x = x || 0;
x++;

Or
x = x + 1 || 1;

So, change your code to:
analytics.users[message.user].counts.hourly[hour] =
    (analytics.users[message.user].counts.hourly[hour] + 1) || 1

If analytics.users[message.user].counts.hourly[hour] is undefined, the increment operation returns NaN. This is a falsy value. So, it takes 1

A: You can create a simple increment function like the one below. It first checks for the key to be initialized and if not, it will initialize it to 0. The next line with the increment is safe to execute since the key was previously created.

let message = {
  user: "user"
}

let analytics = {
  users: {
    "user": {
      counts: {
      }
    }
  }
}

function incrementAnalytics(analytics, period) {
  analytics[period] = analytics[period] || 0;
  ++analytics[period];
}

let test = analytics.users[message.user].counts;
incrementAnalytics(test, "hourly");
incrementAnalytics(test, "hourly");
incrementAnalytics(test, "daily");

console.log(test);

Cheers!


text:
Q: Range of function $ \frac{1}{n\pi}(1-\cos(n\pi))\sin(\frac{n\pi}{2})$ and determination of Fourier coefficients. I am computing the Fourier series expansion of the given signal x(t). In that I am having difficulties in calculating range of function $ \frac{1}{n\pi}(1-\cos(n\pi))\sin(\frac{n\pi}{2})$ (or) I am not able to get how can I arrive at equation (2) from equation (1)

I have done some back calculation(and would like to know the forward way of calculating it)
For example, for the function to have a value of $ \frac{2n}{\pi} $
$$ \sin(\frac{n\pi}{2})=1 \,\, \text{and} \,\, \cos(n\pi)=-1$$
$$\implies \sin(\frac{n\pi}{2})=\sin((4k+1)\frac{\pi}{2}) \, and \, \cos(n\pi)=\cos(2k+1)\pi$$
$$\implies n=(4k+1) \, \text{and} \, n =(2k+1).$$
Which is a contradiction and doesn't match with the book.(Is this the case that among $\implies n=(4k+1) \, \text{and} \, n =(2k+1)$ ,we have to choose $n=(4k+1)$?)
And how have we arrived at 2nd part of equation (2)?
Please help in this regard.

Also clarify another doubt. How have we arrived at equation (3) from (2). It is confusing because it involves determination of the terms based on n which in turn is dependent on k.


text:
Q: How would I have a audio file playing in a method in Java, but then when that method is called again, the previous audio file is stopped playing? So I'm trying to make a guitar simulator, where if I call a method, that note plays. However, when I call it again, the previous sounds stops playing.
    public class ytst {
         public static void main(String[] args)throws Exception {
             Estring.play(1);
             TimeUnit.SECONDS.sleep(3);
     Estring.play(2);
    }
    ----------
    class Estring{
         public static play(int fret){
            String filename="E" + fret + ".wav"
            File soundFile = new File(filename);
            AudioInputStream audioIn = AudioSystem.getAudioInputStream(soundFile);
            Clip clip = AudioSystem.getClip();
            clip.open(audioIn);
            clip.start();
         }
    }

When i try this, the second audio file just overlaps the first. How can i make it so when I call this methd again the previous sound file stops playing?

A: Clips were designed to hold sounds that are reused. Before they will play, the entire .wav file has to be loaded into memory. This can create problems with lag. SourceDataLines will start playing much more quickly, because they only load a buffer's worth of data before starting to play.
Where Clips shine is in starting or restarting them after they have been loaded into memory. Since they are running from memory, there is no costly file loading happening as there is with SourceDataLines. So, if you are going to use Clips, consider first initializing all the Clips. If this consumes too much memory, I would stick with SourceDataLines, at least for a first pass at your app, before trying anything fancy to optimize.
To stop a Clip, all you have to do is call clip.stop(). I'd consider doing something like creating a variable called currentClip, and stopping it with this method, then reassigning it with the value of the new note that you wish to play. If the currentClip is volatile, it should respond quickly even if the various notes are being played on different threads.
With SourceDataLine, you can do the same sort of thing, though shutting down a SourceDataLine is a bit more involved. A common strategy is to have a volatile "playing" boolean as a condition in the innermost while loop. You can set the "playing" variable to false and the sourceDataLine thread will shut down, assuming you have written it correctly--there are good examples of this in the Java Tutorials, the Sound section.