• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

table

GCP Load Balancer Local Routing Table

July 29, 2019

Test if the GCP Load Balancer is working by sending a curl command from the backend VM.

Assume the load balancer IP address is 10.1.2.99, and the VM is called vm-a1.

curl http://10.1.2.99

curl http://10.1.2.99

The end result is …

Page served from: vm-a1

Page served from: vm-a1

Make sure there’s an entry in the local table that matches the IP of the load balancer.

ip route show table local | grep 10.1.2.99

ip route show table local | grep 10.1.2.99

If not, add it.

ip route add to local 10.1.2.99/32 dev eth0 proto 66

ip route add to local 10.1.2.99/32 dev eth0 proto 66

Documentation

Filed Under: Cloud, Linux Tagged With: curl, gcp, load balancer, local, route, table

How to Zebra Stripe a Table

September 18, 2016

A HTML table can be difficult to read, especially if there are hundreds of rows. Reading across a row can sometimes be a challenge. One way of making the table more legible is to alternate the background color of each row. By the way, the plugin used on this blog to display code uses zebra stripes. Zebra stripping can be done by toggling a variable and alternately displaying an odd or even CSS class as it goes through the loop.

The Code:

// set variable initially to "odd."
// loop 4 times for demo purposes.
// toggle CSS classes while in a loop.
$c = "odd";
$count = 0;
echo "<table>";
while ($count < 4) :
  if ($c == "even") : echo "<tr class='even'>"; $c="odd"; else : echo "<tr class='odd'>"; $c="even"; endif;
  echo "<td>Data</td>";
  echo "</tr>";
  $count++;
endwhile;
echo "</table>";

// set variable initially to "odd." // loop 4 times for demo purposes. // toggle CSS classes while in a loop. $c = "odd"; $count = 0; echo "<table>"; while ($count < 4) : if ($c == "even") : echo "<tr class='even'>"; $c="odd"; else : echo "<tr class='odd'>"; $c="even"; endif; echo "<td>Data</td>"; echo "</tr>"; $count++; endwhile; echo "</table>";

The Result:

<table>
<tr class='odd'><td>Data</td></tr>
<tr class='even'><td>Data</td></tr>
<tr class='odd'><td>Data</td></tr>
<tr class='even'><td>Data</td></tr>
</table>

<table> <tr class='odd'><td>Data</td></tr> <tr class='even'><td>Data</td></tr> <tr class='odd'><td>Data</td></tr> <tr class='even'><td>Data</td></tr> </table>

The Style:

.odd { background-color: #fff; }
.even { background-color: #eee; }

.odd { background-color: #fff; } .even { background-color: #eee; }

To see it in action, visit CodePad.

Filed Under: CSS, HTML, PHP Tagged With: table, zebra strip

  • Home
  • About
  • Archives

Copyright © 2023