//Javascript to go with your coffee!
//How does this site handle those mouse click events anyway?
//Say hi to jQuery...
$(document).click(function(event) {
// if the {SGT} link is clicked, stop it from moving
// add the ID's to the elements (which will trigger the CSS3 transitions)
if ($(event.target).attr('id') == 'SGT') {
followerEnabled = false;
displayRandomCodeSnippet();
codeSnippet.attr('id','display-code-snippet');
services.attr('id','display-link-services');
contact.attr('id','display-link-contact')
about.attr('id','display-link-about');
blog.attr('id','display-link-blog');
circle.attr('id','circleDisplay');
//remove sgt rec border
linksgt.attr('id','link-sgt-no-border');
fixSpacing();
}
// if we click the services, contact, about, or blog links don't do anything!
else if ($(event.target).parent().attr('id') == 'display-link-services' ||
$(event.target).parent().attr('id') == 'display-link-contact' ||
$(event.target).parent().attr('id') == 'display-link-about' ||
$(event.target).parent().attr('id') == 'display-link-blog' ) {
return;
}
// if anywhere else on the page it clicked, removed the IDs (which will cause the elements to disappear again)
else {
codeSnippet.removeAttr('id');
services.removeAttr('id');
contact.removeAttr('id');
about.removeAttr('id');
blog.removeAttr('id');
circle.removeAttr('id');
linksgt.removeAttr('id');
$('div.info-text').removeAttr('id');
$('div.info-text-about').hide();
$('div.info-text-services').hide();
$('div.info-text-contact').hide();
follower.removeClass('fitInDocument');
followerEnabled = true;
}
});
//A complex number class that demonstrates operator overloading
//http://msdn.microsoft.com/en-us/library/6fbs5e2h.aspx
public struct Complex
{
public int real;
public int imaginary;
// Constructor.
public Complex(int real, int imaginary)
{
this.real = real;
this.imaginary = imaginary;
}
// Specify which operator to overload (+),
// the types that can be added (two Complex objects),
// and the return type (Complex).
public static Complex operator +(Complex c1, Complex c2)
{
return new Complex(c1.real + c2.real, c1.imaginary + c2.imaginary);
}
// Override the ToString() method to display a complex number
// in the traditional format:
public override string ToString()
{
return (System.String.Format("{0} + {1}i", real, imaginary));
}
}
class TestComplex
{
static void Main()
{
Complex num1 = new Complex(2, 3);
Complex num2 = new Complex(3, 4);
// Add two Complex objects by using the overloaded + operator.
Complex sum = num1 + num2;
// Print the numbers and the sum by using the overridden
// ToString method.
System.Console.WriteLine("First complex number: {0}", num1);
System.Console.WriteLine("Second complex number: {0}", num2);
System.Console.WriteLine("The sum of the two numbers: {0}", sum);
// Keep the console window open in debug mode.
System.Console.WriteLine("Press any key to exit.");
System.Console.ReadKey();
}
}
/* Output:
First complex number: 2 + 3i
Second complex number: 3 + 4i
The sum of the two numbers: 5 + 7i
*/
//And now, a Java "point" class!
//This Point2d is on us...
public class Point2d {
/* The X and Y coordinates of the point--instance variables */
private double x;
private double y;
private boolean debug; // A trick to help with debugging
public Point2d (double px, double py) { // Constructor
x = px;
y = py;
debug = false; // turn off debugging
}
public Point2d () { // Default constructor
this (0.0, 0.0); // Invokes 2 parameter Point2D constructor
}
// Note that a this() invocation must be the BEGINNING of
// statement body of constructor
public Point2d (Point2d pt) { // Another consructor
x = pt.getX();
y = pt.getY();
// a better method would be to replace the above code with
// this (pt.getX(), pt.getY());
// especially since the above code does not initialize the
// variable debug. This way we are reusing code that is already
// working.
}
public void dprint (String s) {
// print the debugging string only if the "debug"
// data member is true
if (debug)
System.out.println("Debug: " + s);
}
public void setDebug (boolean b) {
debug = b;
}
public void setX(double px) {
dprint ("setX(): Changing value of X from " + x + " to " + px );
x = px;
}
public double getX() {
return x;
}
public void setY(double py) {
dprint ("setY(): Changing value of Y from " + y + " to " + py );
y = py;
}
public double getY() {
return y;
}
public void setXY(double px, double py) {
setX(px);
setY(py);
}
public double distanceFrom (Point2d pt) {
double dx = Math.abs(x - pt.getX());
double dy = Math.abs(y - pt.getY());
// check out the use of dprint()
dprint ("distanceFrom(): deltaX = " + dx);
dprint ("distanceFrom(): deltaY = " + dy);
return Math.sqrt((dx * dx) + (dy * dy));
}
public double distanceFromOrigin () {
return distanceFrom (new Point2d ( ));
}
public String toStringForXY() {
String str = "(" + x + ", " + y;
return str;
}
public String toString() {
String str = toStringForXY() + ")";
return str;
}
}
We provide cutting edge software solutions for industry.
Got a hard software problem and don't have the expertise in house to get the job done?
Got a short timeline?
It's ok - it happens a lot these days!
Get the hired guns -> Give us a call.
Resources available now for:
Enterprise Archtecture Consulting
ERP Systems Consulting
Full Stack Web Development
IoT, Thread, CHIP
Microsoft .NET
Industrial Automation (all PLCs)
Machine Vision
Embedded Electronics
Embedded Linux (Yocto, Buildroot, Petalinux)
FPGA Design HDL
Hard Real-Time Control
SoundGains Technologies L.L.C
Call: 651-707-3206
Email: andy@soundgains.com
SoundGains Technologies is a small software consulting and contracting firm out of Saint Paul, MN. We work with highly specialized local developers to get you the right results, on time, and within budget.
The software business is changing very rapidly and it's easy to get left behind. We make it our business to know about the latest technologies / methods and we are happy to pass that knowledge on to you!