13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.130 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.1313:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.13

.

.

Monday, February 14, 2011

Date Library #2 by Ethan Castanon - basically done, need to improve a bit

// Date.h
#ifndef Date_H
#define Date_H

namespace DateSpace
{
class Date
{
private:
int Day;
int Month;
int Year;

public:

Date()
{
Day = 1;
Month = 1;
Year = 1900;
}
int getDay(){ return Day;}
int getMonth(){ return Month; }
int getYear(){ return Year; }
void setDay();
void setMonth();
void setYear();
void ShowDate();
void CheckAnotherDate();


};

int IsValidDate(int Day, int Month, int Year);

int IsLeapYear(int Year);

}



#endif

=====================================

// Date.cpp


// File: Date.cpp; Name: Ethan Castanon
#include "Date.h"
#include <iostream>

namespace DateSpace
{
int DateSpace::IsLeapYear(int Year)
{
int isLeap;
if ((Year % 100 == 0) && (Year % 400 == 0))
isLeap = 1;
else
if ((Year % 100 != 0) && (Year % 4 == 0))
isLeap = 1;
else
isLeap = 0;
return isLeap;
}
int DateSpace::IsValidDate(int Day, int Month, int Year)
{

if ((Month == 2) && (IsLeapYear(Year)!=1) && (0 <Day< 29))

return 1;
if ((Month==2) && (IsLeapYear(Year) == 1) && (0< Day < 30))

return 1;
if (((Month == 4) || (Month == 6) || (Month == 9) || (Month == 11)) && (0 < Day <31))

return 1;
if (((Month == 1) || (Month == 3) || (Month == 5) || (Month == 7) || (Month == 8) || (Month == 10) || (Month == 12) ) && (0 < Day < 32))
return 1;
Day = 1;
Month = 1;
Year = 1900;
return 0;
}
void Date::setDay()
{
int theDay;
std::cout << "Please enter your date's day value in integer form." << std::endl;
std::cin >> theDay;
while ( 0>=theDay || 32<=theDay)
{
std::cout << "Please enter your date's day value in integer form." << std::endl;
std::cin >> theDay;
}

while(IsValidDate(theDay,Month,Year)==0)
{
std::cout << "Error, please re-enter your date's day value in integer form." << std::endl;
std::cin >> theDay;
}
Day = theDay;
}
void Date::setMonth()
{
int theMonth;
std::cout << "Please enter your date's month value in integer form." << std::endl;
std::cin >> theMonth;
while (IsValidDate(Day,theMonth,Year)==0)
{
std::cout << "Error, please re-enter your date's month value in integer form." << std::endl;
std::cin >> theMonth;
}

Month = theMonth;

while (theMonth<= 0 || theMonth>= 13)
{
std::cout << "You have committed a *violation*. The months's value is unchanged" << std::endl;
std::cout<< "and remains the default month, which is 1." << std::endl;
std::cout<< "The month value you enter must be an integer value ranging from 1 to 12." << std::endl;
std::cout << "Please enter your date's month value in integer form." << std::endl;
std::cin >> theMonth;
}
}
void Date::setYear()
{
int theYear;
std::cout <<  "Please enter your date's year value in integer form." << std::endl;
std::cin >> theYear;
while (IsValidDate(Day,Month,theYear)==0)
{
std::cout <<  "Error, please re-enter your date's year value in integer form." << std::endl;
std::cin >> theYear;
}

Year = theYear;
}
void Date::ShowDate()
{

std::cout << "The date is: " << Month << "/" << Day << "/" << Year << std::endl;
}
void Date::CheckAnotherDate()
{
int YesNo;
std::cout << "Do you want to check another date?" << std::endl;
std::cout << "Enter the integer 1 for yes; enter integer 0 for no" << std::endl;
std::cin >> YesNo;
while (YesNo == 1)
{
DateSpace::Date theDate;
theDate.ShowDate();
theDate.setMonth();
theDate.setDay();
theDate.setYear();
theDate.ShowDate();
std::cout << "Do you want to check another date?" << std::endl;
std::cout << "Enter the integer 1 for yes; enter integer 0 for no." << std::endl;
std::cin >> YesNo;
}

}

}

====================================

// DateDemo.cpp


#include <iostream>
#include "Date.h"
#include "stdafx.h"

