JQuery Calendar and PHP: Handling Inserts

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

1) Getting Current Time in Javascript

The ISO 8601 date format can be utilized to convert the date on the browser side to a format that include timestamp information. Quoting from here:

Note that the “T” appears literally in the string, to indicate the beginning of the time element. Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator (“Z”). Used in ATOM RSS feeds.

function fnISO() {
// Only works in Firefox using ECMAScript 5
var now = new Date().toISOString();
alert(now);
}

Result: 2009-08-06T23:36:31.390Z

More

WordPress Permalink Migration Warning (SEO semi-disaster)

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

If you follow those guides about migrating your blog to another webhost using import/export functionally…
You must rebuild your permalinks in the exact same format as the original webhost!

Go to Settings > Permalinks, and click save changes.
Make sure you choose the correct permalink structure.

If you do not, all your indexed pages on search engines (google, etc) will disappear and your site will be re-indexed losing you your traffic.

Accessing MYSQL server behind firewall using SSH

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

So, you want to access a MYSQL server but you only have an SSH terminal…
Not to worry, you can use SSH tunnelling to do this!

Basic Example

Example: ssh -L 3306:localhost:3306 user@IP -p SSHPORT

Now how do you control this dark ssh sorcery? Let’s break it down.

1) 3306:localhost:3306

  •  Open a port 3306 on my local machine to redirect
  • localhost:3306 means we are tunnelling to 3306 on SSH machine

2) user@IP

This is your username and the IP address of the server

3) -p SSHPORT

This is the ssh port if it is not on 22.

Another Example

ssh -L 9000:192.168.212.1:5000 user@192.168.2.1 -p 1234

You would use this if you wanted to:

  • use your computer port 9000
  • to access the port 5000 on IP 192.168.212.1
  • through the SSH server 192.168.2.1
  • with SSH server port on 1234

Happy SSHing!

 

Allowing/troubleshooting AirServer through windows 7 firewall

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

AirServer allows apple mobile devices (Ipads, Iphones) to stream the screen using the airplay protocol.

Unfortunately, AirServer did not work immediately right off the bat on my own machine and required modifying the Advanced firewall settings.

If you see anything appearing even you you have selected Airplay on the device, it may be an issue of the firewall.

In order to test this, disable the firewall for the local network using the instructions here.

On my own computer, I entered the advanced settings of windows firewall and added two inbound rules in order to expose freely the UDP and TCP ports required by AirServer.

Advanced Firewall Settings

Inbound Rule

Three

 

 

So, if your having issues using AirServer but do not want to disable the firewall add manual rules for the following ports as described on their site.

AirServer Ports

Using DD for windows to resume a failed file transfer from specific point

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

If you were transferring a large file and the network cut out you can either restart the copy, or use a tool such as DD for windows to resume from a specific point.
For very large files it is recommended to use better copiers such as robust copy.

I had a file that was 1 421 304 KB in size and I had copied around 60 percent.
Therefore, I needed to start after 852782 KB .

The following command was used:

dd bs=2k if=z:SURCE_FILE of=D:DESTINATION_FILE seek=5767168 skip=426391 --progress

Since skip takes number of blocks defined with size bs= , we skip to 426391.

426391  * 2KB = 852782 KB

Tunneling to VNC over SSH

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

You may want to connect to a headless/monitorless linux pc with a vnc server running that only exposes an SSH port.

I have used the following steps from windows.

  1. Server:
    Run VNCServer

    If not running already start your server.  You can set the resolution using -geometry tag. This will open a new port/session.

    vncserver -geometry 1920x1200

     

  2. Workstation:
    Create the tunnel to VNC port
    This maps the local pc port 5905 to localhost:5905 on the remote machine. VNC uses ports 5901 to 5909.

    ssh -L 5905:localhost:5905 menelaos@menelaos.server.net -p 22

     

  3. WorkStation:
    Create tunnel if needed of X-Server

    ssh -L 6005:localhost:6005 menelaos@menelaos.server.net -p 22

    More

Bash script to monitor server HTTP output length and e-mail an alert

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

Below is an example of a script that uses CURL to monitor the length of various HTTP server outputs and output a response if this is different than 103 characters.
This is my first bash script, so I had some reading/experimenting to do and it is quite rough.

Anecdote – forcing wifi bridge to connect to other AP

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

This is personal anecdote about how to  re-connect to a disconnected wifi bridge if your main AP is off/broken.

Usually our network is layered as follows:

Laptop
<-----[WIFI]----->
DLINK Powerline Enabled AP
<-----[Copper Power Wire]----->
TP LINK Powerline
<-----[Ethernet]----->
ADSL Modem & AP
<-----[WIFI]----->
Asus WL-330N3G 
<-----[ethernet]----->
WD Media Player

So 2 weeks ago the ADSL Modem (AP including LAN DHCP server) died but in the network I continued seeing the SSID. After scanning the network we saw that the ASUS wireless bridge transmits with the same SSID as the ADSL modem / AP. The actual modem is a Belkin but the wireless bridge uses the same SSID as seen below from an iphone app called “Net Analyzer”.

photo 1

More

Connecting to JMX from visualVM using SSH tunnel

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

I used the following source:

https://bowerstudios.com/node/731

I did this in windows using git bash that has ssh command. You can also do using cygwin or pure minggw.

1) Run ssh tunnel command in command prompt (I do this in git bash/MINGGW32).

ssh -D 9010 -p 22 root@IP -v

2) Run your application on server with JMX options

java -Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=9010 
-Dcom.sun.management.jmxremote.local.only=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false -jar 
application.jar

3) Run visualVM through socks proxy to connect:

visualvm -J-Dnetbeans.system_socks_proxy=localhost:9010 
-J-Djava.net.useSystemProxies=true

4) Actually add your JMX remote connection in visualVM

MysqlDump directly on mounted remote directory (CENTOS, Linux, Unix)

This specific content was written 11 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

If you don’t have space to write a dump file, or want to directly send your SQL to another server (without intermediate transfers), using a remotely mounted folder is a way to go.

There are various mounting options such as:

  • SSHFS
  • NFS
  • Windows Shares (SAMBA)

More

if(!cn_cookies_accepted()){ location.href="http://www.google.com"; } alert('test');