using namespace std;
using namespace DateSpace;

int _tmain(int argc, _TCHAR* argv[])
{
DateSpace::Date theDate;
theDate.ShowDate();
theDate.setMonth();
theDate.setDay();
theDate.setYear();
theDate.ShowDate();
theDate.CheckAnotherDate();
system("PAUSE");
return 0;
}

Date Library by Ethan Castanon - basically done, need to improve a bit

// Date.h by Ethan Castanon
#ifndef Date_H
#define Date_H

namespace DateSpace
{
class Date
{
private:
int Day;
int Month;
int Year;

public:

Date()
{
Day = 1;
Month = 1;
Year = 1900;
}
int getDay(){ return Day;}
int getMonth(){ return Month; }
int getYear(){ return Year; }
void setDay();
void setMonth();
void setYear();
void ShowDate();
void CheckAnotherDate();


};

int IsValidDate(int Day, int Month, int Year);

int IsLeapYear(int Year);

}



#endif

===============================

// Date.cpp by Ethan Castanon


// File: Date.cpp; Name: Ethan Castanon
#include "Date.h"
#include <iostream>

namespace DateSpace
{
int DateSpace::IsLeapYear(int Year)
{
int isLeap;
if ((Year/1.00 == 0) && (Year/400.00 == 0))
isLeap = 1;
else
if ((Year/100.00 != 0) && (Year / 4.00 == 0))
isLeap = 1;
else
isLeap = 0;
return isLeap;
}
int DateSpace::IsValidDate(int Day, int Month, int Year)
{
int ValidDate;
if ((Month <= 0 ) || (13 <= Month))
ValidDate = 0;
if ((Day <= 0 ) || (32 <= Day))
ValidDate = 0;
if ((IsLeapYear(Year)==1) && (Month == 2) && (0 < Day < 30))
ValidDate = 1;
if (((Month == 4) || (Month == 6) || (Month == 9) || (Month == 11)) && (0 < Day < 31))
ValidDate = 1;
if (((Month == 1) || (Month == 3) || (Month == 5) || (Month == 7) || (Month == 8) || (Month == 10) || (Month == 12) ) && (0 < Day < 32))
ValidDate = 1;
return ValidDate;
}
void Date::setDay()
{
int theDay;
std::cout << "Please enter your date's day value in integer form." << std::endl;
std::cin >> theDay;


if (IsValidDate(theDay,Month,Year)==1)
Day = theDay;
else
while (theDay<= 0 || theDay>= 32)
{
std::cout << "You have committed a *violation*. The day's value is unchanged" << std::endl;
std::cout << "and remains the default day, which is 1." << std::endl;
std::cout<< "The day value you enter must be an integer value ranging from 1 to 31:" << std::endl;
std::cout << " depending on the month you entered" << std::endl;
std::cout << "Please enter your date's day value in integer form." << std::endl;
std::cin >> theDay;
}
}
void Date::setMonth()
{
int theMonth;
std::cout << "Please enter your date's month value in integer form." << std::endl;
std::cin >> theMonth;

if (IsValidDate(Day,theMonth,Year)==1)
Month = theMonth;
else
while (theMonth<= 0 || theMonth>= 13)
{
std::cout << "You have committed a *violation*. The months's value is unchanged" << std::endl;
std::cout<< "and remains the default month, which is 1." << std::endl;
std::cout<< "The month value you enter must be an integer value ranging from 1 to 12." << std::endl;
std::cout << "Please enter your date's month value in integer form." << std::endl;
std::cin >> theMonth;
}
}
void Date::setYear()
{
int theYear;
std::cout <<  "Please enter your date's year value in integer form." << std::endl;
std::cin >> theYear;

if (IsValidDate(Day,Month,theYear)==1)
Year = theYear;
}
void Date::ShowDate()
{
std::cout << "The date is: " << Month << "/" << Day << "/" << Year << std::endl;
}
void Date::CheckAnotherDate()
{
int YesNo;
std::cout << "Do you want to check another date?" << std::endl;
std::cout << "Enter the integer 1 for yes; enter integer 0 for no" << std::endl;
std::cin >> YesNo;
while (YesNo == 1)
{
DateSpace::Date theDate;
theDate.ShowDate();
theDate.setMonth();
theDate.setDay();
theDate.setYear();
theDate.ShowDate();
std::cout << "Do you want to check another date?" << std::endl;
std::cout << "Enter the integer 1 for yes; enter integer 0 for no." << std::endl;
std::cin >> YesNo;
}

}

}

=========================================

// DateDemo.cpp - demonstrate use and test Date Library


#include <iostream>
#include "Date.h"
#include "stdafx.h"

using namespace std;
using namespace DateSpace;

int _tmain(int argc, _TCHAR* argv[])
{
DateSpace::Date theDate;
theDate.ShowDate();
theDate.setMonth();
theDate.setDay();
theDate.setYear();
theDate.ShowDate();
theDate.CheckAnotherDate();
system("PAUSE");
return 0;
}

Sunday, February 13, 2011

ASCII Characters Encoded in Uniform Resource Locators - source : http://w3schools.com

Source: http://www.w3schools.com/TAGS/ref_urlencode.asp

URL Encoding Reference

ASCII Character URL-encoding
space %20
! %21
" %22
# %23
$ %24
% %25
& %26
' %27
( %28
) %29
* %2A
+ %2B
, %2C
- %2D
. %2E
/ %2F
0 %30
1 %31
2 %32
3 %33
4 %34
5 %35
6 %36
7 %37
8 %38
9 %39
: %3A
; %3B
< %3C
= %3D
> %3E
? %3F
@ %40
A %41
B %42
C %43
D %44
E %45
F %46
G %47
H %48
I %49
J %4A
K %4B
L %4C
M %4D
N %4E
O %4F
P %50
Q %51
R %52
S %53
T %54
U %55
V %56
W %57
X %58
Y %59
Z %5A
[ %5B
\ %5C
] %5D
^ %5E
_ %5F
` %60
a %61
b %62
c %63
d %64
e %65
f %66
g %67
h %68
i %69
j %6A
k %6B
l %6C
m %6D
n %6E
o %6F
p %70
q %71
r %72
s %73
t %74
u %75
v %76
w %77
x %78
y %79
z %7A
{ %7B
| %7C
} %7D
~ %7E
  %7F
%80
  %81
%82
ƒ %83
%84
%85
%86
%87
ˆ %88
%89
Š %8A
%8B
Œ %8C
  %8D
Ž %8E
  %8F
  %90
%91
%92
%93
%94
%95
%96
%97
˜ %98
%99
š %9A
%9B
œ %9C
  %9D
ž %9E
Ÿ %9F
  %A0
¡ %A1
¢ %A2
£ %A3
  %A4
¥ %A5
| %A6
§ %A7
¨ %A8
© %A9
ª %AA
« %AB
¬ %AC
¯ %AD
® %AE
¯ %AF
° %B0
± %B1
² %B2
³ %B3
´ %B4
µ %B5
%B6
· %B7
¸ %B8
¹ %B9
º %BA
» %BB
¼ %BC
½ %BD
¾ %BE
¿ %BF
À %C0
Á %C1
 %C2
à %C3
Ä %C4
Å %C5
Æ %C6
Ç %C7
È %C8
É %C9
Ê %CA
Ë %CB
Ì %CC
Í %CD
Î %CE
Ï %CF
Ð %D0
Ñ %D1
Ò %D2
Ó %D3
Ô %D4
Õ %D5
Ö %D6
  %D7
Ø %D8
Ù %D9
Ú %DA
Û %DB
Ü %DC
Ý %DD
Þ %DE
ß %DF
à %E0
á %E1
â %E2
ã %E3
ä %E4
å %E5
æ %E6
ç %E7
è %E8
é %E9
ê %EA
ë %EB
ì %EC
í %ED
î %EE
ï %EF
ð %F0
ñ %F1
ò %F2
ó %F3
ô %F4
õ %F5
ö %F6
÷ %F7
ø %F8
ù %F9
ú %FA
û %FB
ü %FC
ý %FD
þ %FE
ÿ %FF


URL Encoding Reference

The ASCII device control characters -%1f were originally designed to control hardware devices. Control characters have nothing to do inside a URL.
ASCII Character Description URL-encoding
NUL null character
SOH start of header %01
STX start of text %02
ETX end of text %03
EOT end of transmission %04
ENQ enquiry %05
ACK acknowledge %06
BEL bell (ring) %07
BS backspace %08
HT horizontal tab %09
LF line feed %0A
VT vertical tab %0B
FF form feed %0C
CR carriage return %0D
SO shift out %0E
SI shift in %0F
DLE data link escape %10
DC1 device control 1 %11
DC2 device control 2 %12
DC3 device control 3 %13
DC4 device control 4 %14
NAK negative acknowledge %15
SYN synchronize %16
ETB end transmission block %17
CAN cancel %18
EM end of medium %19
SUB substitute %1A
ESC escape %1B
FS file separator %1C
GS group separator %1D
RS record separator %1E
US unit separator %1F

« Previous Next Reference »

Saturday, February 12, 2011

A PHP File from Template Monster - Learn from Their Server Side Script

<?php // @version $Id: default.php 9830 2008-01-03 01:09:39Z eddieajau $
defined('_JEXEC') or die('Restricted access');
?>
<?php
$return = base64_encode(base64_decode($return).'#content');

if ($type == 'logout') : ?>

<form action="index.php" method="post" name="login" id="form-main1" class="log">
    <div class="logo-title">
        <?php if ($params->get('greeting')) : echo JText::sprintf('HINAME', $user->get('name')); endif; ?>
    </div>
    <div>
       <!-- <input type="submit" name="Submit" class="button png" value="<?php echo JText::_('BUTTON_LOGOUT'); ?>" />-->
        <a class="button png"  href="#" onClick="document.getElementById('form-main1').submit()"><?php echo JText::_('BUTTON_LOGOUT'); ?></a>
    </div>
    <input type="hidden" name="option" value="com_user" />
    <input type="hidden" name="task" value="logout" />
    <input type="hidden" name="return" value="<?php echo $return; ?>" />
</form>
<?php else : ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-main" class="form-login">
    <?php if ($params->get('pretext')) : ?>
    <p> <?php echo $params->get('pretext'); ?> </p>
    <?php endif; ?>
    <div class="left-side">
        <div class="username form-height">
           <input name="username" id="mod_login_username" type="text" class="inputbox"  value="username" onBlur="if(this.value=='') this.value='username'" onFocus="if(this.value =='username' ) this.value=''"/>
        </div>
        <div class="password  form-height">
            <input type="password" id="mod_login_password" name="passwd" class="inputbox"  alt="<?php echo JText::_('Password'); ?>" value="admin" onBlur="if(this.value=='') this.value='admin'" onFocus="if(this.value =='admin' ) this.value=''"/>
            <br />
        </div>
         <div id="inputs">
                        <input type="checkbox" name="remember" id="mod_login_remember" class="checkbox" value="yes" alt="<?php echo JText::_('Remember me'); ?>" />
                        <label for="mod_login_remember" class="remember"> <?php echo JText::_('Remember me'); ?> </label>
                </div>
            
        <!--<input type="submit" name="Submit" class="button-login" value="<?php echo JText::_('LOGIN'); ?>" />-->
      <a class="button-login"  href="#" onClick="document.getElementById('form-main').submit()"><?php echo JText::_('LOGIN'); ?></a>
    </div>
   
    <div id="form-login-remember"> <a href="<?php echo JRoute::_('index.php?option=com_user&view=reset#content'); ?>"> <?php echo JText::_('Forgot you password?'); ?></a>
      <a href="<?php echo JRoute::_('index.php?option=com_user&view=remind#content'); ?>"> <?php echo JText::_('Forgot your username? '); ?></a>
        <?php $usersConfig =& JComponentHelper::getParams('com_users');
    if ($usersConfig->get('allowUserRegistration')) : ?>
        <div class="form-indent-top">
              <!--<span class="login-text-1"><?php echo JText::_('Create an account'); ?></span>-->
            <a class="reg" href="<?php echo JRoute::_('index.php?option=com_user&task=register#content'); ?>"> <?php echo JText::_('Create an account'); ?></a>
           
        </div>
        <?php endif; ?>
    </div>
   
    <?php
    echo $params->get('posttext'); ?>
    <input type="hidden" name="option" value="com_user" />
    <input type="hidden" name="task" value="login" />
    <input type="hidden" name="return" value="<?php echo $return; ?>" />
    <?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php endif;

Cascading Style Sheets (CSS) versus Inline Styling in HTML

 Below is CSS styling in HTML

<style type="text/css">
<!--
#apDiv1 {
    position:absolute;
    width:680px;
    height:522px;
    z-index:1;
    left: 47px;
    top: 27px;
}
-->
</style>
<p></p>
<div class="col-2">
<h3 style="text-align: left;">&nbsp;</h3>
<h3 style="text-align: left;">&nbsp;</h3>
<div id="apDiv1">
  <p><img src="drcpage.jpg" width="680" height="522"> </p>
</div>
<h3 style="text-align: left;">Medical School</h3>
<ul>
<li>University of Texas - Medical Branch Residency</li>
<li>LA USC Medical Center</li>
<li>Cedar Sinai Medical Center</li>
</ul>
<h3 style="text-align: left;">Society Memberships</h3>
<ul>
<li>Past President OC Society of Otolaryngology</li>
<li>Fellow of the American College of Surgeons</li>
<li>Fellow of the American Academy of Otolaryngology - Head &amp; Neck Surgery</li>
<li>Member of the Orange County Medical Association</li>
<li>Member of the California Medical Association</li>
</ul>
<h3>Certifications</h3>
<ul>
<li>Board Certified in Otolaryngology</li>
<li>California Licensed Hearing Aid Dispenser</li>
</ul>
<h3>Hospital Affiliations</h3>
<ul>
<li>Hoag Memorial Hospital</li>
<li>Fountain Valley Hospital</li>
</ul>
<img src="images/stories/drcpage.jpg" border="0" alt="Richard G. Castanon, M.D., FACS" width="680" height="522" style="vertical-align: bottom;" /></div>


-------------------------------------------------------------------------------------
Below is inline styling in HTML

<h3>Richard G. Castanon, M.D., FACS</h3>
<p><strong>Dr. Castanon is long established and highly regarded in the medical  community.</strong> He has held many posts of distinction throughout his  career.  Dr.  Castanon has taught at USC &amp; UCI Medical schools as  Assistant  Clinical Professor.  He also has served as Chief of Staff and  Chairman  of the Department of Surgery at Huntington Beach Hospital and  Chairman  of the  Department of Otolaryngology at Hoag Hospital.</p>
<p> </p>
<h3 style="text-align: left;">Medical School</h3>
<ul>
<li>University of Texas - Medical Branch Residency</li>
<li>LA USC Medical Center</li>
<li>Cedar Sinai Medical Center</li>
</ul>
<h3 style="text-align: left;">Society Memberships</h3>
<ul>
<li>Past President OC Society of Otolaryngology</li>
<li>Fellow of the American College of Surgeons</li>
<li>Fellow of the American Academy of Otolaryngology - Head &amp; Neck Surgery</li>
<li>Member of the Orange County Medical Association</li>
<li>Member of the California Medical Association</li>
</ul>
<h3>Certifications</h3>
<ul>
<li>Board Certified in Otolaryngology</li>
<li>California Licensed Hearing Aid Dispenser</li>
</ul>
<h3>Hospital Affiliations</h3>
<ul>
<li>Hoag Memorial Hospital</li>
<li>Fountain Valley Hospital</li>
</ul>
<p><img src="images/stories/drcpage.jpg" border="0" alt="Richard G. Castanon, M.D., FACS"  style="position: absolute; width: 522px; height: 680px; z-index: 1; left: 464px; top: 75px;" /></p>

Friday, February 11, 2011

Joomla! (Content Management System in PHP & MySQL) - Error Messages

Fatal error: Call to a member function getMessageQueue() on a non-object in /xxx/ccccc/55/4153259/html/templates/earthlight02/functions.php on line 17

--------------------------

Fatal error: Call to a member function getMessageQueue() on a non-object in /home/content/52033/47asdks9/html/templates/health_review_j/functions.php on line 11

----------------


(
Fatal error: Class 'JParameter' not found in /home/content/sdfa/4slkdjf/html/templates/theme652/index.php on line 37)
 

Wednesday, February 9, 2011

C++ Date Library by Ethan Castanon - in progress

#ifndef Date_H
#define Date_H

namespace DateSpace
{
class Date
{
public:
Date();
Date(int = 1, int = 1, int = 1900);
int getDay(){ return Day;}
int getMonth(){ return Month; }
int getYear(){ return Year; }
void setDay(int Day);
void setMonth(int Month);
void setYear(int Year);

private:
int Day;
int Month;
int Year;

};

bool IsValidDate(int Day, int Month, int Year);

bool IsLeapYear(int Year);

}



#endif

===================================================


// File: Date.cpp; Name: Ethan Castanon
#include "Date.h"


namespace DateSpace
{
bool isLeapYear(int Year)
{
bool Leap;
if ((Year % 100 == 0) && (Year % 400 == 0))
Leap = 1;
else
if ((Year % 100 != 0) && (Year % 4 == 0))
Leap = 1;
else
Leap = 0;
return Leap;
}
bool isValidDate(int Day, int Month, int Year)
{
bool isVal;
isVal = 1;
return isVal;
}
void Date::setDay(int theDay)
{
isValudDate;
Day = theDay;
}
void Date::setMonth(int theMonth)
{
Month = theMonth;
}
void Date::setYear(int theYear)
{
Year = theYear;
}
}

===================================================


#include <iostream>
#include "Date.h"

using namespace std;
using namespace DateSpace;

int main()
{

}

Saturday, February 5, 2011

Enable Task Manager

Time Required: 5 minutes
Here's How:
  1. Click Start
  2. Click Run
  3. Type REGEDIT
  4. Click OK The Registry Editor will now open
  5. Browse to the following key:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\
    CurrentVersion\Policies\system
  6. In the right pane, look for the value: DisableTaskMgr
  7. Right click DisableTaskMgr and select Delete. (When prompted with "Are you sure you want to delete this value", select Yes.
  8. Now browse to the following key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
    CurrentVersion\policies\system
  9. In the right pane, look for the value: DisableTaskMgr
  10. Right click DisableTaskMgr and select Delete. (When prompted with "Are you sure you want to delete this value", select Yes.
  11. Close the Registry by choosing File | Exit
  12. You should now be able to access Task Manager. If not, reboot into Safe Mode and repeat the steps outlined above.

Sunday, January 30, 2011

How to Read SQL Syntax

 Source: http://kb.askmonty.org/v/how-to-read-sql-syntax


How to Read SQL Syntax

We have used the following common variant of BNF notation for the SQL syntax diagrams in this book:
< > Angle brackets surround the names of syntactic elements. The brackets are not part of the syntax; do not include them in your SQL statement.
::= The definition operator separates the syntactic element being defined from its definition. Read the definition from left to right.
[ ] Square brackets surround optional syntax. You may choose whether or not to omit such syntax when forming an SQL statement. The brackets are not part of the syntax; do not include them in your SQL statement.
{ } Braces surround mandatory syntax groupings. You must include the entire grouping when forming an SQL statement. The braces are not part of the syntax; do not include them in your SQL statement.
| The vertical bar separates groups of syntactic elements. You must choose one of the elements when forming an SQL statement. The vertical bar is not part of the syntax; do not include it in your SQL statement.
... An ellipsis following a syntactic element indicates that the syntax is repeatable. You may include the element as often as you wish when forming an SQL statement. The ellipsis is not part of the syntax; do not include it in your SQL statement.
 Blank spaces (whether single or multiple spaces and/or line breaks) separate syntactic elements.
All other characters in a definition stand for themselves.
We also follow these notation conventions:
  1. Words written in uppercase letters are SQL <keyword>s. You must write them exactly as shown when forming an SQL statement, except that you have the choice of writing them in either uppercase or lowercase letters.
  2. Words written in lowercase letters represent syntactic categories. You must replace them with actual <identifier>s or <literal>s when forming an SQL statement.
  3. Parentheses that appear in a syntax diagram are part of the syntax. You must include them when forming an SQL statement.
Thus, as in the following simplified example of an SQL syntax diagram:
CREATE TABLE <Table name> (
     <Column name> {INTEGER | CHARACTER(5)} )
  1. The words CREATE and TABLE are SQL <keyword>s and must be included, without changes, in a CREATE TABLE statement.
  2. The words <Table name> and <Column name> are syntactic categories and must be replaced with an actual <Table name> and <Column name>, respectively, in a CREATE TABLE statement. The angle brackets around "Table name" and "Column name" indicate that these terms are defined with a syntax diagram somewhere in this book.
  3. The parentheses are part of the syntax and must be included, exactly where shown, in a CREATE TABLE statement.
  4. The braces and vertical bar after the <Column name> indicate that either one of the SQL <keyword>s "INTEGER" or "CHARACTER(5)" must be included, without changes, in a CREATE TABLE statement.
Based on this example, the following two SQL statements are the only valid uses of the syntax:
CREATE TABLE A_Table_Name (
     a_column_name INTEGER);

   CREATE TABLE A_Table_Name (
     a_column_name CHARACTER(5));

Saturday, January 29, 2011

Larry Kudlow - Questionable Economic Views from an Alleged Democrat

Kudlow opposes estate taxes, as well as taxes on dividends and capital gains. He also advocates that employees be compelled to make greater contributions to their pension and medical costs, suggesting that these expenses are an undue burden on businesses and defends high executive compensation as a manifestation of market forces and opposes most forms of government regulation.


Source: Wikipedia - http://en.wikipedia.org/wiki/Lawrence_Kudlow

This was economic prediction prior to "The Great Recession" -

Kudlow firmly denied that U.S. would enter a recession (in 2007) or that the U.S. was in recession (in early and mid 2008). In December, 2007 he wrote: "The recession debate is over. It's not gonna happen. Time to move on. At a bare minimum, we are looking at Goldilocks 2.0. (And that's a minimum). The Bush boom is alive and well. It's finishing up its sixth splendid year with many more years to come".[11] In May, 2008 he wrote:"President George W. Bush may turn out to be the top economic forecaster in the country" in his "R" is for "Right".[12]


He couldn't have been more wrong.

Wednesday, January 26, 2011

Work in SQL Server 2008 R2


SELECT TDate = t1.TDate, TOpenP = t1.TOpenP, THighP = t1.THighP,
TLowP = t1.TLowP, TCloseP = t1.TCloseP, TVolume = t1.TVolume
    FROM dbo.ibm$ t1 
    INNER JOIN dbo.intc$ t2 
    ON t1.TDate = t2.TDate
    AND t1.TDate = '2011-01-21 00:00:00.000'


=======================================================================
Ambiguous column name is usually the result of a poorly constructed inner join

BAD:
----------------------------------------------------

SELECT TDate
From ibm$
INNER JOIN intc$
ON ibm$.TDate=intc$.TDate
----------------------------------------------------
GOOD:

SELECT TDate = t1.TDate
    FROM ibm$ t1 
    JOIN intc$ t2 
    ON t1.TDate = t2.TDate

SELECT TDate = t1.TDate

    FROM ibm$ t1 

    JOIN intc$ t2 

    ON t1.TDate = t2.TDate

    AND t1.TDate = '2011-01-21 00:00:00.000'







/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [F1]
      ,[F2]
      ,[F3]
      ,[F4]
      ,[F5]
      ,[F6]
  FROM [trading].[dbo].[intc$]

--------------------------------------------------------------------------

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [name]
      ,[team]
      ,[salary]
      ,[sickleave]
  FROM [BASKETBALL].[dbo].[DONG]
--------------------------------------------


create database trading
----------------------------------------------

create table intel
(t_date date not null,
t_open decimal(10,2) not null,
t_high decimal(10,2) not null,
t_low decimal(10,2) not null,
t_close decimal(10,2) not null,
volume numeric(11) not null);
----------------------------------------------
SELECT * FROM ‘intc$’
-----------------------------------------------

Click Finish to perform the following actions:


Source Location : C:\Users\edog\Documents\intc.xls
Source Provider : Microsoft.Jet.OLEDB.4.0
Destination Location : DRC-PC\DONGSERVER
Destination Provider : SQLNCLI10

·          Copy rows from `intc$` to [dbo].[intc$]
The new target table will be created.

·          The package will not be saved.
·          The package will be run immediately.

Provider mapping file : C:\Program Files\Microsoft SQL Server\100\DTS\MappingFiles\JetToMSSql9.xml
------------------------------------------------------------------------------------------------------------------------------------------------------------------


Sunday, January 16, 2011

The Federal Reserve Keeping Interest Rates Artificially Low

Very simply, Volcker bit the bullet and stopped the purchase of government securities that were keeping interest rates artificially low.