text stringlengths 454 608k | url stringlengths 17 896 | dump stringclasses 91 values | source stringclasses 1 value | word_count int64 101 114k | flesch_reading_ease float64 50 104 |
|---|---|---|---|---|---|
Computer Science Archive: Questions from August 24, 2011
- Anonymous askedCreate EntryWayListInerface that compiles with appropriate @comments and parameters with the followi... Show moreCreate EntryWayListInerface that compiles with appropriate @comments and parameters with the following methods:
1. boolean insertHead (Object newEntry)
2. boolean insertTail (Object newEntry)
3. object deleteHead ( )
4. object deleteTail ( )
5. void display ( )
6. int contains (object anEntry)
7. boolean isEmpty ( )
8. boolean isFull ( ) • Show less2 answers
- Anonymous askedIn the Sales department at the Network Service Corporation, what type of users will use the followin... More »0 answers
- Anonymous asked8. A. Write the definitions of the functions setWaitingTime, getArrivalTime, getTransactionTime, and1 answer
- Anonymous asked2 answers
- Anonymous asked0 answers
- Anonymous askedQ4: “if the priority of two or more operators in an arithmetic expression is same then we should l... More »1 answer
- Anonymous56123 asked1) Explain how to use l... Show morePlease answer these in the before 12:30pm(afternoon) EASTERN STANDARD TIME!!!
1) Explain how to use loops to process data stored in a two-dimensional array. In your explanation include a two-dimensional array declaration and initialization and the code required to print the data elements using loops.
2)Develop a class definition that models an employee. Include private & public member functions & variables. Demonstrate how the class would be instantiated and how class members would be accessed.
3)What is the purpose of the new operator? Demonstrate how to use the new operator to create an array whose size is determined by user-input at run time.
4)Explain what a dangling pointer is, why they are harmful and demonstrate using a C++ code segment how to avoid dangling pointers.
5)Explain the difference between unary and binary operator overloading. Provide a code segment that illustrates both types of overloading. Explain why operator overloading is necessary. • Show less5 answers
- Anonymous asked“When we write programs in C language, it can be written without using any function.” Is this po... More »1 answer
- Anonymous askedWhat is the transmission efficiency of a 5000 byte file sent in response to a web request HTTP, TCP/... More »3 answers
- Anonymous askedI am trying to figure out this proposition and am getting stuck. Just started this class two days ag... Show moreI am trying to figure out this proposition and am getting stuck. Just started this class two days ago.
I understand that this (P ^ R) means "P and Q", conjunction, but I cannot figure out
how to evaluate the truth table for (P ^ !R) "P and not R". Any help in figuring this out would be great.
Thanks! • Show less2 answers
- Anonymous askedwrite a sequence of two instructions that copies bits 0-5 from al to bits 0-5 in bl. Should be clear... More »0 answers
- Anonymous asked1. Copy the file PizzaOrder.java (see code lis... Show moreTask #1 The if Statement, Comparing Strings, and Flags
1. Copy the file PizzaOrder.java (see code listing 3.1) from- port or as directed by your instructor.
2. Compile and run PizzaOrder.java. You will be able to make selections, but at this point, you will always get a Hand-tossed pizza at a base cost of $12.99 no matter what you select, but you will be able to choose toppings, and they should add into the price correctly. You will also notice that the output does not look like money. So we need to edit PizzaOrder.java to complete the program so that it works correctly.
3. Construct a simple if statement. The condition will compare the String input by the user as his/her first name with the first names of the owners, Mike and Diane. Be sure that the comparison is not case sensitive.
4. If the user has either first name, set the discount flag to true. This will not affect the price at this point yet.
Task #2 The if-else-if Statement
1. Write an if-else-if statement that lets the computer choose which statements to execute by the user input size (10, 12, 14, or 16). For each option, the cost needs to be set to the appropriate amount.
2. The default else of the above if-else-if statement should print a statement that the user input was not one of the choices, so a 12 inch pizza will be made. It should also set the size to 12 and the cost to 12.99.
3. Compile, debug, and run. You should now be able to get correct output for size and price (it will still have Hand-tossed crust, the output won’t look like money, and no discount will be applied yet). Run your program multiple times ordering a 10, 12, 14, 16, and 17 inch pizza.
Task #3 Switch Statement
1. Write a switch statement that compares the user’s choice with the appropriate characters (make sure that both capital letters and small letters will work).
2. Each case will assign the appropriate string indicating crust type to the crust variable.
3. The default case will print a statement that the user input was not one of the choices, so a Hand-tossed crust will be made.
4. Compile, debug, and run. You should now be able to get crust types other than Hand-tossed. Run your program multiple times to make sure all cases of the switch statement operate correctly.
Task #4 Using a Flag as a Condition
1. Write an if statement that uses the flag as the condition. Remember that the flag is a Boolean variable, therefore is true or false. It does not have to be com- pared to anything.
2. The body of the if statement should contain two statements:
a) A statement that prints a message indicating that the user is eligible for a $2.00 discount.
b) A statement that reduces the variable cost by 2.
3. Compile, debug, and run. Test your program using the owners’ names (both capitalized and not) as well as a different name. The discount should be cor- rectly at this time.
Task #5 Formatting Numbers
1. Add an import statement to use the DecimalFormat class as indicated above the class declaration.
2. Create a DecimalFormat object that always shows 2 decimal places.
3. Edit the appropriate lines in the main method so that any monetary output has 2 decimal places.
4. Compile, debug, and run. Your output should be completely correct at this time, and numeric output should look like money.
Code Listing 3.1 (PizzaOrder.java)
import java.util.Scanner;
import java.text.DecimalFormat;
/** This program allows the user to order a pizza
*/
public class PizzaOrder {
public static void main (String [] args) {
//TASK #5 Create a DecimalFormat object with 2 decimal //places
//Create a Scanner object to read input
Scanner keyboard = new Scanner
String firstName; boolean discount = false;
int inches; char crustType; String crust = "Hand-tossed"; double cost = 12.99; final double TAX_RATE = .08; double tax; char choice; String input; String toppings = "Cheese "; int numberOfToppings = 0;
(System.in);
//user’s first name //flag, true if user is //eligible for discount //size of the pizza //code for type of crust //name of crust //cost of the pizza //sales tax rate //amount of tax //user’s choice //user input //list of toppings //number of toppings
//prompt user and get first name System.out.println("Welcome to Mike and Diane’s Pizza"); System.out.print("Enter your first name: "); firstName = keyboard.nextLine();
//determine if user is eligible for discount by //having the same first name as one of the owners //ADD LINES HERE FOR TASK #1
//prompt user and get pizza size choice System.out.println("Pizza Size (inches) Cost");
System.out.println(" 10 System.out.println(" 12 System.out.println(" 14 System.out.println(" 16 System.out.println("What size pizza would you like?"); System.out.print(
"10, 12, 14, or 16 (enter the number only): "); inches = keyboard.nextInt();
//set price and size of pizza ordered //ADD LINES HERE FOR TASK #2
//consume the remaining newline character keyboard.nextLine();
//prompt user and get crust choice System.out.println("What type of crust do you want? "); System.out.print("(H)Hand-tossed, (T) Thin-crust, or " +
"(D) Deep-dish (enter H, T, or D): "); input = keyboard.nextLine(); crustType = input.charAt(0);
//set user’s crust choice on pizza ordered //ADD LINES FOR TASK #3
//prompt user and get topping choices one at a time
System.out.println("All pizzas come with cheese."); System.out.println("Additional toppings are $1.25 each,"
+ " choose from"); System.out.println("Pepperoni, Sausage, Onion, Mushroom");
$10.99”); $12.99"); $14.99"); $16.99");
//if topping is desired, //add to topping list and number of toppings System.out.print("Do you want Pepperoni? (Y/N): "); input = keyboard.nextLine(); choice = input.charAt(0); if (choice == ‘Y’ || choice == ‘y’) {
numberOfToppings += 1; toppings = toppings + "Pepperoni ";
} System.out.print("Do you want Sausage? (Y/N): "); input = keyboard.nextLine(); choice = input.charAt(0); if (choice == ‘Y’ || choice == ‘y’) {
numberOfToppings += 1; toppings = toppings + "Sausage ";
} System.out.print("Do you want Onion? (Y/N): "); input = keyboard.nextLine(); choice = input.charAt(0); if (choice == ‘Y’ || choice == ‘y’) {
numberOfToppings += 1; toppings = toppings + "Onion ";
} System.out.print("Do you want Mushroom? (Y/N): "); input = keyboard.nextLine(); choice = input.charAt(0); if (choice == ‘Y’ || choice == ‘y’) {
numberOfToppings += 1; toppings = toppings + "Mushroom ";
}
//add additional toppings cost to cost of pizza
}
cost = cost + (1.25*numberOfToppings);
//display order confirmation System.out.println(); System.out.println("Your order is as follows: "); System.out.println(inches + " inch pizza"); System.out.println(crust + " crust"); System.out.println(toppings);
//apply discount if user is eligible //ADD LINES FOR TASK #4 HERE
//EDIT PROGRAM FOR TASK #5 //SO ALL MONEY OUTPUT APPEARS WITH 2 DECIMAL PLACES
System.out.println("The cost of your order is: $" + cost);
//calculate and display tax and total cost tax = cost * TAX_RATE; System.out.println("The tax is: $" + tax); System.out.println("The total due is: $" + (tax+cost));
System.out.println( "Your order will be ready for pickup in 30 minutes."); • Show less1 answer
- Anonymous asked... Show moreTask #1 While loop
1. Copy the file DiceSimulation.java (see code listing 4.1) from or as directed by your instructor. DiceSimulation.java
is incomplete. Since there is a large part of the program missing, the output will
be incorrect if you run DiceSimulation.java.
2. I have declared all the variables. You need to add code to simulate rolling the
dice and keeping track of the doubles. Convert the algorithm below to Java and
place it in the main method after the variable declarations, but before the output
statements. You will be using several control structures: a while loop and an ifelse-
if statement nested inside another if statement. Use the indenting of the
algorithm to help you decide what is included in the loop, what is included in
the if statement, and what is included in the nested if-else-if statement.
3. To “roll” the dice, use the nextInt method of the random number generator to
generate an integer from 1 to 6.
Repeat while the number of dice rolls are less than the number of times the dice should
be rolled.
Get the value of the first die by “rolling” the first die
Get the value of the second die by “rolling” the second die
If the value of the first die is the same as the value of the second die
If value of first die is 1
Increment the number of times snake eyes were rolled
Else if value of the first die is 2
Increment the number of times twos were rolled
Else if value of the first die is 3
Increment the number of times threes were rolled
Else if value of the first die is 4
Increment the number of times fours were rolled
Else if value of the first die is 5
Increment the number of times fives were rolled
Else if value of the first die is 6
Increment the number of times sixes were rolled
Increment the number of times the dice were rolled
4. Compile and run. You should get numbers that are somewhat close to 278 for
each of the different pairs of doubles. Run it several times. You should get different
results than the first time, but again it should be somewhat close to 278.
Task #2 Using Other Types of Loops
1. Change the while loop to a do-while loop. Compile and run. You should get the
same results.
2. Change the do loop to a for loop. Compile and run. You should get the same
results.
Task #3 Writing Output to a File
1. Copy the files StatsDemo.java (see code listing 4.2) and Numbers.txt from or as directed by your instructor.
2. First we will write output to a file:
a) Create a PrintWriter object passing it the filename “Results.txt” (Don’t forget
the needed import statement).
b) Since you are using a PrintWriter object, add a throws clause to the main
method header.
c) Print the mean and standard deviation to the output file using a three decimal
format, labeling each.
d) Close the output file.
3. Compile, debug, and run. You will need to type in the filename Numbers.txt.
You should get no output to the console, but running the program will create a
file called Results.txt with your output. The output you should get at this point
is: mean = 0.000, standard deviation = 0.000. This is not the correct mean or
standard deviation for the data, but we will fix this in the next tasks.
Task #4 Calculating the Mean
1. Now we need to add lines to allow us to read from the input file and calculate
the mean.
a) Create a File object passing it the filename.
b) Create a Scanner object passing it the File object.
2. Write a loop that reads items from the filr until you are at the end of the file.
The body of the loop will
a) read a double from the file
b) add the value that was read from the file to the accumulator
c) increment the counter
3. When the loop terminates, close the input file.
4. Calculate and store the mean. The mean is calculated by dividing the accumulator
by the counter.
5. Compile, debug, and run. You should now get a mean of 77.444, but the standard
deviation will still be 0.000.
Task #5 Calculating the Standard Deviation
1. We need to reconnect to the file so that we can start reading from the top again.
a) Create a File object passing it the filename.
b) Create a Scanner object passing it the File object.
2. Reinitialize sum and count to 0.
3. Write a loop that reads items from the file until you are at the end of the file.
The body of the loop will
a) read a double file from the file
b) subtract the mean from the value that was read from the file and store the
result in difference
c) add the square of the difference to the accumulator
d) increment the counter
4. When the loop terminates, close the input file.
5. The variance is calculated by dividing the accumulator (sum of the squares of
the difference) by the counter. Calculate the standard deviation by taking the
square root of the variance (Use Math.sqrt ( ) to take the square root).
6. Compile, debug, and run the program. you should get a mean of 77.444 and
standard deviation of 10.021.
Code Listing 4.1 (DiceSimulation.java)
import java.util.Random;
//to use the random number
//generator
/**
This class simulates rolling a pair of dice 10,000 times and
counts the number of times doubles of are rolled for each different
pair of doubles.
*/
public class DiceSimulation
{
public static void main(String[] args)
{
final int NUMBER = 10000; //the number of times to
//roll the dice
//a random number generator used in simulating
//rolling a dice
Random generator = new Random();
int die1Value; // number of spots on the first
// die
int die2Value; // number of spots on the second
// die
int count = 0; // number of times the dice were
// rolled
int snakeEyes = 0; // number of times snake eyes is
// rolled
int twos = 0; // number of times double
// two is rolled
int threes = 0; // number of times double three
// is rolled
int fours = 0; // number of times double four
// is rolled
int fives = 0; // number of times double five
// is rolled
int sixes = 0; // number of times double six is
// rolled
//ENTER YOUR CODE FOR THE ALGORITHM HERE
System.out.println ("You rolled snake eyes " +
snakeEyes + " out of " + count + " rolls.");
System.out.println ("You rolled double twos " + twos +
" out of " + count + " rolls.");
System.out.println ("You rolled double threes " +
threes + " out of " + count + " rolls.");
System.out.println ("You rolled double fours " + fours
+ " out of " + count + " rolls.");
System.out.println ("You rolled double fives " + fives
+ " out of " + count + " rolls.");
System.out.println ("You rolled double sixes " + sixes
+ " out of " + count + " rolls.");
}
}
Code Listing 4.2 (StatsDemo.java)
import java.text.DecimalFormat; //for number formatting
import java.util.Scanner; //for keyboard input
//ADD AN IMPORT STATEMENT HERE //for using files
public class StatsDemo
{
public static void main(String [] args) //ADD A THROWS
//CLAUSE HERE
{
double sum = 0; //the sum of the numbers
int count = 0; //the number of numbers added
double mean = 0; //the average of the numbers
double stdDev = 0; //the standard deviation of the
//numbers
double difference; //difference between the value
//and the mean
//create an object of type Decimal Format
DecimalFormat threeDecimals =
new DecimalFormat("0.000");
//create an object of type Scanner
Scanner keyboard = new Scanner (System.in);
String filename; // the user input file name
//Prompt the user and read in the file name
System.out.println("This program calculates statistics" + "on a file containing a series of numbers");
System.out.print("Enter the file name: ");
filename = keyboard.nextLine();
//ADD LINES FOR TASK #4 HERE
//Create a File object passing it the filename
//Create a Scanner object passing it the
//File object.
//write a loop that reads from the file until you
//are at the end of the file
//read a double from the file and add it to sum
//increment the counter
//close the input file
//store the calculated mean
//ADD LINES FOR TASK #5 HERE
//Create a File object passing it the filename
//Create a Scanner object passing it the
//File object.
//reinitialize the sum of the numbers
//reinitialize the number of numbers added
//write a loop that reads until you are at
//the end of the file
//read a double value and subtract the mean
//add the square of the difference to the sum
//increment the counter
//close the input file
//store the calculated standard deviation
//ADD LINES FOR TASK #3 HERE
//create an object of type PrintWriter
//using "Results.txt" as the filename
//print the results to the output file
//close the output file
}
}
• Show less2 answers
- Anonymous askedpublic class... Show moreBlueJ will not return "true" nor "false" when running this code....
import java.util.*;
public class pw
{
public static boolean isPasswordCorrect(char[] input) {
boolean isCorrect = true;
char[] correctPassword = { 'm', 'y', 'p', 'a', 's', 's', 'w' };
if (input.length != correctPassword.length) {
isCorrect = false;
} else {
isCorrect = Arrays.equals (input, correctPassword);
}
//Zero out the password.
Arrays.fill(correctPassword,'0');
return isCorrect;
}
public static void main(String[] args)
{
Scanner myinput = new Scanner(System.in);
String userinput = myinput.next();
//declare the char array
char[] stringArray;
//convert string into array using toCharArray() method of string class
stringArray = userinput.toCharArray();
System.out.print(isPasswordCorrect(stringArray));
}
} • Show less1 answer
- Anonymous askednode... Show moreCreate a simple linked list program to create a class list containing
class node {
void *info;
node *next;
public:
node (void *v) {info = v; next = 0; }
void put_next (node *n) {next = n;}
node *get_next ( ) {return next;}
void *get_info ( ) {return info;}
}; • Show less0 answers | http://www.chegg.com/homework-help/questions-and-answers/computer-science-archive-2011-august-24 | CC-MAIN-2014-52 | refinedweb | 3,306 | 66.84 |
Struts file uploading - Struts
Struts file uploading Hi all,
My application I am uploading files using Struts FormFile.
Below is the code.
NewDocumentForm... when required.
I could not use the Struts API FormFile since
are looking for Struts projects to learn struts in details then visit at these links will help you build your...Struts What is Struts Framework? Hi,Struts 1 tutorial
struts
struts <p>hi here is my code in struts i want to validate my... be
added to your projects ApplicationResources.properties
file or you can...
}//execute
}//class
struts-config.xml
<struts
Struts Projects
Struts Projects
Easy Struts Projects to learn and get into development... learning easy
Using Spring framework in your application
Project in STRUTS Framework using MYSQL database as back end
Struts Projects are supported be fully hi,
I am new in struts concept.so, please explain example login application in struts web based application with source code .
what are needed the jar file and to run in struts application ?
please kindly
Deployment of your example - Struts
Deployment of your example In your Struts2 tutorial, can you show... send me code and explain in detail. code - Struts
://
Thanks...struts code In STRUTS FRAMEWORK
we have a login form with fields
USERNAME:
In this admin
can login and also narmal uses can log
Struts - Struts
Struts Hello
I like to make a registration form in struts inwhich... compelete code.
thanks Hi friend,
Please give details with full source code to solve the problem.
Mention the technology you have used
Struts Code - Struts
://
Thanks...Struts Code How to add token , and encript token and how decript token in struts. Hi friend,
Using the Token methods
The methods we
struts - Struts
as such. Moreover war files are the compressed form of your projects...struts Hi,
i want to develop a struts application,iam using eclipse... you. hi,
to add jar files -
1. right click on your project.
2
struts - Struts
struts Hi,
I need the example programs for shopping cart using struts with my sql.
Please send the examples code as soon as possible.
please...
Hope that it will be helpful for you.
Thanks
Struts - Struts
.
Thanks in advance Hi friend,
Please give full details with source code to solve the problem.
For read more information on Struts visit...Struts Hello
I have 2 java pages and 2 jsp pages
://
Thanks... in struts 1.1
What changes should I make for this?also write struts-config.xml and jsp code.
Code is shown below
Struts - Struts
Struts Dear Sir ,
I am very new in Struts and want... provide the that examples zip.
Thanks and regards
Sanjeev. Hi friend... and specify the type.
5
6
Zip Code needs to between
Struts Code - Struts
Struts Code Hi
I executed "select * from example" query... using struts . I am placing two links Update and Delete beside each record .
Now I...
But it is not appending..
Can any one help me.
Thanks in Advance
struts - Struts
of a struts application Hi friend,
Code to help in solving the problem :
In the below code having two submit button's its values...://
Thanks
Struts first example - Struts
the version of struts is used struts1/struts 2.
Thanks
Hi!
I am using struts 2 for work.
Thanks. Hi friend,
Please visit... friend!
thanks you so much for your supports,
I want to check not only type
can easily learn the struts.
Thanks...struts how to start struts?
Hello Friend,
Please visit the following links:
validation problem in struts - Struts
for your best co-operation .
thanks in advance friends......
Hi... project using struts framework. so i made a user login form for user authentication. nd i write d code for sql connection and user athunetication in d action class
the checkbox.i want code in struts
struts internationalisation - Struts
code to solve the problem :
For more information on struts visit to :
Thanks...struts internationalisation hi friends
i am doing struts
java - Struts
friend,
Check your code having error :
struts-config.xml
In Action...:
Submit
struts... Loged in as
failure.jsp::
Sorry your UserId
First Struts Application - Struts
?
Looking forward to your reply
Thanks & Regards,
Mitika...First Struts Application Hello,
Hello,
I have created a struts simple application by using struts 1.2.9 and Jboss 4.0.4.
I am getting/
Thanks...Struts Dear Sir , I m very new to struts how to make a program in struts and how to call it in action mapping to to froward another location
java - Struts
,
Please check your "web.xml"
For help we give the code :
action...
config
/WEB-INF/struts-config.xml
1
action
*.do
Thanks...
Sorry your UserId/Password is incurrect
Retry click here how the database connection is establised in struts while using ant and eclipse? Hi friend,
Read for more information.
Thanks
multiboxes - Struts
in javascript code or in struts bean. Hi friend,
Code to solve
Struts - Struts
the struts action. Hi friend,
For more information,Tutorials and Examples on Checkbox in struts visit to :
Thanks
Struts - Struts
. Please visit for more information.
Thanks
Struts - Struts
for more information.
Thanks...Struts Hi,
I m getting Error when runing struts application.
i...
/WEB-INF/struts-config.xml
1
Reply - Struts
Reply
Thanks For Nice responce Technologies::--JSP
please write the code and send me....when click "add new button" then get the null value...its urgent... Hi
can u explain in details about your project image uploading
struts image uploading please let me know how to upload image in database using struts ..i have written form class and 'm hanging out in action class ....
form
FileUploadForm:
package com.action.form;
import
Struts 2.0- Deployment - Struts
Struts 2.0- Deployment Exception starting filter struts2... 1.5
Tomcat 6.0 Hi friend,
Check your config of Web.xml.../struts/struts2/
Thanks
I placed correct web.xml only. For first time I
Struts 2 Video Tutorial
?
Is there any source code of the tutorial also?
Thanks
Hi,
Yes your are right. You can learn Struts 2 very easily with the Struts 2 Video... tutorial page.
View the Struts 2 Video Tutorial.
Thanks
Struts - Struts
://
Thanks...Struts Is Action class is thread safe in struts? if yes, how... explaination and example? thanks in advance. Hi Friend,
It is not thread
struts code - Struts
struts code how to call lookup dispatchAction class method using on change of JavaScript
Struts code - Struts
Struts code
Hi Friend,
Is backward redirection possible in struts.If so plz explain..., please reply my posted question its very urgent
Thanks
Doubt in struts - Struts
Doubt in struts I am new to Struts, Can anybody say how to retrieve... with code? Hi friend,
Please visit the link to solve the problem :
Thanks
Struts for Java
Struts for Java What do you understand by Struts for Java? Where Struts for Java is used?
Thanks
Hi,
Struts for Java is programming... information and tutorials then visit our Struts Tutorials section.
Tapestry - Struts
respond me fast
thanks Hi friend,
Code to help in solving the problem :
bring your mouse here
this is a custom loading...;
}
//end of copied code
struts <html:select> - Struts
struts i am new to struts.when i execute the following code i am... in the Struts HTML FORM tag as follows:
Thanks...=db.getDbConnection();
PreparedStatement ps=con.prepareStatement("select Dealer_Code from op
java file upload in struts - Struts
java file upload in struts i need code for upload and download file using struts in flex.plese help me Hi Friend,
Please visit the following links:
can anyone tell me how can i implement session tracking in struts?
please it,s urgent........... session tracking? you mean session management?
we can maintain using class HttpSession.
the code follows
logout - Struts
logout how to make code in struts if i click the logout button... the page
Thanks
Anil Hi anil,
//...
session.removeAttribute...();
//...
-----------------------------------
Visit for more information:
java - Struts
java i want to display a list through struts what code i writen in action, class , struts config.xml and jsp please tell me
thnks for solving my...-tag.shtml
Thanks
the example of Struts 2 tutorial and test on
your computer.
Lets Get Started... Struts 1 migrate your project to Struts 2. You can still find
Struts 1 tutorial... Struts 2 Tutorials - Jakarta Struts Tutorial
Learn Struts 2
Understanding Struts - Struts
better.
I will be expecting your reply soon.
Thanks in advance,
Cheers...Understanding Struts Hello,
Please I need your help on how I can understand Strut completely. I am working on a complex application which
struts flow - Struts
struts flow Struts flow Hi Friend,
Please visit the following links:
Thanks
Getting path name of uploading file in struts 2.1.8
Getting path name of uploading file in struts 2.1.8 In my question I used struts 2.8.1 instead of 2.1.8. Sorry
Struts Validation - Struts
Struts Validation Hi friends.....will any one guide me to use the struts validator...
Hi Friend,
Please visit the following links:
http
STRUTS
STRUTS MAIN DIFFERENCES BETWEEN STRUTS 1 AND STRUTS 2
Struts
Struts How to retrive data from database by using Struts
Hello - Struts
to going with connect database using oracle10g in struts please write the code and send me its very urgent
only connect to the database code
Hi...://
Thanks
Amardeep
Struts
Struts how to learn struts
Struts
Struts what is SwitchAction in struts
STRUTS
STRUTS Request context in struts?
SendRedirect () and forward how to configure in struts-config.xml
struts -
java - Struts
; Hi friend,
You change the same "path" and "action" in code :
In Action Mapping
In login jsp
For read more information on struts visit to :
Thanks
Struts + HTML:Button not workin - Struts
Struts + HTML:Button not workin Hi,
I am new to struts. So pls... is called.
JSP code
--------
Actionclass...:
http
Sending large data to Action Class error. Struts code - Struts
, SrideviMannem) in your D drive.
3. Maintain all your data, documents, projects...Sending large data to Action Class error. Struts code I have a jsp...="***
Dear IT interns,
Subject: Mailer 1 - Preparation of your PC for project work | http://www.roseindia.net/tutorialhelp/comment/7993 | CC-MAIN-2014-41 | refinedweb | 1,675 | 76.93 |
Paramiko is a great Python library for SSH but it can be a hassle to install in Windows. In this situation, I am using Windows 10 64-bit and Python 3.4.3. Paramiko is available on Pip which helps but it is not the smoothest installation.
First, I run in to an issue with the PyCrypto dependency that it tries to install:
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat)
Read this on how to solve that problem: Fix Pip Install Unable to Find vcvarsall.bat
After getting that done and reinstalling with Pip, it appears to install properly. However, when I try to run Python and import paramiko I get an error about winrandom:
ImportError: No module named 'winrandom'
To fix this, you have to go in the source code for the Crypto lib and fix an import statement. In my case, Python was installed to C:\Python34\. The full path of the file I had to change was:
C:\Python34\Lib\site-packages\Crypto\Random\OSRNG\nt.py
In that file, change
import winrandom
to
from . import winrandom
Now you should be able to run python and import paramiko. | https://www.devdungeon.com/content/installing-pycryptoparamiko-python3-x64-windows | CC-MAIN-2021-04 | refinedweb | 197 | 73.07 |
Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10530: Attempting to define own lexical cast on solaris has to use deprected method
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-24 11:57:28
Resolution: | Keywords:
--------------------------------------+--------------------------
Comment (by apolukhin):
Hmmm, your code still works on GCC 4.6.4:
{{{
#include <iostream>
#include <boost/lexical_cast.hpp>
namespace boost {
template <> bool lexical_cast(std::string const &s) { return true; };
}
int main() {
std::cout << boost::lexical_cast<bool>(std::string("Foo"));
return 0;
}
}}}
This makes me think that the problem is related only to the Sun Studio
5.12 compiler. There are no
[
regression testers] that currently run the tests on Sun Studio. Two years
ago was the last time I saw someone running regression tests on Sun Studio
compiler (the compiler was not good because of big problems with partial
specializations).
Unfortunately it is impossible for me to solve your issue while there's no
regression tester. If you're willing to become one of the testers, take a
look at [
this page, section "Running Boost's Automated Regression and Reporting"].
Running those tests on Sun Studio will help the Boost developers to solve
many of the issues that you may have all around the Boost libraries.
Or, if you have a working solution for this issue, then you can make a
pull request with fix to the official
[ lexical cast repo].
Or just attach patch to this ticket.
-- Ticket URL: <> Boost C++ Libraries <> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC | https://lists.boost.org/boost-bugs/2014/09/38051.php | CC-MAIN-2022-27 | refinedweb | 265 | 61.46 |
java swings - Swing AWT
.... write the code for bar charts using java swings. Hi friend,
I am...java swings I am doing a project for my company. I need a to show
java swings - Java Beginners
java swings how to send the data in database using java swing.
Example :
how to design the registration page using java swing, and how... = con.createStatement();
ResultSet rs=st.executeQuery("Select * from login where username
java-swings - Swing AWT
://
Thanks.
Amardeep...java-swings How to move JLabel using Mouse?
Here the problem is i have a set of labels in a panel. I want to arrange them in a customized order
How to put the logo in login form using swings/awt?
that will display logo along with login form in Java Swing.
import javax.swing.... How to put the logo in login form using swings/awt? Hi,
How to put the logo in login form using swings/awt?
I write the login form is working
login sample java awt/swing code to make loginpage invisible after loggedinto next page
Hi Friend,
Try the following code:
1... java.awt.event.*;
class Login
{
JButton SUBMIT;
JLabel label1,label2;
final
java validations
java validations <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...;
<body>
<div id="page-heading"><h1>Retailer</h1><...;
<body>
<div id="page-heading"><h1>Retailer</h1><
Struts validations
Struts validations Can you please provide the login page example
in struts1.x and struts 2.x
Where the login page should interact with the DB... with values that were stored in tables..
If match is successful then login
swings - Swing AWT
:// What is Java Swing Technologies? Hi friend,import javax.swing.*;import java.awt.*;import javax.swing.JFrame;public class
login example
login example 1.Loginpage.jsp
<%@ page language="java...;
2.invalidLogin.jsp
<%@ page language="java"
contentType="text/html; charset...;/html>
3.userlogged.jsp
<%@ page language="java"
contentType
Login page
Login page how to create Login page in java
login page validation
login page validation hi
could you please send me code for login validations Email validation and password email should be in correct format and valid password in java
import java.awt.*;
import javax.swing.
java swings - Java Beginners
java swings When we click on the button , than open a frame, How to create a link on button to frame ,
example :
Suppose I Have to create a login page and on login page there are three button like login
How to create form in Swings
and question form in Java Swing?
Creating different forms in Java Swing - Examples
how to create registration form in swing
swing login form example
swing form example java
LOGIN PAGE
LOGIN PAGE A java program with "login" as title,menus added, and a text field asking for firstname, lastname, and displaying current date and time
java swings - Swing AWT
java swings hi everyone,
can we make a chain of frames with JSplitpane and run a shell script in any one of those frames
login i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
java server side validations - Java Beginners
java server side validations how to write the server side validation for unique username in java?
please help me Hi Friend,
we are providing you a simple swing application to validate for unique username using
Swings - Java Beginners
Swings iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page
validations
validations How to get All Client and server side validations in spring using jsp
Please visit the following link:
Spring Validation Example
swings - Java Beginners
/example/java/swing/
Thanks... for this in google, but i got very difficult programs. i am beginner in java swings . i want a small example to add a image .gif file to combobox list. thank you Hi
Log In Form Validations - Java Beginners
);
SUBMIT=new JButton("Login");
SUBMIT.setBounds(500,110,100,20...();
ResultSet res = st.executeQuery("SELECT * FROM login where username...)) {
JOptionPane.showMessageDialog(null,"Incorrect login or password","Error
Validations
the reason.
Here is an example that validates some fields of html form.
<...;
</html>
Here is an example that validates some fields
Swings - Java Beginners
Swings iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page Hi Friend... JPasswordField(15);
SUBMIT=new JButton("Login");
panel=new JPanel(new
Swings - Java Beginners
is registered,then after login he/she will get the welcome page. If the user is new, he/she...Swings iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page Hi Friend
login page with image
login page with image I am writing program for login page.It consists of a image and the login details... how to write a java program using frames that have the default positions in any of the systems.. thanks
i had
swing question - Java Beginners
swing question how i can create login form in java with password entering i can to next page only if password is correct i want to use java swing feature
Java swing
Java swing how to create the login form?
1... label1,label2;
final JTextField text1,text2;
LoginDemo()
{
setTitle("Login Form...=st.executeQuery("select * from login where username='"+value1+"' and password
java swing question - Java Beginners
java swing question how i can create login form in java with password entering i can to next page only if password is correct i want to use java swing feature
java swings
java swings Hi,
I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under... JButton("Login");
panel.add(label1);
panel.add(text1);
panel.add(label2
login form
); but how to close it totally....using java awt-swing
Hi Friend,
Try...login form sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components
jsf login page - Java Server Faces Questions
jsf login page how to create a login page and connect to database using abatis tool
LinkButton - Swing AWT
want that link into swings(java) code not in html....
i know the html code but i want java(swings) code in that i forgot to write using swings....
if u... that button it has to go another page.
can u give me a simple program......plz
struts2.2.1 Login validation example.
struts2.2.1 Login validation example.
In this example, We will discuss about the Login validation using
struts2.2.1.
Directory structure of example.
1-Login.jsp
<%@
Swing login form example
Swing login form example
In this example we have described swing login form. We have created one text field "textField" and one jPasswordField and we have set..." jPasswordField
set as naulej matches then you will be redirected to the next page
Java logical error - Swing AWT
Java logical error Subject:Buttons not displaying over image
Dear Sir/Madam,
I am making a login page using java 1.6 Swings.
I have want to apply...("Login");
JButton b2=new JButton("Register");
panel.add(label1
login page
login page hi i'm trying to create login page using jsp. i get...
<h1>Login Example!</h1>
USER NAME <input name="uname... the program. Following are my programs...
1.index.jsp
<%@page contentType="text
Struts 2 Validation Example
code in our login application.
For validation the login application java...Struts 2 Validation Example
Validation Login application
In this section we will write the code
login page php mysql example
login page php mysql example How to create a login page for user in PHP Mysql? Please provide me a complete tutorial.
Thanks in Advance
java swing problem - Java Beginners
java swing problem i doesn't know about the panel in swings here i had created one frame then created a panel and i added that to my frame but which... CreatePanel () {
super("Example Class");
setBounds(100,100,200,200
Java swing
Java swing If i am login to open my account the textfield,textarea and button are displayed. if i am entering the time of the textfield... are displayed in the table..I need the source code in java swing
javaa swings - IDE Questions
://
Thanks...javaa swings I'm developing a java desktop database application using NetBeans 6.5 and using mysql as database,When I create the table and link
-to-One Relationship |
JPA-QL Queries
Java Swing Tutorial Section
Java Swing Introduction |
Java 2D
API |
Data Transfer in Java Swing |
Internationalization in Java Swing |
Localization |
What
is java swing - Swing AWT
java swing Iam developing a java web browser.Actually my code works fine ie. i can load a web page without proxy.But in my place i have only proxy... to set to proxy settings through which it should load the web page. How to set Hi,
I need the listbox example.
I have two listboxes first one have data then move the data from first listbox to second listbox...);
frame.setVisible(true);
}
}
Please correct the example and send
java swings - Java Beginners
java swings hi,
I already send the question 4 times.
I have two listboxes.If i select first listbox first value moved to second listbox.
Second...() {
JFrame f= new JFrame();
f.setTitle("Listbox Example");
f.setSize
login authentication - Java Beginners
login authentication i 've designed the jsp page for login. now i need to connect it with the bean and do authentication for the login for the "register" table in mysql. can anybody help me with the code immediately
Login Box - Java Beginners
Login Box Hi, I am new to Java and I am in the process of developing a small application which needs a login page. I am planning to have my database... it with the corresponding password tosee if the login details match.I've
java swings - Java Beginners
java swings Hi,
I need the list box example.
I have given my code .I need the list box inside the code and i have to get the values through list box only.Please help me.This is very urgent...
This is my java code
Validations using Struts 2 Annotations
of the application
Login page is displayed to take the input.
User enters user name... are simple and easy steps to develop Login page in
the using Struts 2 framework... is used to display the login page to the user. In our
application
Swing - Swing AWT
information, visit the following link:
Thanks... canvas;
JButton setUpButton = new JButton("Page Setup");
JButton
login and register - Java Beginners
login and register pls send me the code for login and register immediately Hi friend,
Please specify the technology you want code for login and register.
For example : JSP,Servlet,Struts,JSF etc swing code
Java swing code can any one send me the java swing code for the following:
"A confirmation message after the successful registration of login form
Java Program - Swing AWT
Java Program A program to create a simple game using swings. Hi Friend,
Please visit the following link:
Thanks
Struts 2 Login Form Example
Struts 2 Login Form Example tutorial - Learn how to develop Login form....
Let's start developing the Struts 2 Login Form Example
Step 1... you can create Login form in
Struts 2 and validate the login action
Need Help with Java-SWING progrmming - Swing AWT
://
Thanks...Need Help with Java-SWING progrmming Hi sir,
I am a beginner in java-swing programming. I want to know how we can use the print option
SWINGS - Swing AWT
SWINGS Hi!
How to receive value from showInputDialog in another class.
that means...
when i am moving to another page i am raising
String msg=JOptionPane.showInputDialog("Enter your name");
I want to receive this msg - Java Beginners
java swings Do you want to add textfields on the JPanel
swings - Swing AWT
[]) {
JFrame frame = new JFrame("simple Cut and paste Example");
Container
SWING
SWING A JAVA CODE OF MOVING TRAIN IN SWING
Swings - Java Beginners
=con.createStatement();
ResultSet rs=st.executeQuery("Select id from login where password...)){
Statement st1=con.createStatement();
int i=st1.executeUpdate("update login
Advertisements
If you enjoyed this post then why not add us on Google+? Add us to your Circles | http://www.roseindia.net/tutorialhelp/comment/95870 | CC-MAIN-2015-48 | refinedweb | 2,087 | 56.66 |
Hi there,
I'm having an issue with encapsulating servo functionality in its own class. What I want to do is creating a class that contains a couple of methods that control a servo more or less autonomously, in such a way that just requires me to set the context and then in the loop calling myservo.update() to have the myservo class take care off its own. Very OOP indeed :-)
For some reason I just can't get it to work. Brought down to the bare minimum, I have three source files, main.ino (off course), myservo.h and myservo.cpp:
myservo.h contains this:.
+++ UPDATE (12-march-2014): Rename title as "Biped Howto"..
So im pretty newish to robotics and programming in general, but ive done some reading and have started down my own path.
my robot(including a picture, description, wiring diagram and code) is posted here
Hi,:
Hi all ... have a little problem with a servo i modified for continous rotation
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
The Mini Driver was released by DAGU some time ago. It is essentially our Magician controller in SMD format. Unfortunately the engineer who designed it does not have very good English so I was asked to re-write the manual. You can view/download the manual from here:
Hello...
Hi!
Hi All!
This is my first post so go easy on me. :)
I am trying to build an obstical avoidance robot and decide to salvage a chasis from an old Radio Shack RC truck. The main board is fried. when I got to the se=teering mechanism I discovered 6 wires coming form what I would think is a servo. I was expecting three wires so I'm not sure how to hook it up to my motor shield for an arduino.
I discovered that if I applied a voltage to two of the wires the wheels turn on direction and if I reverse them they go the other way.
Hello!
Hello everyone my PCB's are here, they were actually meant to make my robot more tidy as shown here (turn off the sound)
HiI bought a pan/tilt kit from nodna.de, with 2 micro servos...I hooked them up to my Fez Panda II's PWM and 5V power, then made a simple program to move them from all the way left to right.But when i run it, it moves really fast to one side, then it struggles to move the other way, nearly dont move...?Same problem with both of them... sounds like they dont have the power to turn... ?Could there be somthing im doing wrong? or are they just simply defect? UPDATE:
I have an RC car that i've stripped down to it's bare essentials. It has one motor that provides forward/backward movement and it has a servo that turns the front wheels left/right. I can use the Sabertooth 2x12 fine with the motor. The problem is however the servo. am looking into selling robot parts online, and I am curious what parts you, the potential customers, would like to see.
Does anyone know what diametral pitch or module the gears are in those micro servos?
I want to make a gear that directly mates with the servo final gear but I can't unless I know the module or diametral pitch.
I have the servo gear so with digital calipers I measured the outer diameter of the 31 tooth gear to be 9.96 mm. If I use cad software to create a 0.3 module gear with 31 teeth, this gives me an outer diameter of 9.814 mm. Pretty close but it's not a home run.
After,
Hi guys,
I am taking "control of mobile robots" course on coursera and is pretty intrigued in building a 2 wheel robot car. One of the issues was the control of the 2 wheel velocities here.
So far, I've got a Uno and bought the magician chassis from sparkfun. It provides 2 dc motors. May I know using the dc motors, is it sufficient to be able to know and control the individual wheel velocities?
I've just received 5 x SG92R servos from here : and ordered 5 more. 6 days to the UK from Hong Kong and 14 quid (20 USD) for the five. | http://letsmakerobots.com/taxonomy/term/240 | CC-MAIN-2015-18 | refinedweb | 752 | 73.58 |
ZECHARIA
SITCHIN THE END OF DAYS A R M AG E D D O N A N D PR O PH EC I ES OF THE RETURN
The 7th and Concluding Book of The Earth Chr Chronicles onicles
Dedicated to my brother Dr. Amnon Sitchin, whose aerospace expertise was invaluable at all times
CONTENTS Preface: The Past, The Future
v
1.
The Messianic Clock
1
2.
“And It Came to Pass”
19
3.
Egyptian Prophecies, Human Destinies
33
4.
Of Gods and Demigods
47
5.
Countdown to Doomsday
63
6.
Gone with the Wind
79
7.
Destiny Had Fifty Names
97
8.
In the Name of God
117
9.
The Promised Land
136
10.
The Cross on the Horizon
157
11.
The Day of the Lord
177
12.
Darkness at Noon
198
13.
When the Gods Left Earth
224
14.
The End of Days
250
15.
Jerusalem: A Chalice, Vanished
268
16.
Armageddon and Prophecies of the Return
289
About the Author Praise Other Books by Zecharia Sitchin Cover Copyright About the Publisher deepest hopes and anxieties with religious beliefs and expectations, millennia?
vi
PREFACE Testament’s Book of Daniel and the New Testament’s Book of Revelation; his recently found handwritten calculations concerning the End of Days will be analyzed, along with more recent predictions of The End. Both the Hebrew Bible and the New Testament asserted that the secrets of the Future are embedded in the Past, that the destiny of Earth is connected to the Heavens, that the affairs
1.
2
THE END OF DAYS
The Messianic Clock
3
Figure 1iru’s ruler Anu; their conflict on Earth had its roots on their home planet, Nibiru. Enki—then called E.A (“He whose home is water”)— was Anu’s firstborn son, but not by the official spouse, Antu. When Enlil was born to Anu by Antu—a half-sister of Anu—Enlil became the Legal Heir to Nibiru’s throne though
4
THE END OF DAYS
he was not the firstborn son. The unavoidable resentment on the part of Enki and his maternal family was exacerbated by the fact that Anu’s accession to the throne was problematic to begin with: having lost out in a succession struggle to a rival named Alalu, he later usurped the throne in a coup d’état, forcing Alalu to flee Nibiru for his life. That not only backtracked Ea’s resentments to the days of his forebears, but also brought about other challenges to the leadership of Enlil, as told in the epic Tale of Anzu. (For the tangled relationships of Nibiru’s royal families and the ancestries of Anu and Antu, Enlil and Ea, see The Lost Book of Enki .) The key to unlocking the mystery of the gods’ succession (and marriage) rules was my realization that these rules also applied to the people chosen by them to serve as their proxies to Mankind. It was the biblical tale of the Patriarch Abraham explaining (Genesis 20:12) that he did not lie when he had presented his wife Sarah as his sister: “Indeed,, the son of the handmaiden Hagar. (How such succession rules caused the bitter feud between Ra’s divine descendants in Egypt, the half-brothers Osiris and Seth who married the half-sisters Isis and Nephtys, is explained in The Wars of Gods and Men.) Though those succession rules appear complex, they were based on what those who write about royal dynasties call “bloodlines”—what we now should recognize as sophisticated DNA genealogies that also distinguished between general DNA inherited from the parents as well as the mitochondrial DNA (mtDNA) that is inherited by females only from the mother. The complex yet basic rule was this: Dynastic lines continue through the male line; the Firstborn son is next in succession; a half-sister could be taken as wife if she had a different mother; and if a son by such a half-sister is later born, that son—though not Firstborn—becomes the Legal Heir and the dynastic successor. The rivalry between the two half-brothers Ea/Enki and En-
The Messianic Clock
5
lil in matters of the throne was complicated by personal rivalry in matters of the heart. They both coveted their half-sister Ninmah, whose mother was yet another concubine of Anu. She was Ea’s true love, but he was not permitted to marry her. Enlil then took over, and had a son by her—Ninurta. Though born without wedlock, the succesion rules made Ninurta Enlil’s uncontested heir, being both his Firstborn son and one born by a royal half-sister. Ea, as related in The Earth Chronicles books, was the leader of the first group of fifty Anunnaki to come to Earth to obtain the gold needed to protect Nibiru’s dwindling atmosphere. When the initial plans failed, his half-brother Enlil was sent to Earth with more Anunnaki for an expanded Mission Earth. If that was not enough to create a hostile atmosphere, Ninmah too arrived on Earth to serve as chief medical officer . . . A long text known as the Atrahasis Epic begins the story of gods and men on Earth with a visit by Anu to Earth to settle once and for all (he hoped) the rivalry between his two sons that was ruining the vital mission; he even offered to stay on Earth and let one of the half-brothers assume the regency on Nibiru. With that in mind, the ancient text tells us, lots were drawn to determine who would stay on Earth and who would sit on Nibiru’s throne: The gods clasped hands together, had cast lots and had divided: Anu went up [back] to heaven, [For Enlil] the Earth was made subject; The seas, enclosed as with a loop, to Enki the prince were given. The result of drawing lots, then, was that Anu returned to Nibiru as its king. Ea, given dominion over the seas and waters (in later times, “Poseidon” to the Greeks and “Neptune” to the Romans), was granted the epithet EN.KI (“Lord of Earth”) to soothe his feelings; but it was EN.LIL (“Lord of the Command”) who was put in overall charge: “To him the Earth was made subject.” Resentful or not, Ea/Enki could
6
THE END OF DAYS
not defy the rules of succession or the results of the drawing of lots; and so the resentment, the anger at justice denied, and a consuming determination to avenge injustices to his father and forefathers and thus to himself led Enki’s son Marduk to take up the fight. Several texts describe how the Anunnaki set up their settlements in the E.DIN (the post-Diluvial Sumer), each with a specific function, and all laid out in accordance with a master plan. The crucial space connection—the ability to constantly stay in communication with the home planet and with the shuttlecraft and spacecraft—was maintained from Enlil’s command post in Nippur, the heart of which was a dimly lit chamber called the DUR.AN.KI, “The Bond Heaven-Earth.” Another vital facility was a spaceport, located at Sippar (“Bird City”). Nippur lay at the center of concentric circles at which the other “cities of the gods” were located; all together they shaped out, for an arriving spacecraft, a landing corridor whose focal point was the Near East’s most visible topographic feature—the twin peaks of Mount Ararat (Fig. 2). And then the Deluge “swept over the earth,” obliterated all the cities of the gods with their Mission Control Center and Spaceport, and buried the Edin under millions of tons of mud and silt. Everything had to be done all over again—but much could no longer be the same. First and foremost, it was necessary to create a new spaceport facility, with a new Mission Control Center and new Beacon-sites for a Landing Corridor. The new landing path was anchored again on the prominent twin peaks of Ararat; the other components were all new: the actual spaceport in the Sinai Peninsula, on the 30th parallel north; artificial twin peaks as beacon sites, the Giza pyramids; and a new Mission Control Center at a place called Jerusalem (Fig. 3). It was a layout that played a crucial role in post-Diluvial events. The Deluge was a watershed (both literally and figuratively) in the affairs of both gods and men, and in the relationship between the two: the Earthlings, who were fashioned to serve and work for the gods were henceforth treated as junior partners on a devastated planet.
The Messianic Clock
7
Figure 2 The new relationship between men and gods was formulated, sanctified, and codified when Mankind was granted its first high civilization, in Mesopotamia, circa 3800 b.c.e. The momentous event followed a state visit to Earth by Anu, not just as Nibiru’s ruler but also as the head of the pantheon, on Earth, of the ancient gods. Another (and probably the main) reason for his visit was the establishment and affirmation of peace among the gods themselves—a live-and-let-live arrangement dividing the lands of the Old World among the two principal Anunnaki clans, that of Enlil and that of Enki— for the new post-Diluvial circumstances and the new location of the space facilities required a new territorial division among the gods.
8
THE END OF DAYS
Figure 3 It was a division that was reflected in the biblical Table of Nations (Genesis, chapter 10), in which the spread of Mankind, emanating from the three sons of Noah, was recorded by nationality and geography: Asia to the nations/lands of Shem, Europe to the descendants of Japhet, Africa to the nation/lands of Ham. The historical records show that the parallel division among the gods allotted the first two to the Enlilites, the third one to Enki and his sons. The connecting
The Messianic Clock
9
Sinai peninsula, where the vital post-Diluvial spaceport was located, was set aside as a neutral Sacred Region. While the Bible simply listed the lands and nations according to their Noahite division, the earlier Sumerian texts recorded the fact that the division was a deliberate act, the result of deliberations by the leadership of the Anunnaki. A text known as the Epic of Etana tells us that The great Anunnaki who decree the fates sat exchanging their counsels regarding the Earth. They created the four regions, set up the settlements. In the First Region, the lands between the two rivers Euphrates and Tigris (Mesopotamia), Man’s first known high civilization, that of Sumer, was established. Where the prediluvial cities of the gods had been, Cities of Man arose, each with its sacred precinct where a deity resided in his or her ziggurat—Enlil in Nippur, Ninmah in Shuruppak, Ninurta in Lagash, Nannar/Sin in Ur, Inanna/Ishtar in Uruk, Utu/ Shamash in Sippar, and so on. In each such urban center an EN.SI, a “Righteous Shepherd”—initially a chosen demigod—was selected to govern the people in behalf of the gods; his main assignment was to promulgate codes of justice and morality. In the sacred precinct, a priesthood overseen by a high priest served the god and his spouse, supervised the holiday celebrations, and handled the rites of offerings, sacrifices, and prayers to the gods. Art and sculpture, music and dance, poetry and hymns, and above all writing and recordkeeping flourished in the temples and extended to the royal palace. From time to time one of those cities was selected to serve as the land’s capital; there the ruler was king, LU.GAL (“Great man”). Initially and for a long time thereafter this person, the most powerful man in the land, served as both king and high priest. He was carefully chosen, for his role and authority, and all the physical symbols of Kingship, were deemed to have come to Earth directly from Heaven, from Anu on Nibiru. A Sumerian text dealing with the subject
10
THE END OF DAYS
stated that before the symbols of Kingship (tiara/crown and scepter) and of Righteousness (the shepherd’s staff ) were granted to an earthly king, they “lay deposited before Anu in heaven.” Indeed, the Sumerian word for Kingship was Anuship. This aspect of “Kingship” as the essence of civilization, just behavior and a moral code for Mankind, was explicitly expressed in the statement, in the Sumerian King List, that after the Deluge “Kingship was brought down from Heaven.” It is a profound statement that must be borne in mind as we progress in this book to the messianic expectations—in the words of the New Testament, for the Return of the “Kingship of Heaven” to Earth. Circa 3100 b.c.e. a similar yet not identical civilization was established in the Second Region in Africa, that of the river Nile (Nubia and Egypt). Its history was not as harmonious as that among the Enlilites, for rivalry and contention continued among Enki’s six sons, to whom not cities but whole land domains were allocated. Paramount was an ongoing conflict between Enki’s firstborn Marduk (Ra in Egypt) and Ningishzidda (Thoth in Egypt), a conflict that led to the exile of Thoth and a band of African followers to the New World (where he became known as Quetzalcóatl, the Winged Serpent). Marduk/Ra himself was punished and exiled when, opposing the marriage of his young brother Dumuzi to Enlil’s granddaughter Inanna/Ishtar, he caused his brother’s death. It was as compensation to Inanna/Ishtar that she was granted dominion over the Third Region of civilization, that of the Indus Valley, circa 2900 b.c.e. It was for good reason that the three civilizations—as was the spaceport in the sacred region—were all centered on the 30th parallel north (Fig. 4). con-
The Messianic Clock
11
Figure 4 stantly dominated and determined the affairs of Men and the fate of Mankind. Overshadowing all was the determination of Marduk/Ra to undo the injustice done to his father Ea/ Enki, when under the succession rules of the Anunnaki not Enki but Enlil was declared the Legal Heir of their father Anu, the ruler on their home planet Nibiru. In accord with the sexagesimal (“base sixty�) mathematical system that the gods granted the Sumerians, the twelve great gods of the Sumerian pantheon were given numerical ranks in which Anu held the supreme Rank of Sixty; the Rank of Fifty was granted to Enlil; that of Enki was forty, and so farther down, alternating between male and female deities (Fig. 5).
12
THE END OF DAYS
Under the succession rules, Enlil’s son Ninurta was in line for the rank of fifty on Earth, while Marduk held a nominal rank of ten; and initially, these two successors-in-waiting were not yet part of the twelve “Olympians.” And so the long, bitter, and relentness struggle by Marduk that began with the Enlil–Enki feud focused later on Marduk’s contention with Enlil’s son Ninurta for the succession to the Rank of Fifty, and then extended to Enlil’s granddaughter Inanna/Ishtar, whose marriage to Dumuzi, Enki’s youngest son, was so opposed by Marduk that it ended with Dumuzi’s death. In time Marduk/Ra faced conflicts even
Figure 5
The Messianic Clock
13
with other brothers and half-brothers of his, in addition to the conflict with Thoth that we have already mentioned—principally with Enki’s son Nergal, who married a granddaughter of Enlil named Ereshkigal. In the course of these struggles, the conflicts at times flared up to full-fledged wars between the two divine clans; some of those wars are called “The Pyramid Wars” in my book The Wars of Gods and Men. In one notable instance the fighting led to the burying alive of Marduk inside the Great Pyramid; in another, it led to its capture by Ninurta. Marduk was also exiled more than once—both as punishment and as a self-imposed absence. His persistent efforts to attain the status to which he believed he was entitled included the event recorded in the Bible as the Tower of Babel incident; but in the end, after numerous frustrations, success came only when Earth and Heaven were aligned with the Messianic Clock. Indeed, the first cataclysmic set of events, in the twentyfirst century b.c.e., and the Messianic expectations that accompanied it, is principally the story of Marduk; it also brought to center stage his son Nabu—a deity, the son of a god, but whose mother was an Earthling. Throughout the history of Sumer that spanned almost two thousand years, its royal capital shifted—from the first one, Kish (Ninurta’s first city), to Uruk (the city that Anu granted to Inanna/Ishtar) to Ur (Sin’s seat and center of worship); then to others and then back to the initial ones; and finally, for the third time, back to Ur. But at all times Enlil’s city Nippur, his “cult center,” as scholars are wont to call it, remained the religious center of Sumer and the Sumerian people; it was there that the annual cycle of worshipping the gods was determined. The twelve “Olympians” of the Sumerian pantheon, each with his or her celestial counterpart among the twelve members of the Solar System (Sun, Moon, and ten planets, including Nibiru), were also honored with one month each in the annual cycle of a twelve-month year. The Sumerian term for “month,” EZEN, actually meant holiday, festival; and each such month was devoted to celebrating the worship-festival of
14
THE END OF DAYS
one of the twelve supreme gods. It was the need to determine the exact time when each such month began and ended (and not in order to enable peasants to know when to sow or harvest, as schoolbooks explain) that led to the introduction of Mankind’s first calendar in 3760 b.c.e. It is known as the Calendar of Nippur because it was the task of its priests to determine the calendar’s intricate timetable and to announce, for the whole land, the time of the religious festivals. That calendar is still in use to this day as the Jewish religious calendar, which, in a.d. 2007, numbers the year as 5767. In pre-Diluvial times Nippur served as Mission Control Center, Enlil’s command post where he set up the DUR.AN. KI, the “Bond Heaven-Earth” for the communications with the home planet Nibiru and with the spacecraft connecting them. (After the Deluge, these functions were relocated to a place later known as Jerusalem.) Its central position, equidistant from the other functional centers in the E.DIN (see Fig. 2), was also deemed to be equidistant from the “four corners of the Earth” and gave it the nickname “Navel of the Earth.” A hymn to Enlil referred to Nippur and its functions thus: Enlil, When you marked off divine settlements on Earth, Nippur you set up as your very own city . . . You founded the Dur-An-Ki In the center of the four corners of the Earth. (The term “the Four Corners of the Earth” is also found in the Bible; and when Jerusalem replaced Nippur as Mission Control Center after the Deluge, it too was nicknamed the Navel of the Earth.) In Sumerian the term for the four regions of the Earth was UB, but it also is found as AN.UB—the heavenly, the celestial four “corners”—in this case an astronomical term connected with the calendar. It is taken to refer to the four points in the Earth-Sun annual cycle that we nowadays call the Summer Solstice, the Winter Solstice, and the two crossings of the equator—once as the Spring Equinox and then as the Autumnal Equinox. In the Calendar of Nippur, the year
The Messianic Clock
15
began on the day of the Spring Equinox and it has so remained in the ensuing calendars of the ancient Near East. That determined the time of the most important festival of the year—the New Year festival, an event that lasted ten days, during which detailed and canonized rituals had to be followed. Determining calendrical time by Heliacal Rising entailed the observation of the skies at dawn, when the sun just begins to rise on the eastern horizon but the skies are still dark enough to show the stars in the background. The day of the equinox having been determined by the fact that on it daylight and nighttime were precisely equal, the position of the sun at heliacal rising was then marked by the erection of a stone pillar to guide future observations—a procedure that was followed, for example, later on at Stonehenge in Britain; and, as at Stonehenge, long-term observations revealed that the group of stars (“constellation”) in the background has not remained the same (Fig. 6); there, the alignment stone called the “Heel Stone” that points to sunrise on solstice day
Figure 6
16
THE END OF DAYS
nowadays, pointed originally to sunrise circa 2000 b.c.e. The phenomenon, called Precession of the Equinoxes or just Precession, results from the fact that as the Earth completes one annual orbit around the Sun, it does not return to the same exact celestial spot. There is a slight, very slight retardation; it amounts to one degree (out of 360 in the circle) in 72 years. It was Enki who first grouped the stars observable from Earth into “constellations,” and divided the heavens in which the Earth circled the sun into twelve parts—what has since been called the Zodiacal Circle of constellations (Fig. 7). Since each twelfth part of the circle occupied 30 degrees of the celestial arc, the retardation or Precessional shift from one Zodiacal House to another lasted (mathematically) 2,l60 years (72 × 30), and a complete zodiacal cycle lasted 25,920 years (2,l60 × l2). The approximate dates of the Zodiacal Ages—following the equal twelve-part division and not actual astronomical observations—have been added here for the reader’s guidance.
Figure 7
The Messianic Clock
17
That this was the achievement from a time preceding Mankind’s civilizations is attested to by the fact that a zodiacal calendar was applied to Enki’s first stays on Earth (when the first two zodiacal houses were named in his honor); that this was not the achievement of a Greek astronomer (Hipparchus) in the third century b.c.e. (as most textbooks still suggest), is attested by the fact that the twelve zodiacal houses were known to the Sumerians millennia earlier by names (Fig. 8) and depictions (Fig. 9) that we use to this day.
Figure 8 In When Time Began the calendrical timetables of gods and men were discussed at length. Having come from Nibiru, whose orbital period, the SAR, meant 3,600 (Earth-) years, that unit was naturally the first calendrical yardstick of the Anunnaki even on the fast-orbiting Earth. Indeed, the texts dealing with their early days on Earth, such as the Sumerian King Lists, designated the periods of this or that leader’s time on Earth in terms of Sars. I termed this Divine Time. The calendar granted to Mankind, one based on the orbital aspects of the Earth (and its Moon), was named Earthly Time. Pointing out that the 2,l60-year zodiacal shift (less than a year for the Anunnaki) offered them a better ratio—the
18
THE END OF DAYS
Figure 9 “golden ratio” of 10:6—between the two extremes; I called this Celestial Time. As Marduk discovered, that Celestial Time was the “clock” by which his destiny was to be determined. But which was Mankind’s Messianic Clock, determining its fate and destiny—Earthly Time, such as the count of fiftyyear Jubilees, a count in centuries, or the Millennium? Was it Divine Time, geared to Nibiru’s orbit? Or was it—is it— Celestial Time that follows the slow rotation of the zodiacal clock? The quandary, as we shall see, baffled mankind in antiquity; it still lies at the core of the current Return issue. The question that is posed has been asked before—by Babylonian and Assyrian stargazing priests, by biblical Prophets, in the Book of Daniel, in the Revelation of St. John the Divine, by the likes of Sir Isaac Newton, by all of us today. The answer will be astounding. Let us embark on the painstaking quest.
2 “AND IT CAME TO PASS”
It is highly significant that in its record of Sumer and the early Sumerian civilization, the Bible chose to highlight the space connection incident—the one known as the tale of the “Tower of Babel”: And it came to pass as they journeyed from the east that they found a plain in the land of Shin’ar and they settled there. And they said to one another: “Come, let us make bricks and burn them by fire.” And the brick served them as stone, and the bitumen served them as mortar. And they said: “Come, let us build us a city and a tower whose head shall reach the heavens.” Genesis 11: 2–4 This is how the Bible recorded the most audacious attempt— by Marduk!—to assert his supremacy by establishing his own city in the heart of Enlilite domains and, moreover, to build there his own space facility with its own launch tower. The place is named in the Bible Babel, “Babylon” in English. This biblical tale is remarkable in many ways. It records, first of all, the settlement of the Tigris-Euphrates plain after the Deluge, after the soil had dried up enough to permit resettlement. It correctly names the new land Shin’ar, the Hebrew name for Sumer. It provides the important clue from where—from the mountainous region to the east—the settlers had come. It recognizes that it was there that Man’s first
20
THE END OF DAYS
urban civilization began—the building of cities. It correctly notes (and explains) that in that land, where the soil consisted of layers of dried mud and there is no native rock, the people used mud bricks for building and by hardening the bricks in kilns could use them instead of stone. It also refers to the use of bitumen as mortar in construction—an astounding bit of information, since bitumen, a natural petroleum product, seeped up from the ground in southern Mesopotamia but was totally absent in the Land of Israel. The authors of this chapter in Genesis were thus well informed regarding the origins and key innovations of the Sumerian civilization; they also recognized the significance of the “Tower of Babel” incident. As in the tales of the creation of Adam and of the Deluge, they melded the various Sumerian deities into the plural Elohim or into an all-encompassing and supreme Yahweh, but they left in the tale the fact that it took a group of deities to say, “let us come down” and put an end to this rogue effort (Genesis 11:7). Sumerian and later Babylonian records attest to the veracity of the biblical tale and contain many more details, linking the incident to the overall strained relationships between the gods that caused the outbreak of two “Pyramid Wars” after the Deluge. The “Peace on Earth” arrangements, circa 8650 b.c.e., left the erstwhile Edin in Enlilite hands. That conformed to the decisions of Anu, Enlil, and even Enki—but was never acquiesced to by Marduk/Ra. And so it was that when Cities of Men began to be allocated in the former Edin to the gods, Marduk raised the issue, “What about me?” Although Sumer was the heartland of the Enlilite territories and its cities were Enlilite “cult centers,” there was one exception: in the south of Sumer, at the edge of the marshlands, there was Eridu; it was rebuilt after the Deluge at the exact same site where Ea/Enki’s first settlement on Earth had been. It was Anu’s insistence, when the Earth was divided among the rival Anunnaki clans, that Enki forever retain Eridu as his own. Circa 3460 b.c.e. Marduk decided that he could extend his father’s privilege to also having his own foothold in the Enlilite heartland. The available texts do not provide the reason why Marduk
“And It Came to Pass”
21
chose that specific site on the banks of the Euphrates river for his new headquarters, but its location provides a clue: it was situated between the rebuilt Nippur (the pre-Diluvial Mission Control Center) and the rebuilt Sippar (the pre-Diluvial spaceport of the Anunnaki), so what Marduk had in mind could have been a facility that served both functions. A later map of Babylon, drawn on a clay tablet (Fig. 10) represents it as a “Navel of the Earth”—akin to Nippur’s original function-title. The name Marduk gave the place, Bab-Ili in Akkadian, meant “Gateway of the gods”—a place from which the gods could ascend and descend, where the appropriate main facility was to be a “tower whose head shall reach the heavens”—a launch tower! As in the biblical tale, so it is told in parallel (and earlier) Mesopotamian versions that this attempt to establish a rogue
Figure 10
22
THE END OF DAYS
space facility came to naught. Though fragmented, the Mesopotamian texts (first translated by George Smith in l876) make it clear that Marduk’s act infuriated Enlil, who “in his anger a command poured out” for a nighttime attack to destroy the tower. Egyptian records report that a chaotic period that lasted 350 years preceded the start of Pharaonic kingship in Egypt, circa 3l10 b.c.e. It is this time frame that leads us to date the Tower of Babel incident to circa 3460 b.c.e., for the end of that chaotic period marked the return of Marduk/Ra to Egypt, the expulsion of Thoth, and the start of the worship of Ra. Frustrated this time, Marduk never gave up his attempts to dominate the official space facilities that served as the “Bond Heaven-Earth,” the link between Nibiru and Earth—or to set up his own facility. Since, in the end, Marduk did attain his aims in Babylon, the interesting question is: Why did he fail in 3460 b.c.e.? The equally interesting answer is: It was a matter of timing. A well-known text recorded a conversation between Marduk and his father, Enki, in which a disheartened Marduk asked his father what he had failed to learn. What he failed to do was to take into account the fact that the time then—the Celestial Time—was the Age of the Bull, the Age of Enlil. Among the thousands of inscribed tablets unearthed in the ancient Near East, quite a number provided information regarding the month associated with a particular deity. In a complex calendar begun in Nippur in 3760 b.c.e., the first month, Nissanu, was the EZEN (festival time) for Anu and Enlil (in a leap year with a thirteenth lunar month, the honor was split between the two). The list of “honorees” changed as time went by, as did the composition of the membership of the supreme Pantheon of Twelve. The month associations also changed locally, not only in various lands but sometimes to recognize the city god. We know, for example, that the planet we call Venus was initially associated with Ninmah and later on with Inanna/Ishtar. Though such changes make difficult the identifications of who was linked celestially to what, some zodiacal associa-
“And It Came to Pass”
23
tions can be clearly inferred from texts or drawings. Enki (called at first E.A, “He whose home is water”) was clearly associated with the Water Bearer “Aquarius” (Fig. 11), and initially if not permanently also with the Fishes, “Pisces.” The constellation that was named The Twins, “Gemini,” without doubt was so named in honor of the only known divine twins born on Earth—Nannar/Sin’s children Utu/ Shamash and Inanna/Ishtar. The feminine constellation of “Virgo” (the “Maiden” rather than the inaccurate “Virgin”) that, like the planet Venus, was probably named at first in honor of Ninmah, was renamed AB.SIN, “Whose father is Sin,” which could be correct only for Inanna/Ishtar. The Archer or Defender, “Sagittarius,” matched the numerous texts and hymns extolling Ninurta as the Divine Archer, his father’s warrior and defender. Sippar, the city of Utu/Shamash, no longer the site of a spaceport after the Deluge, was considered in Sumerian times to be the center of Law and Justice, and the god was deemed (even by the later Babylonians) as the Chief Justice of the land; it is certain that the Scales of Justice, “Libra,” represented his constellation. And then there were the nicknames comparing the prowess, strength, or characteristics of a god with an animal held in awe; Enlil’s, as text after text reiterated, was the Bull. It
Figure 11
24
THE END OF DAYS
was depicted on cylinder seals, on tablets dealing with astronomy, and in art. Some of the most beautiful art objects discovered in the Royal Tombs of Ur were bull heads sculpted in bronze, silver, and gold, adorned with semiprecious stones. Without doubt, the constellation of the Bull—Taurus— honored and symbolized Enlil. Its name, GUD.ANNA, meant “The Bull of Heaven,” and texts dealing with an actual “Bull of Heaven” linked Enlil and his constellation to one of the most unique places on Earth. It was a place that was called The Landing Place—and it is there that one of the most amazing structures on Earth, including a stone tower that reaches to the heavens, still stands.. And what happened then in the sacred forest had a bearing on the course of the affairs of gods and men. The journey to the Cedar Forest and its Landing Place, we learn from the epic tale, began in Uruk, the city that Anu granted as a present to his great-granddaughter Inanna (a name that meant “Beloved of Anu”). Its king, early in the third millennium b.c.e., was Gilgamesh (Fig. 12). He was no ordinary man, for his mother was the goddess Ninsun, a member of Enlil’s family. That made Gilgamesh not a mere demi-god, but one who was “two-thirds divine.” As he got older and began to contemplate matters of life and death, it
“And It Came to Pass”
25
Figure 12 occurred to him that being two-thirds divine ought to make a difference; why should he “peer over the wall” like an ordinary mortal? he asked his mother. She agreed with him, but explained to him that the apparent immortality of the gods was in reality longevity due to the long orbital period of their planet. To attain such longevity he had to join the gods on Nibiru; and to do that, he had to go to the place where the rocket ships ascend and descend. Though warned of the journey’s hazards, Gilgamesh was determined to go. If I fail, he said, at least I will be remembered as one who had tried. At his mother’s insistence an artificial double, Enkidu (ENKI.DU meant “By Enki Made”), was to be his companion and guardian. Their adventures, told and retold in the Epic’s twelve tablets and its many ancient renderings, can be followed in our book The Stairway to Heaven. There were, in fact, not one but two journeys (Fig. 13): one was to the Landing Place in the Cedar Forest, the other to the spaceport in the Sinai peninsula where—according to Egyptian depictions (Fig. 14)—rocket ships were emplaced in underground silos.
26
THE END OF DAYS
Figure 13 In the first journey circa 2860 b.c.e.—to the Cedar Forest in Lebanon—the duo were assisted by the god Shamash, the godfather of Gilgamesh, and the going was relatively quick and easy. After they reached the forest they witnessed during the night the launching of a rocket ship. This is how Gilgamesh described it: The vision that I saw was wholly awesome! The heavens shrieked, the earth boomed.
“And It Came to Pass”
27
Figure 14 Though daylight was dawning, darkness came. Lightning flashed, a flame shot up. The clouds swelled, it rained death! Then the glow vanished, the fire went out, And all that had fallen was turned to ashes. Awed but undeterred, the next day Gilgamesh and Enkidu discovered the secret entrance that had been used by the Anunnaki, but as soon as they entered it, they were attacked by a robotlike guardian who was armed with death beams and a revolving fire. They managed to destroy the monster, and relaxed by a brook thinking that their way in was clear. But when they ventured deeper into the Cedar Forest, a new challenger appeared: the Bull of Heaven. Unfortunately, the sixth tablet of the epic is too damaged for the lines describing the creature and the battle with it to be completely legible. The legible portions do make it clear that the two comrades ran for their lives, pursued by the Bull of Heaven all the way back to Uruk; it was there that Enkidu managed to slay it. The text becomes legible where the boastful Gilgamesh, who cut off the bull’s thigh, “called
28
THE END OF DAYS
Figure 15 the craftsmen, the armorers, the artisans” of Uruk to admire the bull’s horns. The text suggets that they were artificially made—“each is cast from thirty minas of lapis, the coating on each is two fingers thick.” Until another tablet with the illegible lines is discovered, we shall not know for sure whether Enlil’s celestial symbol in the cedar forest was a specially selected living bull decorated and embellished with gold and precious stones or a robotic creature, an artificial monster. What we do know for certain is that upon its slaying, “Ishtar, in her abode, set up a wail” all the way to Anu in the heavens. The matter was so serious that Anu, Enlil, Enki, and Shamash formed a divine council to judge the comrades (only Enkidu ended up being punished) and to consider the slaying’s consequences. The ambitious Inanna/Ishtar had indeed reason to raise a wail: the invincibility of Enlil’s Age had been pierced, and the Age itself was symbolically shortened by the cutting off of the bull’s thigh. We know from Egyptian sources, including pictorial depictions in astronomical papyri (Fig. 15), that the slaying’s symbolism was not lost on Marduk: it was taken to mean that in the heavens, too, the Age of Enlil had been cut short. Marduk’s attempt to establish an alternative space facility was not taken lightly by the Enlilites; the evidence suggests that Enlil and Ninurta were preoccupied with establishing their own alternative space facility on the other side of the Earth, in the Americas, near the post-Diluvial sources of gold.
“And It Came to Pass”
29
This absence, together with the Bull of Heaven incident, ushered in a period of instability and confusion in their Mesopotamian heartland, subjecting it to incursions from neighboring lands. People called Gutians, then the Elamites came from the East; Semitic-speaking peoples came from the West. But while the Easterners worshipped the same Enlilite gods as the Sumerians, the Amurru (“Westerners”) were different. Along the shores of the “Upper Sea” (the Mediterranean), in the lands of the Canaanites, the people were beholden to the Enki’ite gods of Egypt. Therein lay the seeds—perhaps to this day—of Holy Wars undertaken “In the Name of God,” except that different peoples had different national gods . . . It was Inanna who came up with a brilliant idea; it can be described as “if you can’t fight them, invite them in.” One day, as she was roaming the skies in her Sky Chamber—it happened circa 2360 b.c.e.—she landed in a garden next to a sleeping man who had caught her fancy. She liked the sex, she liked the man. He was a Westerner, speaking a Semitic language. As he wrote later in his memoirs, he knew not who his father was, but knew that his mother was an Entu, a god’s priestess, who put him in a reed basket that was carried by Akkad and his Semitic language Akkadian. His kingdom, which added northern and northwestern provinces to ancient Sumer, was called Sumer & Akkad. Sargon lost little time in carrying out the mission for which he was selected—to bring the “rebel lands” under control.
30
THE END OF DAYS. The boast implies that the sacred space-related site, the Landing Place deep in the “country of the west,” was captured and held in behalf of Inanna/Ishtar—but not without opposition. Even texts written in glorification of Sargon state that “in his old age all the provinces revolted against him.”. Sargon’s territorial reach, it needs to be noted, included only one of the four post-Diluvial space-related sites—only the Landing Place in the Cedar Forest (see Fig. 3). destruc-
“And It Came to Pass”
31
tion of her enemies, actively assisting him on the battlefields. Depictions of her, which used to show her as an enticing goddess of love, now showed her as a goddess of war, bristling with weapons (Fig. 16).. Boastful, Naram-Sin gave himself the title “King of the four regions” . . . We can hear the protests of Enki. We can read texts that record Marduk’s warnings. It was all more than even the Enlilite leadership could condone.
Figure 16
32
THE END OF DAYS
wiped off the face of the Earth. Naram-Sin’s end came circa 2260 b.c.e.; texts from that time report that troops from the territory in the east, called Gutium, loyal to Ninurta, were the instrument of divine wrath; Aggade was never rebuilt, never resettled; that royal city, indeed, has never been found. The saga of Gilgamesh at the start of the third millennium b.c.e., and the military forays of the Akkadian kings near the end of that millennium, provide a clear background for that millennium’s events: the targets were the space-related sites—by Gilgamesh to attain the gods’ longevity, by the kings beholden to Ishtar to attain supremacy. Without doubt, it was Marduk’s “Tower of Babel” attempt that placed the control of the space-related sites at the center of the affairs of gods and men; and as we shall see, that centrality dominated much (if not most) of what took later place. The Akkadian phase of the War and Peace on Earth was not without celestial or “messianic” aspects.. Marduk, in his pronouncements, warned of coming upheavals and cosmic phenomena: The day shall be turned into darkness, the flow of river waters shall be disarrayed, the lands shall be laid to waste, the people will be made to perish. Looking back, recalling similar biblical prophecies, it is clear that on the eve of the twenty-first century b.c.e., gods and men expected a coming Apocalyptic Time.
3 EGYPTIAN PROPHECIES, HUMAN DESTINIES In the annals of Man on Earth, the twenty-first century b.c.e. saw in the ancient Near East one of civilization’s most glorious chapters, known as the Ur III period. It was at the same time the most difficult and crushing one, for it witnessed the end of Sumer in a deathly nuclear cloud. And after that, nothing was the same. Those momentous events, as we shall see, were also the root of the messianic manifestations that centered on Jerusalem when b.c.e. turned to a.d. some twenty-one centuries later. The historic events of that memorable century—as all events in history—had their roots in what had taken place before. Of that, the year 2160 b.c.e. is a date worth remembering. The annals of Sumer & Akkad from that time record a major policy shift by the Enlilite gods. In Egypt, the date marked the beginning of changes of political-religious significance, and what occurred in both zones coincided with a new phase in Marduk’s campaign to attain supremacy. Indeed, it was Marduk’s chesslike strategy maneuvers and geographic movements from one place to another that controlled the agenda of the era’s “divine chess game.” His moves and movements began with a departure from Egypt, to become (in Egyptian eyes) Amon (also written Amun or Amen), “The Unseen.” The date of 2160 b.c.e.
34
THE END OF DAYS
Egyptians worshipped the Ptah pantheon, erecting monumental b.c.e.,. At its start the text describes the breakdown of law and order and of a functioning society—a situation in which “the doorkeepers go and plunder, the wash-man refuses to carry his load . . . robbery is everywhere . . . a man regards his son as an enemy.” Though the Nile is in flooding and irrigates the land, “no one ploughs . . . grain has perished . . . the storehouses are bare . . . dust is throughout the land . . . the desert spreads . . . women are dried up, no one can conceive . . . the dead are just thrown into the river . . . the river is blood.” The roads are unsafe, trade has ceased, the provinces of Upper Egypt are no longer taxed; “there is civil war . . . barbarians from elsewhere have come to Egypt . . . all is in ruin.” Some Egyptologists believe that at the core of those events lay a simple rivalry for wealth and power, an attempt (successful in the end) by Theban princes from the south to control and rule the whole country. Lately, studies have associated
Egyptian Prophecies, Human Destinies
35
the collapse of the Old Kingdom with a “climate change” that undermined a society founded on agriculture, caused food shortages and food riots, social upheaval, and collapse of authority. But little attention has been paid to a major and perhaps the most important change: in the texts, in the hymns, in the honorific names of temples, it was no longer Ra but from then on Ra-Amon, or simply Amon, who was henceforth worshipped; Ra became Amon—Ra the Unseen—for he was gone from Egypt. It was indeed a religious change that caused the political and societal breakdown, the unidentified Ipu-Wer wrote; we believe that the change was Ra’s becoming Amon. The upheaval began with a collapse of religious observances and manifested itself in the defiling and abandonment of temples, where “the Place of Secrets has been laid bare, the writings of the august enclosure have been scattered, common men tear them up in the streets . . . magic is exposed, it is in the sight of him who knows it not.” The sacred symbol of the gods worn on the king’s crown, the Uraeus (the Divine Serpent), “is rebelled against . . . religious dates are disturbed . . . priests are carried off wrongfully.” After calling on the people to repent, “to offer incense in the temples . . . to keep the offerings to the gods,” the papyrus called on the repenters to be baptized—to “remember to immerse.” Then the words of the papyrus turn prophetic: in a passage that even Egyptologists call “truly messianic,” the Admonitions speak of “a time that shall come” when an unnamed Savior—a “god-king”—shall appear. Starting with a small following, of him “men shall say: He brings coolness upon the heart, He is a shepherd of all men. Though his herds may be small, He will spend the days caring for them . . . Then he would smite down evil, He would stretch forth his arm against it.” “People will be asking: ‘Where is he today? Is he then sleeping? Why is his power not seen?’ ” Ipu-Wer wrote, and
36
THE END OF DAYS
answered, “Behold, the glory thereof cannot be seen, [but] Authority, Perception and Justice are with him.” Those ideal times, Ipu-Wer stated in his prophecy, will be preceded by their own messianic birth pangs: “Confusion will set throughout the land, in tumultuous noise one will kill the other, the many will kill the few.” People will ask: “Does the Shepherd desire death?” No, he answered, “it is the land that commands death,” but after years of strife, righteousness and proper worship will prevail. This, the papyrus concluded, was “What Ipu-Wer said when he responded to the majesty of the All-Lord.” If not just the description of events and the messianic prophecies, but also the choice of wording in that ancient Egyptian papyrus seem astounding, there is more to come. Scholars are aware of the existence of another prophetic/ messianic text that reached us from ancient Egypt, but believe that it was really composed after the events and only pretends to be prophetic by dating itself to an earlier time. To be specific, while the text purports to relate prophecies made at the time of Sneferu, a Fourth Dynasty pharaoh (circa 2600 b.c.e.), Egyptologists believe that it was actually written in the time of Amenemhet I of the Twelfth Dynasty (circa 2000 b.c.e.)—after the events that it pretends to prophecy. Even so, the “prophecies” serve to confirm those prior occurrences; and many details and the very wording of the predictions can best be described as chilling. The prophecies are purported to be told to King Sneferu by a “great seer-priest” named Nefer-Rohu, “a man of rank, a scribe competent with his fingers.” Summoned to the king to foretell the future, Nefer-Rohu “stretched forth his hand for the box of writing equipment, he drew forth a scroll of papyrus,” and then began to write what he was envisioning, in a Nostradamus-like manner: Behold, there is something about which men speak; It is terrifying . . . What will be done was never done before. The Earth is completely perished. The land is damaged, no remainder exists.
Egyptian Prophecies, Human Destinies
37
There is no sunshine that people could see, No one can live with the covering clouds, The south wind opposes the north wind. The rivers of Egypt are empty . . . Ra must begin the foundations of the Earth again. Before Ra can restore the “Foundations of the Earth,” there will be invasions, wars, bloodshed. Then a new era of peace, tranquility, and justice will follow. It will be brought by what we have come to call a Savior, a Messiah: Then it is that a sovereign will come— Ameni (“The Unknown”), The Triumphant he will be called. The Son-Man will be his name forever and ever . . . Wrongdoing will be driven out; Justice in its place will come; The people of his time rejoice. It is astounding to find such messianic prophecies of apocalyptic times and the end of Wrongdoing that will be followed by the coming—the return—of peace and justice, in papyrus texts written some 4,200 years ago; it is chilling to find in them terminology that is familiar from the New Testament, about an Unknown, the Triumphant Savior, the “Son-Man.” It is, as we shall see, a link in millennia-spanning interconnected events. In Sumer, a period of chaos, occupation by foreign troops, defiling of temples, and confusion as to where the capital should be and who should be king followed the end of the Sargonic Era of Ishtar in 2260 b.c.e. For a while, the only safe haven in the land was Ninurta’s “cult center” Lagash, from which the Gutian foreign troops were kept out. Mindful of Marduk’s unrelenting ambitions, Ninurta decided to reassert his right to the Rank of Fifty by instructing the then-king of Lagash, Gudea, to erect for him in the city’s Girsu (the sacred precinct) a new and different
38
THE END OF DAYS
temple. Ninurta—here called NIN.GIRSU, “Lord of the Girsu”—already had a temple there, as well as a special enclosure for his “Divine Black Bird” or flying machine. Yet the building of the new temple required special permission from Enlil, which was in time granted. We learn from the inscriptions that the new temple had to have special features linking it to the heavens, enabling certain celestial observations. To that end Ninurta invited to Sumer the god Ningishzidda (“Thoth” in Egypt), the Divine Architect, and Keeper of the Secrets of the Giza pyramids. The fact that Ningishzidda/ Thoth was the brother whom Marduk forced into exile circa 3100 b.c.e. was certainly not lost on all concerned . . . The amazing circumstances surrounding the announcement, planning, construction, and dedication of the E.NINNU (“House/Temple of Fifty”) are told in great detail in Gudea’s inscriptions; they were unearthed in the ruins of Lagash (a site now called Tello) and are quoted at length in The Earth Chronicles books. What emerges from that detailed record (inscribed on two clay cylinders in clear Sumerian cuneiform script, Fig. 17) is the fact that from announcement to dedication, every step and every detail of the new temple was dictated by celestial aspects. Those special celestial aspects had to do with the very timing of the temple’s building: It was the time, as the inscriptions’ opening lines declare, when “in the heavens destinies on Earth were determined”: At the time when in heaven destinies on Earth were determined, “Lagash shall lift its head heavenwards in accordance with the Great Tablet of Destinies” Enlil in favor of Ninurta decided. That special time when the destinies on Earth are determined in the heavens was what we have called Celestial Time, the Zodiacal Clock. That such determining was linked to Equinox Day becomes evident from the rest of Gudea’s tale, as well as from Thoth’s Egyptian name Tehuti, The Balancer (of day and night) who “Draws the Cord” for orienting
Egyptian Prophecies, Human Destinies
39
Figure 17 a new temple. Such celestial considerations continued to dominate the Eninnu project from start to finish. Gudea’s tale begins with a vision-dream that reads like an episode from The Twilight Zone TV series, for while the several gods featured in it were gone when he awoke, the various objects they showed him in the dream remained physically lying by his side! In that vision-dream (the first of several) the god Ninurta appeared at sunrise, and the sun was aligned with the planet Jupiter. The god spoke and informed Gudea that he was
40
THE END OF DAYS
chosen to build a new temple. Next the goddess Nisaba appeared; she was wearing the image of a temple structure on her head; the goddess was holding a tablet on which the starry heavens were depicted, and with a stylus she kept pointing to the “favorable celestial constellation.” A third god, Ningishzidda (i.e. Thoth) held a tablet of lapis lazuli on which a structural plan was drawn; he also held a clay brick, a mold for brickmaking, and a builder’s carrying basket. When Gudea awoke, the three gods were gone, but the architectural tablet was on his lap (Fig. 18) and the brick and its mold were at his feet! Gudea needed the help of an oracle goddess and two more vision-dreams to understand the meaning of it all. In the third vision-dream he was shown a holographic-like animated demonstration of the temple’s building, starting with the initial alignment with the indicated celestial point, the laying of foundations, the molding of bricks—the construction all the way up, step by step. Both the start of construction and the final dedication ceremony were to be held on signals from the gods on specific days; both fell on New Year’s Day, which meant the day of the Spring Equinox.
Figure 18
Egyptian Prophecies, Human Destinies
41
The temple “raised its head” in the customary seven stages, but—unusually for the flat-topped Sumerian ziggurats—its head had to be pointed, “shaped like a horn”—Gudea had to emplace upon the temple’s top a capstone! Its shape is not described, but in all probability (and judging by the image on Nisaba’s head), it was in the shape of a pyramidion—in the manner of capstones on Egyptian pyramids (Fig. 19). Moreover, rather than leave the brickwork exposed, as was customary, Gudea was required to encase the structure with a casing of reddish stones, increasing its similarity to an Egyptian pyramid. “The outside view of the temple was like that of a mountain set in place.” That raising a structure with the appearance of an Egyptian pyramid had a purpose becomes clear from Ninurta’s own words. The new temple, he told Gudea, will be seen from afar; its awe-inspiring glance will reach the heavens; the adoration of my temple shall extend to all the lands, its heavenly name will be proclaimed in countries from the ends of the Earth— In Magan and Meluhha it will cause people [to say]: Ningirsu [the “Lord of the Girsu”], the Great Hero from the Lands of Enlil, is a god who has no equal; He is the lord of all the Earth. Magan and Meluhha were the Sumerian names for Egypt and Nubia, the Two Lands of the gods of Egypt. The purpose
Figure 19
42
THE END OF DAYS
Figure 20 of the Eninnu was to establish, even there, in Marduk’s lands, Ninurta’s unequaled Lordship: “A god who has no equal, the Lord of all the Earth.” Proclaiming Ninurta’s (rather than Marduk’s) supremacy required special features in the Eninnu. The ziggurat’s entrance had to face the Sun precisely in the east, rather than the customary northeast. In the temple’s topmost level Gudea had to erect a SHU.GA.LAM—“where the shining is announced, the place of the aperture, the place of determining,” from which Ninurta/Ningirsu could see “the Repetition over the lands.” It was a circular chamber with twelve positions, each marked with a zodiacal symbol, with an aperture for observing the skies—an ancient planetarium aligned to the zodiacal constellations!
Egyptian Prophecies, Human Destinies
43
Figure 21 In the temple’s forecourt, linked to an avenue that faced sunrise, Gudea had to erect two stone circles, one with six and the other with seven stone pillars, for observing the skies. Since only one avenue is mentioned, one assumes that the circles were one within the other. As one studies each phrase, terminology, and structural detail, it becomes evident that what was built in Lagash with the help of Ningishzidda/Thoth was a complex yet practical stone observatory, one part of which, devoted entirely to the zodiacs, reminds one of the similar one found in Denderah, Egypt (Fig. 20), and the other, geared to observing celestial risings and setting, a virtual Stonehenge on the banks of the Euphrates river! Like Stonehenge in the British Isles (Fig. 21), the one built in Lagash provided stone markers for solar observations of solstices and equinoxes, but the prime outside feature was the creation of a sight line from a center stone, continued between two stone pillars, then on down an avenue to another stone. Such a sight line, precisely oriented when planned, enabled determining at the moment of heliacal rising in which zodiacal
44
THE END OF DAYS
constellation the Sun was appearing. And that—determining the zodiacal age through precise observation—was the prime objective of the whole complex facility. In Stonehenge, that sight line ran (and still runs) from the stone column called the Altar Stone in the center, through two stone columns identified as Sarsen Stones numbers 1 and 30, then down the Avenue to the so-called Heel Stone (see Fig. 6). It is generally agreed that the Stonehenge with the double Bluestone Circle and the Heel Stone of what is designated Stonehenge II dates to between 2200 to 2100 b.c.e. That was also the time—perhaps more accurately, in 2160 b.c.e.—when the “Stonehenge on the Euphrates” was built. And that was no chance coincidence. Like those two zodiacal observatories, other stone observatories proliferated at the same time in other places on Earth—at various sites in Europe, in South America, on the Golan Heights northeast of Israel, even in faraway China (where archaeologists discovered in the Shanzi province a stone circle with thirteen pillars aligned to the zodiac and dating to 2100 b.c.e.). They were all deliberate countermoves by Ninurta and Ningishzidda to Marduk’s Divine Chess Game: to show Mankind that the zodiacal age was still the Age of the Bull. Various texts from that time, including an autobiographical text by Marduk and a longer text known as the Erra Epos, shed light on Marduk’s wanderings away from Egypt, making him there the Hidden One. They also reveal that his demands and actions assumed an urgency and ferocity because of a conviction that his time for supremacy has come. The Heavens bespeak my glory as Lord, was his claim. Why? Because, he announced, the Age of the Bull, the Age of Enlil, was over; the Age of the Ram, Marduk’s zodiacal age, has arrived. It was, just as Ninurta had told Gudea, the time when in the heavens destinies on Earth were determined. The zodiacal ages, it will be recalled, were caused by the phenomenon of Precession, the retardation in Earth’s orbit around the Sun. The retardation accumulates to 1 degree (out of 360) in 72 years; an arbitrary division of the grand circle
Egyptian Prophecies, Human Destinies
45
into 12 segments of 30 degrees each means that mathematically the zodiacal calendar shifts from one Age to another every 2,160 years. Since the Deluge occurred, according to Sumerian texts, in the Age of the Lion, our zodiacal clock can start circa 10860 b.c.e. An astounding timetable emerges if, in this mathematically determined 2,160-year zodiacal calendar, the starting point of 10800 b.c. rather than 10860 b.c. is chosen: 10800 to 8640—Age of the Lion (Leo) 8640 to 6480—Age of the Crab (Cancer) 6480 to 4320—Age of the Twins (Gemini) 4320 to 2160—Age of the Bull (Taurus) 2160 to 0—Age of the Ram (Aries) Setting aside the neat end result that synchronizes with the Christian Era, one must wonder whether it was mere coincidence that the Ishtar-Ninurta era petered out in or about 2160 b.c.e., just when, according to the above zodiacal calendar, the Age of the Bull, Enlil’s Age, was also ending? Probably not; certainly Marduk did not think so. The available evidence suggests that he was sure that according to Celestial Time, his time for supremacy, his Age, has arrived. (Modern studies of Mesopotamian astronomy indeed confirm that the zodiacal circle was divided there into 12 houses of 30 degrees each—a mathematical rather than an observational division.) The various texts we have mentioned indicate that as he moved about, Marduk made another foray into the Enlilite heartland, arriving back in Babylon with a retinue of followers. Rather than resort to armed conflict, the Enlilites enlisted Marduk’s brother Nergal (whose spouse was a granddaughter of Enlil) to come to Babylon from southern Africa and persuade his brother to leave. In his memoirs, known as The Erra Epos, Nergal reported that Marduk’s chief argument was that his time, the Age of the Ram, had arrived. But Nergal counterargued that it is not really so: the Heliacal Rising, he told Marduk, still occurs in the constellation of the Bull! Enraged, Marduk questioned the accuracy of the observations. What happened to the precise and reliable instruments,
46
THE END OF DAYS
from before the Deluge, that were installed in your Lower World domain? he demanded to know from Nergal. Nergal explained that they were destroyed by the Deluge. Come, see for yourself which constellation is seen at sunrise on the appointed day, he urged Marduk. Whether Marduk went to Lagash to make the observation, we do not know, but he did realize the cause of the discrepancy: While mathematically the ages changed every 2,160 years, in reality, observationally, they did not. The zodiacal constellations, in which stars were grouped arbitrarily, were not of equal size. Some occupied a larger arc of the heavens, some smaller; and as it happened, the constellation of the Ram was one of the smaller ones, squeezed between the larger Taurus and Pisces (Fig. 22). Celestially, the constellation Taurus, occupying more than 30 degrees of the heavenly arc, lingers on for at least another two centuries beyond its mathematical length. In the twenty-first century b.c.e., Celestial Time and Messianic Time failed to coincide. Go away peacefully and come back when the heavens will declare your Age, Nergal told Marduk. Yielding to his fate, Marduk did leave, but did not go too far away. And with him, as emissary, spokesman, and herald, was his son, whose mother was an Earthling woman.
Figure 22
4 OF GODS AND DEMIGODS
The decision of Marduk to stay in or near the contested lands and to involve his son in the struggle for Mankind’s allegiance persuaded the Enlilites to return Sumer’s central capital to Ur, the cult center of Nannar (Su-en or Sin in Akkadian). It was the third time that Ur was chosen to serve in that capacity—hence the designation “Ur III” for that period. The move linked the affairs of the contending gods to the biblical tale—and role—of Abraham, and the intertwined relationship changed Religion to this day. Among the many reasons for the choice of Nannar/Sin as the Enlilite champion was the realization that contending with Marduk has expanded beyond the affairs of the gods alone, and has become a contest for the minds and hearts of the people—of the very Earthlings whom the gods had created, who now made up the armies that went to war on behalf of their creators . . . Unlike other Enlilites, Nannar/Sin was not a combatant in the Wars of the Gods; his selection was meant to signal to people everywhere, even in the “rebel lands,” that under his leadership an era of peace and prosperity would begin. He and his spouse Ningal (Fig. 23) were greatly beloved by the people of Sumer, and Ur itself spelled prosperity and wellbeing; its very name, which meant “urban, domesticated place,” came to mean not just “city” but The City—the urban jewel of the ancient lands. Nannar/Sin’s temple there, a skyscraping ziggurat, rose in stages within a walled sacred precinct where a variety of structures served as the gods’ abode and the residences and
48
THE END OF DAYS
Figure 23 functional buildings of a legion of priests, officials, and servants who attended to the divine couple’s needs and arranged the religious observances by king and people. Beyond those walls there extended a magnificent city with two harbors and canals linking it to the Euphrates river (Fig. 24), a great city with the king’s palace, administrative buildings (including for scribes and recordkeeping as well as for tax collecting), multilevel private dwellings, workshops, schools, merchants’ warehouses, and stalls—all in wide streets where, at many intersections, prayer shrines open to all travelers were built. The majestic ziggurat with its monumental stairways (Reconstruction, Fig. 25), though long in ruins, still dominates the landscape even after more than 4,000 years. But there was another compelling reason. Unlike the contending Ninurta and Marduk, who were both “immigrants” to Earth from Nibiru, Nannar/Sin was born on Earth. He was not only Enlil’s Firstborn on Earth—he was the first of the first generation of gods to be born on Earth. His children, the twins Utu/Shamash and Inanna/Ishtar, and their sister Ereshkigal, who belonged to the gods’ third generation, were all born on Earth. They were gods, but they were also Earth’s natives. All that was without doubt taken into consideration
Of Gods and Demigods
49
Figure 24
Figure 25 in the coming struggle for the loyalties of the people. The choice of a new king, to restart afresh kingship in and from Sumer, was also carefully made. Gone was the free hand given to (or assumed by) Inanna/Ishtar, who chose Sargon the Akkadian to start a new dynasty because she liked his lovemaking. The new king, named Ur-Nammu (“The joy of Ur”), was carefully selected by Enlil and approved by Anu, and he was no mere Earthling: He was a son—“the beloved son”—of the goddess Ninsun; she had been, the reader will recall, the mother of Gilgamesh. Since this divine
50
THE END OF DAYS
genealogy was restated in numerous inscriptions during Ur-Nammu’s reign, in the presence of Nannar and other gods, one must assume that the claim was factual. This made Ur-Nammu not only a demigod but—as was the case of Gilgamesh—“two-thirds divine.” Indeed, the claim that the king’s mother was the goddess Ninsun placed Ur-Nammu in the very same status as that of Gilgamesh, whose exploits were well remembered and whose name remained revered. The choice was thus a signal, to friends and foes alike, that the glorious days under the unchallenged authority of Enlil and his clan are back. All that was important, perhaps even crucial, because Marduk had his own attributes of appeal to the masses of Mankind. That special appeal to the Earthlings was the fact that Marduk’s deputy and chief campaigner was his son Nabu— who not only was born on Earth, but was born to a mother who herself was an Earthling, for long ago—indeed, in the days before the Deluge—Marduk broke all traditions and taboos and took an Earthling woman to be his official wife. That young Anunnaki took Earthling females as wives should not come as a shocking surprise, for it is recorded in the Bible for all to read. What is little known even to scholars, because the information is found in ignored texts and has to be verified from complex God Lists, is the fact that it was Marduk who set the example that the “Sons of the gods” followed: And it came to pass when the Earthlings began to increase in number upon the Earth and daughters were born unto them— That the sons of the Elohim saw the daughters of The Adam that they were compatible; And they took unto themselves wives of whichever they chose. Genesis 6: 1–2 The biblical explanation of the reasons for the Great Flood
Of Gods and Demigods
51
in the first eight enigmatic verses of chapter 6 of Genesis clearly points to the intermarriage and its resulting offspring as the cause of the divine wrath: The Nefilim were on the Earth in those days and thereafter too, When the sons of the Elohim came unto the daughters of The Adam and had children by them. (My readers may recall that it was my question, as a schoolboy, of why Nefilim—which literally means “Those who have come down,” who descended [from heaven to Earth]—was usually translated “giants.” It was much later that I realized and suggested that the Hebrew word for “giants,” Anakim, was actually a rendering of the Sumerian Anunnaki.) The Bible clearly cites such intermarriage—the “taking as wives”—between young “sons of the gods” (sons of the Elohim, the Nefilim) and female Earthlings (“daughters of The Adam”) as God’s reason for seeking Mankind’s end by the Deluge: “My spirit shall no longer dwell in Man, for in his flesh they erred . . . And God repented that He had fashioned the Adam on Earth, and was distraught, and He said: Let me wipe the Adam that I have created off the face of the Earth.” The Sumerian and Akkadian texts telling the story of the Deluge explained that two gods were involved in that drama: it was Enlil who sought Mankind’s destruction by the Deluge, while it was Enki who connived to prevent it by instructing “Noah” to build the salvaging ark. When we delve into the details, we find that Enlil’s “I’ve had it up to here!” anger on one hand, and Enki’s counterefforts on the other hand, were not just a matter of principles. For it was Enki himself who began to copulate with female Earthlings and have children by them, and it was Marduk, Enki’s son, who led the way to and set the example for actual marriages with them . . . By the time their Mission Earth was fully operative, the Anunnaki stationed on Earth numbered 600; in addition,
52
THE END OF DAYS
300 who were known as the IGI.GI (“Those who observe and see”) manned a planetary Way Station—on Mars!—and the spacecraft shuttling between the two planets. We know that Ninmah, the Anunnaki’s chief medical officer, came to Earth at the head of a group of female nurses (Fig. 26). It is not stated how many they were or whether there were other females among the Anunnaki, but it is clear that in any event females were few among them. The situation required strict sexual rules and supervision by the elders, so much so that (according to one text) Enki and Ninmah had to act as matchmakers, decreeing who should marry whom. Enlil, a strict disciplinarian, himself fell victim to the shortage of females and date-raped a young nurse. For that even he, the Commander in Chief on Earth, was punished with exile; the punishment was commuted when he agreed to marry Sud and make her his official consort, Ninlil. She remained his sole spouse to the very end. Enki, on the other hand, is described in numerous texts as a philanderer with female goddesses of all ages, and managing to get away with it. Moreover, once “daughters of The Adam” proliferated, he was not averse to having sexual flings with them, too . . . Sumerian texts extolled Adapa, “the wisest of men” who grew up at Enki’s household, was taught writing and mathematics by Enki, and was the first Earthling to be taken aloft to visit Anu on Nibiru; the texts also
Figure 26
Of Gods and Demigods
53
reveal that Adapa was a secret son of Enki, mothered by an Earthling female. Apocryphal texts inform us that when Noah, the biblical hero of the Deluge, was born, much about the baby and the birth caused his father, Lamech, to wonder whether the real father had not been one of the Nefilim. The Bible just states that Noah was a genealogically “perfect” man who “Walked with the Elohim”; Sumerian texts, where the Flood’s hero is named Ziusudra, suggest that he was a demigod son of Enki. It was thus that one day Marduk complained to his mother that while his companions were assigned wives, he was not: “I have no wife, I have no children.” And he went on to tell her that he had taken a liking to the daughter of a “high priest, an accomplished musician” (there is reason to believe that he was the chosen man Enmeduranki of Sumerian texts, the parallel of the biblical Enoch). Verifying that the young Earthling female—her name was Tsarpanit—agreed, Marduk’s parents gave him the go-ahead. The marriage produced a son. He was named EN.SAG, “Lofty Lord.” But unlike Adapa, who was an Earthling demigod, Marduk’s son was included in the Sumerian God Lists, where he was also called “the divine MESH”—a term used (as in GilgaMESH) to denote a demigod. He was thus the first demigod who was a god. Later on, when he led the masses of humans in his father’s behalf, he was given the epithet-name Nabu—The Spokesman, The Prophet—for that is what the literal meaning of the word is, as is the meaning of the parallel biblical Hebrew word Nabih, translated “prophet.” Nabu was thus the god-son and an Adam-son of ancient scriptures, the one whose very name meant Prophet. As in the Egyptian prophecies earlier quoted, his name and role became linked to the Messianic expectations. And so it was, in the days before the Deluge, that Marduk set an example to the other young unespoused gods: find and marry an Earthling female . . . The breach of the taboo appealed in particular to the Igigi gods who were away on Mars most of the time, with their principal station on Earth being
54
THE END OF DAYS
the Landing Place in the Cedar Mountains. Finding an opportunity—perhaps an invitation to come and celebrate Marduk’s wedding—they seized Earthling females and carried them off as wives. Several extra-biblical books, designated The Apocrypha, such as the Book of Jubilees, the Book of Enoch, and the Book of Noah, record the incident of the intermarriage by the Nefilim and fill in the details. Some two hundred “Watchers” (“Those who observe and see”) organized themselves in twenty groups; each group had a named leader. One, called Shamyaza, was in overall command. The instigator of the transgression, “the one who led astray the sons of God and brought them down to Earth and led them astray through the Daughters of Man,” was named Yeqon . . . It happened, these sources confirmed, during the time of Enoch. In spite of their efforts to fit the Sumerian sources (that told of rival and contradicting Enlil and Enki) into a monotheistic framework—the belief in only one Almighty God— the compilers of the Hebrew Bible ended that section in chapter 6 of Genesis with a recognition of the factual outcome. Speaking of the offspring of those intermarriages, the Bible makes two admissions: the first, that the intermarrying took place in the days before the Deluge, “and therafter too”; and secondly, that from the offspring “came the heroes of old, the men of renown.” The Sumerian texts indicate that post-Diluvial heroic kings were indeed such demigods. But they were the offspring not only of Enki and his clan: sometimes kings in the Enlilite region were sons of Enlilite gods. For example, The Sumerian King Lists clearly state that when kingship began in Uruk (an Enlilite domain), the one chosen for kingship was a MESH, a demigod: Meskiaggasher, a son of Utu, became high priest and king. Utu was of course the god Utu/Shamash, grandson of Enlil. Further down the dynastic line there was the famed Gilgamesh, “two-thirds of him divine,” son of the Enlilite goddess Ninsun and fathered by the High Priest of Uruk, an Earthling. (There
Of Gods and Demigods
55
were several more rulers down the line, both in Uruk and in Ur, who bore the title “Mesh” or “Mes”.) In Egypt, too, some Pharaohs claimed divine parentage. Many in the 18th and 19th Dynasties adopted theophoric names with a prefix or suffix MSS (rendered Mes, Mose, Meses), meaning “Issue of ” this or that god—such as the names Ah-mes or Ra-mses (RA-MeSeS—“issue of,” offspring of, the god Ra). The famed queen Hatshepsut, who though a female seized the title and privileges of a Pharaoh, claimed that right by virtue of being a demigod—the great god Amon, she claimed in inscriptions and depictions in her immense temple at Deir el Bahri, “took the form of his majesty the king,” the husband of her queen-mother, “had intercourse with her,” and caused Hatshepsut to be born as his semidivine daughter. Canaanite texts included the tale of Keret, a king who was the son of the god El. An interesting variant on such demigod-as-king practices was the case of Eannatum, a Sumerian king in Ninurta’s Lagash during the early “heroic” times. An inscription by the king on a well-known monument of his (the “Stela of the Vultures”) attributes his demigod status to artificial insemination by Ninurta (the Lord of the Girsu, the sacred precinct), and to help from Inanna/Ishtar and Ninmah (here called by her epithet Ninharsag): The Lord Ningirsu, warrior of Enlil, implanted the semen of Enlil for Eannatum in the womb of [ . . . ]. Inanna accompanied his [birth], named him “Worthy in the Eanna temple,” set him on the sacred lap of Ninharsag. Ninharsag offered him her sacred breast. Ningirsu rejoiced over Eannatum— semen implanted in the womb by Ningirsu. While the reference to the “semen of Enlil” leaves unclear whether Ninurta/Ningirsu’s own semen is here considered “semen of Enlil” because he was Enlil’s firstborn, or actually used Enlil’s semen for the insemination (which is doubtful),
56
THE END OF DAYS
the inscription clearly claims that Eannatum’s mother (whose name is illegible on the stela) was artificially impregnated, so that a demigod was conceived without actual sexual intercourse—a case of immaculate conception in third millennium b.c.e. Sumer! That the gods were no strangers to artificial insemination is corroborated by Egyptian texts, according to which after Seth killed and dismembered Osiris, the god Thoth extracted semen from the phallus of Osiris and impregnated with it the wife of Osiris, Isis, bringing about the birth of the god Horus. A depiction of the feat shows Thoth and birth goddesses holding the two strands of DNA that were used, and Isis holding the newborn Horus (Fig. 27). Clearly, then, after the Deluge the Enlilites too accepted both the mating with Earthling females and considered the offspring “heroes, men of renown,” suitable for kingship. Royal “bloodlines” of demigods were thus begun. One of the first tasks of Ur-Nammu was to carry out a moral and religious revival. And for that, too, a former revered and remembered king was emulated. It was done through the promulgation of a new Code of Laws, laws of moral behav-
Figure 27
Of Gods and Demigods
57
ior, laws of justice—of adherence, the Code said, to the laws that Enlil and Nannar and Shamash had wanted the king to enforce and the people to live by. The nature of the laws, a list of do’s and don’ts, can be judged by Ur-Nammu’s claim that due to those laws of justice, “the orphan did not fall prey to the wealthy, the widow did not fall prey to the powerful, the man with one sheep was not delivered to the man with one ox . . . justice was established in the land.” In that he emulated—sometimes using the exact same phrases—a previous Sumerian king, Urukagina of Lagash, who three hundred years earlier had promulgated a law code by which social, legal, and religious reforms were instituted (among them the establishment of women’s safehouses under the patronage of the goddess Bau, Ninurta’s spouse). These, it ought to be pointed out, were the very same principles of justice and morality that the biblical prophets demanded of kings and people in the next millennium. As the era of Ur III began, there was obviously a deliberate attempt to return Sumer (now Sumer & Akkad) to its olden days of glory, prosperity, and morality and peace—the times that preceded the latest confrontation with Marduk. The inscriptions, the monuments, and the archaeological evidence attest that Ur-Nammu’s reign, which began in 2113 b.c.e., great gods, especially Enlil and Ninlil, were honored with renovated and magnified temples, and for the first time in Sumer’s history, the priesthood of Ur was combined with that of Nippur, leading a religious revival. All scholars agree that in virtually every way the Ur III period begun by Ur-Nammu attained new heights in the Sumerian civilization. That conclusion only increased the puzzlement caused by a beautifully crafted box that was
58
THE END OF DAYS
uncovered by archaeologists: its inlaid panels, front and back, depicted two contradicting scenes of life in Ur. While one of the panels (now known as the “Peace Panel”) depicted banqueting, commerce, and other scenes of civil activities, the other (the “War Panel”) depicted a military column of armed and helmeted soldiers and horse-drawn chariots marching to war (Fig. 28).
Figure 28
Of Gods and Demigods
59 Ur-Nammu’s body to Sumer “in an unknown place had sunk; the waves sank it down, with him on board.” When news of the defeat and the tragic death of Ur-Nammu reached Ur, a great lament went up there. The people could not understand how such a religiously devout king, a righteous shepherd who only followed the gods’ directives with weapons they put in his hands, could perish so ignominiously. “Why did the Lord Nannar not hold him by the hand?” they asked; “Why did Inanna, Lady of Heaven, not put her noble arm around his head? Why did the valiant Utu not assist him?” The Sumerians, who believed that all that happens had been fated, wondered, “Why did these gods step aside when UrNammu’s bitter fate was decided?” Surely those gods, Nannar and his twin children, knew what Anu and Enlil were determining; yet they said nothing to protect Ur-Nammu. There could be only one plausible explanation, the people of Ur and Sumer concluded as they cried out and lamented: The great gods must have gone back on their word— How the fate of the hero had been changed! Anu altered his holy word. Enlil deceitfully changed his decree!
60
THE END OF DAYS
These are strong words, accusing the great Enlilite gods of deceit and double-crossing! The ancient words convey the extent of the people’s disappointment. If that was so in Sumer & Akkad, one can imagine the reaction in the rebellious western lands. In the struggle for the hearts and minds of Mankind, the Enlilites were faltering. Nabu, the “spokesman,” intensified the campaign in behalf of his father Marduk. His own status was enhanced and changed: his own divinity was now glorified by a variety of venerating epithets. Inspired by Nabu— the Nabih, the Prophet—prophecies of the Future, of what is about to happen, began to sweep the contested lands. We know what they said because a number of clay tablets on which such prophecies were inscribed have been found; written in Old Babylonian cuneiform, they are grouped by scholars as Akkadian Prophecies or Akkadian Apocalypses. Common to all of them is the view that Past, Present, and Future are parts of a continuous flow of events; that within a preordained Destiny there is some room for free will and thus a variated Fate; that for Mankind, both were decreed or determined by the gods of Heaven and Earth; and that therefore events on Earth reflect occurrences in the heavens. To grant the prophecies believability, the texts sometimes anchored the prediction of future events in a known past historic occurrence or entity. What is wrong in the present, why change is needed, is then recounted. The unfolding events are attributed to decisions by one or more of the great gods. A divine Emissary, a Herald, will appear; the prophetic text might be his words, written down by the scribe, or expected pronouncements; as often as not, “a son will speak for his father.” The predicted event(s) will be linked to omens—the death of a king, or heavenly signs: a celestial body will appear and make a frightful sound; “a burning fire” will come from the skies; “a star shall flash from the height of the sky to the horizon as a torch;” and, most significantly, “a planet will appear before its time.” Bad things, Apocalypse, shall precede the final event. There would be calamitous rains, huge devastating waves—
Of Gods and Demigods
61
or droughts, the silting of canals, locusts, and famines. Mother will turn against daughter, neighbor against neighbor. Rebellion, chaos, and calamities will occur in the lands. Cities will be attacked and depopulated; kings will die, be toppled, and captured; “one throne will overthrow another.” Officials and priests will be killed; temples will be abandoned; rites and offerings will cease. And then the predicted event—a great change, a new era, a new leader, a Redeemer— will come. Good will prevail over evil, prosperity will replace sufferings; abandoned cities will be resettled, the remnants of the dispersed people will return to their homes. Temples will be restored, and the people will perform the correct religious rites. Not unexpectedly, these Babylonian or pro-Marduk prophecies pointed the accusing finger of wrongdoing at Sumer & Akkad (and also their allies Elam, Hattiland, and the Sealands), and named the Amurru Westerners as the instrument of divine retribution. The Enlilite “cult centers” Nippur, Ur, Uruk, Larsa, Lagash, Sippar, and Adab are named; they will be attacked, plundered, their temples abandoned. The Enlilite gods are described as confused (“unable to sleep”). Enlil is calling out to Anu, but ignores Anu’s advice (some translators read the word as “command”) that Enlil issue a misharu edict—a “putting things straight” order. Enlil, Ishtar, and Adad will be forced to change kingship in Sumer & Akkad. The “sacred rites” will be transferred out of Nippur. Celestially, “the great planet” will appear in the constellation of the Ram. The word of Marduk shall prevail; “He will subdue the Four Regions, the whole Earth shall tremble at the mention of his name . . . After him his son will reign as king and will become master of the whole Earth.” In some of the prophecies, certain deities are the subject of specific predictions: “A king will arise,” one text prophesied in regard to Inanna/Ishtar, “he will remove the protective goddess of Uruk from Uruk and make her dwell in Babylon . . . He will establish the rites of Anu in Uruk.” The Igigi are also specifically mentioned: “The regular offerings for the Igigi gods, which had ceased, will be reestablished,” one prophecy states.
62
THE END OF DAYS
* * * As was the case with Egyptian prophecies, most scholars also treat the “Akkadian Prophecies” as “pseudo-prophecies” or post aventum texts—that they were in fact written long after the “predicted” events; but as we have remarked in regard to the Egyptian texts, to say that the events were not prophesied because they had already happened is only to reassert that the events per se did happen (whether or not they were predicted), and that is what matters most to us. It means that the prophecies did come true. And if so, most chilling is the prediction (in a text known as Prophecy “B”): The Awesome Weapon of Erra upon the lands and the people will come in judgment. A most chilling prophecy indeed, for before the twentyfirst century b.c.e. was over, “judgment upon lands and peoples” occurred when the god Erra (“The Annihilator”)—an epithet for Nergal—unleashed nuclear weapons in a cataclysm that made prophecies come true.
5 COUNTDOWN TO DOOMSDAY
The disastrous twenty-first century b.c.e. began with the tragic and untimely death of Ur-Nammu, in 2096 b.c.e. It culminated with an unparalleled calamity, by the hand of the gods themselves, in 2024 b.c.e. The interval was seventytwo years—exactly the precessional shift of one degree; and if it was just a coincidence, then it was one of a series of “coincidental” occurrences that were somehow well coordinated . . . ‘little Enlil,’ a child suitable for kingship and throne, shall be conceived.” That was a genealogical claim not to be sneezed at. UrNammu himself, as earlier stated, was “two-thirds” divine, since his mother was a goddess. Though the High Priestess who was Shulgi’s mother is not named, her very status suggests that she, too, was of some godly lineage, for it was a king’s daughter who was chosen to be an EN.TU; and the kings of Ur, starting with the first dynasty, could be traced back to demigods. That Nannar himself arranged for the union to take place in Enlil’s temple in Nippur was also significant; as previously stated, it was under Ur-Nammu’s reign that for the first time the priesthood of Nippur was combined with the priesthood of another city—in this case, with the one in Ur.
64
THE END OF DAYS
Much of what was happening in and around Sumer at the time has been gleaned from “Date Formulas”—royal records in which each year of the king’s reign was noted by the major event that year. In the case of Shulgi much more is known, for he left behind other short and long inscriptions, including poetry and love songs.. When Shulgi returned to Ur, he had every reason to think that he had brought to gods and people alike “Peace in our time” (to use a modern analogy). He was granted by the gods the title “High Priest of Anu, Priest of Nannar.” He was befriended by Utu/Shamash, and was given the personal attention of Inanna/Ishtar (boasting in his love songs that she granted him her vulva in her temple). But while Shulgi turned from affairs of state to personal pleasures, the unrest in the “rebel lands” was continuing. Unprepared for military action, Shulgi asked his Elamite ally for troops, offering its king as a reward one of his daugh-
Countdown to Doomsday
65
ters. The Date Formulas called it the Great West Wall, and scholars believe that it ran from the Euphrates to the Tigris rivers north of where Baghdad is situated nowadays, blocking to invaders the way down the fertile plain between the two rivers. It was a defensive measure that preceded the Great Wall of China, which was built for similar reasons, by almost two thousand years! In 2048 b.c.e.. As in so much else, what was happening had root causes going back, sometimes way back, to earlier times and events. The “rebel lands,” though in Asia and thus domains in the Enlilite Lands of Noah’s son Shem, were inhabited by varied “Canaanites”—offspring of the biblical Canaan who, though descended of Ham (and thus belonging to Africa), occupied a stretch of Shem’s lands (Genesis, Chapter 10). That the “Lands of the West” along the Mediterranean coast were somehow disputed territory was also indicated by ancient Egyptian texts regarding the bitter contest between Horus and Seth that ended in aerial battles between them over the Sinai and the same contested lands. It is noteworthy that in their military expeditions to subdue and punish the “rebel lands” in the west, both Ur-Nammu and Shulgi reached the Sinai peninsula, but turned away
66
THE END OF, Fig. 29, commanding the spaceport’s “Eaglemen,” Fig. 30). ancient sources indicate that from the safety of the sacred region Nabu ventured to the lands and cities along the Mediterranean coast, even to some Mediterranean islands, spreading everywhere the message of Marduk’s coming su-
Figure 29
Countdown to Doomsday
67
Figure 30 premacy. He was, thus, the enigmatic “Son-Man” of the Egyptian and the Akkadian prophecies—the Divine Son who was also a Son-Man, the son of a god and of an Earthling woman. The Enlilites, understandably, could not accept such a situation. And so it was that when Amar-Sin ascended the throne of Ur after Shulgi, the targets and strategy of the Ur III military expeditions were changed in order to reassert Enlilite control over Tilmun, to sever the sacred region from the “rebel lands,” then pry loose those lands from the influence of Nabu and Marduk by force of arms. Starting in 2047 b.c.e., the sacred Fourth Region became a target and a pawn in the Enlilite struggle with Marduk and Nabu; and as both biblical and Mesopotamian texts reveal, the conflict erupted to the greatest international “world war” of antiquity. Involving the Hebrew Abraham, that “War of the Kings” placed him in center stage of international events. In 2048 b.c.e.).
68
THE END OF DAYS
It was located at the crossroads of major international trade and military land routes. Situated at the headwaters of the Euphrates River, it was also a hub for river transportation all the way downstream to Ur itself. Surrounded by fertile meadows watered by the river’s tributaries, the Balikh and Khabur rivers, it was a center of sheepherding. The famed “Merchants of Ur” came there for Harran’s wool, and brought in exchange to distribute from there Ur’s famed woolen garments. Commerce in metals, skins, leather, woods, earthenware products, and spices followed. (The Prophet Ezekiel, who was exiled from Jerusalem to the Khabur area in Babylonian times, mentioned Harran’s “merchants in choice fabrics, embroidered cloaks of blue, and many-colored carpets.”) Harran (the town, by that very name, still exists in Turkey, near the border with Syria, and was visited by me in 1997) was also known in ancient times as “Ur away from Ur”; at its center stood a great temple to Nannar/Sin. In 2095 b.c.e., the year in which Shulgi took over the throne in Ur, a priest named Terah was sent from Ur to Harran to serve at that temple. He took along his family; it included his son Abram. We know about Terah, his family, and their move from Ur to Harran from the Bible: Now these are the generationas of Terah: Terah begot Abram, Nahor and Haran, and Haran begot Lot. And Haran died before his father Terah in his land of birth, in Ur in Chaldea. And Abram and Nahor took wives— the wife of Abram was named Sarai and that of Nahor’s wife Milkhah . . . And Terah took with him his son Abram and Lot, the son of his son Haran, and his daughter-in-law Sarai, and went forth with them from Ur in Chaldea by the way to Canaan; and they reached Harran and resided there. Genesis 11: 27–31
Countdown to Doomsday
69
It is with these verses that the Hebrew Bible begins the pivotal tale of Abraham—called at the beginning by his Sumerian name Abram. His father, we are told earlier, stemmed from a patriarchal line that went all the way back to Shem, the oldest son of Noah (the hero of the Deluge); all those Patriarchs enjoyed long lives—Shem to the age of 600, his son Arpakhshad to 438; and subsequent male offspring to 433, 460, 239, and 230 years. Nahor, the father of Terah, lived to age l48; and Terah himself—who fathered Abram when he was seventy years old—lived to age 205. Chapter 11 of Genesis explains that Arpakhshad and his descendants lived in the lands later known as Sumer and Elam and their surroundings. So Abraham, as Abram, was a true Sumerian. This genealogical information alone indicates that Abraham was of a special ancestry. His Sumerian name, AB. RAM, meant “Father’s Beloved,” an apropriate name for a son finally born to a seventy-year-old father. The father’s name, Terah, stemmed from the Sumerian epithet-name TIRHU; it designated an Oracle Priest—a priest who observed celestial signs or received oracular messages from a god, and explained or conveyed them to the king. The name of Abram’s wife, SARAI (later Sarah in Hebrew), meant “Princess”; the name of Nahor’s wife, Milkhah, meant “Queenlike”; both suggest a royal genealogy. Since it was later revealed that Abraham’s wife was his half-sister—“the daughter of my father but not of my mother,” he explained—it follows that Sarai/Sarah’s mother was of royal descent. The family thus belonged to Sumer’s highest echelons, combining royal and priestly ancestries. Another significant clue to identifying the family’s history is the repeated reference by Abraham to himself, when he met rulers in Canaan and Egypt, as being an Ibri—a “Hebrew.” The word stems from the root ABoR—to come across, to cross—so it has been assumed by biblical scholars that by that he meant that he had come across from the other side of the Euphrates River, i.e., from Mesopotamia. But I believe that the term was more specific. The name used for Sumer’s “Vatican City,” Nippur, is the Akkadian rendering of the original Sumerian name NI.IBRU, “Splendid Place of Crossing.”
70
THE END OF DAYS
Abram, and his descendants who are called in the Bible Hebrews, belonged to a family that identified themselves as “Ibru”—Nippurians. That would suggest that Terah was first a priest in Nippur, then moved to Ur, and finally to Harran, taking his family along. By synchronizing biblical, Sumerian, and Egyptian chronologies (as detailed in The Wars of Gods and Men), we have arrived at the year 2123 b.c.e. as the date of Abraham’s birth. The gods’ decision to make Nannar/Sin’s cult center Ur the capital of Sumer and to enthrone Ur-Nammu took place in 2113 b.c.e. Soon thereafter, the priesthoods of Nippur and Ur were combined for the first time; it is very likely that it was then that the Nippurian priest Tirhu moved with his family, including the ten-year-old boy Abram, to serve in Nannar’s temple in Ur. In 2095 b.c.e., when Abraham was twenty-eight and already married, Terah was transferred to Harran, taking the family with him. It could not have been just a coincidence that it was the very same year in which Shulgi succeeded UrNammu. The emerging scenario is that the movements of this family were somehow linked to the geopolitical events of that era. Indeed, when Abraham himself was chosen to carry out divine orders to leave Harran and rush to Cannan, the great god Marduk took the crucial step of moving to Harran. It was in 2048 b.c.e. that the two moves occurred: Marduk coming to sojourn in Harran, Abraham leaving Harran for faraway Cannan. We know from Genesis that Abram was seventy-five years old, and it was thus 2048 b.c.e., that he was told by God, “Get thee out of thy country and out of thy birthplace and from thy father’s house”—leave behind Sumer, Nippur, and Harran—and go “unto the land which I will show thee.” As to Marduk, a long text known as the Marduk Prophecy that he addressed to the people of Harran (clay tablet, Fig. 31) provides the clue confirming the fact and the time of his move to Harran: 2048 b.c.e. There is no way the two moves could have been unrelated. But 2048 b.c.e. was also the very year in which the Enlilite gods decided to get rid of Shulgi, ordering for him the
Countdown to Doomsday
71
Figure 31 “death of a sinner”—a move that signaled the end of “let’s try peaceful means” and a return to aggressive conflict; and there is no way that this, too, was just a coincidence. No, the three moves—Marduk to Harran, Abram leaving Harran for Canaan, and the removal of the decadent Shulgi—had to be interconnected: three simultaneous and interrelated moves in the Divine Chessgame. They were, as we shall see, steps in the countdown to Doomsday. The ensuing twenty-four years—from 2048 to 2024 b.c.e.— were a time of religious fervor and ferment, of international diplomacy and intrigue, of military alliances and clashing armies, of a struggle for strategic superiority. The spaceport in the Sinai peninsula, and the other space-related sites, were constantly at the core of events. Amazingly, various written records from antiquity have survived, providing us not just with an outline of events but with great details about the battles, the strategies, the discussions, the arguments, the participants and their moves, and
72
THE END OF DAYS
the crucial decisions that resulted in the most profound upheaval on Earth since the Deluge. Augmented by the Date Formulas and varied other references, the principal sources for reconstructing those dramatic events are the relevant chapters in Genesis; Marduk’s autobiography, known as The Marduk Prophecy; a group of tablets in the “Spartoli Collection” in the British Museum known as The Khedorla’omer Texts; and a long historical/autobiographical text dictated by the god Nergal to a trusted scribe, a text known as the Erra Epos. As in a movie—usually a crime thriller—in which the various eyewitnesses and principals describe the same event not exactly the same way, but from which the real story emerges, so are we able to reach the same result in this case. Marduk’s main chess move, in 2048 b.c.e., was to establish his command post in Harran. By that he took away from Nannar/Sin this vital northern crossroads and severed Sumer from the northern lands of the Hittites. Besides the military significance, the move deprived Sumer of its economically vital commercial ties. The move also enabled Nabu “to marshal his cities, toward the Great Sea to set his course.” Place names in these texts suggest that the principal cities west of the Euphrates River were coming under full or partial control of the father–son team, including the all-important Landing Place. It was into the most populated part of the Lands of the West—Canaan—that Abram/Abraham was commanded to go. He left Harran, taking his wife and nephew Lot with him. He was traveling swiftly southward, stopping only to pay homage to his God at selected sacred sites. His destination was the Negev, the dry region bordering the Sinai Peninsula. He did not stay there long. As soon as Shulgi’s successor, Amar-Sin, was enthroned in Ur in 2047 b.c.e., Abram was instructed to go to Egypt. He was at once taken to meet the reigning Pharaoh, and was provided with “sheep and oxen and asses, and male attendants and female servants, and sheasses and camels.” The Bible is mum regarding the reason for this royal treatment, except to hint that the Pharaoh, being told that Sarai was Abram’s sister, assumed that she was
Countdown to Doomsday
73
being offered to him in marriage—a step that suggsts that a treaty was discussed. That such high level international negotiations were taking place between Abram and the Egyptian king seems plausible when one realizes that the year when Abram returned to the Negev after a seven-year stay in Egypt—2040 b.c.e.—was the very same year in which the Theban princes of Upper Egypt defeated the previous Lower Egypt dynasty, launching Egypt’s unified Middle Kingdom. Another geopolitical coincidence! Abram, now reinforced with manpower and camels, returned to the Negev in the nick of time, his mission now clear: to defend the Fourth Region with its spaceport. As the biblical narrative reveals, he now had with him an elite force of Ne’arim—a term usually translated “Young Men”—but Mesopotamian texts used the parallel term LU.NAR (“NARmen”) to denote armed cavalrymen. It is my suggestion that Abraham, having learnt in Harran tactics from the militarily excelling Hittites, obtained in Egypt a striking force of swift camel-riding cavalrymen. His base in Canaan was again the Negev, the area bordering the Sinai Peninsula. He did so in the nick of time, for a mighty army—legions of an alliance of Enlilite kings—was on its way not only to crush and punish the “sinning cities” that switched allegiance to “other gods,” but to also capture the spaceport. The Sumerian texts dealing with the reign of Amar-Sin, Shulgi’s son and successor, inform us that in 2041 b.c.e.. It was, indeed, such a major and unparalleled occurrence that the Bible devoted a whole long chapter to it—Genesis, Chapter 14. Biblical scholars call it “The War of the Kings,” for it climaxed in a great battle between an army of four “Kings of the East” and the combined forces of five “Kings of the West,” and culminated in a remarkable military feat by Abraham’s swift cavalrymen.
74
THE END OF DAYS
The Bible begins its report of that great international war by listing the kings and kingdoms of the East who “came and made war” in the West: And it came to pass in the days of Amraphel king of Shine’ar, Ariokh king of Ellasar, Khedorla’omer king of Elam, and Tidhal the king of Goyim. The group of tablets named the Khedorla’omer Texts was first brought to scholarly attention by the Assyriologist Theophilus Pinches in a lecture at the Victoria Institute, London, in 1897. They clearly describe the same events that are the great international war of Chapter 14 of Genesis, though in much greater detail; it is quite possible, indeed, that those tablets served as the source for the biblical writers. Those tablets identify “Khedorla’omer king of Elam” as the Elamite king Kudur-Laghamar, who is known from historical records. “Ariokh” has been identified as ERI.AKU (“Servant of the Moon god”), who reigned in the city of Larsa (biblical “Ellasar”); and Tidhal was identified as Tud-Ghula, a vassal of the king of Elam. There has been over the years a debate regarding the identity of “Amraphel king of Shine’ar”; suggestions ranged all the way to Hammurabi, a Babylonian king centuries later. Shine’ar was the constant biblical name for Sumer, not Babylon, so who, in the time of Abraham, was its king? I have convincingly suggested in The Wars of Gods and Men that the Hebrew should be read not Amra-Phel but Amar-Phel, from the Sumerian AMAR.PAL—a variant of AMAR.SIN— whose Date Formulas attest that he did indeed, in 2041 b.c.e., launch the War of the Kings. That fully identified coalition, according to the Bible, was led by the Elamites—a detail corroborated by the Mesopotamian data that highlights the reemerging leading role of Ninurta in the struggle. The Bible also dates this Khedorla’omer Invasion by observing that it took place fourteen years after the previous Elamite incursion into
Countdown to Doomsday
75
Canaan—another detail conforming to the data from Shulgi’s time. The invasion route this time was, however, different: shortcutting the distance from Mesopotamia by a risky passage through a stretch of desert, the invaders avoided the densely populated Mediterranean coastland by marching on the eastern side of the Jordan River. The Bible lists the places where those battles took place and who the Enlilite forces battled there; the information indicates that an attempt was made to settle accounts with old adversaries—descendants of the intermarrying Igigi, even of the Usurper Zu—who evidently supported the uprisings against the Enlilites. But sight was not lost of the prime target: the spaceport. The invading forces followed what has been known since biblical times as the Way of the King, running north–south on the eastern side of the Jordan. But when they turned westward toward the gateway to the Sinai Peninsula, they met a blocking force: Abraham and his cavalrymen (Fig. 32). Referring to the Peninsula’s gateway city Dur-Mah-Ilani (“The gods’ great fortified place”)—the Bible called it Kadesh-Barnea—the Khedorla’omer Texts clearly stated that the way was blocked there: The son of the priest, whom the gods in their true counsel had anointed, the despoiling had prevented. “The son of the priest,” anointed by the gods, I suggest, was Abram the son of the priest Terah. A Date Formula tablet belonging to Amar-Sin, inscribed on both sides (Fig. 33), boasts of destroying NE IB.RU.UM— “The Shepherding place of Ibru’um.” In fact, at the gateway to the spaceport there was no battle; the mere presence of Abram’s cavalry striking force persuaded the invaders to turn away—to richer and more lucrative targets. But if the reference is indeed to Abram, by name, it offers once more an extraordinary extra-biblical corroboration of the Patriarchal record, no matter who claimed victory. Prevented from entering the Sinai Peninsula, the Army of
76
THE END OF DAYS
Figure 32 the East turned northward. The Dead Sea was then shorter; its current southern appendix was not yet submerged, and it was then a fertile plain rich with farmland, orchards, and trading centers. The settlements there included five cities, among them the infamous Sodom and Gomorrah. Turning
Countdown to Doomsday
77
Figure 33 northward, the invaders now faced the combined forces of what the Bible called “five sinning cities.” It was there, the Bible reports, that the four kings fought and defeated the five kings. Looting the cities and taking captives with them, the invaders marched back, this time on the western side of the Jordan. The biblical focus on those battles might have ended with that turning back were it not for the fact that Abram’s nephew Lot, who resided in Sodom, was among the captives. When a refugee from Sodom told Abram what had happened, “he armed his trained men, three hundred and eighteen of them, and gave chase.” His cavalry caught up with the invaders all the way north, near Damascus (see Fig. 32), where Lot was freed and the booty recovered. The Bible records the feat as the “smiting of Khedorla’omer and the kings who were with him” by Abram. The historical records suggest that as audacious and farflung that War of the Kings had been, it failed to suppress the Marduk-Nabu surge. Amar-Sin, we know, died in 2039 b.c.e.—felled not by an enemy lance, but by a scorpion’s bite. He was replaced in 2038 b.c.e. by his brother Shu-Sin. The
78
THE END OF DAYS
data for his nine years’ reign record two military forays northward but none westward; they speak mostly of his defensive measures. He relied mainly on building new sections of the Wall of the West against attacking Amorites. The defenses, however, were moved each time ever closer to Sumer’s heartland, and the territory controlled from Ur kept shrinking. By the time the next (and last) of the Ur III dynasty, IbbiSin, ascended the throne, invaders from the west had broken through the defensive Wall and were clashing with Ur’s “Foreign Legion,” Elamite troops, in Sumerian territory. Directing and prompting the Westerners on toward the cherished target was Nabu. His divine father, Marduk himself, was waiting in Harran for the recapture of Babylon. The great gods, called to an emergency council, then approved extraordinary steps that changed the future forever.
6 GONE WITH THE WIND
The unleashing of “weapons of mass destruction” in the Middle East underlies the fear of Armageddon prophecies coming true. The sad fact is that a mounting conflict—among gods, not men—did lead to the use of nuclear weapons, right there, four thousand years ago. And if there ever was a most regrettable act with the most unexpected consequences, that was it. That nuclear weapons had been used on Earth for the first time not in l945 A.D. but in 2024 b.c.e. is fact, not fiction.. The failure of the War of the Kings to subdue the “rebel lands” of course discouraged the Enlilites and encourged the Mardukites, but the events did more than that. On Enlil’s instructions, Ninurta got busy setting up an alternative space facility on the other side of the world—all the way in what is now Peru in South America. The texts indicate that Enlil himself was away from Sumer for long stretches of time. These gods’ moves caused the last two kings of Sumer, Shu-Sin and Ibbi-Sin, to waver in their allegiances and to start paying homage to Enki in his Sumerian foothold, Eridu. The divine absences also loosened controls over the Elamite “Foreign Legion,” and the records speak of “sacrileges” by the Elamite troops. Gods and men were increasingly disgusted with it all.
80
THE END OF DAYS
Especially enraged was Marduk, who received word of looting, destructions, and desecrations in his cherished Babylon. It will be recalled that the last time he was there he was persuaded by his half-brother Nergal to leave peacefully until the Celestial Time would reach the Age of the Ram. He did so having received Nergal’s solemn word that nothing would be disturbed or desecrated in Babylon, but the opposite happened. Marduk was angered by the reported desecration of his temple there by the “unworthy” Elamites: “To herds of dogs Babylon’s temple they made a den; flying ravens, loudly shrieking, their dung dropped there.” From Harran he cried out to the great gods: “Until When?” Has not the Time arrived yet, he asked in his prophetic autobiography: O great gods, learn my secrets as I girdle my belt, my memories remember. I am the divine Marduk, a great god. I was cast off for my sins, to the mountains I have gone. In many lands I have been a wanderer. From where the sun rises to where it sets I went. To the highland of Hatti I came. In Hattiland I asked for an oracle; in it I asked: “Until when?” “Twenty-four years in Harran’s midst I nested,” Marduk went on; “my days are completed!” The time has come, he said, to set his course to his city (Babylon), “my temple to rebuild, my everlasting abode to establish.” Waxing visionary, he spoke of seeing his temple E.SAG.ILA (“Temple whose head is lofty”) rising as a mountain upon a platform in Babylon, calling it “The house of my covenant.” He foresaw Babylon as forever established, a king of his choice installed there, a city filled with joy, a city blessed by Anu. The messianic times, Marduk prophesied, will “chase away evil and bad luck, bring motherly love to Mankind.” The year in which a sojourn of twenty-four years in Harran was completed was 2024 b.c.e.; it marked seventy-two years
Gone with the Wind
81
since Marduk had agreed to depart from Babylon and await the oracular celestial time. Marduk’s “until when?” appeal to the Great Gods was not an idle one, for the leadership of the Anunnaki was constantly consulting, informally and in formal councils. Alarmed by the worsening situation, Enlil hurriedly returned to Sumer, and was shocked to learn that things had gone wrong even in Nippur itself. Ninurta was summoned to explain the Elamites’ misconduct, but Ninurta put all the blame on Marduk and Nabu. Nabu was summoned, and “Before the gods the son of his father came.” His main accuser was Utu/ Shamash, who, describing the dire situation, said, “all this Nabu has caused to happen.” Speaking for his father, Nabu blamed Ninurta, and revived the old accusations against Nergal in regard to the disappearance of the pre-Diluvial monitoring instruments and the failure to prevent sacrileges in Babylon; he got into a shouting match with Nergal, and “showing disrespect . . . to Enlil evil he spoke: ‘There is no justice, destruction was conceived, Enlil against Babylon caused evil to be planned.’ ” It was an unheard-of accusation against the Lord of the Command. Enki spoke up, but it was in defense of his son, not of Enlil. What are Marduk and Nabu actually accused of? he asked. His ire was directed especially at his son Nergal: “Why do you continue the opposition?” he asked him. The two argued so much that in the end Enki shouted to Nergal to get out of his presence. The gods’ councils broke up in disarray. But all these debates, accusations, and counteraccusations were taking place against the increasingly realized fact— what Marduk referred to as the Celestial Oracle: with the passage of time—with the crucial shift of the precessional clock by one degree—the Age of the Bull, the zodiacal age of Enlil, was coming to an end, and the Age of the Ram, Marduk’s Age, was looming in the heavens. Ninurta could see it coming at his Eninnu temple in Lagash (which Gudea built); Ningishzidda/Thoth could confirm it from all the stone circles that he had erected elsewhere on Earth; and the people knew it, too.
82
THE END OF DAYS
It was then that Nergal—vilified by Marduk and Nabu, ordered out by his father Enki—“consulting with himself,” concocted the idea of resort to the “Awesome Weapons.” He did not know where they were hidden, but knew that they existed on Earth, locked away in a secret underground place (according to a text catalogued as CT-xvi, lines 44–46, somewhere in Africa, in the domain of his brother Gibil): Those seven, in the mountains they abide; In a cavity inside the earth they dwell. Based on our current level of technology, they can be described as seven nuclear devices: “Clad with terror, with a brilliance they rush forth.” They were brought to Earth unintentionally from Nibiru and were hidden away in a secret safe place a long time ago; Enki knew where, but so did Enlil. A War Council of the gods, overruling Enki, voted to follow Nergal’s suggestion to give Marduk a punishing blow. There was constant communication with Anu: “Anu to Earth the words was speaking, Earth to Anu the words pronounced.” He made it clear that his approval for the unprecedented step was limited to depriving Marduk of the Sinai spaceport, but that neither gods nor people should be harmed: “Anu, lord of the gods, on the Earth had pity,” the ancient records state. Choosing Nergal and Ninurta to carry out the mission, the gods made absolutely clear to them its limited and conditional scope. But that is not what happened: The “Law of Unintended Consequences” proved itself true on a catastrophic scale. In the aftermath of the calamity that resulted in the death of countless people and the desolation of Sumer, Nergal dictated to a trusted scribe his own version of the events, trying to exonerate himself. The long text is known as the Erra Epos, for it refers to Nergal by the epithet Erra (“The Annihilator”) and to Ninurta as Ishum (“The Scorcher”). We can put together the true story by adding to this text information from several other Sumerian, Akkadian, and biblical sources.
Gone with the Wind
83
Thus we find that no sooner was the decision reached than Nergal rushed to Gibil’s African domain to find and retrieve the weapons, not waiting for Ninurta. To his dismay Ninurta learnt that Nergal was disregarding the objective’s limits, and was going to use the weapons indiscriminately to settle personal accounts: “I shall annihilate the son, and let the father bury him; then I shall kill the father, and let no one bury him,” Nergal has boasted. While the two argued, word reached them that Nabu was not sitting still: “From his temple to marshall all his cities he set his step, toward the Great Sea he set his course; the Great Sea he entered, sat upon a throne that was not his.” Nabu was not only converting the western cities, he was taking over the Mediterranean islands, and setting himself up as their ruler! Nergal/Erra thus argued that destroying the spaceport was not enough: Nabu, and the cities that rallied to him, also had to be punished, destroyed! Now, with two targets, the Nergal-Ninurta team saw another problem: Would the “upheavaling” of the spaceport not sound the alarm for Nabu and his sinning followers to escape? Reviewing their targets, they found the solution in splitting up: Ninurta would attack the spaceport; Nergal would attack the nearby “sinning cities.” But as all this was agreed upon, Ninurta had second thoughts; he insisted that not only the Anunnaki who manned the space facilities should be forewarned, but that even certain people should be forewarned: “Valiant Erra,” he told Nergal, “will you the righteous destroy with the unrighteous? Will you destroy those who against you have not sinned with those who against you have sinned?” Nergal/Erra, the ancient text states, was persuaded: “The words of Ishum appealed to Erra as fine oil.” And so, one morning, the two, sharing the seven nuclear explosives between them, set out on their ultimate Mission: Then did the hero Erra go ahead, remembering the words of Ishum. Ishum too went forth in accordance with the words given, a squeezing in his heart.
84
THE END OF DAYS
The available texts even tell us who went to what target: “Ishum to the Mount Most Supreme set his course” (we know that the spaceport was beside this mount from the Epic of Gilgamesh). “Ishum raised his hand: the Mount was smashed . . . That which was raised toward Anu to launch was caused to wither, its face was made to fade away, its place was made desolate.” In one nuclear blow, the spaceport and its facilities were obliterated by the hand of Ninurta. The ancient text then describes what Nergal did: “Emulating Ishum, Erra the Way of the King followed, the cities he finished off, to desolation he overturned them”; his targets were the “sinning cities” whose kings had formed the alliance against the Kings of the East, the plain in the south of the Dead Sea. And so it was that in the year 2024 b.c.e. nuclear weapons were unleashed in the Sinai Peninsula and in the nearby Plain of the Dead Sea; and the spaceport and the Five Cities were no more. Amazingly, yet no wonder if Abraham and his mission in Canaan is understood the way we explain it, it is in this apocalyptic event that the biblical record and the Mesopotamian texts converge. We know from the Mesopotamian texts relating the events that, as required, the Anunnaki guarding the spaceport were forewarned: “The two [Nergal and Ninurta], incited to commit the evil, made its guardians stand aside; the gods of that place abandoned it—its protectors went up to the heights of heaven.” But while the Mesopotamian texts reiterate that “the two made the gods flee, made them flee the scorching,” they are ambiguous regarding whether that advance notice was also extended to the people in the doomed cities. It is here that the Bible provides missing details: we read in Genesis that both Abraham and his nephew Lot were indeed forewarned—but not the other residents of the “sinning cities.” The biblical report, apart from throwing light on the “upheavaling” aspects of the events, contains details that shed an amazing light on the gods in general and on their relation-
Gone with the Wind
85
ship with Abraham in particular. The story begins in Chapter 18 of Genesis when Abraham, now ninety-nine years old, sitting at the entrance to his tent on a hot midday, “lifted his eyes” and all of a sudden saw “three men standing above him.” Though they are described as Anashim, “men,” there was something different or unusual about them, for he rushed out of his tent and bowed to the ground, and—referring to himself as their servant—washed their feet and offered them food. As it turned out, the three were divine beings. As they leave, their leader—now identified as the Lord God—decides to reveal to Abraham the trio’s mission: to determine whether Sodom and Gomorrah are indeed sinning cities whose upheavaling is justified. While two of the three continue toward Sodom, Abraham approaches and reproaches (!) God with words that are identical to those in the Mesopotamian text: Wilt thou destroy the righteous with the unrighteous? (Genesis 18: 23). What followed was an incredible bargaining session between Man and God. “Perchance there are fifty righteous within the city—Wilt thou destroy, and not spare the city on account of the fifty righteous within it?” Abraham asked God. When told that, well, the city would be spared if fifty righteous men reside there, Abraham said, what about just forty? What about only thirty? And so it went, down to ten . . . “And Yahweh went away as soon as he had finished speaking, and Abraham returned to his place.” The other two divine beings—the tale’s continuation in Chapter 19 calls them Mal’achim, literally “emissaries” but commonly translated “Angels”—arrived in Sodom in the evening. The happenings there confirmed its people’s wickedness, and at daybreak the two urged Abraham’s nephew Lot to escape with his family, for “Yahweh is about to destroy the city.” The lingering family asked for more time, and one of the “angels” agreed to have the upheaval delayed long enough for Lot and his family to reach the safer mountain. “And Abraham got up early in the morning . . . and he looked toward Sodom and Gomorrah and toward all the land of the Plain, and beheld, and lo—vapor went up from the earth as the smoke of a furnace.”
86
THE END OF DAYS
Abraham was then ninety-nine years old; having been born in 2123 b.c.e., the time had to be 2024 b.c.e. The convergence of the Mesopotamian texts with the biblical narrative of Genesis concerning the upheaval of Sodom and Gomorrah is at once one of the most significant confirmations of the Bible’s veracity in general and of Abraham’s status and role in particular—and yet one of the most shunned by theologians and other scholars, because of its report of the events of the preceding day, the day three Divine Beings (“Angels” who looked like men) had paid Abraham a visit— it smacks too much of an “Ancient Astronauts” tale. Those who question the Bible or treat the Mesopotamian texts as just myths have sought to explain the destruction of Sodom and Gomorrah as some natural calamity, yet the biblical version confirms twice that the “upheaval” by “fire and sulfur” was not a natural calamity but a premeditated, postponable and even cancellable event: once when Abraham bargained with The Lord to spare the cities so as not to destroy the righteous with the unjust, and again when his nephew Lot obtained a postponement of the upheaval. Photographs of the Sinai Peninsula from space (Fig. 34) still show the immense cavity and the crack in the surface where the nuclear explosion had taken place. The area itself is strewn, to this day, with crushed, burnt, and blackened rocks (Fig. 35);”) (Fig. 36). Attempts by Israeli archaeologists to explore the seabed there have revealed the existence of enigmatic underwater ruins, but the Hashemite Kingdom of Jordan, in whose half of the Dead Sea the ruins are, put a stop to further exploration. Interestingly, the relevant Mesopotamian texts confirm the topographic change and even suggest that the sea became a Dead Sea as a result of the nuclear bombing: Erra, they tell, “Dug
Figure 34
Figure 35
88
THE END OF DAYS
Figure 36
through the sea, its wholeness he divided; that which lives in it, even the crocodiles, he made wither.� The two, as it turned out, did more than destroy the spaceport and the sinning cities: as a result of the nuclear explosions, A storm, the Evil Wind, went around in the skies. And the chain reaction of unintended consequences began.
Gone with the Wind
89
The historical records show that the Sumerian civilization collapsed in the sixth year of the reign in Ur of Ibbi-Sin— in 2024 b.c.e. It was, the reader will recall, the very year in which Abraham was ninety-nine years old . . . Scholars assumed at first that Sumer’s capital, Ur, was overrun by “barbarian invaders”; but no evidence for such a destructive invasion was found. A text titled “A Lamentation Over the Destruction of Ur” was then discovered; it puzzled the scholars, for it bewailed not the physical destruction of Ur but its “abandonment”: the gods who had dwelt there abandoned it, the people who dwelt there were gone, its stables were empty; the temples, the houses, the sheepfolds remained intact—standing, but empty. Other lamentation texts were then discovered. They lamented not just Ur, but all of Sumer. Again they spoke of “abandonment”: not only did the gods of Ur, Nannar, and Ningal abandon Ur; Enlil, “the wild bull,” abandoned his beloved temple in Nippur; his spouse Ninlil was also gone. Ninmah abandoned her city Kesh; Inanna, “the queen of Erech,” abandoned Erech; Ninurta forsook his temple Eninnu; his spouse Bau was also gone from Lagash. One Sumerian city after another was listed as having been “abandoned,” without their gods, people, or animals. The scholars were now puzzling over some “dire catastrophe,” a mysterious calamity that affected the whole of Sumer. What could it be? The answer to the puzzle was right there in those texts: Gone with the wind. No, this is not a play of words on the title of a famous book/ movie. That was the refrain in the Lamentation Texts: Enlil has abandoned his temple, he was “gone by the wind.” Ninlil from her temple was “gone by the wind.” Nannar has abandoned Ur—his sheepfolds were “gone by the wind”; and so on and on. The scholars have assumed that this repetition of the words was a literary device, a refrain that the lamenters repeated over and over again to highlight their grief. But that was no literary device—that was the literal truth: Sumer and its cities were literally emptied as a result of a wind. An “Evil Wind,” the lamentation (and then other texts) reported, came blowing and caused “a calamity, one unknown
90
THE END OF DAYS
to men, to befall the land.” It was an Evil Wind that “caused cities to be desolate, caused houses to be desolate, caused stalls to be desolate, the sheepfolds to be emptied.” There was desolation, but no destruction; emptiness, but no ruins: the cities were there, the houses were there, the stalls and sheepfolds were there—but nothing alive remained; even “Sumer’s rivers flow with water that is bitter, the once cultivated fields grow weeds, in the meadows the plants have withered.” All life is gone. It was a calamity that had never happened before— On the Land Sumer a calamity fell, One unknown to men. One that had never been seen before, One which could not be withstood. Carried by the Evil Wind, it was a death from which there was no escape: it was a death “which roams the street, is let loose in the road . . . The highest wall, the thickest wall, it passes like a flood; no door can shut it out, no bolt can turn it back.” Those who hid behind doors were felled inside; those who ran to the rooftops died on the roofs. It was an unseen death: “It stands beside a man, yet no one can see it; when it enters a house, its appearance is unknown.” It was a grusesome death: “Cough and phlegm weakened the chest, the mouth was filled with spittle, dumbness and daze have come upon them . . . an overwhelming dumbness . . . a headache.” As the Evil Wind clutched its victims, “their mouths were drenched with blood.” The dead and dying were everywhere. The texts make clear that the Evil Wind, “bearing gloom from city to city,” was not a natural calamity; it resulted from a deliberate decision of the great gods. It was caused by “a great storm ordered by Anu, a [decision] from the heart of Enlil.” And it was the result of a single event—“spawned in a single spawning, in a lightning flash”—an event that occurred far away in the west: “From the midst of the mountains it had come, from the Plain of No-Pity it had
Gone with the Wind
91
come . . . Like a bitter venom of the gods, from the west it had come.” That the cause of the Evil Wind was the nuclear “upheaval” back in and near the Sinai peninsula was made clear when the texts asserted that the gods knew its source and cause—a blast, an explosion: An evil blast heralded the baleful storm, An evil blast was its forerunner. Mighty offspring, valiant sons, were the heralds of the pestilence. The authors of the lamentation texts, the gods themselves, left us a vivid record of what had taken place. As soon as the Awesome Weapons were launched from the skies by Ninurta and Nergal, “they spread awesome rays, scorching everything like fire.” The resulting storm “in a flash of lightning was created.” A “dense cloud that brings doom”—a nuclear “mushroom”—then rose to the sky, followed by “rushing wind gusts . . . a tempest that scorches the heavens.” It was a day not to be forgotten: On that day, When heaven was crushed and the Earth was smitten, its face obliterated by the maelstrom— When the skies were darkened and covered as with a shadow— On that day the Evil Wind was born. The various texts kept attributing the venomous maelstrom to the explosion at the “place where the gods ascend and descend”—to the obliteration of the spaceport, rather than to the destruction of the “sinning cities.” It was there, “in the midst of the mountains,” that the nuclear mushroom cloud arose in a brilliant flash—and it was from there that the prevailing winds, coming from the Mediterranean Sea, carried the poisonous nuclear cloud eastward, toward Sumer, and
92
THE END OF DAYS
there it caused not destruction but a silent annihilation, bringing death by nuclear poisoned air to all that lives. It is evident from all the relevant texts that, with the possible exception of Enki, who had protested and warned against the use of the Awesome Weapons, none of the gods involved expected the eventual outcome. Most of them were Earthborn, and to them the tales of the nuclear wars on Nibiru were Tales of the Elders. Did Anu, who should have known better, think perhaps that the weapons, hidden so long ago, would hardly work or not work at all? Did Enlil and Ninurta (who had come from Nibiru) assume that the winds, if at all, would blow the nuclear cloud toward the desolate deserts that are now Arabia? There is no satisfactory answer; the texts only state that “the great gods paled at the storm’s immensity.” But it is clear that as soon as the direction of the winds and the intensity of the nuclear venom were realized, an alarm was sounded for those in the wind’s path—gods and people alike—to run for their lives. The panic, fear, and confusion that overtook Sumer and its cities as the alarm was sounded are vividly described in a series of lamentation texts, such as the Ur Lamentation, the Lamentation over the Desolation of Ur and Sumer, The Nippur Lamentation, The Uruk Lamentation, and others. As far as the gods were concerned, it appears that it was by and large “each man for himself ”; using their varied craft, they took off by air and by water to get out of the wind’s path. As for the people, the gods did sound the alarm before they fled. As described in The Uruk Lamentation, “Rise up! Run away! Hide in the steppe!” the people were told in the middle of the night. “Seized with terror, the loyal citizens of Uruk” ran for their lives, but they were felled by the Evil Wind anyway. The picture, though, was not identical everywhere. In Ur, the capital, Nannar/Sin was so incredulous that he refused to believe that Ur’s fate has been sealed. His long and emotional appeal to his father Enlil to avert the calamity is recorded in the Ur Lamentation (which was composed by Ningal, Nannar’s spouse); so is Enlil’s blunt admission of inevitability:
Gone with the Wind
93
Ur was granted kingship— An eternal reign it was not granted . . . Unwilling to accept the inevitable and too devoted to the people of Ur to abandon them, Nannar and Ningal decided to stay put. It was daytime when the Evil Wind approached Ur; “of that day I still tremble,” Ningal wrote, “but of that day’s foul smell we did not flee.” As doomsday came, “a bitter lament was raised in Ur, but of its foulness we did not flee.” The divine couple spent the night of nightmares in the “termite house,” an underground chamber deep inside their ziggurat. By morning, as the venomous wind “was carried off from the city,” Ningal realized that Nannar was ill. She hastily put on garments and had the god carried out and away from Ur, the city that they loved. At least another deity was also harmed by the Evil Wind; she was Ninurta’s spouse Bau, who was alone in Lagash (for her husband was busy destroying the spaceport). Loved by the people, who called her “Mother Bau,” she was trained as a healing physician, and just could not force herself to leave. The lamentations record that “On that day, the storm caught up with the Lady Bau; as if she was a mortal, the storm caught up with her.” It is not clear how badly she was stricken, but subsequent records from Sumer suggest that she did not survive long thereafter. Eridu, Enki’s city, lying farthest to the south, was apparently at the edge of the Evil Wind’s path. We learn from The Eridu Lament that Ninki, Enki’s spouse, flew away from the city to a safe haven in Enki’s African Abzu: “Ninki, the Great Lady, flying like a bird, left her city.” But Enki himself departed from the city only far enough to get out of the Evil Wind’s way: “The Lord of Eridu stayed outside his city . . . for the fate of his city he wept with bitter tears.” Many of Eridu’s citizens followed him, camping in the fields at a safe distance as they watched—for a day and a half—the storm “put its hand on Eridu.” Amazingly, the least affected of all the land’s major centers was Babylon, for it lay beyond the storm’s northern edge. As the alert was sounded, Marduk contacted his father to
94
THE END OF DAYS
seek advice: What are the people of Babylon to do? he asked. Those who can escape should go north, Enki told him; and in the manner of the two “Angels” who had advised Lot and his family not to look back when they fled Sodom, so did Enki instruct Marduk to tell his followers “neither to turn nor to look back.” If escape was not possible, the people should seek shelter underground: “Get them into a chamber below the earth, into a darkness,” was Enki’s advice. Following this advice, and due to the wind’s direction, Babylon and its people were unharmed. As the Evil Wind passed and blew away (its remnants, we learn, reached the Zagros Mountains farther east), it left Sumer desolate and prostrate. “The storm desolated the cities, desolated the houses.” The dead, lying where they fell, remained unburied: “The dead people, like fat placed in the sun, of themselves melted away.” In the grazing lands, “cattle large and small became scarce, all living creatures came to an end.” The sheepfolds “were delivered to the Wind.” The cultivated fields withered; “on the banks of the Tigris and the Euphrates only sickly weeds grew, in the swamps the reeds rotted in a stench.” “No one treads the highways, no one seeks out the roads.” “Oh Temple of Nannar in Ur, bitter is thy desolation!” the lamentation poems bewailed; “Oh Ningal whose land has perished, make thy heart like water!” The city has become a strange city, how can one now exist? The house has become a house of tears, it makes my heart like water. Ur and its temples have been delivered to the Wind. After two thousand years, the great Sumerian civilization was gone with the wind. In recent years archaeologists have been joined by geologists, climatologists, and other earth sciences experts for multidisciplinary efforts to tackle the enigma of the abrupt
Gone with the Wind
95
collapse of Sumer & Akkad at the end of the third millennium b.c.e. A trend-setting study was one by an international group of seven scientists from different disciplines titled “Climate Change and the Collapse of the Akkadian Empire: Evidence from the Deep Sea,” published in the scientific journal Geology in its April 2000 issue. Their research used radiological and chemical analysis of ancient dust layers from that period obtained from various Near Eastern sites, but primarily from the bottom of the Gulf of Oman; their conclusion was that an unusual climate change in the areas adjoining the Dead Sea gave rise to dust storms and that the dust—an unusual “atmospheric mineral dust”—was carried by the prevailing winds over southern Mesopotamia all the way beyond the Persian Gulf (Fig. 37)—the very pattern of Sumer’s Evil Wind! Carbon dating of the unusual “fallout dust” led to the conclusion that it was due to an “uncommon dramatic event
Figure 37
96
THE END OF DAYS
that occurred near 4025 years before the present.” That, in other words, means “near 2025 b.c.e.”—the very 2024 b.c.e. indicated by us! Interestingly, the scientists involved in that study observed in their report that “the Dead Sea level fell abruptly by 100 meters at that time.” They leave the point unexplained—but obviously the breach of the Dead Sea’s southern barrier and the flooding of the Plain, as described by us, explain what had happened. b.c.e.
7 DESTINY HAD FIFTY NAMES
The resort to nuclear weapons at the end of the twenty-first century b.c.e. ushered—one could say, “with a bang”—the Era of Marduk. It was, in almost all respects, truly a New Age, even the way we understand the term nowadays. Its greatest paradox was that while it made Man look to the heavens, it brought the gods of the heavens down to Earth. The changes that New Age has wrought affect us to this day. For Marduk the New Age was a wrong righted, an ambition attained, prophecies fulfilled. The price paid—the desolation of Sumer, the flight of its gods, the decimation of its people—was not his doing. If anything, those who suffered were punished for obstructing Destiny. The unforeseen nuclear storm, the Evil Wind, and its course that seemed selectively guided by an unseen hand only confirmed what the Heavens proclaimed: the Age of Marduk, the Age of the Ram, has arrived. The change from the Age of the Bull to the Age of the Ram was especially celebrated and marked in Marduk’s homeland, Egypt. Astronomical depictions of the heavens (such as at the Denderah temple, see Fig. 20) showed the constellation of the Ram as the focal point of the zodiacal cycle. Lists of zodiacal constellations began not with the Bull as in Sumer, but with the Ram (Fig. 38). The most impressive manifestations were the rows of Ram-headed sphinxes that flanked the processional way to the great temples in Karnak (Fig. 39), whose construction, by Pharaohs of the newly established Middle Kingdom, began right after Ra/
Figure 38
Destiny Had Fifty Names
99
Figure 39 Marduk’s ascent to supremacy. They were Pharaohs who bore theophoric names honoring Amon/Amen, so that both temples and kings were dedicated to Marduk/Ra as Amon, The Unseen, for Marduk, absenting himself from Egypt, selected Babylon in Mesopotamia to be his Eternal City. Both Marduk and Nabu survived the nuclear maelstrom unharmed. Although Nabu was personally targeted by Nergal/ Erra, he apparently hid on one of the Mediterranean islands and escaped harm. Subsequent texts indicate that he was given his own cult center in Mesopotamia called Borsippa, a new city situated near his father’s Babylon, but he continued to roam and be worshipped in his favorite Lands of the West. His veneration both there and in Mesopotamia is attested to by sacred places named in his honor—such as Mount Nebo near the Jordan River (where Moses later died)—and the theophoric royal names (such as Nabo-pol-assar, Nebo-chadnezzar, and many others) by which famous kings of Babylon were called. And his name, as we have noted, became synonymous with “prophet” and prophecy throughout the ancient Near East. Marduk himself, it will be recalled, was asking “Until
100
THE END OF DAYS
when?” from his command post in Harran when the fateful events took place. In his autobiographical text The Marduk Prophecy he envisioned the coming of a Messianic Time, when gods and men will recognize his supremacy, when peace shall replace war and abundance will banish suffering, when a king of his choice “will make Babylon the foremost” with the Esagil temple (as its name meant) raising its head to heaven— A king in Babylon will arise; In my city Babylon, in its midst, my temple to heaven he will raise; The mountainlike Esagil he will renew, the ground plan of Heaven-Earth for the mountainlike Esagil he will draw; The Gate of Heaven will be opened. In my city Babylon a king will arise; In abundance he will reside; My hand he will grasp, He will lead me in processions . . . To my city and my temple Esagil for eternity I shall enter. That new Tower of Babel, however, was not intended (as the first one was) as a launch tower. His supremacy, Marduk recognized, was now stemming not only from the possession of a physical space connection but from the Signs of Heaven—from the zodiacal Celestial Time, from the position and movement of the celestial bodies, the Kakkabu (stars/planets) of heaven. Accordingly, he envisioned the future Esagil as the reigning astronomical observatory, making redundant Ninurta’s Eninnu and the varied stonehenges erected by Thoth. When the Esagil was eventually built, it was a ziggurat erected according to detailed and precise plans (Fig. 40): its height, the spacing of its seven stages, and its orientation were such that its head pointed directly to the star Iku—the lead star of the constellation of the Ram—circa 1960 b.c.e. The nuclear apocalypse and its unintended consequences
Destiny Had Fifty Names
101
Figure 40 brought to an abrupt end the debate regarding whose zodiacal age it was; Celestial Time was now Marduk’s Time. But the gods’ planet, Nibiru, was still orbiting and clocking Divine Time—and Marduk’s attention shifted to that. As his Prophecy text made clear, he now envisioned astronomerpriests scanning the skies from the ziggurat’s stages for “The rightful planet of the Esagil”: Omen-knowers, put to service, shall then ascend its midst. Left and right, on opposite sides, they shall separately stand. The king will then approach; The rightful Kakkabu of the Esagil over the land [he will observe].
102
THE END OF DAYS
A Star-Religion was born. The god—Marduk—became a star; a star (we call it planet)—Nibiru—became “Marduk.” Religion became Astronomy, Astronomy became Astrology. In conformity with the new Star Religion, the Epic of Creation, Enuma Elish, was revised in its Babylonian version so as to grant Marduk a celestial dimension: he did not just come from Nibiru—he was Nibiru. Written in “Babylonian,” a dialect of Akkadian (the Semitic mother language), it equated Marduk with Nibiru, the home planet of the Anunnaki, and gave the name “Marduk” to the Great Star/Planet that had come from deep space to avenge both the celestial Ea and the one on Earth (Fig. 41). It thus made “Marduk” the “Lord” in Heaven as on Earth. His Destiny—in the heavens, his orbit—was the greatest of all the celestial gods (the other planets) (see Fig. 1); paralleling that, he was destined to be the greatest of the Anunnaki gods on Earth. The revised Epic of Creation was read publicly on the fourth night of the New Year festival. It credited Marduk with the defeat of the “monster” Tiamat in the Celestial Battle, the creation of the Earth (Fig. 42), and the reshaping of the Solar system (Fig. 43)—all the feats that in the original
Figure 41
Destiny Had Fifty Names
103
Figure 42
Sumerian version were attributed to the planet Nibiru as part of a sophisticated scientific cosmogony. The new version then credited Marduk even with the “artful fashioning” of “Man,” with devising the calendar, and with the selection of Babylon to be the “Navel of the Earth.” The New Year festival—the most important religious event of the year—began on the first day of the month Nissan, coinciding with the Spring Equinox. Calling it in Babylon the Akiti festival, it evolved there into a twelve-day-long celebration from the Sumerian ten-day A.KI.TI (“On Earth Bring Life”) festival. It was conducted according to elaborately defined ceremonies and prescribed rituals that reenacted (in Sumer) the tale of Nibiru and the coming of the Anunnaki to Earth, as well as (in Babylon) the life story of Marduk. It included episodes from the Pyramid Wars, when
104
THE END OF DAYS
Figure 43
he was sentenced to die in a sealed tomb, and his “resurrection” when he was brought out of it alive; his exile to become the Unseen; and his final victorious Return. Processions, comings and goings, appearances and disappearances, and even passion plays with actors visually and vividly presented Marduk to the people as a suffering god—suffering on Earth but finally victorious by gaining supremacy through a heavenly counterpart. (The New Testament’s Jesus story was so
Destiny Had Fifty Names
105
similar that scholars and theologians in Europe debated a century ago whether Marduk was the “Prototype Jesus.”) The ceremonies consisted of two parts. The first involved a solitary boat ride by Marduk upon and across the river, to a structure called Bit Akiti (“House of Akiti”); the other took place within the city itself. It is evident that the solitary part symbolized Marduk’s celestial travel from the home planet’s outer location in space to the inner solar system—a journey in a boat upon waters, in conformity with the concept that interplanetary space was a primeval “Watery Deep” to be traversed by “celestial boats” (spacecraft)—a concept represented graphically in Egyptian art, where the celestial gods were depicted as coursing in the skies in “celestial barques” (Fig. 44). It was upon Marduk’s successful return from the outer and lonely Bit Akiti that the public festivities began. Those public and joyous ceremonies started with the greeting of Marduk at the wharf by other gods, and his accompaniment by the king and priests in a Sacred Procession, attended by everlarger crowds. The descriptions of the procession and its route were so detailed that they guided the archaeologists who excavated ancient Babylon. From the texts inscribed on clay tablets and from the unearthed topography of the city, it emerged that there were seven stations at which the sacred procession made stops for prescribed rituals. The stations bore both Sumerian and Akkadian names and symbolized
Figure 44
106
THE END OF DAYS
(in Sumer) the travels of the Anunnaki within the solar system (from Pluto to Earth, the seventh planet), and (in Babylon) the “stations” in Marduk’s life story: his divine birth in the “Pure Place”; how his birthright, his entitlement to supremacy, was denied; how he was sentenced to death; how he was buried (alive, in the Great Pyramid); how he was rescued and resurrected; how he was banished and went into exile; and how in the end even the great gods, Anu and Enlil, bowed to destiny and proclaimed him supreme. The original Sumerian Epic of Creation extended over six tablets (paralleled by the biblical six days of creation). In the Bible, God rested on the seventh day, using it to review His handiwork. The Babylonian revision of the Epic culminated with the addition of a seventh tablet that was entirely devoted to the glorification of Marduk by the granting to him of fifty names—an act that symbolized the assumption by him of the Rank of Fifty that was until then Enlil’s (and to which Ninurta had been in line). Starting with his traditional name MAR.DUK, “son of the Pure Place,” the names—alternating between Sumerian and Akkadian—granted him epithets that ranged from “Creator of All” to “Lord who fashioned Heaven and Earth” and other titles relating to the celestial battle with Tiamat and the creation of the Earth and the Moon: “Foremost of all the gods,” “Allotter of tasks to the Igigi and the Anunnaki” and their Commander, “The god who maintains life . . . the god who revives the dead,” “Lord of all the lands,” the god whose decisions and benevolence sustain Mankind, the people he had fashioned, “Bestower of cultivation,” who causes rains to enrich the crops, allocates fields, and “heaps abundance” for gods and people alike. Finally, he was granted the name NIBIRU, “He who shall hold the Crossing of Heaven and Earth”: The Kakkabu which in the skies is brilliant . . . He who the Watery Deep ceaselessly courses— Let “Crossing” be his name! May he uphold the courses of the stars in heaven, May he shepherd the heavenly gods as sheep.
Destiny Had Fifty Names
107
“With the title ‘Fifty’ the great gods proclaimed him; He whose name is ‘Fifty’ the gods made supreme,” the long text states in conclusion. When the nightlong reading of the seven tablets was completed—it probably was dawn by then—the priests who conducted the ritual service made the following prescribed pronouncements: Let the Fifty Names be kept in mind . . . Let the wise and knowing discuss them. Let the father recite them to his son, Let the ears of shepherds and herdsmen be opened. Let them rejoice in Marduk, the “Enlil” of the gods, whose order is firm, whose command is unalterable; The utterance of his mouth no god can change. When Marduk appeared in sight of the people, he was dressed in magnificent vestments that put to shame the simple wool garments of the olden gods of Sumer & Akkad (Fig. 45). Although Marduk was an unseen god in Egypt, his veneration and acceptance there took hold rather quickly. A Hymn
Figure 45
108
THE END OF DAYS
to Ra-Amon that glorified the god by a variety of names in emulation of the Akkadian Fifty Names called him “Lord of the gods, who behold him in the midst of the horizon”—a celestial god—“who made the entire Earth,” as well as a god on Earth “who created mankind and made the beasts, who created the fruit tree, made herbage and gave life to cattle”— a god “for whom the sixth day is celebrated.” The snippets of similarities to the Mesopotamian and the biblical creation tales are clear. According to these expressions of faith, on Earth, in Egypt, Ra/Marduk was an unseen god because his main abode was elsewhere—one long hymn actually referred to Babylon as the place where the gods are in jubilation for his victory (scholars, though, assume the reference is not to the Mesopotamian Babylon, but to a town by that name in Egypt). In the heavens he was unseen, because “he is far away in heaven,” because he went “to the rear of the horizons . . . to the height of heaven.” Egypt’s reigning symbol—a Winged Disc usually flanked by serpents—is commonly explained as a Sun disc “because Ra was the Sun”; but, in fact, it was the ancient world’s ubiquitous symbol of Nibiru (Fig. 46), and it was Nibiru that has become a distant unseen “star.” Because Ra/Marduk was physically absent from Egypt, it was in Egypt that his Star Religion was expressed in its clearest form. There, Aten, the “Star of Millions of Years” representing Ra/Marduk in his celestial aspect, became The Unseen because it was “far away in heaven,” because it had gone “to the rear of the horizon.” The transition to Marduk’s New Age and new religion was not so smooth in the Enlilite lands. First, southern Mesopotamia and the western lands that were in the path of the poisonous wind had to recover from its impact. The calamity that befell Sumer, it will be recalled, was not the nuclear explosion per se but the ensuing radioactive wind. The cities were emptied of their residents and livestock, but were physically undamaged. The waters were poisoned, but the flowing two great rivers soon corrected that. The soil ab-
Destiny Had Fifty Names
109
Figure 46 sorbed the radioactive poison, and that took longer to recover; but that, too, improved with time. And so it was possible for people to slowly repopulate and reinhabit the desolated land. The first recorded administrative ruler in the devastated south was an ex-governor of Mari, a city way northwest on the Euphrates River. We learn that “he was not of Sumerian seed”; his name, Ishbi-Erra, was in fact a Semitic name. He established his headquarters in the city of Isin, and from there he oversaw the efforts to resurrect the other major cities, but the process was slow, difficult, and at times chaotic. His efforts at rehabilitation were continued by several successors, also bearing Semitic names, the so-called “Dynasty of Isin.” All together, it took them close to a century to revive Ur, Sumer’s economic center, and ultimately Nippur, the land’s traditional religious heart; but by then that
110
THE END OF DAYS
city-at-a-time process ran into challenges from other local city rulers, and the erstwhile Sumer remained fragmented and a broken land. Even Babylon itself, though outside the Evil Wind’s direct path, needed a revived and repopulated country if it was to rise to imperial size and status, and it did not attain the grandeur of Marduk’s prophecies for quite some time. More than a century had to pass until a formal dynasty, called by scholars the First Dynasty of Babylon, was installed on its throne (circa 1900 b.c.e.). Yet another century had to pass until a king who lived up to the prophesied greatness sat on Babylon’s throne; his name was Hammurabi. He is mostly known for the code of laws proclaimed by him—laws recorded on a stone stela that archaeologists have discovered (and that is now in the Louvre in Paris). It still took some two centuries before Marduk’s prophetic vision regarding Babylon could come true. The meager evidence from the postcalamity time—some scholars refer to the period following the demise of Ur as a Dark Age in Mesopotamian history—suggests that Marduk let the other gods—even his adversaries—take care of the recovery and repopulation of their own olden cult centers, but it is doubtful that they took up his invitation. The recovery and rebuilding that were started by Ishbi-Erra began at Ur, but there is no mention of Nannar/Sin and Ningal returning to Ur. There is mention of Ninurta’s occasional presence in Sumer, especially in regard to its garrisoning by troops from Elam and Gutium, but there is no record that he or his spouse Bau ever returned to their beloved Lagash. The efforts by Ishbi-Erra and his successors to restore the cult centers and their temples culminated—after the passage of seventy-two years—at Nippur, but there is no mention that Enlil and Ninlil resumed residence there. Where had they gone? One avenue of exploring that intriguing subject was to ascertain what Marduk himself—now supreme and claiming to be the giver of commands to all the Anunnaki—had planned for them. The textual and other evidence from that time show that Marduk’s rise to supremacy did not end polytheism—the re-
Destiny Had Fifty Names
111
ligious beliefs in many gods. On the contrary, his supremacy required continued polytheism, for to be supreme over other gods, the existence of other gods was necessary. He was satisfied to let them be, as long as their prerogatives were subject to his control; a Babylonian tablet recorded (in its undamaged portion) the following list of divine attributes that were henceforth vested in Marduk: Ninurta Nergal Zababa Enlil Sin Shamash Adad
is is is is is is is
Marduk of the hoe Marduk of the attack Marduk of the combat Marduk of lordship and counsel Marduk the illuminator of the night Marduk of justice Marduk of rains
The other gods remained, their attributes remained—but they now held attributes of Marduk that he granted to them. He let their worship be continued; the very name of the interim ruler/administrator in the south, Ishbi-Erra (“Priest of Erra,” i.e., of Nergal) confirms this tolerant policy. But what Marduk expected was that they come and stay with him in his envisaged Babylon—prisoners in golden cages, one may say. In his autobiographical Prophecies Marduk clearly indicated his intentions in regard to the other gods, including his adversaries: they were to come and reside next to him, in Babylon’s sacred precinct. Sanctuaries or pavilions for Sin and Ningal, where they would reside—“together with their treasures and possessions”!—are specifically mentioned. Texts describing Babylon, and archaeological excavations there, show that in accordance with Marduk’s wishes, Babylon’s sacred precinct also included residence-shrines dedicated to Ninmah, Adad, Shamas, and even Ninurta. When Babylon finally rose to imperial power—under Hammurabi—its ziggurat-temple indeed reached skyward; the prophesied great king in time did sit on its throne; but to its priest-filled sacred precinct, the other gods did not flock. That manifestation of the New Religion did not come about.
112
THE END OF DAYS
Figure 47
Looking at the Hammurabi stela recording his law code (Fig. 47), we see him receiving the laws from none other than Utu/Shamash—the very one, according to the abovequoted list, whose prerogatives as God of Justice now belonged to Marduk; and the preamble inscribed on the stela invoked Anu and Enlil—the one whose “Lordship and Counsel” were presumably taken over by Marduk—as the gods to whom Marduk was beholden for his status: Lofty Anu, Lord of the gods who from heaven to Earth came, and Enlil, Lord of Heaven and Earth who determines the Land’s destinies, Determined for Marduk, the firstborn of Enki, the Enlil-functions over all mankind. These acknowledgments of the continued empowerment of Enlilite gods, two centuries after the Age of Marduk began, reflect the actual state of affairs: They did not come to retire in Marduk’s sacred precinct. Dispersed away from Sumer, some accompanied their followers to far lands in the four corners of the Earth; others remained nearby, rallying their followers, old and new, to a renewed challenge to Marduk.
Destiny Had Fifty Names
113
The sense that Sumer as a homeland was no more is clearly expressed in the divine instructions to Abram of Nippur—on the eve of the nuclear upheavaling—to “Semitize” his name to Abraham (and that of his wife Sarai to Sarah), and to make his permanent home in Cannan. Abraham and his wife were not the only Sumerians in need of a new refuge. The nuclear calamity triggered migrational movements on a scale unknown before. The first wave of people was away from the affected lands; its most significant aspect, and one with the most lasting effects, was the dispersal of Sumer’s remnants away from Sumer. The next wave of migrants was into that abandoned land, coming in waves from all directions. Whichever direction those migration waves took, the fruits of two thousand years of Sumerian civilization were adopted by the other peoples that followed them in the next two millennia. Indeed, though Sumer as a physical entity was crushed, the attainments of its civilization are still with us to this day—just look up your twelve-month calendar, check the time on your watch that retained the Sumerian sexagesimal (“base sixty”) system, or drive in your contraption on wheels (a car). The evidence for a widespread Sumerian diaspora with its language, writing, symbols, customs, celestial knowledge, beliefs, and gods comes in many forms. Beside the generalities—a religion based on a pantheon of gods who have come from the heavens, a divine hierarchy, god epithet-names that mean the same in the different languages, astronomical knowledge that included a home planet of the gods, a zodiac with its twelve houses, virtually identical creation tales, and memories of gods and demigods that scholars treat as “myths”—there are a host of astounding specific similarities that cannot be explained other than by an actual presence of Sumerians. It was expressed in the spread in Europe of Ninurta’s DoubleEagle symbol (Fig. 48); the fact that three European languages—Hungarian, Finnish, and Basque—are akin only to Sumerian; and the widespread depiction throughout the world—even in South America—of Gilgamesh fighting off with bare hands two ferocious lions (Fig. 49). In the Far East, there is the clear similarity between the
114
THE END OF DAYS
Figure 48
Sumerian cuneiform writing and the scripts of China, Korea, and Japan. The similarity is not only in the script: many similar glyphs are identically pronounced and also have the same meanings. In Japan, civilization has beeen attributed to an enigmatic forefather-tribe called AINU. The emperor’s family has been deemed to be a line of demigods descended from the Sun-god, and the investiture ceremonies of a new king include a secret solitary nightly stay with the Sun goddess—a ritual ceremony that uncannily emulates the Sacred Marriage rites in ancient Sumer, when the new king spent a night with Inanna/Ishtar. In the erstwhile Four Regions, the migratory waves of diverse peoples triggered by the nuclear calamity and Marduk’s New Age, much like flowing and overflowing rivers and rivulets after stormy rains, filled the pages of the ensuing centuries with the rise and fall of nations, states, and citystates. Into the Sumerian void, newcomers came in from near and far; their arena, their central stage, remained what can rightly be called the Lands of the Bible. Indeed, until the advent of modern archaeology, little or nothing was known about most of them except for their mention in the Hebrew Bible; it provided not only a record of those various peoples, but also of their “national gods”—and of the wars fought in the name of those gods. But then nations such as the Hittites, states such as Mi-
Destiny Had Fifty Names
115
Figure 49 tanni, or royal capitals such as Mari, Carchemish, or Susa, which were doubt-filled puzzles, were literally dug up by archaeology; in their ruins there were found not only telltale artifacts but also thousands of inscribed clay tablets that brought to light both their existence as well as the extent of their debt to the Sumerian legacy. Virtually everywhere, Sumerian “firsts� in sciences and technology, literature and art, kingship and priesthood were the foundation on which subsequent cultures were developed. In astronomy, Sumerian terminology, orbital formulas, planetary lists, and zodiacal concepts were retained. The Sumerian cuneiform script was kept in use for another thousand years, and then more. The
116
THE END OF DAYS
Sumerian language was studied, Sumerian lexicons were compiled, and Sumerian epic tales of gods and heroes were copied and translated. And once those nations’ diverse languages were deciphered, it turned out that their gods were, after all, members of the old Anunnaki pantheon. Did the Enlilite gods themselves accompany their followers when such replanting of Sumerian knowledge and beliefs took place in faraway lands? The data are inconclusive. But what is historically certain is that within two or three centuries of the New Age, in lands bordering Babylonia, those who were supposed to become Marduk’s retired guests embarked on an even newer kind of religious affiliations: National State Religions. Marduk may have garnered the Fifty divine names; but it did not prevent, from then on, nation fighting nation and men killing men “in the name of God”—their god.
8 IN THE NAME OF GOD
If the prophecies and messianic expectations attendant on the New Age of the twenty-first century b.c.e. look familiar to us today, the battle cries of the subsequent centuries would not sound strange, either. If in the third millennium b.c.e. god fought god using armies of men, in the second millennium b.c.e. men fought men “in the name of god.” It took just a few centuries after the start of Marduk’s New Age to show that the fulfillment of his prophecies of grandeur would not easily come. Significantly, the resistance came not so much from the dispersed Enlilite gods but from the people, the masses of their loyal worshippers! More than a century had to pass from the time of the nuclear ordeal until Babylon (the city) emerged on the stage of history as Babylonia (the state) under its First Dynasty. During that interval southern Mesopotamia—the Sumer of old—was left to recover in the hands of temporary rulers headquartered in Isin and then in Larsa; their theophoric names—Lipit-Ishtar, Ur-Ninurta, Rim-Sin, Enlil-Bani—flaunted their Enlilite loyalties. Their crowning achievement was the restoration of Nippur’s temple exactly seventy-two years after the nuclear havoc—another indication of where their loyalties lay, and of an adherence to a zodiacal time count. Those non-Babylonian rulers were scions of Semiticspeaking royals from a city-state called Mari. As one looks at a map showing the nation-states of the first half of the second millennium b.c.e. (Fig. 50), it becomes clear that the non-Mardukite states formed a formidable vise around Greater Babylon, starting with Elam and Gutium on the
118
THE END OF DAYS
Figure 50 southeast and east; Assyria and Hatti in the north; and as a western anchor in the chain, Mari on the mid-Euphrates. Of them, Mari was the most “Sumerian,” even having served once as Sumer’s capital, the tenth as that function rotated among Sumer’s major cities. An ancient port city on the Euphrates River, it was a major crossing point for people, goods, and culture between Mesopotamia in the east, the Mediterranean lands in the west, and Anatolia in the northwest. Its monuments bore the finest examples of Sumerian writing, and its huge central palace was decorated with murals, astounding in their artistry, honoring Ishtar (Fig. 51). (A chapter on Mari and my visit to its ruins can be read in The Earth Chronicles Expeditions.) Its royal archive of thousands of clay tablets revealed how Mari’s wealth and international connections to many other
In the Name of God
119
Figure 51 city-states were first used and then betrayed by the emerging Babylon. After at first attaining the restoration of southern Mesopotamia by the Mari royals, Babylon’s kings—feigning peace and unprovoked—treated Mari as an enemy. In 1760 b.c.e. the Babylonian king Hammurabi attacked, sacked, and destroyed Mari, its temples and its palaces. It was done, Hammurabi boasted in his annals, “through the mighty power of Marduk.” After the fall of Mari, chieftains from the “Sealands”— Sumer’s marshy areas bordering the Lower Sea (Persian Gulf)—conducted raids northward, and took from time to time control of the sacred city of Nippur. But those were temporary gains, and Hammurabi was certain that his vanquishing of Mari completed Babylon’s political and religious domination of the old Sumer & Akkad. The dynasty to which he belonged, named by scholars the First Dynasty of Babylon, began a century before him and continued through his descendants for another two centuries. In those turbulent times, it was quite an achievement. Historians and theologians agreee that in 1760 b.c.e. Hammurabi, calling himself “King of the Four Quarters,” “put Babylon on the world map” and launched Marduk’s distinct Star Religion. When Babylon’s political and military supremacy was thus established, it was time to assert and aggrandize its religious domination. In a city whose splendor was extolled in the Bi-
120
THE END OF DAYS
ble and whose gardens were deemed one of the ancient world’s wonders, the sacred precinct, with the Esagil ziggurat-temple at its center, was protected by its own walls and guarded gates; inside, processional ways were laid out to fit the religious ceremonies, and shrines were built for other gods (whom Marduk expected to be his unwilling guests). When archaeologists excavated Babylon, they found not only the city’s remains but also “architectural tablets” describing and mapping out the city; though many of the structures are remains from later times, this artist’s conception of the sacred precinct’s center (Fig. 52) gives a good idea of Marduk’s magnificent headquarters. As befits a “Vatican,” the sacred precinct was also filled with an impressive array of priests whose religious, ceremonial, administrative, political, and menial tasks can be gleaned from their varied groupings, classifications, and designations. At the bottom of the hierarchy were the service personnel, the Abalu—“Porters”—who clean-swept the temple and adjoining buildings, provided the tools and utensils that the other priests required, and acted as general supply and warehousing personnel—except for woollen yarns, which were entrusted only to the Shu’uru priests. Special priests, like the Mushshipu and Mulillu, performed ritual purification services, except that it required a Mushlahhu to handle snake infestations. The Umannu, Master Craftsmen, worked in
Figure 52
In the Name of God
121
workshops where artful religious objects were fashioned; the Zabbu were a group of female priestesses, chefs, and cooks who prepared the meals. Other priestesses acted as professional bewailers in funerals; the Bakate knew how to shed bitter tears. And then there were the Shangu—simply “the priests”—who oversaw the overall functioning of the temple, the smooth performance of its rituals, and the receiving and handling of the offerings, or who were responsible for the gods’ clothes; and so on and on. The provision of personal “butlering” services to the resident gods was handled by a small, specially selected elite group of priests. There were the Ramaqu who handled the purification-by-water rituals (honored with bathing the god), and the Nisaku who poured out the used water. The anointing of the god with “Sacred Oil”—a delicate mixture of specific aromatic oils—was placed in specialized hands, starting with the Abaraku who mixed the ointments, and included the Pashishu who performed the anointing (in the case of a goddess the priests were all eunuchs). Then there were altogether other priests and priestesses, including the Sacred Choir—the Naru who sang, the Lallaru who were singers and musicians, and the Munabu whose specialty was lamentations. In each group there was the Rabu—the Chief, the one in charge. As envisaged by Marduk, once his Esagil ziggurat-temple was raised heavenward, its main function was to constantly observe the heavens; and indeed, the most important segment of temple priests were those whose task it was to observe the heavens, track the movement of stars and planets, record special phenomena (such as a planetary conjunction or an eclipse), and consider whether the heavens bespoke omens; and if so, to interpret what they did portend. The astronomer-priests, generally called Mashmashu, included diverse specialties; a Kalu priest, for example, specialized in watching the Constellation of the Bull. It was the duty of the Lagaru to keep a detailed daily record of the celestial observations, and to convey the information to a cadre of interpreter-priests. These—making up the top priestly hierarchy—included the Ashippu, Omen specialists,
122
THE END OF DAYS
the Mahhu “who could read the signs,” and the Baru— “Truth-tellers”—who “understood mysteries and divine signs.” A special priest, the Zaqiqu, was charged with conveying the divine words to the king. Then at the head of those astronomer-astrologer priests was the Urigallu, the Great Priest, who was a holy man, a magician, and a physician, whose white vestments were elaborately color-trimmed at the hems. The discovery of some seventy tablets that formed a continuous series of observations and their meaning, named after the opening words Enuma Anu Enlil, revealed both the transition from Sumerian astronomy and the existence of oracular formulas that dictated what a phenomenon meant. In time a host of diviners, dream interpreters, fortune-tellers, and the like joined the hierarchy, but they were in the king’s rather than the gods’ service. In time the celestial observations degraded to astrological omens for king and country—predicting war, tranquility, overthrows, long life or death, abundance or pestilences, divine blessings or godly wrath. But in the beginning the celestial observations were purely astronomical and were of prime interest to the god— Marduk—and only derivatively to king and people. It was not by chance that a Kalu priest specialized in watching Enlil’s Constellation of the Bull for any untoward phenomena, for the main purpose of the Esagil-as-observatory was to track the heavens zodiacally and keep an eye on Celestial Time. The fact that significant events prior to the nuclear blast happened in seventy-two-year intervals, and continued to do so afterward (see above and earlier chapters), suggests that the zodiacal clock, in which it took seventy-two years for a Precessional shift of one degree, continued to be observed and adhered to. It is clear from all the astronomical (and astrological) texts from Babylon that its astronomer-priests retained the Sumerian division of the heavens into three Ways or paths, each occupying sixty degrees of the celestial arc: the Way of Enlil for the northern skies, the Way of Ea for the southern skies, and the Way of Anu as the central band (Fig. 53). It was in
In the Name of God
123
Figure 53
the latter that the zodiacal constellations were located, and it was there that “Earth met Heaven”—at the horizon. Perhaps because Marduk attained supremacy in accordance with Celestial Time, the zodiacal clock, his astronomer-priests continuously scanned the skies at the horizon, the Sumerian AN.UR, “Heaven’s Base.” There was no point in looking up to the Sumerian AN.PA, “Heaven’s Top,” the zenith, for Marduk as a “star,” Nibiru, was by then gone and unseen. But as an orbiting planet, though unseen now, it was bound to return. Expressing its equivalent of the Marduk-is-Nibiru theme, the Egyptian version of Marduk’s Star-Religion openly promised its faithful that a time will come when this god-star or star-god would reappear as the ATEN. It was this aspect of Marduk’s Star Religion—the eventual Return—that directly challenged Babylon’s Enlilite adversaries, and shifted the conflict’s focus to renewed messianic expectations. Of the post-Sumer actors on the stage of the Old World, four that grew to imperial status left the deepest imprint on history: Egypt and Babylonia, Assyria and Hatti (the land of the Hittites); and each one had its “national god.”
124
THE END OF DAYS
The first two belonged to the Enki-Marduk-Nabu camp; the other two were beholden to Enlil, Ninurta, and Adad. Their national gods were called Ra-Amon and Bel/Marduk, Ashur and Teshub, and it was in the name of those gods that constant, prolonged, and cruel wars were fought. The wars, historians may explain, were caused by the usual reasons for war: resources, territory, need, or greed; but the royal annals that detailed the wars and military expeditions presented them as religious wars in which one’s god was glorified and the opposite deity humiliated. However, the looming expectations of the Return turned those wars to territorial campaigns that had specific sites as their targets. The wars, according to the royal annals of all those lands, were launched by the king “on the command of my god” soand-so; the campaign was carried out “in accordance with an oracle” from this or that god; and as often as not, victory was attained with the help of unopposable weapons or other direct help provided by the god. An Egyptian king wrote in his war records that it was “Ra who loves me, Amon who favors me,” who instructed him to march “against these enemies whom Ra abominates.” An Assyrian king, recording the defeat of an enemy king, boasted that he replaced in the city’s temple the images of the city’s gods “with the images of my gods, and declared them to be henceforth the gods of the country.” A clear example of the religious aspect of those wars—and the deliberate choice of targets—can be found in the Hebrew Bible, in 2 Kings Chapters that all on the city’s walls could understand, he shouted to them the words of the king of Assyria: Don’t be deceived by your leaders that your god Yahweh will protect you;
In the Name of God
125
the gods of all these lands ever rescued his land from my hand? Will then Yahweh rescue Jerusalem from my hand?” (Yahweh, the historical records show, did.) What were those religious wars about? The wars, and the national gods in whose name they were fought, don’t make sense except when one realizes that at the core of the conflicts was what the Sumerian had impact also a religious significance? We know the answer, to some extent, because all three sites still stand on Earth, challenging mankind by their mysteries and the gods by facing upward to the heavens. The most familiar of the three is the Great Pyramid and its companions in Giza (Fig. 54); its size, geometric precision, inner complexity, celestial alignments, and other amazing aspects have long cast doubt on the attribution of its construction to a Pharaoh named Cheops—an attribution supported solely by a discovery of a hieroglyph of his name inside the pyramid. In The Stairway to Heaven I offered proof that those markings were a modern forgery, and in that book and others voluminous textual and pictorial evidence
126
THE END OF DAYS
Figure 54 was provided to explain just remained silent witnesses to a vanished Past; there has been no indication that (Fig. 55) a rocket ship emplaced on a special base within an enclosure
In the Name of God
127
Figure 55 that weigh an incredible 1,100 tons each and are known as the Trilithon (Fig. 56). The amazing fact about those colossal stone blocks is that they were quarried about two miles away in the valley, where one such block, whose quarrying was not completed, still sticks out from the ground (Fig. 57). The Greeks venerated the place since Alexander’s time as Heliopolis (City of the Sun god); the Romans built there the greatest temple to Zeus. The Byzantines converted it to a great church; the Moslems after them built there a mosque; and present-day Maronite Christians revere the place as a relic from the Time of the Giants. (A visit to the place and its ruins, and how it functioned as a launch tower, are described in The Earth Chronicles Expeditions.)
128
THE END OF DAYS
Figure 56 Most sacred and hallowed to this day has been the site that served as Mission Control Center—Ur-Shalem (“City of the Comprehensive God”), Jerusalem. There, too, as in Baalbek but on a reduced scale, a large stone platform rests on a rock and cut-stones foundation, including a massive western wall with three colossal stone blocks that weigh about six hundred tons each (Fig. 58). It was upon that preexisting platform that Moslem-built Dome of the Rock (Fig. 59); its gilded dome originally surmonted the Moslem shrine at Baalbek—evidence that the link between the two space-related sites has seldom been missed.
In the Name of God
129
Figure 57
Figure 58 In the trying times after the nuclear calamity, could Marduk’s Bab-Ili, his “Gateway of the gods,” substitute for the olden Bond Heaven-Earth sites? Could Marduk’s new Star Religion offer an answer to the perplexed masses?
130
THE END OF DAYS
Figure 59 The ancient search for an answer, it seems, has continued to our very own time. The most unremitting adversary of Babylon was the Assyrians. Their province, in the upper region of the Tigris River, was called Subartu in Sumerian times and was the northernmost extension of Sumer & Akkad. In language and racial origins they appear to have had a kinship to Sargon of Akkad, so much so that when Assyria became a kingdom and imperial power, some of its most famous kings took the name Sharru-kin—Sargon—as their royal name. All that, gleaned from archaeological finds in the past two centuries, corroborates the succint statements in the Bible (Genesis, Chapter 10) that listed the Assyrians among the descendants of Shem, and Assyria’s capital Nineveh and other principal cities as “coming out of ”—an outgrowth, an extension of—Shine’ar (Sumer). Their pantheon was the Sumerian pantheon—their gods were the Anunnaki of Sumer & Akkad; and the theophoric names of Assyrian kings and high officials indicated reverence to the gods Ashur, Enlil, Ninurta, Sin, Adad, and Shamash. There were temples to them, as well as to the goddess Inanna/Ishtar, who was also
In the Name of God
131
extensively worshipped; one of her best-known depictions, as a helmeted pilot (Fig. 60), was found in her temple in Ashur (the city). Historical documents from the time indicate that it was the Assyrians from the north who were the first to challenge Marduk’s Babylon militarily. The very first recorded Assyrian king, Ilushuma, led circa 1900 b.c.e.. Assyria called itself the “Land of the god Ashur” or simply ASHUR, after the name of its national god, for its kings
Figure 60
132
THE END OF DAYS
and people considered this religious aspect to be all that mattered. Its first capital was also called “City of Ashur,” or simply Ashur. The name meant “The One Who Sees” or “The One Who Is Seen.” Yet with all the countless hymns, prayers, and other references to the god Ashur, it remains unclear who exactly, in the Sumerian-Akkadian pantheon, he was. In god lists he was the equivalent of Enlil; other references sometimes suggest that he was Ninurta, Enlil’s son and heir; but since whenever the spouse was listed or mentioned she was always called Ninlil, the conclusion tends to be that the Assyrian “Ashur” was Enlil. The historical record of Assyria is one of conquest and aggression against many other nations and their gods. Their countless military campaigns ranged far and wide, and were carried on, of course, “in the name of god”—their god, Ashur: “On the command of my god Ashur, the great lord” was the usual opening statement in the Assyrian kings’ record of a military campaign. But when it came to the warfare with Babylon, the amazing aspect of Assyria’s attacks was its central aim: not just the rollback of Babylon’s influence— but the actual, physical removal of Marduk himself from his temple in Babylon! The feat of capturing Babylon and taking Marduk into captivity was first achieved, however, not by the Assyrians but by their neighbors to the north—the Hittites. Circa 1900 b.c.e. the Hittites began to spread out from their strongholds in north-central Anatolia (today’s Turkey), became a major military power, and joined the chain of Enlilite nation-states opposed to Marduk’s Babylon. In a relatively short time, they attained imperial status and their domains extended southward to include most of the biblical Canaan. The archaeological discovery of the Hittites, their cities, records, language, and history, is an astounding and exciting tale of bringing to life and corroborating the existence of people and places hitherto known only from the Hebrew Bible. Hittites are repeatedly mentioned in the Bible, but without the disdain or scorn reserved for worshippers of pagan gods. It refers to their presence throughout the lands where
In the Name of God
133
the story and history of the Hebrew Patriarchs unfolded. They were Abraham’s neighbors in Harran, and it was from Hittite landowners in Hebron, south of Jerusalem, that he bought the Machpelah burial cave. Bathsheba, whom King David coveted in Jerusalem, was the wife of a Hittite captain in his army; and it was from Hittite farmers (who used the site for wheat thrashing) that David bought the platform for the Temple on Mount Moriah. King Solomon bought chariot horses from Hittite princes, and it was one of their daughters whom he married. The Bible considered the Hittites to belong, genealogically and historically, to the peoples of Western Asia; modern scholars believe that they were migrants to Asia Minor from elsewhere—probably from beyond the Caucasus mountains. Because their language, once deciphered, was found to belong to the Indo-European group (as do Greek on the one hand and Sanskrit on the other hand), they are considered to have been non-Semitic “Indo-Europeans.” Yet, once settled, they added the Sumerian cuneiform script to their own distinct script, included Sumerian “loan words” in their terminology, studied and copied Sumerian “myths” and epic tales, and adopted the Sumerian pantheon—including the count of twelve “Olympians.” In fact, some of the earliest tales of the gods on Nibiru and coming from Nibiru were discovered only in their Hittite versions. The Hittite gods were undoubtedly the Sumerian gods, and monuments and royal seals invariably showed them accompanied by the ubiquitous symbol of the Winged Disc (see Fig. 46), the symbol for Nibiru. These gods were sometimes called in the Hittite texts by their Sumerian or Akkadian names—we find Anu, Enlil, Ea, Ninurta, Inanna/Ishtar, and Utu/Shamash repeatedly mentioned. In other instances the gods were called by Hittite names; leading them was the Hittite national god, Teshub—“the Windblower” or “God of storms.” He was none other than Enlil’s youngest son ISHKUR/Adad. His depictions showed him holding the lightning bolt as his weapon, usually standing upon a bull—the symbol of his father’s celestial constellation (Fig. 61). The biblical references to the extended reach and military
134
THE END OF DAYS
Figure 61
prowess of the Hittites were confirmed by archaeological discoveries both at Hittite sites and in the records of other nations.. The two sides thus had all it took to engage in armed conflict. In fact, the wars between the two included some of the ancient world’s most famous battles fought “in the name of god.” But rather than attack Egypt, the Hittites sprung a surprise. The first, perhaps, to introduce horse-driven chariots in military campaigns, the Hittite army, totally unexpectedly, in 1595 b.c.e., swept down the Euphrates River, captured Babylon, and took Marduk into captivity.
In the Name of God
135
Though one wishes that more detailed records from that time and event would have been discovered, what is known indicates that—a place (yet to be excavated) in the district of Terka, along the Euphrates River. The humiliating absence of Marduk from Babylon lasted twenty-four years—exactly the same time that Marduk had been in exile in Harran five centuries earlier.. The sudden Hittite thrust to Babylon and the temporary removal of Marduk remain an unresolved historical, political, and religious mystery. Was the intention of the raid just to embarrass and diminish Marduk—deflate his ego, confuse his followers—or was there a more far-reaching purpose— or cause—behind it? Was it possible that Marduk fell victim to the proverbial “hoist by his own petard”?
9 THE PROMISED LAND
The capture and removal of Marduk from Babylon had geopolitical repercussions, shifting for several centuries the center of gravity from Mesopotamia westward, to the lands along the Mediterranean Sea. In religious terms, it was the equal of a tectonic earthquake: in one blow, all the great expectations by Marduk for all gods to be gathered under his aegis, and all the messianic expectations by his followers, were gone like a puff of smoke. But both geopolitically and religiously, the greatest impact can be summed up as the story of three mountains—the three space-related sites that put the Promised Land in the midst of it all: Mount Sinai, Mount Moriah, and Mount Lebanon. Of all the events that followed the unprecedented occurrence in Babylon, the central and most lasting one was the Israelite Exodus from Egypt—when, for the first time, sites that until then were the gods’ alone were entrusted to people. When the Hittites who took Marduk captive withdrew from Babylon, they left behind political disarray and a religious enigma: How could that happen? Why did it happen? When bad things happened to people, they would say that the gods were angry; so what now that bad things happened to gods— to Marduk? Was there a God supreme to the supreme god? In Babylon itself, the eventual release and return of Marduk did not provide an answer; in fact, it increased the mystery, for the “Kassites” who welcomed the captured god back to Babylon were non-Babylonian strangers. They called Babylon
The Promised Land
137
b.c.e. and to dominate Babylon from 1560 b.c.e. until 1160 b.c.e. Modern scholars speak of the period that followed Marduk’s humiliation as a “dark age” in Babylonian history, not only because of the disarray it caused but mainly because of the paucity of written Babylonian records from that time. The Kassites quickly integrated themselves into the Sumerian-Akkadian culture, including language and cuneiform script, but were neither the meticulous recordkeepers the Sumerians had been nor the likes of previous Babylonian writers of royal annals. Indeed, most of the few royal records of Kassite kings have been found not in Babylon but in Egypt—clay tablets in the El-Amarna archive of royal correspondence. Remarkably, in those tablets the Kassite kings called the Egyptian Pharaohs “my brother.” The expression, though figurative, was not unjustified, for Egypt shared with Babylon the veneration of Ra-Marduk and, like Babylonia, had also undergone a “dark age”—a period scholars call the Second Intermediate Period. It began with the demise of the Middle Kingdom circa 1780 b.c.e. and lasted until about 1560 b.c.e.. That the dates of this Second Intermediate Period (with its many obscure aspects) parallel the dates of Babylon’s slide from the peak of Hammurabi’s victories (1760 b.c.e.) to the capture and resumption of Marduk’s worship in Babylon (circa 1560 b.c.e.) is probably neither accident nor coincidence: those similar developments at parallel times in Marduk’s principal lands happened because Marduk was “hoist by his own petard”—the very justification for his claim to supremacy was now causing his undoing. The “petard” was Marduk’s own initial contention that the
138
THE END OF DAYS
time for his supremacy on Earth had arrived because in the heavens the Age of the Ram, his age, had arrived. But as the zodiacal clock kept ticking, the Age of the Ram started to slowly slip away. The physical evidence from those perplexing times still exists, and can be seen, in Thebes, the ancient Egyptian capital of Upper Egypt. Apart from the great pyramids of Giza, ancient Egypt’s most impressive and majestic monuments are the colossal temples of Karnak and Luxor in southern (Upper) Egypt. The Greeks called the place Thebai, from which its name in English—Thebes—derives; the ancient Egyptians called it the City of Amon, for it was to this unseen god that those temples were dedicated. The hieroglyphic writing and the pictorial depictions on their walls, obelisks, pylons, and columns (Fig. 62) glorify the god and praise the Pharaohs who built, enlarged, expanded—and kept changing—the temples. It was there that the arrival of the Age of the Ram was announced by the rows of ram-headed sphinxes (see Fig. 39); and it is there that the very layout of the temples reveals the secret quandary of Egypt’s followers of Ra-Amon/Marduk.
Figure 62
The Promised Land
139
One time, visiting the sites with a group of fans, I stood in the midst of a temple waving my hands as a traffic policeman; amazed onlookers wondered, “Who is this nut?,” but I was trying to point out to my group the fact that the Thebes temples, built by a succession of Pharaohs, kept changing their orientation (Fig. 63). It was Sir Norman Lockyer who, in the 1890s, first grasped the significance of this architectural aspect, giving rise to a discipline called Archaeoastronomy. Temples that were oriented to the equinoxes, like Solomon’s temple in Jerusalem, (Fig. 64) —as can be illustrated by Stonehenge, where Lockyer applied his findings (see Fig. 6). The
Figure 63
140
THE END OF DAYS
Figure 64 very temples that Ra/Marduk’s followers had erected to glorify him were showing that the heavens were uncertain about the durability of the god and his Age. Marduk himself—so aware of the zodiacal clock when he had claimed in the previous millennium that his time had arrived—tried to shift the religious focus by introducing the Star Religion of “Marduk is Nibiru.” But his capture and humiliation now raised questions regarding this unseen celestial god. The question, Until when will the Age of Marduk last? changed to the question: If celestially Marduk is the unseen Nibiru, when will it reveal itself, reappear, return? As unfolding events showed, both the religious and the geopolitical focus shifted in the middle of the second millenium b.c.e. to the stretch of land that the Bible called Canaan. As the return of Nibiru started to emerge as the religious focus, the space-related sites also emerged into sharper focus, and it was in the geographic “Canaan” where
The Promised Land
141
both the Landing Place and the erstwhile Mission Control Center were located. Historians tell the ensuing events in terms of the rise and fall of nation-states and the clash of empires. It was circa 1460 b.c.e. that the forgotten kingdoms of Elam and Anshan (later known as Persia, east and southeast of Babylonia) joined to form a new and powerful state, with Susa (the biblical Shushan) as the national capital and Ninurta, the national god, as Shar Ilani—“Lord of the gods”; that newly assertive nation-state was to play a decisive role in ending Babylon’s and Marduk’s supremacy. It was probably no coincidence that at about the same time, a new powerful state arose in the Euphrates region where Mari had once dominated. There the biblical Horites (scholars call them Hurrians) formed a powerful state named Mitanni—“The Weapon of Anu”—which captured the lands that are now Syria and Lebanon and posed a geopolitical and religious challenge to Egypt. That challenge was countered, most ferociously, by Egypt’s Pharaoh Tothmosis III, whom historians describe as an “Egyptian Napoleon.” Interwined with all that was the Israelite exodus from Egypt, that period’s seminal event, if for no other reason than due to its lasting effects, to this day, on Mankind’s religions, social and moral codes, and the centrality of Jerusalem. Its timing was not accidental, for all those developments related to the issue of who shall control the space-related sites when Nibiru’s return will occur. As was shown in previous chapters, Abraham did not just happen to become a Hebrew Patriarch, but was a chosen participant in major international affairs; and the places where his tale took us—Ur, Harran, Egypt, Canaan, Jerusalem, the Sinai, Sodom and Gomorrah—were principal sites of the universal story of gods and men in earlier times. The Israelite Exodus from Egypt, recalled and celebrated by the Jewish people during the Passover holiday, was likewise an integral aspect of the events that were then unfolding throughout the ancient lands. The Bible itself, far from
142
THE END OF DAYS
treating the Exodus as just an “Israelite” story, clearly placed it in the context of Egyptian history and the international events of the time. The Hebrew Bible opens the story of the Israelite exodus from Egypt in its second book, Exodus, by reminding the reader that the Israelite presence in Egypt began when Jacob (who was renamed Israel by an angel) and his other eleven sons joined Jacob’s son Joseph in Egypt, in 1833 b.c.e. The full story of how Joseph, separated from his family, rose from being a slave to the rank of viceroy, and how he saved Egypt from a devastating famine, is told by the Bible in the last chapters of Genesis; and my take on how Joseph saved Egypt and what evidence of that exists to this day is told in The Earth Chronicles Expeditions. Having reminded the reader of how and when the Israelite presence in Egypt began, the Bible makes it clear that all that was gone and forgotten by the time of the Exodus: “Joseph and all his brothers and all that generation had passed away.” Not only they but even the dynasty of the Egyptian kings who were connected to those times were also long gone. A new dynasty came into power: “And there arose a new king over Egypt who knew not Joseph.” Accurately, the Bible describes the change of government in Egypt. The dynasties of the Middle Kingdom based in Memphis were gone, and after the disarray of the Second Intermediate Period the princes of Thebes launched the dynasties of the New Kingdom. Indeed, there arose entirely new kings over Egypt—new dynasties in a new capital, “and they knew not Joseph.” Forgetting the Israelite contribution to Egypt’s survival, a new Pharaoh now saw danger in their presence. He ordered a series of oppressive steps against them, including the killing of all male babies. These were his reasons: And he said unto his people: “Behold, a nation, Children of Israel, is greater and mightier than us; Let us deal wisely with them, lest they multiply
The Promised Land
143
and, when war shall be called, they will join our enemies, and fight against us, and leave the land.” Exodus 1:9–10 Biblical scholars have assumed all along that the feared nation of the “Children of Israel” were the Israelites sojourning in Egypt. But this is in accord with neither the numbers given nor with the literal wording in the Bible. Exodus begins with a list of the names of Jacob and his children who had come, with their children, to join Joseph in Egypt, and states that “all of those who descended from the loins of Jacob, excluding Joseph who was already in Egypt, numbered seventy.” (That together with Jacob and Joseph the number totaled 72 is an intriguing detail to ponder.) The “sojourn” lasted four centuries, and according to the Bible the number of all the Israelites leaving Egypt was 600,000; no Pharaoh would consider such a group “greater and mightier than us.” (For the identity of that Pharaoh and of “the Pharaoh’s Daughter” who raised Moses as her son, see Divine Encounters.) The narrative’s wording records the Pharaoh’s fear that at time of war, the Israelites will “join our enemies, and fight against us, and leave the land.” It is a fear not of a “Fifth Column” inside Egypt, but of Egypt’s indigent “Children of Israel” leaving to reinforce an enemy nation to whom they are related—all of them being, in Egyptian eyes, “Children of Israel.” But what other nation of “Children of Israel” and what war was the Egyptian king talking about? Thanks to archaeological discoveries of royal records from both sides of those ancient conflicts and the synchronization of their contents, we now know that the New Kingdom Pharaohs were engaged in prolonged warfare against Mitanni. Starting circa 1560 b.c.e. with the Pharaoh Ahmosis, continued by the Pharaohs Amenophis I, Thothmosis I, and Thothmosis II, and intensifying under Thothmosis III through 1460 b.c.e., Egyptian armies thrust into Canaan and advanced northward against Mitanni. The Egyptian chronicles of those battles frequently mention Naharin as
144
THE END OF DAYS
the ultimate target—the Khabur River area, which the Bible called Aram-Naharayim (“The Western Land of the Two Rivers”); its principal urban center was Harran! It was there, Bible students will recall, that Abraham’s brother Nahor stayed on when Abraham proceeeded to Canaan; it was from there that Rebecca, the bride of Abraham’s son Isaac, came—she was in fact the granddaughter of Nahor. And it was to Harran that Isaac’s son Jacob (renamed Israel) went to find a bride—ending up marrying his cousins, the two daughters (Le’ah and Rachel) of Laban, the brother of his mother Rebecca. These direct family ties between the “Children of Israel” (i.e., of Jacob) who were in Egypt and those who stayed on in Naharin-Naharayim are highlighted in the very first verses in Exodus: the list of the sons of Jacob who had come to Egypt with him includes the youngest, Ben-Yamin (Benjamin), the only full brother of Joseph because both were Jacob’s sons by Rachel (the others were sons of Jacob by his wife Le’ah and two concubines). We now know from Mitannian tablets that the most important tribe in the Khabur River area were called Ben-Yamins! The name of Joseph’s full brother was thus a Mitannian tribal name; no wonder, then, that the Egyptians considered the “Children of Israel” in Egypt and the “Children of Israel” in Mitanni as one combined nation “greater and mightier than us.” That was the war the Egyptians were preoccupied with and that was the reason for the Egyptian military concern— not the small number of Israelites in Egypt if they stayed, but a threat if they “left the land” and occupied territory to the north of Egypt. Indeed, preventing the Israelites from leaving appears to have been the central theme of the developing drama of the Exodus—there were the repeated appeals by Moses to the reigning Pharaoh to “let my people go,” and the Pharaoh’s repeated refusals to grant that request—in spite of ten consecutive divine punishments. Why? For a plausible answer we need to insert the space connection into the unfolding drama. In their northward thrusts, the Egyptians marched through the Sinai peninsula via the Way of the Sea, a route (later
The Promised Land
145
called by the Romans Via Maris) that afforded passage through the gods’ Fourth Region along the Mediterranean coast, without actually entering the peninsula proper. Then, advancing north through Canaan, the Egyptians repeatedly reached the Cedar Mountains of Lebanon and fought battles at Kadesh, “The Sacred Place.” Those were battles, we suggest, for control of the two sacred space-related sites—the erstwhile Mission Control Center ( Jerusalem) in Canaan and the Landing Place in Lebanon. The Pharaoh Thothmosis III, for example, in his war annals, referred to Jerusalem (“Ia-ur-sa”), which he garrisoned as the “place reaching to the outer ends of the Earth”—a “Navel of the Earth.” Describing his campaigns farther north, he recorded battles at Kadesh and Naharin and spoke of taking the Cedar Mountains, the “Mountains of god’s land” that “support the pillars to heaven.” The terminology unmistakably identifies by their space-related attributes the two sites he was claiming to have captured “for the great god, my father Ra/ Amon.” And the purpose of the Exodus? In the words of the biblical God himelf, to keep His sworn promise to Abraham, Isaac, and Jacob to grant to their descendants as “an Everlasting Heritage” (Exodus 6: 4–8); “from the Brook of Egypt to the River Euphrates, the great river”; “the whole of the Land of Canaan,” (Genesis 15:18, 17:8); “the Western Mount . . . the Land of Canaan and Lebanon” (Deuteronomy 1: 7); “from the desert to Lebanon, from the River Euphrates unto the Western Sea” (Deuteronomy 11:24)—even the “fortified places reaching heavenwards” wherein “descendants of the Anakim”—the Anunnaki—still resided (Deuteronomy 9: 1–2). The promise to Abraham was renewed at the Israelites’ first stop, at Har Ha-Elohim, the “Mount of the Elohim/ gods.” And the mission was to take hold, possess, the two other space-related sites, which the Bible repeatedly connected (as in Psalms 48:3), calling Mount Zion in Jerusalem Har Kodshi, “My Sacred Mount,” and the other, on the crest of Lebanon, Har Zaphon, “The Secret North Mount.” The Promised Land clearly embraced both space-related
146
THE END OF DAYS
sites; its division among the twelve tribes granted the area of Jerusalem to the tribes of Benjamin and Judah, and the territory that is now Lebanon to the tribe of Asher. In his parting words to the tribes before he died, Moses reminded the tribe of Asher that the northern space-related site was in their land—like no other tribe, he said, they will see the “Rider of the clouds soaring heavenwards” (Deuteronomy 33: 26). Apart from the territorial assignment, the words of Moses imply that the site would be functional and used for soaring heavenward in the future. Clearly and most emphatically, the Children of Israel were to be the custodians of the two remaining space-related sites of the Anunnaki. That Covenant with the people chosen for the task was renewed, at the greatest theophany on record, at Mount Sinai. It was certainly not by chance that the theophany occurred there. From the very beginning of the Exodus tale— when God called out to Moses and gave him the Exodus assignment—that place in the Sinai peninsula occupied center stage. We read in Exodus 3:1 that it happened at the “Mount of the Elohim”—the mountain associated with the Anunnaki. The route of the Exodus (Fig. 65) was divinely determined, the Israelite multitude having been shown the way by a “pillar of cloud by day and a pillar of fire by night.” The Children of Israel “journeyed in the wilderness of Sinai according to the instructions of Yahweh,” the Bible clearly states; in the third month of the journey they “reached and encamped opposite the Mount”; and on the third day thereafter, Yahweh in his Kabod “came down upon Mount Sinai in full view of all the people.” It was the same mount that Gilgamesh, arriving at the place where the rocket ships ascended and descended, had called “Mount Mashu.” It was the same mount with “the double doors to heaven” to which Egyptian Pharaohs went in their Afterlife Journey to join the gods on the “planet of millions of years.” It was the Mount astride the erstwhile Spaceport—and it was there that the Covenant was renewed with the people chosen to be the guardians of the two re-
The Promised Land
147
Figure 65 maining space-related sites. * * * As the Israelites were preparing, after the death of Moses, to cross the Jordan River, the boundaries of the Promised Land were restated to the new leader, Joshua. Embracing the locations of the space-related sites, the boundaries emphatically included Lebanon. Speaking to Joshua, the biblical God said:
148
THE END OF DAYS
Now arise and cross this Jordan, thou and all this people, the Children of Israel, unto the land which I do give to them. Every place where the soles of your feet shall tread upon have I given to you, just as I have spoken to Moses: From the Desert to the Lebanon, and from the great river, the River Euphrates, in the country of the Hittites, unto the Great Sea, where the sun sets— That shall be your boundary. Joshua 1: 2–4 With so much of the current political, military, and religious turmoil taking place in the Lands of the Bible, and with the Bible itself serving as a key to the past and to the future, one must point out a caveat inserted by the biblical God in regard to the Promised Land. The boundaries, running from the Wilderness in the south to the Lebanon range in the north, and from the Euphrates in the east to the Mediterranean Sea in the west, were reconfirmed to Joshua. These, God said, were the promised boundaries. But to become an actual land grant, it had to be obtained by possession. Akin to the “planting of the flag” by explorers in the recent past, the Israelites could possess and keep land where they actually set foot—“tread with the soles of their feet”; therefore, God commanded the Israelites not to tarry and delay, but to cross the Jordan and fearlessly and systematically settle the Promised Land. But when the twelve tribes under the leadership of Joshua were done with the conquest and settlement of Canaan, only part of the areas east of the Jordan were occupied; nor were all of the lands west of the Jordan captured and settled. As far as the two space-related sites were concerned, their stories are totally different: Jerusalem—which was specifically listed (Joshua 12: 10, 18: 28)—was firmly in the hands of the tribe of Benjamin. But whether the northward advance attained the Landing Place in Lebanon is in doubt. Subsequent biblical references to the site called it the “Crest of Zaphon” (the “se-
The Promised Land
149
cret north place”)—what the area’s dwellers, the CanaanitePhoenicians, also called it. (Canaanite epics deemed it to be a sacred place of the god Adad, Enlil’s youngest son.) The crossing of the Jordan River—an accomplishment attained with the help of several miracles—took place “opposite Jericho,” and the fortified city of Jericho (west of the Jordan) was the Israelites’ first target. The story of the tumbling of its walls and its capture includes a biblical reference to Sumer (Shin’ar in Hebrew): in spite of the commandment to take no booty, one of the Israelites could not resist the temptation to “keep a valued garment of Shin’ar.” The capture of Jericho, and the town of Ai south of it, opened the way to the Israelites’ most important and immediate target: Jerusalem, where the Mission Control platform had been. The missions of Abraham and his descendants and God’s covenants with them never lost sight of that site’s centrality. As God told Moses, it is in Jerusalem that His earthly abode was to be; now the promise-prophecy could be fulfilled. The capture of the cities on the way to Jerusalem, along with the hill towns surrounding it, turned out to be a formidable challenge, primarily because some of them, and especially Hebron, were inhabited by “children of the Anakim”—descendants of the Anunnaki. Jerusalem, it will be recalled, ceased to function as Mission Control Center when the spaceport in the Sinai was wiped out more than six centuries earlier. But according to the Bible, the descendants of the Anunnaki who had been stationed there were still residing in that part of Canaan. And it was “Adoni-Zedek, king of Jerusalem” who formed an alliance with four other citykings to block the Israelite advance. The battle that ensued, at Gibe’on in the Valley of Ayalon just north of Jerusalem, took place on a unique day—the day the Earth stood still. For the better part of that day, “the Sun stopped and the Moon stood still” (Joshua 10: 10– 14), enabling the Israelites to win that crucial battle. (A parallel but reverse occurrence, when nighttime lasted an extra twenty hours, took place on the other side of the world, in the Americas; we discuss the matter in The Lost Realms.)
150
THE END OF DAYS
In the biblical view, then, God himself assured that Jerusalem would come into Israelite hands. No sooner was kingship established under David than he was commanded by God to clear the platform atop Mount Moriah and sanctify it for Yahweh’s Temple. And ever since Solomon built that Temple there, Jerusalem/Mount Moriah/ the Temple Mount have remained uniquely sacred. There is, indeed, no other explanation why Jerusalem—a city not at major crossroads, far from waterways, with no natural resources—has been coveted and sacred since antiquity, deemed to be a singular city, a “Navel of the Earth.” The comprehensive list of captured cities given in Joshua Chapter 12 names Jerusalem as the third city, following Jericho and Ai, as firmly in Israelite hands. The story was different, however, in regard to the northern space-related site. The Cedar Mountains of Lebanon run in two ranges, the Lebanon on the west and the anti-Lebanon on the east, separated by the Bekka—the “Cleft,” a canyon-like valley that has been known since Canaanite times as the “Lord’s Cleft” or Ba’al-Bekka—hence Ba’albek, the current name of the site of the Landing Place (on the edge of the eastern range, facing the valley). The kings of the “Mount of the North” are listed in the Book of Joshua as having been defeated; a place called Ba’al Gad “in the valley of Lebanon” is listed as captured; but whether Ba’al-Gad “in the valley of Lebanon” is just another name for Ba’al-Bekka is uncertain. We are told ( Judges 1: 33) that the Tribe of Naphtali “did not disinherit the dwellers of Beth-Shemesh” (“Abode of Shamash,” the Sun god), and that could be a reference to the site, for the later Greeks called the place Heliopolis, “City of the Sun.” (Though later the territories under Kings David and Solomon extended to include Beth-Shemesh, it was only temporarily so.) The primary failure to establish Israelite hegemony over the northern space-related site made it “available” to others. A century and a half after the Exodus the Egyptians attempted to take possession of that “available” Landing Place, but were met by an opposing Hittite army. The epic battle is described in words and illustrations (Fig. 66) on the
The Promised Land
151
Figure 66 walls of Karnak’s temples. Known as the Battle of Kadesh, it ended with an Egyptian defeat, but the war and the battle exhausted both sides so much that the site the Landing Place was left in the hands of the local Phoenician kings of Tyre, Sidon, and Byblos (the biblical Gebal). (The prophets Ezekiel and Amos, who called it “the place of the gods” as well as “the Eden Abode,” recognized it as belonging to the Phoenicians.) The Phoenician kings of the first millennium b.c.e. were well aware of the site’s significance and purpose—witness its depiction on a Phoenician coin from Byblos (see Fig. 55). The Prophet Ezekiel (28: 2, 14) admonished the king of Tyre for haughtily believing that, having been to that sacred site of the Elohim, he had become himself a god: Thou hast been to a sacred mount, As a god werest thou, moving within the fiery stones . . . And you became haughty, saying: “A god am I, at the place of the Elohim I was”; But you are just Man, not god. It was at that time that the Prophet Ezekiel—in exile in the “old country,” near Harran on the Khabur River—saw divine visions and a celestial chariot, a “Flying Saucer,” but that tale must be postponed to a later chapter. Here it is important
152
THE END OF DAYS
to note that of the two space-related sites, only Jerusalem was retained by the followers of Yahweh. The first five books of the Hebrew Bible, known as the Torah (“The Teachings”), cover the story from Creation, Adam, and Noah to the Patriarchs and Joseph in Genesis. The other four books—Exodus, Leviticus, Numbers, and Deuteronomy—tell the story of the Exodus on the one hand, and on the other hand enumerate the rules and regulations of the new religion of Yahweh. That a new religion encompassing a new, a “priestly” way of life was promulgated is explicitly made clear: “You shall neither do what is done in the land of Egypt, where you had dwelt, nor as is wont in the Land of Canaan whence I am bringing you; you shall neither behave like them nor follow their statutes” (Leviticus 18: 2–3). Having established the basics of the faith (“You shall have no other God before me”) and its moral and ethical code in just Ten Commandments, there follow page after page of detailed dietary requirements, rules for priestly rites and vestments, medical teachings, agricultural directives, architectural instructions, family and sexual conduct regulations, property and criminal laws, and so on. They reveal extraordinary knowledge in virtually every scientific discipline, expertise in metals and textiles, acquaintance with legal systems and societal issues, familiarity with the lands, history, customs, and gods of other nations—and certain numerological preferences. The theme of twelve—as in the twelve tribes of Israel or in the twelve-month year—is obvious. Obvious, too, is the predilection for seven, most prominently in the realm of festivals and rituals, and in establishing a week of seven days and consecrating the seventh day as the Sabbath. Forty is a special number, as in the forty days and forty nights that Moses spent upon Mount Sinai, or the forty years decreed for the Israelite wandering in the Sinai wilderness. These are numbers familiar to us from the Sumerian tales—the twelve of the solar system and the twelve-month calendar of Nippur; the seven as the planetary number of the Earth (when the
The Promised Land
153
Anunnaki counted from the outside in) and of Enlil as Earth’s Commander; the forty as Ea/Enki’s numerical rank. The number fifty is also present. Fifty, as the reader knows, was a number with “sensitive” aspects—it was the original rank number of Enlil and the stand-in rank of his heir apparent, Ninurta; and more significantly, in the days of the Exodus, it connoted symbolism to Marduk and his Fifty Names. Extra attention is therefore called for when we find that “fifty” was granted extraordinary importance—it was used to create a new Unit of Time, the fifty-year Jubilee. While the calendar of Nippur was clearly adopted as the calendar by which the festivals and other Israelite religious rites were to be observed, special regulations were dictated for the fiftieth year; it was given a special name, that of a Jubilee Year: “A hallowed Jubilee year it shall be unto you” (Leviticus Chapter 25). In such a year, unprecedented freedoms were to take place. The count was to be done by counting the New Year’s Day of Atonements for seven years sevenfold, forty-nine times; then on the Day of Atonement on the year thereafter, the fiftieth year, the trumpet call of a ram’s horn was to be sounded throughout the land, and freedom was to be proclaimed for the land and all who dwelled in it: people should return to their families; property should return to its original owners—all land and house sales shall be redeemable and undone; slaves (who had to be treated at all times as hired help!) shall be set free, and liberty shall be given the land itself by leaving it fallow that year. As much as the concept of a “Year of Freedom” is novel and unique, the choice of fifty as a calendrical unit seems odd (we have adopted 100—a century—as a convenient unit of time). Then the name given to such a once-in-fifty year is even more intriguing. The word that is translated “Jubilee” is Yovel in the Hebrew Bible, and it means “a ram.” So one can say that what was decreed was a “Year of the Ram,” to repeat itself every fifty years, and to be announced by sounding the ram’s horn. Both the choice of fifty for the new time unit and its name raise the unavoidable question: Was there a hidden aspect here, related to Marduk and his Age of the Ram?
154
THE END OF DAYS
Were the Israelites told to keep counting “fifty years” until some significant divine event, relating either to the Age of the Ram or to the holder of the Rank of Fifty—when everything shall turn back to a new beginning? While no obvious answer is offered in those biblical chapters, one cannot avoid searching for clues by pursuing a significant and very similar year-unit on the other side of the world: not fifty, but fifty-two. It was the Secret Number of the Mesoamerican god Quetzalcoatl, who according to Aztec and Mayan legends gave them civilization, including their three calendars. In The Lost Realms we have identified Quetzalcoatl as the Egyptian god Thoth, whose secret number was fifty-two—a calendrical-based number, for it represented the fifty-two weeks of seven days in a solar year. The oldest of the three Mesoamerican calendars is known as the Long Count: it counted the number of days from a “Day One” that scholars have identified as August 13, 3113 b.c.e. Alongside this continuous but linear calendar there were two cyclical calendars. One, the Haab, was a solar-year calendar of 365 days, divided into 18 months of 20 days each plus an additional 5 special days at year’s end. The other was the Tzolkin, a Sacred Calendar of only 260 days, composed of a 20-day unit rotated 13 times. The two cyclical calendars were then meshed together, as two geared wheels (Fig. 67), to create the Sacred Round of fifty-two years, when these two counts returned to their common starting point and started the counts all over again. This “bundle” of fifty-two years was a most important unit of time, because it was linked to the promise of Quetzalcoatl, who at some point left Mesoamerica, to return on his Sacred Year. The Mesoamerican peoples therefore used to gather on mountains every fifty-two years to expect the promised Return of Quetzalcoatl. (In one such Sacred Year, 1519 a.d., a white-faced and bearded Spaniard, Hernando Cortes, landed on Mexico’s Yucatan coast and was welcomed by the Aztec king Montezuma as the returning god—a costly mistake, as we now know.) In Mesoamerica, the “bundle year” served for a countdown to the promised “Year of Return,” and the question is,
The Promised Land
155
Figure 67 Was the “Jubilee year” intended to serve a similar purpose? Searching for an answer, we find that when the linear fifty-year time unit is meshed with the zodiacal cyclical unit of seventy-two—the time that a shift of one degree requires—we arrive at 3,600 (50 × 72 = 3,600), which was the (mathematical) orbital period of Nibiru. By linking a Jubilee calendar and the zodiacal calendar to Nibiru’s orbit, was the biblical God saying, “When you enter the Promised Land, start the countdown to the Return”? Some two thousand years ago, during a time of great messianic fervor, it was recognized that the Jubilee was a divinely inspired time unit for predicting the future—for calculating when the meshed geared wheels of time will announce the Return. That recognition underlies one of the most important postbiblical books, known as The Book of Jubilees. Though available now only from its Greek and later translations, it was originally written in Hebrew, as fragments
156
THE END OF DAYS
found among the Dead Sea scrolls confirm. Based on earlier extrabiblical treatises and sacred traditions, it rewrote the Book of Genesis and part of Exodus according to a calendar based on the Jubilee Time Unit. It was a product, all scholars agree, of messianic expectations at the time when Rome occupied Jerusalem, and its purpose was to provide a means by which to predict when the Messiah shall come—when the End of Days shall occur. It is the very task we have undertaken.
10 THE CROSS ON THE HORIZON
About sixty years after the Israelites’ Exodus, highly unusual religious developments took place in Egypt. Some scholars view those developments as an attempt to adopt Monotheism—perhaps under the influence of the revelations at Mount Sinai. What they have in mind is the reign of Amenhotep (sometimes rendered as Amenophis) IV who left Thebes and its temples, gave up the worship of Amon, and declared ATEN the sole creator god. As we shall show, that was not an echo of Monotheism, but another harbinger of an expected Return—the return, into view, of the Planet of the Cross. The Pharaoh in question is better known by the new name he had adopted—Akhen-Aten (“The servant/worshipper of Aten”), and the new capital and religious center that he had established, Akhet-Aten (“Aten of the Horizon”), is better known by the site’s modern name, Tell el-Amarna (where the famed ancient archive of royal international correspondence was discovered). Scion of Egypt’s famed eighteenth Dynasty, Akhenaten reigned from 1379 to 1362 b.c.e., and his religious revolution did not last. The priesthood of Amon in Thebes led the opposition, presumably because it was deprived of its positions of power and wealth, but it is of course possible that the objections were genuinely on religious grounds, for Akhenaten’s successors (of whom most famed was Tut-Ankh-Amen) resumed the inclusion of Ra/Amon in their theophoric names. No sooner was Akhenaten gone than the new capital, its temples, and its palace were torn down and systematically
158
THE END OF DAYS
destroyed. Nevertheless, the remains that archaeologists have found throw enough light on Akhenaten and his religion. The notion that the worship of the Aten was a form of monotheism—worship of a sole universal creator—stems primarily from some of the hymns to the Aten that have been found; they include such verses as “O sole god, like whom there is no other . . . The world came into being by thy hand.” The fact that, in a clear departure from Egyptian customs, representation of this god in anthropomorphic form was strictly forbidden sounds very much like Yahweh’s prohibition, in the Ten Commandments, against making any “graven images” to worship. Additionally, some portions of the Hymns to Aten read as if they were clones of the biblical Psalms— O living Aten, How manifold are thy works! They are hidden from the sight of men. O sole god, beside whom there is no other! Thou didst create the earth according to thy desire whilst thou wast alone. The famed Egyptologist James H. Breasted (The Dawn of Conscience) compared the above verses to Psalm 104, beginning with verse 24— O Lord, how manifold are thy works! In wisdom hast thou made them all; the Earth is full of thy riches. The similarity, however, arises not because the two, Egyptian hymn and biblical Psalm, copy each other, but because both speak of the same celestial god of the Sumerian Epic of Creation—of Nibiru—that shaped the Heavens and created the Earth, imparting to it the “seed of life.” Virtually every book on ancient Egypt will tell you that the “Aten” disc that Akhenaten made the central object of worship represented the benevolent Sun. If so, it was odd that in a marked departure from Egyptian temple architecture that oriented the temples to the solstices on a southeast-
The Cross on the Horizon
159
northwest axis, Akhenaten oriented his Aten temple on an east–west axis—but had it facing west, away from the Sun at sunrise. If he was expecting a celestial reappearance from a direction opposite to that of where the Sun rises, it could not be the Sun. A close reading of the hymns reveals that Akhenaten’s “star god” was not Ra as Amon “the Unseen,” but a different kind of Ra: it was the celestial god who had “existed from primeval time . . . The one who renews himself ” as it reappears in all its glory, a celestial god that was “going afar and returning.” On a daily basis, those words could indeed apply to the Sun, but on a long-term basis, the description fitted Ra only as Nibiru: it did become unseen, the hymns said, because it was “far away in heaven,” because it went “to the rear of the horizon, to the height of heaven.” And now, Akhenaten announced, it was coming back in all its glory. Aten’s hymns prophesied its reappearance, its return “beautiful on the horizon of heaven . . . Glittering, beautiful, strong,” ushering a time of peace and benevolence to all. These words express clear messianic expectations that have nothing to do with the Sun. In support of the “Aten is the Sun” explanation, various depictions of Akhenaten are offered; they show (Fig. 68) him and his wife blessed by, or praying to, a rayed star; it is the Sun, most Egyptologists say. The hymns do refer to the Aten as a manifestation of Ra, which to Egyptologists who have deemed Ra to be the Sun means that Aten, too, represented the Sun; but if Ra was Marduk and the celestial Marduk was Nibiru, then Aten, too, represented Nibiru and not the Sun. Additional evidence comes from sky maps, some painted on coffin lids (Fig. 69), that clearly showed the twelve zodiacal constellations, the rayed Sun, and other members of the solar system; but the planet of Ra, the “Planet of Millions of Years,” is shown as an extra planet in its own large separate celestial barque beyond the Sun, with the pictorial hieroglyph for “god” in it—Akhenaten’s “Aten.” What, then, was Akhenaten’s innovation, or, rather, digression, from the official religious line? At its core his “transgression” was the same old debate that had taken place
Figure 68
Figure 69
The Cross on the Horizon
161
720 years earlier about timing. Then the issue was: Has Marduk/Ra’s time for supremacy come, has the Age of the Ram begun in the heavens? Akhenaten shifted the issue from Celestial Time (the zodiacal clock) to Divine Time (Nibiru’s orbital time), changing the question to: When will the Unseen celestial god reappear and become visible—“beautiful on the horizon of heaven”? His greatest heresy in the eyes of the priests of Ra/Amon can be judged by the fact that he erected a special monument honoring the Ben-Ben—an object that had been revered generations earlier as the vehicle in which Ra had arrived on Earth from the heavens (Fig. 70). It was an indication, we believe, that what he was expecting in connection with Aten was a Reappearance, a Return not just of the Planet of the Gods, but another arrival, a New Coming of the gods themselves! This, we must conclude, was the innovation, the difference introduced by Akhenaten. In defiance of the priestly establishment, and no doubt prematurely in their opinion, he was announcing the coming of a new messianic time. This heresy was aggravated by the fact that Akhenaten’s pronouncements about the returning Aten were accompanied by a personal claim: Akhenaten increasingly referred to himself as the god’s prophet-son, one “who came forth from the god’s body,” and to whom alone the deity’s plans were revealed:
Figure 70
162
THE END OF DAYS
There is no other that knoweth thee except thy son Akhenaten; Thou hast made him wise in thy plans. And this, too, was unacceptable to the Theban priests of Amon. As soon as Akhenaten was gone (and it is uncertain how . . . ), they restored the worship of Amon—the Unseen god—and smashed and destroyed all that Akhenaten had erected. That the Aten episode in Egypt, as the introduction of the Jubilee—the “Year of the Ram”—were the stirrings of a wider expectation of a Return of a celestial “star god” is evident from yet another biblical reference to the Ram, yet another manifestation of a Countdown to the Return. It is the record of an unusual incident at the end of the Exodus. It is a tale that is replete with puzzling aspects, and one that ends with a divinely inspired vision of things to come. The Bible repeatedly declared divination by examining animal entrails, consulting with spirits, soothsaying, enchanting, conjuring, and fortune-telling to be “abominations unto Yahweh”—all manners of sorcery practiced by other nations that the Israelites must avoid. At the same time, it asserted—quoting Yahweh himself—that dreams, oracles, and visions could be legitimate ways of divine communication. It is such a distinction that explains why the Book of Numbers devotes three long chapters (22–24) to tell—approvingly!— the story of a non-Israelite Seer and Oracle-teller. His name was Bil’am, rendered Balaam in English Bibles. The events described in those chapters took place when the Israelites (“Children of Israel” in the Bible), having left the Sinai Peninsula, went around the Dead Sea on the east, advancing northward. As they encountered the small kingdoms that occupied the lands east of the Dead Sea and the Jordan River, Moses sought from their kings permission for peaceful passage; it was, by and large, refused. The Israelites, having just defeated the Ammonites, who did not let them pass through peacefully, now “were encamped in the
The Cross on the Horizon
163
plains of Mo’ab, on the side of the Jordan that is opposite Jericho,” awaiting the Moabite king’s permission to pass through his land. Unwilling to let “the horde” pass yet afraid to fight them, the king of Mo’ab—Balak the son of Zippor—had a bright idea. He sent emissaries to fetch an internationally renowned seer, Bala’am the son of Be’or, and have him “put a curse on these people for me,” to make it possible to defeat and chase them away. Balaam had to be entreated several times before he accepted the assignment. First at Balaam’s home (somewhere near the Euphrates River?) and then on the way to Moab, an Angel of God (the word in Hebrew, Mal’ach, literally means “emissary”) appears and gets involved in the proceedings; he is sometimes visible and sometimes invisible. The Angel allows Balaam to accept the assignment only after making sure that Balaam understands that he is to utter only divinely inspired omens. Puzzlingly, Balaam calls Yahweh “my God” when he repeats this condition, first to the king’s ambassadors and then to the Moabite king himself. A series of oracular settings are then arranged. The king takes Balaam to a hilltop from which he can see the whole Israelite encampment, and on the Seer’s instructions he erects seven altars, sacrifices seven bullocks and seven rams, and awaits the oracle; but from Balaam’s mouth come words not of accusation but of praise for the Israelites. The persistent Moabite king then takes Balaam to another mount, from which just the edge of the Israelite encampment can be seen, and the procedure is repeated a seond time. But again Balaam’s oracle blesses rather than curses the Israelites: I see them coming out of Egypt protected by a god with spreading ram’s horns, he says—it is a nation destined for kingship, a nation that like a lion will arise. Determined to try again, the king now takes Balaam to a hilltop that faces the desert, facing away from the Israelite encampment; “maybe the gods will let you proclaim curses there,” he says. Seven altars are again erected, on which seven bullocks and seven rams are sacrificed. But Balaam now sees the Israelites and their future not with human eyes
164
THE END OF DAYS
but “in a divine vision.” For the second time he sees the nation protected, as it came out of Egypt, by a god with spreading rams’ horns, and envisions Israel as a nation that “like a lion will arise.” When the Moabite king protests, Balaam explains that no matter what gold or silver he be offered, he can utter only the words that God puts in his mouth. So the frustrated king gives up and lets Balaam go. But now Balaam offers the king free advice: Let me tell you what the future holds, he says to the king—“that which will come about to this nation and to your people at the end of days”—and proceeds to describe the divine vision of the future by relating it to a “star”: I see it, though not now; I behold it, though it is not near: A Star of Jacob is on its course. A Scepter from Israel will arise— Moab’s quarters it will crush, all the Children of Seth it will unsettle. Numbers 24: 17 Balaam then turned and cast his eyes toward the Edomites, Amalekites, Kenites, and other Canaanite nations, and pronounced an oracle thereon: Those who will survive the wrath of Jacob shall fall into the hands of Assyria; then Assyria’s turn will come, and it shall forever perish. And having pronounced that oracle, “Balaam rose up and went back to his place; and Balak too went on his way.” Though the Balaam episode has naturally been the subject of discussion and debate by biblical and theological scholars, it remains baffling and unresolved. The text switches effortlessly between references to the Elohim—“gods” in the plural—and to Yahweh, the sole God, as the Divine Presence. It gravely transgresses the Bible’s most basic prohibition by applying to the God who brought the Israelites out of Egypt a physical image, and then compounds the transgression by envisioning Him in the image of “a ram with spreading horns”—an image that has been the Egyptian depiction of Amon (Fig. 71)! The approving attitude toward a profes-
The Cross on the Horizon
165
Figure 71 sional seer in a Bible that prohibited soothsaying, conjuring, and so on adds to the feeling that the whole tale was, originally, a non-Israelite tale, and yet the Bible incorporated it, devoting to it substantial space, so the incident and its message must have been considered a significant prelude to the Israelite possession of the Promised Land. The text suggests that Balaam was an Aramaean, residing somewhere up the Euphrates River; his prophetic oracles expanded from the fate of the Children of Jacob to the place of Israel among the nations to oracles regarding the future of such other nations—even of distant and yet-to-come imperial Assyria. The oracles were thus an expression of wider non-Israelite expectations at the time. By including the tale, the Bible combined the Israelite destiny with Mankind’s universal expectations. Those expectations, the Balaam tale indicates, were chan-
166
THE END OF DAYS
neled along two paths—the zodiacal cycle on the one hand, and the Returning Star’s course on the other hand. The zodiacal references are strongest regarding the Age of the Ram (and its god!) at the time of the Exodus, and become oracular and prophetic as the Seer Balaam envisions the Future, when the zodiacal constellation symbols of the Bull and the Ram (“bullocks and rams for sevenfold sacrifices”) and the Lion (“when the Royal Trumpet shall be heard in Israel”) are invoked (Numbers Chapter 23). And it is when envisioning that Distant Future that the Balaam text employs the significant term At the End of Days as the time to which the prophetic oracles apply (Numbers 24: 14). The term directly links these non-Israelite prophecies to the destiny of Jacob’s offspring because it was used by Jacob himself as he lay on his deathbed and gathered his children to hear oracles regarding their future (Genesis Chapter 49). “Come gather together,” he said, “that I may tell you that which shall befall you at the End of Days.” The oracles, individually stated for each one of the twelve future Tribes of Israel, are deemed by many to be related to the twelve zodiacal constellations. And what about the Star of Jacob—an explicit vision by Balaam? In scholarly biblical discussions, it is usually considered in an astrological rather than an astronomical context at best, and more often than not, the tendency has been to deem the reference to “Jacob’s Star” as purely figurative. But what if the reference was indeed to a “star” orbiting on its course—a planet prophetically seen though it is not yet visible? What if Balaam, like Akhenaten, was speaking of the return, the reappearance, of Nibiru? Such a return, it must be realized, would be an extraordinary event that occurs once in several millennia, an event that had repeatedly signified the most profound watersheds in the affairs of gods and men. This is not just a rhetorical question. In fact, the unfolding events were increasingly indicating that an overwhelmingly significant occurrence was in the offing. Within a century or
The Cross on the Horizon
167
so of the preoccupations and predictions regarding the Returning Planet that we find in the tales of the Exodus, Balaam, and Akhenaten’s Egypt, Babylon itself started to provide evidence of such wide-spreading expectations, and the most prominent clue was the Sign of the Cross. In Babylon, the time was that of the Kassite dynasty, of which we have written earlier. Little has remained of their reign in Babylon itself, and as stated earlier those kings did not excel in keeping royal records. But they did leave behind telltale depictions—and international correspondence of letters on clay tablets. It was in the ruins of Akhet-Aten, Akhenaten’s capital—a site now known as Tell el-Amarna in Egypt—that the famed “el-Amarna Tablets” were discovered. Of the 380 clay tablets, all except three were inscribed in the Akkadian language, which was then the language of international diplomacy. While some of the tablets represented copies of royal letters sent from the Egyptian court, the bulk were original letters received from foreign kings. The cache was the royal diplomatic archive of Akhenaten, and the tablets were predominantly correspondence he had received from the kings of Babylon! Did Akhenaten use those exchanges of letters with his counterparts in Babylon to tell them of his newfound Aten religion? We really don’t know, for all we have are a Babylonian king’s letters to Akhenaten in which he complained that gold sent to him was found short in weight, that his ambassadors were robbed on the way to Egypt, or that the Egyptian king failed to inquire about his health. Yet the frequent exchanges of ambassadors and other emissaries, even offers of intermarriage, as well as the calling of the Egyptian king “my brother” by the Babylonian king, must lead to a conclusion that the hierarchy in Babylon was fully aware of the religious goings-on in Egypt; and if Babylon wondered, “What is this ‘Ra as a Returning Star’ commotion?” Babylon must have realized that it was a reference to “Marduk as a Returning Planet”—to Nibiru orbiting back. With the tradition of celestial observations so much older and more advanced in Mesopotamia than in Egypt, it is of
168
THE END OF DAYS
course possible that the royal astronomers of Babylon had come to conclusions regarding Nibiru’s return without Egyptian aid, and even ahead of the Egyptians. Be that as it may, it was in the thirteenth century b.c.e. that the Kassite kings of Babylon started to signal, in a variety of ways, their own fundamental religious changes. In 1260 b.c.e. a new king ascended the throne in Babylon and adopted the name Kadashman-Enlil—a theophoric name surprisingly venerating Enlil. It was no passing gesture, for he was followed on the throne, for the next century, by Kassite kings bearing theophoric names venerating not only Enlil but also Adad—a surprising gesture suggesting a desire for divine reconciliation. That something unusual was expected was further evidenced on commemorative monuments called kudurru—“rounded stones”—that were set up as boundary markers. Inscribed with a text stating the terms of the border treaty (or land grant) and the oaths taken to uphold it, the kudurru was sanctified by symbols of the celestial gods. The divine zodiacal symbols—all twelve of them—were frequently depicted (Fig. 72); orbiting above them were the emblems of the Sun, the Moon, and Nibiru. In another depiction (Fig. 73), Nibiru was shown in the company of Earth (the seventh planet) and the Moon (and the umbilical-cutter symbol for Ninmah). Significantly, Nibiru was depicted no longer by the Winged Disc symbol, but rather in a new way—as the planet of the radiating cross—befitting its description by the Sumerians in the “Olden Days” as a radiating planet about to become the “Planet of the Crossing.” This way of showing a long-unobserved Nibiru by a symbol of a radiating cross began to become more common, and soon the Kassite kings of Babylon simplified the symbol to just a Sign of the Cross, replacing with it the Winged Disc symbol on their royal seals (Fig. 74). This cross symbol, which looks like the much later Christian “Maltese Cross,” is known in studies of ancient glyptic as a “Kassite Cross.” As another depiction indicates, the symbol of the cross was for a planet clearly not the same as the Sun, which is separately shown along with the Moon-crescent and the six-pointed star
The Cross on the Horizon
169
Figure 72
Figure 73 symbol for Mars (Fig. 75). As the first millennium b.c.e. began, Nibiru’s Sign of the Cross spread from Babylonia to seal designs in nearby lands. In the absence of Kassite religious or literary texts, it is a matter of conjecture what messianic expectations might have
170
THE END OF DAYS
Figure 74 accompanied these changes in depictions. Whatever they were, they intensified the ferocity of the attacks by the Enlilite states—Assyria, Elam—on Babylon and their opposition to Marduk’s hegemony. Those attacks delayed, but did not prevent, the eventual adoption of the Sign of the Cross in Assyria itself. As royal monuments reveal, it was worn, most conspicuously, by Assyria’s kings on their chests, near their
Figure 75
The Cross on the Horizon
171
hearts (Fig. 76)—the way devout Catholics wear the cross nowadays. Religiously and astronomically, it was a most significant gesture. That it was also a widespread manifestation is suggested by the fact that in Egypt, too, depictions were found of a king-god wearing, like his Assyrian counterparts, the sign of the cross on his chest (Fig. 77). The adoption of the Sign of the Cross as the emblem of Nibiru, in Babylon, Assyria, and elsewhere, was not a surprising innovation. The sign had been used before—by the Sumerians and Akkadians. “Nibiru—let ‘Crossing’ be its name!” the Epic of Creation stated; and accordingly its symbol, the cross, had been employed in Sumerian glyptic to denote Nibiru, but
Figure 76
172
THE END OF DAYS
Figure 77 then it always signified its Return into visibility. Enuma elish, the Epic of Creation, clearly stated that after the Celestial Battle with Tiamat, the Invader made a grand orbit around the Sun and returned to the scene of the battle. Since Tiamat orbited the Sun in a plane called the Ecliptic (as other members of our Sun’s planetary family do), it is to that place in the heavens that the Invader had to return; and when it does so, orbit after orbit after orbit, it is there that it crosses the plane of the ecliptic. A simple way to illustrate this would be to show the orbital path of the well-known Halley’s Comet (Fig. 78), which emulates on a greatly reduced scale the orbit of Nibiru: its inclined orbit brings it, as it nears the Sun, from the south, from below the ecliptic, near Uranus. It arches above the ecliptic and makes the turn around the Sun, saying “Hello” to Saturn, Jupiter, and Mars; then it comes down and crosses the ecliptic near the site of Nibiru’s Celestial Battle with Tiamat—the Crossing (marked “X”)—and is gone, only to come back as its orbital Destiny prescribes. That point, in the heavens and in time, is The Crossing—
The Cross on the Horizon
173
Figure 78
it is then, Enum elish stated, that the planet of the Anunnaki becomes the Planet of the Cross: Planet NIBIRU: The Crossroads of Heaven and Earth it shall occupy . . . Planet NIBIRU: The central position he holds . . . Planet NIBIRU: It is he who without tiring the midst of Tiamat keeps crossing; Let “Crossing” be his name!iru, and its glyptical depictions—even in early Sumerian times—were the Cross. That record began with the Deluge. Several texts dealing
174
THE END OF DAYS
with the Deluge associated the watershed catastrophe with the appearance of the celestial god, Nibiru, in the Age of the Lion (circa 10,900 b.c.e.)—it was “the constellation of the Lion that measured the waters of the deep,” one text said. Other texts described the appearance of Nibiru at Deluge time as a radiating star, and depicted it accordingly (Fig. 79)—
Figure 79 When they shall call out “Flooding!” It is the god Nibiru . . . Lord whose shining crown with terror is laden; Daily within the Lion he is afire. The planet returned, reappeared, and again became “Nibiru” when Mankind was granted farming and husbandry, in the mid-eighth millennium b.c.e.; depictions (on cylinder seals) illustrating the beginning of agriculture used the Sign of the Cross to show Nibiru visible in Earth’s skies (Fig. 80). Finally and most memorably for the Sumerians, the planet was visible once again when Anu and Antu came to Earth on a state visit circa 4000 b.c.e., in the Age of the Bull (Taurus). The city that was later known for millennia as Uruk was established in their honor, a ziggurat was erected, and from its stages the appearance of the planets on the horizon, as the night sky darkened, was observed. When Nibiru came into view, a shout went up: “The Creator’s image has arisen!” and all present broke into hymnal songs of praise for “the planet of the Lord Anu.”
The Cross on the Horizon
175
Figure 80 Nibiru’s appearance at the start of the Age of the Bull meant that at the time of heliacal rising—when dawn begins but the horizon is still dark enough to see the stars—the constellation in the background was that of Taurus. But the fastmoving Nibiru, arcing in the skies as it circled the Sun, soon descended back to cut across the planetary plain (“ecliptic”) to the point of Crossing. There the crossing was observed against the background of the constellation of the Lion. Several depictions, on cylinder seals and in astronomical tablets, used the cross symbol to indicate Nibiru’s arrival when Earth was in the Age of the Bull and its crossing was observed in the constellation of the Lion (cylinder seal depiction, Fig. 81, and as illustrated in Fig. 82). The change from the Winged Disc symbol to the Sign of the Cross thus was not an innovation; it was reverting to the
Figure 81
176
THE END OF DAYS
Figure 82
way in which the Celestial Lord had been depicted in earlier times—but only when in its great orbit it crossed the ecliptic and became “Nibiru.” As in the past, the renewed display of the Sign of the Cross signified reappearance, coming back into view, RETURN.
11 THE DAY OF THE LORD
As the last millennium b.c.e. began, the appearance of the Sign of the Cross was a harbinger of the Return. It was also then that a temple to Yahweh in Jerusalem forever linked its sacred site to the course of historic events and to Mankind’s messianic expectations. The time and the place were no coincidence: the impending Return dictated the enshrinement of the erstwhile Mission Control Center. Compared to the mighty and conquering imperial powers of those days—Babylonia, Assyria, Egypt—the Hebrew kingdom was a midget. Compared to the greatness of their capitals—Babylon, Nineveh, Thebes—with their sacred precincts, ziggurats, temples, processional ways, ornate gates, majestic palaces, hanging gardens, sacred pools, and river harbors—Jerualem was a small city with hastily built walls and an iffy water supply. And yet, millennia later, it is Jerusalem, a living city, that is in our hearts and in the daily headlines, while the grandeur of the other nations’ capitals has turned to dust and crumbled ruins. What made the difference? The Temple of Yahweh that was built in Jerusalem, and its Prophets whose oracles came true. Their prophecies, one therefore believes, still hold the key to the Future. The Hebrew association with Jerusalem, and in particular with Mount Moriah, goes back to the time of Abraham. It was when he had fulfilled his assignment of protecting the spaceport during the War of the Kings that he was greeted by Malkizedek, the king of Ir-Shalem ( Jerusalem), “who was a priest of the God Most High.” There Abraham was blessed,
178
THE END OF DAYS
and in turn took an oath, “by the God Most High, possessor of Heaven and Earth.” It was again there, when Abraham’s devotion was tested, that he was granted a Covenant with God. Yet it took a millennium, until the right time and circumstances, for the Temple to be built. The Bible asserted that the Jerusalem temple was unique— and so indeed it was: it was conceived to preserve the “Bond Heaven-Earth” that the DUR.AN.KI of Sumer’s Nippur had once been. And it came to pass in the fourhundred and eightieth year after the Children of Israel came out of Egypt, in the fourth year of Solomon’s reign, in the second month, that he began to build the House of the Lord. Thus does the Bible record, in the first Book of Kings (6:1), the memorable start of the construction of the Temple of Yahweh in Jerusalem by King Solomon, giving us the exact date of the event. It was a crucial, decisive step whose consequences are still with us; and the time, it must be noted, was when Babylon and Assyria adopted the Sign of the Cross as the harbinger of the Return . . . The dramatic story of the Jerusalem Temple starts not with Solomon but with King David, Solomon’s father; and how he happened to become Israel’s king is a tale that reveals a divine plan: to prepare for the Future by resurrecting the Past. David’s legacy (after a reign of 40 years) included a greatly expanded realm, reaching in the north as far as Damascus (and including the Landing Place!), many magnificent Psalms, and the groundwork for Yahweh’s temple. Three divine emissaries played key roles in the making of this king and his place in history; the Bible lists them as “Samuel the Seer, Nathan the Prophet, and Gad the Visionary.” It was Samuel, the custodian-priest of the Ark of the Covenant, who was instructed by God to “take the youth David, son of Jesse, from herding sheep to be shepherd of Israel,” and
The Day of the Lord
179
Samuel “took the oil-filled horn and anointed him to reign over Israel.” The choosing of the young David, who was shepherding his father’s flock, to be shepherd over Israel was doubly symbolic, for it harks back to the golden age of Sumer. Its kings were called LU.GAL, “Great Man,” but they strove to earn the cherished title EN.SI, “Righteous Shepherd.” That, as we shall see, was only the beginning of David’s and the Temple’s links to the Sumerian past. David began his reign in Hebron, south of Jerusalem, and that, too, was a choice filled with historic symbolism. The previous name of Hebron, the bible repeatedly pointed out, was Kiryat Arba, “the fortified city of Arba.” And who was Arba? “He was a Great Man of the Anakim”—two biblical terms that render in Hebrew the Sumerian LU.GAL and ANUNNAKI. Starting with passages in the book of Numbers, and then in Joshua, Judges, and Chronicles, the Bible reported that Hebron was a center of the descendants of the “Anakim, who as the Nefilim are counted,” thus connecting them to the Nefilim of Genesis 6 who intermarried with the Daughters of Adam. Hebron was still inhabited at the time of the Exodus by three sons of Arba, and it was Caleb the son of Jephoneh who captured the city and slew them in behalf of Joshua. By choosing to be king in Hebron, David established his kingship as a direct continuation of kings linked to the Anunnaki of Sumerian lore. He reigned in Hebron for seven years, and then moved his capital to Jerusalem. His seat of kingship—the “City of David”—was built on Mount Zion, just south of and separated by a small valley from Mount Moriah (where the platform built by the Anunnaki was, Fig. 83). He constructed the Miloh, the Filling, to close the gap between the two mounts, as a first step to building, on the platform, Yahweh’s temple; but all he was allowed to erect on Mount Moriah was an altar. God’s word, through the Prophet Nathan, was that because David had shed blood in his many wars, not he but his son Solomon would build the temple. Devastated by the prophet’s message, David went and “sat before Yahweh,” in front of the Ark of the Covenant (which
180
THE END OF DAYS
Figure 83 was still housed in a portable tent). Accepting God’s decision, he asked for one reward for his devout loyalty to Him: an assurance, a sign, that it would indeed be the House of David that would build the Temple and be forever blessed. That very night, sitting in front of the Ark of the Covenant by which Moses had communicated with the Lord, he received a divine sign: he was given a Tavnit—a scale model—of the future temple! One can shrug off the tale’s veracity were it not for the fact that what happened that night to King David and his temple project was the equivalent of the Twilight Zone tale of the Sumerian king Gudea, who more than a thousand years earlier was likewise given in a vision-dream a tablet with the architectural plan and a brick mold for the construction of a temple in Lagash for the god Ninurta. When he neared the end of his days, King David summoned to Jerusalem all the leaders of Israel, including the
The Day of the Lord
181
tribal chiefs and the military commanders, the priests and the royal office holders, and told them of Yahweh’s promise; and in full view of those gathered he handed to his son Solomon “the Tavnit of the temple and all its parts and chambers . . . the Tavnit that he received by the Spirit.” There was more, for David also handed over to Solomon “all that Yahweh, in His own hand written, gave to me for understanding the workings of the Tavnit”: A set of accompanying instructions, divinely written (I Chronicles, Chapter 28). The Hebrew term Tavnit is translated in the King James English Bible “pattern” but is rendered “plan” in more recent translations, suggesting that David was given some kind of an architectural drawing. But the Hebrew word for “plan” is Tokhnit. Tavnit, on the other hand, is derived from the root verb that means “to construct, to build, to erect,” so what David was given and what he handed over to his son Solomon was a “constructed model”—in today’s parlance, a scale model. (Archaeological finds throughout the ancient Near East have indeed unearthed scale models of chariots, wagons, ships, workshops, and even multilevel shrines.) The biblical books of Kings and Chronicles provide precise measurements and clear structural details of the Temple and its architectural designs. Its axis ran east–west, making it an “eternal temple” aligned to the equinox. Consisting of three parts (see Fig. 64), it adopted the Sumerian temple plans of a forepart (Ulam in Hebrew), a great central hall (Hekhal in Hebrew, stemming from the Sumerian E.GAL, “Large Abode”), and a Holy of Holies for the Ark of the Covenant. That innermost section was called the Dvir (the “Speaker”)—for it was by means of the Ark of the Covenant that God spoke to Moses. As in Sumerian ziggurats, which traditionally were built to express the sexagesimal’s “base sixty” concept, the Temple of Solomon also adopted sixty in its construction: the main section (the Hall) was 60 cubits (about 100 feet) in length, 20 cubits (60:3) wide, and 120 (60 × 2) cubits in height. The Holy of Holies was 20 by 20 cubits—just enough to hold the Ark of the Covenant with the two golden Cherubim atop it (“their wings touching”). Tradition, textual evi-
182
THE END OF DAYS
dence, and archaeological research indicate that the Ark was placed precisely on the extraordinary rock on which Abraham was ready to sacrifice his son Isaac; its Hebrew designation, Even Shatiyah, means “Foundation Stone,” and Jewish legends hold that it is from it that the world will be re-created. Nowadays it is covered over and surrounded by the Dome of the Rock (Fig. 84). (Readers can find more about the sacred rock and its enigmatic cave and secret subterranean passages in The Earth Chronicles Expeditions.) Though these were not monumental measurements compared to the skyscraping ziggurats, the Temple, when completed, was truly magnificent; it was also unlike any other contemporary temple in that part of the world. No iron or iron tools were used for its erection upon the platform (and absolutely none in its operation—all the utensils were of copper or bronze), and the building was inlaid inside with gold; even the nails holding the golden plates in place were made of gold. The quantities of gold used ( just “for the Holy of
Figure 84
The Day of the Lord
183
Holies, 600 talents; for the nails, fifty shekels”) were enormous—so much so that Solomon arranged for special ships to bring gold from Ophir (believed to be in southeast Africa). The Bible offers no explanation, neither for the prohibition against using anything made of iron on the site nor for the inlaying of everything inside the temple with gold. One can only speculate that iron was shunned because of its magnetic properties, and gold because it is the best electrical conductor. It is significant that the only two other known instances of shrines so inlaid with gold are on the other side of the world. One is the great temple in Cuzco, the Inca capital in Peru, where the great god of South America, Viracocha, was worshipped. It was called the Coricancha (“Golden Enclosure”), for its Holy of Holies was completely inlaid with gold. The other is in Puma-Punku on the shores of Lake Titicaca in Bolivia, near the famed ruins of Tiwanaku. The ruins there consist of the remains of four chamberlike stone buildings whose walls, floors, and ceilings were each cut out of a single colossal stone block. The four enclosures were completely inlaid inside with golden plates that were held in place with golden nails. Describing the sites (and how they were looted by the Spaniards) in The Lost Realms, I have suggested that Puma-Punku was erected for the stay of Anu and Antu when they visited Earth circa 4000 b.c.e. According to the Bible, tens of thousands of workmen were needed for seven years for the immense undertaking. What, then, was the purpose of this House of the Lord? When all was ready, with much pomp and circumstance, the Ark of the Covenant was carried by priests and placed in the Holy of Holies. As soon as the Ark was put down and the curtains separating the Holy of Holies from the great hall were drawn, “the House of the Lord was filled with a cloud and the priests could not remain standing.” Then Solomon offered a thanksgiving prayer, saying: Lord who has chosen to dwell in the cloud: I have built for Thee a stately House,
184
THE END OF DAYS
a place where you may dwell forever . . . Though the uttermost heavens cannot contain Thee, May you hear our supplications from Thine seat in heaven. “And Yahweh appeared to Solomon that night, and said to him: I have heard your prayer; I have chosen this site for my house of worship . . . From heaven I will hear the prayers of my people and forgive their transgressions . . . Now I have chosen and consecrated this House for my Shem to remain there forever” (II Chronicles, Chapters 6–7). The word Shem—here and earlier, as in the opening verses of chapter 6 of Genesis—is commonly translated “Name.” As far back as in my first book, The Twelfth Planet, I have suggested that the term originally and in the relevant context referred to what the Egyptians called the “Celestial Boat” and the Sumerians called MU—“sky ship”—of the gods. Accordingly, the Temple in Jerusalem, built atop the stone platform, with the Ark of the Covenant placed upon the sacred rock, was to serve as an earthly bond with the celestial deity—both for communicating and for the landing of his sky ship! Throughout the Temple there was no statue, no idol, no graven image. The only object within it was the hallowed Ark of the Covenant—and “there was nothing in the Ark except the two tablets that were given to Moses in Sinai.” Unlike the Mesopotamian ziggurat temples, from Enlil’s in Nippur to Marduk’s in Babylon, this one was not a place of residence for the deity, where the god lived, ate, slept, and bathed. It was a House of Worship, a place of divine contact; it was a temple for a Divine Presence by the Dweller in the Clouds. It is said that a picture is worth a thousand words; it is certainly true where there are few pertinent words but many relevant pictures. It was about the time that the Jerusalem temple was completed and consecrated to the Dweller in the Clouds that a noticeable change in the sacred glyptic—the depiction of the divine—took place where such depictions were common and
The Day of the Lord
185
permissible, and (at the time) first and foremost in Assyria. They showed, most clearly, the god Ashur as a “dweller of the clouds,” full face or with just his hand showing, frequently depicted holding a bow (Fig. 85)—a depiction reminding one of the Bible’s tale of the Bow in the Cloud that was a divine sign in the aftermath of the Deluge. A century or so later, Assyrian depictions introduced a new variant of the God in the Cloud. Classified as “Deity in a Winged Disc,” they clearly showed a deity inside the emblem of the Winged Disc, by itself (Fig. 86a) or as it joins the Earth (seven dots) and the Moon (crescent) (Fig. 86b). Since the Winged Disc represented Nibiru, it had to be a deity arriving with Nibiru. Clearly, then, these depictions implied expectations of the nearing arrival not only of the planet, but also of its divine dwellers, probably led by Anu himself. The changes in glyphs and symbols, begun with the Sign of the Cross, were manifestations of more profound expectations, of overwhelming changes and wider preparations called for by the expected Return. However, the expectations and preparations were not the same in Babylon as in Assyria. In one, the messianic expectations were centered on the god(s) who were already there; in the other, the expectations related to the god(s) about to return and reappear.
Figure 85
186
THE END OF DAYS
Figure 86a
Figure 86b In Babylon the expectations were mostly religious—a messianic revival by Marduk through his son Nabu. Great efforts were undertaken to resume, circa 960 b.c.e., the sacred Akitu ceremonies in which the revised Enuma elish— appropriating to Marduk the creation of Earth, the reshaping of the Heavens (the Solar System), and the fashioning of Man—was publicly read. The arrival of Nabu from his shrine in Borsippa ( just south of Babylon) to play a crucial role in the ceremonies was an essential part of the revival. Accordingly, the Babylonian kings who reigned between 900 b.c.e. and 730 b.c.e. resumed bearing Marduk-related names and, in great numbers, Nabu-related names. The changes in Assyria were more geopolitical; historians consider the time—circa 960 b.c.e.—as the start of the Neo-
The Day of the Lord
187
Assyrian Imperial period. In addition to inscriptions on monuments and palace walls, the main source of information about Assyria in those days is the annals of its kings, in which they recorded what they did, year by year. Judging by that, their main occupation was Conquest. With unparalleled ferocity, its kings set out on one military campaign after another not only to have dominion over the olden Sumer & Akkad, but also over what they deemed essential for the Return: Control of the space-related sites. That this was the purpose of the campaigns is evident not only from their targets, but also from the grand stone reliefs on the walls of Assyrian palaces from the ninth and eighth centuries b.c.e. (which one can see in some of the world’s leading museums): as on some cylinder seals, they show the king and the high priest, accompanied by winged Cherubim—Anunnaki “astronauts”—flanking the Tree of Life as they welcome the coming of the god in the Winged Disc (Fig. 87a,b). A divine arrival was clearly expected! Historians connect the start of this Neo-Assyrian period to the establishment of a new royal dynasty in Assyria, when Tiglath-Pileser II ascended the throne in Nineveh. The pattern of aggrandizement at home and conquest, destruction, and annexation abroad was set by that king’s son and grandson,
Figure 87a
188
THE END OF DAYS
Figure 87b who followed him as kings of Assyria. Interestingly, their first target was the area of the Khabur River, with its important trade and religious center—Harran. Their successors took it from there. Frequently bearing the same name as previous glorified kings (hence the numerations I, II, III, etc. for them), the successive kings expanded Assyrian control in all directions, but with special emphasis on the coastal cities and mountains of La-ba-an (Lebanon). Circa 860 b.c.e. Ashurnasirpal II—who wore the cross symbol on his chest (see Fig. 76)—boasted of capturing the Phoenician coastal cities of Tyre, Sidon, and Gebal (Byblos), and of ascending the Cedar Mountain with its sacred site, the olden Landing Place of the Anunnaki. His son and successor Shalmaneser III recorded the erecting there of a commemorative stela calling the place Bit Adini. The name literally meant “the Eden Abode”—and was known by that same name to the biblical Prophets. The Prophet Ezekiel castigated the king of Tyre for deeming himself a god because he had been to that sacred place and “moved within its fiery stones”; and the Prophet Amos listed it when he spoke of the coming Day of the Lord. As could be expected, the Assyrians then turned their at-
The Day of the Lord
189
tention to the other space-related site. After the death of Solomon his kingdom was split by his contending heirs into “Judea” (with Jerusalem as capital) in the south and “Israel” and its ten tribes in the north. In his best-known inscribed monument, the Black Obelisk, Shalmaneser III recorded the receipt of tribute from the Israelite king Jehu and, in a scene dominated by the Winged Disc emblem of Nibiru, depicted him kneeling in obeisance (Fig. 88). Both the Bible and the Assyrian annals recorded the subsequent invasion of Israel by Tiglath-Pileser III (744–727 b.c.e.), the detaching of its better provinces, and the partial exile of its leaders. Then, in 722 b.c.e., his son Shalmaneser V overran what was left of Israel, exiled all of its people, and replaced them with foreigners; the Ten Tribes were gone, their whereabouts remaining a lasting mystery. (Why and how, on his return from Israel, Shalmaneser was punished and abruptly replaced on the throne by another son of Tiglath-Pileser is also an unsolved mystery.) Having already captured the Landing Place, the Assyrians were now at the doortstep of the final prize, Jerusalem; but again they held off the final assault. The Bible explained it by attributing it all to the will of Yahweh; an examination of
Figure 88
190
THE END OF DAYS
Assyrian records suggests that what and when they did in Israel and Judea was synchronized with what and when they did about Babylon and Marduk. After the capture of the space-related site in Lebanon— but before launching the campaigns toward Jerusalem—the Assyrians took an unprecedented step for reconciliation with Marduk. In 729 b.c.e. Tiglath-Pileser III entered Babylon, went to its sacred precinct, and “took the hands of Marduk.” It was a gesture with great religious and diplomatic significance; the priests of Marduk approved the reconciliation by inviting Tiglath-Pileser to share in the god’s sacramental meal. Following that, Tiglath-Pileser’s son Sargon II marched southward into the olden Sumer & Akkad areas, and after seizing Nippur turned back to enter Babylon. In 710 b.c.e. he, like his father, “took the hands of Marduk” during the New Year ceremonies. The task of capturing the remaining space-related site fell to Sargon’s successor, Sennacherib. The assault on Jerusalem in 704 b.c.e., at the time of its King Hezekiah, is amply recorded both in Sennacherib’s annals and in the Bible. But while Sennacherib in his inscriptions spoke just of the successful seizing of Judean provincial cities, the Bible provides a detailed tale of the siege of Jerusalem by a mighty Assyrian army that was miraculously wiped out by Yahweh’s will. Encircling Jerusalem and entrapping its people, the Assyrians engaged in psychological warfare by shouting discouraging words to the defenders on the city’s walls, ending with vilification of Yahweh. The shocked king, Hezekiah, tore his clothes in mourning and prayed in the Temple to “Yahweh, the God of Israel, who rests upon the Cherubim, the sole God upon all the nations,” for help. In response, the Prophet Isaiah conveyed to him God’s oracle: the Assyrian king shall never enter the city, he will return home in failure, and there he will be assassinated. And it came to pass that night that the Angel of Yahweh went forth and smote in the camp of the Assyrians a hundred and eighty-five thousand.
The Day of the Lord
191
And at sunrise, lo and behold, they were all dead corpses. So Sennacherib, the king of Assyria, departed and journeyed back to his abode in Nineveh 2 Kings 19: 35–36 To make sure the reader realizes that the whole prophecy came true, the biblical narrative then continues: “And Sennacherib went away, and journeyed back to Nineveh; and it was when he was bowing down in his temple to his god . . . that Adramelekh and Sharezzer struck him down with a sword, and they fled to the land of Ararat. His son Esarhaddon became king in his stead.” The biblical postscript is an amazingly informed record: Sennacherib was indeed murdered, by his own sons, in 681 b.c.e. For the second time, Assyrian kings who attacked Israel or Judea were dead as soon as they went back. While prophecy—the foretelling of what is yet to happen—is inherently what is expected of a prophet, the Prophets of the Hebrew Bible were more than that. From the very beginning, as was made clear in Leviticus, a prophet was not to be “a magician, a wizard, an enchanter, a charmer or seer of spirits, a fortune-teller, or one who conjures the dead”—a pretty comprehensive list of the varied fortune-tellers of the surrounding nations. Their mission as Nabih—“Spokesmen”—was to convey to kings and peoples Yahweh’s own words. And as Hezekiah’s prayer made clear, while the Children of Israel were His Chosen People, He was “sole God upon all the nations.” The Bible speaks of prophets from Moses on, but only fifteen of them have their own books in the Bible. They include the three “majors”—Isaiah, Jeremiah, and Ezekiel— and twelve “minors.” Their prophetic period began with Amos in Judea (circa 760 b.c.e.) and Hoseah in Israel (750 b.c.e.) and ended with Malachi (circa 450 b.c.e.). As expectations of the Return took shape, geopolitics, religion, and actual happenings combined to serve as the foundation of biblical Prophecy. The biblical Prophets served as Keepers of the Faith and
192
THE END OF DAYS
were the moral and ethical compass of their own kings and people; they were also observers and predictors on the world arena by possessing uncannily accurate knowledge of goings-on in distant lands, of court intrigues in foreign capitals, of which gods were worshipped where, plus amazing knowledge of history, geography, trade routes, and military campaigns. They then combined such awareness of the Present with knowledge of the Past to foretell the Future. To the Hebrew Prophets, Yahweh was not only El Elyon— “God Supreme”—and not only God of the gods, El Elohim, but a Universal God—of all nations, of the whole Earth, of the universe. Though His abode was in the Heaven of Heavens, He cared for his creation—Earth and its people. Everything that has happened was by His will, and His will was carried out by Emissaries—be it Angels, be it a king, be it a nation. Adopting the Sumerian distinction between predetermined Destiny and free-willed Fate, the Prophets believed that the Future could be foretold because it was all preplanned, yet on the way thereto, things could change. Assyria, for example, was at times called God’s “rod of wrath” with which other nations were punished, but when it chose to act unnecessarily brutally or out of bounds, Assyria itself was in turn subjected to punishment. The Prophets seemed to be delivering a two-track message not only in regard to current events, but also in respect to the Future. Isaiah, for example, prophesied that Mankind should expect a Day of Wrath when all the nations (Israel included) shall be judged and punished—as well as look forward to an idyllic time when the wolf shall dwell with the lamb, men shall beat their swords into plowshares, and Zion shall be a light unto all nations. The contradiction has baffled generations of biblical scholars and theologians, but a close examination of the Prophets’ words leads us to an astounding finding: the Day of Judgment was spoken of as the Day of the Lord; the messianic time was expected at the End of Days; and the two were neither synonymous nor predicted as concurrent events. They were two separate events, due to occur at different times:
The Day of the Lord
193
One, the Day of the Lord, a day of God’s judgment, was about to happen; The other, ushering a benevolent era, was yet to come, sometime in the future. Did the words spoken in Jerusalem echo the debates in Nineveh and Babylon regarding which time cycle applies to the future of gods and men—Nibiru’s orbital Divine Time or the zodiacal Celestial Time? Undoubtedly, as the eighth century b.c.e. was ending, it was clear in all three capitals that the two time cycles were not identical; and in Jerusalem, speaking of the coming Day of the Lord, the biblical prophets in fact spoke of the Return of Nibiru. Ever since it rendered in the opening chapter of Genesis an abbreviated version of the Sumerian Epic of Creation, the Bible recognized the existence of Nibiru and its periodic return to Earth’s vicinity, and treated it as another—in this case, celestial—manifestation of Yahweh as a Universal God. The Psalms and the Book of Job spoke of the unseen Celestial Lord that “in the heights of heaven marked out a circuit.” They recalled this Celestial Lord’s first appearance—when he collided with Tiamat (called in the Bible Tehom and nicknamed Rahab or Rabah, the Haughty One), smote her, created the heavens and “the Hammered Bracelet” (the Asteroid Belt), and “suspended the Earth in the void”; they also recalled the time when that celestial Lord caused the Deluge. The arrival of Nibiru and the celestial collision, leading to Nibiru’s great orbital circuit, were celebrated in the majestic Psalm 19: The heavens bespeak the glory of the Lord; The Hammered Bracelet proclaims his handiwork . . . He comes forth as a groom from the canopy; Like an athlete he rejoices to run the course. From the end of the heavens he emanates, and his circuit is to their end. It was the nearing of the Celestial Lord at the time of the Deluge that was held to be the forerunner of what will
194
THE END OF DAYS
happen next time the celestial Lord will return (Psalm 77: 6, 17–19): I shall recall the Lord’s deeds, remember thine wonders in antiquity . . . The waters saw thee, O Lord, and shuddered. Thine splitting sparks went forth, lightnings lit up the world. The sound of thine thunder was rolling, the Earth was agitated and it quaked. The Prophets considered those earlier phenomena as the guide for what to expect. They expected the Day of the Lord (to quote the Prophet Joel) to be a day when “the Earth shall be agitated, Sun and Moon shall be darkened, and the stars shall withhold their shining . . . A day that is great and terrifying.” The Prophets brought the word of Yahweh to Israel and all nations over a period of about three centuries. The earliest of the fifteen Literary Prophets was Amos; he began to be God’s spokesman (“Nabih”) circa 760 b.c.e. His prophecies covered three periods or phases: he predicted the Assyrian assaults in the near future, a coming Day of Judgment, and an Endtime of peace and plenty. Speaking in the name of “the Lord Yahweh who reveals His secrets to the Prophets,” he described the Day of the Lord as a day when “the Sun shall set at noon and the Earth shall darken in the midst of daytime.” Addressing those who worship the “planets and star of their gods,” he compared the coming Day to the events of the Deluge, when “the day darkened as night, and the waters of the seas poured upon the earth;” and he warned those worshippers with a rhetorical question (Amos 5: 18): Woe unto you that desire the Day of the Lord! To what end is it for you? For the day of the Lord is darkness and no light. A half-century later, the Prophet Isaiah linked the prophecies of the “Day of the Lord” to a specific geographical site,
The Day of the Lord
195
to the “Mount of the Appointed Time,” the place “on the northern slopes,” and had this to say to the king who had set himself up on it: “Behold, the Day of the Lord cometh with pitiless fury and wrath, to lay the earth desolate and destroy the sinners upon it.” He, too, compared what is about to happen to the Deluge, recalling the time when the “Lord came as a destroying tempest of mighty waves,” and described (Isaiah 13: 10,13) the coming Day as a celestial occurrence that will affect the Earth: The stars of heaven and its constellations shall not give their light; the Sun shall be darkened at its rising and the Moon shall not shine its light . . . The heavens shall be agitated and the Earth in its place will be shaken; When the Lord of Hosts shall be crossing on the day of his wrath. Most noticeable in this prophecy is the identification of the Day of the Lord as the time when “the Lord of Hosts”— the celestial, the planetary lord—“shall be crossing.” This is the very language used in Enuma elish when it describes how the invader that battled Tiamat came to be called NIBIRU: “Crossing shall be its name!” Following Isaiah, the Prophet Hosea also foresaw the Day of the Lord as a day when Heaven and Earth shall “respond” to each other—a day of celestial phenomena resonating on Earth. As we continue to examine the prophecies chronologically, we find that in the seventh century b.c.e. the prophetic pronouncements became more urgent and more explicit: the Day of the Lord shall be a Day of Judgment upon the nations, Israel included, but primarily upon Assyria for what it has done and upon Babylon for what it will do, and the Day is approaching, it is near— The great Day of the Lord is approaching— It is near!
196
THE END OF DAYS
The sound of the Lord’s Day hasteth greatly. A day of wrath is that day, a day of trouble and distress, a day of calamity and desolation, a day of darkness and deep gloom, a day of clouds and thick mist. Zephania, 1: 14–15 Just before 600 b.c.e. the Prophet Habakkuk prayed to the “God who in the nearing years is coming,” and who shall show mercy in spite of His wrath. Habakkuk described the expected celestial Lord as a radiant planet—the very manner in which Nibiru was depicted in Sumer & Akkad. It shall appear, the Prophet said, from the southern skies: The Lord from the south shall come . . . Covered are the heavens with his halo, His splendor fills the Earth. His rays shine forth from where his power is concealed. The Word goes before him, sparks emanate from below. He pauses to measure the Earth; He is seen, and the nations tremble. Habakkuk 3: 3–6 The prophecies’ urgency increased as the sixth century b.c.e. began. “The Day of the Lord is at hand!” the Prophet Joel announced; “The Day of the Lord is near!” the Prophet Obadiah declared. Circa 570 b.c.e. the Prophet Ezekiel was given the following urgent divine message (Ezekiel 30: 2–3): Son of Man, prophesy and say: Thus sayeth the Lord God: Howl and bewail for the Day! For the Day is near— the Day of the Lord is near!
The Day of the Lord
197
Ezekiel was then away from Jerusalem, having been taken into exile with other Judean leaders by the Babylonian king Nebuchadnezzar. The place of exile, where Ezekiel’s prophecies and famed vision of the Celestial Chariot took place, was on the banks of the Khabur River, in the region of Harran. The location was not a chance one, for the concluding saga of the Day of the Lord—and of Assyria and Babylon—was to be played out where Abraham’s journey began.
12 DARKNESS AT NOON
While the Hebrew Prophets predicted Darkness at Noon, what were the “other nations” expecting as they awaited the Return of Nibiru? To judge by their written records and engraved images, they were expecting the resolution of the gods’ conflicts, benevolent times for mankind, and a great theophany. They were in, as we shall see, for an immense surprise. In anticipation of the great event, the cadres of priests observing the skies in Nineveh and Babylon were mobilized to note celestial phenomena and interpret their omens. The phenomena were meticulously recorded and reported to the kings. Archaeologists have found in the remains of royal and temple libraries tablets with those records and reports that in many instances were arranged according to subject or the planet they were observing. A well-known collection in which some seventy tablets were combined—in antiquity— was a series titled Enuma Anu Enlil; it reported observations of planets, stars, and constellations classified according to the celestial Way of Anu and Way of Enlil—encompassing the skies from 30 degrees south all the way to zenith in the north (see Fig. 53). At first the observations were interpreted by comparing the phenomena to astronomical records from Sumerian times. Though written in Akkadian (Babylon’s and Assyria’s language), the observational reports extensively used Sumerian terminology and mathematics and sometimes included a scribal note that they were translated from earlier Sumerian tablets. Such tablets served as “astronomers’ manuals,” tell-
Darkness at Noon
199
ing them from past experience what a phenomenon’s oracular meaning was: When the Moon in its calculated time is not seen: There will be an invasion of a mighty city. When a comet reaches the path of the Sun: Field-flow will be diminished, an uproar will happen twice. When Jupiter goes with Venus: The prayers of the land will reach the gods. As time went on, the reports were increasingly of observations accompanied by the omen-priests’ own interpretations: “In the night Saturn came near to the Moon. Saturn is a planet of the Sun. This is the meaning: It is favorable to the king.” The noticeable change included the paying of particular attention to eclipses; a tablet (now in the British Museum), listing computerlike columns of numbers, served to predict lunar eclipses fifty years in advance. Modern studies have concluded that the change to the new style of topical astronomy took place in the eighth century b.c.e. when, after a period of mayhem and royal upheavals in Babylon and Assyria, the two lands’ fates were placed in new and strong royal hands: Tiglath-Pileser III (745–727 b.c.e.) in Assyria and Nabunassar (747–734 b.c.e.) in Babylonia. Nabunassar (“By Nabu protected”) was hailed, already in antiquity, as an innovator and powerhouse in the field of astronomy. One of his first actions was to repair and restore the temple of Shamash in Sippar, the Sun-god’s “cult center” in ancient Sumer. He also built a new observatory in Babylon, updated the calendar (a heritage from Nippur), and instituted daily reporting to the king of the celestial phenomena and their meaning. It was primarily due to those measures that a wealth of astronomical data, shedding light on subsequent events, has come to light. Tiglath-Pileser III was also active, in his own ways. His
200
THE END OF DAYS
annals describe constant military campaigns and boast of captured cities, brutal executions of local kings and nobility, and mass exiles. His role, and those of his successors Shalmaneser V and Sargon II, in the demise of Israel and the exile of its people (the Ten Lost Tribes), and then the attempt by Sennacherib to seize Jerusalem, were described in the previous chapter. Closer to home, those Assyrian kings were busy annexing Babylonia by “taking the hands of Marduk.” The next Assyrian king, Esarhaddon (680–669 b.c.e.), announced that “both Ashur and Marduk gave me wisdom,” swore oaths in the name of Marduk and Nabu, and started to rebuild the Esagil temple in Babylon. In history books, Esarhaddon is mainly remembered for his successful invasion of Egypt (675–669 b.c.e.). The invasion’s purpose, as far as it could be ascertained, was to stop Egyptian attempts to “meddle in Canaan” and dominate Jerusalem. Noteworthy, in the light of subsequent events, was the route he chose: instead of going the shortest way, to the southwest, he made a considerable detour and went northward, to Harran. There, in the olden temple of the god Sin, Esarhaddon sought that god’s blessing to embark on the conquest; and Sin, leaning on a staff and accompanied by Nusku (the Divine Messenger of the gods), gave his approval. Esarhaddon then did turn southward, sweeping mightily through the lands of the eastern Mediterranean to reach Egypt. Significantly, he detoured away from the prize that Sennacherib failed to seize—Jerusalem. Significantly, too, that invasion of Egypt and the detour away from Jerusalem—as well as Assyria’s own eventual fate—had been prophesied by Isaiah decades earlier (10: 24–32). Busy geopolitically as Esarhaddon was, he did not neglect the astronomical requirements of those times. With guidance from the gods Shamash and Adad, he erected in Ashur (the city, Assyria’s cult center) a “House of Wisdom”—an observatory—and depicted the complete twelve-member solar system, including Nibiru, on his monuments (Fig. 89). Leading to a more lavish sacred precinct was a new monumental gate, built—according to cylinder seal depictions—to
Darkness at Noon
201
Figure 89
Figure 90 emulate Anu’s gateway on Nibiru (Fig. 90). It is a clue to what the Return expectations in Assyria were. All those religious-political moves suggest that the Assyrians made sure to “touch all the bases” as far as the gods were concerned. And so, by the seventh century b.c.e., Assyria was ready for the anticipated Return of the planet of the gods. Discovered texts—including letters to the kings by
202
THE END OF DAYS
their chief astronomers—reveal anticipation of an idyllic, utopian time: When Nibiru will culminate . . . The lands will dwell securely, Hostile kings will be at peace; The gods will receive prayers and hear supplications. When the Planet of the Throne of Heaven will grow brighter, there will be floods and rains. When Nibiru attains its perigee, the gods will give peace. Troubles will be cleared up, complications will be unravelled. Clearly, the expectation was of a planet that will appear, rise in the skies, grow brighter, and at its perigee, at the Crossing, become NIBIRU (the Cross Planet). And as the gateway and other construction indicated, with the returning planet a repeat of the previous visit to Earth by Anu was expected. It was now up to the astronomer-priests to watch the heavens for that planetary appearance; but where were they to look in the celestial expanse, and how would they recognize the planet when still in the distant skies? The next Assyrian king, Ashurbanipal (668–630 b.c.e.), came up with a solution. Historians consider Ashurbanipal to have been the most scholarly of the Assyrian kings, for he had learnt other languages besides Akkadian, including Sumerian, and claimed that he could even read “writings from before the Flood.” He also boasted that he “learnt the secret signs of Heaven and Earth . . . and studied the heavens with the masters of divination.” Some modern researchers also consider him to have been “The First Archaeologist,” for he systematically collected tablets from sites that were already ancient in his time—like
Darkness at Noon
203
Nippur, Uruk, and Sippar in what used to be Sumer. He also sent specialized teams to sort out and loot such tablets from the capitals that the Assyrians overran. The tablets ended up in a famed library where teams of scribes studied, translated, and copied chosen texts from the previous millennia. (A visitor to the Museum of the Ancient Near East in Istanbul can see a display of such tablets, neatly arranged on the original shelves, with each shelf headed by a “catalog tablet” that lists all the texts on that shelf .) While the subjects in the accumulated tablets covered a wide range, what was found indicates that particular attention was given to celestial information. Among the purely astronomical texts there were tablets that belonged to a series titled “The day of Bel”—the Day of the Lord! In addition, epic tales and histories pertaining to the gods’ comings and goings were deemed important, especially if they shed light on Nibiru’s passages. Enuma elish—the Epic of Creation that told how an invading planet joined the solar system to become Nibiru—was copied, translated, and recopied; so were writings dealing with the Great Flood, such as the Atra-Hasis Epic and the Epic of Gilgamesh. While they all seem to legitimately be part of accumulating knowledge in a royal library, it so happens that they all dealt with instances of Nibiru’s appearances in the past—and thus with its next nearing. Among the purely astronomical texts translated and, undoubtedly, carefully studied, were guidelines for observing Nibiru’s arrival and for recognizing it on its appearance. A Babylonian text that retained the original Sumerian terminology stated: Planet of the god Marduk: Upon its appearance SHUL.PA.E; Rising thirty degrees, SAG.ME.NIG; When it stands in the middle of the sky: NIBIRU. While the first-named planet (SHUL.PA.E) is deemed to be Jupiter (but could be Saturn), the next one’s name (SAG.ME.NIG) could just be a variant for Jupiter, but is
204
THE END OF DAYS
considered by some to be Mercury (*). A similar text from Nippur, rendering the Sumerian planetary names as UMUN.PA.UD.DU and SAG.ME.GAR, suggested that the arrival of Nibiru will be “announced” by the planet Saturn, and after rising 30 degrees will be near Jupiter. Other texts (e.g., a tablet known as K.3124) state that after passing SHUL.PA.E and SAG.ME.GAR—which I believe mean Saturn and Jupiter—“Planet Marduk” will “enter the Sun” (i.e., reach Perigee, closest to the Sun) and “become Nibiru.” Other texts provide clearer clues in regard to Nibiru’s path, as well as to the time frame for its appearance: From the station of Jupiter, the planet passes toward the west. * The extensive astronomical data that have been found attracted, already in the 19th and early in the 20th centuries, the time, attention, and patience of scholarly giants who brilliantly combined “Assyriology” with knowledge of astronomy. The very first book of The Earth Chronicles, The 12th Planet, covered and used the work and achievements of the likes of Franz Kugler, Ernst Weidner, Erich Ebeling, Herman Hilprecht, Alfred Jeremias, Morris Jastrow, Albert Schott, and Th. G. Pinches, among others. Their task was complicated by the fact that the same kakkabu (any celestial body, including planets, fixed stars, and constellations) could have more than one name. I also pointed out right then and there the most basic failing of their work: they all assumed that the Sumerians and other ancient peoples had no way of knowing (“with the naked eye”) about planets beyond Saturn. The result was that whenever a planet was named other than the accepted names for the “seven known kakkabani”—Sun, Moon, Mercury, Venus, Mars, Jupiter, Saturn—it was assumed to just be yet another name for one of those “known seven.” The principal victim of that erroneous stance was Nibiru; whenever it or its Babylonian equivalent “planet Marduk” was listed, it was assumed to be another name for Jupiter or Mars or (in some extreme views) even for Mercury. Incredibly, modern establishment astronomers continue to base their work on that “only seven” assumption—in spite of the vast contrary evidence that shows that the Sumerians knew the true shape and composition of our solar system, starting with the naming of the outer planets in Enuma elish, or the 4,500year-old depiction of the complete twelve-member solar system, with the Sun in the center, on cylinder seal VA/243 in the Berlin Museum (Fig. 91), or the depiction of twelve planetary symbols on Assyrian and Babylonian monuments, etc.
Darkness at Noon
205
Figure 91 From the station of Jupiter the planet increases its brilliance, and in the zodiac of Cancer will become Nibiru. The great planet: At his appearance: Dark red. The heaven he divides in half as it stands in Nibiru. Taken together, the astronomical texts from the time of Ashurbanipal described a planet appearing from the solar system’s edge, rising and becoming visible when it reaches Jupiter (or even Saturn before that), and then curving down toward the ecliptic. At its perigee, when it is closest to the Sun (and thus to Earth), the planet—at the Crossing—becomes Nibiru “in the zodiac of Cancer.” That, as the enclosed schematic (and not to scale) diagram shows, could happen only when sunrise on the day of the Spring Equinox took place in the Age of the Ram—during the zodiacal age of Aries (Fig. 92). Such clues regarding the orbital path of the Celestial Lord and its reappearance, sometimes using the constellations as a celestial map, are also found in biblical passages, thereby revealing knowledge that must have been internationally available:
206
THE END OF DAYS
Figure 92
“In Jupiter will thy face be seen,” states Psalm 17. “The Lord from the south shall come . . . his shining splendor will beam as light,” predicted the prophet Habakkuk (Chapter 2). “Alone he stretches out the heavens and treads upon the highest Deep; he arrives at the Great Bear, Sirius and Orion, and the constellations of the south,” the Book of Job (Chapter 9) stated; and the Prophet Amos (5: 9) foresaw the Celestial Lord “smiling his face upon Taurus and Aries, from Taurus to Sagittarius he shall go.” These verses described a planet that spans the highest heavens and, orbiting clockwise—“retrograde,” astronomers say—arrives via the southern constellations. It is a trajectory, on a vaster scale, akin to that of Halley’s comet (see Fig. 78). A telling clue in regard to Ashurbanipal’s expectations was the meticulous rendering into Akkadian of Sumerian descriptions of the ceremonies attending the state visit of Anu and Antu to Earth circa 4000 b.c.e. The sections dealing with their stay in Uruk described how, at evetime, an observer was stationed “on the topmost stage of the tower” to watch for and announce the appearance of the planets one after the other, until the “Planet of the Great Anu of Heaven”
Darkness at Noon
207
came into view, whereupon all the gods assembled to welcome the divine couple recited the composition “To the one who grows bright, the heavenly planet of the god Anu” and sang the hymn “The Creator’s image has arisen.” The long texts then described the ceremonial meals, the retreat to the nighttime chambers, the processions the next day, and so on. One can reasonably conclude that Ashurbanipal was engaged in collecting, collating, translating, and studying all the earlier texts that could (a) provide guidance to the astronomer-priests for detecting, at the first possible moment, the returning Nibiru and (b) inform the king about the procedures for what to do next. Calling the planet “Planet of the Heavenly Throne” is an important clue to the royal expectations, as were the depictions on palace walls, in magnificent reliefs, of Assyrian kings greeting the god in the Winged Disc as it hovered above the Tree of Life (as in Fig. 87). It was important to be informed of the planet’s appearance as soon as possible in order to be able to prepare the proper reception for the arrival of the great god depicted within it—Anu himself?—and be blessed with long, perhaps even eternal, Life. But that was not destined to be. Soon after Ashurbanipal’s death, rebellions broke out throughout the Assyrian empire. His sons’ hold on Egypt, Babylonia, and Elam disintegrated. Newcomers from afar appeared on the borders of the Assyrian empire—“hordes” from the north, Medes from the east. Everywhere, local kings seized control and declared independence. Of particular importance—immediate and for future events—was Babylon’s “decoupling” of the dual kingship with Assyria. As part of the New Year festival in 626 b.c.e. a Babylonian general whose name—Nabupolassar (“Nabu his son protects”)—implied that he claimed to be a son of the god Nabu, was enthroned as king of an independent Babylonia. A tablet described the start of his investiture ceremony thus: “The princes of the land were assembled; they blessed Nabupolassar; opening their fists, they declared him sovereign; Marduk in the assembly of the gods gave the Standard of Power to Nabupolassar.” The resentment of Assyria’s brutal rule was so great that
208
THE END OF DAYS
Nabupolassar of Babylon soon found allies for military action against Assyria. A principal and freshly vigorous ally was the Medes (precursors of the Persians), who had experienced Assyrian incursions and brutality. While Babylonian troops were advancing into Assyria from the south, the Medes attacked from the east, and in 614 b.c.e.—as had been prophesied by the Hebrew Prophets!—captured and burned down Assyria’s religious capital, Ashur. The turn of Nineveh, the royal capital, came next. By 612 b.c.e. the great Assyria was in shambles. Assyria—the land of the “First Archaeologist”—itself became a land of archaeological sites. How could that happen to the land whose very name meant “Land of the god Ashur”? The only explanation at the time was that the gods withdrew their protection from that land; in fact, we shall show, there was much more to it: the gods themselves withdrew—from that land and from Earth. And then the most astounding and final chapter of the Return Saga, in which Harran was to play a key role, began to unfold. The amazing chain of events after the demise of Assyria began with the escape to Harran of members of Assyria’s royal family. Seeking there the protection of the god Sin, the escapees rallied the remnants of the Assyrian army and proclaimed one of the royal refugees as “King of Assyria”; but the god, whose city Harran has been since days of yore, did not respond. In 610 b.c.e. Babylonian troops captured Harran and put an end to the Assyrians’ lingering hopes. The contest for the mantle of successorship to the heritage of Sumer and Akkad was over; it was now worn solely, and with divine blessing, by the king in Babylon. Again, Babylon ruled the lands that were once the hallowed “Sumer & Akkad”—so much so that in many texts from that time, Nabupolassar was given the title “King of Akkad.” He used that authority to extend the celestial observations to the erstwhile Sumerian cities of Nippur and Uruk, and some of the key observational texts from the subsequent crucial years come from there. It was in that same fateful year, 610 b.c.e.—a memorable
Darkness at Noon
209
year of astounding events, as we shall see—that a reinvigorated Egypt also placed on its throne an assertive strongman named Necho. Just one year later one of the least understood—by historians, that is—geopolitical moves then took place. The Egyptians, who used to be on the same side as the Babylonians in opposition to Assyrian rule, emerged from Egypt and, rushing northward, overran territories and sacred sites that the Babylonians considered theirs. The Egyptian advance, all the way north to Carchemish, put them within striking distance of Harran; it also placed in Egyptian hands the two space-related sites, in Lebanon and in Judea. The surprised Babylonians were not going to let it stand. The aging Nabupolassar entrusted the task of recapturing the vital places to his son Nebuchadnezzar, who had already distinguished himself on the battlefields. In June 605 b.c.e., at Carchemish, the Babylonians crushed the Egyptian army, liberated “the sacred forest in Lebanon which Nabu and Marduk desired,” and chased the fleeing Egyptians all the way to the Sinai Peninsula. Nebuchadnezzar stopped the pursuit only on news from Babylon that his father had died. He rushed back, and was proclaimed King of Babylon that same year. Historians find no explanation for the sudden Egyptian thrust and the ferocity of the Babylonian reaction. To us it is evident that at the core of the events was the expectation of the Return. Indeed, it seems that in that year 605 b.c.e. the Return was deemed to be imminent, perhaps even overdue; for it was in that very same year that the Prophet Habakkuk began to prophecy in the name of Yahweh, in Jerusalem. Uncannily foretelling the future of Babylon and other nations, the Prophet asked Yahweh when the Day of the Lord— a day of judgment upon the nations, Babylon included—would come, and Yahweh responded, saying: Write down the prophecy, explain it clearly on the tablets, so that it may be quickly read: For the vision there is a set time; In the end it shall come, without fail!
210
THE END OF DAYS
Though it may tarry, wait for it; For it will surely come— For its appointed time it will not be delayed. Habakkuk 2: 2–3 (The “appointed time,” as we shall see, arrived precisely fifty years thereafter.) The forty-three years of Nebuchadnezzar’s reign (605–562 b.c.e.) are considered a period of a dominant “Neo-Babylonian” empire, a period marked by decisive actions and fast moves, for there was no time to lose—the nearing Return was now Babylon’s prize! To prepare Babylon for the expected Return, massive renovation and construction works were quickly undertaken. Their focal point was the sacred precinct, where the Esagil temple of Marduk (now simply called Bel/Ba’al, “The Lord”) was renovated and rebuilt, its seven-stage ziggurat readied for viewing from it the starry skies (Fig. 93)—just as had been done in Uruk when Anu had visited circa 4000 b.c.e. A new Processional Way leading to the sacred precinct through a massive new gate was erected; their walls were decorated and covered from top to bottom with artful glazed bricks that
Figure 93
Darkness at Noon
211
astound to this day, for the site’s modern excavators have removed and put the Processional Way and the Gate back together at the Vorderasiatiches Museum in Berlin. Babylon, Marduk’s Eternal City, was readied to welcome the Return. “I have made the city of Babylon to be the foremost among all the countries and every habitation; its name I elevated to be the most praised of all the sacred cities,” Nebuchadnezzar wrote in his inscriptions. The expectation, it seems, was that the arriving god of the Winged Disk would come down at the Landing Place in Lebanon, then consummate the Return by entering Babylon through the new marvelous Processional Way and imposing gate (Fig. 94)—a gate named “Ishtar” (alias IN.ANNA), who had been “Anu’s beloved” in Uruk— another clue regarding whose Return was expected.
Figure 94
212
THE END OF DAYS
Accompanying these expectations was Babylon’s role as the new Navel of the Earth—inheriting the prediluvial status of Nippur as the DUR.AN.KI, the “Bond Heaven-Earth.” That this was now Babylon’s function was expressed by giving the ziggurat’s foundation platform the Sumerian name E.TEMEN. AN.KI (“Temple of the Foundation for Heaven-Earth”), stressing Babylon’s role as the new “Navel of the Earth”—a role clearly depicted on the Babylonian “Map of the World” (see Fig. 10). This was terminology that echoed the description of Jerusalem, with its Foundation Stone, serving as a link between Earth and Heaven! But if that was what Nebuchadnezzar envisioned, then Babylon had to replace the existing post-Diluvial space link—Jerusalem. Having taken over Nippur’s prediluvial role to serve as Mission Control Center after the Deluge, Jerusalem was located at the center of concentric distances to the other spacerelated sites (see Fig. 3). Calling it the “Navel of the Earth” (38: 12), the Prophet Ezekiel announced that Jerusalem has been chosen for this role by God himself: Thus has said the Lord Yahweh: This is Jerusalem; In the midst of the nations I placed her, and all the lands are in a circle round about her. Ezekiel 5: 5 Determined to usurp that role for Babylon, Nebuchadnezzar led his troops to the elusive prize and in 598 b.c.e. captured Jerusalem. This time, as the Prophet Jeremiah had warned, Nebuchadnezzar was carrying out God’s anger at Jerusalem’s people, for they had taken up the worship of the celestial gods: “Ba’al, the Sun and the Moon, and the constellations” (II Kings 23: 5)—a list that clearly included Marduk as a celestial entity! Starving Jerusalem’s people by a siege that lasted three years, Nebuchadnezzar managed to subdue the city and took
Darkness at Noon
213
the Judean king Jehoyachin captive to Babylon. Taken into exile were also Judea’s nobility and learned elite—among them the Prophet Ezekiel—and thousands of its soldiers and craftsmen; they were made to reside by the banks of the Khabur River, near Harran, their ancestral home. The city itself and the Temple were left intact this time, but eleven years later, in 587 b.c.e., the Babylonians returned in force. Acting this time, according to the Bible, on their own volition, the Babylonians put the torch to the Temple that Solomon built. In his inscriptions Nebuchadnezzar offered no explanation other than the usual one—to carry out the wishes of and to please “my gods Nabu and Marduk”; but as we shall soon show, the real reason was a simple one: a belief that Yahweh had departed and was gone. The destruction of the Temple was a shocking and evil deed for which Babylon and its king—previously deemed by the Prophets to have been Yahweh’s “rod of wrath”—were to be severely punished: “The vengeance of Yahweh our God, vengeance for His Temple,” shall be meted out to Babylon, announced the Prophet Jeremiah (50: 28). Predicting the fall of mighty Babylon and its destruction by invaders from the north—events that came true just a few decades later—Jeremiah also proclaimed the fate of the gods whom Nebuchadnezzar had invoked: Declare among the nations and proclaim, Raise the sign, announce, do not conceal, Say: Captured is Babylon! Withered is Bel, confounded is Marduk! Jeremiah 50: 2 Divine punishment upon Nebuchadnezzar himself was commensurate with the sacrilege. Crazed, according to traditional sources, by a bug that entered his brain through his nose, Nebuchadnezzar died in agony in 562 b.c.e. Neither Nebuchadnezzar nor his three bloodline successors (who were murdered or otherwise disposed of in short shrift)
214
THE END OF DAYS
lived to see an arrival of Anu at the gates of Babylon. In fact, such an arrival never took place, even though Nibiru did return. It is a fact that astronomical tablets from that very time record actual observations of Nibiru, alias “Planet of Marduk.” Some were reported as omina, for example, a tablet catalogued K.8688 that informed the king that if Venus shall be seen “in front of ” (i.e., rising ahead of ) Nibiru, the crops will fail, but if Venus shall rise “behind” (i.e., after) Nibiru, “the crop of the land will succeed.” Of greater interest to us are a group of “Late Babylonian” tablets found in Uruk; they rendered the data in twelve monthly zodiacal columns and combined the texts with pictorial depictions. In one of these tablets (VA 785l, Fig. 95), the Planet of Marduk, shown between the Aries ram symbol on one side and the seven symbol for Earth on the other side, depicts Marduk within the planet. Another example is tablet VAT 7847; it names an actual observation, in the constellation of Aries, as the “Day when the gate of the great lord Marduk was opened”— when Nibiru had appeared into view; and then has an entry—“Day of the Lord Marduk”—as the planet moved on and was seen in Aquarius. Even more telling of the coming into view of the planet “Marduk” from the southern skies and its fast becoming “Ni-
Figure 95
Darkness at Noon
215
biru” in the central celestial band, were yet another class of tablets, this time circular. Representing “an advance backward” to the Sumerian astronomical tenets, the tablets divided the celestial sphere into the three Ways (Way of Enlil for the northern skies, of Ea for the southern, and of Anu in the center). The twelve zodiacal-calendrical segments were then superimposed on the three Ways, as shown by the discovered fragments (Fig. 96); explanatory texts were written on the back sides of those circular tablets. In A.D. 1900, addressing a meeting of the Royal Asiatic Society in London, England, Theophilius G. Pinches caused a sensation when he announced that he had succeeded in
Figure 96
216
THE END OF DAYS
piecing together a complete “astrolabe” (“Taker of Stars”), as he called the tablet. He showed it to be a circular disc divided into three concentric sections and, like a pie, into twelve segments, resulting in a field of thirty-six portions. Each of the thirty-six portions contained a name with a small circle below it, indicating it was a celestial body, and a number. Each portion also bore a month’s name, so Pinches numbered them from I to XII, starting with Nissan (Fig. 97). The presentation caused an understandable sensation, for here was a Babylonian sky map, divided into the three Ways of Enlil, Anu, and Ea/Enki, showing which planets, stars, and constellations were observed where at each month dur-
Figure 97
Darkness at Noon
217
ing the year. The debate over the identity of the celestial bodies (at the root of which lurks the notion of “nothing beyond Saturn”) and the meaning of the numbers has yet to end. Also unresolved is the issue of dating—in what year was the astrolabe made, and if it was a copy of an earlier tablet, what was the time shown? Dating opinions ranged from before the twelfth century to the third century b.c.e.; most agreed, however, that the astrolabe belonged to the era of Nebuchadnezzar or his successor Nabuna’id. The astrolabe presented by Pinches was identified in the ensuing debates as “P,” but has been later renamed “Astrolabe A” because another one has since been pieced together and is known as “Astrolabe B.” Though the two astrolabes at first glance look identical, they are different—and for our analysis, the key difference is that in “B” the planet identified as mul Neberu deity Marduk—“Planet Nibiru of the god Marduk”—is shown in the Way of Anu, the central-ecliptic band (Fig. 98), whereas in “A” the planet identified as mul Marduk—the “Planet of Marduk”—is shown in the Way of Enlil, in the northern skies (Fig. 99). The change in name and position is absolutely correct if the two astrolabes depict a moving planet—“Marduk” as it was called by the Babylonians—that, after having come into view high in the northern skies (as in “A”), curves down to cross the ecliptic and becomes NIBIRU (“Crossing”) when it crosses the ecliptic in the Way of Anu (as in “B”). The twostage documentation by the two astrolabes depicts precisely what we have been asserting all along! The texts (known as KAV 218, columns B and C) accompanying the circular depictions remove any shadow of doubt regarding the Marduk/Nibiru identity: [Month] Adar: Planet Marduk in the Way of Anu: The radiant Kakkabu which rises in the south after the gods of the night finished their tasks, and divides the heavens. This kakkabu is Nibiru = god Marduk.
218
THE END OF DAYS
Figure 98 While we can be certain—for reasons soon to be given— that the observations in all those “Late Babylonian” tablets could not have taken place earlier than 610 b.c.e., we can also be sure that they did not take place after 555 b.c.e., for that was the date when one called Nabuna’id became the last king of Babylonia; and his claim to legitimacy was that his kingship was celestially confirmed because “the planet of Marduk, high in the sky, had called me by my name.” Making that claim, he also stated that in a nighttime vision he had seen “the Great Star and the Moon.” Based on the Kepler
Darkness at Noon
219
Figure 99 formulas for planetary orbits around the Sun, the whole period of Marduk/Nibiru’s visibility from Mesopotamia lasted just a short few years; hence, the visibility claimed by Nabuna’id places the planet’s Return in the years immediately preceding 555 b.c.e. So when was the precise time of the Return? There is one more aspect involved in resolving the puzzle: the prophecies of “Darkness at noon” on the Day of the Lord— a solar eclipse—and such an eclipse did in fact occur, in 556 b.c.e.!
220
THE END OF DAYS
Solar eclipses, though much rarer than lunar eclipses, are not uncommon; they happen when the Moon, passing in a certain way between Earth and the Sun, temporarily obscures the Sun. Only a small portion of solar eclipses are total. The extent, duration, and path of total darkness vary from passage to passage due to the ever-changing triple orbital dance between Sun, Earth, and Moon, plus Earth’s daily revolution and its changing axial tilt. As rare as solar eclipses are, the astronomical legacy of Mesopotamia included knowledge of the phenomenon, calling it atalu shamshi. Textual references suggest that not only the phenomenon but even its lunar involvement were part of the accumulated ancient knowledge. In fact, a solar eclipse whose path of totality passed over Assyria had occurred in 762 b.c.e. It was followed by one in 584 b.c.e. that was seen all across the Mediterranean lands, with totality over Greece. But then, in 556 b.c.e., there occurred an extraordinary solar eclipse “not in an expected time.” If it was not due to the predictable motions of the Moon, could it have been caused by an unusually close passage of Nibiru? Among astronomical tablets belonging to a series called “When Anu Is Planet of the Lord,” one tablet (catalogued VACh.Shamash/RM.2,38—Fig. 100), dealing with a solar eclipse, recorded thus the observed phenomenon (lines 19–20): In the beginning the solar disc, not in an expected time, became darkened, and stood in the radiance of the Great Planet. On day 30 [of the month] was the eclipse of the Sun. What exactly do the words that the darkened Sun “stood in the radiance of the Great Planet” mean? Though the tablet itself does not provide a date for that eclipse, it is our suggestion that the particular wording, highlighted above, strongly indicates that the unexpected and extraordinary solar
Figure 100
222
THE END OF DAYS
eclipse was somehow caused by the return of Nibiru, the “great radiating planet”; but whether the direct cause was the planet itself, or the effects of its “radiance” (gravitational or magnetic pull?) on the Moon, the texts do not explain. Still, it is an astronomically historic fact that on a day equal to May 19, 556 b.c.e., a major total solar eclipse did occur. As shown by this map, prepared by NASA’s Goddard Space Flight Center (Fig. 101), the eclipse was a great
Figure 101
Darkness at Noon
223
and major one, seen over wide areas, and a unique aspect about it was that the band of total darkness passed exactly over the district of Harran! This last fact is of the utmost significance for our conclusions—and it was even more so in those fateful years in the ancient world; for right after that, in 555 b.c.e., Nabuna’id was proclaimed king of Babylonia—not in Babylon, but in Harran. He was the last king of Babylon; after him, as Jeremiah had prophesied, Babylon followed the fate of Assyria. It was in 556 b.c.e. that the prophesied Darkness at Noon came. It was just then that Nibiru returned; it was the prophesied DAY OF THE LORD. And when the planet’s Return did occur, neither Anu nor any other of the expected gods showed up. Indeed, the opposite happened: the gods, the Anunnaki gods, took off and left the Earth.
13 WHEN THE GODS LEFT EARTH
The departure of the Anunnaki gods from Earth was a drama-filled event replete with theophanies, phenomenal occurrences, divine uncertainties, and human quandary. Incredibly, the Departure is neither surmised nor speculative; it is amply documented. The evidence comes to us from the Near East as well as from the Americas; and some of the most direct, and certainly the most dramatic, records of the ancient gods’ departure from Earth come to us from Harran. The testimony is not hearsay; it consists of eyewitness reports, among them by the Prophet Ezekiel. The reports are included in the Bible, and they were inscribed on stone columns—texts dealing with miraculous events leading to the accession to the throne of Babylon’s last king. Harran nowadays—yes, it is still there, and I have visited it—is a sleepy town in eastern Turkey, just a few miles from the Syrian border. It is surrounded by crumbling walls from Islamic times, its inhabitants dwelling in beehive-shaped mud huts. The traditional well where Jacob met Rachel is still there among the sheep meadows outside the town, with the purest naturally cool water one can imagine. But in earlier days Harran was a flourishing commercial, cultural, religious, and political center, so much so that even the Prophet Ezekiel (27: 24), who lived in the area with other exiles from Jerusalem, recalled her reputation as a trader in “blue clothes and broidered work, and in chests of rich apparel, bound with cords and made of cedar.” It was a city that had been from Sumerian times on an “Ur away from Ur” cult center of the “Moon god” Nannar/Sin. Abraham’s family
When the Gods Left Earth
225
ended up residing there because his father Terah was a Tirhu, an omen-priest, first in Nippur, then in Ur, and finally in Nannar/Sin’s temple in Harran. After the demise of Sumer by the nuclear Evil Wind, Nannar and his spouse, Ningal, made their home and headquarters in Harran. Though Nannar (“Su-en,” or Sin for short in Akkadian) was not Enlil’s firstborn legal heir—that rank belonged to Ninurta—he was the firstborn of Enlil and his spouse Ninlil, a firstborn on Earth. Gods and men greatly adored Nannar/ Sin and his spouse; the hymns in their honor in Sumer’s glorious times, and the lamentations about the desolation of Sumer in general and Ur in particular, reveal the great love and admiration of the people for this divine couple. That many centuries later Esarhaddon went to consult with an aging Sin (“leaning on a staff ”) regarding the invasion of Egypt, and that the escaping Assyrian royals made a last stand in Harran, serve to indicate the continued important role played by Nannar/Sin and Harran to the very end. It was in the ruins of the city’s great Nannar/Sin temple, the E.HUL.HUL (“House of Double Joy”), that archaeologists discovered four stone columns (“stelae”) that once stood in the temple, one at each corner of the main prayer hall. The inscriptions on the stelae revealed that two were erected by the temple’s high priestess, Adda-Guppi, and two by her son Nabuna’id, the last king of Babylon. With an evident sense of history and as a trained temple official, Adda-Guppi provided in her inscriptions precise dates for the astounding events that she had witnessed. The dates, linked as was then customary to regnal years of known kings, could thus be—and have been—verified by modern scholars. It is thus certain that she was born in 649 b.c.e. and lived through the reigns of several Assyrian and Babylonian kings, passing on at the ripe old age of 104. Here is what she wrote on her stela concerning the first of a series of amazing events: It was in the sixteenth year of Nabupolassar, king of Babylon, when Sin, lord of the gods, became angry with his city and his temple
226
THE END OF DAYS
and went up to heaven; and the city and the people in it went to ruin. The sixteenth year of Nabupolassar was 610 b.c.e.—a memorable year, the reader may recall, when Babylonian forces captured Harran from the remnants of the Assyrian royal family and army, and when a reinvigorated Egypt decided to seize the space-related sites. It was then, AddaGuppi wrote, that an angered Sin, removing his protection (and himself ) from the city, packed up “and went up to heaven!” What followed in the captured city is accurately summed up: “And the city and its people went to ruin.” While other survivors fled, Adda-Guppi stayed on. “Daily, without ceasing, by day and night, for months, for years,” she kept vigil in the ruined temple. Mourning, she “forsook the dresses of fine wool, took off jewelry, wore neither silver nor gold, relinquished perfumes and sweet smelling oils.” As a ghost roaming the abandoned shrine, “in a torn garment I was clothed; I came and went noiselessly,” she wrote. Then, in the desolate sacred precinct, she found a robe that had once belonged to Sin. To the despondent priestess, the find was an omen from the god: suddenly he had given her a physical presence of himself. She could not take her eyes off the sacred garb, not daring to touch it except by “taking hold of its hem.” As if the god himself was there to hear her, she prostrated herself and “in prayer and humility” uttered a vow: “If you would return to your city, all the Black-Headed people would worship your divinity!” “Black-Headed people” was a term by which the Sumerians used to describe themselves, and the employment of the term by the high priestess some 1,500 years after Sumer was no more was full of significance: she was telling the god that were he to come back, he would be restored to lordship as in the Days of Old, become again the lord god of a restored Sumer and Akkad. To achieve that, Adda-Guppi offered her god a deal: If he would return and then use his divine powers to make her son Nabuna’id the next imperial king, reigning over all the Babylonian and Assyrian domains, Nabuna’id
When the Gods Left Earth
227
would restore the temple of Sin not only in Harran but also in Ur, and would proclaim the worship of Sin as the state religion in all the lands of the Black-Headed people! Touching the hem of the god’s robe, day after day she prayed; then one night the god appeared to her in a dream and accepted her proposal. The Moon god, Adda-Guppi wrote, liked the idea: “Sin, lord of the gods of Heaven and Earth, for my good doings looked upon me with a smile; he heard my prayers; he accepted my vow. The wrath of his heart calmed. Toward Ehulhul, his temple in Harran, the divine residence in which his heart rejoiced, he became reconciled; and he had a change of heart.” The god, Adda-Guppi wrote, accepted the deal: Sin, lord of the gods, looked with favor upon my words. Nabuna’id, my only son, issue of my womb, to the kingship he called— the kingship of Sumer and Akkad. All the lands from the border of Egypt, from the Upper Sea to the Lower Sea, in his hands he entrusted. Both sides kept their bargain. “I myself saw it fulfilled,” Adda-Guppi stated in the concluding segment of her inscriptions: Sin “honored his word which he spoke to me,” causing Nabuna’id to ascend the Babylonian throne in 555 b.c.e.; and Nabuna’id kept his mother’s vow to restore the Ehulhul temple in Harran, “perfecting its structure.” He renewed the worship of Sin and Ningal (Nikkal in Akkadian)—“all the forgotten rites he made anew.” And then a great miracle, an occurrence unseen for generations, happened. The event is described in the two stelae of Nabuna’id, in which he is depicted holding an unusual staff and facing the celestial symbols of Nibiru, Earth, and the Moon (Fig. 102): This is the great miracle of Sin that has by gods and goddesses
228
THE END OF DAYS
Figure 102
not happened in the land, since days of old unknown; That the people of the Earth had neither seen nor found written on tablets since the days of old: That Sin, lord of gods and goddesses, residing in the heavens, has come down from the heavens— in full view of Nabuna’id, king of Babylon. Sin, the inscriptions report, did not return alone. According to the texts, he entered the restored Ehulhul temple in a ceremonial procession, accompanied by his spouse Ningal/ Nikkal and his aide, the Divine Messenger Nusku. The miraculous return of Sin “from the heavens” raises many questions, the first one being Where, “in the heavens,” he had been for five or six decades. Answers to such questions can be given by combining the ancient evidence with the achievements of modern science and technology. But before we turn to that, it is important to examine all the aspects of
When the Gods Left Earth
229
the Departure, for it was not Sin alone who “became angry” and, leaving Earth, “went up to heaven.” The extraordinary celestial comings and goings described by Adda-Guppi and Nabuna’id took place while they were in Harran—a significant point because another eyewitness was present in that area at that very time; he was the Prophet Ezekiel; and he, too, had much to say on the subject. Ezekiel, a priest of Yahweh in Jerusalem, was among the aristocracy and craftsmen who had been exiled, together with King Jehoiachin, after Nebuchadnezzar’s first attack on Jerusalem in 598 b.c.e. They were taken forcefully to northern Mesopotamia, settling in the district of the Khabur River, just a short distance away from their ancestral home in Harran. And it was there that Ezekiel’s famous vision of a celestial chariot had occurred. As a trained priest, he too recorded the place and the date: it was on the fifth day of the fourth month in the fifth year of the exile—594/593 b.c.e.— “when I was among the exiles on the banks of the river Khebar, that the heavens opened up and I saw visions of Elohim,” Ezekiel stated at the very beginning of his prophecies; and what he saw, appearing in a whirlwind, flashing lights and surrounded by a radiance, was a divine chariot that could go up and down and sideways, and within it, “upon the likeness of a throne, the semblance of a man”; and he heard a voice addressing him as “Son of Man” and announcing his prophetic assignment. The Prophet’s opening statement is usually translated “visions of God.” The term Elohim, which is plural, has been traditionally translated “God” in the singular, even when the Bible itself clearly treats it in the plural, as in “And Elohim said let us fashion the Adam in our image and after our likeness” (Genesis 1: 26). As readers of my books know, the biblical Adam tale is a rendering of the much more detailed Sumerian creation texts, where it was an Anunnaki team, led by Enki, that used genetic engineering to “fashion” the Adam. The term Elohim, we have shown over and over again, referred to the Anunnaki; and what Ezekiel reported was that he had encountered an Anunnaki celestial craft— near Harran.
230
THE END OF DAYS
The celestial craft that was seen by Ezekiel was described by him, in the opening chapter and thereafter, as the God’s Kavod (“That which is heavy”)—the very same term used in Exodus to describe the divine vehicle that had landed on Mount Sinai. The craft’s description rendered by Ezekiel has inspired generations of scholars and artists; the resulting depictions have changed with time, as our own technology of flight vehicles has advanced. Ancient texts refer both to spacecraft and aircraft, and describe Enlil, Enki, Ninurta, Marduk, Thoth, Sin, Shamash, and Ishtar, to name the most prominent, as gods who possessed aircraft and could roam Earth’s skies—or engage in aerial battles, as between Horus and Seth or Ninurta and Anzu (not to mention the Indo-European gods). Of all the varied textual descriptions and pictorial depictions of the “celestial boats” of the gods, the most appropriate to Ezekiel’s vision of a Whirlwind appears to be the “whirlwind chariot” depicted at a site in Jordan (Fig. 103) from which the Prophet Elijah was taken up to heaven. Helicopterlike, it had to serve just as a shuttlecraft to where full-fledged spacecraft were stationed. Ezekiel’s mission was to prophesy and warn his exiled compatriots of the coming Day of Judgment for all the nations’ injustices and abominations. Then, a year later, the same “semblance of a man” appeared again, put out a hand, grabbed him, and carried him all the way to Jerusalem, to prophecy there. The city, it will be remembered, went through
Figure 103
When the Gods Left Earth
231
a starving siege, a humiliating defeat, wanton looting, a Babylonian occupation, and the exile of the king and all the nobility. Arriving there, Ezekiel saw a scene of complete breakdown of the rule of law and of religious observances. Wondering what was going on, he heard the remnant sitting in mourning, bewailing (8: 12; 9: 9): Yahweh sees us no more, Yahweh has left the Earth! This was, we suggest, the reason why Nebuchadnezzar dared attack Jerusalem again and destroy Yahweh’s temple. It was an outcry virtually identical to what Adda-Guppi had reported from Harran: “Sin, the lord of the gods, became angry with his city and his people, and went up to heaven; and the city and the people in it went to ruin.” One cannot be certain how or why events occurring in northern Mesopotamia gave rise to a notion in distant Judea that Yahweh, too, had left the Earth, but it is evident that word that God and gods departed had spread far and wide. Indeed, tablet VAT 7847, which we mentioned earlier in connection with the solar eclipse, states the following in a prophetic section regarding calamities that last 200 years: Roaring the gods, flying, from the lands will go away, from the people they will be separated. The people will the gods’ abodes leave in ruins. Compassion and well-being will cease. Enlil, in anger, will lift himself off. Like several other documents of the “Akkadian Prophecies” genre, scholars deem this text, too, a “post-event prophecy”—a text that uses events that had already happened as the basis for predicting other future events. Be that as it may, we have here a document that considerably expands the divine exodus: the angered gods, led by Enlil, flew away from their lands; it was not just Sin who was angered and left.
232
THE END OF DAYS
There is yet another document. It is classified by scholars as belonging to “Prophecy in Neo-Assyrian sources,” though its very first words suggest authorship by a (Babylonian?) worshipper of Marduk. Here is, in full, what it says: Marduk, the Enlil of the gods, got angry. His mind became furious. He made an evil plan to disperse the land and its peoples. His angry heart was bent on levelling the land and destroying its people. A grievous curse formed in his mouth. Evil portents indicating the disruption of heavenly harmony started appearing abunbantly in heaven and on Earth. The planets in the Ways of Enlil, Anu and Ea worsened their positions and repeatedly disclosed abnormal omens. Arahtu, the river of abundance, became a raging current. A fierce surge of water, a violent flood like the Deluge swept away the city, its houses and sanctuaries, turning them to ruins. The gods and goddesses became afraid, abandoned their shrines, flew off like birds and ascended to heaven. What is common to all these texts are the assertions that (a) the gods grew angry with the people, (b) the gods “flew away like birds,” and (c) they ascended to “heaven.” We are further informed that the departure was accompanied by unusual celestial phenomena and some terrestrial disturbances. These are aspects of the Day of the Lord as prophesied by the biblical Prophets: The Departure was related to the Return of Nibiru—the gods left Earth when Nibiru came. The VAT 7847 text includes an intriguing reference to a calamitous period of two centuries. The text does not make it
When the Gods Left Earth
233
clear whether that was a prediction of what is to follow the gods’ departure, or whether it was during such a time that their anger and disappointment with Mankind grew, leading to the Departure. It seems that the latter is the case, for it is probably no coincidence that the era of biblical prophecy regarding the nations’ sins and the coming judgment on the Day of the Lord began with Amos and Hosea circa 760/750 b.c.e.—two centuries before the Return of Nibiru! For two centuries the Prophets, from the only legitimate place of the “Bond Heaven-Earth”—Jerusalem—called for justice and honesty among people and peace among nations, scorned meaningless offerings and worship of lifeless idols, denounced wanton conquests and pitiless destruction, and warned one nation after another—Israel included—of the inevitable punishments, but to no avail. If that was the case, then what had taken place was a gradual buildup of divine anger and disappointment, and the reaching of a conclusion by the Anunnaki that “enough is enough”—it was time to leave. It all brings to mind the decision of the gods, led by the disappointed Enlil, to keep the coming Deluge and the gods’ lofting themselves in their celestial craft a secret from Mankind; now, as Nibiru was again nearing, it was the Enlilite gods who planned the Departure. Who left, how did they leave, and where did they go if Sin could come back in a few decades? For the answers, let us roll the events back to the beginning. When the Anunnaki, led by Ea/Enki, had first come to Earth to obtain the gold with which to protect their planet’s endangered atmosphere, they planned to extract the gold from the waters of the Persian Gulf. When that did not work, they shifted to mining operations in southeastern Africa and smelting and refining in the E.DIN, the future Sumer. Their number increased to 600 on Earth plus 300 Igigi who operated celestial craft to a way station on Mars, from which the long-haul spacecraft to Nibiru could be launched more easily. Enlil, Enki’s half-brother and rival for the succession, came and was put in overall command. When the Anunnaki toiling in the mines mutinied, Enki suggested that a “Primitive Worker” be fashioned; it was done by genetically up-
234
THE END OF DAYS
grading an existing Hominid. And then the Anunnaki began to “take the daughters of the Adam as wives and had children by them” (Genesis 6), with Enki and Marduk breaking the taboo. When the Deluge came, the outraged Enlil said “let mankind perish,” for “the wickedness of Man was great on the Earth.” But Enki, through a “Noah,” frustrated the plan. Mankind survived, proliferated, and in time was granted civilization. The Deluge that swept over the Earth flooded the mines in Africa, but exposed a mother lode of gold in the Andes Mountains of South America, enabling the Anunnaki to obtain more gold more easily and quickly, and without the need for smelting and refining, for the Placer Gold—pure gold nuggests washed down from the mountains—needed only panning and collecting. It also made it possible to reduce the number of Anunnaki needed on Earth. On their state visit to Earth circa 4000 b.c.e., b.c.e., the facilities in South America were the only ones left entirely in Enlilite hands. And so, when the frustrated and disgusted Anunnaki leadership decided that it was time to leave, some could use the Landing Place; others, perhaps with a last large haul of gold, had to use the South American facilities, near the place where Anu and Antu stayed during their visit to the area. As earlier mentioned, the place—now called PumaPunku—is a short distance from a shrunken Lake Titicaca (shared by Peru and Bolivia), but was then situated on the lake’s southern shore, with harbor facilities. Its main remains
When the Gods Left Earth
235
Figure 104
consist of a row of four collapsed structures, each made of a single hollowed-out giant boulder (Fig. 104). Each such hollowed-out set of chambers was completely inlaid inside with gold plates, held in place by gold nails—an incredible treasure hauled off by the Spaniards when they arrived in the sixteenth century. How such dwellings were so precisely hollowed out of the rocks and how four huge rocks were brought to the site remain a mystery. There is yet another mystery at the site. The archaeological finds in the place included a large number of unusual stone blocks that were precisely cut, grooved, angled, and shaped; some of them are shown in Fig. 105. One does not
Figure 105
When the Gods Left Earth
237? Clearly, one can think only of the Anunnaki as possessing both the technology to make those “dies” and to use them or their end products. The main outpost of the Anunnaki was situated a few miles inland, at a site now known as Tiwanacu (earlier spelled Tiahuanacu), now belonging to Bolivia. One of the first European explorers to reach it in modern times, George Squier, described the place in his book Peru Illustrated as “The Baalbec of the New world”—a comparison more valid than he realized. The next main modern explorer of Tiwanaku, Arthur Posnansky (Tihuanacu—The Cradle of American Man), reached astounding conclusions regarding the site’s age. The principal aboveground structures in Tiwanaku (there are numerous subterranean ones) include the Akapana, an artificial hill riddled with channels, conduits, and sluices whose purpose is discussed in The Lost Realms. A tourist favorite is a stone gateway known as the Gate of the Sun, a prominent structure that was also cut from a single boulder, with some of the precision exhibited at Puma-Punku. It probably served an astronomical purpose and undoubtedly a calendrical one, as the carved images on the archway indicate; those carvings are dominated by the larger image of the god Viracocha holding the lightning weapon that clearly emulated the Near Eastern Adad/Teshub (Fig. 106). Indeed, in The Lost Realms I have suggested that he was Adad/Teshub. The Gate of the Sun is so positioned that it forms an astronomical observation unit with the third prominent structure at Tiwanaku, called the Kalasasaya. It is a large rectangular structure with a sunken central courtyard and is surrounded by standing stone pillars. Posnansky’s suggstion
238
THE END OF DAYS
Figure 106 that the Kalasasaya served as an observatory has been confirmed by subsequent explorers; his conclusion, based on Sir Norman Lockyer’s archaeoastronomy guidelines, that the astronomical alignments of the Kalasasaya show that it was built thousands of years before the Incas was so incredible that German astronomical institutions sent teams of scientists to check this out. Their report, and subsequent additional verifications (viz. the scientific journal Baesseler Archiv, volume 14) affirmed that the Kalasasaya’s orientation unquestionably matched the Earth’s obliquity either in 10,000 b.c.e. or 4000 b.c.e. Either date, I wrote in The Lost Realms, was fine with me—the earlier soon after the Deluge, when the gold-obtaining operations began there, or the later date, when Anu visited; both dates matched the activities of the Anunnaki there, and the evidence for the presence of the Enlilite gods is all over the place. Archaeological, geological, and mineralogical research at the site and in the area confirmed that Tiwanaku also served as a metallurgical center. Based on various finds and the im-
When the Gods Left Earth
239
ages on the Gate of the Sun (Fig. 107a) and their similarity to depictions in ancient Hittite sites in Turkey (Fig. 107b), (Fig. 108),
Figure 107a
Figure 107b
240
THE END OF DAYS
Figure 108
been etched into the hard rocks to a depth of about 2 feet— and no one knows by whom and when or how, unless it was Adad himself who wanted to declare his presence. (Fig. 109). The drawings were made by removing the topsoil to a depth of several
When the Gods Left Earth
241
Figure 109 inches, and were executed with a unicursal line—a continuous line that curves and twists without crossing over itself. Anyone flying over the area (there are small planes at the service of tourists there) invariably concludes that “someone” airborne has used a soil-blasting device to doodle on the ground below. Directly relevant to the subject of the Departure, however, is another even more puzzling feature of the Nazca Lines— actual “lines” that look like wide runways (Fig. 110). Straight without fault, these flat stretches—sometimes narrow, sometimes wide, sometimes short, sometimes long— run straight over hills and vales, no matter the shape of the terrain. There are some 740 straight “lines,” sometimes
Figure 110
When the Gods Left Earth
243
combined with triangular “trapezoids� (Fig. 111). They frequently criss-cross each other without rhyme or reason, sometimes running over the animal drawings, revealing that the lines were made at different times. Various attempts to resolve the mystery of the Lines, in-
Figure 111
244
THE END OF DAYS
cluding those by the late Maria Reiche, who made it her lifelong project, failed whenever an explanation was sought in terms of “it was done by native Peruvians”—people of a “Nazca culture” or a “Paracas civilization” or the likes. Studies (including some by the National Geographic Society) aimed at uncovering astronomical orientations for the lines— alignments with solstices, equinoxes, this or that star—led nowhere. For those who rule out an “Ancient Astronauts” solution, the enigma remains unresolved.. That the “celestial chambers” of the Anunnaki did emit such exhausts is indicated by the Sumerian pictograph (read DIN.GIR) for the space gods (Fig. 112). This, I suggest, is the solution of the puzzle of the “Nazca Lines”: Nazca was the last spaceport of the Anunnaki. It served them after the one in the Sinai was detroyed, and then it served them for the final Departure.
Figure 112
When the Gods Left Earth
245
There are no eyewitness-report texts regarding the airborne craft and flights in Nazca; there are, as we have shown, texts from Harran and Babylon regarding the flights that undoubtedly used the Landing Place in Lebanon. The eyewitness reports relating to those departure flights and Anunnaki’s craft include the testimony of the Prophet Ezekiel and the inscriptions of Adda-Guppi and Nabunaid. The inevitable conclusion must be that from at least 610 b.c.e. through probably 560 b.c.e., the Anunnaki gods were methodically leaving planet Earth. Where did they go as they lifted off Earth? It had to be, of course, a place from which Sin could return relatively soon once he changed his mind. The place was the good old Way Station on Mars, from which the long-distance spaceships raced to intercept and land on the orbiting Nibiru. As detailed in The Twelfth Planet, Sumerian knowledge of our Solar system included references to the use of Mars by the Anunnaki as a Way Station. It is evidenced by a remarkable depiction on a 4,500-year-old cylinder seal now in the Hermitage Museum in St. Petersburg, Russia (Fig. 113) that shows an astronaut on Mars (the sixth planet) communicating with one on Earth (the seventh planet, counting from the
Figure 113
246
THE END OF DAYS
outside in), with a spacecraft in the heavens between them. Benefiting from Mars’s lower gravity compared to that of Earth, the Anunnaki had found it easier and more logical to first transport themselves and their cargos in shuttlecraft from Earth to Mars, and there transfer to reach Nibiru (and vice versa). In 1976, when all that was first presented in The Twelfth Planet, Mars was still held to be an airless, waterless, lifeless, hostile planet, and the suggestion that a space base had once existed there was deemed by establishment scholars even more far out than the notion of “Ancient Astronauts.” By the time Genesis Revisited was published in 1990, there were enough of NASA’s own findings and photographs from Mars to fill up a whole chapter titled “A Space Base on Mars.” The evidence showed that Mars once had water, and included photographs of walled structures, roads, a hublike compound (Fig. 114 shows just two such photographs)—and the famous Face (Fig. 115). Both the United States and the Soviet Union (now Russia) made great efforts to reach and explore Mars with unmanned spacecraft; unlike other space endeavors, the missions to Mars—since augmented by the European Union—have met with an unusual, troubling, and puzzling high rate of failures, including bewildering unexplained disappearances of spacecraft. But due to persistent efforts, enough U.S., Soviet, and European unmanned spacecraft have managed to reach and explore Mars in the last two decades, that by now the scientific journals—of the same “Doubting Thomases” of the 1970s—have been filled with reports, studies, and photographs announcing that Mars did have a sizeable and still has a thin atmosphere; that it once had rivers, lakes, and oceans and still has water, at some places just below the surface and in some instances even visible as small frozen lakes—as a medley of the headlines shows (Fig. 116). In 2005 NASA’s Mars Rovers sent back chemical and photographic evidence backing those conclusions; together with some of the Rovers’ amazing photographs showing structural remains—like a sand-covered wall with distinct rightangled corners (Fig. 117)—they should suffice here to make
Figure 114
Figure 115
Figure 116
When the Gods Left Earth
249
Figure 117 the point: Mars could, and did, serve as a Way Station for the Anunnaki. It was the first close-by destination of the departing gods, as confirmed by the relatively quick return of Sin. Who else left, who stayed behind, who might return? Surprisingly, some of the answers also come from Mars.
14 THE END OF DAYS
Mankind’s recollection of landmark events in its past—“legends” or “myths” to most historians—includes tales deemed “universal” in that they have been part of the cultural or religious heritage of peoples all over the Earth. Tales of a First Human Couple, of a Deluge, or of gods who came from the heavens, belong to that category. So do tales of the gods’ departure back to the heavens. Of particular interest to us are such collective memories by the peoples and in the lands where the departures had actually taken place. We have already covered the evidence from the ancient Near East; it also comes from the Americas, and it embraces both Enlilite and Enki’ite gods. In South America, the dominant deity was called Viracocha (“Creator of All”). The Aymara natives of the Andes told of him that his abode was in Tiwanaku, and that he gave the first two brother-sister couples a golden wand with which to find the right place to establish Cuzco (the eventual Inca capital), the site for the observatory of Machu Picchu, and other sacred sites. And then, having done all that, he left. The grand layout, which simulated a square ziggurat with its corners oriented to the cardinal points, then marked the direction of his eventual departure (Fig. 118). We have identified the god of Tiwanaku as Teshub/Adad of the Hittite/Sumerian pantheon, Enlil’s youngest son. In Mesoamerica, the giver of civilization was the “Winged Serpent” Quetzalcoatl. We have identified him as Enki’s son Thoth of the Egyptian pantheon (Ningishzidda to the Sumerians) and as the one who, in 3113 b.c.e., brought over his
The End of Days
251
Figure 118
African followers to establish civilization in Mesoamerica. Though the time of his departure was not specified, it had to coincide with the demise of his African protégés, the Olmecs, and the simultaneous rise of the native Mayas—circa 600/500 b.c.e. The dominant legend in Mesoamerica was his promise, when he departed, to return—on the anniversary of his Secret Number 52. And so it was, by the middle of the first millennium b.c.e., in one part of the world after another, that Mankind found itself without its long-worshipped gods; and before long, the question (which has been asked by my readers) began to preoccupy Mankind: Will they return? Like a family suddenly abandoned by its father, Mankind grasped for the hope of a Return; then, like an orphan needing help, Mankind cast about for a Savior. The Prophets promised it will surely happen—at the End of Days. At the peak of their presence, the Anunnaki numbered 600 on Earth plus another 300 Igigi based on Mars. Their number
252
THE END OF DAYS
was falling after the Deluge and especially after Anu’s visit circa 4000 b.c.e. Of the gods named in the early Sumerian texts and in long God Lists, few remained as the millennia followed each other. Most returned to their home planet; some—in spite of their wonted “immortality”—died on Earth. We can mention the defeated Zu and Seth, the dismembered Osiris, the drowned Dumuzi, the nuclear-afflicted Bau. The departures of the Anunnaki gods as Nibiru’s return loomed were the dramatic finale. b.c.e.), the nations surrounding Judea were mocked for worshipping not a “living god” but idols made by craftsmen of stone, wood, and metal—gods who needed to be carried, for they could not walk. With the final departure taking place, who of the great Anunnaki gods remained on Earth? To judge by who was mentioned in the texts and inscriptions from the ensuing period, we can be certain only of Marduk and Nabu of the Enki’ites; and of the Enlilites, Nannar/Sin, his spouse Ningal/Nikkal and his aide Nusku, and probably also Ishtar. On each side of the great religious divide there was now just one sole Great God of Heaven and Earth: Marduk for the Enki’ites, Nannar/Sin for the Enlilites. The story of Babylonia’s last king reflected the new circumstances. He was chosen by Sin in his cult-center Harran— but he required the consent and blessing of Marduk in Babylon, and the celestial confirmation by the appearance of Marduk’s planet; and he bore the name Nabu-Na’id. This divine co-regnum might have been an attempt at Dual Monotheism (to coin an expression); but its unintended consequence was to plant the seeds of Islam. The historical record indicates that neither gods nor people were happy with these arrangements. Sin, whose temple in Harran was restored, demanded that his great ziggurat temple
The End of Days
253
in Ur should also be rebuilt and become the center of worship; and in Babylon, the priests of Marduk were up in arms. A tablet now in the British Museum is inscribed with a text that scholars have titled Nabunaid and the Clergy of Babylon. It contains a list of accusations by the Babylonian priests against Nabunaid. The charges ran from civil matters (“law and order are not promulgated by him”), through neglect of the economy (“the farmers are corrupted,” “the traders’ roads are blocked”), and lack of public safety (“nobles are killed”), to the most serious charges: religious sacrilege—. It was, the accusations continued, a strange statue of a deity, never seen before, “with hair reaching down to the pedestal.” It was so unusual and unseemly, the priests wrote, that even Enki and Ninmah (who ended up with strange chimera creatures when they attempted to fashion Man) “could not have conceived it”; it was so strange that “not even the learned Adapa”—an icon of utmost human knowledge—“could have named it.” To make matters worse, two unusual beasts were sculpted as its guardians—one a “Deluge demon” and the other a wild bull; then the king took this abomination and placed it in Marduk’s Esagil temple. Even more offending was Nabunaid’s announcment that henceforth the Akitu festival, during which the near-death, resurrection, exile, and final triumph of Marduk were reenacted, would no longer be celebrated. Declaring that Nabunaid’s “protective god became hostile to him” and that “the former favorite of the gods was now fated to misfortune,” the Babylonian priests forced Nabunaid
254
THE END OF DAYS
to leave Babylon and go into exile “in a distant region.” It is a historical fact that Nabunaid indeed left Babylon and named his son Bel-Shar-Uzur—the Belshazzar of the biblical Book of Daniel—as regent. The “distant region” to which Nabunaid went in self-exile was Arabia. As various inscriptions attest, his entourage included Jews from among the Judean exiles in the Harran region. His principal base was at a place called Teima, a caravan center in what is now northwestern Saudi Arabia that is mentioned several times in the Bible. (Recent excavations there have uncovered cuneiform tablets attesting to Nabunaid’s stay.) He established six other settlements for his followers; five of the towns were listed—a thousand years later—by Arabian writers as Jewish towns. One of them was Medina, the town where Muhammed founded Islam. The “Jewish angle” in the Nabunaid tale has been reinforced by the fact that a fragment of the Dead Sea scrolls, found at Qumran on the shores of the Dead Sea, mentions Nabunaid and asserts that he was suffering in Teima from an “unpleasant skin disease” that was cured only after “a Jew told him to give honor to the God Most High.” All that has led to speculation that Nabunaid was contemplating Monotheism; but to him the God Most High was not the Judeans’ Yahweh, but his benefector Nannar/Sin, the Moon god, whose crescent symbol has been adopted by Islam; and there is little doubt that its roots can be traced back to Nabunaid’s stay in Arabia. Sin’s whereabouts fade out of Mesopotamian records after the time of Nabunaid. Texts discovered at Ugarit, a “Canaanite” site on the Mediterranean coast in Syria now called Ras Shamra, describe the Moon god as retired, with his spouse, to an oasis at the confluence of two bodies of water, “near the cleft of the two seas.” Ever wondering why the Sinai peninsula was named in honor of Sin and its main central crossroads in honor of his spouse Nikkal (the place is still called, in Arabic, Nakhl), I surmised that the aged couple retired to somewhere on the shores of the Red Sea and the Gulf of Eilat. The Ugaritic texts called the Moon god EL—simply, “God,” a forerunner of Islam’s Allah; and his moon-cres-
The End of Days
255
cent symbol crowns every Moslem mosque. And as tradition demands, the mosques are flanked, to this day, by minarets that simulate multistage rocketships ready to be launched (Fig. 119). The last chapter in the Nabunaid saga was linked to the emergence on the scene of the ancient world of the Persians—a name given to a medley of peoples and states on the Iranian plateau that included the olden Sumerian Anshan and Elam and the land of the later Medes (who had a hand in the demise of Assyria). It was in the sixth century b.c.e. that a tribe called Achaemeans by Greek historians who recorded their deeds emerged from the northern outskirts of those territories, seized control, and unified them all to become a mighty new empire. Though deemed to racially be “Indo-Europeans,” their tribal name stemmed from that of their ancestor Hakham-Anish, which meant “Wise Man” in Semitic Hebrew—a fact that some attribute to the influence of Jewish exiles from the Ten Tribes who had been relocated to that
Figure 119
256
THE END OF DAYS
region by the Assyrians. Religiously, the Achaemean Persians apparently adopted a Sumerian-Akkadian pantheon akin to its Hurrian-Mitannian version, which was a step to the Indo-Aryan one of the Sanskrit Vedas—a mixture that is conveniently simplified by just stating that they believed in a God Most High whom they called Ahura-Mazda (“Truth and Light”). In 560 b.c.e. the Achaemean king died and his son Kurash succeeded him on the throne and made his mark on subsequent historic events. We call him Cyrus; the Bible called him Koresh and considered him Yahweh’s emissary for conquering Babylon, overthrowing its king, and rebuilding the destroyed Temple in Jerusalem. “Though you knowest Me not, I, Yahweh, the God of Israel, am thy caller who hath called you by name . . . who will help you though you don’t recognize me,” the biblical God stated through the prophet Isaiah (44: 28 to 45: 1–4). That end of Babylonian kingship was most dramatically foretold in the Book of Daniel. One of the Judean exiles taken to Babylon, Daniel was serving in the Babylonian court of Belshazzar when, during a royal banquet, a floating hand appeared and wrote on the wall MENE MENE TEKEL UPHARSIN. Astounded and mystified, the king called his wizards and seers to decipher the inscription, but none could. As a last resort, the exiled Daniel was called in, and he told the king the inscription’s meaning: God has weighed Babylon and its king and, finding them wanting, numbered their days; they will meet their end by the hand of the Persians. In 539 b.c.e. Cyrus crossed the Tigris River into Babylonian territory, advanced on Sippar where he intercepted a rushing-back Nabunaid, and then—claiming that Marduk himself had invited him—entered Babylon without a fight. Welcomed by the priests who considered him a savior from the heretic Nabunaid and his disliked son, Cyrus “grasped the hands of Marduk” as a sign of homage to the god. But he also, in one of his very first proclamations, rescinded the exile of the Judeans, permitted the rebuilding of the Temple in Jerusalem, and ordered the return of all the Temple’s ritual objects that were looted by Nebuchadnezzar.
The End of Days
257
The returning exiles, under the leadership of Ezra and Nehemiah, completed the rebuilding of the Temple—henceforth known as the Second Temple—in 516 b.c.e.—exactly, as was prophesied by Jeremiah, seventy years after the First Temple was destroyed. The Bible considered Cyrus an instrument of God’s plans, an “anointed of Yahweh”; historians believe that Cyrus proclaimed a general religious amnesty that allowed each people to worship as they pleased. As to what Cyrus himself might have believed, to judge by the monument he had erected for himself, he appears to have envisioned himself as a winged Cherub (Fig. 120). Cyrus—some historians attach the epithet “the great” to his name—consolidated into a vast Persian empire all the lands that had once been Sumer & Akkad, Mari and Mittani, Hatti and Elam, Babylonia and Assyria; it was left to his son Cambyses (530–522 b.c.e.) to extend the empire to Egypt. Egypt was just recovering from a period of disarray that some consider a Third Intermediate Period, during which it was disunited, changed capitals several times, was ruled by invaders from Nubia, or had no central authority at all. Egypt
Figure 120
258
THE END OF DAYS
was also in disarray religiously, its priests uncertain who to worship, so much so that the leading cult was that of the dead Osiris, the leading deity the female Neith whose title was Mother of God, and the principal “cult object” a bull, the sacred Apis Bull, for whom elaborate funerals were held. Cambyses, too, like his father, was no religious zealot, and let people worship as they pleased; he even (according to an inscribed stela now in the Vatican museum) learnt the secrets of the worship of Neith and participated in a ceremonial funeral of an Apis bull. These religious laissez-faire policies bought the Persians peace in their empire, but not forever. Unrest, uprisings, and rebellions kept breaking out almost everywhere. Especially troublesome were growing commercial, cultural, and religious ties between Egypt and Greece. (Much information about that comes from the Greek historian Herodotus, who wrote extensively about Egypt after his visit there circa 460 b.c.e., coinciding with the beginning of Greece’s “golden age.”) The Persians could not be pleased with those ties, above all because Greek mercenaries were participating in the local uprisings. Of particular concern were also the provinces in Asia Minor (present-day Turkey), at the western tip of which Asia and the Persians faced Europe and the Greeks. There, Greek settlers were reviving and reinforcing olden settlements; the Persians, on their part, sought to ward off the troublesome Europeans by seizing nearby Greek islands. The growing tensions broke into open warfare when the Persians invaded the Greek mainland and were beaten at Marathon in 490 b.c.e.. A Persian invasion by sea was beaten off by the Greeks in the straits of Salamis a decade later, but the skirmishes and battles for control of Asia Minor continued for another century, even as in Persia king followed king and in Greece Athenians, Spartans, and Macedonians fought one another for supremacy. In those double struggles—one among the mainland Greeks, the other with the Persians—the support of the Greek settlers of Asia Minor was very important. No sooner did the Macedonians win the upper hand on the mainland
The End of Days
259
than their king, Philip II, sent an armed corps over the Straits of Hellespont (today’s Dardanelles) to secure the loyalty of the Greek settlements. In 334 b.c.e. his successor, Alexander (“the Great”), heading an army 15,000 strong, crossed into Asia at the same place and launched a major war against the Persians. Alexander’s astounding victories and the resulting subjugation of the Ancient East to Western (Greek) domination have been told and retold by historians—starting with some who had accompanied Alexander—and need no repetition here. What does need to be described are the personal reasons for Alexander’s foray into Asia and Africa. For, apart from all geopolitical or economic reasons for the Greek-Persian great war, there was Alexander’s own personal quest: there had been persistent rumors in the Macedonian court that not King Philip but a god—an Egyptian god—was Alexander’s true father, having come to the queen, Olympias, disguised as a man. With a Greek pantheon that derived from across the Mediterranean Sea and headed (like the Sumerian twelve) by twelve Olympians, and with tales of the gods (“myths”) that emulated the Near Eastern tales of the gods, the appearance of one such god in the Macedonian court was not deemed an impossibility. With court shenanigans that involved a young Egyptian mistress of the king and marital strife that included divorce and murders, the “rumors” were believed—first and foremost by Alexander himself. A visit by Alexander to the oracle in Delphi to find out whether he was indeed the son of a god and therefore immortal only intensified the mystery; he was advised to seek an answer at an Egyptian sacred site. It was thus that as soon as the Persians were beaten in the first battle, Alexander, rather than pursuing them, left his main army and rushed to the oasis of Siwa in Egypt. There the priests assured him that he indeed was a demigod, the son of the ram-god Amon. In celebration, Alexander issued silver coins showing him with ram’s horns (Fig. 121). But what about the immortality? While the course of the resumed warfare and Alexander’s conquests have been
260
THE END OF DAYS
Figure 121 documented by his campaign historian Callisthenes and other historians, his personal quest for Immortality is mostly known from sources deemed to be pseudo-Callisthenes, or “Alexander Romances” that embellished fact with legend. As detailed in The Stairway to Heaven, the Egyptian priests directed Alexander from Siwa to Thebes. There, on the Nile River’s western shore, he could see in the funerary temple built by Hatshepsut the inscription attesting to her being fathered by the god Amon when he came to her mother disguised as the royal husband—exactly like the tale of Alexander’s demigod conception. In the great temple of RaAmon in Thebes, in the Holy of Holies, Alexander was crowned as a Pharaoh. Then, following the directions given in Siwa, he entered subterranean tunnels in the Sinai peninsula, and finally he went to where Amon-Ra, alias Marduk, was—to Babylon. Resuming the battles with the Persians, Alexander reached Babylon in 331 b.c.e., and entered the city riding in his chariot. In the sacred precinct he rushed to the Esagil ziggurat temple to grasp the hands of Marduk as conquerors before him had done. But the great god was dead. According to the pseudo-sources, Alexander saw the god lying in a golden coffin, his body immersed (or preserved) in special oils. True or not, the facts are that Marduk was no longer alive, and that his Esagil ziggurat was, without exception, described as his tomb by subsequent established historians. According to Diodorus of Sicily (first century b.c.e.),
The End of Days
261
whose Bibliothca historica is known to have been compiled from verified reliable sources, “scholars called Chaldaeans, who have gained a great reputation in astrology and who are accustomed to predict future events by a method based on age-old observations,” warned Alexander that he would die in Babylon, but “could escape the danger if he re-erected the tomb of Belus which had been demolished by the Persians” (Book XVII, 112.1). Entering the city anyway, Alexander had neither the time nor the manpower to do the repairs, and indeed died in Babylon in 323 b.c.e. by.
262
THE END OF DAYS
That the end came as the Age of the Ram was waning was probably no coincidence, either. With the death of Marduk and the fading away of Nabu, all the great Anunnaki gods who had once dominated Earth were
The End of Days
263 shall no longer teach war” (Isaiah 2: 1–4). The assertion that after troubles and tribulations, after people and nations shall be judged for their sins and transgressions, a time of peace and justice shall come was also made by the early Prophets even as they predicted the Day of the Lord as judgment day. Among them were Hosea, who foresaw the return of the kingdom of God through the House of David at the End of Days, and Micha, who—using words identical to those of Isaiah—declared that “at the End of Days it shall come to pass.” Significantly, Micha too considered the restoration of God’s Temple in Jerusalem and Yahweh’s universal reign through a descendant of David as a prerequisite, a “must” destined from the very beginning, “emanating from ancient times, from everlasting days.” There was thus a combination of two basic elements in those End of Days predictions: one, that the Day of the Lord, a day of judgment upon Earth and the nations, will be followed by Restoration, Renewal, and a benevolent era centered on Jerusalem. The other is, that it has all been preordained, that the End was already planned by God at the Beginning. Indeed, the concept of an End of Epoch, a time when the course of events shall come to a halt—a precursor, one may say, of the current idea of the “End of History”— and a new epoch (one is almost tempted to say, a New Age), a new (and predicted!) cycle shall begin, can already be found in the earliest biblical chapters. The Hebrew term Acharit Hayamim (sometimes translated “last days,” “latter days,” but more accurately “end of
264
THE END OF DAYS
days”) was already used in the Bible in Genesis (Chapter 49), when the dying Jacob summoned his sons and said: “Gather yourselves together, that I may tell you that which shall befall you at the End of Days.” It is a statement (followed by detailed predictions that many associate with the twelve houses of the zodiac) that presupposes prophecy by being based on advance knowledge of the future. And again, in Deuteronomy (Chapter 4), when Moses, before dying, reviewing Israel’s divine legacy and its future, counseled the people thus: “When you in tribulations shall be and such things shall befall you, in the End of Days to Yahweh thy God return and hearken to His voice.” The repeated stress on the role of Jerusalem, on the essentiality of its Temple Mount as the beacon to which all nations shall come streaming, had more than a theological-moral reason. A very practical reason is cited: the need to have the site ready for the return of Yahweh’s Kavod—the very term used in Exodus and then by Ezekiel to describe God’s celestial vehicle! The Kavod that will be enshrined in the rebuilt Temple, “from which I shall grant peace, shall be greater than the one in the First Temple,” the Prophet Haggai was told. Significantly, the Kavod’s coming to Jerusalem was repeatedly linked in Isaiah to the other space-related site—in Lebanon: It is from there that God’s Kavod shall arrive in Jerusalem, verses 35: 2 and 60: 13 stated. One cannot avoid the conclusion that a divine Return was expected at the End of Days; but when was the End of Days due? The question—one to which we shall offer our own answer—is not new, for it has already been asked in antiquity, even by the very Prophets who had spoken of the End of Days. Isaiah’s prophecy about the time “when a great trumpet shall be blown” and the nations shall gather and “bow down to Yahweh on the Holy Mount in Jerusalem” was accompanied by his admission that without details and timing the people could not understand the prophecy. “Precept is upon precept, precept is within precept, line is upon line, line is with line, a little here, somewhat there” was how Isaiah (28:
The End of Days
265
10) complained to God. Whatever answer he was given, he was ordered to seal and hide the document; no less than three times, Isaiah changed the word for “letters” of a script— Otioth—to Ototh, which meant “oracular signs,” hinting at the existence of a kind of secret “Bible Code” due to which the divine plan could not be comprehended until the right time. Its secret code might have been hinted at when the Prophet asked God—identified as “Creator of the letters”— to “tell us the letters backward” (41: 23). The prophet Zephaniah—whose very name meant “By Yahweh encoded”—relayed a message from God that it will be at the time of the nations’ gathering that He “will speak in a clear language.” But that said no more than saying, “You’ll know when it will be time to tell.” No wonder, then, that in its final prophetic book, the Bible dealt almost exclusively with the question of WHEN—when will the End of Days come? It is the Book of Daniel, the very Daniel who deciphered (correctly) for Belshazzar the Writing on the Wall. It was after that that Daniel himself began to have omen-dreams and to see apocalyptic visions of the future in which the “Ancient of Days” and his archangels played key roles. Perplexed, Daniel asked the angels for explanations; the answers consisted of predictions of future events, taking place at, or leading to, the End of Time. And when will that be? Daniel asked; the answers, which on the face of it seemed precise, only piled up enigmas upon puzzles. In one instance an angel answered that a phase in future events, a time when “an unholy king shall try to change the times and the laws,” will last “a time, times and a half time”; only after that will the promised Messianic Time, when “the kingdom of heaven will be given to the people by the Holy Ones of the Most High,” come about. Another time the responding angel said: “Seventy sevens and seventy sixties of years have been decreed for your people and your city until the measure of transgression is filled and prophetic vision is ratified”; and yet another time that “after the seventies and sixties and two of years, the Messiah will be cut off, a leader will come who will destroy the city, and the end will come through a flood.”
266
THE END OF DAYS
Seeking a clearer answer, Daniel then asked a divine messenger to speak plainly: “How long until the end of these awful things?” In response, he again received the enigmatic answer that the End will come after “a time, times and a half time.” But what did “time, times and a half time” mean, what did “seventy weeks of years” mean? “I heard and did not understand,” Daniel stated in his book. “So I said: My lord, what will be the outcome of these things?” Again speaking in codes, the angel answered: “from the time the regular offering is abolished and an appalling abomination is set up, it will be a thousand and two hundred and ninety days; happy is the one who waits and reaches one thousand three hundred and thirty five.” And having given Daniel that information, the angel—who had called him before “Son of Man”—told him: “Now, go on to thy end, and arise for your destiny at the End of Days.” Like Daniel, generations of biblical scholars, savants and theologians, astrologers and even astronomers—the famed Sir Isaac Newton among the latter—also said “we heard, but did not understand.” The enigma is not just the meaning of “time, time and a half ” and so on, but from when does (or did) the count begin? The uncertainty stems from the fact that the symbolic visions seen by Daniel (such as a goat attacking a ram, or two horns multiplying to four and then dividing) were explained to him by the angels as events that were to take place well beyond Babylon of Daniel’s time, beyond its predicted fall, even beyond the prophesied rebuilding of the Temple after seventy years. The rise and demise of the Persian empire, the coming of the Greeks under Alexander’s leadership, even the division of his conquered empire among his successors—all are foretold with such accuracy that many scholars believe that the Daniel prophecies are of the “post-event” genre—that the book’s prophetic part was actually written circa 250 b.c.e. but pretended to have been written three centuries earlier. The clinching argument is the reference, in one of the angelic encounters, to the start of the count “from the time that regular offering [in the temple] is abolished and an appalling abomination is set up.” That could only refer to the events
The End of Days
267
that took place in Jerusalem on the 25th day of the Hebrew month Kislev in 167 b.c.e. The date is precisely recorded, for it was then that “the abomination of desolation” was placed in the Temple, marking—many then believed—the start of the End of Days.
15 JERUSALEM: A CHALICE, VANISHED
In the twenty-first century b.c.e., when nuclear weapons were first used on Earth, Abraham was blessed with wine and bread at Ur-Shalem in the name of the God Most High— and proclaimed Mankind’s first Monotheistic religion. Twenty-one centuries later, a devout descendant of Abraham, celebrating a special supper in Jerusalem, carried on his back a cross—the symbol of a certain planet—to a place of execution, and gave rise to another monotheistic religion. Questions still swirl about him—Who really was he? What was he doing in Jerusalem? Was there a plot against him, or was he his own plotter? And what was the chalice that has given rise to the legends about (and searches for) the “Holy Grail”? On his last evening of freedom he celebrated the Jewish Passover ceremonial meal (called Seder in Hebrew) with wine and unleavened bread together with his twelve disciples, and the scene has been immortalized by some of the greatest painters of religious art, Leonardo Da Vinci’s The Last Supper being the most famous of them (Fig. 122). Leonardo was renowned for his scientific knowledge and theological insights; what his painting shows has been discussed, debated, and analyzed to this day—deepening, rather than resolving, the enigmas. The key to unlocking the mysteries, we shall show, lies in what the painting does not show; it is what is missing from it that holds answers to troubling puzzles in the saga of God and Man on Earth, and the yearnings for
Jerusalem: A Chalice, Vanished
269
Figure 122 Messianic Times. Past, Present, and Future do converge in the two events, separated by twenty-one centuries; Jerusalem was pivotal to both, and by their timing, they were linked by biblical prophecies about the End of Days. To understand what happened twenty-one centuries ago, we need to roll the pages of history back to Alexander, who deemed himself the son of a god, yet died in Babylon at the young age of thirty-two. While alive, he controlled his feuding generals through a mixture of favors, punishments, and even untimely deaths (some, in fact, believed that Alexander himself was poisoned). No sooner did he die than his four year-old son and his guardian, Alexander’s brother, were murdered and the quarrelling generals and regional commanders divided between them the main conquered lands: Ptolemy and his successors, headquartered in Egypt, seized Alexander’s African domains; Seleucus and his successors ruled, from Syria, Anatolia, Mesopotamia, and the distant Asian lands; the contested Judea (with Jerusalem) ended up in the Ptolemaic realm. The Ptolemies, having managed to maneuver Alexander’s
270
THE END OF DAYS
body for burial in Egypt, considered themselves his true heirs and, by and large, continued his tolerant attitude toward others’ religions. They established the famed Library of Alexandria, and assigned an Egyptian priest, known as Manetho, to write down Egypt’s dynastic history and divine prehistory for the Greeks (archaeology has confirmed what is still known of Manetho’s writings). That convinced the Ptolemies that their civilization was a continuation of the Egyptian one, and they thus considered themselves rightful successors to the Pharaohs. Greek savants showed particular interest in the religion and writings of the Jews, so much so that the Ptolemies arranged for the translation of the Hebrew Bible into Greek (a translation known as the Septuagint) and allowed the Jews complete religious freedom of worship in Judea, as well as in their growing communities in Egypt. Like the Ptolemies, the Seleucids also retained a Greekspeaking scholar, a former priest of Marduk known as Berossus, to compile for them the history and prehistory of Mankind and its gods according to Mesopotamian knowledge. In a twist of history, he researched and wrote at a library of cuneiform tablets located near Harran. It is from his three books (which we know of only from fragmented quotations in the writings of others in antiquity) that the Western world, of Greece and then Rome, learnt of the Anunnaki and their coming to Earth, the prediluvial era, the creation of Wise Man, the Deluge, and what followed. Thus it was from Berossus (as later confirmed by the discovery and decipherment of the cuneiform tablets) that the 3600 “Sar” as the “year” of the gods was first learnt. In 200 b.c.e. the Seleucids crossed the Ptolemaic boundary and captured Judea. As in other instances, historians have searched for geopolitical and economic reasons for the war—ignoring the religious-messianic aspects. It was in the report about the Deluge that the tidbit information was given by Berossus, that Ea/Enki instructed Ziusudra (the Sumerian “Noah”) to “conceal every available writing in Sippar, the city of Shamash,” for post-Diluvial recovery, because those writings “were about beginnings, middles and ends.” According to Berossus, the world undergoes periodic cata-
Jerusalem: A Chalice, Vanished
271
clysms, and he related them to the zodiacal Ages, his contemporary one having begun 1,920 years before the Seleucid Era (312 b.c.e.); that would have placed the beginning of the Age of the Ram in 2232 b.c.e.—an Age destined to come soon to an end even if the full mathematical length is granted to it (2232–2160 = 122 b.c.e.). The available records suggest that the Seleucid kings, coupling those calculations with the Missing Return, were seized with the need to urgently expect and prepare for one. A frenzy of rebuilding the ruined temples of Sumer and Akkad began, with emphasis on the E.ANNA—the “House of Anu”—in Uruk. The Landing Place in Lebanon, called by them Heliopolis—City of the Sun god—was rededicated by erecting a temple honoring Zeus. The reason for the war to capture Judea, one must conclude, was the urgency of also preparing the space-related site in Jerusalem for the Return. It was, we suggest, the Greek-Seleucid way of preparing for the reappearance of the gods. Unlike the Ptolemies, the Seleucid rulers were determined to impose the Hellenic culture and religion in their domains. The change was most significant in Jerusalem, where suddenly foreign troops were stationed and the authority of the Temple priests was curtailed. Hellenistic culture and customs were forcefully introduced; even names had to be changed, starting with the high priest, who was obliged to change his name from Joshua to Jason. Civil laws restricted Jewish citizenship in Jerusalem; taxes were raised to finance the teaching of athletics and wrestling instead of the Torah; and in the countryside, shrines to Greek deities were being erected by the authorities and soldiers were sent to enforce worship in them. In 169 b.c.e. the then Seleucid king, Antiochus IV (who adopted the epithet Epiphanes) came to Jerusalem. It was not a courtesy visit. Violating the Temple’s sanctity, he entered the Holy of Holies. On his orders, the Temple’s treasured golden ritual objects were confiscated, a Greek governor was put in charge of the city, and a fortress for a permanent garrison of foreign soldiers was built next to the Temple. Back in his Syrian capital, Antiochus issued a proclamation requiring
272
THE END OF DAYS
worship of Greek gods throughout the kingdom; in Judea, it specifically forbade the observance of the Sabbath and circumcision. In accordance with the decree, the Jerusalem temple was to become a temple to Zeus; and in 167 b.c.e., on the 25th day of the Hebrew month Kislev—equivalent to today’s December 25—an idol, a statue representing Zeus, “The Lord of Heaven,” was set up by Syrian-Greek soldiers in the temple, and the great altar was altered and used for sacrifices to Zeus. The sacrilege could not have been greater. The unavoidable Jewish uprising, begun and led by a priest named Matityahu and his five sons, is known as the Hashmonean or Maccabean Revolt. Starting in the countryside, the uprising quickly overcame the local Greek garrisons. As the Greeks rushed in reinforcements, the revolt engulfed the whole country; what the Maccabees lacked in numbers and weapons, they compensated for by the ferocity of their religious zeal. The events, described in the Book of Maccabees (and by subsequent historians), leave no doubt that the fight of the few against a powerful kingdom was guided by a certain timetable: It was imperative to retake Jerusalem, cleanse the temple, and rededicate it to Yahweh by a certain deadline. Managing in 164 b.c.e. to recapture only the Temple Mount, the Maccabees cleansed the Temple, and the sacred flame was rekindled that year; the final victory, leading to full control of Jerusalem and restoration of Jewish independence, took place in 160 b.c.e. The victory and rededication of the Temple are still celebrated by Jews as the holiday of Hanukkah (“rededication”) on the twenty-fifth day of Kislev. The sequence and the timing of those events appeared to be linked to the prophecies about the End of Days. Of those prophecies, as we have seen, the ones that offered specific numerical clues in regard to the ultimate future, the End of Days, were conveyed by the angels to Daniel. But clarity is lacking because the counts were enigmatically expressed either in a unit called “time,” or in “weeks of years,” and even in numbers of days; and it is perhaps only in respect to the latter that one is told when the count does begin, so that one could know when it would end. In that one instance, the
Jerusalem: A Chalice, Vanished
273
count was to begin from the day when “regular offering is abolished and an appalling abomination is set up” in the Jerusalem temple; we have established that such an abominable act indeed took place one day in 167 b.c.e. With the sequence of those events in mind, the count of days given to Daniel must have applied to the specific events at the Temple: its defiling in 167 b.c.e. (“when the regular offering is abolished and an appalling abomination is set up”), the cleansing of the Temple in 164 b.c.e. (after “a thousand and two hundred and ninety days”), and Jerusalem’s complete liberation by 160 b.c.e. (“happy is the one who waits and reaches one thousand three hundred and thirty five days”). The numbers of days, 1290 and 1335, basically match the sequence of events at the Temple. According to the prophecies in the Book of Daniel, it was then that the clock of the End of Days began ticking. The imperative of recapturing the whole city and the removal of uncircumcised foreign soldiers from the Temple Mount by 160 b.c.e. hold the key to another clue. While we have been using the accepted count of b.c.e. and a.d. for dating events, the people of those past times obviously could not and did not use a timetable based on a future Christian calendar. The Hebrew calendar, as we have mentioned earlier, was the calendar begun in Nippur in 3760 b.c.e.—and according to that calendar, what we call 160 b.c.e. was precisely the year 3600! That, as the reader knows by now, was a SAR, the original (mathematical) orbital period of Nibiru. And though Nibiru had reappeared four hundred years earlier, the arrival of the SAR year—3,600—the completion of one Divine Year— was of unavoidable significance. To those to whom the biblical prophecies of the return of Yahweh’s Kavod to His Temple Mount were unquestioned divine pronouncements, the year we call “160 b.c.e.” was a crucial moment of truth: no matter where the planet was, God has promised to Return to His Temple, and the temple had to be purified and readied for that. That the passage of years according to the Nippurian/Hebrew calendar was not lost sight of in those turbulent times is
274
THE END OF DAYS
attested by the Book of Jubilees, an extrabiblical book presumed to have been written in Hebrew in Jerusalem in the years following the Maccabean revolt (now available only from its Greek, Latin, Syriac, Ethiopic, and Slavonic translations). It retells the history of the Jewish people from the time of the Exodus in time units of Jubilees—the 50-year units decreed by Yahweh at Mount Sinai (see our chapter IX); it also created a consecutive calendrical historical count that has since become known as Annu Mundi—“Year of the World” in Latin—that starts in 3760 b.c.e. Scholars (such as the Rev. R.H. Charles in his English rendition of the book) converted such “Jubilee of years” and their “weeks” to an Anno Mundi count. That such a calendar was not only kept throughout the ancient Near East, but even determined when events were timed to happen, can be ascertained by simply reviewing some pivotal dates (often highlighted in bold font) given in our earlier chapters. If we choose just a few of those key historical events, this is what transpires when the “b.c.e.” is converted to “n.c.” (Nippurian Calendar): b.c.e. 3760
n.c. 0
3460 2860 2360 2160
300 900 1400 1600
2060
1700
1960 1760
1800 2000
1560
2200
EVENT Sumerian civilization. Nipput calender begins The Tower of Babel incident Bull of Heaven killed by Gilgamesh Sargon: Era of Akkad begins First Intermediate Period in Egypt; Era of Ninurta (Gudea builds Temple-of-Fifty) Nabu organizes Marduk’s followers; Abraham to Canaan; War of the Kings Marduk’s Esagil temple in Babylon Hammurabi consolidates Marduk’s supremacy New dynasty (“Middle Kingdom”) in Egypt; new dynastic rule (“Kassite”)
Jerusalem: A Chalice, Vanished 1460
2300
960
2800
860 760
2900 3000
560
3200
460 160
3100 3600
275
begins in Babylon Anshan, Elam, Mitanni emerge against Babylon; Moses in Sinai, the “burning bush” Neo-Assyrian empire launched; Akitu festival renewed in Babylon Ashurnasirpal wears cross symbol Prophecy in Jerusalem begins with Amos Anunnaki gods complete their Departure; Persians challenge Babylon; Cyrus Greece’s golden age; Herodotus in Egypt Maccabees free Jerusalem, Temple rededicated
The impatient reader will hardly wait to fill in the next entries: 60
3700
0
3760
The Romans build the Jupiter temple at Baalbek, occupy Jerusalem Jesus of Nazareth; a.d. count begins
The century and a half that elapsed from the Maccabean freeing of Jerusalem to the events connected with Jesus after he arrived there were some of the most turbulent in the history of the ancient world and of the Jewish People in particular. That crucial period, whose events affect us to this day, began with understandable jubilation. For the first time in centuries the Jews were again complete masters of their holy capital and sacred Temple, free to appoint their own kings and High Priests. Though the fighting at the borders continued, the borders themselves now extended to encompass much of the olden united kingdom of David’s time. The establishment of an independent Jewish state, with Jerusalem as its capital, under the Hashmoneans was a triumphal event in all respects—except one:
276
THE END OF DAYS
The return of Yahweh’s Kavod, expected at the End of Days, did not take place, even though the count of days from abomination time seemed to have been correct. Was the Time of Fulfillment not yet at hand, many wondered; and it became evident that the enigmas of Daniel’s other counts, of “years” and “weeks of years” and of “Time, Times,” and so on had yet to be deciphered. Clues were the prophetic parts in the Book of Daniel that spoke of the rise and fall of future kingdoms after Babylon, Persia, and Egypt—kingdoms cryptically called “of the south,” “of the north,” or a seafaring “Kittim”; and kingdoms that shall split off them, fight each other, “plant tabernacles of palaces between the seas”—all future entities that were also cryptically represented by varied animals (a ram, a goat, a lion and so on) whose offspring, called “horns,” will again split apart and fight each other. Who were those future nations, and what wars were foretold? The Prophet Ezekiel also spoke of great battles to come, between north and south, between an unidentified Gog and an opposing Magog; and people were wondering whether the prophesied kingdoms have already appeared on the scene— Alexander’s Greece, the Seleucids, the Ptolemies. Were these the subject of the prophecies, or was it someone yet to come in the even more distant future? There was theological turmoil: Was the expectation at the Jerusalem Temple of the Kavod as a physical object a correct understanding of prophecies, or was the expected Coming only of a symbolic, of an ephemeral nature, a spiritual Presence? What was required of the people—or was what was destined to happen will happen no matter what? The Jewish leadership split between devout and by-thebook Pharisees and the more liberal Sadducees, who were more internationally minded, recognizing the importance of a Jewish diaspora already spread from Egypt to Anatolia to Mesopotamia. In addition to these two mainstreams, small sects, sometimes organized in their own communities, sprang up; the best known of them are the Essenes (of
Jerusalem: A Chalice, Vanished
277
the Dead Sea Scrolls fame), who secluded themselves at Qumran. In the efforts to decipher the prophecies, a rising new power—Rome—had to be figured in. Having won repeated wars with the Phoenicians and with the Greeks, the Romans controlled the Mediterranean and began to get involved in the affairs of Ptolemian Egypt and the Seleucid Levant (Judea included). Armies followed imperial delegates; by 60 b.c.e., the Romans, under Pompey, occupied Jerusalem. On the way there, like Alexander before him, he detoured to Heliopolis (alias Baalbek) and offered sacrifices to Jupiter; it was followed by the building there, atop the earlier colossal stone blocks, of the Roman empire’s greatest temple to Jupiter (Fig. 123). A commemorative inscription found at the site indicates that the emperor Nero visited the place in a.d. 60, suggesting that the Roman temple was already built by then. The national and religious turmoil of those days found expression in a proliferation of historic-prophetic writings, such as the Book of Jubilees, the Book of Enoch, the Testaments of the Twelve Patriarchs, and the Assumption of Moses (and several others, all collectively known as the Apocrypha and Pseuda-Epigrapha). The common theme in them was a belief that history is cyclical, that all has been foretold, that the End of Days—a time of turmoil and upheaval—will mark not just an end of a historic cycle but also the beginning of a new one, and that the “flipover time” (to use a modern expression) will be manifest by the coming of the “Anointed One”—Mashi’ach in Hebrew (translated Chrystos in Greek, and thus Messiah or Christ in English). The act of anointing a newly invested king with priestly oil was known in the Ancient World, at least from the time of Sargon. It was recognized in the Bible as an act of consecration to God from the earliest times, but its most memorable instance was when the priest Samuel, custodian of the Ark of the Covenant, summoned David, the son of Jesse, and, proclaiming him king by the grace of God,
278
THE END OF DAYS
Figure 123
Took the horn of oil and anointed him in the presence of his brethren; and the Spirit of God came upon David from that day on. I Samuel 16: 13 Studying every prophecy and every prophetic utterance, the devout in Jerusalem found repeated references to David as God’s Anointed, and a divine vow that it will be of “his seed”—by a descendant of the House of David—that his throne shall be established again in Jerusalem “in days that are to come.” It is on the “throne of David” that future kings, who must be of the House of David, shall sit in Jerusalem; and when that shall happen, the kings and princes of the
Jerusalem: A Chalice, Vanished
279
Earth shall flock to Jerusalem for justice, peace, and the word of God. This, God vowed, is “an everlasting promise,” God’s covenant “for all generations.” The universality of this vow is attested to in Isaiah 16: 5 and 22: 22; Jeremiah 17: 25, 23: 5, and 30: 3; Amos 9: 11; Habakkuk 3: 13; Zechariah 12: 8; Psalms 18: 50, 89: 4, 132: 10, 132: 17, and so on. These are strong words, unmistakable in their messianic covenant with the House of David, yet they are also full of explosive facets that virtually dictated the course of events in Jerusalem. Linked to that was the matter of the Prophet Elijah. Elijah, nicknamed the Thisbite after the name of his town in the district of Gile’ad, was a biblical prophet active in the kingdom of Israel (after the split from Judea) in the ninth century b.c.e., during the reign of king Ahab and his Canaanite wife, Queen Jezebel. True to his Hebrew name, Eli-Yahu— “Yahweh is my God”—he was in constant conflict with the priests and “spokesmen” of the Canaanite god Ba’al (“the Lord”), whose worship Jezebel was promoting. After a period of seclusion at a hiding place near the Jordan River, where he was ordained to become “A Man of God,” he was given a “mantle of haircloth” that held magical powers, and was able to perform miracles in the name of God. His first reported miracle (I Kings Chapter 17) was the making of a spoonful of flour and a little cooking oil last a widow as food for the rest of her lifetime. He then resurrected her son, who had died of a virulent illness. During a contest with the prophets of Ba’al on Mount Carmel, he could summon a fire from the sky. His was the only biblical instance of an Israelite revisiting Mount Sinai since the Exodus: when he escaped for his life from the wrath of Jezebel and the priests of Ba’al, an Angel of the Lord sheltered him in a cave on Mount Sinai. Of him the Scriptures said that he did not die because he was taken up to heaven in a whirlwind to be with God. His ascent, as described in great detail in II Kings Chapter 2, was neither a sudden nor an unexpected occurrence; on the contrary, it was a preplanned and prearranged operation whose place and time were communicated to Elijah in advance. The designated place was in the Jordan Valley, on the
280
THE END OF DAYS
eastern side of the river. When it was time to go there, his disciples, headed by one named Elisha, went along. He made a stop at Gilgal (where Yahweh’s miracles were performed for the Israelites under the leadership of Joshua). There he tried to shake off his companions, but they went on to accompany him to Beth-El; though asked to stay put and let Elijah cross the river by himself, they stuck with him unto the last stop, Jericho, all the while asking Elisha whether it was “true that the Lord will take Elijah heavenward today?” At the bank of the Jordan River, Elijah rolled his miracle mantle and struck the waters, parting them, enabling him to cross the river. The other disciples stayed behind, but even then Elisha persisted on being with Elijah, crossing over with him; And as they continued to walk and to talk, there appeared a chariot of fire with horses of fire, and the two were separated. And Elijah went up to heaven, in a whirlwind. And Elisha saw and cried out: “My father! My father! the chariot of Israel and its horsemen!” And he saw it no more. II Kings 2: 11–12 Archaeological excavations at Tell Ghassul (the “Prophet’s Mound”), a site in Jordan that fits the biblical tale’s geography, have uncovered murals that depicted the “whirlwinds” shown in Fig. 103. It is the only site excavated under the auspices of the Vatican. (My search for the finds, which covered archaeological museums in Israel and Jordan and included a visit to the site in Jordan, and ultimately led to the Jesuit-run Pontifical Biblical Institute in Jerusalem—Fig. 124—is described in The Earth Chronicles Expeditions.) Jewish tradition has held that the transfigured Elijah will one day return as a harbinger of final redemption for the people of Israel, a herald of the Messiah. The tradition was already recorded in the fifth century b.c.e. by the Prophet
Jerusalem: A Chalice, Vanished
281
Figure 124 Malachi—the last biblical Prophet—in his final prophecy. Because tradition held that the Mount Sinai cave where the angel took Elijah was where God had revealed himself to Moses, Elijah has been expected to reappear at the start of the Passover festival, when the Exodus is commemorated. To this day the Seder, the ceremonial evening meal when the seven-day Passover holiday begins, requires the placement on the meal table of a wine-filled cup for Elijah, to sip from as he arrives; the door is opened to enable him to enter, and a prescribed hymn is recited, expressing the hope that he will soon herald “the Messiah, son of David.” (As is the case with Christian kids being told that Santa Claus did sneak down the chimney and bring them the gifts they see, so are Jewish kids told that though unseen, Elijah did sneak in and took a tiny sip of wine.) By custom, “Elijah’s Cup” has been embellished to become an artful goblet, a chalice never used for any purpose other than for the Elijah ritual at the Passover meal. The “Last Supper” of Jesus was that tradition-filled Passover meal. Though retaining the semblance of choosing its own high priest and king, Judea became for all intents and purposes a
282
THE END OF DAYS
Roman colony, ruled first from headquarters in Syria, then by local governors. The Roman governor, called Procurator, made sure that the Jews chose as Ethnarch (“Head of the Jewish Council”) to serve as the Temple’s High Priest, and at first also a “King of the Jews” (not “King of Judea” as a country), whomever Rome preferred. From 36 to 4 b.c.e. the king was Herod, descended of Edomite converts to Judaism, who was the choice of two Roman generals (of Cleopatra fame): Mark Anthony and Octavian. Herod left a legacy of monumental structures, including the enhancement of the Temple Mount and the strategic palace-cum-fortress of Masada at the Dead Sea; he also paid heed to the governor’s wishes as a de facto vassal of Rome. It was into a Jerusalem enlarged and magnified by Hashmonean and Herodian constructions, thronged with pilgrims for the Passover holiday, that Jesus of Nazareth arrived—in a.d. 33 (according to the accepted scholarly dating). At that time the Jews were allowed to retain only a religious authority, a council of seventy elders called the Sanhedrin; there was no longer a Jewish king; the land, no longer a Jewish state but a Roman province, was governed by the Procurator Pontius Pilate, ensconced in the Antonia Citadel that adjoined the Temple. Tensions between the Jewish populace and the Roman masters of the land were rising, and resulted in a series of bloody riots in Jerusalem. Pontius Pilate, arriving in Jerusalem in a.d. 26, made matters worse by bringing into the city Roman legionnaires with their pole-mounted signae and coinage, bearing graven images forbidden in the Temple; Jews showing resistance were pitilessly sentenced to crucifixion in such numbers that the place of execution was nicknamed Gulgatha—Place of the Skulls. Jesus had been to Jerusalem before; “His parents went to Jerusalem every year at the feast of Passover, and when he was twelve years old they went up to Jerusalem after the custom of the feast; and when they had fulfilled the days, as they returned, the child Jesus tarried behind in Jerusalem” (Luke 2: 41–43). When Jesus arrived (with his disciples) this time,
Jerusalem: A Chalice, Vanished
283
the situation was certainly not what was expected, not what the biblical prophecies promised. Devout Jews—as Jesus most certainly was—were beholden to the idea of redemption, of salvation by a Messiah, central to which was the special and everlasting bond between God and the House of David. It was clearly and most emphatically expressed in the magnificent Psalm 89 (19–29), in which Yahweh, speaking to His faithful followers in a vision, said: I have exalted one chosen out of the people; I have found David, my servant; With my holy oil have I anointed him . . . He shall call out to me: “Thou art my father, my God, the rock of my salvation!” And I as a Firstborn shall place him, supreme of all the kings on Earth. My compassion for him forever I will keep, My faithfulness I shall not betray; My covenant with him will not be violated, What I have uttered I shall not change . . . I shall make his seed endure forever, his throne [endure] as the Days of Heaven. Was not that reference to the “Days of Heaven” a clue, a linkage between the coming of a Savior and the prophesied End of Days? Was it not the time to see the prophecies come true? And so it was that Jesus of Nazareth, now in Jerusalem with his twelve disciples, determined to take matters into his own hands: if salvation requires an Anointed One of the House of David, he, Jesus, would be the one! His very Hebrew name—Yehu-shuah (“Joshua”)—meant Yahweh’s Savior; and as for the requirement that the Anointed One (“Messiah”) be of the House of David, that he was: the very opening verse of the New Testament, in the Gospel According to St. Matthew, says: “The book of the generations of Jesus Christ, the son of David, the son of
284
THE END OF DAYS
Abraham.” Then, there and elsewhere in the New Testament, the genealogy of Jesus is given through the generations: Fourteen generations from Abraham to David; fourteen generations from David to the Babylonian exile; and fourteen generations from then to Jesus. He was qualified, the Gospels assured one and all. Our sources for what happened next are the gospels and other books of the New Testament. We know that the “eyewitness reports” were in fact written long after the events; we know that the codified version is the result of deliberations at a convocation called by the Roman emperor Constantine three centuries later; we know that “gnostic” manuscripts, like the Nag Hammadi documents or the Gospel of Judas, give different versions that the Church had reason to suppress; we even know—which is an undisputed fact—that at first there was a Jerusalem Church led by the brother of Jesus, aimed exclusively at Jewish followers, that was overtaken, superseded, and eliminated by the Church of Rome that addressed the gentiles. Yet follow we shall the “official” version, for it, by itself, links the Jesus events in Jerusalem to all the previous centuries and millennia, as told heretofore in this book. First, any doubt, if it still exists, that Jesus came to Jerusalem at Passover time and that the “Last Supper” was the Passover Seder meal must be removed. Matthew 26: 2, Mark 14: 1, and Luke 22: 1 quote Jesus saying to his disciples as they arrived in Jerusalem: “Ye know that after two days is the Feast of the Passover”; “After two days was the feast of the Passover, of the unleavened bread”; and “Now the feast of the unleavened bread drew nigh, and it is called the Passover.” The three gospels, in the same chapters, then state that Jesus told his disciples to go to a certain house, where they would be able to celebrate the Passover meal with which the holiday begins. Next to be tackled is the matter of Elijah, the herald of the coming Messiah (Luke 1: 17 even quoted the relevant verses in Malachi). According to the Gospels, the people who heard about the miracles that Jesus performed—miracles that were
Jerusalem: A Chalice, Vanished
285
so similar to those by the prophet Elijah—at first wondered whether Jesus was Elijah reappeared. Not saying no, Jesus challenged his closest disciples: “What say you that I am? And Peter answered and said unto him: Thou art the Anointed One” (Mark 8: 28–29). If so, he was asked, where is Elijah, who had to appear first? And Jesus answered: Yes, of course, but he has already come! And they asked him, saying: Why say the scribes that Elias must first? And he answered and told them: Elias verily cometh first, and restoreth all things . . . But I say unto you That Elias has indeed come. Mark 9: 11,13 This was an audacious statement, the test of which was about to come: for if Elijah has in fact returned to Earth, “is indeed come,” thereby fulfilling the prerequisite for the Messiah’s coming—then he had to show up at the Seder and drink from his cup of wine! As custom and tradition required, the Cup of Elijah, filled with wine, was set on the Seder table of Jesus and his disciples. The ceremonial meal is described in Mark, Chapter 14. Conducting the Seder, Jesus took the unleavened bread (now called Matzoh) and made the blessing, and broke it, and gave pieces of it to his disciples. “And he took the cup, and when he had thanks, he gave it to them, and they all drank of it” (Mark 14: 23). So, without doubt, the Cup of Elijah was there, but Da Vinci chose not to show it. In this The Last Supper painting, which could only be based on the New Testament passages, Jesus is not holding the crucial cup, and nowhere is there a wine cup on the table! Instead there is an inexplicable gap to the right of Jesus (Fig. 125), and the disciple to his right is bending sideways as if to allow someone unseen to come between them:
286
THE END OF DAYS
Figure 125
Was the thoroughly theologically correct Da Vinci implying that an unseen Elijah did come through the open windows, behind Jesus, and took away the cup that was his? Elijah, the painting thereby suggests, did return; the herald preceding the Anointed King of the House of David did arrive. And thus confirmed, when the arrested Jesus was brought before the Roman governor who asked him: “Art thou the king of the Jews? Jesus said unto him: Thou sayest” (Matthew 27: 11). The sentence, to die on the cross, was inevitable. When Jesus raised the cup of wine and made the required blessing, he said to his disciples, according to Mark 14: 24, “This is my blood of the new testament.” IF these were his exact words, he did not mean to say that they were to drink wine turned to blood—a grave transgression of one of the strictest prohibitions of Judaism from the earliest times, “for blood is the soul.” What he said (or meant to say) was that the wine in this cup, the Cup of Elijah, was a testament, a confirmation of his bloodline. And Da Vinci depicted it convinc-
Jerusalem: A Chalice, Vanished
287
ingly by its disappearance, presumably taken away by the visiting Elijah. The vanished cup has been a favorite subject of authors over the centuries. The tales became legends: the Crusaders sought it; Knights Templar found it; it was brought over to Europe . . . the cup became a goblet, a chalice; it was the chalice representing the Royal Blood—Sang Real in French, becoming San Greal, the Holy Grail. Or had it, after all, never left Jerusalem? The continued subjugation and intensified Roman repression of the Jews in Judea led to the outbreak of Rome’s most challenging rebellion; it took Rome’s greatest generals and best legions seven years to defeat little Judea and reach Jerusalem. In a.d. 70, after a prolonged siege and fierce hand-tohand battles, the Romans breached the Temple’s defenses; and the commanding general, Titus, ordered the Temple put to the torch. Though resistance continued elsewhere for another three years, the Jewish Great Revolt was over. The triumphant Romans were so jubilant that they commemorated the victory with a series of coins that announced to the world Judaea Capta—Judea Captured—and erected a victory archway in Rome depicting the looted Temple’s ritual objects (Fig. 126). But during each year of independence, Jewish coins were
Figure 126
288
THE END OF DAYS
Figure 127 struck with the legend “Year One,” “Year Two,” etc., “for the freedom of Zion,” showing fruits of the land as decorative themes. Inexplicably, the coins of years two and three bore the image of a chalice (Fig. 127) . . . Was the “Holy Grail” still in Jerusalem?
16 ARMAGEDDON AND PROPHECIES OF THE RETURN
Will they return? When will they return? These questions have been asked of me countless times, “they” being the Anunnaki gods whose saga has filled my books. The answer to the first question is yes; there are clues that need to be heeded, and the prophecies of the Return need to be fulfilled. The answer to the second question has preoccupied Mankind ever since the watershed events in Jerusalem more than two thousand years ago. But the question is not only “if” and “when.” What will the Return signal, what will it bring with it? Will it be a benevolent coming, or—as when the Deluge was looming— bring about the End? Which prophecies would come true: a Messianic Time, the Second Coming, a new Beginning— or perhaps a catastrophic Apocalypse, the Ultimate End, Armageddon . . . It is the last possibility that shifts these prophecies from the realm of theology, escatology, or mere curiosity to a matter of Mankind’s very survival; for Armageddon, a term that has come to denote a war of unimagined calamitous scope, is in fact the name of a specific place in a land that has been subjected to threats of nuclear annihilation. In the twenty-first century b.c.e., a war of the Kings of the East against the Kings of the West was followed by a nuclear calamity. Twenty-one centuries later, when b.c.e. changed to a.d., Mankind’s fears were expressed in a scroll, hidden in a cave near the Dead Sea, that described a great and final “War of the Sons of Light Against the Sons of Darkness.”
290
THE END OF DAYS
Now again, in the twenty-first century a.d., a nuclear threat hangs over the very same historical place. It is enough reason to ask: Will history repeat itself—does history repeat itself, in some mysterious way, every twenty-one centuries? A war, an annihilating conflagration, has been depicted as part of the End of Days scenario in Ezekiel (chapters 38–39). Though “Gog of the land of Magog,” or “Gog and Magog,” are foreseen as the principal instigators in that final war, the list of combatants that shall be sucked into the battles encompassed virtually every nation of note; and the focus of the conflagration shall be “the dwellers of the Navel of the Earth”—the people of Jerusalem according to the Bible, but the people of “Babylon” as a replacement for Nippur to those for whom the clock stopped there. It is a spine-chilling realization that Ezekiel’s list of those widespread nations (38: 5) that will engage in the final war—Armageddon—actually begins with PERSIA— the very country (today’s Iran) whose leaders seek nuclear weapons with which to “wipe off the face of the Earth” the people who dwell where Har-Megiddo is! Who is that “Gog of the land of Magog,” and why does that prophecy from two and a half millennia ago sound so much like current headlines? Does the accuracy of such details in the Prophecy point to the When—to our time, to our century? Armageddon, a Final War of Gog and Magog, is also an essential element of the End of Days scenario of the New Testament’s prophetic book, Revelation (whose full name is The Apocalypse of St. John the Divine). It compares the instigators of the apocryphal events to two beasts, one of which can “make fire come down from heaven to earth, in sight of men.” Only an enigmatic clue is given for its identity (13: 18): Here is wisdom: Let him that hath understanding count the number of the beast: It is the number of a man;
Armageddon and Prophecies of the Return
291
and his number is six hundred and threescore and six. Many have attempted to decipher the mysterious number 666, assuming it is a coded message pertaining to the End of Days. Because the book was written when the persecution of Christians in Rome began, the accepted interpretation is that the number was a code for the oppressor emperor Nero, the numerical value of whose name in Hebrew (NeRON QeSaR) added up to 666. The fact that he had been to the space platform in Baalbek, possibly to inaugurate the temple to Jupiter there, in the year a.d. 60 may—or may not—have a bearing on the 666 puzzle. That there could be more to 666 than a connection to Nero is suggested by the intriguing fact that 600, 60, and 6 are all basic numbers of the Sumerian sexagesimal system, so that the “code” might hark back to some earlier texts; there were 600 Anunnaki, Anu’s numerical rank was 60, Ishkur/Adad’s rank was 6. Then, if the three numbers are to be multiplied rather than added, we get 666 = 600 × 60 × 6 = 216,000, which is the familiar 2160 (a zodiacal age) times 100—a result that can be speculated on endlessly. Then there is the puzzle that when seven angels reveal the sequence of future events, they do not link them to Rome; they link them to “Babylon.” The conventional explanation has been that, like the 666 was a code for the Roman ruler, so was “Babylon” a code word for Rome. But Babylon was already gone for centuries when Revelation was written, and Revelation, speaking of Babylon, unmistakably links the prophecies to “the great river Euphrates” (9: 14), even describing how “the sixth angel poured out his vial upon the great river Euphrates,” drying it up so that the Kings of the East would be joined in the fighting (16: 12). The talk is of a city/land on the Euphrates, not on the Tiber River. Since Revelation’s prophecies are of the future, one must conclude that “Babylon” is not a code—Babylon means Babylon, a future Babylon that will get involved in the war of “Armageddon” (which verse 16: 16 correctly explains as
292
THE END OF DAYS
the name of “a place in the Hebrew tongue”—Har-Megiddo, Mount Megiddo, in Israel)—a war involving the Holy Land. If that future Babylon is indeed today’s Iraq, the prophetic verses are again chilling, for as they foretell current events leading to the fall of Babylon after a brief but awesome war, they predict the breakup of Babylon/Iraq into three parts! (16: 19). Like the Book of Daniel, which predicted phases of tribulations and trying stages in the messianic process, so has Revelation tried to explain the enigmatic Old Testament prophecies by describing (Chapter 20) a First Messianic Age with “a First Resurrection” lasting a thousand years, followed by a Satanic reign of a thousand years (when “Gog and Magog” will engage in an immense war), and then a second messianic time and another resurrection (and thus the “Second Coming”). Unavoidably, these prophecies triggered a frenzy of speculation as the year a.d. 2000 approached: speculation regarding the Millennium as a point in time, in the history of Mankind and the Earth, when prophecies would come true. Besieged with millennium questions as the year 2000 neared, I told my audiences that nothing will happen in 2000, and not only because the true millennium point counting from the birth of Jesus had already passed, Jesus having been born, by all scholarly calculations, in 6 or 7 b.c.e. The main reason for my opinion was that the prophecies appeared to envision not a linear timeline—year one, year two, year nine hundred, and so on—but a cyclical repetition of events, the fundamental belief that “The First Things shall be the Last Things”—something that can happen only when history and historical time move in a circle, where the start point is the end point, and vice versa. Inherent in this cyclical plan of history is the concept of God as an everlasting divine entity who had been present at the Beginning when Heaven and Earth were created and who will be there at the End of Days, when His kingdom shall be renewed upon His holy mount. It is expressed in repeated statements from the earliest biblical assertions through the
Armageddon and Prophecies of the Return
293
latest Prophets, as when God announced, through Isaiah (41: 4, 44: 6, 48: 12): I am He, I am the First and also the Last I am . . . From the Beginnings the Ending I foretell, and from ancient times the things that are not yet done. Isaiah 48: 12, 46: 10 And equally so (twice) in the New Testament’s Book of Revelation: I am Alpha and Omega, the Beginning and the Ending, sayeth the Lord— Which is, and which was, and which will be. Revelation 1: 8 Indeed, the basis for prophecy was the belief that the End was anchored in the Beginning, that the Future could be predicted because the Past was known—if not to Man, then to God: I am the one “who from the Beginning tells the End,” Yahweh said (Isaiah 46: 10). The Prophet Zechariah (1: 4, 7: 7, 7: 12) foresaw God’s plans for the future—the Last Days— in terms of the Past, the First Days. This belief, which is restated in the Psalms, in Proverbs, and in the Book of Job, was viewed as a universal divine plan for the whole Earth and all its nations. The Prophet Isaiah, envisioning the Earth’s nations gathered to find out what is in store, described them asking each other: “Who among us can tell the future by letting us hear the First Things?” (41: 22). That this was a universal tenet is shown in a collection of Assyrian Prophecies, when the god Nabu told the Assyrian king Esarhaddon: “The future shall be like the past.” This cyclical element of the biblical Prophecies of the Return leads us to one current answer to the question of WHEN.
294
THE END OF DAYS
A cyclical revolving of historical time was found, the reader will recall, in Mesoamerica, resulting from the meshing, like the gears of wheels, of two calendars (see Fig. 67), creating the “bundle” of 52 years, on the occurring of which—after an unspecified number of turns—Quetzalcoatl (alias Thoth/Ningishzidda) promised to return. And that introduces us to the so-called Mayan Prophecies, according to which the End of Days will come about in a.d. 2012. The prospect that the prophesied crucial date is almost at hand has naturally attracted much interest, and merits explaining and analyzing. The claimed date arises from the fact that in that year (depending how one calculates) the time unit called Baktun will complete its thirteenth turn. Since a Baktun lasts 144,000 days, it is some kind of a milestone. Some errors, or fallacious assumptions, in this scenario need to be pointed out. The first is that the Baktun belongs not to the two “meshing” calendars with the 52-year promise (the Haab and the Tzolkin), but to a third and much older calendar called The Long Count. It was introduced by the Olmecs—Africans who had come to Mesoamerica when Thoth was exiled from Egypt—and the count of days actually began with that event, so that Day One of the Long Count was in what we date as August 3113 b.c.e. Glyphs in that calendar represented the following sequence of units: 1 kin 1 Uinal 1 Tun 1 Ka-tun 1 Bak-tun 1 Pictun
= = = = =
1 kin × 20 1 kin × 360 1 tun × 20 1 Ka-tun × 20 1 Bak-tun × 20
= = = = = =
1 day 20 days 360 days 7,200 days 144,000 days 2,880,000 days
These units, each a multiple of the previous one, thus continued beyond the Baktun with ever-increasing glyphs. But since Mayan monuments never reached beyond 12 Baktuns, whose 1,728,000 days were already beyond the Mayan existence, the 13th Baktun appears as a real milestone. Besides, Mayan lore purportedly held that the present “Sun” or Age
Armageddon and Prophecies of the Return
295
would end with the 13th Baktun, so when its number of days (144,000 × 13 = 1,872,000) is divided by 365.25, it results in the passage of 5,125 years; when the b.c.e. 3113 is deducted, the result is the year a.d. 2012. This is an exciting as well as an ominous prediction. But that date has been challenged, already a century ago, by scholars (like Fritz Buck, El Calendario Maya en la Cultura de Tiahuanacu) who pointed out that as the above list indicates, the mutiplier, and thus the divider, should be the calendar’s own mathematically perfect 360 and not 365.25. That way, the 1,872,000 days result in 5,200 years—a perfect result, because it represents exactly 100 “bundles” of Thoth’s magical number 52. Thus calculated, Thoth’s magical year of the Return would be a.d. 2087 (5200 − 3113 = 2087). One could stand even that wait; the only fly in the ointment is that the Long Count is a linear time count, and not the required cyclical one, so that its counted days could roll on to the fourteenth Baktun and the fifteenth Baktun and on and on. All that, however, does not eliminate the significance of a prophetic millennium. Since the source of “millennium” as an escatological time had its origins in Jewish apocryphal writings from the 2nd century b.c.e., the search for meaning must shift in that direction. In fact, the reference to “a thousand”—a millennium—as defining an era had its roots way back in the Old Testament. Deuteronomy (7: 9) assigned to the duration of God’s covenant with Israel a period of “a thousand generations”—an assertion repeated (I Chronicles 16:15) when the Ark of the Covenant was brought to Jerusalem by David. The Psalms repeatedly applied the number “thousand” to Yahweh, his wonders, and even to his chariot (Psalm 68: 17). Directly relevant to the issue of the End of Days and the Return is the statement in Psalm 90: 4—a statement attributed to Moses himself—that said of God that “a thousand years, in thy eyes, are but as one day that has passed.” This statement has given rise to speculation (which started soon after the Roman destruction of the Temple) that it was a way
296
THE END OF DAYS
to figure out the elusive messianic End of Days: if Creation, “The Beginning,” according to Genesis, took God six days, and a divine day lasts a thousand years, the result is a duration of 6,000 years from Beginning to End. The End of Days, it has thus been figured, will come in the Anno Mundi year 6,000. Applied to the Hebrew calendar of Nippur that began in 3760 b.c.e., this means that the End of Days will occur in a.d. 2240 (6000 − 3760 = 2240). This third End of Days calculation may be disappointing or comforting—it depends on one’s expectations. The beauty of this calculation is that it is in perfect harmony with the Sumerian sexagesimal (“base 60”) system. It might even prove in future to be correct, but I don’t think so: it is again linear—and it is a cyclical time unit that is called for by the prophecies. With none of the “modern” predicted dates workable, one must look back at the olden “formulas”—do what had been advised in Isaiah, “look at the signs backwards.” We have two cyclical choices: the Divine Time orbital period of Nibiru, and the Celestial Time of the zodiacal Precession. Which one is it? That the Anunnaki came and went during a “window of opportunity” when Nibiru arrived at Perigee (nearest the Sun, and thus the closest to Earth and Mars) is so obvious that some readers of mine used to simply deduct 3600 from 4000 (as a round date for Anu’s last visit), resulting in 400 b.c.e., or deduct 3,600 from 3760 (when the Nippur calendar began)— as the Maccabbees did—and arrive at 160 b.c.e. Either way, the next arrival of Nibiru is way in the distant future. In fact, as the reader now knows, Nibiru arrived earlier, circa 560 b.c.e. When considering that “digression,” one must keep in mind that the perfect SAR (3600) has always been a mathematical orbital period, because celestial orbits—of planets, comets, asteroids—digress from orbit to orbit due to the gravitational tug of other planets near which they pass. To use the well-tracked Halley’s Comet as an example, its given period of 75 years actually fluctuates from
Armageddon and Prophecies of the Return
297
74 to 76; when it last appeared in 1986, it was 76 years. Extend Halley’s digression to Nibiru’s 3600, and you get a plus/ minus variant of about 50 years each way. There is one other reason for wondering why Nibiru had digressed so much from its wonted SAR: the unusual occurrence of the Deluge circa 10900 b.c.e. During its 120 SARs before the Deluge, Nibiru orbited without causing such a catastrophe. Then something unusual happened that brought Nibiru closer to Earth: combined with the slippage conditions of the ice sheet covering Antarctica, the Deluge occurred. What was that “something unusual”? The answer may well lie farther out in our solar system, where Uranus and Neptune orbit—planets whose many moons include some that, inexplicably, orbit in an “opposite” (“retrograde”) direction—the way Nibiru orbits. One of the great mysteries in our solar system is the fact that the planet Uranus literally lies on its side—its northsouth axis faces the Sun horizontally instead of being vertical to it. “Something” gave Uranus a “big whack” sometime in its past, NASA’s scientists said—without venturing to guess what the “something” was. I have often wondered whether that “something” was also what caused the huge mysterious “chevron” scar and an unexplained “ploughed” feature that NASA’s Voyager 2 found on Uranus’s moon Miranda in 1986 (Fig. 128)—a moon that is different in numerous ways from
Figure 128
298
THE END OF DAYS
the other moons of Uranus. Could a celestial collision with a passing Nibiru and its moons cause all that? In recent years astronomers have ascertained that the outer large planets have not stayed put where they were formed, but have been drifting outward, away from the Sun. The studies concluded that the shift has been most pronounced in the case of Uranus and Neptune (see sketch, Fig. 129), and that can explain why nothing happened out there for many Nibiru orbits—then suddeny something did. It is not implausible to assume that on its “Deluge” orbit Nibiru encountered the drifting Uranus, and one of Nibiru’s moons struck Uranus, tilting it on its side; it could even be that the strike “weapon” was the enigmatic moon Miranda—a moon of Nibiru—striking Uranus and ending up captured to orbit Uranus. Such an occurrence would have affected the orbit of Nibiru, slowing it down to about 3450 Earth-years rather than 3600, and resulting in a post-Diluvial reappearance schedule of circa 7450, circa 4000, and circa 550 b.c.e. If that is what had happeed, it would explain the “early” arrival of Nibiru in 556 b.c.e.—and suggest that its next arrival will be circa a.d. 2900. For those who associate the prophesied cataclysmic events with the return of Nibiru— “Planet X” to some—the time is not at hand.
Figure 129
Armageddon and Prophecies of the Return
299
But any notion that the Anunnaki limited their comings and goings to a single short “window” at the planet’s perigee is, however, incorrect. They could keep coming and going at other times as well. The ancient texts record numerous instances of backand-forth travel by the gods with no indication of a link to the planet’s proximity. There are also a number of tales of Earth-Nibiru travel by Earthlings that omit any assertion of Nibiru seen in the skies (a sight stressed, on the other hand, when Anu visited Earth circa 4000 b.c.e.). In one instance Adapa, a son of Enki by an Earthling woman, who was given Wisdom but not immortality, paid a very short visit to Nibiru, accompanied by the gods Dumuzi and Ningishzidda. Enoch, emulating the Sumerian Enmeduranki, also came and went, twice, in his lifetime on Earth. This was possible in at least two ways, as shown in Fig. 130: one by a spaceship accelerating on Nibiru’s incoming phase (from point A), arriving well ahead of perigee time; the other by decelerating a spacecraft (at point B) during Nibiru’s outbound phase, “falling back” toward the Sun (and thus to Earth and Mars). A short visit to Earth, like the one by Anu, could take place by combining “A” for arrival and “B” for outbound departure; a short visit to Nibiru (as by Adapa) could take place by reversing the procedure—by leaving
Figure 130
300
THE END OF DAYS
Earth to intercept Nibiru at “A” and departing from Nibiru at “B” for the return to earth, and so on. A Return of the Anunnaki at a time other than the planet’s return can thus take place, and for that we are left with the other cyclical time—zodiacal time. I have called it, in When Time Began, Celestial Time, distinct from yet serving as a link between Earthly Time (our planet’s orbital cycle) and Divine Time (the clock of the Anunnaki’s planet). If the expected Return will be of the Anunnaki rather than of their planet, then it behooves us to seek the solution to the enigmas of gods and men through the clock that has linked them—the cyclical zodiac of Celestial Time. It was invented, after all, by the Anunnaki as a way to reconcile the two cycles; their ratio—3600 for Nibiru, 2l60 for a zodiacal Age—was the Golden Ratio of 10:6. It resulted, I have suggested, in the sexagesimal system on which Sumerian mathematics and astronomy were based (6 × 10 × 6 × 10 and so on). Berossus, as we have mentioned, deemed the zodiacal Ages to be turning points in the affairs of gods and men and held that the world periodically undergoes apocalyptic catastrophes, either by water or by fire, whose timing is determined by heavenly phenomena. Like his counterpart Manetho in Egypt, he also divided prehistory and history into divine, semidivine, and postdivine phases, with a grand total of 2,160,000 years of “the duration of this world.” This—wonder of wonders!—is exactly one thousand—a millennium!—zodiacal ages. Scholars studying ancient clay tablets dealing with mathematics and astronomy were astounded to discover that the tablets used the fantastic number l2960000—yes, 12,960,000—as a starting point. They concluded that this could only be related to the zodiacal ages of 2,160, whose multiples result in 12,960 (if 2,160 × 6), or 129,600 (if 2,160 × 60), or 1,296,000 (if multiplied by 600); and—wonder of wonders!—the fantastic number with which these ancient lists begin, 12,960,000, is a multiple of 2,160 by 6,000—as in the divine six days of creation.
Armageddon and Prophecies of the Return
301
That major events, when the affairs of the gods affected the affairs of men, were linked to zodiacal ages has been shown throughout this volume of The Earth Chronicles. As each Age began, something momentous took place: the Age of Taurus signaled the grant of civilization to Mankind. The Age of Aries was ushered in by the nuclear upheaval and ended with the Departure. The Age of Pisces arrived with the destruction of the Temple and the beginning of Christianity. Should one not wonder whether the prophetic End of Days really means End of (zodiacal) Age? Were the “time, times, and a half ” of Daniel simply a terminology referring to zodiacal ages? The possibility was pondered, some three centuries ago, by none other than Sir Isaac Newton. Best known for his formulation of the natural laws governing celestial motions—such as planets orbiting the Sun—his interests also lay in religious thought, and he wrote lengthy treatises about the Bible and biblical prophecies. He considered the celestial motions that he formulated to be “the mechanics of God,” and he strongly believed that the scientific discoveries that began with Galileo and Copernicus and were continued by him were meant to happen when they did. This led him to pay particular attention to the “mathematics of Daniel.” In March 2003 the British Broadcasting Corporation (BBC) startled the scientific and religious establishments with a program on Newton that revealed the existence of a document, handwritten by him on front and back, that calculated the End of Days according to Daniel’s prophecies. Newton wrote his numerical calculations on one side of the sheet, and his analysis of the calculations as seven “propositions” on the paper’s other side. A close examination of the document—a photocopy of which I am privileged to have—reveals that the numbers that he used in the calculations include 216 and 2160 several times—a clue to me to understand what his line of thought was: he was thinking of zodiacal time—to him, that was the Messianic Clock! He summed up his conclusions by writing down a set of three “not before” and a “not later than” timetable for Daniel’s prophetic clues:
302
THE END OF DAYS
• Between 2132 and 2370 according to one clue given to Daniel, • Between 2090 and 2374 according to a second clue, • Between 2060 and 2370 for the crucial “time, times & half time.” “Sir Isaac Newton predicted the world would end in the year 2060,” the BBC announced. Not exactly, perhaps— but as the table of zodiacal ages in an earlier chapter shows, he was not far off the mark in two of his “not earlier than” dates: 2060 and 2090. The original cherished document of the great Englishman is now kept in the Department of Manuscripts and Archives of the Jewish National and University Library—in Jerusalem! A coincidence? It was in my 1990 book Genesis Revisited that the “Phobos Incident”—a hushed-up event—was first publicly revealed. It concerned the loss, in 1989, of a Soviet spacecraft sent to explore Mars and its possibly hollow moonlet called Phobos. In fact, not one but two Soviet spacecraft were lost. Named Phobos 1 and Phobos 2 to indicate their purpose—to probe Mars’ moonlet Phobos—they were launched in 1988, to reach Mars in 1989. Though a Soviet project, it was supported by NASA and European agencies. Phobos 1 just vanished—no details or explanation were ever publicly given. Phobos 2 did make it to Mars, and started to send back photographs taken by two cameras—a regular one and an infrared one. Amazingly or alarmingly, they included pictures of the shadow of a cigar-shaped object flying in the planet’s skies between the Soviet craft and the surface of Mars (Fig. 131 by the two cameras). The Soviet mission chiefs described the object that cast the shadow as “something which some may call a flying saucer.” Immediately, the spacecraft was directed to shift from Mars orbit to approach the moonlet and, from a distance of 50 yards, bombard it with laser beams.
Armageddon and Prophecies of the Return
303
Figure 131
The last picture Phobos 2 sent showed a missile coming at it from the moonlet (Fig. 132). Immediately after that, the spacecraft went into a spin and stopped transmitting—destroyed by the mysterious missile. The “Phobos incident” remains, officially, an “unexplained accident.” In fact, right thereafter, a secret commission on which all the leading space nations were represented sprang into action. The commission and the document it formulated merit more scrutiny than they received, for they hold the key to understanding what the world’s leading nations really know about Nibiru and the Anunnaki. The geopolitical events that resulted in the secret group’s formation began with the discovery, in 1983, of a “Neptunesized planet” by IRAS—NASA’s Infra-Red Astronomical Satellite—which scanned the edges of the solar system not visually but by detecting heat-emitting celestial bodies. The search for a tenth planet was one of its stated objectives, and indeed it found one—determining that it was a planet because, detected once and then again six months later, it was clearly moving in our direction. The news of the discovery
304
THE END OF DAYS
Figure 132 made headlines (Fig. 133) but was retracted the next day as a “misunderstanding.” In fact, the discovery was so shocking that it led to a sudden change in U.S.–Soviet relations, a meeting and an agreement for space cooperation between President Reagan and Chairman Gorbachev, and public statements by the President at the United Nations and other forums that included the following words (pointing heavenwards with his finger as he said them): Just think how easy his task and mine might be in these meetings that we held if suddenly there was a threat to this world from some other species from another planet outside in the universe . . . I occasionally think how quickly our differences would vanish if we were facing an alien threat from outside this world. The Working Committee that was formed as a result of these concerns conducted several meetings and leisurely
Armageddon and Prophecies of the Return
305
Figure 133 consultation—until the March 1989 Phobos incident. Working feverishly, it formulated in April 1989 a set of guidelines known as the Declaration of Principles Concerning Activities Following the Detection of Extraterrestrial Intelligence, by which the procedures to be followed after receiving “a signal or other evidence of extraterrestrial intelligence” were agreed upon. The “signal,” the group revealed, “might not be simply one that indicates its intelligent origin but could be an actual message that may need decoding.” The agreed procedures included undertakings to delay disclosure of the contact for at least twenty-four hours before a response is made. This was surely ridiculous if the message had come from a planet light years away . . . No, the preparations were for a nearby encounter! To me, all these events since 1983, plus all the evidence from Mars briefly described in previous chapters, and the missile shot out from the moonlet Phobos, indicate that the Anunnaki still have a presence—probably a robotic pres-
306
THE END OF DAYS
ence—on Mars, their olden Way Station. That could indicate forethought, a plan to have a facility ready for a future revisit. Put together, it suggests an intent for a Return. To me, the Earth-Mars cylinder seal (see Fig. 113) is both a depiction of the Past and a foretelling of the Future because it bears a date—a date indicated by the sign of two fishes— the Age of Pisces. Does it tell us: What had taken place in a previous Age of Pisces will be repeated again in the Age of Pisces? If the prophecies are to come true, if the First Things shall be the Last Things, if the Past is the Future—the answer has to be Yes. We are still in the Age of Pisces. The Return, the signs say, will happen before the end of our current Age. scientiďŹ c discoveries to retell the history and prehistory of mankind and planet Earth. His trailblazing books have been translated into more than twenty languages; his ďŹ rst one, an oft-quoted classic, celebrates more than thirty years in print. A graduate of the University of London and a journalist and editor in Israel for many years, he now lives and writes in New York.
Visit for exclusive information on your favorite HarperCollins author.
Resounding Praise for
ZECHARIA SITCHIN’s Groundbreaking and Remarkable Bestselling Series
THE EARTH CHRONICLES “Exciting . . . credible . . . provacative and compelling.” Library Journal
“Heavyweight scholarship . . . For thousands of years priests, poets, and scientists have tried to explain how life began . . . Now a recognized scholar has come forth with a theory that is the most astonishing of all.” United Press International
“Brilliant and explosive.” Erich von Daniken, author of Chariots of the Gods “Dazzling . . . Sitchin is a zealous investigator.” Kirkus Reviews
“Sitchin’s research is thorough and well documented . . . In terms of scholarship and research, his books are light years away from those other popular authors.” New York City Tribune
“Intriguing . . . Sitchin is to be congratulated . . . He makes his point, and makes it well.” The British UFO Research Organization
“Imaginative and thought-provoking.” Daily Mirror
“The Earth Chronicles are a must-read.” Borderlands
By Zecharia Sitchin THE EARTH CHRONICLES Book I: The 12th Planet Book II: Stairway to Heaven Book III: The Wars of Gods and Men Book IV: The Lost Realms Book V: When Time Began Book VI: The Cosmic Code COMPANION BOOKS Divine Encounters Genesis Revisited The Lost Book of Enki The Earth Chronicles Expeditions
Copyright THE END OF DAYS. Copyright Š 2007 by Zecharia Sitchin. All rights reserved under International and Pan-American Copyright Conventions. By payment of the required fees, you have been granted the non-exclusive, nontransfer. Adobe Acrobat eBook Reader February 2008 ISBN 978-0-06-163128-3 | https://issuu.com/correiodesucata/docs/the_end_of_days__by_zecharia_sitchi | CC-MAIN-2019-47 | refinedweb | 77,436 | 62.72 |
Why to use Char Array instead of String for storing password in Java – Security
Why we should use Character Array for storing sensitive information(like passwords ) instead of Strings in Java is a very important concept with respect to security of the application and this is also one of the favourite questions of any interviewer in any java interview.
So if we try to figure out the difference between these two
What is the biggest difference between a String and a Character Array in Java??
The biggest difference between the two is the way Garbage Collector(GC) handles each of the object. Since Strings are handled by Java Garbage Collector in a different way than the other traditional objects, it makes String less usable to store sensitive information.
So the main reasons to prefer char[] are-
1) Immutability of Strings
Strings in Java are immutable(i.e. once created we can not change its value) and it also uses the String Pool concept for reusability purpose, hence we are left with no option to clear it from the memory until GC clears it from the memory. Because of this there are great chances that the object created will remain in the memory for a long duration and we can’t even change its value. So anyone having access to the memory dump can easily retrieve the exact password from the memory. For this we can also use the encryption techniques so that if someone access then he will get the encrypted copy of the password.
But with character array you can yourself wipe out the data from the array and there would be no traces of password into the memory.
Read More – What are immutable Strings and what is their benefit.
Have a look at the example and highlighted lines of code.
public class PasswordSecurityExample { public static void main(String[] args) { char[] password = { 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' }; // Changing value of all characters in password for (int i = 0; i < password.length; i++) { password[i] = 'x'; } System.out.print("New Password - "); // Priniting new Password for (int i = 0; i < password.length; i++) { System.out.print(password[i]); } } }
Output:- New Password - xxxxxxxx
In the above example you can see that the array holding the value of Password is changed and now no traces of the actual password exists in the memory. So anyone even with memory dumps can not retrieve the password.
2) Accidental printing to logs
Along with the memory dump protection storing passwords in Strings also prevent accidental logging of password in Text files, consoles, monitors and other insecure places. But in the same scenario char array is not gonna print a value same as when we use
toString() method..
Example:-
public class PasswordSecurityExample { public static void main(String[] args) { String password = "password"; char[] password2; System.out.println("Printing String -> " + password); password2 = password.toCharArray(); System.out.println("Printing Char Array -> " + password2); } }
Output:- Printing String -> password Printing Char Array -> [C@21882d18
3) Recommendation by Java itself
Java itself recommends the use of Char Array instead of Strings. It is clear from the
JPasswordField of
javax.swing as the method
public String getText() which returns String is Deprecated from Java 2 and is replaced by
public char[] getPassword() which returns Char Array.
- JavaGuy
- hiteshgarg21
- hiteshgarg21 | http://www.codingeek.com/java/strings/why-to-use-char-array-instead-of-string-for-storing-password-in-java-security/ | CC-MAIN-2017-04 | refinedweb | 547 | 51.18 |
The aim of this project is to create a QR Code Displayer using the Dot One. QR Codes enables you to share information such as Wi-Fi credentials, URL's, Contact Information or just simple plain text with anyone that has a camera on their phone.
List of items required to create this project:
- Wia Dot One (Buy Yours Here)
- Dot One TFT LCD Screen Module (Buy Yours Here)
- Micro USB Cable (Buy Yours Here)
- Phone
- Computer (Windows and Linux Only)
Step 1:
Create a Wia account with the Dot One connected. If you haven’t done so yet, you can follow this tutorial over here.
Step 2:
Visit this website to generate your QR Code of choice. QR Code Generator. Once Created save the image as a PNG onto the desktop.
Step 3:
Visit this website in order to resize the image to the size of 128 x 128 pixels. It is vital that you perform this step.
Step 4:
Visit this URL and download the program by clicking on the "Downloads" tab and selecting the latest version. Unzip the program and run the 'lcd-image-converter.exe'.
Step 5:
Click on 'File' and then 'Open' and find your resized QR Code.
Step 6:
Click on 'Options' and then 'Conversion'. Change the Preset on the top of the window to 'Monochrome' and click on 'Show Preview'
Step 7:
A new Window Should appear, similar to this below. Copy the right column output and paste it temporarily into notepad or similar text editor.
Step 8:
Insert the TFT LCD module into the dot one making sure of the orientation of the display. Power the Dot one with a micro usb cable.
Step 9:
Go to and select your space. Create a New Code Project by clicking on the 'Code' Icon and clicking on the blue 'Create Code Project'.
Enter a project name of your choice, I will name it "QR Code Display". Make sure you select "Code Project" and click "Create Code Project".
Step 10:
Copy this
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#define TFT_RST -1
#define TFT_CS 16
#define TFT_DC 17
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
const unsigned char qrcode [] PROGMEM = {
//---------------------------------------------------------------
//---------------------------------------------------------------
//INPUT YOUR QR CODE DATA HERE
//---------------------------------------------------------------
//---------------------------------------------------------------
};
void setup() {
WiFi.begin();
delay(2500);
tft.initR(INITR_144GREENTAB);
}
void loop() {
tft.setRotation(1);
tft.fillScreen(ST7735_BLACK);
tft.drawBitmap(0,0,qrcode,128,128,ST7735_WHITE);
delay(10000);
}
STEP 11:
Replace the "//INPUT YOUR QR CODE DATA HERE" with the code that you have saved temporarily onto notepad.
STEP 12:
Click on the rocket icon on the top right corner to upload your code. Select your device from the box below. and click the blue button "Deploy".
STEP 13:
Once succesfully deployed you should see this screen. Proceed by clinking the button to the left of the USB cable to download the code onto your Dot One.
STEP 14:
If done correctly, you should see a QR Code On your LCD Display. | https://community.wia.io/d/82-display-qr-codes-on-your-dot-one | CC-MAIN-2021-10 | refinedweb | 493 | 74.49 |
Let’s see how to rotate image in Pillow Python library.
Rotating the image
For a start we will rotate image 180 degrees.
from PIL import Image my_image = Image.open("C:/Users/pythoneo/Documents/image.jpg") rotated_image = my_image.rotate(180, expand='True') rotated_image.show()
First, I imported Pillow Python library which does the job.
Next, I identified the path when script can access my_image. Remember to use slashes (/) instead of backslashes (\).
Rotate andgle is the first parameter of rotate Pillow function.
The second recommended parameter is expand method. Better to set it to True to fit an image to the window.
See the example when you rotate image by custom angle. The benefit is that corners of your image fit to the window. This is image rotated 80 angles clockwise.
| https://pythoneo.com/how-to-rotate-image-in-pillow/ | CC-MAIN-2022-40 | refinedweb | 130 | 54.49 |
Hello; I'm James McNellis, and I've recently joined the Visual C++ team as a libraries developer. My first encounter with the C++/CX language extensions was early last year, while implementing some code generation features for the Visual Studio 2012 XAML designer. I started off by hunting for some example code, and it suffices to say that I was a bit surprised with what I first saw. My initial reaction was along the lines of:
"What the heck are these hats doing in this C++ code?"
"What the heck are these hats doing in this C++ code?"
Actually, I was quite worried; because I thought it was C++/CLI—managed code. Not that managed code is bad, per se, but I'm a C++ programmer, and I had been promised native code.
Thankfully, my initial impression was uninformed and wrong: while C++/CX is syntactically similar to C++/CLI and thus looks almost the same in many ways, it is semantically quite different. C++/CX code is native code, no CLR required. Programming in C++/CLI can be very challenging, as one must deftly juggle two very different object models at the same time: the C++ object model with its deterministic object lifetimes, and the garbage-collected CLI object model. C++/CX is much simpler to work with, because the Windows Runtime, which is based on COM, maps very well to the C++ programming language.
Windows Runtime defines a relatively simple, low-level Application Binary Interface (ABI), and mandates that components define their types using a common metadata format. C++/CX is not strictly required to write a native Windows Runtime component: it is quite possible to write Windows Runtime components using C++ without using the C++/CX language extensions, and Visual C++ 2012 includes a library, the Windows Runtime C++ Template Library (WRL), to help make this easier. Many of the Windows Runtime components that ship as part of Windows (in the Windows namespace) are written using WRL. There's no magic in C++/CX: it just makes writing Windows Runtime components in C++ much, much simpler and helps to cut the amount of repetitive and verbose code that you would have to write when using a library-based solution like WRL.
Windows
The intent of this series of articles is to discuss the Windows Runtime ABI and to explain what really happens under the hood when you use the C++/CX language constructs, by demonstrating equivalent Windows Runtime components written in C++ both with and without C++/CX, and by showing how the C++ compiler actually transforms C++/CX code for compilation.
There are already quite a few great sources of information about C++/CX, and I certainly don't intend for a simple series of blog articles to replace them, so before we begin digging into C++/CX, I wanted to start with a roundup of those resources.
First, if you're interested in the rationale behind why the C++/CX language extension were developed and how the C++/CLI syntax ended up being selected for reuse, I'd recommend Jim Springfield's post on this blog from last year, "Inside the C++/CX Design". Also of note is episode 3 of GoingNative, in which Marian Luparu discusses C++/CX.
If you're new to C++/CX (or Windows Store app and Windows Runtime component development in general), and are looking for an introduction to building software with C++/CX, or if you're building something using C++/CX and are trying to figure out how to accomplish a particular task, I'd recommend the following resources as starting points:
Visual C++ Language Reference (C++/CX): The language reference includes a lot of useful information, including a C++/CX syntax reference with many short examples demonstrating its use. There's also a useful walkthrough of how to build a Windows Store app using C++/CX and XAML. If you're just starting out, this would be a great place to start.
C++ Metro style app samples: Most of the C++ sample applications and components make use of C++/CX and many demonstrate interoperation with XAML.
Component Extensions for Runtime Platforms: This used to be the documentation for C++/CLI, but it has since been updated to include documentation for C++/CX, with comparisons of what each syntactic feature does in each set of language extensions.
Hilo is an example application, written using C++, C++/CX, and XAML, and is a great resource from which to observe good coding practices—both for modern C++ and for mixing ordinary C++ code with C++/CX.
Building Metro style apps with C++ on MSDN Forums is a great place to ask questions if you are stuck.
Often, the best way to learn about how the compiler handles code is to take a look at what the compiler outputs. For C++/CX, there are two outputs that are useful to look at: the metadata for the component, and the generated C++ transformation of the C++/CX code.
Metadata: As noted above, Windows Runtime requires each component to include metadata containing information about any public types defined by the component and any public or protected members of those types. This metadata is stored in a Windows Metadata (WinMD) file with a .winmd extension. When you build a Windows Runtime component using C++/CX, the WinMD file is generated by the C++ compiler; when you build a component using C++ (without C++/CX), the WinMD file is generated from IDL. WinMD files use the same metadata format as .NET assemblies.
If you want to know what types have been fabricated by the C++ compiler to support your C++/CX code, or how different C++/CX language constructs appear in metadata, it is useful to start by inspecting the generated WinMD file. Because WinMD files use the .NET metadata format, you can use the ildasm tool from the .NET Framework SDK to view the contents of a WinMD file. This tool doesn't do much interpretation of the data, so it can take some getting used to how it presents data, but it's very helpful nonetheless.
Generated Code: When compiling C++/CX code, the Visual C++ compiler transforms most C++/CX constructs into equivalent C++ code. If you're curious about what a particular snippet of C++/CX code really does, it's useful to take a look at this transformation.
There is a top-secret compiler option, /d1ZWtokens, which causes the compiler to print the generated C++ code that it generated from your C++/CX source. (Ok, this compiler option isn't really top secret: Deon Brewis mentioned it in his excellent //BUILD/ 2011 presentation, "Under the covers with C++ for Metro style apps." However, do note that this option is undocumented, and thus it is unsupported and its behavior may change at any time.)
The output is intended for diagnostic purposes only, so you won't be able to just copy and paste the output and expect it to be compilable as-is, but it's good enough to demonstrate how the compiler treats C++/CX code during compilation, and that makes this option invaluable. The output is quite verbose, so it is best to use this option with as small a source file as possible. The output includes any generated headers, including the implicitly included <vccorlib.h>. I find it's often best to use types and members with distinctive names so you can easily search for the parts that correspond to your code.
<vccorlib.h>
There are two other useful compiler options, also mentioned in Deon's presentation, which can be useful if you want to figure out how class hierarchies and virtual function tables (vtables) are laid out. The first is /d1reportAllClassLayout, which will cause the compiler to print out the class and vtable layouts for all classes and functions in the translation unit. The other is /d1reportSingleClassLayoutClyde which will cause the compiler to print out the class and vtable layouts for any class whose name contains "Clyde" (substitute "Clyde" for your own type name). These options are also undocumented and unsupported, and they too should only be used for diagnostic purposes.
In our next article (which will be the first "real" article), we'll introduce a simple C++/CX class and discuss how it maps to the Windows Runtime ABI. The following is a list of all of the articles in this series that have been published so far:
@Alex
> So it is obviously a language extension.
So you obviously have no idea what language extension is.
@atch666:
> portability
Metro apps are not portable to anything other than Windows 8 and Windows RT. So it makes no sense for WinRT to be portable.
@Alex
I see that you also don't (fully) understand what portability means. So there is still lot of learning for you (and for all of us for that matter) but the point is that argument like yours is just silly and naive. What if I wanted to port my application written using Very Slow (VS) to embarcadero XE3? Because that's also is a portability. This is the best example why STANDARDS and CONFORMANCE to thereof is very, very important. If at one point you as a very intelligent and creative dev decided that Very Slow is just weak and doesn't give you a chance to develop your apps the way you'd like it then, if (and only if) your app was written using std language then you can simply say to folks from MS (after few years of begging them first for new features which are implemented by other vendors for years now): Screeeeww youuuu! You didn't listen to me, I just cannot allow anymore to let you (MS)constrain me and my evolution as a developer, I am... and here is the interesting thing... PORTING my business elsewhere. You see? That way you're free, that way you have a choice.
But as the things are for now, by accepting Cx, If at one point you as a very intelligent and creative dev decided that Very Slow is just weak and doesn't give you a chance to develop your apps the way you'd like it then after years of begging MS for new features THEY will tell YOU (not in so many words of course): Screeeww youuu! We have locked you in our home brewed extension boy! You have no choice but stay with us! You are screeeewwed!
Do you see now, why portability and conformance to standards is so important? So you want allow to anybody to enslave you.
Regards
@Alex and change the "want" to "won't" from the last sentence of mine please.
@atch666
> embarcadero XE3
Do you know that C++ Builder forces you to use proprietary language extensions in every kind of GUI applications it supports? That it's standard libraries are written in Delphi? Even worse, it doesn't produce app packages that you could publish on Store. It tries to imitate Windows 8 look and feel with FireMonkey but build still produces exe files that you can run on older OS. And I would not be surprised if they doesn't integrate with Windows 8 features at all.
Your arguments are so childish. Do you argue with your employer/team lead that way when you are forced to use tools you don't like?
@Alex which of my arguments are childish? And as for a workplace - this is different story, you may be sure that many MS employees don't agree with MS's policies yet they won't say anything agains. Guess why. But please answer which arguments of mine are childish and why.
Please watch more closely to what a language extension is. VCL and the likes are a library. That is a fundamental difference. I would love /CX to be implemented as a library and would have no objections whatsoever.
What Qt does is a pre-compile step supported by any build mechanism done by tools(moc and uic) that are opensource and can be built with the same compiler you use for your code. If you want to use them with gcc, intel, vc, clang or anything else you recompile them(takes seconds) and are good to go. Also if you don't want to use their keywords like slots and signals there are macro replacements: Q_SIGNAL, Q_SLOT - still vanilla C++ code. With C++/CX no such luck. Support for it would have to be added to the compiler itself, which in case of compilers like gcc simply won't happen for reasons I think are obvious.).
Why would someone want to? For many reasons. Established workflow not using Visual Studio is first that comes to mind. Not having to pay for IDE or compiler is another.
Alex, we are not Microsoft's employees, we are their CUSTOMERS.
I know I can use C++ without CX, but then I have to work with COM or use libs hiding it. As far as CX goes it IS extension and no matter how much you try you cannot make it to be something else to suit your own argument and/or your agenda. (Or post proof as so far you had only assertions)
And its not like nobody else does language extensions... nor anybody forces you to use CX...
@Krzysztof Kawa
>).
It is worth recalling that in standard C++ it is also impossible as C++ doesn't have standartized ABI; different compilers have different STL implementations thus you cannot just return STL type from library compiled with one compiler and consume it in code built with different compiler or with different version of same compiler (similar limitations apply to exceptions). COM and C++/CX solve these problems.
Nobody stops you from writing wrapper library over WinRT interfaces for mingw if you need one. I don't think that caring about other compilers is something MS should do. And honestly I don't know why one would prefer mingw over msvc.
Intel compiler is source and binary compatible with msvc. CX support will probably come soon.
> Not having to pay for IDE or compiler is another.
There is Visual Studio 2012 Express for Windows 8 which is free for commercial use.
@Alex: different ABIs is a completely different issue. I am able to build a DLL with one compiler, and load it with another. Yes, there are limitations in terms of exceptions and non-POD types and STL types, but it's doable.
But with C++/CX you're just out of luck if you don't stick exactly to VS2012. You can't use VS2010, for example. Why not? Because "hey, it's been a long time since we invented our own proprietary language, I'm getting that itch again" Portability doesn't necessarily mean "runs on Linux". It doesn't necessarily mean "can build with GCC". It also means "Can build with the Microsoft compiler I happen to use today" Or "can build with the Microsoft compiler that's released next year". Or "can be understood by static analysis tools".
Even if I'm a good boy who chooses to use VS2012 to build my C++/CX code, even if I'm willing to sacrifice all the C++11 features and standards-conformance that other compilers offer, even then, I have other tools than just the compiler. I might want to run PVS Studio as my static analysis tool. I might want to run Doxygen over my source code. I might want to have syntax highlighting when viewing code in the web frontend for my source control tool. I might use Qt, which requires MOC to be able to parse the code. And so on, and so on.
> I don't think that caring about other compilers is something MS should do.
No. But caring about their customers is something they should do.
> Intel compiler is source and binary compatible with msvc. CX support will probably come soon.
"Probably". See, that's the question. Will it? Is C++/CX so well-specified that it is **possible** for other compilers to implement it? Has Microsoft committed to such a specification? Will they follow the specification if bugs in their own implementation deviates from it?
If you're right, if it is *possible* for other compilers to implement C++/CX support, then yes, a lot of these complaints will fall away. But I see little evidence for it. When Microsoft came up with AMP, they clearly announced that "we're writing a formal specification so that anyone can implement it. We *want* third parties to implement this". With C++/CX? Not so much.
>It is worth recalling that in standard C++ it is also impossible as C++ doesn't have standartized ABI
So your point is that inventing unportable closed-source extensions is better than pushing for standardization for anyone (including MS itself and its customers)? I strongly disagree.
>Nobody stops you from writing wrapper library over WinRT interfaces for mingw if you need one. I don't think that caring about other compilers is something MS should do. And honestly I don't know why one would prefer mingw over msvc.
MS stops me. I can't write a wrapper without using their compiler, which, as you pointed out yourself - might not be binary compatible with the rest of my project (if not written very carefully). While msvc is generally better compiler for windows in terms of performance or file size it's light years behind when it comes to c++11 implementation completeness and even further behind say clang in terms of debug information and static analysis. So it's a question of your needs at any particular time - binary optimisation or developer effectiveness and productivity or a decent output when you're debugging say complex templates.
"probably" is the key here. I really have my doubts on this one. They tried this once with c++/cli and up to now only the mono project picked it up and it's hardly a widespread or popular solution.
Btw. I never used icc myself, but wikipedia says: "(...) Since then, the compiler has been and remains compatible with GCC 3.2 and later." so I'm confused about what you said about compatibility with msvc? Do you know anything more about this?
> There is Visual Studio 2012 Express for Windows 8 which is free for commercial use.
Express is a no-go in any larger project. Main reason is that it doesn't support plugins so using any tools like Qt add-in or VisualAssistX or integrating with source control systems, custom build flow or bug-trackers is very hard or plain impossible compared to other freeware IDEs.
@grumpy summed up my primary issue with C++/CX, which is that it was introduced in a way that makes it very difficult to keep it contained in a "boundary layer" the way Sutter and other have recommended. Co-opting the ".cpp" file extension is the most egregious example of this. My suggestion for MS would be to designate a different extension for C++/CX (".cx" or ".ccx", perhaps), and then to add a compiler option so that the /CX extensions can be rejected in other files.
I'm back from an Embarcadero XE3 presentation. It doesn't do Metro: Metropolis UI is a Metro-like UI running as a desktop app (like the Zune app). Good about that? It could be deployed in Win XP (if we needed a touch-first UI in XP at all). Bad: it's still a desktop app, forget about selling it through the Store. There's no Express edition, either. Overall impression: mediocre. Disclaimer: I'm an independent developer.
@Diegum
>It doesn't do Metro: Metropolis UI is a Metro-like UI running as a desktop app
First, I can see only positives. What's wrong or what's worse in having desktop app to a Metro app? With desktop you have full power of desktop, with metro as you probably well know you are constrained in so many ways.
Second, What do you mean it doesn't do Metro? What's Metro? AFAIC Metro is a new user interface (widely understood). If so, it is like saying, only microsoft can produce cars, others at best can produce automobiles.
Thirdly, mediocre? fair enough, never claimed that they are fantastic, but isn't Very Slow mediocre too?
Fourthly, the point of not being able to put it into MS store? For decades people were selling their apps without MS store, I believe that they simply don't need it. If your app is good you will sell it without MS store. If your app is bad nothing will help you, not even MS store.
The point is that with XE3 you can have Metropolis application without being constrained in so many ways by Very Slow and CX and as you are probably aware they are going to use fantastic clang compiler which it's on its own selling point to me. | http://blogs.msdn.com/b/vcblog/archive/2012/08/29/cxxcxpart00anintroduction.aspx?PageIndex=3 | CC-MAIN-2014-35 | refinedweb | 3,517 | 61.16 |
This class holds a three dimensional tensor field. More...
#include <SIM_MatrixField.h>
This class holds a three dimensional tensor field.
Definition at line 30 of file SIM_MatrixField.h.
Definition at line 34 of file SIM_MatrixField.h.
Adds a volume primitive version of our field to the given gdp.
Adds a velocity to the given voxel. If this is face, it is divided in two and spread on each of 6 faces. If it is corner, it is divided by 8 and spread along each of 8 corners.
Advects this field by the other given field.
Advects this by the velocity field, storing our min/max interpolants into the min/max fields
True if we have a constant value. Ignores end conditions in determining this. Used as a rough guess that the field is unused.
Definition at line 187 of file SIM_MatrixField.h.
Creates a GDP with us as a Volume Primitive inside it.
Enforces boundary conditions on the array.
Controls the dimensions of where the field is properly defined in the field space.
Definition at line 63 of file SIM_MatrixField.h.
Gets the velocity at the given voxel location, interpolating if we have corner or face velocities.
Calculate the size and divisions according to options such as 2d or equal sized voxels.
Retrieve raw field.
Definition at line 165 of file SIM_MatrixField.h.
Definition at line 166 of file SIM_MatrixField.h.
Definition at line 54 of file SIM_MatrixField.h.
Definition at line 71 of file SIM_MatrixField.h.
Control the number of divisions.
Accesses the relative path to the position data associated with this geometry.
Access the field value given a world space location. This does trilinear interpolation.
Definition at line 114 of file SIM_MatrixField.h.
True if we contain any NANs.
Definition at line 173 of file SIM_MatrixField.h.
Converts an integer index into a worldspace position.
True if we are component wise aligned, the subfields may still not be aligned with respect to each other.
Definition at line 206 of file SIM_MatrixField.h.
Match this field to the given reference field. We will end up with the same size/divisions/twod/uniform, but not the same sampling pattern
Override the setDivisions to rebuild our voxel array on demand.
Reimplemented from SIM_OptionsUser.
Converts a worldspace position into an integer index.
Definition at line 201 of file SIM_MatrixField.h.
Resizes our field keeping our field data. The final size will be an integer number of voxels matching our current voxel size. The final center will be an integer number of voxel offset from our current center. This allows us to do a perfect copy of the data.
Definition at line 64 of file SIM_MatrixField.h.
Adjusts the size/divisions of this field, overriding and twod or uniform voxel settings.
Sets the field to the given field, gaining ownership of it. The new field must already match the field it will replace.
Definition at line 115 of file SIM_MatrixField.h.
Steals the field, replacing this copy with an empty field and Steals the field, replacing this copy with an empty field and returning the old version.
Recomputes total number of voxels to be stored on our options data for ease of reading
Definition at line 256 of file SIM_MatrixField.h. | https://www.sidefx.com/docs/hdk/class_s_i_m___matrix_field.html | CC-MAIN-2022-40 | refinedweb | 538 | 61.02 |
i wrote this program, but somthenig is missing when i input -1 to finish. instead to have straight this :the overall average miles/gallons:.... my average consumption result, the program output this: Enter the miles driven and it follows:the overall average miles/gallons:
itwil be kind, i had two days stugling.
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int miles;
int gallons;
int counter;
int total;
float average;
float consumption;
counter = 0;
total = 0;
printf ("Enter the gallons used, -1 to end :");
scanf("%d", &gallons);
printf("Enter the miles driven :");
scanf("%d", &miles);
while (gallons != -1){
consumption = (float) miles / gallons;
printf("The miles / gallons for this thank was %.2f \n", consumption);
total += consumption;
counter += 1;
printf ("\nEnter the gallons used, -1 to end :");
scanf("%d", &gallons);
printf("Enter the miles driven :");
scanf("%d", &miles);
}
if (counter != 0){
average = (float) total / counter;
printf ("\nthe overall average miles/gallons %.2f \n", average);
}
else{
printf ("\nNo No No ");
}
system("PAUSE");
return 0;
} | http://cboard.cprogramming.com/c-programming/97016-consumption-printable-thread.html | CC-MAIN-2014-52 | refinedweb | 162 | 64.91 |
............
I want to Transfer values from one page to another using Request Object
but when i try store
textBox value into Request object like..
Property or indexer 'System.Web.HttpRequest.this[string]' cannot be assigned to -- it is read only
Hi All,I am trying to check if a control exist on another page, so i have:page1.aspx and page2.aspxIn page1.aspx, i need to check if page2 has an control with id "textboxFindMe", how can i do that? Also notice that page2 is dynamically build, so control "textboxFindMe" only exist in a condition, like certain time of the day.Ideally, i would like to return an object on page2.aspx and use it in page1.aspx. I assumed page2 need to render first, otherwise the control would not be exist to be found in page1.aspxcode will be something like:Page2 _page2 = new Page2();_page2.Render();Control ctrl = _page2.FindControl("textboxFindMe");Any ideas?Many
hi, now if i want to iterate through the object it doesnt seems to work :
var myobject = new{param1 = "value1" , param2 = "value2" }
foreach(var i in myobject){
@i.Value
@i.Key
}
doesnt work , any ideas ?
thank you'm busy writing a webservice. One of the tasks is to able a client over the internet to add a record. This records exists of about 50 databasefields. My best guess is this:
- Create a public class with each field as public string or integer of that class.
- Client dims at his side a variable as new class:
Dim myObj as new MyObjec.MyClass
- he sets al parameters
- He calls webservice.AddRecord(myObj)
- The webservice passes myObj to another project which is my data layer
- The datalayer creates the query and adds the record.
The problem here is to make one class which is available in all projects: client project, webservice project, data layer project. My best guess (as I did it in vb6) is to create a seperate project containing the class. Add a referense from my webservice project en datalayser project to this seperate project. The problem is that the client can't set a reference, so it doesn't know what the class looks like.
I hope this makes sence to you all.
It is not possible to use one project for both the webservice and the data layer. The data layer wil be com-exposed as I need to be able to use it from classic asp.
Please advice me which way to look.
Kind Regards!
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend | http://www.dotnetspark.com/links/5855-public-object-on-aspnet-page.aspx | CC-MAIN-2017-13 | refinedweb | 429 | 74.49 |
On Sat, Apr 24, 2010 at 1:32 AM, P.J. Eby <pje at telecommunity.com> wrote: > > If you don't mind trying a simple test for me, would you patch your > pkg_resources to comment out this loop: > > for pkg in self._get_metadata('namespace_packages.txt'): > if pkg in sys.modules: declare_namespace(pkg) That looks much better. It is roughly half the time (450 ms -> 250 ms). I had a simple test set with a directory containing N empty *.egg-info directory, and the import time was proportional to N, now it does not matter anymore. > This change is not backward compatible with some older packages (from years > ago) that were not declaring their namespace packages correctly, but it has > been announced for some time (with warnings) that such packages will not > work with setuptools 0.7. > > (By the way, in case you're thinking this change would only affect namespace > packages, and you don't have any, what's happening is that the > _get_metadata() call forces a check for the *existence* of > namespace_packages.txt in every .egg-info or .egg/EGG-INFO on your path, > whether the file actually exists or not. In the case of zipped eggs, this > check is just looking in a dictionary; for actual files/directories, this is > a stat call.) Yes, that's exactly what I was seeing in the strace output. Is there a design document or something else decribing how the namespace mechanism works for setuptools ? I would like to support namespace package in my own packaging project, but it is not clear to me what needs to be done on my side of things. David | https://mail.python.org/pipermail/distutils-sig/2010-April/016031.html | CC-MAIN-2016-36 | refinedweb | 273 | 72.36 |
-file
Overview
The ServiceMix File component provides JBI integration to the file system. It can be used to read & write files via URI or to periodically poll directories for new files.
Namespace and xbean.xml
The namespace URI for the servicemix-bean JBI component is. This is an example of an xbean.xml file with a namespace definition with prefix bean.
<beans xmlns: <!-- add file:poller and file:sender definitions here --> </beans>
Endpoint types
The servicemix-file component defines two endpoint type:
file:poller :: Periodically polls a directory for files and sends an exchange for every file
file:sender :: Writes the contents of an exchange to a file | http://servicemix.apache.org/docs/4.5.x/jbi/components/servicemix-file.html | CC-MAIN-2018-05 | refinedweb | 108 | 56.96 |
Software vulnerabilities within containers can create security risks to your Kubernetes environment. This lab will allow you to practice your skills with scanning images using Trivy to determine whether they contain critical vulnerabilities.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Scan the Images with Trivy and Save the Results
Check all of the Pods in the
questionablesoftnamespace. Scan their images with Trivy and save the results for each scan to files in
/home/cloud_user. Give each file the name of the image and the
.logextension (e.g.,
/home/cloud_user/myimage:1.1.0.log).
Note: Trivy is already installed on the control plane node. You do not need to install it yourself.
- Delete Pods with Major Vulnerabilities
Delete any Pods that have high- or critical-severity vulnerabilities in their images. You can delete Pods with
--forceif you wish. | https://acloudguru.com/hands-on-labs/scanning-images-for-vulnerabilities-with-trivy | CC-MAIN-2021-31 | refinedweb | 143 | 56.35 |
UUID::Tiny - Pure Perl UUID Support With Functional Interface
Version 1.041, UUID_NS_DNS, 'caugustin.de'); my $v1_mc_UUID_string = create_uuid_as_string(UUID_V1); my $v3_md5_UUID_string = uuid_to_string($v3_md5_UUID); if ( version_of_uuid($v1_mc_UUID) == 1 ) { ... }; if ( version_of_uuid($v5_sha1_UUID) == 5 ) { ... }; if ( is_uuid_string($v1_mc_UUID_string) ) { ... }; if ( equal_uuids($uuid1, $uuid2) ) { ... }; my $uuid_time = time_of_uuid($v1_mc_UUID); my $uuid_clk_seq = clk_seq_of_uuid($v1_mc_UUID);
UUID::Tiny is a lightweight, low dependency Pure Perl module for UUID creation and testing. This module provides the creation of version 1 time based UUIDs (using random multicast MAC addresses), version 3 MD5 based UUIDs, version 4 random UUIDs, and version 5 SHA-1 based UUIDs.).
UUID::Tiny deliberately uses a minimal functional interface for UUID creation (and conversion/testing), because in this case OO looks like overkill to me and makes the creation and use of UUIDs unnecessarily complicated.
If you need raw performance for UUID creation, or the real MAC address in version 1 UUIDs, or an OO interface, and if you can afford module compilation and installation on the target system, then better look at other CPAN UUID modules like Data::UUID.
This module!
This module should run from Perl 5.8 up and uses mostly standard (5.8 core) modules for its job. No compilation or installation required. These are the modules UUID::Tiny depends on:
Carp Digest::MD5 Perl 5.8 core Digest::SHA Perl 5.10 core (or Digest::SHA1, or Digest::SHA::PurePerl) MIME::Base64 Perl 5.8 core Time::HiRes Perl 5.8 core POSIX Perl 5.8 core
If you are using this module on a Perl prior to 5.10 and you don't have Digest::SHA1 installed, you can use Digest::SHA::PurePerl instead.
After some debate I'm convinced that it is more Perlish (and far easier to write) to use all-lowercase function names - without exceptions. And that it is more polite to export symbols only on demand.
While the 1.0x versions will continue to export the old, "legacy" interface on default, the future standard interface is available using the
:std tag on import from version 1.02 on:
use UUID::Tiny ':std'; my $md5_uuid = create_uuid(UUID_MD5, $str);
In preparation for future version of UUID::Tiny you have to use the
:legacy tag if you want to stay with the version 1.0 interface:
use UUID::Tiny ':legacy'; my $md5_uuid = create_UUID(UUID_V3, $str);
This module provides the NIL UUID (shown with its string representation):
UUID_NIL: '00000000-0000-0000-0000-000000000000'
This module provides the common pre-defined namespace UUIDs (shown with their string representation):
UUID_NS_DNS: '6ba7b810-9dad-11d1-80b4-00c04fd430c8' UUID_NS_URL: '6ba7b811-9dad-11d1-80b4-00c04fd430c8' UUID_NS_OID: '6ba7b812-9dad-11d1-80b4-00c04fd430c8' UUID_NS_X500: '6ba7b814-9dad-11d1-80b4-00c04fd430c8'
This module provides the UUID version numbers as constants:
UUID_V1 UUID_V3 UUID_V4 UUID_V5
With
use UUID::Tiny ':std'; you get additional, "speaking" constants:
UUID_TIME UUID_MD5 UUID_RANDOM UUID_SHA1.
my $v1_mc_UUID = create_UUID(); my $v1_mc_UUID = create_UUID(UUID_V1); my $v3_md5_UUID = create_UUID(UUID_V3, $ns_uuid, $name_or_filehandle); my $v3_md5_UUID = create_UUID(UUID_V3, $name_or_filehandle); my $v4_rand_UUID = create_UUID(UUID_V4); my $v5_sha1_UUID = create_UUID(UUID_V5, $ns_uuid, $name_or_filehandle); my $v5_sha1_UUID = create_UUID(UUID_V5, $name_or_filehandle);
Creates a binary UUID in network byte order (MSB first). For v3 and v5 UUIDs a
SCALAR (normally a string),
GLOB ("classic" file handle) or
IO object (i.e.
IO::File) can be used; files have to be opened for reading.
I found no hint if and how UUIDs should be created from file content. It seems to be undefined, but it is useful - so I would suggest to use UUID_NIL as the namespace UUID, because no "real name" is used; UUID_NIL is used by default if a namespace UUID is missing (only 2 arguments are used). if it is a UUID already.
In addition to the standard UUID string representation and its URN forms (starting with
urn:uuid: or
uuid:), this function accepts 32 digit hex strings, variants with different positions of
- and Base64 encoded UUIDs.
Throws an exception if string can't be interpreted as a UUID.
If you want to make sure probability of collisions and provides a better "randomness" of the resulting UUID compared to MD5. Version 5 is recommended in RFC 4122 if backward compatibility is not an issue.
Using MD5 (version 3) has a better performance. This could be important with creating UUIDs from file content rather than names.
See RFC 4122 () for technical details on UUIDs. Wikipedia gives a more palatable description at.
Christian Augustin,
<mail at caugustin.de>
Some of this code is based on UUID::Generator by ITO Nobuaki <banb@cpan.org>. But that module is announced to be marked as "deprecated" in the future and it is much too complicated for my liking.
So I decided to reduce it to the necessary parts and to re-implement those parts with a functional interface ...:
Kudos to ITO Nobuaki <banb@cpan.org> for his UUID::Generator::PurePerl module! My work is based on his code, and without it I would've been lost with all those incomprehensible RFC texts and C codes ...
Thanks to Jesse Vincent (
). | http://search.cpan.org/~caugustin/UUID-Tiny-1.04/lib/UUID/Tiny.pm | CC-MAIN-2017-30 | refinedweb | 823 | 55.95 |
Using Filters in Code Completion
ReSharper allows you to filter completion suggestions by kind of symbol, access modifiers, etc. You can modify the set of applied filters each time the code completion is invoked and/or choose to keep the state of filters.
By default, ReSharper shows filters bar at the bottom of the completion pou-up. In this bar, you can see the state of filters and click on box is selected, you can optionally modify the default state of filters. Note that these filter state controls are synchronized with the filter bar in the completion pop-up.
Filter modes
Each filter can be enabled in one of two modes: inclusive or exclusive.
Inclusive mode
if a filter is enabled in this mode, the completion list only shows items that match this filter. If there are several filters enabled in this mode, the completion list shows items that match all of these filters.
To enable filters in this mode, left-click on the filter icon.
On the filter bar, filters in this mode are highlighted with the uniform background.
Exclusive mode
if a filter is enabled in this mode, the completion list only shows items that match this filter. If there are several filters enabled in this mode, the completion list shows items that match all of these filters.
To enable filters in this mode, right-click on the filter icon.
On the filter bar, filters in this mode are highlighted with the border.
Shortcuts for completion filters
All completion filters can be toggled with keyboard shortcuts. The table below lists aliases for each action. You can use this aliases to find and assign specific shortcuts in Visual Studio options. ().
Custom filtersReSharper allows you to define custom filters that you can use to exclude items by their assembly, namespace, and other parameters from completion suggestions.
To define a custom completion filter
- Open thepage of ReSharper options.
- Make sure that the Enable Filters check box is ticked.
- Click Add.
- and technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section. | https://www.jetbrains.com/help/resharper/2017.3/Using_Filters_in_Code_Completion.html | CC-MAIN-2017-51 | refinedweb | 360 | 63.59 |
Given a binary tree with parent pointers, find the right sibling of a given node(pointer to the node will be given), if it doesn’t exist return null. Do it in O(1) space and O(n) time?
Examples:
1 / 2 3 / 4 6 5 / 7 9 8 / 10 12 Input : Given above tree with parent pointer and node 10 Output : 12
Idea is to find out first right child of nearest ancestor which is neither the current node nor parent of current node, keep track of level in those while going up. then, iterate through that node first left child, if left is not there then, right child and if level becomes 0, then, this is the next right sibling of the given node.
In above case if given node is 7, we will end up with 6 to find right child which doesn’t have any child.
In this case we need to recursively call for right sibling with the current level, so that we case reach 8.
C++
Java
Python3
# Python3 program to print right sibling
# of a node
# A class to create a new Binary
# Tree Node
class newNode:
def __init__(self, item, parent):
self.data = item
self.left = self.right = None
self.parent = parent
# Method to find right sibling
def findRightSibling(node, level):
if (node == None or node.parent == None):
return None
# GET Parent pointer whose right child is not
# a parent or itself of this node. There might
# be case when parent has no right child, but,
# current node is left child of the parent
# (second condition is for that).
while (node.parent.right == node or
(node.parent.right == None and
node.parent.left == node)):
if (node.parent == None):
return None
node = node.parent
level -= 1
# Move to the required child, where
# right sibling can be present
node = node.parent.right
# find right sibling in the given subtree
# (from current node), when level will be 0
while (level < 0): # Iterate through subtree if (node.left != None): node = node.left elif (node.right != None): node = node.right else: # if no child are there, we cannot # have right sibling in this path break level += 1 if (level == 0): return node # This is the case when we reach 9 node # in the tree, where we need to again # recursively find the right sibling return findRightSibling(node, level) # Driver Code if __name__ == '__main__': root = newNode(1, None) root.left = newNode(2, root) root.right = newNode(3, root) root.left.left = newNode(4, root.left) root.left.right = newNode(6, root.left) root.left.left.left = newNode(7, root.left.left) root.left.left.left.left = newNode(10, root.left.left.left) root.left.right.right = newNode(9, root.left.right) root.right.right = newNode(5, root.right) root.right.right.right = newNode(8, root.right.right) root.right.right.right.right = newNode(12, root.right.right.right) # passing 10 res = findRightSibling(root.left.left.left.left, 0) if (res == None): print("No right sibling") else: print(res.data) # This code is contributed by PranchalK [tabby title="C#"]
Output:
12
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. | https://tutorialspoint.dev/data-structure/binary-tree-data-structure/find-right-sibling-binary-tree-parent-pointers | CC-MAIN-2020-16 | refinedweb | 532 | 75.5 |
RANDOM(3) BSD Programmer's Manual RANDOM(3)
random, srandom, srandomdev, initstate, setstate - better random number generator; routines for changing generators
#include <stdlib.h> long random(void); void srandom(unsigned int seed); void srandomdev(void); char * initstate(unsigned int seed, char *state, size_t n); char * setstate(const char *state); se- quence and initialization arandom gen- erator- state(). Once a state array has been initialized, it may be restarted at a dif- ferent.
If initstate() is called with less than 8 bytes of state information, or if setstate() detects that the state information has been garbled, error messages are printed on the standard error output.
arc4random(3), drand48(3), rand(3), random(4)
The random(), srandom(), initstate(), and setstate() functions conform to X/Open Portability Guide Issue 4.2 ("XPG4.2"). The srandomdev() function is an extension.
These functions appeared in 4.2BSD.
Earl T. Cohen
About 2/3 the speed of rand(3). MirOS BSD #10-current April 19, 1991. | http://www.mirbsd.org/htman/i386/man3/initstate.htm | CC-MAIN-2013-20 | refinedweb | 160 | 55.64 |
Suppose we have a number n; we have to find the nth ugly number. As we know that the ugly numbers are those numbers, whose prime factors are only 2, 3 and 5. So if we want to find 10th ugly number, the output will be 12, as the first few ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 and so on.
To solve this, we will follow these steps:
Let us see the following implementation to get better understanding:
#include using namespace std; class Solution { public: int nthUglyNumber(int n) { vector v(n + 1); if(n == 1){ return 1; } int two = 2, three = 3, five = 5; int twoIdx = 2; int threeIdx = 2; int fiveIdx = 2; for(int i = 2; i <= n; i++){ int curr = min({two, three, five}); v[i] = curr; if(curr == two){ two = v[twoIdx] * 2;; twoIdx++; } if(curr == three){ three = v[threeIdx] * 3; threeIdx++; } if(curr == five){ five = v[fiveIdx] * 5; fiveIdx++; } } return v[n]; } }; main(){ Solution ob; cout << (ob.nthUglyNumber(15)); }
15
24 | https://www.tutorialspoint.com/program-to-find-nth-ugly-number-in-cplusplus | CC-MAIN-2021-25 | refinedweb | 173 | 64.78 |
Plugin to interact with the Tropo Cloud platform
Dependency:
compile "org.grails.plugins:tropo-webapi-grails:0.2.1"
Summary
Installation
grails install tropo-webapi-grails
Description
DescriptionTropo is an Open Source massively scalable developer platform that makes it simple to quickly and easily build phone, SMS and Instant Messaging applications - or applications that handle all three - using the web technologies you already know and Tropo's powerful cloud API.This plugin implements the Tropo WebApi which is a server-side API that allows developers to create with very few lines of code applications that can send and receive SMSs and calls, build instant messaging powered applications, build conferences, transfer calls, record conversations, play and send sound files to other people and many other cool things. Apart from the Tropo WebApi, this plugin also implements the Tropo REST API which is a provisioning API that lets you configure, launch and manage all your Tropo applications.To run your Tropo applications you will need a Tropo powered application server. Voxeo (Tropo authors) offers the Tropo Cloud platform which is totally free for developers and which has very competitive rates for production deployment.
RequiresGrails 1.0.5 or higher.
Includes
- commons-codec-1.3.jar
- ezmorph-1.0.6.jar
- http-builder-0.5.1.jar
- httpclient-4.0.3.jar
- httpcore-4.0.1.jar
- json-lib-2.4-jdk15.jar
- xml-resolver-1.2.jar
InstallationYou can install this plugin by running the following command:
grails install-plugin tropo-webapi-grails
ScreencastBe sure to check out this screencast on how to create your first project with Tropo and Grails:
5 minutes tutorialIn the following sections we will create a sample Grails application that uses Tropo services. It will take you less than 5 minutes.
Creating your Tropo applicationOnce you have the plugin installed you will find that creating voice and SMS powered application becomes incredibly easy. But first of all you need to sign up with Tropo. Once you have registered and signed in you can proceed and create your first application. As we are creating an application that uses the WebApi, you need to click on the plus button and then choose WebApi application like in the picture below:
- Calling a phone number that you have set up
- Calling a skype number
- Sending a SMS
- Sending a message through an IM network
- Using the REST API
- From Grails itself using the TropoService object (effectively it runs a GET request to the REST API)
Creating your ControllerOnce your application is created adding voice support to it is really simple. You do not need any specific artifacts so you can add voice and messaging support to any of your Grails controllers, services or Taglibs. However, you will need to provide some implementation for the Grails controller that you have linked to your application in the previous steps.The Tropo WebApi is based in JSON and defines many different methods. This plugin provides a groovy builder that makes really easy to interact with the Tropo platform. Below you can find an example for our TropoController.groovy:
Note that you can also use a more 'traditional' approach. The following source code is equivalent to the snippet above. Use whatever syntax you feel more comfortable with.
import com.tropo.grails.TropoBuilder;class TropoController { def index = { def tropo = new TropoBuilder() tropo.tropo { say("Hello World. Hello Tropo. We are going to play a song.") say("") hangup() } tropo.render(response) } }
import com.tropo.grails.TropoBuilder;class TropoController { def index = { def tropo = new TropoBuilder() tropo.say("Hello World. Hello Tropo. We are going to play a song.") tropo.say("") tropo.hangup() tropo.render(response) } }
Testing your applicationIf you have created some landline phone numbers you can test your application just by calling those phone numbers. For example, in this tutorial you could call either +44 1259340253 or (407) 680-0744 and you would hear a welcome message and a mp3 song would be played until either the song stops or you hang up. You can also use Skype to call your application:
Source CodeAlthough the plugin is available from Grails SVN, the latest source code for this plugin is hosted at GitHub. You can find it here:
Using Tests as a referenceAt the source code there is several unit tests that show how to use the Groovy builder. Check them out here.
ConfigurationThis plugin does not require specific configuration parameters by default.If you plan to use the REST API then you should provide your Tropo username and password as most of the REST API methods are secured by default. In this case you need to add the following lines to your Config.groovy file providing your Tropo username and password:
tropo.username = "yourtropousername" tropo.password = "yourtropopassword"
Interacting with Tropo REST APITropo REST API allows you to interact with Tropo platform through a REST based service. This API can be used to directly invoke your applications (for example you could provide a phone image link in your webapp GUI that will invoke your application and trigger the Controller that we saw in the 5 minutes tutorial). Another usage for this API is to administer your account. You can use this API to create new applications, create and delete phone numbers, create and delete IM accounts, send signals to your application (like hanging up), etc. In summary, it is an admin and provisioning API.Although you could send the REST requests yourself, this plugin provides a handy Grails service named TropoService that is injected in your applications and that you may use to execute all the different Tropo REST API calls.Here is an example on how simple would be to launch your Tropo application using the TropoService:
As you can see in the code above, some of the TropoService calls will require a token. Each Tropo application has a unique token for handling voice calls and a different token for handling messaging. You can find your application's tokens at your application page in Tropo.com
class TropoController { def tropoService def index = { tropoService.launchSession(token: '72979191d971e344b46a0e4a3485571844250e689bb13548a75f1cce2ce9a53dde82c3fe944479bcb650500e') }
IMPORTANT: Transcription issuesThe interaction with Tropo is based on the interchange of JSON based documents. There is a known bug where Tropo sends transcription POST requests with a Content-Type header set to 'application/x-www-form-urlencoded' which basically will make the JSON coverter to fail with a message pretty similar to "org.codehaus.groovy.grails.web.json.JSONException: Missing value. at character 0 of "If you face this issue the workaround is to disable Grails' automcatic content handling and parse the POST body yourself with the JSON converter. This is actually pretty easy. Here is an example:
import grails.converters.JSONclass TestController { static allowedMethods = [add:'POST'] def index = { } def transcription = { def raw = request.reader.text def json = JSON.parse(raw) render "ok" } }
Examples using the Tropo BuilderAs you could see in the 5 minutes tutorial above, this plugin provides a groovy builder that makes really easy to interact with the Tropo platform. The following examples showcase some of the actions that you could do in your Grails applications.
Saying something to the user
Find more about the 'say' method at the 'say' reference page
def builder = new TropoBuilder() builder.tropo { say('Hello Mr. User') }
Asking a question to the user
Find more about the 'ask' method at the 'ask' reference page
def builder = new TropoBuilder() builder.tropo { ask(name : 'foo', bargein: true, timeout: 30, required: true, choices: '[5 DIGITS]') { say('Please say your account number') } }
Asking a question and redirecting the user to a different controllerSimply asking a question wasn't really a very useful action. Lets ask a question and redirect the user to a new action in our controller:
def builder = new TropoBuilder() builder.tropo { ask(name : 'foo', bargein: true, timeout: 30, required: true) { say('Please say your account number') choices(value: '[5 DIGITS]') } on(event:'continue',next:'/tropo/zipcode') }
Displaying the outcome of your application actionsIn the example above we've seen how we can redirect to a different controller to handle the user's input like for example when entering a number or saying something. How can we get the user input from our controllers?It is really easy. Tropo will send a POST request to our controller containing the result of the action that we have executed. That includes any input from the user:
def zipcode = { def tropoRequest = request.JSON def zipcode = tropoRequest.result.actions.value def builder = new TropoBuilder() builder.tropo { say(value: "Your zipcode is ${zipcode}. Thank you.") hangup() } builder.render(response) }
Creating a conferenceThe conference action allows multiple lines in separate sessions to be conferenced together so that the parties on each line can talk to each other simultaneously.
Find more about the 'conference' method at the 'conference' reference page
def builder = new TropoBuilder() builder.tropo { conference(name: 'foo', id: '1234', mute: false, send_tones: false, exit_tone: '#') { on(event: 'join') { say(value: 'Welcome to the conference') } on(event:'leave') { say(value: 'Someone has left the conference') } } }
Hanging upAs it name says, the hangup action will simply hang up the call.
Find more about the 'hangup' method at the 'hangup' reference page
def builder = new TropoBuilder() builder.hangup()
Recording a callThe record action plays a prompt (audio file or text to speech) then optionally waits for a response from the caller and records it.
Find more about the 'record' method at the 'record' reference page
def builder = new TropoBuilder()builder.record(name: 'foo', url: '', beep: true, sendTones: true, exitTone: '#') { transcription(id: 'bling', url:'mailto:[email protected]', emailFormat: 'encoded') say('Please say your account number') choices(value: '[5 DIGITS]') }
Redirecting a callRedirect is used to deflect the call to a third party SIP address. This function must be called before the call is answered; for active calls, consider using transfer.
Find more about the 'redirect' method at the 'redirect' reference page
def builder = new TropoBuilder() builder.tropo { redirect(to: 'sip:1234', from: '4155551212') }
Rejecting a callThis action rejects the incoming call. For example, an application could inspect the callerID variable to determine if the user is known, then reject the call accordingly.
Find more about the 'reject' method at the 'reject' reference page
def builder = new TropoBuilder() builder.reject()
Starting a recordingAllows your plugin to begin recording the current session. The resulting recording may then be sent via FTP or an HTTP POST/Multipart Form.
Find more about the 'startRecording' method at the 'startRecording' reference page
builder.tropo { startRecording(url:'') }
Stopping some recordingThis stops the recording of the current call after startCallRecording has been called.
Find more about the 'stopRecording' method at the 'stopRecording' reference page
def builder = new TropoBuilder() builder.stopRecording()
Transfering a callThe transfer action will transfer an already answered call to another destination / phone number
Find more about the 'transfer' method at the 'transfer' reference page
builder.tropo { transfer(to: 'tel:+14157044517') { on(event: 'unbounded', next: '/error') choices(value: '[5 DIGITS]') } }
Calling someoneThe call method initiates an outbound call or a text conversation. Note that this verb is only valid when there is no active WebAPI call.
Find more about the 'call' method at the 'call' reference page
builder.call(to: 'foo', from: 'bar', network: 'SMS', channel: 'TEXT', timeout: 10, answerOnMedia: false) { headers(foo: 'foo', bar: 'bar') startRecording(url: '', method: 'POST', format: 'audio/mp3', username: 'jose', password: 'passwd') }
Sending messagesThe message action creates a call, says something and then hangs up, all in one step. This is particularly useful for sending out a quick SMS or IM.
Find more about the 'message' method at the 'message' reference page
def builder = new TropoBuilder()builder.message(to: 'foo', from: 'bar', network: 'SMS', channel: 'TEXT', timeout: 10, answerOnMedia: false) { headers(foo: 'foo', bar: 'bar') startRecording(url: '', method: 'POST', format: 'audio/mp3', username: 'jose', password: 'passwd') say('Please say your account number') }
Event handlingSome actions may respond to different events. You can specify the different events as parameters. Refer to the WebApi reference to get more information.
def builder = new TropoBuilder()def help_stop_choices = '0(0,help,i do not know, agent, operator, assistance, representative, real person, human), 9(9,quit,stop,shut up)' def yes_no_choices = 'true(1,yes,sure,affirmative), false(2,no,no thank you,negative),' + help_stop_choices builder.ask(name: 'donate_to_id', bargein: true, timeout: 10, silenceTimeout: 10, attempts: 4) { say([[event: 'timeout', value: 'Sorry, I did not hear anything.'], [event: 'nomatch:1 nomatch:2 nomatch:3', value: "Sorry, that wasn't a valid answer. You can press or say 1 for 'yes', or 2 for 'no'."], [value: 'You chose organization foobar. Are you ready to donate to them? If you say no, I will tell you a little more about the organization.'], [event: 'nomatch:3', value: 'This is your last attempt.']]) choices(value: yes_no_choices) }
Embedding buildersSometimes you may need to create a builder in one method then run some logic and append extra content to the builder. This plugin lets you append builders within other builders. Here is an example:
def builder1 = new TropoBuilder() builder1.tropo { on(event:'continue',next:'/result.json') } def builder2 = new TropoBuilder() builder2.tropo { ask(name : 'foo', bargein: true, timeout: 30, required: true) { say('Please say your account number') choices(value: '[5 DIGITS]') } append(builder1) }
AuthorMartín Pérez ([email protected])Please report any issues to the guys at Voxeo support. You can also use the Grails User mailing list and/or write up an issue in JIRA at under the Tropo-Webapi-Grails component.
HistoryOctober 4, 2011
- Fixed: public/private mixed warning from STS2.8.0M1 and grails snapshot
- Released version 0.2.1
- Added a new isEmpty method to TropoBuilder
- Bug fixed. Append could only be used at the end of a closure.
- Bug fixed. Recordings use a choices element not exit_tone attribute.
- Added support for the new interdigitTimeout element in WebApi
- Released version 0.2 of the plugin
- Added the possibility to embed builders within other builders
- released version 0.1.2
- Fixed TropoBuilder's toString
- released patched version 0.1.1
- released initial version 0.1 | http://www.grails.org/plugin/tropo-webapi-grails?skipRedirect=true | CC-MAIN-2018-09 | refinedweb | 2,318 | 53.81 |
A base class for Django to allow immutable fields on Models
Easily make all of a django model’s fields immutable after saving. You can customize it to make some fields mutable. You can change when it can be mutable (e.g. whenever the field’s value is nil, or only when a particular ‘lock field’ is false)
History and credits
Very heavily based on Rob Madole’s original code at and Helder Silva’s fork at. Rob’s was ‘inspired by a Google search that didn’t turn up reusable solution for making fields immutable inside of a Django model’.
Pulled across from hg/bitbucket to git/github because less headache as they are more familar to me (Tim)
Installing
One of the following:
Via the ole’ standby:
easy_install django-immutablemodel
Pip:
pip install django-immutablemodel
To install directly from Github:
pip install git+
Hint
You do not need to add anything into Django’s INSTALLED_APPS
What does it do
Allows you to declare a Django model as immutable.
It works as a drop-in replacement for Django’s own Model. This means you can ImmutableModel.
from django.db import models from immutablemodel.models import ImmutableModel CruiseShip(ImmutableModel): name = models.CharField(max_length=50) class Meta: mutable_fields = [] # you can actually leave this out...
Now you can try with all your might, but once you’ve saved it won’t change (within reason, sure this is Python we can do almost anything if we try hard enough)
>>> queen_anne = CruiseShip.objects.create( >>> queen_anne.>> queen_anne.name 'Queen Anne'
You can make it complain
Change the meta section to include immutable_quiet = False and it will raise a ValueError if an attempt is made to change this value
class Meta: mutable_fields = [] # you can actually leave this out... immutable_quiet = False
The error is raised as soon as you try and set the field, not when save() is called.
>>> queen_anne = CruiseShip.objects.create( >>> queen_anne.name = 'King George' ValueError: name is immutable and cannot be changed
If you want you can make ALL immutable fields complain by adding IMMUTABLE_QUIET=False to your settings.py
You can make some fields mutable
List the fields you actually want mutable in “mutable_fields”
CruiseShip(ImmutableModel): name = models.CharField(max_length=50) passengers = models.PositiveIntegerField() class Meta: mutable_fields = ['passengers']
Please note that fields beginning with an underscore are ignored by ImmutableModel - this allows immutable_lock_field to be a @property (ie. they are automatically mutable - thanks to for contributing a patch for this – see)
Reference
Meta
Specify options (in addition to the normal django model’s Meta options) that control how immutable fields are handled when subclassing the ImmutableModel class
mutable_fields
Tell ImmutableModel which fields should be allowed to change. This value must be a tuple or a list and contain the names of the fields as strings.:class Meta: mutable_fields = ['some_transient_data']
Specify multiple fields:class ImmutableMeta: mutable_fields = ['some_transient_data', 'name', 'foreign_key']
immutable_fields
Tell ImmutableModel which fields should not be allowed to change. NB: you can’t specify mutable_fields AND immutable_fields. This value must be a tuple or a list and contain the names of the fields as strings.:class Meta: immutable_fields = ['my_special_id']
Specify multiple fields:class ImmutableMeta: immutable_fields = ['my_special_id', 'name', 'foreign_key']
immutable_quiet
If an attempt is made to change an immutable field, should we quietly prevent it.
Set this value to False to raise a ValueError when an immutable field is changed.:class ImmutableMeta: immutable_quiet = False
immutable_lock_field
This determines when to enforce immutability. By default it is equal to immutable_model.models.PK_FIELD. This means that when the PK_FIELD is full (typically when saved) the model is immutable, but before it is saved it is mutable. Alternatively you can specify a field by name, or you can set it to None, which means that you can’t change immutable fields once they are set (even before saving).
- class ImmutableMeta:
- immutable_lock_field = [‘is_locked’]
settings.py
IMMUTABLE_QUIETSet this to False to make all immutable_fields raise an Exception when attempting to be changed.
Release notes
0.1
Release date: 28-Apr-2010
- Initial release by Rob Madole as django-immutablefield
0.2
- Version by Helder Silva (skandal) on bitbucket adding sign_off field. (not formally released)
0.3
- Version by Tim Diggins (red56) calling it django-immutablemodel and making immutability after save by default
0.3.1 —
- Fixing problem with abstract models
0.3.2 —
- Allowing for full inheritance of immutability options within Meta
0.3.3 —
- Fixing problem where immutable (non undeletable) models with default lock_field couldn’t be deleted after save (because of Django deletion collector needing to change id field)
0.3.4 —
- Making fields starting with _ always mutable (ignored by immutable model)
Download Files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/django-immutablemodel/ | CC-MAIN-2017-34 | refinedweb | 786 | 53.61 |
Name | Synopsis | Description | Return Values | Errors | Usage | See Also | Notes
#include <sys/types.h> #include <sys/mount.h> #include <sys/mntent.h> int mount(const char *spec, const char *dir, int mflag, char *fstype, char *dataptr,int datalen, char *optptr, int optlen);. The mounted file system is inserted into the kernel list of all mounted file systems. This list can be examined through the mounted file system table (see mnttab(4)).
The fstype argument is the file system type name. Standard file system names are defined with the prefix MNTTYPE_ in <sys/mntent.h>. If neither MS_DATA nor MS_OPTIONSTR is set in mflag, then fstype is ignored and the type of the root file system is assumed.
The dataptr argument is 0 if no file system-specific data is to be passed; otherwise it points to an area of size datalen that contains the file system-specific data for this mount and the MS_DATA flag should be set.
If the MS_OPTIONSTR flag is set, then optptr points to a buffer containing the list of options to be used for this mount. The optlen argument specifies the length of the buffer. On completion of the mount() call, the options in effect for the mounted file system are returned in this buffer. If MS_OPTIONSTR is not specified, then the options for this mount will not appear in the mounted file systems table.
If the caller does not have all privileges available in the current zone, the nosuid option is automatically set on the mount point. The restrict option is automatically added for autofs mounts.
If the caller is not in the global zone, the nodevices option is automatically set.
The mflag argument is constructed by a bitwise-inclusive-OR of flags from the following list, defined in <sys/mount.h>.
The dataptr and datalen arguments describe a block of file system-specific binary data at address dataptr of length datalen. This is interpreted by file system-specific code within the operating system and its format depends on the file system type. If a particular file system type does not require this data, dataptr and datalen should both be 0.
Mount a file system globally if the system is configured and booted as part of a cluster (see clinfo(1M)).
Prevent programs that are marked set-user-ID or set-group-ID from executing (see chmod(1)). It also causes open(2) to return ENXIO when attempting to open block or character special files.
The optptr and optlen arguments describe a character buffer at address optptr of size optlen. When calling mount(), the character buffer should contain a null-terminated string of options to be passed to the file system-specific code within the operating system. On a successful return, the file system-specific code will return the list of options recognized. Unrecognized options are ignored. The format of the string is a list of option names separated by commas. Options that have values (rather than binary options such as suid or nosuid), are separated by "=" such as dev=2c4046c. Standard option names are defined in <sys/mntent.h>. Only strings defined in the "C" locale are supported. The maximum length option string that can be passed to or returned from a mount() call is defined by the MAX_MNTOPT_STR constant. The buffer should be long enough to contain more options than were passed in, as the state of any default options that were not passed in the input option string may also be returned in the recognized options list that is returned.
Allow the file system to be mounted over an existing file system mounted on dir, making the underlying file system inaccessible. If a mount is attempted on a pre-existing mount point without setting this flag, the mount will fail.
Mount the file system for reading only. This flag should also be specified for file systems that are incapable of writing (for example, CDROM). Without this flag, writing is permitted according to individual file accessibility.
Remount a read-only file system as read-write.
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
The mount() function.
The dir argument is currently mounted on, is someone's current working directory, or is otherwise busy; or the device associated with spec is currently mounted.
The spec, dir, fstype, dataptr, or optptr argument points outside the allocated address space of the process.
The super block has an invalid magic number, the fstype is invalid, or dir is not an absolute path.
Too many symbolic links were encountered in translating spec or dir.
The length of the path argument exceeds PATH_MAX, or the length of a path component exceeds NAME_MAX while _POSIX_NO_TRUNC is in effect.
None of the named files exists or is a null pathname.
The path argument points to a remote machine and the link to that machine is no longer active.
The file system state in the super-block is not FsOKAY and mflag requests write permission.
The spec argument is not a block special device.
The dir argument is not a directory, or a component of a path prefix is not a directory.
A global mount is attempted (the MS_GLOBAL flag is set in mflag) on a machine which is not booted as a cluster; a local mount is attempted and dir is within a globally mounted file system; or a remount was attempted on a file system that does not support remounting.
The device associated with spec does not exist.
The length of the option string to be returned in the optptr argument exceeds the size of the buffer specified by optlen.
The {PRIV_SYS_MOUNT} privilege is not asserted in the effective set of the calling process.
The spec argument is remote and cannot be mounted.
The spec argument is write protected and mflag requests write permission.
The mount() function can be invoked only by processes with appropriate privileges.
mount(1M), umount(2), mnttab(4)
MS_OPTIONSTR-type option strings should be used.
Some flag bits set file system options that can also be passed in an option string. Options are first set from the option string with the last setting of an option in the string determining the value to be set by the option string. Any options controlled by flags are then applied, overriding any value set by the option string.
Name | Synopsis | Description | Return Values | Errors | Usage | See Also | Notes | http://docs.oracle.com/cd/E19082-01/819-2241/mount-2/index.html | CC-MAIN-2016-44 | refinedweb | 1,070 | 63.9 |
You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.Join group
Join the community to find out what other Atlassian users are discussing, debating and creating.
Dear @Alexey Matveev _Appfire_,
I have a question How do I set the pre-text already present in the custom field in the create screen. My code works best in edit and view screen but I'm unable to find the ID value for the create screen of the same .
As always thank you very much.
Like even if i put something like this in the behavior tab, still nothing happens, would you be able to assist me.
I just tried your code and it worked for me.
You can change the code like this
def apply = getFieldById("customfield_19896")
log.error("apply: " + apply)
if (! apply.getValue()) {
apply.setFormValue("Hi do not replace the revision value kindly update here")
}
Then open the necessary screen and have a look in the logs.
In my case the log looks like this:
/rest/scriptrunner/behaviours/latest/validatorsByPid.json [c.o.j.groovy.user.FieldBehaviours] initForm field ID: customfield_23100, value: null
You see "field ID" is not null, which means that the custom field was found, and the value is null, which means that your if condition will work.
Sure, @Alexey Matveev _Appfire_ but after the using the code, I did have the edit screen not loading for ever, and I needed to refresh the page and edit which is not desirable at all.
Like if i remove the code from the behavior, the edit page loads fine. Is this fixable?
Hmmm. that is strange why the code makes your edit screen freeze. Kindly have a look in the logs and try look for. | https://community.atlassian.com/t5/Adaptavist-questions/Set-text-on-the-create-screen-for-a-custom-field/qaq-p/765816 | CC-MAIN-2021-25 | refinedweb | 297 | 72.76 |
About this document
This document describes features of Nim that are to be considered experimental. Some of these are not covered by the .experimental pragma or --experimental switch because they are already behind a special syntax and one may want to use Nim libraries using these features without using them oneself.
Note: Unless otherwise indicated, these features are not to be removed, but refined and overhauled.
Package level objects
Every Nim module resides in a (nimble) package. An object type can be attached to the package it resides in. If that is done, the type can be referenced from other modules as an incomplete object type. This feature allows to break up recursive type dependencies across module boundaries. Incomplete object types are always passed byref and can only be used in pointer like contexts (var/ref/ptr IncompleteObject) in general since the compiler does not yet know the size of the object. To complete an incomplete object the package pragma has to be used. package implies byref.
As long as a type T is incomplete, neither sizeof(T) nor runtime type information for T is available.
Example:
# module A (in an arbitrary package) type Pack.SomeObject = object ## declare as incomplete object of package 'Pack' Triple = object a, b, c: ref SomeObject ## pointers to incomplete objects are allowed ## Incomplete objects can be used as parameters: proc myproc(x: SomeObject) = discard
# module B (in package "Pack") type SomeObject* {.package.} = object ## Use 'package' to complete the object s, t: string x, y: int.
Automatic dereferencing
Automatic dereferencing is performed for the first argument of a routine call. This feature has to be enabled via {.experimental: "implicitDeref".}:
{.experimental: "implicitDeref".} proc depth(x: NodeObj): int = ... var n: Node new(n) echo n.depth # no need to write n[].depth either
Code reordering
The code reordering feature can implicitly rearrange procedure, template, and macro definitions along with variable declarations and initializations at the top level scope so that, to a large extent, a programmer should not have to worry about ordering definitions correctly or be forced to use forward declarations to preface definitions inside a module.
Example:
{.experimental: "codeReordering".} proc foo(x: int) = bar(x) proc bar(x: int) = echo(x) foo(10)
Variables can also be reordered as well. Variables that are initialized (i.e. variables that have their declaration and assignment combined in a single statement) can have their entire initialization statement reordered. Be wary of what code is executed at the top level:
{.experimental: "codeReordering".} proc a() = echo(foo) var foo = 5 a() # outputs: "5"
It is important to note that reordering only works for symbols at top level scope. Therefore, the following will fail to compile:
{.experimental: "codeReordering".} proc a() = b() proc b() = echo("Hello!") a()
Named argument overloading
Routines with the same type signature can be called differently if a parameter has different names. This does not need an experimental switch, but is an unstable feature.
proc foo(x: int) = echo "Using x: ", x proc foo(y: int) = echo "Using y: ", y foo(x = 2) # Using x: 2 foo(y = 2) # Using y: 2 preceding
Special Operators
dot operators
Note: Dot operators are still experimental and so need to be enabled via {.experimental: "dotOperators".}. passed to an untyped parameter:
a.b # becomes `.`(a, b) a.b(c, d) # becomes `.`(a, b, c, d)
The matched dot operators can be symbols of any callable kind (procs, templates and macros), depending on the desired effect:
template `.`(js: PJsonNode, field: untyped): JSON = js[astToStr)
Call operator
The call operator, (), matches all kinds of unresolved calls and takes precedence over dot operators, however it does not match missing overloads for existing routines. The experimental callOperator switch must be enabled to use this operator.
{.experimental: "callOperator".} template `()`(a: int, b: float): untyped = $(a, b) block: let a = 1.0 let b = 2 doAssert b(a) == `()`(b, a) doAssert a.b == `()`(b, a) block: let a = 1.0 proc b(): int = 2 doAssert not compiles(b(a)) doAssert not compiles(a.b) # `()` not called block: let a = 1.0 proc b(x: float): int = int(x + 1) let c = 3.0 doAssert not compiles(a.b(c)) # gives a type mismatch error same as b(a, c) doAssert (a.b)(c) == `()`(a.b, c)
Not nil annotation
Note: This is an experimental feature. It can be enabled with {.experimental: "notnil".}.
All types for which nil is a valid value can be annotated with the not nil annotation to exclude nil as a valid value:
{.experimental: "notnil".}.
Strict not nil checking
Note: This feature is experimental, you need to enable it with
{.experimental: "strictNotNil".}
or
nim c --experimental:strictNotNil <program>
In the second case it would check builtin and imported modules as well.
It checks the nilability of ref-like types and makes dereferencing safer based on flow typing and not nil annotations.
Its implementation is different than the notnil one: defined under strictNotNil. Keep in mind the difference in option names, be careful with distinguishing them.
We check several kinds of types for nilability:
- ref types
- pointer types
- proc types
- cstrings
nil
The default kind of nilability types is the nilable kind: they can have the value nil. If you have a non-nilable type T, you can use T nil to get a nilable type for it.
not nil
You can annotate a type where nil isn't a valid value with not nil.
type NilableObject = ref object a: int Object = NilableObject not nil Proc = (proc (x, y: int)) proc p(x: Object) = echo x.a # ensured to dereference without an error # compiler catches this: p(nil) # and also this: var x: NilableObject if x.isNil: p(x) else: p(x) # ok
If a type can include nil as a valid value, dereferencing values of the type is checked by the compiler: if a value which might be nil is derefenced, this produces a warning by default, you can turn this into an error using the compiler options --warningAsError:strictNotNil.
If a type is nilable, you should dereference its values only after a isNil or equivalent check.
local turn on/off
You can still turn off nil checking on function/module level by using a {.strictNotNil: off.} pragma. Note: test that/TODO for code/manual.
nilability state
Currently a nilable value can be Safe, MaybeNil or Nil : we use internally Parent and Unreachable but this is an implementation detail(a parent layer has the actual nilability).
- Safe means it shouldn't be nil at that point: e.g. after assignment to a non-nil value or not a.isNil check
- MaybeNil means it might be nil, but it might not be nil: e.g. an argument, a call argument or a value after an if and else.
- Nil means it should be nil at that point; e.g. after an assignment to nil or a .isNil check.
- Unreachable means it shouldn't be possible to access this in this branch: so we do generate a warning as well.
We show an error for each dereference ([], .field, [index] () etc) which is of a tracked expression which is in MaybeNil or Nil state.
type nilability
Types are either nilable or non-nilable. When you pass a param or a default value, we use the type : for nilable types we return MaybeNil and for non-nilable Safe.
TODO: fix the manual here. (This is not great, as default values for non-nilables and nilables are usually actually nil , so we should think a bit more about this section.)
params rules
Param's nilability is detected based on type nilability. We use the type of the argument to detect the nilability.
assignment rules
Let's say we have left = right.
When we assign, we pass the right's nilability to the left's expression. There should be special handling of aliasing and compound expressions which we specify in their sections. (Assignment is a possible alias move or move out).
call args rules
When we call with arguments, we have two cases when we might change the nilability.
callByVar(a)
Here callByVar can re-assign a, so this might change a's nilability, so we change it to MaybeNil. This is also a possible aliasing move out (moving out of a current alias set).
call(a)
Here call can change a field or element of a, so if we have a dependant expression of a : e.g. a.field. Dependats become MaybeNil.
branches rules
Branches are the reason we do nil checking like this: with flow checking. Sources of brancing are if, while, for, and, or, case, try and combinations with return, break, continue and raise
We create a new layer/"scope" for each branch where we map expressions to nilability. This happens when we "fork": usually on the beginning of a construct. When branches "join" we usually unify their expression maps or/and nilabilities.
Merging usually merges maps and alias sets: nilabilities are merged like this:
template union(l: Nilability, r: Nilability): Nilability = ## unify two states if l == r: l else: MaybeNil
Special handling is for .isNil and == nil, also for not, and and or.
not reverses the nilability, and is similar to "forking" : the right expression is checked in the layer resulting from the left one and or is similar to "merging": the right and left expression should be both checked in the original layer.
isNil, == nil make expressions Nil. If there is a not or != nil, they make them Safe. We also reverse the nilability in the opposite branch: e.g. else.
compound expressions: field, index expressions
We want to track also field(dot) and index(bracket) expressions.
We track some of those compound expressions which might be nilable as dependants of their bases: a.field is changed if a is moved (re-assigned), similarly a[index] is dependent on a and a.field.field on a.field.
When we move the base, we update dependants to MaybeNil. Otherwise we usually start with type nilability.
When we call args, we update the nilability of their dependants to MaybeNil as the calls usually can change them. We might need to check for strictFuncs pure funcs and not do that then.
For field expressions a.field, we calculate an integer value based on a hash of the tree and just accept equivalent trees as equivalent expressions.
For item expression a[index], we also calculate an integer value based on a hash of the tree and accept equivalent trees as equivalent expressions: for static values only. For now we support only constant indices: we dont track expression with no-const indices. For those we just report a warning even if they are safe for now: one can use a local variable to workaround. For loops this might be annoying: so one should be able to turn off locally the warning using the {.warning[StrictCheckNotNil]:off}..
For bracket expressions, in the future we might count a[<any>] as the same general expression. This means we should should the index but otherwise handle it the same for assign (maybe "aliasing" all the non-static elements) and differentiate only for static: e.g. a[0] and a[1].
element tracking
When we assign an object construction, we should track the fields as well:
var a = Nilable(field: Nilable()) # a : Safe, a.field: Safe
Usually we just track the result of an expression: probably this should apply for elements in other cases as well. Also related to tracking initialization of expressions/fields.
unstructured control flow rules
Unstructured control flow keywords as return, break, continue, raise mean that we jump from a branch out. This means that if there is code after the finishing of the branch, it would be ran if one hasn't hit the direct parent branch of those: so it is similar to an else. In those cases we should use the reverse nilabilities for the local to the condition expressions. E.g.
for a in c: if not a.isNil: b() break code # here a: Nil , because if not, we would have breaked
aliasing
We support alias detection for local expressions.
We track sets of aliased expressions. We start with all nilable local expressions in separate sets. Assignments and other changes to nilability can move / move out expressions of sets.
move: Moving left to right means we remove left from its current set and unify it with the right's set. This means it stops being aliased with its previous aliases.
var left = b left = right # moving left to right
move out: Moving out left might remove it from the current set and ensure that it's in its own set as a single element. e.g.
var left = b left = nil # moving out
initialization of non nilable and nilable values
TODO
warnings and errors
We show an error for each dereference ([], .field, [index] () etc) which is of a tracked expression which is in MaybeNil or Nil state.
We might also show a history of the transitions and the reasons for them that might change the nilability of the expression.
Concepts type params, you must prefix the type with the explicit type modifier. The named instance of the type, following the concept keyword is also considered to have the explicit modifier std: typedesc[Matrix]): int = M.M template Cols*(M: typedesc[Matrix]): int = M.N template ValueType*(M: typedesc std/[sugar, typetraits] type Functor[A] = concept f type MatchedGenericType = genericHead(typeof(f)) # stdof Equally
Type bound operations
There are 4 operations that are bound to a type:
- Assignment
- Moves
- Destruction
- Deep copying for communication between threads
These operations can be overridden instead of overloaded. This means the implementation is automatically lifted to structured types. For instance if type T has an overridden assignment operator = this operator is also used for assignments of the type seq[T]. Since these operations are bound to a type they have to be bound to a nominal type for reasons of simplicity of implementation: This means an overridden.
Assignments, moves and destruction are specified in the destructors document..
Case statement macros
Macros named case can rewrite case statements for certain types in order to implement pattern matching. The following example implements a simplistic form of pattern matching for tuples, leveraging the existing equality operator for tuples (as provided in system.==):
{.experimental: "caseStmtMacros".} import std/macros macro `case`(n: tuple): untyped = result = newTree(nnkIfStmt) let selector = n[0] for i in 1 ..< n.len: let it = n[i] case it.kind of nnkElse, nnkElifBranch, nnkElifExpr, nnkElseExpr: result.add it of nnkOfBranch: for j in 0..it.len-2: let cond = newCall("==", selector, it[j]) result.add newTree(nnkElifBranch, cond, it[^1]) else: error "custom 'case' for tuple cannot handle this node", it case ("foo", 78) of ("foo", 78): echo "yes" of ("bar", 88): echo "no" else: discard
Currently case statement macros must be enabled explicitly via {.experimental: "caseStmtMacros".}.
case macros are subject to overload resolution. The type of the case statement's selector expression is matched against the type of the first argument of the case macro. Then the complete case statement is passed in place of the argument and the macro is evaluated.
In other words, the macro needs to transform the full case statement but only the statement's selector expression is used to determine which macro to call..
Term rewriting macro are applied recursively, up to a limit. This means that if the result of a term rewriting macro is eligible for another rewriting, the compiler will try to perform it, and so on, until no more optimizations are applicable. To avoid putting the compiler into an infinite loop, there is a hard limit on how many times a single term rewriting macro can be applied. Once this limit has been passed, the term rewriting macro will be ignored.
Another example:
proc somefunc(s: string) = assert s == "variable" proc somefunc(s: string{nkStrLit}) = assert s == "literal" proc somefunc(s: string{nkRStrLit}) = assert s == r"raw" proc somefunc(s: string{nkTripleStrLit}) = assert s == """triple""" proc somefunc(s: static[string]) = assert s == "constant" # Use parameter constraints to provide overloads based on both the input parameter type and form. var variable = "variable" somefunc(variable) const constant = "constant" somefunc(constant) somefunc("literal") somefunc(r"raw") somefunc("""triple""") std std std blockUntilAny to wait on multiple flow variables at the same time:
import std/threadpool, ... # wait until 2 out of 3 servers received the update: proc main = var responses = newSeq[FlowVarBase](3) for i in 0..2: responses[i] = spawn tellServer(Update, "key", "value") var index = blockUntilAny(responses) assert index >= 0 responses.del(index) discard blockUntil std/[strutils, math, threadpool] {.experimental: "parallel".} during semantic analysis to be free of data races. intrins allow potential deadlocks to be detected during semantic analysis. detect potential deadlocks during semantic analysis.()
noRewrite pragma
Term rewriting macros and templates are currently greedy and they will rewrite as long as there is a match. There was no way to ensure some rewrite happens only once, e.g. when rewriting term to same term plus extra content.
noRewrite pragma can actually prevent further rewriting on marked code, e.g. with given example echo("ab") will be rewritten just once:
template pwnEcho{echo(x)}(x: untyped) = {.noRewrite.}: echo("pwned!") echo "ab"
noRewrite pragma can be useful to control term-rewriting macros recursion.
Aliasing restrictions in parameter passing
Note: The aliasing restrictions are currently not enforced by the implementation and need to be fleshed out further.
"Aliasing" here means that the underlying storage locations overlap in memory at runtime. An "output parameter" is a parameter of type var T, an input parameter is any parameter that is not of type var.
- Two output parameters should never be aliased.
- An input and an output parameter should not be aliased.
- An output parameter should never be aliased with a global or thread local variable referenced by the called proc.
- An input parameter should not be aliased with a global or thread local variable updated by the called proc.
One problem with rules 3 and 4 is that they affect specific global or thread local variables, but Nim's effect tracking only tracks "uses no global variable" via .noSideEffect. The rules 3 and 4 can also be approximated by a different rule:
- A global or thread local variable (or a location derived from such a location) can only passed to a parameter of a .noSideEffect proc.
Noalias annotation
Since version 1.4 of the Nim compiler, there is a .noalias annotation for variables and parameters. It is mapped directly to C/C++'s restrict keyword and means that the underlying pointer is pointing to a unique location in memory, no other aliases to this location exist. It is unchecked that this alias restriction is followed, if the restriction is violated, the backend optimizer is free to miscompile the code. This is an unsafe language feature.
Ideally in later versions of the language, the restriction will be enforced at compile time. (Which is also why the name noalias was choosen instead of a more verbose name like unsafeAssumeNoAlias.)
Strict funcs
Since version 1.4 a stricter definition of "side effect" is available. In addition to the existing rule that a side effect is calling a function with side effects the following rule is also enforced:
Any mutation to an object does count as a side effect if that object is reachable via a parameter that is not declared as a var parameter.
For example:
{
The algorithm behind this analysis is described in the view types section.
View types
Note: --experimental:views is more effective with --experimental:strictFuncs.
A view type is a type that is or contains one of the following types:
- lent T (view into T)
- openArray[T] (pair of (pointer to array of T, size))
For example:
type View1 = openArray[byte] View2 = lent string View3 = Table[openArray[char], int]
Exceptions to this rule are types constructed via ptr or proc. For example, the following types are not view types:
type NotView1 = proc (x: openArray[int]) NotView2 = ptr openArray[char] NotView3 = ptr array[4, lent int]
The mutability aspect of a view type is not part of the type but part of the locations it's derived from. More on this later.
A view is a symbol (a let, var, const, etc.) that has a view type.
Since version 1.4 Nim allows view types to be used as local variables. This feature needs to be enabled via {.experimental: "views".}.
A local variable of a view type borrows from the locations and it is statically enforced that the view does not outlive the location it was borrowed from.
For example:
{.experimental: "views".} proc take(a: openArray[int]) = echo a.len proc main(s: seq[int]) = var x: openArray[int] = s # 'x' is a view into 's' # it is checked that 'x' does not outlive 's' and # that 's' is not mutated. for i in 0 .. high(x): echo x[i] take(x) take(x.toOpenArray(0, 1)) # slicing remains possible let y = x # create a view from a view take y # it is checked that 'y' does not outlive 'x' and # that 'x' is not mutated as long as 'y' lives. main(@[11, 22, 33])
A local variable of a view type can borrow from a location derived from a parameter, another local variable, a global const or let symbol or a thread-local var or let.
Let p the proc that is analysed for the correctness of the borrow operation.
Let source be one of:
- A formal parameter of p. Note that this does not cover parameters of inner procs.
- The result symbol of p.
- A local var or let or const of p. Note that this does not cover locals of inner procs.
- A thread-local var or let.
- A global let or const.
- A constant array/seq/object/tuple constructor.
Path expressions
A location derived from source is then defined as a path expression that has source as the owner. A path expression e is defined recursively:
- source itself is a path expression.
- Container access like e[i] is a path expression.
- Tuple access e[0] is a path expression.
- Object field access e.field is a path expression.
- system.toOpenArray(e, ...) is a path expression.
- Pointer dereference e[] is a path expression.
- An address addr e, unsafeAddr e is a path expression.
- A type conversion T(e) is a path expression.
- A cast expression cast[T](e) is a path expression.
- f(e, ...) is a path expression if f's return type is a view type. Because the view can only have been borrowed from e, we then know that owner of f(e, ...) is e.
If a view type is used as a return type, the location must borrow from a location that is derived from the first parameter that is passed to the proc. See for details about how this is done for var T.
A mutable view can borrow from a mutable location, an immutable view can borrow from both a mutable or an immutable location.
If a view borrows from a mutable location, the view can be used to update the location. Otherwise it cannot be used for mutations.
The duration of a borrow is the span of commands beginning from the assignment to the view and ending with the last usage of the view.
For the duration of the borrow operation, no mutations to the borrowed locations may be performed except via the view that borrowed from the location. The borrowed location is said to be sealed during the borrow.
{.experimental: "views".} type Obj = object field: string proc dangerous(s: var seq[Obj]) = let v: lent Obj = s[0] # seal 's' s.setLen 0 # prevented at compile-time because 's' is sealed. echo v.field
The scope of the view does not matter:
proc valid(s: var seq[Obj]) = let v: lent Obj = s[0] # begin of borrow echo v.field # end of borrow s.setLen 0 # valid because 'v' isn't used afterwards
The analysis requires as much precision about mutations as is reasonably obtainable, so it is more effective with the experimental strict funcs feature. In other words --experimental:views works better with --experimental:strictFuncs.
The analysis is currently control flow insensitive:
proc invalid(s: var seq[Obj]) = let v: lent Obj = s[0] if false: s.setLen 0 echo v.field
In this example, the compiler assumes that s.setLen 0 invalidates the borrow operation of v even though a human being can easily see that it will never do that at runtime.
Start of a borrow
A borrow starts with one of the following:
- The assignment of a non-view-type to a view-type.
- The assignment of a location that is derived from a local parameter to a view-type.
End of a borrow
A borrow operation ends with the last usage of the view variable.
Reborrows
A view v can borrow from multiple different locations. However, the borrow is always the full span of v's lifetime and every location that is borrowed from is sealed during v's lifetime.
Algorithm
The following section is an outline of the algorithm that the current implementation uses. The algorithm performs two traversals over the AST of the procedure or global section of code that uses a view variable. No fixpoint iterations are performed, the complexity of the analysis is O(N) where N is the number of nodes of the AST.
The first pass over the AST computes the lifetime of each local variable based on a notion of an "abstract time", in the implementation it's a simple integer that is incremented for every visited node.
In the second pass information about the underlying object "graphs" is computed. Let v be a parameter or a local variable. Let G(v) be the graph that v belongs to. A graph is defined by the set of variables that belong to the graph. Initially for all v: G(v) = {v}. Every variable can only be part of a single graph.
Assignments like a = b "connect" two variables, both variables end up in the same graph {a, b} = G(a) = G(b). Unfortunately, the pattern to look for is much more complex than that and can involve multiple assignment targets and sources:
f(x, y) = g(a, b)
connects x and y to a and b: G(x) = G(y) = G(a) = G(b) = {x, y, a, b}. A type based alias analysis rules out some of these combinations, for example a string value cannot possibly be connected to a seq[int].
A pattern like v[] = value or v.field = value marks G(v) as mutated. After the second pass a set of disjoint graphs was computed.
For strict functions it is then enforced that there is no graph that is both mutated and has an element that is an immutable parameter (that is a parameter that is not of type var T).
For borrow checking a different set of checks is performed. Let v be the view and b the location that is borrowed from.
- The lifetime of v must not exceed b's lifetime. Note: The lifetime of a parameter is the complete proc body.
- If v is used for a mutation, b must be a mutable location too.
- During v's lifetime, G(b) can only be modified by v (and only if v is a mutable view).
- If v is result then b has to be a location derived from the first formal parameter or from a constant location.
- A view cannot be used for a read or a write access before it was assigned to. | https://nim-lang.github.io/Nim/manual_experimental.html | CC-MAIN-2021-39 | refinedweb | 4,600 | 64 |
Making calls to RESTful APIs can seem quite a daunting task, but once you have done it a few times, it really is not as scary as you might think.
I thought this little utility might be helpful for those first getting into making calls to such Web Services. This is my first article on CodeProject, so I thought I would keep it relatively simple and short(ish). It is an article for beginners after all! I say an article for beginners, because there are many out there, of all different skill levels, that seem to be attempting to create Facebook applications and the like and making calls to the provided APIs. Let's hope this helps a little!
Oh, and I welcome comments
Recently, I started a new job that required making calls to RESTful APIs. I found myself often rewriting the GET and POST methods to make calls to the various APIs as each gave a different type of response. After a little refactoring, I created this little utility that handles at least getting the response first for processing in a different class.
The project is built in VS2010, and can be run targeting either .NET 4, or .NET 3.5 with the Parallel Extensions library available from Microsoft.
Some knowledge of HTTP is required to understand the article - especially calls to GET and POST methods.
I have provided a glossary for the many beginners who will be reading this article. The idea is that an upfront, plain-English explanation will help with the understanding of the topics to come.
MessageBox
Form
ShowDialog()
The project exists of only a handful of classes, but revolves around one main one: the HttpHandler. It is the class that sends information to a URL or retrieves information from it.
HttpHandler
The main methods on the HttpHandler are the Get and Post methods which correspond to the HTTP GET and POST methods, respectively. The Get method can optionally take a Dictionary of strings to pass as parameters to the web method, while the Post method must include parameters, as it is generally used to send data, not make a parameterless call to the server.
Get
Dictionary
string
The RequestBuilder class uses the URI and parameters (if any) passed to the Get or Post methods to create an HttpWebRequest object. That object is then used by the HttpHandler to make a call to the remote web server and return the server's response.
RequestBuilder
HttpWebRequest
public class HttpHandler
{
//...
public HttpWebResponse Get(string uri, Dictionary<string, string> parameters)
{
builder = new RequestBuilder();
var request = builder.BuildRequest(uri, parameters);
//Wait for request to return before exiting
return ProcessRequest(request);
}
public void Post(string uri, Dictionary<string, string> parameters)
{
builder = new PostRequestBuilder();
var request = builder.BuildRequest(uri, parameters);
//Wait for request to return before exiting
ProcessRequest(request);
}
}
You may have noticed that there is a slight difference between the Get and Post method bodies. The Get method uses a plain old RequestBuilder, while the Post method uses a PostRequestBuilder. This is because there is an extra step when creating a POST request: writing the parameters to the POST stream. A GET request just utilises the query string portion of a URL to pass its parameters.
PostRequestBuilder
Each of these methods sends a blocking request to a Web Service - a request that waits until a response is returned before completing the method. This is often fine in code that runs locally, but there are many factors one must consider when utilising the unreliable medium that is the internet.
A response could be some time away depending on the web server, the distance to the server, the amount of data expected to be returned, etc. If you have a user sitting at a computer waiting for this to happen, it could get frustrating for them, so the best option is to do the calls asynchronously.
Thankfully, with .NET 4 (and the Parallel Extensions in .NET 3.5, which are a back-port of the functionality in .NET 4), it is really easy to run a method asynchronously using Tasks.
Task
public class HttpHandler
{
//...
public void GetAsync(string uri, Dictionary<string, string> parameters)
{
builder = new RequestBuilder();
var request = builder.BuildRequest(uri, parameters);
//Don't bother waiting - if it is there, it is there
Task.Factory.StartNew(() => ProcessRequest(request));
}
public void PostAsync(string uri, Dictionary<string, string> parameters)
{
builder = new PostRequestBuilder();
var request = builder.BuildRequest(uri, parameters);
//Don't bother waiting - if it is there, it is there
Task.Factory.StartNew(() => ProcessRequest(request));
}
}
The above code does the same thing as the snippet previously, except that the method ProcessRequest is run on a separate thread. The application doesn't wait for the response, it completes the method immediately after telling the Task library to fire off ProcessRequest.
ProcessRequest
There are a few ways to handle the response once the request completes, but they can be tricky. The easiest way to do so is declare an event on the HttpHandler and call it when the response is attained. This way, if another class subscribes to the event, it knows that there is a response to read when the handler is called.
public class HttpHandler
{
//...
public event EventHandler<genericeventargs<httpwebresponse >> RequestCompleted;
private HttpWebResponse ProcessRequest(HttpWebRequest request)
{
try
{
var response = (HttpWebResponse)request.GetResponse();
OnRequestCompleted(response);
return response;
}
catch (Exception ex)
{
var exception = new ApplicationException(String.Format(
"Request failed for Url: {0}", request.RequestUri), ex);
throw exception;
}
}
protected void OnRequestCompleted(HttpWebResponse response)
{
if (null != RequestCompleted)
RequestCompleted(this, new GenericEventArgs<httpwebresponse>(response));
}
}
In the above code, once the variable response is assigned, a call to OnRequestCompleted is made, which notifies any subscribers to the event that a response is ready.
response
OnRequestCompleted
N.B. The code is a little naughty in that it catches a blanket exception, but it is great for a simple, easy-to-read example.
Well, that is the guts of the HttpHandler class. Now you need to know how to use it in your projects.
First, you need to add a reference to the library System.Net.CodeProject from within your project. Right click on 'References' in Solution Explorer:
Then select the Browse tab and navigate to where you have saved the library. You will want to select System.Net.CodeProject.dll.
And now you can use the HttpHandler in code by importing it with the using statement:
using
using System.Net;
Ok, hopefully you have a URL in mind that you want to make requests to, but if not, you can use the following one which is included in the sample project:.
This URL gives you access to all publicly searchable posts on Facebook that are found with the query 'codeproject'. Breaking it down, we see there is the base URL and a query string with two parameters, 'q' and 'type'.
The following code is included in the attached project files, which also includes a simple way to process the HttpWebResponse data, both synchronously and asynchronously using an event handler.
HttpWebResponse
The HttpHandler can be used as follows:
var handler = new HttpHandler
var url = "";
var parameters = new Dictionary<string, string>
{
{"q", "codeproject"}
, {"type", "post"}
}
var response = handler.Get(url, parameters);
Easy as that. Although the response is only an HttpWebResponse at this point, the response stream still needs to be retrieved. From Facebook, the stream contains a JSON object containing all the fun stuff like the posts you asked for. Handling the stream is outside the scope of this article, but feel free to examine the code in the included files.
There is a big fat article here on HttpWebRequests and HttpWebResponses if you need a bit more information on them and how to use them.
As this is a basic article, the asynchronous implementation of the Get and Post methods is also very basic. There is no IAsnycResult returned or anything fancy, just an Event to subscribe to that will notify when the request has completed.
IAsnycResult
Event
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
//Asynchronous request sent
handler.RequestCompleted += HandlerRequestCompleted;
handler.GetAsync(url, parameters);
var
var response = handler.Get(url, parameters)
void
leppie
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Articles/96964/Handling-the-HttpWebRequest | CC-MAIN-2015-06 | refinedweb | 1,384 | 53.92 |
We should probably implement a suite shell service for system hooks in suiterunner. This should probably go into suite/common/shell or suite/shell and base upon the Firefox shell service in as esp. the Windows integration part of this has seen some good work for Vista integration, IIRC. Our old implementation in probably has some additional functionality when it comes to mail stuff or so, we need to port that over as well, of course. This will also get rid of nsWindowsHooks.properties and replace it with a locale file in suite/locales/.../common/ which solves one part of bug 377801
Implementing this bug will mean we don't need to fix bug 364168 (or at least not in the same way).
Created attachment 279523 [details] [diff] [review] Patch, first attempt Ok, here's the work I've done so far. It's not ready for review yet, but if you want you can look at it and point out obviously wrong code ;-). The patch adds a shell service for Windows like FF and TB have one. It also disables the default browser/default mail dialogs and replaces them with a new, generic default client dialog. It's the same dialog in browser and mail, so it is only displayed once per session. But the old dialogs can also be kept if wanted.
Forgot the locale changes in the patch, will be included in the next patch.
Comment on attachment 279523 [details] [diff] [review] Patch, first attempt >Index: mailnews/mapi/mapihook/src/Makefile.in >=================================================================== >-ifndef MOZ_THUNDERBIRD >+ifeq (,$(MOZ_SUITE)$(MOZ_THUNDERBIRD)) > CPPSRCS += nsMapiRegistry.cpp nsMapiRegistryUtils.cpp > endif As already discussed on IRC before, I think it would be better to just kill off nsMapiRegistry* completely, there is no mailnews besides Thunderbird and suite. Same for the places referring to that in msgMapiSupport.cpp
For references, see bug 353906 where Thunderbird adopted shell service - and all those nsMapiRegistry* files have a comment that says "This File is no longer used by Thunderbird. Seamonkey is the only consumer." so we probably should really kick them out with this work. Additionally, bug 353906 comment #44 reads to me as accountUtils.js being shared between SeaMonkey and Thunderbird, so 1) it should contain stuff already to make this work with TB's shell service and 2) make sure you don't break TB with your changes :)
Created attachment 282610 [details] [diff] [review] Shell service only Ok, new patch which only includes the shell service itself. The patch got too big, UI patch and patch for mailnews will follow later. This patch can be reviewed and applied independently of those two other patches.
Comment on attachment 282610 [details] [diff] [review] Shell service only Forgot the browser-prefs.js change in that patch (only needed when the UI uses the shell service), it's just + pref("shell.checkDefaultClient", true);
Did you want to request reviews or such as well?
Comment on attachment 282610 [details] [diff] [review] Shell service only >+ /** >+ * app types we can be registered to handle >+ */ >+ const unsigned short MAIL = 0x0001; >+ const unsigned short NEWS = 0x0002; >+ const unsigned short BROWSER = 0x0004; Odd numbering. Can we have browser first please? Makes it easier to add RSS. >+ * @param aStartupCheck true if this is the check being performed >+ * by the first mail window at startup, >+ * false otherwise. Delete "mail" >+ * @param aApps the application types being tested (Mail, News, Browser) Browser, Mail, News >+ const long BACKGROUND_TILE = 1; >+ const long BACKGROUND_STRETCH = 2; >+ const long BACKGROUND_CENTER = 3; >+ const long BACKGROUND_FILL = 4; What does this last one do? You don't seem to use it anyway. >+ * entire screen. A rgb value, where (r << 16 | g << 8 | b) An RGB value (r << 16 | g << 8 | b) >+static nsresult >+OpenUserKeyForReading(HKEY aStartKey, const nsAString& aKeyName, HKEY* aKey) const nsString& aKeyName >+ if (aStartKey == HKEY_LOCAL_MACHINE) { >+ // prevent infinite recursion on the second pass through here if >+ // ::RegOpenKeyEx fails in the all-users case. >+ return NS_ERROR_NOT_AVAILABLE; >+ } >+ return OpenUserKeyForReading(HKEY_LOCAL_MACHINE, aKeyName, aKey); Eww. I'd just do RegOpenKeyExW(aStartKey) and if that returns not found and the start key isn't HKLM (which it never is, except to support the recursion) then I'd retry with HKLM. >+ case ERROR_ACCESS_DENIED: >+ if (aHKLMOnly || aStartKey == HKEY_CURRENT_USER) >+ return NS_ERROR_FILE_ACCESS_DENIED; >+ // fallback to HKCU immediately on access denied since we won't be able >+ // to create the key. >+ return OpenKeyForWriting(HKEY_CURRENT_USER, aKeyName, aKey, aHKLMOnly); >+ case ERROR_FILE_NOT_FOUND: >+ res = ::RegCreateKeyExW(aStartKey, flatName.get(), 0, NULL, >+ 0, KEY_READ | KEY_WRITE, NULL, aKey, >+ NULL); >+ if (res != ERROR_SUCCESS) { >+ if (aHKLMOnly || aStartKey == HKEY_CURRENT_USER) { >+ // prevent infinite recursion on the second pass through here if >+ // ::RegCreateKey fails in the current user case. >+ return NS_ERROR_FILE_ACCESS_DENIED; >+ } >+ return OpenKeyForWriting(HKEY_CURRENT_USER, aKeyName, aKey, aHKLMOnly); >+ } I've really no idea why this is so badly written... why not just RegCreateKeyExW on HKLM and if it fails and it's not HKLM only then on HKCU? >+// shell\open\command (default) REG_SZ <apppath> -url "%1" -requestPending What does -requestPending do, why isn't it always in the same place, and where's -osint? [Is it possible to register as an HTML document editor?] >+// HKCU\SOFTWARE\Classes\SeaMonkey.Url.news (default) REG_SZ SeaMonkey (News) URL >+// DefaultIcon REG_SZ <apppath>,0 >+// EditFlags REG_DWORD 2 >+// shell\open\command (default) REG_SZ <apppath> -mail "%1" Not -news? >+// The following protocols: >+// news,nntp,snews >+// are mapped like this: >+// >+// HKCU\SOFTWARE\Classes\<protocol>\ (default) REG_SZ SeaMonkey (News) URL >+// EditFlags REG_DWORD 2 >+// URL Protocol REG_SZ >+// DefaultIcon (default) REG_SZ <appath>,0 >+// shell\open\command (default) REG_SZ <appath> -mail "%1" -news again? >+ // File Extension Class - as of 1.8.1.2 the value for VAL_URL_OPEN is also 1.8.1.2? >+ DWORD res = ::RegQueryValueExW(theKey, PromiseFlatString(value).get(), value should already be flat... >+ const nsString &flatName = PromiseFlatString(keyName); keyName is already flat etc. etc.... >+#ifndef MOZ_CAIRO_GFX This is never false. >+ do { >+ i -= bpr; >+ >+ stream->Write(((const char*)bits) + i, bpr, &written); >+ if (written == bpr) { >+ rv = NS_OK; Should set this outside of the loop. >+ int aParameters[2] = { COLOR_BACKGROUND, COLOR_DESKTOP }; Why are we setting the window background colour? >+ classDescription: "Default Suite Cmdline Handler", "Set Default ..."
(In reply to comment #9) > (From update of attachment 282610 [details] [diff] [review]) > >+ /** > >+ *... Now I'm going to dive in with some other comments from the build aspects (I realise you may have got some of these from other apps/my original patch, but I've learnt since then ;-) ) Index: suite/Makefile.in +ifeq ($(OS_ARCH),WINNT) +DIRS += shell +endif To make it easier to dev other platforms, could all OS enter the shell directory please. To enter the public directory would also be fine, you'd just have to do a global ifdef on the src directory. I'm very surprised there are no changes to suite/build/Makefile.in in this patch - I'd have expected to see the header includes and a library option change as well. Index: suite/build/nsSuiteModule.cpp +#ifdef XP_WIN +#include "nsWindowsShellService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsShellService, Init) +#endif It would be nice to include this stuff in the #if defined(XP_WIN) sections that are already in that file... Index: suite/installer/windows/packages You'll need to add nsSetDefault.js to this file as well. Index: suite/shell/src/Makefile.in +REQUIRES = \ do we really need that lot of dependencies? Its fine if we do, it just seems rather large. +MODULE = shellservice ... +ifdef CPPSRCS +LIBRARY_NAME = shellservice_s +endif ... +FORCE_STATIC_LIB=1 I'd prefer it if these were all at the start of the file (makes it easier to work out what's happening). Though not sure if that's sensible with LIBRARY_NAME at the moment - but it may be if you put the ifdef for WINNT around the whole lot (but between the .mk files) as I mentioned above. +ifeq ($(OS_ARCH),WINNT) +ifeq (,$(filter-out windows,$(MOZ_WIDGET_TOOLKIT))) These seem a little inconsistent.
(In reply to comment #10) >(In reply to comment #9) >>(From update of attachment 282610 [details] [diff] [review] [details]) >>>+ /** >>>+ *... In case it wasn't clear, it was the ordering, not the values, that I disliked. >>+ifeq ($(OS_ARCH),WINNT) > >>+ifeq (,$(filter-out windows,$(MOZ_WIDGET_TOOLKIT))) > >These seem a little inconsistent. Yes, I'd go with OS_ARCH tests for Windows.
Created attachment 303922 [details] [diff] [review] Shell service only #2
Created attachment 303932 [details] [diff] [review] Shell service only #2
Comment on attachment 303932 [details] [diff] [review] Shell service only #2 All review comments should be fixed with this patch. requestPending is for DDE stuff, see
Comment on attachment 303932 [details] [diff] [review] Shell service only #2 >+ /** >+ * Used to determine whether or not to show a "Set Default Client" >+ * query dialog. This attribute is true if the application is starting >+ * up and "shell.checkDefaultClient" is true, otherwise it >+ * is false. >+ */ >+ attribute boolean shouldCheckDefaultClient; We don't actually use this yet do we? >+OS_LIBS += $(call EXPAND_LIBNAME,ole32 version uuid) >+OS_LIBS += shell32.lib version.lib Inconsistent. Find out from ted/bsmedberg which one is right? >+ virtual ~nsWindowsShellService() {}; Shouldn't need to be virtual. >+ const nsString &flatName = PromiseFlatString(aKeyName); aKeyName is already flat. >+ DWORD res = ::RegOpenKeyExW(aStartKey, flatName.get(), 0, KEY_READ, aKey); >+ >+ switch (res) { >+ case ERROR_SUCCESS: >+ break; >+ case ERROR_ACCESS_DENIED: >+ return NS_ERROR_FILE_ACCESS_DENIED; >+ case ERROR_FILE_NOT_FOUND: >+ if (aStartKey != HKEY_LOCAL_MACHINE) { >+ // retry with HKEY_LOCAL_MACHINE >+ return OpenUserKeyForReading(HKEY_LOCAL_MACHINE, aKeyName, aKey); I still don't like this "recursion". if (res == ERROR_FILE_NOT_FOUND && aStartKey != HKEY_LOCAL_MACHINE) res = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, aKeyName.get(), 0, KEY_READ, aKey); >+ } No default action in the switch. What happens for other errors? >+ const nsString &flatName = PromiseFlatString(aKeyName); aKeyName is already flat. >+ DWORD res = ::RegCreateKeyExW(aStartKey, flatName.get(), 0, NULL, >+ 0, KEY_READ | KEY_WRITE, NULL, aKey, >+ &dwDisp); >+ >+ if (REG_FAILED(res)) { >+ if (!aHKLMOnly && aStartKey != HKEY_CURRENT_USER) { >+ // fallback to HKCU immediately on error since we won't be able >+ // to create the key. >+ return OpenKeyForWriting(HKEY_CURRENT_USER, aKeyName, aKey, aHKLMOnly); >+ } >+ return NS_ERROR_FILE_ACCESS_DENIED; This is almost unreadable! if (REG_FAILED(res) && aTryHKCU) res = ::RegCreateKeyExW(HKEY_CURRENT_USER, aKeyName.get(), ...); return REG_FAILED(res) ? NS_ERROR_FILE_ACCESS_DENIED : NS_OK; >+// The DefaultIcon registry key value should never be used (e.g. NON_ESSENTIAL) >+// when checking if Firefox is the default browser since other applications >+// (e.g. MS Office) may modify the DefaultIcon registry key value to add Icon >+// Handlers. s/Firefox/SeaMonkey/ >+ // seamonkey.exe\shell\properties (default) REG_SZ SeaMonkey &Options Preferences >+PRBool >+nsWindowsShellService::TestForDefault(SETTING aSettings[], PRInt32 aSize) >+{ >+ nsCOMPtr<nsILocalFile> lf; >+ nsresult rv = NS_NewLocalFile(mAppShortPath, PR_TRUE, >+ getter_AddRefs(lf)); >+ >+ if (NS_FAILED(rv)) >+ return rv; >+ >+ nsAutoString exeName; >+ rv = lf->GetLeafName(exeName); >+ if (NS_FAILED(rv)) >+ return rv; rv isn't a PRBool >+ isDefault = PR_FALSE; >+ break; Could just return PR_FALSE; (final return would then become return PR_TRUE;) >+ if (!::GetModuleFileNameW(0, appPath, MAX_BUF)) >+ return NS_ERROR_FAILURE; That's not quite true ;-) >+nsWindowsShellService::nsWindowsShellService() >+:mCheckedThisSessionClient(PR_FALSE) >+{ >+} Inline this? >+ PRBool isDefaultBrowser = PR_TRUE; >+ PRBool isDefaultMail = PR_TRUE; >+ PRBool isDefaultNews = PR_TRUE; Should be BOOL, no? >+ if (aApps & nsIShellService::BROWSER) >+ hr = pAAR->SetAppAsDefaultAll(APP_REG_NAME); >+ if (aApps & nsIShellService::MAIL) >+ hr = pAAR->SetAppAsDefaultAll(APP_REG_NAME_MAIL); >+ if (aApps & nsIShellService::NEWS) >+ hr = pAAR->SetAppAsDefaultAll(APP_REG_NAME_NEWS); Don't set hr, you don't use it again. >+ res = ::RegDeleteValueW(key, EmptyString().get()); L"" (or I think 0 also works?) >+ res = DeleteRegKey(key, nsDependentString(subkeyName)); Bad function signature, you don't actually use any nsString methods. >+ // Set the Options menu item Preferences >+ // Set the Safe Mode menu item Hmm, I couldn't find this - would having a branch SeaMonkey installed confuse things? >+ do { >+ i -= bpr; >+ >+ stream->Write(((const char*)bits) + i, bpr, &written); >+ if (written == bpr) { >+ rv = NS_OK; No point setting rv each time through the loop. Just set it once. >+ // XXX write background loading stuff! I hope this is copied code ;-) >+ // eventually, the path is "%APPDATA%\Mozilla\Firefox\Desktop Background.bmp" s/Firefox/SeaMonkey/ >+ // The size is always 3 unicode characters. No it's not, it's two! >+ int aParameters[2] = { COLOR_BACKGROUND, COLOR_DESKTOP }; Why are we setting two colours? >+ BYTE r = (aColor >> 16); >+ BYTE g = (aColor << 16) >> 24; >+ BYTE b = (aColor << 24) >> 24; >+ COLORREF colors[2] = { RGB(r,g,b), RGB(r,g,b) }; Ask jag for some better code for this ;-) >+ // Try to create/open a subkey under HKLM. >+ DWORD rv = ::RegCreateKeyExW(HKEY_CURRENT_USER, >+ L"Control Panel\\Colors", 0, NULL, >+ REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, >+ &key, &dwDisp); Comment wrong? >+ var shell = Cc["@mozilla.org/suite/shell-service;1"]. >+ getService(Ci.nsIShellService); var shell = Components.classes[...] .getService(...); (use constants for the two ...s if you prefer.) >+optionsLabel=%S &Options Preferences (and fix optionsLabel in the code, I overlooked it earlier)
Comment on attachment 303932 [details] [diff] [review] Shell service only #2 And jar.mn changes are missing.
Comment on attachment 303932 [details] [diff] [review] Shell service only #2 > suitebrowser \ > suitemigration \ > txmgr \ > unicharutil \ > windowwatcher \ >+ suitebrowser \ >+ suitemigration \ Duplicates.
Created attachment 310076 [details] [diff] [review] Shell service only #3 >> + attribute boolean shouldCheckDefaultClient; > We don't actually use this yet do we? Correct, it's used by my UI patch though (will be attached, when this patch is in). >> >+OS_LIBS += $(call EXPAND_LIBNAME,ole32 version uuid) >> >+OS_LIBS += shell32.lib version.lib > Inconsistent. Find out from ted/bsmedberg which one is right? I used $(call ...). >> + virtual ~nsWindowsShellService() {}; > Shouldn't need to be virtual. Fixed. I also fixed the OpenUserKeyForReading and OpenUserKeyForWriting functions, I hope it's ok now :). >> + res = ::RegDeleteValueW(key, EmptyString().get()); > L"" (or I think 0 also works?) MSDN says NULL works, too. >> + res = DeleteRegKey(key, nsDependentString(subkeyName)); > Bad function signature, you don't actually use any nsString methods. Changed the second param to a LPCWSTR and changed the callees to use L"subkeyName". I also renamed the function name to RegDeleteTree to reflect what it emulates (there is a Windows API function with that name, but it only exists in Vista and above). >> + // Set the Safe Mode menu item > Hmm, I couldn't find this - would having a branch SeaMonkey installed confuse > things? Branch uses 8.3 style in the registry, so should not. Background color code stayed as is because it turned out that another way is not really easier because of the registry write. >> + int aParameters[2] = { COLOR_BACKGROUND, COLOR_DESKTOP }; > Why are we setting two colours? According to MSDN, they set those two set the same. I removed COLOR_DESKTOP. Everything not mentioned here was fixed. To test this patch, one can execute this in the JS Console: Components.classes["@mozilla.org/suite/shell-service;1"].getService(nsIShellService).setDefaultClient(false, true, nsIShellService.BROWSER); To set mail as default app, just replace BROWSER with MAIL.
Oh and make the "+ Layout" change "+ layout" :).
Created attachment 310202 [details] [diff] [review] Shell service only #4 Fixed the "Firefox" code comments, fixed the OpenKeyForWriting recursive call, fixed isDefault (removed it and directly return PR_TRUE), changed the wcslen call to !*keyName, renamed optionsLabel to preferencesLabel, fixed the code comment for HKCU.
Comment on attachment 310202 [details] [diff] [review] Shell service only #4 We're down to the last few nits now, nearly there! Marking r- because this patch has non-shell-service bits in it. >+#define NS_SUITEWININTEGRATION_CONTRACTID "@mozilla.org/suite/shell-service;1" Hmm, is this name right? I guess it's OK. Presumably NS_SUITEMACINTEGRATION_CONTRACTID will have the same value, but NS_SUITEMACINTEGRATION_CID will have a different value. >+ DWORD RegDeleteTree(HKEY baseKey, LPCWSTR keyName); We can't really use an internal name that matches a Windows API, because the Vista SDK's WinUser.h will #define RegDeleteTree RegDeleteTree[A|W]. Call it DeleteRegTree perhaps? >+ DWORD DeleteRegKeyDefaultValue(HKEY baseKey, LPCWSTR keyName); Also, why are these not static methods in the .cpp file? >+#include "prbit.h" Not used! >+OpenUserKeyForReading(HKEY aStartKey, const nsString& aKeyName, HKEY* aKey) >+OpenKeyForWriting(HKEY aStartKey, const nsString& aKeyName, HKEY* aKey, >+ PRBool aHKLMOnly) I've just noticed that aKeyName doesn't need to be an nsString&, a LPWCSTR will suffice (as per RegDeleteTree and DeleteRegKeyDefaultValue). >+ res = ::RegDeleteValueW(key, 0); You mentioned NULL in your Bugzilla comment which might make more sense here. >+ nsAutoString current(buf); >+ if (REG_FAILED(res) || !current.Equals(aValue)) { Doesn't aValue.Equals(buf) work? >+ nsAutoString optionsKey(NS_LITERAL_STRING(SMI)); >+ optionsKey.Append(exeName); >+ optionsKey.AppendLiteral("\\shell\\properties"); Please rename all the other occurrences of options to preferences too! >+ int aParameters[1] = { COLOR_BACKGROUND }; >+ BYTE r = (aColor >> 16); >+ BYTE g = (aColor << 16) >> 24; >+ BYTE b = (aColor << 24) >> 24; >+ COLORREF colors[1] = { RGB(r,g,b) }; >+ >+ ::SetSysColors(sizeof(aParameters) / sizeof(int), aParameters, colors); I wonder whether it's worth writing these as simple variables instead of arrays and using ::SetSysColors(1, ¶meter, &color); >+const Cc = Components.classes; Not used. >+const Ci = Components.interfaces; Not inlined like I asked ;-) const nsIShellService = Components.interfaces.nsIShellService; is OK if you need to avoid wrapping below. >+ var shell = Components.classes["@mozilla.org/suite/shell-service;1"]. >+ getService(Ci.nsIShellService); >+ shell.setDefaultClient(true, true, nsIShellService.BROWSER); Components.classes["@mozilla.org/suite/shell-service;1"] .getService(Components.interfaces.nsIShellService); ( .setDefaultClient if you want... saves on the var) Same for mail; do we need -setDefaultNews? > rdf \ > string \ > suitebrowser \ > suitemigration \ > txmgr \ >+ shellservice \ Alphabetical order please.
Created attachment 316116 [details] [diff] [review] Shell service only #5 Ok, all review comments are fixed now. I used aValue.Equals(nsDependentString(buf, len)) for comparing the PRUnichar array to the nsString.
Comment on attachment 316116 [details] [diff] [review] Shell service only #5 Almost there! >+#ifndef nswindowsshellservice_h____ >+#define nswindowsshellservice_h____ This hardly seems necessary; there are only the two includes! >+#include "nsStringApi.h" Should be nsStringAPI.h in case somebody cross-compiles this. >+ // Get the old value >+ DWORD res = ::RegQueryValueExW(theKey, aValueName.get(), >+ NULL, NULL, (LPBYTE)buf, &len); >+ >+ // Set the new value >+ if (REG_FAILED(res) || !aValue.Equals(nsDependentString(buf, len))) { The documentation for RegQueryValueEx says that the string isn't guaranteed to be or not to be null-terminated. Now as it happens you always write null-terminated strings, which means that len is always one more than the actual length of the string (as used by nsDependentString). Except it isn't, because len is in bytes, not in characters... Conveniently you used almost correct code in TestForDefault (ZeroMemory and Equals without the nsDependentString) so I don't need an additional review of the fix. (IMHO you need to set len to two less than the actual buffer size.) >+ // Set the Options and Safe Mode start menu context menu item labels Preferences! >+ // Set the Options menu item Preferences! >+ suite/common/Makefile > suite/build/Makefile > suite/debugQA/Makefile > suite/debugQA/locales/Makefile > suite/common/Makefile Oops ;-)
Comment on attachment 316116 [details] [diff] [review] Shell service only #5 >+ locale/@AB_CD@/communicator/defaultClientDialog.dtd (%chrome/common/defaultClientDialog.dtd) Don't check this line in yet ;-)
Thanks for all the reviews and the s/options/preferences checks :-P. Checking in suite/shell/Makefile.in; /cvsroot/mozilla/suite/shell/Makefile.in,v <-- Makefile.in new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/public/Makefile.in; /cvsroot/mozilla/suite/shell/public/Makefile.in,v <-- Makefile.in new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/public/nsIShellService.idl; /cvsroot/mozilla/suite/shell/public/nsIShellService.idl,v <-- nsIShellService.idl new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/src/Makefile.in; /cvsroot/mozilla/suite/shell/src/Makefile.in,v <-- Makefile.in new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/src/nsWindowsShellService.h; /cvsroot/mozilla/suite/shell/src/nsWindowsShellService.h,v <-- nsWindowsShellService.h new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/src/nsWindowsShellService.cpp; /cvsroot/mozilla/suite/shell/src/nsWindowsShellService.cpp,v <-- nsWindowsShellService.cpp new revision: 1.3; previous revision: 1.2 done Checking in suite/shell/src/nsSetDefault.js; /cvsroot/mozilla/suite/shell/src/nsSetDefault.js,v <-- nsSetDefault.js new revision: 1.3; previous revision: 1.2 done Checking in suite/installer/windows/packages; /cvsroot/mozilla/suite/installer/windows/packages,v <-- packages new revision: 1.55; previous revision: 1.54 done Checking in suite/build/Makefile.in; /cvsroot/mozilla/suite/build/Makefile.in,v <-- Makefile.in new revision: 1.13; previous revision: 1.12 done Checking in suite/build/nsSuiteModule.cpp; /cvsroot/mozilla/suite/build/nsSuiteModule.cpp,v <-- nsSuiteModule.cpp new revision: 1.9; previous revision: 1.8 done Checking in suite/locales/jar.mn; /cvsroot/mozilla/suite/locales/jar.mn,v <-- jar.mn new revision: 1.36; previous revision: 1.35 done Checking in suite/locales/en-US/chrome/common/shellservice.properties; /cvsroot/mozilla/suite/locales/en-US/chrome/common/shellservice.properties,v <-- shellservice.properties new revision: 1.3; previous revision: 1.2 done Checking in suite/browser/browser-prefs.js; /cvsroot/mozilla/suite/browser/browser-prefs.js,v <-- browser-prefs.js new revision: 1.90; previous revision: 1.89 done Checking in suite/Makefile.in; /cvsroot/mozilla/suite/Makefile.in,v <-- Makefile.in new revision: 1.23; previous revision: 1.22 done Checking in suite/makefiles.sh; /cvsroot/mozilla/suite/makefiles.sh,v <-- makefiles.sh new revision: 1.12; previous revision: 1.11 done
Created attachment 316623 [details] [diff] [review] Patch that was checked in This is the patch that was checked in.
Comment on attachment 316623 [details] [diff] [review] Patch that was checked in >+ QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]), Sorry, but I only just noticed this :-(
Fixed that.
Created attachment 316685 [details] [diff] [review] (Cv1) <nsSetDefault.js> (s/handeFlag/handleFlag/) [Checkin: Comment 30] [Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9pre) Gecko/2008042003 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4) Fixes, (at application startup): {{ Error: aCmdline.handeFlag is not a function Source File: Line: 64 }} Frank, can you check it in (preemptively) ?
Checked in.
Is this bug fixed ? Or what is left to be done ?
The current UI needs to be changed to use the new shell service. I filed Bug 441050 for that. Closing this bug here. | https://bugzilla.mozilla.org/show_bug.cgi?id=380347 | CC-MAIN-2017-17 | refinedweb | 3,520 | 51.34 |
Prev
Java JVM Code Index
Headers
Your browser does not support iframes.
Re: Do any Java compilers or JVMs optimize getter method calls?
From:
David Karr <davidmichaelkarr@gmail.com>
Newsgroups:
comp.lang.java.programmer
Date:
Thu, 3 Sep 2009 16:32:57 -0700 (PDT)
Message-ID:
<ceea1652-1e1c-4066-8a64-98c1554c2792@t13g2000yqn.googlegroups.com>
On Sep 3, 3:56 pm, Lew <no...@lewscanon.com> wrote:
david.karr wrote:
I prefer to reference instance variables through getters, as opposed
to direct access to them. However, there's "obviously" going to be a
small time penalty for that. I did some timings in Eclipse, and I
found direct reads were a tiny fraction faster than through the getter
call (no surprise), and the difference between the setter and a direct
write was even smaller (I tested 100000000 iterations, adding up the
nanosecond intervals of each type of access).
I'm wondering whether there are any compiler/JVM combinations that
optimize getter calls to be the same as a direct access? I can see
from the bytecode in Eclipse that there is no optimization at that
level, but I don't know if the JVM will do any optimization in some
cases. It didn't appear to do it in Eclipse, but I don't know if other
JVMs would act differently.
You cannot tell optimization from the bytecode, because optimization happ=
ens
in the JVM.
Yes, I know, I was just pointing out the bytecode wasn't already pre-
optimized.
Doesn't Eclipse use the JVM installed on your system? What JVM is inst=
alled
on your system?
Yes. I've tested with Sun's 1.5.0_19, 1.6.0_14, and 1.6.0_16.
What options are you passing to the JVM now?
The most significant optimizations occur with the "-server" option to the
"java" command (or equivalent). Others are possible. They are docum=
ented on
java.sun.com and elsewhere.
I wasn't using "-server" before, but I am now. That's a useful
change.
Methods declared as 'final' tend to be inlined and run faster than method=
s not
so qualified.
When running your benchmarks, let the loop run a bunch of times before yo=
u
start timing. That lets the Hotspot compiler analyze the run and figur=
e out
what to optimize.
I'm also using both of these strategies. I'm running 100000000 timed
iterations, so I doubt the warm-up loop is necessary, but I'm doing
that anyway.
My measurements show very tiny differences (perhaps .02% total
difference over all 100000000 iterations). In fact, emphasizing the
fact that this isn't statistically significant, I saw several runs
where the "direct" test was slightly slower than the "getter" test.
If it matters, following this is my test class.
------Timings.java----------
package timings;
public class Timings {
private String foo;
final public String getFoo() {return foo;}
final public void setFoo(String foo) {this.foo = foo;}
public static void main(String[] args) {
Timings timings = new Timings(args);
timings.go();
}
public Timings(String[] args) {}
private void go() {
// warmup loop.
for (int ctr = 0; ctr < 1000; ++ ctr) {
setFoo(ctr + "");
getFoo();
this.foo = this.foo + "";
}
int iters = 10000000;
long totalns;
totalns = 0;
for (int ctr = 0; ctr < iters; ++ ctr) {
setFoo(ctr + "");
long startTime = System.nanoTime();
String val = getFoo();
totalns += (System.nanoTime() - startTime);
}
System.out.println("getter[" + totalns + "]");
totalns = 0;
for (int ctr = 0; ctr < iters; ++ ctr) {
setFoo(ctr + "");
long startTime = System.nanoTime();
String val = this.foo;
totalns += (System.nanoTime() - startTime);
}
System.out.println("direct[" + totalns + "]");
totalns = 0;
for (int ctr = 0; ctr < iters; ++ ctr) {
long startTime = System.nanoTime();
setFoo(ctr + "");
totalns += (System.nanoTime() - startTime);
}
System.out.println("setter[" + totalns + "]");
totalns = 0;
for (int ctr = 0; ctr < iters; ++ ctr) {
long startTime = System.nanoTime();
this.foo = ctr + "";
totalns += (System.nanoTime() - startTime);
}
System.out.println("direct[" + totalns + "]");
}
}
--------------------
Generated by PreciseInfo ™
) | http://preciseinfo.org/Convert/Articles_Java/JVM_Code/Java-JVM-Code-090904023257.html | CC-MAIN-2022-05 | refinedweb | 635 | 60.82 |
Hi,
I've just been looking at Hello World applications for programmign CGI's - and ive discovered that:
#include <stdio.h> int main(void) { printf("Content-Type: text/plain;charset=us-ascii\n\n"); printf("Hello world\n\n"); return 0; }
Compiles to about 15.4 kb, compared to:
#include <iostream> using namespace std; int main() { cout<<"Content-type: text/plain"<<endl<<endl; cout<<"Hello World!"<<endl; return 0; }
which compiles to about 458kb
Can anyone explain why the two peices of code compiel to such different sizes (Is it the differnet IO library in which case which one is better?)
Thanks | https://www.daniweb.com/programming/software-development/threads/164913/compile-filesize | CC-MAIN-2018-43 | refinedweb | 102 | 59.84 |
Almost:
Typical circuit of 555 in Astable mode is given below, from which we have derived the above given Signal Generator Circuit.
>.
One can see that RB of above diagram is replaced by a pot in the Signal Generator Circuit; this is done so that we can get variable frequency square wave at the output for better testing. For simplicity, one can replace the pot with a simple resistor.
Schmitt Trigger Gate:
We know that all the testing signals are not square or rectangular waves. We have triangular waves, tooth waves, sine waves and so on. With the UNO being able to detect only the square or rectangular waves, we need a device which could alter any signals to rectangular waves, thus we use Schmitt Trigger Gate. Schmitt trigger gate is a digital logic gate, designed for arithmetic and logical operations.. We don’t usually get Schmitt trigger separately, we always have a NOT gate following the Schmitt trigger. Schmitt Trigger working is explained here: Schmitt Trigger Gate
We are going to use 74LS.
Now we will feed any type of signal to ST gate, we will have rectangular wave of inverted time periods at the output, we will feed this signal to UNO.
Arduino measures the Frequency:
The Uno has a special function pulseIn, which enables us to determine the positive state duration or negative state duration of a particular rectangular wave:
Htime = pulseIn(8,HIGH); Ltime = pulseIn(8, LOW);
The given function measures the time for which High or Low level is present at PIN8 of Uno. So in a single cycle of wave, we will have the duration for the positive and negative levels in Micro seconds. The pulseIn function measures the time in micro seconds. In a given signal, we have high time = 10mS and low time = 30ms (with frequency 25 HZ). So 30000 will be stored in Ltime integer and 10000 in Htime. When we add them together we will have the Cycle Duration, and by inverting it we will have the Frequency.
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int Htime; //integer for storing high time
int Ltime; //integer for storing low time
float Ttime; // integer for storing total time of a cycle
float frequency; //storing frequency
void setup()
{
pinMode(8,INPUT);
lcd.begin(16, 2);
}
void loop()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Frequency of signal");
Htime=pulseIn(8,HIGH); //read high time
Ltime=pulseIn(8,LOW); //read low time
Ttime = Htime+Ltime;
frequency=1000000/Ttime; //getting frequency with Ttime is in Micro seconds
lcd.setCursor(0,1);
lcd.print(frequency);
lcd.print(" Hz");
delay(500);
}
Apr 14, 2016
I like only Audio amplifier. so maked to Aurduino measurement. Hz, Amp, Mili Amp, Wattes, Etc.
Jun 20, 2016
this project is simple to make and vry interesting.
Jun 22, 2016
can i use this circuit as an oscilloscope?and where to modify??
Jun 28, 2016
Hi, going to make this when the parts come in. I know I have some 555s around here some place, but I can't for the life of me find them, probably have a couple Schmid triggers as well but you can never have too many parts, and for the cost of them now days, ordering a lot of 10 for 3 bucks doesn't seem to much to invest in a good signal generator. Now to decide which display I want to use, and which project box will house it. Details, details, always details...>>>>
Jun 28, 2016
Being a Ham operator, I wonder if I can find a way to use this to check the frequency of my low power CW field rig. Perhaps find a place to hook a test lead in the radio at a test point....
Jun 30, 2016
No you cannot, The frequency counter cannot measure frequencies higher than 6Mhz. So it cannot detect radio signals.
Aug 16, 2016
Yes. You can measure radio frequencies of up to about 6 MHz. If you add a pre-scaler (divide by N) you can then change the code to multiply the displayed frequency by the pre-scale division and see the actual input frequency. To improve accuracy you can add or subtract a few microseconds in the code to
compensate if your Arduino crystal is off frequency by a small amount.
Jun 15, 2018
Yes you can use this idea to make an Arduino based frequency meter but for the higher frequencies encountered on HF bands you will need to add a pre-scaler. That will bring the HF signals down to where they can be measured by the pulse-width functions in Arduino libraries.
A better way might be to use something like a 74HC4060 as a pre-scaler and make your Arduino software interrupt-driven so it toggles at LOW-->HIGH transitions of the pre-scaled signal. Then use the micro-seconds() counter to determine time between subsequent LOW-->HIGH transitions and calculate the frequency. Since some Arduino boards use a ceramic resonator for the 16 MHz oscillator you may see some temperature induced drift. Frequency correction can be done in software but this does not stop the drift. There are some Arduinio Pro-mini boards available from Ebay vendors that use a real crystal for the 16 MHz oscillator. These are much better for Arduino-based frequency counters.
[ K7HKL ]
Aug 06, 2016
I built this circuit as per your instructions & tested it against my O-scope. I get a non-lin addative drift of about 15hz per 100 ie.: 100hz= 114.7 to 15ish (arduino output floats) , 200hz= 230ish etc from my frequecy generator. My O-scope verifies that the generator is right on the money. Is this an inherant accuracy expectancy or could something else be at play here? How accurate where your readings? Any ideas or input greatly appreciated.
Aug 16, 2016
/* fcounter.ino
This code is based on a simpler version that has become standard
among Arduino users. Some problems with the original code have
been fixed and operation speed has been improved (slightly).
Arv K7HKL 2016
STRATEGY:
This code is actually a period counter with conversion of period to
frequency in software. Refresh time is less for higher frequency
inputs, which provides a pseudo auto-ranging operation.
A prescaler is needed for frequencies higher than one third CPU
Clock. If a prescaler is used, its division factor should be set in the
"int prescale = N;" code line. This will cause frequency to be multiplied
by the pre-scal factor before it is written to the LCD. Higher prescale
factors may noticeably slow counting of VLF and audio signals.
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // LCD pin connections
int Htime; // integer for storing high time
int Ltime; // integer for storing low time
float Ttime; // integer for storing total time of a cycle
float frequency; // for storing frequency
int prescale = 1; // change this if a pre-scaler is added
void setup()
{
pinMode(8,INPUT); // pin D8 is frequency input
lcd.begin(16, 2); // set LCD = 16 char by 2 lines
lcd.clear(); // clear the whole LCD
lcd.setCursor(0,0); // set cursor to the first character, top line
lcd.print(" Frequency"); // label the LCD top line
}
void loop()
{
Htime=pulseIn(8,HIGH); //read high time
Ltime=pulseIn(8,LOW); //read low time
Ttime = Htime+Ltime; // total time = high time + low time
frequency=1000000/Ttime; //calculate frequency from Ttime in Micro seconds
frequency = frequency * prescale; // handle any pre-scaler division factor
lcd.setCursor(0,1); // set cursor to first character of LCD second line
lcd.print(" "); // clear the second line
lcd.setCursor(0,1); // set cursor to first character of LCD second line
lcd.print(frequency); // print frequency on LCD second line
lcd.print(" Hz"); // add suffix to show measurement is in Hz.
}
Jul 01, 2018
Would this work with a frequency range of 108-136 MhZ? I would like to add this to a Airband Receiver project. What would I have to change in order to get these frequencies displayed? "int prescale = 1; // change this if a pre-scaler is added"
Would you still recommend the 74HC4060 chip substitution?
Sep 05, 2016
Great project ! I'm just starting with the Arduino and would like to put this project together. I'm in the USA and I can't find the LCD JHD_162ALCD referred to in the companion article (LCD is interfaced with Arduino ). Can anyone provide a source for the LCD or is there an alternative (please provide part nbr) ? Also, the sketch refers to the LiquidCrystal.h library: Being new to the Arduino is this part of the Arduino code base or do I need to dowload the library from some where? Any help is appreciated ! Thanks.
Oct 01, 2016
You can use any 16x2 LCD, no need to get exact one. And LiquidCrystal.h is the part of Arduino code base, you just need to use latest Arduino IDE to burn the code:
Jul 04, 2018
You can buy any 16*2 Alphanumeric LCD module that is available in your local market. It should be easy for you to find one in you local hardware store. The LCD library for Arduino will be loaded by default in your Arduino IDE so you dont have to worry about it.
All the best.
Oct 04, 2016
Hi, I want to measure a phonic wheel sensor which submit between 0 hz to 1300 hz, I wonder if this method could shows accurate results for this range?
Lee
Oct 07, 2016
This circuit can measure upto 1MHz of frequency but it is most suitable for measuring frequency of digitally generated Square wave.
Nov 04, 2016
this simple code has helped me to simplify my ground capacitive moisture meter .
I had all the pins in Arduino One engaged and I could not use the Frequencycounter library that requires the pin D5 free.
thank you !!
Best regards friend
Nov 22, 2016
after programming whether the led name (L) will blink or not blink or stand steadily
Dec 07, 2016
hy,every one.
i just want to know that how the frequency changes ,either by changing the voltage or by any other way
Mar 21, 2017
Where to connect the capacitor c1 and c2
Apr 15, 2017
Can i use 20*4 lcd display ??If possible ,how?
Apr 18, 2017
why the hell the frequency is changing when we are changing 47k pot for same signal. For a particular signal it should show some frequency,for different signals it should show different frequency . Frequency counter means it should count the frequency of the given signal ,for example if we give our household power signal it should show approx 50 Hz. I am not able to understand the main idea behind signal generator(using 555 timer), when the input signal is fed to the arduino through schmitt trigger gate arduino will count number of pulses passing per second from which we get frequency then what is the use of dummy signal generator there ???
Jul 05, 2017
house hold AC can damage the circuit, and if you have square wave of known frequency you can provide input from that too. Here 555 is just to give demonstration of the protect.
Jul 04, 2017
Worked like a charm!
Jul 16, 2017
Can we use a simple NOT gate instead of your Schmidt Trigger NOT gate???
If not plz tell in short why. What's special with this 7414 gate?
Nov 11, 2017
1.
You must find the correct libraries for the LCD you have.For me I use
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
2.
You made one measuring of time and then display the floating number of frequency. You will get a more correct measuring as an average of several measuring's. I have placed a for .. until loop with counter to 1000 and add up Ttime in variabel Tsum and then calculate frequency from Tsum/1000. You can also convert this frequency to an integer if you like
frekvens=long(frequency+0.5);
3.
I have a better way don't use pulseIn() function because this is an indirect way and have many complicated process's , but count the number of transitions from HIGH to LOW (or LOW to HIGH) in a second that is frequency.
/*
**Frequency counter - count the number of trasitions from HIGH to LOW in a second
**The use of LCD is taken from other programs
*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
long frekvens;//storing frequency - danish for frequency
long number; // counter for transitions
long time1; // starttime for 1 second in micros()
long time; // measering time in micros()
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
void setup()
{
lcd.begin (16,2); // <<----- My LCD was 16x2
pinMode(8,INPUT); //impuls ind på digital ben nr 8
Serial.begin(9600);//initialize the serial
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
}
void loop()
{
number=0;
time1=micros();
do
/* loop for one second*/
{
if (digitalRead(8)==HIGH)
{
do
{
/* empty loop waiting for transition*/
}
while (digitalRead(8)==HIGH);
/* now from HIGH to LOW */
number++;
}
time=micros();
}
while (time<(time1+1000000));
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Frequency :");
lcd.setCursor(0,1);
lcd.print(number);
lcd.print(" Hz");
delay(1000);
}
Nov 14, 2017
True that! nice suggestions
Aug 12, 2018
Can you share with me your libraries?
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
Please!!
Dec 15, 2017
Hello community,
I have a problem regarding to the pulseIn() function. I am using an Arduino Micro for my work.
The problem is that I get false results in PWM measurement. I used the Code shown on this page. My PWM Signal is simulated by the Arduino and has 2Hz.
My Serial Monitor just Shows for HIGH and LOW both 0 and for the frequency it shows inf (Infinite?? Dont know what that is). I already tried to change pins, the timeout length and even used external HIGH or LOW to measure a pulse which still gave me a 0 as time in Serial Monitor....
here is my Code:
int PWM = 8; // Input for the frequency
int READYLED = 10; // PWM generator
float T = 0;
int L;
int H;
float frequency;
void setup() {
Serial.begin(9600);
pinMode(PWM, INPUT);
pinMode(READYLED, OUTPUT);
}
void loop(){
digitalRead(PWM);
H = pulseIn(PWM, HIGH, 300);
L = pulseIn(PWM, LOW, 300);
T = H+L;
frequency=1000000/T;
Serial.println(frequency);
digitalWrite(READYLED, HIGH);
delay(250);
digitalWrite(READYLED; LOW);
delay(250);
}
it would be nice if you guys could help me with that problem.
best regards,
Marcel
Dec 19, 2017
I doubt problem is more with your hardware. Are you sure you are getting nice PWM at the input? Also what is the use of "digitalRead(PWM);"
You can try using the forum for this question
Jul 06, 2018
I may be wrong, but aren't you trying to read pwm with the same arduino that generates it? When you want to detect a pulse it is not there because at the end of the loop you turned the signal low. H and L are 0, so dividing 1000000 by 0 gives you an error.
Jan 21, 2018
This is fantastic. Good job. Thanks.
Apr 07, 2018
Can you PLEASE post a diagram of how the 555 and SN54 are connected? I had it working last week and for the life of me I cannot get it working again! Better yet, post a diagram of the entire circuit. Whenever I run the sketch I only get ~60Hz, which is the powerline frequency. I had it working perfectly and then when I went to implement it into my lighted electric drum project it no longer worked.
Apr 19, 2018
What's the use of 1000 uF capacitor?
May 10, 2018
Very nice and well explained project. My questions are:
No1: may I use HEF40106BP (CMOS HEX SCHMITT TRIGGER) as a substitute of 74LS14?
No2: Quote:"For filtering the noise we have added couple of capacitors across power." (End of quote.)
Do you mean the +5V DC power pin and Gnd pin of the Adruino board, or the Vcc pin of the Schmitt trigger IC?
Best regards
Apr 08, 2019
Olá alguem pode me ajudar a desenvolver um simulador de roda fonica com arduino que tenha display e ajuste de rotação?
Apr 30, 2019
I am certainly not a expert about this stuff, or about anything, for that matter, so, if you see something wrong with my conclusions, please let me know.
-------------------------------------------------------------------------------
My conclusions:
Below 707 Hz, it is able to resolve on one Hz difference.
At ten kiloHertz, resolution is down to about 100 Hertz.
Audio range: Even if you consider the top of the range to be 15 kHz, you can't come any closer than about 300 Hz to the actual frequency at that point.
At one hundred Kilohertz, the minimum difference it can resolve is 11.1 kilohertz. For instance, if you wanted to know whether the actual signal was 100 kHz or 108 kHz, you'd never know. All you would see is some number in that range, and, possibly that number jumping up or down by 11.1 kiloHertz from one sample to the next.
At one megaHertz, there would be a one megaHertz minimum resolution! No, it really won't be useful anywhere near to one megahertz and certainly not beyond.
If you can live with this lack of precision, or whatever you call it , then this circuit is for you. | https://circuitdigest.com/microcontroller-projects/arduino-frequency-counter-circuit | CC-MAIN-2019-43 | refinedweb | 2,924 | 71.44 |
Access the Civis Platform API
Project description
Introduction
The Civis API Python client is a Python package that helps analysts and developers interact with the Civis Platform. The package includes a set of tools around common workflows as well as a convenient interface to make requests directly to the Civis API. See the full documentation for more details.
Installation
Get a Civis API key (instructions).
Add a CIVIS_API_KEY environment variable.
You can add the following to .bash_profile for bash:
export CIVIS_API_KEY="alphaNumericApiK3y"
Source your .bash_profile
Install the package:
pip install civis
Optionally, install pandas, and pubnub to enable some functionality in civis-python:
pip install pandas pip install pubnub
Installation of pandas will allow some functions to return DataFrame outputs. Installation of pubnub will improve performance in all functions which wait for a Civis Platform job to complete.
Usage
civis-python includes a number of wrappers around the Civis API for common workflows.
import civis df = civis.io.read_civis(table="my_schema.my_table", database="database", use_pandas=True)
The Civis API may also be directly accessed via the APIClient class.
import civis client = civis.APIClient() database = client.databases.list()
See the full documentation for a more complete user guide.
Retries
The API client will automatically retry for certain API error responses.
If the error is one of [413, 429, 503] and the API client is told how long it needs to wait before it’s safe to retry (this is always the case with 429s, which are rate limit errors), then the client will wait the specified amount of time before retrying the request.
If the error is one of [429, 502, 503, 504] and the request is not a patch* or post* method, then the API client will retry the request several times, with a delay, to see if it will succeed.
Build Documentation Locally
To install dependencies for building the documentation:
pip install Sphinx pip install sphinx_rtd_theme pip install numpydoc
To build the API documentation locally:
cd docs make html
Then open docs/build/html/index.html.
Note that this will use your API key in the CIVIS_API_KEY environment variable so it will generate documentation for all the endpoints that you have access to.
Contributing
See CONTRIBUTING.md for information about contributing to this project.
License
BSD-3
See LICENSE.md for details.
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/civis/ | CC-MAIN-2018-39 | refinedweb | 410 | 56.35 |
First time here? Check out the FAQ!
Sorry, I don't know how to use mpq_t attribute. Should I import some library for it? How do it? Thanks in advance.
I re-edited with an example. Thanks.
I want to work efficiently with rational numbers under the context %cython but I don`t know how. Can anyone suggest any ideas? Thank you.
An example:
%cython
def rational_partitions(n):
sol = [i/n for i in range(n)]
for a in sol[0:-1]:
for b in sol[1:]:
k=2
while abs(b-a)/k>1/n:
sol.append(abs(b-a)/k)
k += 1
return sol
rational_partitions(10). | https://ask.sagemath.org/users/8885/rafarob32/?sort=recent | CC-MAIN-2020-50 | refinedweb | 108 | 71.92 |
> the wheel. But while font-lock allows additional properties, it will always > also set the face... Not true. Just return (face nil ...). >> ii) the timing is bad. >> iii) the lack of consultation is bad. > > Granted! But from my experience many developers don't half understand > advanced makefiles and hardly mess with them. Thus the impact here is way > smaller than changes to, say, cc-mode. Not really an excuse, but ... The correct parsing part of your patch is of course OK. The major changes in highlighting is what puts people off (together with the idea that only "GNUMakefile" can use GNU extensions). Stefan | http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-06/msg00234.html | CC-MAIN-2017-30 | refinedweb | 103 | 68.67 |
Docker Initially docCloud Company founder Solomon Hykes An internal project initiated while in France , It is based on docCloud The company has innovated cloud service technology for many years , And in 2013 year 3 Month after month Apache 2.0 License open source , The main project code is in GitHub upkeep .
Dokcer It's an open source commercial product ,Docker Divided into community version (Community Edition, CE) And enterprise (Enterprise Edition, EE). among Docker Community Edition is an open source software , The source code is located in be based on Go Language development , be based on Linux Kernel cgroup、namespace, as well as OverlayFS Class Union FS Technology , Encapsulate and isolate processes , Virtualization technology at the operating system level .License by Apache-2.0, The latest stable version is 19.03.13, On 2020 year 9 month 18 Promulgated by the , Support Linux、Windows and Mac operating system , It's an open platform , For developing applications 、 deliver (shipping) application 、 Run the application . Because the isolated process is independent of the host and other isolated processes , So it's also called a container . The initial implementation is based on LXC, from 0.7 The version begins to remove LXC, Turn to self-developed libcontainer, from 1.11 Start , Then it further evolved to use runC and containerd.
Docker Allow users to put infrastructure (Infrastructure) The applications in are separated separately , Form smaller particles ( Containers ), To speed up the delivery of software .Docker Containers are similar to virtual machines , But they are different in principle . Containers are virtualization of the operating system layer , Virtual machines are virtualization hardware , So the container is more portable 、 Efficient use of servers . Containers are more used to represent a standardized unit of software . Because of the standardization of containers , So it can ignore differences in infrastructure , Deploy anywhere .
Docker Is a for development 、 An open platform for publishing and running applications .Docker Enables you to separate applications from infrastructure , So you can quickly deliver software . With the help of Docker, You can manage the infrastructure in the same way that you manage applications . By using Docker Methods for rapid delivery 、 Testing and deployment , You can greatly reduce the delay between writing code and running it in a production environment .
Docker utilize Linux The resource separation mechanism in the core , for example cgroups, as well as Linux Core namespace (namespaces), To create a separate container (containers). This can be done in a single Linux Under the entity operation , Avoid the extra burden of booting a virtual machine .
Docker Provides in a loosely isolated environment (loosely isolated environment)( It's called a container ) The ability to package and run applications in . Isolation and security allow you to run multiple containers simultaneously on a given host . Containers are lightweight , Because they don't need a hypervisor (hypervisor) The extra burden of , It runs directly in the host's kernel . This means that compared to using virtual machines , More containers can be run on a given combination of hardware . You can even run it on a host that is actually a virtual machine Docker Containers .
Docker Is an open source application container engine , Let developers package their applications and dependencies into a lightweight package 、 In a portable container , Then post to any popular Linux Machine or Windows On the machine , You can also implement virtualization . Containers are completely sandboxed using the sandbox mechanism , There will be no interface between them , More importantly, the container performance overhead is minimal .
and VMware Virtual machines are compared to ,Docker Using containers to host applications , Instead of using an operating system , So it costs very little , A high performance . however ,Docker Application isolation is not as thorough as virtual machines , So it can't completely replace VMware.
Docker It's a container based platform , Allow highly portable workloads .Docker The container can be on the developer's native machine 、 On physical or virtual machines in the data center 、 Running on a cloud service or in a hybrid environment .Docker Portability and lightweight features , It also makes it easy for you to complete the dynamic management workload , And according to the business requirements , Expand or dismantle applications and services in real time .
Linux Containers (Linux Containers, Abbreviation for LXC): A virtualization technology , It's not simulating a complete operating system , It's about isolating the .
Traditional virtual machine technology is the virtual out of a set of hardware , Run a full operating system on it , The required application processes are then run on the system ; Application processes in the container run directly from the host kernel , There is no kernel of its own in the container , And there is no hardware virtualization . Containers are therefore more portable than traditional virtual machines .
Docker engine (Docker Engine) Is a client with the following main components ---- Server application (client----server application):
(1). The server : It's a long-running program , Called daemons (daemon process)(dockerd command ).
(2).REST API: It specifies the interface that a program can use to communicate with the daemons and indicate its operation .
(3). client : Command line interface (command line interface, CLI)(docker command ).
We write commands through the client , The client then sends the command to the daemons , The daemons then return the results of the command execution to the client , This allows us to view the execution results through commands , The image is the source code of the container , The container is started by mirroring , Use the repository to hold the user built image . Daemons create and manage Docker object , For example, mirror image 、 Containers 、 Network and volume .
Docker The engine is the core software used to run and manage containers , Usually people simply refer to it as Docker or Docker platform .
CLI Use Docker REST API By script or directly CLI To command or control with Docker Daemons interact . Many others Docker Applications use the basics API and CLI.
Docker framework :Docker Using client ---- Server architecture , As shown in the figure below .Docker The client and Docker Daemon (daemon) A dialogue , The daemons complete the build 、 Operation and distribution Docker The heavy work of the container .Docker Clients and daemons can run on the same system , Or you can put Docker Clients connect to remote Docker Daemon .Docker Clients and daemons are in UNIX Use on socket or network interface REST API communicate .
(1).Docker Daemon (Docker daemon): Listen Docker API Request and manage Docker object , For example, mirror image 、 Containers 、 Network and volume . Daemons can also communicate with other daemons to manage Docker service .
Docker The daemons accept requests from clients as servers , And process those requests ( establish 、 function 、 Distribution of the container ). Both the client and the server can run on the same machine , Can also pass socket perhaps REST API To communicate .Docker Daemons usually run in the background of the host , Wait to receive a message from the client .Docker The client provides the user with a series of executable commands , The user implements the following with these commands Docker Daemons interact .
(2). Docker client (Docker client): It's a lot of Docker Users and Docker Main ways of interaction . When you use something like docker run Orders like that , The client will send these commands to dockerd, Then execute them . docker Command to use Docker API.Docker The client can communicate with multiple daemons . Both the client and the server can run on the same machine , Can also pass socket perhaps RESTful API To communicate .Docker daemon Generally runs in the background of the host host , Wait to receive a message from the client .Docker The client provides the user with a series of executable commands , The user implements the following with these commands Docker daemon Interaction .
(3).Docker Registry Center (Docker registry): Storage Docker Mirror image .Docker Hub It's a public registry that anyone can use , And by default ,Docker Configured to be in Docker Hub Find the image on . You can even run your own private registry . Use docker pull or docker run On command , The required image will be extracted from the configured registry . Use docker push On command , The image is pushed to the configured registry .
After the mirror is built , Can be easily run on the current host , however , If you need to use this image on another server , We just need a centralized store 、 A service that distributes images ,Docker Registry That's the service .
One Docker Registry Can contain multiple warehouses in (Repository); Each warehouse can contain multiple labels (Tag); Each label corresponds to an image . Usually , A warehouse will contain images of different versions of the same software , And tags are often used for different versions of corresponding software . We can go through < Warehouse, >:< label > To specify which version of the image of the software . If you don't give a label , Will be with latest As default label .
With Ubuntu Image as an example ,ubuntu It's the name of the warehouse , It contains different version labels , Such as 16.04、18.04. We can go through ubuntu:16.04, perhaps ubuntu:18.04 To specify which version of the image you want . If the label is ignored , such as ubuntu, That would be considered ubuntu:latest.
Warehouse names often appear in the form of a two-phase path , such as jwilder/nginx-proxy, The former often means Docker Registry User name in multi-user environment , The latter is often the corresponding software name . But this is not absolute , Depends on the specific... Used Docker Registry Software or services .
Docker Registry Open service : It is open to users 、 Allow users to manage mirrored Registry service . Generally, such public services allow users to upload for free 、 Download public images , And may provide charging service for users to manage private image . Most commonly used Registry Public service is official Docker Hub, This is also the default Registry, And has a large number of high-quality official images . in addition to , also Red Hat Of Quay.io;Google Of Google Container Registry, Kubernetes This service is used for the image of .
For some reason , Visiting these services in China may be slow . Some cloud service providers in China have provided solutions for Docker Hub Image services (Registry Mirror), These image services are called accelerators . The common ones are Alibaba cloud accelerators 、DaoCloud Accelerator, etc . There are also some cloud service providers in China that provide similar services Docker Hub Public service . For example, Netease cloud image service 、 Alibaba cloud image library, etc .
private Docker Registry: In addition to using public services , Users can also set up private businesses locally Docker Registry.Docker The official provided Docker Registry Mirror image , Can be used directly as private Registry service .
Don't do it without configuration Docker APT Use directly in the case of source apt Command to install Docker.
(4).Docker object (Docker objects): Refer to Images、Containers、Networks、Volumes、Plugins wait .
A. Mirror image (Images): Is a read-only template , It includes creating Docker Description of the container . Usually , One mirror is based on another image , And do some other customization . for example , You can build based on ubuntu Mirror image of mirror image , But installation Apache Web Server and your application , And the configuration details needed to run the application . You can create your own image , You can also just use images created by others and published in the registry . Build your own mirror image , You can create one with simple syntax Dockerfile, To define the steps required to create the image and run it . Dockerfile Each instruction in creates a layer in the image . When you change Dockerfile And rebuild the mirror image , Rebuild only those layers that have changed . Compared with other virtualization technologies , This is what makes the mirror so light 、 Part of the reason for being small and fast . Image layering (layers) structure Of , And the files that define these levels are called Dockerfile.
The operating system is divided into kernel and user space . about Linux for , After kernel startup , Will mount root File system provides user space support for it . and Docker Mirror image , It's like one root file system . For example, the official image ubuntu:18.04 It includes a complete set Ubuntu 18.04 Minimum system root file system .
Docker A mirror is a special file system , In addition to providing the required programs for the container runtime 、 library 、 resources 、 Configuration and other files outside , It also contains some configuration parameters for the runtime ( Such as anonymous volume 、 environment variable 、 The user etc. ). The mirror does not contain any dynamic data , Its content is not changed after construction .
Because the image contains the complete operating system root file system , Its volume is often huge , So in Docker When the design , Just make the most of Union FS Technology , Design it as a tiered storage architecture . So strictly speaking , Mirror image is not like a ISO Packing files like that , Image is just a virtual concept , It's not really a document , It's a set of file systems , Or say , It is composed of multiple file systems . When the image is built , It will be built layer by layer , The former layer is the foundation of the latter layer . After each layer is built, it will not change , Any change on the latter layer only happens on its own layer . When building images , Need extra care , Each layer should contain only what it needs to add , Anything extra should be cleaned up before the layer is built . The characteristics of tiered storage also enable the reuse of images 、 Customization becomes easier . You can even use the previously constructed image as the base layer , Then add a new layer , To customize what you need , Building a new mirror .
Docker Put the application and its dependencies , Packaged in a mirror file . Only through this document , Can be created Docker Containers . Image files can be seen as templates for containers .Docker Create an instance of the container from the image file . The same image file , You can generate multiple container instances running at the same time . Images are binary files . In development , A mirror file often inherits another image file , Add some personalization to create .
Image files are generic , Copy the image file of one machine to another , Still usable . Generally speaking , To save time , We should try to use the image files made by others , Instead of making it yourself . Even if you want to customize , Should also be based on other people's image file processing , Not from scratch . For the convenience of sharing , After the image file is made , It can be uploaded to the warehouse on the Internet .Docker The official warehouse of Docker Hub Is the most commonly used image warehouse .
Use the image to create a container , The mirror image must be associated with Docker Host system architecture is consistent , for example Linux x86_64 Architecture system can only use Linux x86_64 Image creation container of .Windows、Mac With the exception of , It USES binfmt_misc Provides a variety of architecture support , stay Windows、Mac On the system (x86_64) Can run arm And other architectures .
When the user gets an image ,Docker The engine will first look for whether the image has manifest list , If any Docker The engine will follow Docker Running environment ( System and Architecture ) Find the corresponding image . If not, the image will be obtained directly .
Each mirror is made up of many layers ,Docker Use Union FS Combine these different layers into a mirror image . Usually Union FS There are two uses , On the one hand, it can be realized without the help of LVM、RAID Will be multiple disk Hang to the same directory , A more common branch that can be written together with another read-only branch .
B. Containers (Containers): It's an application or set of applications that run independently , It's the entity of the mirror runtime . You can use Docker API or CLI establish 、 start-up 、 stop it 、 Move or delete containers . You can connect containers to one or more networks , Connect storage to it , Even create a new image based on its current state . By default , The isolation between the container and other containers and their hosts is relatively high . You can control the network of containers 、 The degree to which storage or other underlying subsystems are isolated from other containers or hosts . A container is defined by its image and any configuration options that are provided to it at creation or startup . After deleting the container , State changes that are not stored in permanent storage will disappear .Docker Container by Docker Image to create .
The relationship between image and container , It's like classes and instances in object-oriented programming , Image is a static definition , Containers are entities that mirror the runtime . Containers can be created 、 start-up 、 stop it 、 Delete 、 Pause and wait . Closing the container does not delete the container file , It's just that the container stops running . Terminate the running container file , It will still occupy the hard disk space .
The essence of a container is a process , But unlike processes that execute directly on the host , Container processes run in their own separate namespace . So you can have your own container root file system 、 Own network configuration 、 Own process space 、 Even their own users ID Space . The process in the container is running in an isolated environment , Use up , It's like operating on a host independent system .
The mirror uses tiered storage , So is the container . Each container runs , It's a mirror based layer , Create a storage layer on it for the current container , We can call this storage layer prepared for container read-write at runtime as container storage layer . The lifetime of the container storage layer is the same as that of the container , When the container dies , The container storage layer also dies . therefore , Any information saved in the container storage layer will be lost with the deletion of the container .
according to Docker Best practice requirements , The container should not write any data to its storage layer , Container storage layer should be kept stateless . All file write operations , Data volume should be used (Volume)、 Or bind the host Directory , Reading and writing at these locations skips the container storage layer , Directly to the host ( Or networked storage ) Reading and writing happen , Its performance and stability are higher . The lifetime of a data volume is independent of the container , The container dies , Data volumes don't die . therefore , After using the data volume , After the container is removed or re run , Data is not lost .
Docker You need to have a local image before running the container , If the image does not exist locally ,Docker The image will be downloaded from the image repository . Containers are based on mirrors , Add another layer of container storage , To make such a multi-layer storage structure to run . So if the image is dependent on this container , Then deletion must lead to failure . If these containers are not needed , They should be deleted first , And then delete the image .
When we run a container ( If you don't use volumes ), Any file changes we make will be recorded in the container storage layer . and Docker Provides a ”docker commit” command , You can save the storage layer of the container as a mirror . let me put it another way , On the basis of the original image , Add the storage layer of the container , And form a new image . When we run this new image in the future , Will have the last file change of the original container .
There are two ways to start a container , One is to create a new container based on the image and start it , The other one is going to be in the terminate state (stopped) Restart the container of . because Docker The container is so lightweight , Most of the time, users delete and create containers at any time .
Docker Container and LXC The container is very similar , The security features provided are similar . When used docker run When you start a container , Backstage Docker Create a separate set of namespace and control groups for the container . The namespace provides the most basic and direct isolation , Processes running in containers are not discovered and acted upon by processes running on the host and other containers . Each container has its own unique network stack , Means they can't access other containers sockets Or interface . however , If the corresponding settings are made on the host system , Containers can interact with other containers just as they interact with hosts . When specifying a public port or using links To connect 2 When it's a container , The containers can communicate with each other ( Policies that can be configured to limit communication ).
Mirror image can be understood as a construction time (build-time) structure , A container can be understood as a runtime (run-time) structure . You can start one or more containers from a single mirror .
C. service (Services): So you can be in more than one Docker Extending containers between daemons , These daemons can all work with multiple managers and staff . colony (swarm) Every member of is Docker Daemon , All daemons use Docker API communicate . Services allow you to define the required state , For example, the number of copies of a service that must be available at any given time . By default , The service is load balanced across all work nodes (load-balanced) Of . For consumers ,Docker The service seems to be a separate application .Docker Engine stay Docker 1.12 Cluster mode is supported in and above (swarm mode).
Docker host (Host): A physical or virtual machine is used to execute Docker Daemons and containers .
Docker The underlying technology :Docker Yes, it is Go Programming language , utilize Linux Several features of the kernel to deliver its functionality .
(1). Namespace (Namespaces):Docker Use a technique called a namespace to provide an isolated workspace called a container . When running the container ,Docker A set of namespace is created for the container . These provide a layer of isolation . Each aspect of the container runs in a separate namespace , And access to it is limited to the namespace . The namespace is Linux A powerful feature of the kernel . Each container has its own separate namespace , The applications running in it are like running in a separate operating system . The namespace ensures that containers do not affect each other .Docker Engine stay Linux Use the following namespace on :
A.pid Namespace : Process isolation (PID: process ID).
B.net Namespace : Manage network interfaces (NET: The Internet ).
Docker Allows network services to be provided through external access to containers or container interconnections . Some network applications can run in the container , Make these applications accessible to the outside world , Can pass -P or -p Parameter to specify the port mapping .
By default , Containers can actively access connections to external networks , But the external network cannot access the container . Container all connections to external networks , The source address will be NAT Local system IP Address . This is the use of iptables The source address camouflage operation of .
C.ipc Namespace : Management is right IPC Access to resources (IPC: Interprocess communication ).
D.mnt Namespace : Managing file system mount points (MNT:mount).
E.uts Namespace : Isolate kernel and version identifier (UTS:Unix Time sharing system ).
(2). Control group (Control groups, cgroups):Linux Upper Docker The engine also relies on another technology called control groups .cgroup Limit the application to a specific set of resources . The control group allowed Docker Engine Sharing available hardware resources to containers , And selectively impose restrictions and constraints . for example , You can limit the memory available for a particular container .
The control group is Linux Another key component of the container mechanism , Responsible for the audit and limitation of resources . It provides a lot of useful features , And make sure that each container can share the host's memory fairly 、CPU、 disk IO And so on , Of course , what's more , The control group ensures that the host system is not compromised when the use of resources in the container is under pressure .
(3). Federated file system (Union file systems, or UnionFS): By creating layers (layers) The file system that operates , Make it very light and fast .Docker Engine Use UnionFS Provide building blocks for containers .Docker Engine Multiple can be used UnionFS variant , Include AUFS、btrfs、vfs and DeviceMapper.
UnionFS It's a kind of layering 、 Lightweight and high performance file system , It supports changes to the file system as a single commit layer upon layer , At the same time, you can mount different directories to the same virtual file system (unite several directories into a single virtual filesystem). The federated file system is Docker The foundation of the mirror . Images can be inherited by layering , Based on the basic image ( No father image ), Can make a variety of specific application image . in addition , Different Docker Containers can share some of the underlying file system layers , At the same time, add their own unique change layer , Greatly improve the efficiency of storage .
(4). Container format (Container format):Docker Engine Put the namespace 、 Control group and UnionFS Combined into a wrapper called container format . The default container format is libcontainer. future ,Docker It can be done through BSD Jails or Solaris Zones To support other container formats .
Docker Compose: Is used to define and run multiple containers Docker Application tools . adopt Compose, You can use YAML File to configure all the services the application needs , And then by using a command , You can create and start all services .Compose Three steps to use :
(1). Use Dockerfile Define the environment of the application ;
(2). Use docker-compose.yml Define the services that make up the application , So they can run together in an isolated environment ;
(3). Last , perform docker-compose up Command to start and run the entire application .
Docker Compose yes Docker Official layout (Orchestration) One of the project , Responsible for rapid deployment of distributed applications .Compose Location is ” Define and run multiple Docker Application of containers (Defining and running multi-container Docker applications)”, Its predecessor is open source project Fig.Compose Allow users to pass through a single docker-compose.yml Template file (YAML Format ) To define a set of associated application containers as a project (project).Compose Support Linux、Mac、Windows10 Three platforms .Compose Can pass Python Package management tools pip Installation , You can also download the compiled binary file directly , Even directly in Docker Running in the container .
Docker Swarm: yes Docker Cluster management tool , Its main function is to turn a number of Docker The host is abstracted as a whole , And manage these through a single portal Docker All kinds of things on the mainframe Docker resources . It will Docker The host pool becomes a single virtual Docker host .Docker Swarm Provided with standard Docker API, All that has been associated with Docker Tools for daemons to communicate can be used Swarm Easily scale to multiple hosts .Swarm The cluster is managed by the node (manager) And work nodes (work node) constitute :
(1).swarm manager: Responsible for the management of the whole cluster, including cluster configuration 、 Service management and all the work related to cluster .
(2).work node: It is mainly responsible for running the corresponding services to perform tasks (task).
Swarm Mode: Refer to Docker Cluster management and choreography functions embedded in the engine . When you initialize a swarm(cluster) Or add nodes to a swarm when , Its Docker The engine will start with swarm mode Form operation .Swarm Mode built-in kv Storage function , There are many new features , such as : Decentralized design with fault tolerance 、 Built in service discovery 、 Load balancing 、 Routing grid 、 Dynamic scaling 、 Scroll to update 、 Secure transmission, etc .
Docker Machine: yes Docker Official layout (Orchestration) One of the project , Responsible for fast installation on multiple platforms Docker Environmental Science , It's a simplification Docker Command line tools installed , It can be installed on the corresponding platform through a simple command line Docker, And can be used docker-machine Command to manage the host .Docker Machine You can also centrally manage all of docker host , For example, give quickly 100 Server installation docker.Docker Machine The managed virtual host can be on-board , It can also be a cloud provider , Such as ali cloud 、 Tencent cloud . Use docker-machine command , You can start 、 Check 、 Stop and restart the managed host , You can also upgrade Docker Clients and daemons , As well as the configuration Docker The client communicates with your host .
install Docker Machine It needs to be installed before Docker, Can be in accordance with the Install according to the instructions in .
Docker Hub: Warehouse (Repository) It's a place where images are centrally stored . at present Docker The government maintains a public warehouse Docker Hub. More than Docker Hub, It's just that remote service providers are different , The operation is the same . Most of the requirements can be met through Docker Hub Download the image directly to realize . step :
(1). register : stay Sign up for a free Docker account number ;
(2). Login and logout : Login requires a user name and password , After successful login , We can go from Docker Hub Pull up and get all the images under your account :
sign out :$ docker logout
Can pass docker search Command to find the image in the official warehouse , Such as ubuntu Search for keywords :$ docker search ubuntu
utilize docker pull Command to download it locally :$ docker pull ubuntu
After logging in , It can be done by docker push Command to push your own image to Docker Hub, among username For their own Docker Account name :$ docker push username/ubuntu:18.04
Docker There are two file formats :Dockerfile and Compose file.Dockerfile Defines the contents of a single container and the behavior at startup .Compose file Defines a multi container application .
(1).Dockerfile:Docker According to Dockerfile The content of , Build images automatically .Dockerfile It's the text that contains all the commands the user wants to build the image .
Dockerfile It's a text file , It contains a line of instructions (Instruction), Each instruction builds a layer , So the content of each instruction , That describes how the layer should be built .
(2).Compose file : It's a YAML file , Defined Services (service)、 The Internet 、 volume (volume).
Docker By default , All files will be stored in a writable container layer in the container (container layer). Containers have two ways of permanent storage : volume (volumes) And binding mount (bind mounts). in addition ,Linux Users can also use tmpfs Mount ;Windows Users can also use the command pipeline (named pipe). In the container , Whatever kind of permanent storage , The form of expression is the same .
(1). volume (volumes): Is part of the host machine's file system , from Docker Conduct management ( stay Linux, Store in /var/lib/docker/volumes/). Not Docker The program should not modify these files .Docker It is recommended to use volumes to persist data . Volume can support volume drive (volume drivers), The driver allows users to store data to a remote host or cloud service provider (cloud provider) Or other . A volume without a name is called an anonymous volume (anonymous volume), A volume with a name is called a named volume (named volume). The anonymous volume doesn't have a clear name , When initialized , Will be given a random name .
A volume is a special directory that can be used by one or more containers , It bypasses UFS, There are many useful features available :A. Volumes can be shared and reused between containers ;B. Changes to the volume will take effect immediately ;C. Updating the volume , It doesn't affect the mirror image ;D. By default, the volume will always exist , Even if the container is deleted .
The use of volumes , Be similar to Linux Proceed to the directory or file below mount, The files in the directory designated as mount point in the image are copied to the volume ( Copy only when the volume is empty ). Volumes are designed to persist data , Its lifecycle is independent of the container ,Docker The volume is not automatically deleted after the container is deleted , And there's no garbage collection mechanism to handle volumes that don't have any container references .
(2). Bind mount (bind mounts): By mounting the path of the host machine into the container , Thus data persistence , So a bind mount can store data anywhere in the host machine's file system . Not Docker The program can modify these files . Binding mount is Docker Early on , Compared to rolling up , Binding mount is very simple and straightforward . Developing Docker When applied , Named volumes should be used (named volume) Mount instead of binding , Because the user cannot mount the binding Docker CLI The command operation .
Binding mount is often used for :A. Synchronize profile , Such as : Will host host host's DNS The configuration file (/etc/resolv.conf) Synchronize to the container ;B. When developing programs , Source code or Artifact Synchronize to the container . This usage is similar to Vagrant similar .
(3).tmpfs mount (tmpfs mouts): It's just stored in memory , Does not operate the host machine's file system ( Not persistent on disk ). It can be used to store some non persistent state 、 sensitive data .
(4). name pipes (named pipes): adopt npipe The form of mounting , send Docker Host and container can communicate with each other . A common use case is to run a third-party tool within a container , And use named pipes to connect to Docker Engine API.
(5). Cover the problem : When mounting an empty volume into a directory , The contents of the directory are copied into the volume ( Will not cover ). If you mount a non empty volume or bind to a directory , Then the contents of the directory will be hidden (obscured), When unloaded, the content will be displayed again .
journal : Under default configuration ,Docker Log ( Such as :docker logs、docker service log) What is recorded is the output of the command line (STDOUT and STDERR). and STDOUT and STDERR The corresponding file paths are /dev/stderr and /dev/stdout. in addition , You can also view the container log on the host .
All of the above are from the network , Main reference :
1.
2.
3.
4. | https://javamana.com/2020/11/20201109082900537a.html | CC-MAIN-2022-21 | refinedweb | 5,709 | 52.39 |
To understand ROT13, imagine an analog clock face. Instead of the numbers one to twelve, this face has the letters A to Z. To get the secret code for any letter, find the letter on the clock face and advance 13 spots. For example, A becomes N, and X becomes K.
Implementing ROT13 is straightforward with the tr command in Unix:
tr A-Za-z N-ZA-Mn-za-mThe word anagram comes from a Greek word for shuffling letters. What about gyrigrams, pairs of words equivalent up to ROT13? (The Greek word γυρίζω means turn or return, so it indicates rotation and also the cipher's symmetry.)
This post is a literate Haskell program that will find interesting gyrigrams in a dictionary file. Copy-and-paste it into a file named gyrigram.lhs to get a runnable program.
Some front matter:
> module Main where > import Data.Char (toLower) > import Data.List (sort) > import qualified Data.Map as M > import qualified Data.Set as S > import System.Environment (getArgs, getProgName) > import System.Exit (ExitCode(ExitFailure), exitWith) > import System.IO (hPutStrLn, stderr)To run the program, either provide the path to your dictionary file as the sole command-line argument, or omit it to use /usr/share/dict/words:
> usage :: IO a > usage = do > me <- getProgName > hPutStrLn stderr $ "Usage: " ++ me ++ " [ dictionary ]" > exitWith (ExitFailure 1)The implementation of rot13 below performs a table lookup for all characters in the input. Characters outside the set [A-Za-z] pass through unchanged.
> rot13 :: String -> String > rot13 = map $ \c -> maybe c id (M.lookup c table) > where table = M.fromList $ zip (uc ++ lc) (uc' ++ lc') > (uc, lc) = (['A'..'Z'], ['a'..'z']) > (uc', lc') = (rot uc, rot lc) > rot xs = [drop,take] >>= \f -> f 13 xsTo find all gyrigrams, we stuff the input list, normalizing to lowercase, in a Set for quick lookups. Then for each word in the input, probe for its rot13 counterpart and add hits to the result. Removing matches from the dictionary prevents duplicated values. Note also that we ignore single-letter words.
> gyrigrams :: [String] -> [(String,String)] > gyrigrams xs = go dict xs > where go _ [] = [] > go d (w:ws) > | d `has` w' = (w,w') : go d' ws > | otherwise = go d ws > where has = flip $ S.member . lc > w' = rot13 w > d' = foldr (S.delete . lc) d [w,w'] > dict = S.fromList $ map lc $ filter ((>1) . length) xs > lc = map toLowerThe main program reads the input and prints a sorted list of pairs:
> main :: IO () > main = > getPath >>= readFile >>= mapM_ (putStrLn . show') . > sort . gyrigrams . lines > where show' (a,b) = a ++ " => " ++ bArgument processing:
> getPath :: IO FilePath > getPath = getArgs >>= go > where go [path] = return path > go [] = return "/usr/share/dict/words" > go _ = usageOne pair is especially interesting because they're both gyrigrams and synonyms: irk and vex.
2 comments:
I like "green" and "Terra" as anagrams. Also "Pres" and "Cerf" -- Vint for president?
Here's my version of the program:
import Data.Char
import Data.List
import qualified Data.Set as S
rot13 :: Char->Char
rot13 c = chr $ xa + ((ord c - xa + 13)`mod`26)
where
xa | isUpper c = ord 'A'
| otherwise = ord 'a'
rot13w :: String -> String
rot13w = map rot13
main = do
f <- readFile "/usr/share/dict/words"
let ws = [map toLower w | w <- words f, length w > 2]
(front, back) = break (>= "n") (sort ws)
anagrams = (S.fromList front
`S.intersection` S.fromList (map rot13w back))
print [(a, rot13w a) | a<-S.toList anagrams]
Well that paste didn't come out too well. Here's a pastebin: | http://gbacon.blogspot.com/2009/07/gyrigrams.html | CC-MAIN-2018-22 | refinedweb | 582 | 75.81 |
Given N number of students and an array which represent the mark obtained by students. School has dicided to give them teddy as a price. Hoever, school wants to save money, so they to minimize the total number of teddies to be distrubuted by imposing following constrain −
Let us suppose there are 3 students and marks obtained are represented in array as −
arr[] = {2, 3, 3} So, total number of teddies to be distributed: {1, 2, 1} i.e. 4 teddies
This problem can be solved using dynamic programming as follows −
1. Create a table of size N and initialize it with 1 as each student must get atleast one teddy 2. Iterate over marks array and perform below step: a. If current student has more marks than previous student then: i. Get the number of teddies given to the previous student ii. Increment teddie count by 1 b. If current student has lesser marks than previous student then: i. Review and change all the values assigned earlier
#include <iostream> #include <algorithm> #define SIZE(arr) (sizeof(arr) / sizeof(arr[0])) using namespace std; int teddieDistribution(int *marks, int n) { int table[n]; fill(table, table + n, 1); for (int i = 0; i < n - 1; ++i) { if (marks[i + 1] > marks[i]) { table[i + 1] = table[i] + 1; } else if (marks[i] > marks[i + 1]) { int temp = i; while (true) { if (temp >= 0 && (marks[temp] > marks[temp + 1])) { if (table[temp] > table[temp + 1]) { --temp; continue; } else { table[temp] = table[temp + 1] + 1; --temp; } } else { break; } } } } int totalTeddies = 0; for (int i = 0; i < n; ++i) { totalTeddies += table[i]; } return totalTeddies; } int main() { int marks[] = {2, 6, 5, 2, 3, 7}; int totalTeddies = teddieDistribution(marks, SIZE(marks)); cout << "Total teddies to be distributed: " << totalTeddies << "\n"; return 0; }
When you compile and execute above program. It generates following output −
Total teddies to be distributed: 12 | https://www.tutorialspoint.com/minimize-the-total-number-of-teddies-to-be-distributed-in-cplusplus | CC-MAIN-2021-21 | refinedweb | 313 | 55.37 |
SALVATION BIBLICAL WORD GLOSSARY
By Dennis Schmidt 1/2001
RETURN TO THE: BIBLE PAPERS HOME PAGE.
This paper shows SALVATION WORDS DEFINITIONS (including Strong's Greek & Hebrew) with key scriptures where these Biblical words are found. Links to other papers, with more detailed, are also provided. All scriptures are from the King James' version Bible.
MY DOCTRINE BELIEFS: ALL KEY THEOLOGICAL AREAS WITH MY PAPERS ON EACH SUBJECT
SUBJECT CROSS INDEX Allows a search of the database by subjects (Shows Subjects Locations)
See my paper: BIBLE BOOKS AND TOPICS - SUBJECT CROSS INDEX for more information on these subjects.
ADOPTION: To place another' child (unbeliever) as one's own to become a son with legal son-ship rights. The means for a begotten (born again) child of God (saved believer) to become a mature Son of God.
Also see my paper: What is a Born Again & How to Become One? for more information on this subject.
G5206. huiothesia, hwee-oth-es-ee'-ah; from a presumed comp. of G5207 and a der. of G5087; the placing as a son, i.e. adoption (fig. Chr. sonship in respect to God):--adoption (of children, of sons).
- In the Jewish religion, a boy of 13 is bar mitzah (son of the covenant) & girl - bat mitzah.
Mark 14:36 "And he said, Abba, Father, all things are possible unto thee; take away this cup from me: nevertheless not what I will, but what thou wilt."
- Jesus is our example as the unique only begotten mature Son to His Father.." G5206
- Son-ship mature children of God are heirs and joint-heirs with Jesus.." G5206
-The creation is waiting for the manifested Sons of God (Romans 8:19) by adoption.
Romans 9:3-4 "For I could wish that myself were accursed from Christ for my brethren, my kinsmen according to the flesh: {4} Who are Israelites; to whom pertaineth the adoption, and the glory, and the covenants, and the giving of the law, & the service of God, & the promises;" G5206
- This compares Israel's relationship with God to the adopted child (Hosea 11:1/Exodus 4:22).." G5206
- The adopted child of God, by the Holy Spirit, cries out Abba, Father as a heir & Son of God.
Ephesians" G5206
- Adoption here should be begotten since the child of God is begotten. Adoption is for Son-ship.
ADVOCATE (COMFORTER): See MEDIATOR/INTERCESSOR Spokesman (advocate) on behalf of of the people toward God.
Also see my paper: Triunity for more information on this subject.
Also see my paper: Holy Spirit Baptism for more information on this subject.
G3875. parakletos, par-ak'-lay-tos; an intercessor, consoler:--advocate, comforter. To standby you.
John 14:16 "And I will pray the Father, and he shall give you another Comforter, that he may abide with you for ever;" G3875
John 14:26 "But the Comforter, which is the Holy Ghost, whom the Father will send in my name, he shall teach you all things, and bring all things to your remembrance, whatsoever I have said unto you." G3875
John 15:26 "But when the Comforter is come, whom I will send unto you from the Father, even the Spirit of truth, which proceedeth from the Father, he shall testify of me:" G3875
John 16:7 "Nevertheless I tell you the truth; It is expedient for you that I go away: for if I go not away, the Comforter will not come unto you; but if I depart, I will send him unto you." G3875
1 John 2:1 "My little children, these things write I unto you, that ye sin not. And if any man sin, we have an advocate with the Father, Jesus Christ the righteous:" G3875
- Jesus, as our advocate, has already sacrifice His blood to the Father who gives whatever He asks.
ATONEMENT: In New Testament = Reconciation. See PROPITIATION/SATISFACTION Means to cover or expiate, by the blood, which appeases or propitiates God wrath on man. The blood reconciles God with man and bring man to a renewed relationship with God.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
- The Old Testament has a day of Atonement (Yom Kippur) once a year. 17:11 "For the life of the flesh is in the blood: and I have given it to you upon the altar to make an atonement for your souls: for it is the blood that maketh an atonement for the soul."
- God required a life (animal and later Jesus) for the atonement of man's sins. & the sin offering should be made for all Israel."3722
- This is the sacrifice that the Old Testament priest offered as an atonement for man's sins.
G2643. katallage, kat-al-lag-ay'; from G2644; exchange (fig. adjustment), i.e. restoration to (the divine) favor:--atonement, reconciliation (-ing).
Romans 5:8-12 :" G2643 Atonement here means reconciliation.
- The word here atonement should be reconciliation to restore a relationship between God & man.
BEGOTTEN: See SALVATION & REGENERATION also. This is the new birth experience.
Also see my paper: What Is a Born-Again & How to Become One? for more information on this subject.
G1080. gennao, ghen-nah'-o; from a var. of G1085; to procreate (prop. of the father, but by extens. of the mother); fig. to regenerate:--bear, beget, be born, bring forth, conceive, be delivered of, gender, make, spring.
1 John 5:1 "Whosoever believeth that Jesus is the Christ is born of God: and every one that loveth him that begat loveth him also that is begotten of him." G1080 (all three)
- The Christian is brought forth from sinner to believer by the power of the Holy Spirit.
CONVERSION: See REGENERATION also. To return or turn back the person to God.
Also see my paper: What Is a Born-Again & How to Become One? for more information on this subject..
Isaiah 6:10 "Make the heart of this people fat, and make their ears heavy, and shut their eyes; lest they see with their eyes, and hear with their ears, and understand with their heart, and convert, and be healed." H7725
- The unbeliever is given an instantaneous experience of their eyes, ears & heart opened by God.
G1994. epistrepho, ep-ee-stref'-o; from G1909 and G4762; to revert (lit., fig. or mor.):--come (go) again, convert, (re-) turn (about, again).
Mark 4:12 "That seeing they may see, and not perceive; and hearing they may hear, and not understand; lest at any time they should be converted, & their sins should be forgiven them."1994." G1994
- The word implies a turning from (repent) & a turning to (faith in God).
EXPIATION: See PROPITIATION The way to remove the guilt by penalty payment.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
FAITH: Complete trust or belief on God or another person. Also reliance or depended upon.
Also see my paper: Faith for more information on this subject.
H530. 'emuwnah, em-oo-naw'; or (short.) 'emunah, em-oo-naw'; fem. of H529; lit. firmness; fig. security; mor. fidelity:--faith (-ful, -ly, -ness, [man]), set office, stability, steady, truly, truth, verily.
Habakkuk 2:4 "Behold, his soul which is lifted up is not upright in him: but the just shall live by his faith."
- Abraham, Father of faith, lived a life of faith or trust of God for every need. This is asked of us.
G4. BELIEVING in 1 Peter 1:8
G4102. pistis, pis'-tis; from G3982; persuasion, i.e. credence; mor. conviction (of religious truth, or the truthfulness of God or a religious teacher), espec. reliance upon Christ for salvation; abstr. constancy in such profession; by extens. the system of religious (Gospel) truth itself:--assurance, belief, believe, faith, fidelity.
Corinthians 13:13 "And now abideth faith, hope, charity, these three; but the greatest of these is charity." H4102
- Faith is included in the big three truths for how a Christian should live.
Hebrews 11:1 "Now faith is the substance of things hoped for, the evidence of things not seen."
- Faith is the substance (same Greek word used in Hebrews 1:3 as person for Jesus) which is a real person as is a real substance in the faith dimension until God moves it to this dimension.
Hebrews 11:6 "But without faith it is impossible to please him: for he that cometh to God must believe that he is, and that he is a rewarder of them that diligently seek him." H4102
- Faith is the means to please God. This results in a blessing as a reward.
1 Peter 1:8-9 "Whom having not seen, ye love; in whom, though now ye see him not, yet believing, ye rejoice with joy unspeakable and full of glory: {9} Receiving the end of your faith, even the salvation of your souls." believing = G4100; faith = G4102
- Faith is believing, though you do not see, which includes acting on your faith in love & trust.
GOSPEL: Good news, preached, of the righteousness of God through Jesus as the only saving means, without man's effort, by the life, ministry, death & resurrection of God's unique Son Jesus.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
Also see my paper: Man's Greatest Need - Relationship with God for more information on this subject.
G2097. euaggelizo, yoo-ang-ghel-id'-zo ); from G2095 and G32; to announce good news ("evangelize") espec. the gospel:--declare, bring (declare, show) glad (good) tidings, preach (the gospel).
1st KEY SCRIPTURE: Gospel is power of God by His righteousness to salvation through faith:2098
- Righteousness of God, by Jesus, as only means to salvation to those who believe
Salvation is dependent only on God & not on the sinner, nor can the sinner do anything for it
2nd KEY SCRIPTURE: Gospel is Jesus life and ministry that Christian's receive for salvation:" G2098
- Gospel of Christ for salvation in Jesus righteousness in His death, burial & resurrection?" G2098
- Gospel is the life & ministry of Jesus with the imputed righteousness of Jesus reckon to believers.
GRACE: Unmerited flavor/blessings from God
Also see my paper: Grace for more information on this subject.
H2580. chen, khane; from H2603; graciousness, i.e. subj. (kindness, favor) or objective (beauty):--favour, grace (-ious), pleasant, precious, [well-] favoured.
Genesis 6:8 "But Noah found grace in the eyes of the LORD." H2580
- Noah was favored by God to be the instrument to bring salvation to his family and animals.
Proverbs 3:34 "Surely he scorneth the scorners: but he giveth grace unto the lowly." H2580
- God blesses those that are lowly and meek.
G5485. charis, khar'-ece; from G5463; graciousness (as gratifying), of manner or act (abstr. or concr.; lit., fig. or spiritual; espec. the divine influence upon the heart, and its reflection in the life; including gratitude):--acceptable, benefit, favour, gift, grace (-ious), joy liberality, pleasure, thank (-s, -worthy).
Ephesians 2:8-9 "For by grace are ye saved through faith; and that not of yourselves: <it is> the gift of God: {9} Not of works, lest any man should boast." G5485
- God gives grace & we believe unto salvation. It is a gift of God and not of man's work.
1 Peter 5:5 "Likewise, ye younger, submit yourselves unto the elder. Yea, all of you be subject one to another, and be clothed with humility: for God resisteth the proud, and giveth grace to the humble." G5485
- God resists the proud and blesses by His grace those that are humble & those subject to others.
HOLY: See PERFECTION & SANCTIFICATION Pure, consecrated, blameless, sacred, saint, hallow
Also see my paper: Walk As Jesus Walked for more information on this subject.
Also see my paper: Christian Growth for more information on this subject.
H6918. qadowsh, kaw-doshe'; or qadosh, kaw-doshe'; from H6942; sacred (ceremonially or morally); (as noun) God (by eminence), an angel, a saint, a sanctuary:--holy (One), saint.
Leviticus 11:45 "For I am the LORD that bringeth you up out of the land of Egypt, to be your God: ye shall therefore be holy, for I am holy." H6918
- The believer is to strive to be pure, consecrated, and holy as a representative of God.
H6944. qodesh, ko'-desh; from H6942; a sacred place or thing; rarely abstr. sanctity:--consecrated (thing), dedicated (thing), hallowed (thing), holiness, (X most) holy (X day, portion, thing), saint, sanctuary.
Isaiah 63:8-12 ?" H6944
- God, the Holy Spirit is hallow, consecrated, and blameless without any evil.
G40. hagios, hag'-ee-os; from hagos (an awful thing) [comp. G53, H2282]; sacred (phys. pure, mor. blameless or religious, cer. consecrated):--(most) holy (one, thing), saint.
Mark 1:8 "I indeed have baptized you with water: but he shall baptize you with the Holy Ghost."
- God's Holy Spirit is perfectly pure and without fault since God has done no evil.
IMPUTATION: Means the merits of Christ are legally charged to the Christian, to his account. He is saved, justified, made a child and heir with Jesus. Jesus righteousness, through God's grace, entitled the Christian to all that salvation offers of eternal life both on earth and in heaven. The Christian does not have a righteousness within himself. He gains Christ's righteousness. The Christian's sins are also imputed to Christ. Christ does not have sin within Himself. Jesus bears our sins.
- Other words for imputed are: reckon, count, made, charge, declare, & credit to another account.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
Also see my paper: Imputed/Reckoned/Counted Righteousness of Jesus for more information on this subject.
H2803. chashab, khaw-shab'; a prim. root; prop. to plait or interpenetrate, i.e. (lit.) to weave or (gen.) to fabricate; fig..
Genesis 15:6 "And he believed in the LORD; & he counted it to him for righteousness."H2803
- Abraham believed God for a child - Issac & God counted (Imputed) his faith for righteousness.
G1677. ellogeo, el-log-eh'-o; from G1722 and G3056 (in the sense of account); to reckon in, i.e. attribute:--impute, put on account.
Philemon 18-19 " G1677 (Imputed) = put, on, & account
- Charge to Paul, Onesimus (run away slave) debt, who would repay any loss to Philemon's. God's used Paul as the instrument to lead Philemon to salvation thereby Philemon owned Paul a greater debt.
G3049. logizomai, log-id'-zom-ahee; mid. from G3056; to take an inventory, i.e. estimate (lit. or fig.):--conclude, (ac-) count (of), + despise, esteem, impute, lay, number, reason, reckon, suppose, think (on).3049
- God by grace offers to impute righteousness in place of the our sin & forgives & covers our sins." G3049
- Imputed righteousness of God to those that believe in the ministry of Jesus.
IMPUTED RIGHTEOUSNESS TRANSFERRED FOR OUR SINS:
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
Also see my paper: Imputed/Reckoned/Counted Righteousness of Jesus for more information on this subject.
2 Corinthians 5:21 "For he hath made him to be sin for us, who knew no sin; that we might be made the righteousness of God in him" G1343 = Righteousness; 1st sin is sin offering
- Jesus was imputed with man's sin, but he did not sin Himself. The imputation of our sins to Jesus, and His righteousness imputed to us is the means of making the Gospel personal to us. It is not the historical facts of Jesus death, burial, & resurrection which regenerates us, but the regenerative act by God in us.
Philippians 3:6-10 , & the power of his resurrection, & the fellowship of his sufferings, being made conformable unto his death"
- Paul's works were as dung as compared with God's righteousness being excellent.
INTERCESSOR: See MEDIATOR/ADVOCATE Spokesman on behalf of of the people toward God.
Also see my paper: Triunity for more information on this subject.
Also see my paper: Holy Spirit Baptism for more information on this subject.
H6293. paga', paw-gah'; a prim. root; to impinge, by accident or violence, or (fig.) by importunity:--come (betwixt), cause to entreat, fall (upon), make intercession, intercessor, intreat, lay, light [upon], meet (together), pray, reach,." H6293
G1793. entugchano, en-toong-khan'-o; from G1722 and G5177; to chance upon, i.e. (by impl.) confer with; by extens. to entreat (in favor or against):--deal with, make intercession.." From G1793
- The Bible shows God's will. The Holy Spirit prays with our tongue, heart & mind God's will.
Romans 8:34 "Who is he that condemneth? It is Christ that died, yea rather, that is risen again, who is even at the right hand of God, who also maketh intercession for us." G1793
- Jesus, our lawyer or attorney, is provided the ear of God who will give us whatever Jesus asks.
JUSTIFICATION: Count, impute, or declare one as righteous through the atonement of Jesus.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
Also see my paper: Justification for more information on this subject.
Also see my paper: Justification of Faith - Old Testament Doctrine for more information on this subject.
H6663. tsadaq, tsaw-dak'; a prim. root; to be (causat. make) right (in a moral or forensic sense):--cleanse, clear self, (be, do) just (-ice, -ify, -ify self), (be, turn to) righteous (-ness).
Isaiah 53:11 "He shall see of the travail of his soul, and shall be satisfied: by his knowledge shall my righteous servant justify many; for he shall bear their iniquities." H6663
G1344. dikaioo, dik-ah-yo'-o; from G1342; to render (i.e. show or regard as) just or innocent:--free, justify (-ier), be righteous.
Romans 3:30-4:3 "Seeing it is one God, which shall justify the circumcision by faith, and uncircumcision through faith. {31} Do we then make void the law through faith? God forbid: yea, we establish the law. ." G1344
- Justified by faith by imputed righteousness of Christ given us by God's grace and not our works.." G1344
- Acquittal from guilt of our sins by the faith of Jesus (His righteous) & not by our efforts - works.
MEDIATOR: See INTERCESSOR/ADVOCATE Spokesman on behalf of the people toward God.
Also see my paper: Triunity for more information on this subject.
Also see my paper: Holy Spirit Baptism for more information on this subject.
G3316. mesites, mes-ee'-tace; from G3319; a go-between, i.e. (simply) an internunciator, or (by impl.) a reconciler (intercessor):--mediator.
1 Timothy 2:5-6 "For there is one God, and one mediator between God and men, the man Christ Jesus; {6} Who gave himself a ransom for all, to be testified in due time." G3316
- Jesus suffered being tempted so that He can sympathize with believers as our intercessor.
MERCY: Not getting, from God, what we deserve for our sins (justice & punishment).
Also see my paper: Ephesians 1:2 for more information on this subject.
H2617. checed, kheh'-sed; from H2616; kindness; by impl. (towards God) piety; rarely (by opp.) reproof, or (subject.) beauty:--favour, good deed (-liness, -ness), kindly, (loving-) kindness, merciful (kindness), mercy, pity, reproach, wicked thing.
Genesis 19:19 "Behold now, thy servant hath found grace in thy sight, and thou hast magnified thy mercy, which thou hast showed unto me in saving my life; and I cannot escape to the mountain, lest some evil take me, and I die:" H2617
- Mercy is not getting what we deserve as grace (blessings) is getting what we do not deserve.
G1653. eleeo, el-eh-eh'-o; from G1656; to compassionate (by word or deed, spec. by divine grace):--have compassion (pity on), have (obtain, receive, shew) mercy (on).." G1653
- Mercy is a gift, from God, and God will determine to whom it is given.
PEACE: Rest & reassurance, in the Lord, that God has everything under His control.
Also see my paper: Galatians 1:1 for more information on this subject.
H79.
Isaiah 55:12 "For ye shall go out with joy, and be led forth with peace: the mountains & the hills shall break forth before you into singing, & all the trees of the field shall clap their hands." H7965
- God guides His people with peace, joy, singing and nature responds likewise.
G1515. eirene, i-ray'-nay; prob. from a prim. verb eiro (to join); peace (lit. or fig.); by impl. prosperity:--one, peace, quietness, rest, + set at one again.
Romans 14:17 "For the kingdom of God is not meat and drink; but righteousness, and peace, and joy in the Holy Ghost." G1515
- God's righteousness provides peace and joy in the believer.
Galatians 5:22-23 "But the fruit of the Spirit is love, joy, peace, longsuffering, gentleness, goodness, faith, {23} Meekness, temperance: against such there is no law." G1515
- A relationship with God provides Holy Spirit fruits of joy, peace and love among many blessings.
PERFECTION: Growth unto a mature Christian who is pure, holy, complete in the Holy Spirit.
Also see my paper: Walk As Jesus Walked for more information on this subject.
Also see my paper: Christian Growth for more information on this subject.
H8003. shalem, shaw-lame'; from H7999; complete (lit. or fig.); espec. friendly:--full, just, made ready, peaceable, perfect (-ed), quiet, Shalem [by mistake for a name], whole.
1 Kings 8:61 "Let your heart therefore be perfect with the LORD our God, to walk in his statutes, and to keep his commandments, as at this day." H8003
- The commandment is to love the Lord with all thy heart, mind & soul. Love neighbor as self.
H8549. tamiym, taw-meem'; from H8552; entire (lit., fig. or mor.); also (as noun) integrity, truth:--without blemish, complete, full, perfect, sincerely (-ity), sound, without spot, undefiled, upright (-ly), whole.
Genesis 17:1, & thou shalt be a father of many nations. {5} Neither shall thy name any more be called Abram, but thy name shall be Abraham; for a father of many nations have I made thee." H8549
- Perfect in faith. Abraham believed God and it was counted for his righteousness.
G5046. teleios, tel'-i-os; from G5056; complete (in various applications of labor, growth, mental and moral character, etc.); neut. (as noun, with G3588)
Matthew 5:48 "Be ye therefore perfect, even as your Father which is in heaven is perfect."5046
- Perfection as believing in righteousness of Jesus by faith in God the Father.
G5048. teleioo, tel-i-o'-o; from G5046; to complete, i.e. (lit.) accomplish, or (fig.) consummate (in character):--consecrate, finish, fulfil, (make) perfect.
John 17:23 "I in them, and thou in me, that they may be made perfect in one; and that the world may know that thou hast sent me, and hast loved them, as thou hast loved me." G5048
- Jesus in us as Jesus and the Father are one having the perfect love of God because God is love.
G5051. teleiotes, tel-i-o-tace'; from G5048; a completer, i.e. consummater:--finisher.
Hebrews 5:13-6:3 5051
- Mature (perfection) growth in the deeper/meat principles of the doctrines of Christ as He permits
PROPITIATION/SATISFACTION: 3 Propitiation scriptures & 1 mercyseat scripture means or satisfaction is the way in which to makes reconciliation to God by an atonement.
Propitiation or satisfaction is the way to appease or avert God's wrath and justice. Both words are related to reconciliation.
Expiation is the way to remove the guilt through a payment of the penalty i.e. the death & blood of Jesus.
See my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
H3727. kapporeth, kap-po'-reth; from H3722; a lid (used only of the cover of the sacred Ark):-mercy seat.O.T. 27 Times." H3727," H3727
G2435. hilasterion, hil-as-tay'-ree-on; neut. of a der. of G2433; an expiatory (place or thing), i.e. (concr.) an atoning victim, or (spec.) the lid of the Ark (in the Temple):--mercyseat, propitiation2435
Hebrews 9:5 "And over it the cherubims of glory shadowing the mercyseat; of which we cannot now speak particularly." G2435
- Jesus Christ is our propitiation to God to satisfy our sins and expiate us by His redeeming gift.
G2434. hilasmos, hil-as-mos'; atonement, i.e. (concr.) an expiator:--propitiation.." G2434
- By Jesus Christ death, burial & resurrection; His blood was a sufficient propitiation to God for all." G2434
- God's love sent Jesus, His one and only unique Son, to be the propitiation for our sins.
G2433. hilaskomai, hil-as'-kom-ahee; mid. from the same as G2436; to conciliate, i.e. (trans.) to atone for (sin), or (intrans.) be propitious:--be merciful, make reconciliation for.
Hebrews 2:17 "Wherefore in all things it behoved him to be made like unto his brethren, that he might be a merciful and faithful high priest in things pertaining to God, to make reconciliation for the sins of the people." G2433
- As a human high priest He made a propitiation for the sins of the people.
G2436. hileos, hil'-eh-oce; perh. from the alt. form of G138; cheerful (as attractive), i.e. propitious; adv. (by Hebr.) God be gracious!, i.e. (in averting some calamity) far be it:--be it far, merciful.
RECONCILIATION: See ATONEMENT To purify, by God's grace, to restore man to right relationship.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
H23."
- This is the sacrifice that the Old Testament priest offered as an atonement for man's sins.
G2643. katallage, kat-al-lag-ay'; from G2644; exchange (fig. adjustment), i.e. restoration to (the divine) favor:--atonement, reconciliation (-ing).." G2643
- We are reconciled to God to help restore & make others aware that Jesus is our atonement.
REDEMPTION: To buy back, ransom, for a just price.
Also see my paper: What Is a Born-Again & How to Become One? for more information on this subject.
H6306. pidyowm, pid-yome'; or pidyom, pid-yome'; also pidyown, pid-yone'; or pidyon, pid-yone'; from H6299; a ransom:--ransom, that were redeemed, redemption.
Psalms 49:8 "(For the redemption of their soul is precious, and it ceaseth for ever:)"
G3085. lutrosis, loo'-tro-sis; from G3084; a ransoming (fig.):--+ redeemed, redemption.
Hebrews 9:12." G3085
- We are externally redeemed by the spotless blood of Jesus Christ for the our transgressions.
REGENERATION: (2 scriptures). See SALVATION & RELATIONSHIP also. Born (from above) into God's family by receiving Jesus as savior.
Also see my paper: What Is a Born-Again & How to Become One? for more information on this subject.
G3824. paliggenesia, pal-ing-ghen-es-ee'-ah; from G3825 and G1078; (spiritual) rebirth (the state or the act), i.e. (fig.) spiritual renovation; spec. Messianic restoration:--regeneration.
Titus 3:5-7 "Not by works of righteousness which we have done, but according to his mercy he saved us, by the washing of regeneration, & renewing of the Holy Ghost; {6} Which he shed on us abundantly through Jesus Christ our Savior; {7} That being justified by his grace, we should be made heirs according to the hope of eternal life." G3824
- Washed in the blood of Jesus & renewed by the Holy Spirit, we are justified by His grace.
RELATIONSHIP WITH GOD: See SALVATION & REGENERATION also: RECEIVE JESUS as a gift: SAVED
Also see my paper: What Is a Born-Again & How to Become One? for more information on this subject.
G1209. dechomai, dekh'-om-ahee; mid. of a prim. verb; to receive (in various applications, lit. or fig.):--accept, receive, take. Comp. G2983.
Man was created to have fellowship, as a child, with his Father God. God created man for that reason. Man can only have an abundant life when he worships God in that fellowship in spirit & truth. Man can then enjoy God's love, mercy, and grace in an everlasting relationship with his heavenly Father. God has made man as the only creature to be given a spiritual & moral nature made in God's own image. Man can think and reason. He has self awareness to fellowship with God in a spiritual life given him from above by the righteousness of God imputed by Jesus life and ministry.
Matthew 10:40-41 ." G1209
- The Christian RECEIVES JESUS as his savior and not accepts Jesus. The difference is God offers the righteousness of God as the only salvation way, and the believer will RECEIVE (regenerated heart) the offer. The unbeliever thinks he can make the decision (his works) to accept or reject the offer as the cause of his salvation.
G2983. lambano, lam-ban'-o; a prol. form of a prim. verb, which is used only as an alt. in certain tenses; to take (in very many applications, lit. and fig. [prop. obj. or act., to get hold of; whereas G1209 is rather subj. or pass., to have offered to one; while G138 is more violent, to seize or remove]):--accept, + be amazed, assay, attain, bring, X when I call, catch, come on (X unto), + forget, have, hold, obtain, receive (X after), take (away, up).
John 1:12 "But as many as received him, to them gave he power to become the sons of God, even to them that believe on his name:" G2983
- RECEIVE the gift that God offers of Jesus' complete fulfilled atonement. God regenerates the Christian & inclines the believer to understand who he is.
REPENTANCE: Turn around or return (believer) from doing evil (sinning) to good. Following God.
Also see my paper: What Does God Really Want? for more information on this subject.
H5162. nacham, naw-kham'; a prim. root; prop. to sigh, i.e. breathe strongly; by impl. to be sorry, i.e. (in a favorable sense) to pity, console, or (reflex.) rue; or (unfavorably) to avenge (oneself):--comfort (self), ease [one's self], repent (-er, -ing, self).
Jonah 3:9 "Who can tell if God will turn and repent, and turn away from his fierce anger, that we perish not?" H5162
- This use of repent is God changing and not punishing man's sins at this time..
Ezekiel 14:6 "Therefore say unto the house of Israel, Thus saith the Lord GOD; Repent, and turn yourselves from your idols; and turn away your faces from all your abominations." H7725
- Repent and turn or turn away from your sins and idols (whatever thing in your life is your god).
G278. ametameletos, am-et-am-el'-ay-tos; from G1 (as a neg. particle) and a presumed der. of G3338; irrevocable:--without repentance, not to be repented of.
Romans 11:28-30 :" G278
- God's gifts, callings & election will not be changed or repented by God for He is a merciful.
G3341. metanoia, met-an'-oy-ah; from G3340; (subj.) compunction (for guilt, includ. reformation); by impl. reversal (of [another's] decision):--repentance.
Hebrews 6:13341
- Jesus elementary principles includes repentance from our works for righteousness.
RIGHTEOUSNESS: Meeting God's standard of: being: holy, pure, justified, upright, meet, moral
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
H6664. tsedeq, tseh'-dek; from H6663; the right (nat., mor. or legal); also (abstr.) equity or (fig.) prosperity:-- X even, (X that which is altogether) just (-ice), ([un-]) right (-eous) (cause, -ly, -ness). Clean self
H6666. tsedaqah, tsed-aw-kaw'; from H6663; rightness (abstr.), subj. (rectitude), obj. (justice), mor. (virtue) or fig. (prosperity):--justice, moderately, right (-eous) (act, -ly, -ness).
Isaiah 1:27 "Zion shall be redeemed with judgment, and her converts with righteousness"H6666
- God will redeem and supply His converts with righteousness.
G1343. dikaiosune, dik-ah-yos-oo'-nay; from G1342; equity (of character or act); spec. (Chr.) justification:--righteousness. G1342 is the Greek word for Justifier.1343
- Therein (Romans 1:17) = Gospel = Righteousness of God is revealed by faith. Just = Righteous
Romans 3:211343 = Righteousness & G1342 = Justifier which words are related.
- Righteousness of God, same method used in the Old Testament, without the law or any of man's (flesh) efforts, but by faith of Jesus through God's grace man is justified and forgiven.
Romans 4:3-9 1343
- God uses the same method in the Old Testament of righteousness of God & will not impute sins.
Romans 5:17, 20-21 : {21} That as sin hath reigned unto death, even so might grace reign through righteousness unto eternal life by Jesus Christ our Lord." G1343
- They which receive grace through the gift of righteousness of God unto eternal life by Jesus." G1343
- Paul's desire was for Israel's salvation. Israel has a zeal for God, but not according to God's method. It is not enough to have zeal! Israel is not submitted to God's righteousness which is the end of the law for believer. Many people, today, have as the basis for salvation their flesh, zeal, works, & law! This is not according to God's way of righteousness. Anyone not submitted to or ignorant of the righteousness of God for salvation is not saved! Jesus has completed the perfect work for the Christian's salvation, maintaining their salvation, growth, etc.
SALVATION: See RELATIONSHIP WITH GOD, CONVERTED, & REGENERATION
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
H3444. yeshuw'ah, yesh-oo'-aw; fem. pass. part. of H3467; something saved, i.e. (abstr.) deliverance; hence aid, victory, prosperity:--deliverance, health, help (-ing), salvation, save, saving (health), welfare.
Isaiah 12:2-3 "Behold, God is my salvation; I will trust, and not be afraid: for the LORD JEHOVAH is my strength and my song; he also is become my salvation. {3} Therefore with joy shall ye draw water out of the wells of salvation." H3444
- Salvation as in saved relationship with God delivering & providing victory over Satan & world.
H3468. yesha', yeh'-shah; or yesha', yay'-shah; from H3467; liberty, deliverance, prosperity:--safety, salvation, saving.
2 Samuel 22:47 "The LORD liveth; and blessed be my rock; and exalted be the God of the rock of my salvation." H3468
- A security and safe place or God to place our trust as He is the rock to rely upon.
G4982. sozo, sode'-zo; from a prim. sos (contr. for obsol. saos, "safe"); to save, i.e. deliver or protect (lit. or fig.):--heal, preserve, save (self), do well, be (make) whole.
Matthew 1:21 "And she shall bring forth a son, and thou shalt call his name JESUS: for he shall save his people from their sins." G4982
- Jesus name means salvation for He is the source of our salvation from sins and world.
G4991. soteria, so-tay-ree'-ah; fem. of a der. of G4990 as (prop. abstr.) noun; rescue or safety (phys. or mor.):--deliver, health, salvation, save, saving.
Acts 4:12 "Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved." Salvation = G4991 Saved = G4982
- The name is Jesus which means salvation. His salvation for healing, deliverance, & preservation.
SANCTIFICATION: See HOLY also. Pure, consecrated, blameless, sacred, saint, hallow
Also see my paper: Walk As Jesus Walked for more information on this subject.
Also see my paper: Christian Growth for more information on this subject.
H69.." H6942
- Make yourself clean, pure, and consecrated to do service unto the Lord.
G37. hagiazo, hag-ee-ad'-zo; from G40; to make holy, i.e. (cer.) purify or consecrate; (mentally) to venerate:--hallow, be holy, sanctify.
John 17:16-19 ." G37
- The word of God (Bible) as a guide to help us clean & purify with the Holy Spirit working in us.
2 Thessalonians 2:13 "But we are bound to give thanks alway to God for you, brethren beloved of the Lord, because God hath from the beginning chosen you to salvation through sanctification of the Spirit and belief of the truth:" G37
- The Christian is a saint or set aside for God's purpose. The Holy Spirit guides us into all truth.
SINS COVERED: See IMPUTED also. The blessings are to the person not imputed sin.
Also see my paper: True Gospel for Salvation by the Imputed Righteousness of Jesus for more information on this subject.
H3680. kacah, kaw-saw'; a prim. root; prop. to plump, i.e. fill up hollows; by impl. to cover (for clothing or secrecy):--clad self, close, clothe, conceal, cover (self), (flee to) hide, overwhelm. Comp. H3780.
Psalms 32:1 "A Psalm of David, Maschil. Blessed is he whose transgression is forgiven, whose sin is covered." H3780
- God covers our sins by concealing them by the blood of Jesus whose righteousness we are imputed.
G1943. epikalupto, ep-ee-kal-oop'-to; from G1909 and G2572; to conceal, i.e. (fig.) forgive:--cover.
Romans 4:6-8 "Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works, {7}Saying, Blessed are they whose iniquities are forgiven, & whose sins are covered. {8} Blessed is the man to whom the Lord will not impute sin." G1943
- God forgives our sins, imputes Jesus righteousness, and all this is without our works or efforts.
This page is maintained by Dennis Schmidt. Please send your questions or comments to (dennisschmidt@att.net).
RETURN TO THE: BIBLE PAPERS HOME PAGE. | http://home.att.net/~dennisschmidt/glossary.htm | crawl-001 | refinedweb | 6,255 | 65.52 |
Solution for Why is a,b=b,b+a different then a=b b=b+a? [duplicate]
is Given Below:
Trying to create a fibonacci sequence up to “n” number, I found that the following code only doubles the last value
def fibon(n): a=0 b=1 for i in range(n): a=b b=a+b print(b)
But if done in the same line, it is able to do the correct operation
def fibon(n): a=0 b=1 for i in range(n): a,b=b,a+b print(b)
I ‘m just wondering why the second methods works, and whats the diference between the two. Thanks.
They’re different because in the second version, you’re doing the assignment atomically, using the “old” value of
a in the
a+b computation. In the first version, you’re setting
a = b first, so you’re effectively setting
b = 2*b. | https://codeutility.org/why-is-abbba-different-then-ab-bba-duplicate/ | CC-MAIN-2021-49 | refinedweb | 154 | 56.93 |
.
#include <SoftwareSerial.h> #include <Adafruit_NeoPixel.h> SoftwareSerial bt(9,8); // RX, TX int red,green,blue; Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, 7, NEO_GRB + NEO_KHZ800); void setup() { randomSeed(analogRead(0)); Serial.begin(9600); Serial.println("Lets light the world"); // set the data rate for the SoftwareSerial port - Bluetooth bt.begin(9600); //Strip LEDs strip.begin(); strip.show(); //start doing something colorSet(strip.Color(random(1,255), random(1,255), random(1,255)), 0); } void loop() { // run over and over if (bt.available() > 0) { // Get the colors int red = bt.parseInt(); // do it again: int green = bt.parseInt(); // do it again: int blue = bt.parseInt(); // look for the newline. That's the end of your if (bt.read() == '\n') { // sends confirmation bt.println("received"); // constrain the values to 0 - 255 red = constrain(red, 0, 255); green = constrain(green, 0, 255); blue = constrain(blue, 0, 255); //create some codes here: //if all 0, lets create some sequence if (red == 0 && blue == 0 and green == 0) { rainbow(150); Serial.println("Rainbow"); } else { // fill strip colorSet(strip.Color(red, green, blue), 0); Serial.println("received:"+String(red)+","+String(green)+","+String(blue)); } } } } // Fill strip with a color void colorSet(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); } strip.show(); delay(wait); } //Rainbow void rainbow(uint8_t wait) { uint16_t i, j; for(j=0; j<256; j++) { for(i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, Wheel((i+j) & 255)); }); }
And the final work
Hope you like it !
Some References
Danasf instructable | https://blog.whatgeek.com.pt/arduino-bluetooth-4-0-le-android-controlled-rgb-lamp/ | CC-MAIN-2020-16 | refinedweb | 252 | 54.69 |
I've just learned how to use write to files and output whats in them off of this site's tutorial and was wondering how to output the whole string of characters into the console window:
This program only outputs "this".This program only outputs "this".Code:#include <fstream> #include <iostream> using namespace std; int main() { char str[10]; /*creates an instance of ofstream and opens example.txt*/ ofstream a_file ( "example.txt" ); /*outputs to example.txt through a_file*/ a_file << "This is my first program using files!!!"; /*close the file stream explicitly*/ a_file.close(); /*opens the file for reading*/ ifstream b_file ( "example.txt" ); /*reads the string from the file*/ b_file >> str; /*should print this*/ cout << str << endl; cin.get(); }
Thanks for the help in advance! | https://cboard.cprogramming.com/cplusplus-programming/87691-new-fstream-ofstream.html | CC-MAIN-2017-13 | refinedweb | 124 | 68.57 |
I must do a program where there is an object that moves forward and backward.
I have created a script which takes from a file.txt a numbers sequence.
If it reads:
0 : go forward
1: go backward
2: stop
Can I write a script where I give a start position, an end position and a time for moving the object from start position to end position in (for example) 3 seconds? If it is possible, how can I do it?
My script is:
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
filename = open(‘filedati.txt’,‘r’)
line = filename.readline()
for word in line.split():
spostamenti = [int(e) for e in line.split()]
for i in spostamenti:
if spostamenti[i] == 0:
print(“forword”,own.position)
…script to move forward from [0,0,0] to [0,2,0] in 3 seconds…
elif spostamenti[i] == 1:
print(“backword”,own.position)
…script to move backward from [0,2,0] to [0,0,0] in 3 seconds…
elif spostamenti[i] == 2:
print(“stop”,own.position)
…script to stand still in the position in which the object is located…
main() | https://blenderartists.org/t/move-an-object-with-bge-script/561323 | CC-MAIN-2021-10 | refinedweb | 188 | 69.28 |
We pay for user submitted tutorials and articles that we publish. Anyone can send in a contributionLearn More or any other data needs to be saved. Follow the 3 steps to get the picture and see how easy it is:
Lets check out the these three steps for using linq to xml
In this example we’ll be dealing with patients, so lets define a Patient class with some attributes:
class Patient { public string EMail { get; set; } public string FirstName { get; set; } public string LastName { get; set; } }
<?xml version="1.0" encoding="utf-8" ?> <Patients> <Patient EMail="LeBron@James.com"> <FirstName>LeBron</FirstName> <LastName>James</LastName> </Patient> <Patient EMail="Kobe@Bryant.com"> <FirstName>Kobe</FirstName> <LastName>Bryant</LastName> </Patient> <Patient EMail="Allen@Iverson.com"> <FirstName>Allen</FirstName> <LastName>Iverson</LastName> </Patient> </Patients>
I Inherited the List<Patient> and add Load/Save methods to it:
class PatietList : List<Patient> { public void Load(string xmlFile) { XDocument doc = XDocument.Load(xmlFile); var query = from xElem in doc.Descendants("Patient") select new Patient { EMail = xElem.Attribute("EMail").Value, FirstName = xElem.Element("FirstName").Value, LastName = xElem.Element("LastName").Value, }; this.Clear(); AddRange(query); } public void Save(string xmlFile) { XElement xml = new XElement("Patients", from p in this select new XElement("Patient", new XAttribute("EMail", p.EMail), new XElement("FirstName", p.FirstName), new XElement("LastName", p.LastName))); xml.Save(xmlFile); } }
See how easy this is? get familiar with the XDocument, XElement and XAttribute classes.
Another thing you could do is to move load/save knowledge into the Data object:
class Patient { ... public Patient(XElement xElement) { EMail = xElement.Attribute("EMail").Value; FirstName = xElement.Element("FirstName").Value; LastName = xElement.Element("LastName").Value; } public XElement XElement { get { return new XElement("Patient", new XAttribute("EMail", EMail), new XElement("FirstName", FirstName), new XElement("LastName", LastName)); } } ... }
and than the load/save query looks like this:
public void Load(string xmlFile) { ... var query = from xElem in doc.Descendants("Patient") select new Patient(xElem); ... public void Save(string xmlFile) { ... XElement xml = new XElement("Patients", from p in this select p.XElement);
Tags :application settingsLINQLinq to xmlLoadpersistencySaveXml
Breeze : Designed by Amit Raz and Nitzan Kupererd
Sam
Said on April 29, 2008 :
Linq is so neat. I bought a book on it though and the book isn’t really as good as many online resources like this one. Thanks for adding your knowledge to the community’s database.
Larry
Said on November 5, 2008 :
I ran a variation of this with my own xml, where xml file looked like:
XML File:
Bob
Bob1
False
2146836480
My Code snippet:
—- Usings:
using System.Collections.Specialized;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Xml.Linq;
class Key
{
public string Name { get; set; }
public string Value { get; set; }
}
class KeyList: List
{
public void Load(string xmlFile)
{
XDocument doc = XDocument.Load(xmlFile);
var query = from xElem in doc.Descendants(”Key”)
select new Key
{
Name = xElem.Attribute(”Name”).Value,
Value = xElem.Element(”Value”).Value,
};
this.Clear();
AddRange(query);
}
}
My method getting data:
private static string GetMachineConfig(string Dimension)
{
KeyList MyKeys = new KeyList();
MyKeys.Load(”D:\\Log\\MachineConfig.xml”);
foreach (Key ky in MyKeys)
{
if (ky.Name == Dimension)
{
return ky.Value;
}
}
return “Not Found”;
}
My compiler error:
Could not find an implementation of the query pattern for source type ‘System.Collections.Generic.IEnumerable’. ‘Select’ not found. Are you missing a reference to ‘System.Core.dll’ or a using directive for ‘System.Linq’? c:\BuildJobBat\Program.cs 23 39 BuildJobBat
Larry
Said on November 5, 2008 :
Note: web app stripped some code out of the example, email me for actual code snippet.
Lezka
Said on April 28, 2009 :
Hi,
I have an xml with elements like this
how can I store the list of files in the new Module created by the sql?
Marcio
Said on May 23, 2009 :
Very good article.Is anybody there could show me how to get the results from a Linq query and populate a DataSet?
That way the data can be placed in a DataGridView. I am trying to do this but no results yet.
Rob
Said on March 15, 2010 :
Ok I give in, I tried to get linq -> DataTable going, but it was horrible. So I tried dealing directly with linq -> xml, that was even horribler (I claim the rights to that word).
Which ever you do you end up with ugly code and neither makes using your application’s stored data easier to use than the good old fashioned ‘Do it yourself straight from classes’ method. Why on earth didn’t MS make a nice Linq->DataTable/Set marriage.
As for the Linq->XML side, instead of making the marriage as easy to use as Linq, they have made it as horrible to use as XML. Maybe their developers miss read the design spec.
You are right, best way is to just load the data into a regular class and forget about the XML side from then on (or until you need to update the file. But then you start to wonder why you are keeping the data in an XML file, I mean, if the only program using your data is your application and it’s relatives, then XML is just too much of a pain in the big bit at the top of your legs around the back.
Australian Amusements Directory
Said on May 4, 2010 :
Good tutorial.
Mike Pliam
Said on June 26, 2010 :
class PatietList : List
will not compile using VS 2008.
The non-generic type ‘List’ cannot be used with type arguments.
Also, I assume you meant ‘PatientList’ (sp). Taking a bit more time to go over your posts would probably save many of us alot of time.
Warren
Said on August 4, 2011 :
Has anyone converted this to vb.net.. I can do it in C#, but the code base I am working with is vb and I am not sure how to do teh part that “cast” the linq results in a class…
var query = from xElem in doc.Descendants(”Patient”)
select new Patient
{
FirstName = xElem.Element(”FirstName”).Value,
LastName = xElem.Element(”LastName”).Value,
};
fully
Said on September 8, 2011 :
Hey, Thank for your article but i cant write keyword “this” without a error
XElement xml = new XElement(”Customers”,
from p in this // <== error at keyword this
select new XElement(”Customer”,
new XElement(”name”,”John Cherry”),
new XElement(”phone”,”2134-234-324″),
new XElement(”address”,”Hai Phong”)));
Specify this error is :
Could not find an implementation of the query pattern for source type ‘DAL_GALLERY’. ‘Select’ not found.
Someone help me, please ! | http://www.dev102.com/2008/04/25/linq-to-xml-in-3-easy-steps/ | CC-MAIN-2013-48 | refinedweb | 1,088 | 57.98 |
>>.
Maybe check out Telegram:...
There's no password.
AFAIK it generates a key when you verify your phone number with the SMS code. If the key is lost for whatever reason then you can run the verification again..
Whatsapp exploits convenience in a nasty way. Someone "smart" came up with idea that they can use mobile device identification (IMEI) as a base for user identification, so Whatsapp doesn't require users to register like normal services would do. Instead it's enough to install the application on the mobile device and it "magically" connects one to the service (of course under the hood it uses the said IMEI). It saves one time step of registration (which takes how much, 2-5 minutes at most?).
The same thing which is presented as a benefit is actually a serious drawback, because such approach means inability to use secure authentication, i.e. users can't choose their ids and passwords, it also exposes device id externally. And this severe security deficiency comes for the sake of saving 5 minutes of the registration process! It's a completely crooked idea and a disproportionate benefit (drawbacks are much more serious and continuous, unlike the benefit), however many people eagerly buy this bait and claim that Whatsapp is so great and "user friendly".
Another downside of this all is inability to use the same account from multiple devices like normal services allow.
Original developers of Whatsapp did something really crooked by exploiting natural desire for convenience, while hiding from their users that they pay for it with their security and the price is way disproportionate.
Edited 2014-02-20 07:28 UTC
The reason so many people use it is that it works exactly the same as sending SMS messages (although with extra features):
-No account setup: launch the app, receive the verification SMS and your are good to go.
-No need to exchange IDs with your contacts. If it's on your phone's contact list then it's also on your Whatsapp contacts.
-The point above makes it quite convenient for casual business communication.
-Minimal complexity: no voice/video calls, no integrated stuff, one single client on one single device... it does only one thing, and it's good enough at that.
Years ago when Whatsapp started making waves people were like "it's cool! free SMS!", which made me think "heck haven't you ever heard of chat apps before?".
But then if you think about it they had a point: it has succeeded not because of it's features as a chat app, but because it works exactly the same as the old text messages.
Interesting. I guess I understand why it took off now, thanks for the education.
Personally, I think it has the same limitations as SMS. IE, phone to phone. I wouldn't be able to use my computer to chat with anyone. But maybe the fact is people don't use a real laptop/desktop enough these days where that would be a draw back. Google's hangouts seems to be a better solution in that regards. I wouldn't be surprised if Whatsapp gets replaced by hangouts. Google was very sly in its design and implementation.
I prefer Hangouts too. Being able to use it on your PC makes it more convenient for me, and you don't even need a client, just a browser plugin.
And also with two step authentication you can safely use it on public computers.
But then it requires a Google account, which is an entry barrier compared to Whatsapp. I don't see it taking over as long as that's a requirement, other apps like Telegram might have better chances just because of that.
But everyone I know already has a google account. If people buy android phones with hangouts as the default text message app, Google wins. Downloading whatsapp is a barrier, imho. Its duplicate, non free functionality.
Furthermore, as their wasn't any barrier to entry with Whatsapp, there is no barrier to exit either.
Facebook chat uses XMPP. Whatsapp uses a closed kind of XMPP. Great for the future of XMPP. Hopefully Facebook will keep it open.
Also good for security. Whatsapp really did hit the bottom of security.
Let's fight against SIP as it is mostly used to maintain old-fashioned phone numbers. The XMPP style "numbers" can just be the same as your email address - and that is just how I like it. One address, multiple channels (mail, IM, audio, video). Also, old numbers are controlled outside the own organization, while XMPP is fully controlled by the domain owner.
I like XMPP. I like how it's decentralized and works similar to e-mail and I like the fact that I can host my own server for that. I just wish there were some good clients to use with XMPP, especially for Android; I'm using Xabber on my phone, but it's...rather limited. It doesn't do audio or video chat, it doesn't do file-transfer, it's just barebones text-chat. I tried Tigase-messenger, but it's buggy and often my messages get lost in /dev/null for no apparent good reason.
Also, I haven't heard of anything interesting happening wrt. the protocol itself, it seems to have stagnated and it's gotten outdated. It doesn't offer any of the things that people look for in modern IM-applications and platforms, like e.g. hires avatars, or the ability to store a small selection of pictures on the server on your profile so others could peruse them even when you're not present. Especially the avatars are horribly outdated by today's standards as the spec officially, as far as I can remember, restricted them to 64x64 pixels in size.
IMHO there should be at least some more attention paid to features that your average citizen uses just so we could hopefully wean more of them out of proprietary, insecure solutions. I mean, we all would benefit if a secure, fully-open spec gained ground.
Edited 2014-02-20 02:31 UTC
Jitsi for Android is progressing:
I agree that in general clients are lagging behind. Telepathy framework still doesn't support OTR and ZRTP for instance and clients which are built on top of it don't enable them accordingly (KDE Telepathy, Sailfish one and others).
Edited 2014-02-20 03:08 UTC
And please stop misquoting me ;-)
I literally wrote: "Let's fight against SIP as it is mostly used to maintain old-fashioned phone numbers."
That you can use SIP without phone numbers becomes less relevant now that the whole ecosystem is being conquered by traditional telco companies.
That's why I argued for XMPP, which has an ecosystem in which often an email address is being used.
Pidgin and Jitsi are good XMPP clients.
Given that it reuses components from libjingle, it may also be easier to bridge WebRTC to XMPP+Jingle than to SIP.
(Which matters to me because I want to ditch Skype and WebRTC shows the most promise for an open-source VoIP system where I can shoulder the burden of making it work for my non-technical friends.)
I really like their mobile messaging app. It is just so polished and flawless.
I do find it annoying having friends spread so thinly across so many different networks though.
* IRC
* non-affiliated XMPP-OTR
* Google Hangouts
* Whatsapp
* SMS
* BBM
I know a few of those could be consolidated with a solid XMPP app, ChatSecure is getting there, but is still quite buggy and unfinished compared to the likes of BBM.
Well, I've never heard of "line" outside of a geometric or queuing situation either.
I can only imagine its a useful app when your queued up with a bunch of strangers and want to swap positions in line for other favors.
Like, I'll swap you this prime position in line for a ride home and a beer. Plus I also knit hats out of alpaca fur if you'd prefer.
Lately I was using Telegram, I highly recommend it
Bad idea. Another centralized and walled service, not any better than Skype or Whatsapp. It has no end to end encryption, so server owner can read all your messages. Server is not open source. Account is required to be bound to a phone number (what for?). And etc. and etc. Not sure why it's needed at all, it's awfully designed and presented especially in the age of mass surveillance.
Edited 2014-02-20 03:18 UTC
It has end-to-end encryption, you have to use the "secret chat" option. I don't know how secure It is though.
BTW if I need to transmit super secret information I'll do it by email using gpg encryption really... expect serious privacy from a messaging app running in an ultra insecure technology like mobile phones is pretty naive.
I think, overall, Telegram is a huge improvement over Whatsapp, ie. having a Mac OSX client is a killer feature for me.
Anything can be considered an improvement over Whatsapp. Whatsapp is just horrible in a whole range of aspects including security.
I don't see what Telegram can do better than any up to date XMPP service. For OS X there is Adium client for example.
Edited 2014-02-20 06:17 UTC
Well lots of people like using Whatsapp and it is awesome. It is a lot cheaper than SMS in spain and I can just get on and use it. I honestly don't care about the security of me telling my Girlfriend I will meet her after work at the Tapas bar.
People really don't care about the same things you do and until you realise that, you will keep on making these ridiculous "this is terrible" remarks ... when it really isn't.
Edited 2014-02-20 20:15 UTC
People don't care about those things until they get hit with them. Then they might start caring but it can be too late.
That wasn't the point about Whatsapp however. Making a conscious choice of not caring about security for whatever reason is one thing. Whatsapp is not that case, because most people have no clue about the underlying problem and developers don't care or even intentionally don't want to inform them. I'm sure they'd lose quite a number of users if they'd fairly warn them that they sacrifice security for convenience.
Edited 2014-02-20 22:59 UTC
That is their own fault then.
People regularly sacrifice security for convenience. It isn't as bigger deal as you make out.
Edited 2014-02-21 09:55 UTC
Hi guys,
I've continued researching bits and pieces for the Peer to Peer network that some of us had been discussing, and I've started some prototypes for it. I've decided that I'm going to work on it and maybe push for an alpha version hopefully by summer.
I'm not a huge fan of browser based technologies and I prefer native apps for numerous reasons. However I'm overlooking my opinion in the interests of lowering the barrier to entry and getting more people on when it's ready. The prototype uses the WebRTC interface to work in a browser. The main negatives of WebRTC for this project are that it needs a server to bootstrap the clients every startup, the webpage has to be kept open, and it's going to be annoying to integrate native clients. But at least once connected all the traffic and storage are bonafide peer to peer!
Last time we talked about what "user identity" means in a P2P network, a global namespace would be disastrous, GUIDs are unfriendly, so I'm leaning towards a federated solution, possibly openid. Something like namecoin might also be an option. Ideas are welcome.
P2P routing is a very fun CS problem. We cannot connect each peer in a full mesh topology, so we have to find a way to route through other peers. The regular internet routes using a global routing table hundreds of megabytes in size at each backbone router to find the next hop of every packet. This doesn't scale for us, so we need a new approach.
What I'm working on is another scheme that assigns each peer a globally unique Virtual IP address. A VIP is a hash of a public crypto key, so it's impossible to forge and encryption can be built right into the network. The VIP could be permanent or temporary and would be independent of one's physical IP. One peer could contact any other on the network using the VIP. I also envision this VIP being used to host services in the long term. I've worked out an algorithm that should be able to route with minimal resources using a greedy N-ary search without knowing anything other than one's own peers. In effect, we'll guaranty that the packet will make progress as it traverses the network (it will never take a hop that places it further away from the target VIP). Greedy algorithms always find local maxima, so the network has to take be interconnected in that arrangement. This gives the network some interesting properties. I can't wait to see how well it works in the wild!
If anybody's interested in any of this or wants to get involved, please email me:alfman _a_ evergrove.com. I didn't get any takers last time, but I definitely enjoy talking about these things and it would be nice to get others involved. I'll be out of the country for a while, so I won't be able to respond much till I get back.
Edited 2014-02-20 05:58 UTC.
Why do you have a resistance to giving your phone number to Facebook, but at the same time have no problem handing it to Whatsapp? What makes them so much better than Facebook in your eyes?
That's a good question. I must admit to being an erring human: I hesitated a lot before using whatsapp, I didn't install it in the first place.
I then caved in on a request to keep in touch with a friend far away.
I just deleted the account and uninstalled the app. At least that wasn't a painfull process, but very snappy one.
Anyway... I wanted to point to something else. Lack of control or foresight about your data in a service being sold to a hegemony at any point in time.
Yes. Then again, if any of your friends are using Facebook on their mobiles and have your phone number stored in their contacts Facebook's already got it and most likely have been able to link your profile to it ages ago.
Phew! What a relief ? :-)
Facebook buy WhatsApp and then file dmca takedown notices to free software implementations at github. - not cool | http://www.osnews.com/comments/27573 | CC-MAIN-2015-11 | refinedweb | 2,520 | 72.16 |
Microsoft Corp. has stated that the company will open its source code to governments and international organizations worldwide. This move follows various government requests and government announcements of adopting open source strategies, mainly for security and integration reasons. Update: The Register also posted an interesting article regarding this announcement.
Microsoft to Reveal Source Code to Governments
2003-01-15 Microsoft 23 Comments
There’s bound to be a few thousand catches or so though. 🙂
Read this article about the subject at “The Register”:
Undoubtably, a decision to open up some of the source for Windows comes from very high up in the company considering that the source code and resulting binaries are Microsoft’s main product.
There must be a lot of pressure on them at the moment to have made them do this. You need only look at the tech news recently to see how many countries are switching their systems over to alternative os’s and you’ll see how much potential money Microsoft is standing to lose from this worldwide shift.
I think that Microsoft’s business model is about to change drastically over the next couple of years and they know this. I want to see what happens.
Thanks FireBase,
I have included the Register article to this news item.
Even if i’m pretty sure most governments already got a hold of the source thru intelligence, microsoft giving away the source code for windows to them is still a risky move for companies and governments that use windows for their systems (specially if connected to the internet). As such code isnt nearly as audited as its opensource alternatives it probably does contain an enormous amount of security holes to exploit.
And even if windows has backdoors set in there purposedly,
they can be removed before shipping such source.
…Windows 95/98/ME, I’d rather Microsoft not release it
to anyone. No one, not even the government, should have
to look at that mess of spaghetti code. Ack.
<theoretical Win9x code>
#include <stdlib.h>
#include <BSOD.h>
…
if (openApplications > 2 || (openApplications > 1 &&
any16bitApplications == TRUE)) {
int dice = (rand()%6)+1;
if (dice > 3)
blueScreenOfDeath();
}
…
</theoretical Win9x code>
LOL 🙂
Anyway, as for restrictions, well, there would probably be NDAs, NDAs for these NDAs and NDAs for that NDAs and the NDA for the license itself :-). They probably won’t let anyone that saw the code to build a competing product..
Microsoft cannot prove that the source code they show you is the one from which the software you actually run is compiled from.
Gov’t with source access: “Hi, MS support? We’ve found that we’re not able to build the sources you gave us. Is there somthing missing in the readme?”
MS: “Ha! You’re trying to *build* it? No no. It won’t build.”
Gov’t: “Why not?”
MS: “Well,.. of course, we’ve taken out the portions that you’re surely not interested in. Besides, if you want a binary, I can put you in touch with our sales dept; one moment please while I transfer your call…”
Gov’t: “No. Wait. But…[click]”
—
PR! Do i have to say more? It’s no use for anyone, just because “open-source” is hot, they say like: “Jo people see how trustfull we are! We even share code!!!” I read it as complete FUD
Mr. Billy the McCarty may even up his ass for public, I am not interested. : )
Actually, these are signs that Linux is gaining popularity amoung the governments, so that capitalist MS is getting afraid.
Great news for Linux community!!!!
Its gonna be so covered by NDA’s, licenses and laywers that you cant write another line of code as long as you and your children live.
Nah thanks, I looked the gift horse in the mouth and decided that it had bad breath.
MWN.
If this didn’t work in India what makes them think this will working countries like Japan where they are also shifting to true Open Source platforms ? This smells of PR marketing hype and smoke and mirrors. I am sure that there will be some many limits and rules alone put in place that it will not even be worth the hassle. Not to mention that they might do what jonhG is suggesting and leave important parts out that would render such source code utterly useless.
I believe many governments have put too much blind trust into Microsoft’s solutions in the past. Just some simple security holes can easily allow people (in the know) to retrieve sensitive information.
I doubt that full open source environments would be the solution however. Fully Open Sourced software also allows 3rd party individuals to spot and abuse security holes/faults more easily.
I believe the ideal situation would be, a secure OS being closed sourced, with the *full* sources available only to various 3rd party international and official security specialized inspection teams.
Wonder how many holes, & bugs they will find? I will take bets now.You know someone will leak it to the net.
If I were a government I wouldn’t accept a partial release of source code as being enough. It has to be a complete release and the closed sourced products sold must be from a government approved build.
The more I think about it the more I think open standards and ARB style bodies are the way forward. Microsofts source should be treated as no more than SGI’s OpenGL reference implementation.
>>>If I were a government I wouldn’t accept a partial release of source code as being enough. It has to be a complete release and the closed sourced products sold must be from a government approved build.
If you were a government, then you are some 3rd world dictatorship regime.
Well I’m not a Govt or an International worldwide body so I’ll never get to see this code.
Besides … are they going to let these bodies also contribute code to fix issues with the existing … i think not.
This is just a PR move on MS’s part.
>>>are they going to let these bodies also contribute code to fix issues with the existing … i think not.
There are something like 3 or 4 different programs. Some allow you to look at the code only. Some allow you to contribute code changes. The G7 countries get more access than countries like India and China.
>>>This is just a PR move on MS’s part.
It’s also totally FUD that about how Microsoft has backdoor access to foreign government’s computers.
“It’s also totally FUD that about how Microsoft has backdoor access to foreign government’s computers.”
I wouldn’t risk. : ) Why should I risk national security and waste hard earned money of the people with horrible MS yearly fees while there are a FREE, BETTER, OPEN SOURCE OSes such as BeOS spawns, BSD, Linux around? (I like them in that order.)
MS is a monopolistic capitalistic unethical shit.
IIS has been under shared source for awhile. But why does it have many many times more security problems than Apache? It doesn’t matter whether you are open source or not, if one the designing stage, you forget about the security issue, you are screwed.
I would take the case of open sourced BeOS spawns, is there one that actually boots on its own? Government should choose Linux or BSD just because of rumour site claimed NSA-key is NSA’s backdoor. They should use it because it is better/cheaper/more flexible/etc.
However, there is risks in using Windows in non-US government enviroments. What happens if the government places sanctions on you that makes you use a old version of Windows ridden with security holes? Moving to Linux/BSD at that point would be hard and costly.
Yellowtab’s zetaOS most likely has been able to boot for some time…. | https://www.osnews.com/story/2559/microsoft-to-reveal-source-code-to-governments/ | CC-MAIN-2020-45 | refinedweb | 1,324 | 72.46 |
Wednesday, March 21, 2007
[Microsoft.BizTalk.Deployment.DeploymentException] [System.Data.SqlClient.SqlException] Failed to load msxmlsql.dll. [System.Data.SqlClient.SqlException] Failed to load msxmlsql.dll.
A few sites pointed to potential fixes but these appeared to be red herrings. In the end our DBA re-applied SP4 and the issue was cleared up. Most bizarre. Will teach us to deploy security updates so quickly!
posted @ Wednesday, March 21, 2007 11:24 AM | Feedback (0) |
Filed Under [
BizTalk
.NET
]
Friday, December 01, 2006
posted @ Friday, December 01, 2006 8:56 AM | Feedback (0) |
Wednesday, October 18, 2006
I've previously used RSS Bandit which I thought was excellent, but even though you could do some synchronisation with it's files, it wasn't very portable.
Google reader lets you upload your OPML file with your feeds to it, and it just does a generally excellent job of presenting them to you, and giving you a huge pile of keyboard shortcuts for working through them.
I recommend that you all give it a try!
posted @ Wednesday, October 18, 2006 11:26 AM | Feedback (0) |
Tuesday, August 22, 2006
Makes a lot of sense to me, may be of particular interest to anyone that is hiring at the moment.
posted @ Tuesday, August 22, 2006 7:24 AM | Feedback (0) |
Tuesday, August 01, 2006
This is a most excellent free tool that supports UML 2, various approches, code generation, reverse engineering, Gang of Four design patterns and document generation to name but a few features.
I also find that the GUI allows you to create diagrams a lot quicker than you can with the likes of enterprise architect, which is kind of bloated and cumbersome.
I recommend that anyone needing a UML tool for a small to medium size project check this one out! Better than a lot of the paid for offerings out there.
posted @ Tuesday, August 01, 2006 10:12 AM | Feedback (3) |
Wednesday, July 26, 2006
I got a T-Mobile MDA Pro WM5 mobile phone. The network just released a patch to enable the exchange email push on it.
I discovered do a free service that allows you to have an exchange account to which you can forward email and, this in turn allows you to use activesync over a secure connection.
Most impresed by this. Works very quickly, nice way of using the inclusive data allowance I have, and of course being able to more in touch (as if I really need that).
posted @ Wednesday, July 26, 2006 11:01 AM | Feedback (0) |
Wednesday, July 19, 2006
Check this out:
Does this mean future rootkits and other vulns will be covered up?
posted @ Wednesday, July 19, 2006 5:56 AM | Feedback (0) |
Thursday, July 13, 2006
posted @ Thursday, July 13, 2006 8:08 AM | Feedback (1) |
Friday, May 19, 2006
I've got it so that I can compile using the external tools, but unfortuantly I can seem to make this as slick as I would like. I've added the console with the following:
Title : NDoc Compile
Command: C:\Software\OpenSource\ndoc\1.3.1\bin\net\1.1\NDocConsole.exe
Arguments: -project=$(SolutionDir)Solution.ndoc
Initial Dir: $(SolutionDir)
This ties me to the solution.ndoc though for hte ndoc project file. Would be good if I could get the add in to automatically look for .ndoc
Anyone got any ideas?
posted @ Friday, May 19, 2006 7:31 AM | Feedback (0) |
Anyone got any ideas?
posted @ Friday, May 19, 2006 7:31 AM | Feedback (0) |
Wednesday, January 04, 2006
I've got an MSDN subscription which I thought was kind of universal but it seems I dont get any of team system. Now, I wasn't particuarly bothered with a lot of the stuff but I dont get the integrated unit testing in the pro edition.
I guess this means that I am going to be sticking with NUnit and as such recommending that my clients do exactly the same.
I don't see why Microsoft should be putting this kind of an additional expense on independant consultants, not given the amount of money I have made them in server licences from my clients!
posted @ Wednesday, January 04, 2006 12:10 PM | Feedback (4) |
Tuesday, August 30, 2005
Hi, don't know how many of you have found the wonders of podcasts as yet. I'm quite into them, as a good podcast can make the walk to work a better use of time than it would be listening to the latest Green Day album.
As yet the podcast scene is in its infancy but there are several good resources out there. The best one I have found is delivered by the folk who host my blog. It covers all manner of useful developer information including plenty of interviews etc.
If like me you are the proud owner of an ipod then iTunes 4.9 includes pod cast access and this podcast is synicated through this. This makes it a lot easier to make sure you have the latest episode.
posted @ Tuesday, August 30, 2005 12:23 PM | Feedback (0) |
Friday, August 12, 2005
Someone I know gets a notable mention with the log4net stuff too ;)
posted @ Friday, August 12, 2005 11:46 AM | Feedback (0) |
Wednesday, July 06, 2005
I'd like to take a moment to blog about the excellent work Scott Colestock is doing with regards to BizTalk supplemental tools
I've been working with both his Nant deployment script and his implementation of Log4net. Both are absolutly must haves for the BizTalk developer. If you haven't checked this stuff out then I sincerely hope that you do. Your life will be better with it!
I even updated his Log4net library to use the latest version. Hope he gets it up on his site soon
Many thanks for your good work Scott. Check him out at Trace of Thought
posted @ Wednesday, July 06, 2005 10:40 PM | Feedback (0) |
Monday, July 04, 2005
posted @ Monday, July 04, 2005 3:48 PM | Feedback (1) |
Tuesday, April 05, 2005
using System.Management;
//Run the base class stuff.
base.Install(stateSaver);
try
{
PutOptions options = new PutOptions();
options.Type = PutType.CreateOnly;
//create a ManagementClass object and spawn a ManagementObject instance
ManagementClass newAdapterClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_AdapterSetting", null);
ManagementObject newAdapterObject = newAdapterClass.CreateInstance();
//set the properties for the Managementobject
newAdapterObject["Name"] = "<YOURADAPTER>";
newAdapterObject["Comment"] = "<Comment you want to appear in BizTalk>";
newAdapterObject["Constraints"] = "<Constraint Bit Mank>"; //Bitmask appears in registry file.
newAdapterObject["MgmtCLSID"] = "<Adapter Management Class Id>"; //Guid that appears in the registry file.
//create the Managementobject
newAdapterObject.Put(options);
System.Diagnostics.Trace.WriteLine("Adapter has been created successfully");
}
catch (Exception ex)
System.Diagnostics.Trace.WriteLine(ex.ToString());
throw;
ManagementClass adapterClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_AdapterSetting", null);
ManagementObjectCollection adapterObjects = adapterClass.GetInstances();
System.Diagnostics.Trace.WriteLine("We have {0} management objects", adapterObjects.Count.ToString());
foreach (ManagementObject adapterObject in adapterObjects)
{
System.Diagnostics.Trace.WriteLine("Current adapter object is {0}", adapterObject["Name"].ToString());
if( adapterObject["Name"].ToString().ToUpper() == "<YOURADAPTER>" )
adapterObject.Delete();
}
System.Diagnostics.Trace.WriteLine("Adapter has been removed successfully");
posted @ Tuesday, April 05, 2005 10:13 PM | Feedback (3) | | http://geekswithblogs.net/cmcneill/Default.aspx | crawl-002 | refinedweb | 1,189 | 53.71 |
Eclipse Community Forums - RDF feed Eclipse Community Forums libxml++ namespace not found <![CDATA[Hello: I am attempting to experiment with libxml++ on a unbuntu 12.04 machine. I have downloaded the library and started a C++ project with the wizard. I am trying to run the DOMParser example so I pasted it into the cpp file. _https ://developer.gnome.org/libxml++-tutorial/stable/chapter-parsers.html I have put the `pkg-config libxm++-2.6 --cflags --libs` in the command line (using GUI) This appears with to work with includes as it does find all headers from the single <libxml++/libxml++.h> include. The problem I am having is that it does not "see" the xmlpp:: namespace, or for that matter the Glib:: namespace. The compiler errors are of the form: "error: 'class xmlpp::DomParser' has no member named 'set_throw_messages' Hovering over any of the other errors in the editor gives something like: "Type 'xml::ContentNode' could not be resolved" or "Type 'Glib::ustring' could not be resolved" Althouth it has been quite a few years since I have done C++ (off on C# .NET and C) and I have only used eclipse for straight C projects... I think the compiler is unable to resolve the namespaces from the two "non-standard" libraries (libxml++, and glib). The compiler/editor does see the std namespace and I have done a couple simple C++ projects without a problem. If someone can help me resolve this issue I would appreciate it. BTW, I have been spoiled by IDE's and GUI's so I am trying to resolve this within eclipse IDE. Thanks in advance, my apologies for the long description. Adam ]]> Adam Levine 2013-03-14T21:28:41-00:00 Re: libxml++ namespace not found <![CDATA[I "fixed" the problem with finding xmlpp namespace. I needed to add -std=c++0x to Project Properties->C/C++ Build ->Settings->Tool Settings->GCC C++ Compiler->Miscellaneous->Other Flags. I still can't get it to see Glib namespace. I thought that might be because I didn't have the glib dev packages installed. I installed these and still it does not see the Glib namespace. (Also getting "must implement virtual functions..." on xmlpp stuff but this seems to me a language issue with the example not tools set-up.) Any help still appreciated. Adam]]> Adam Levine 2013-03-15T18:29:32-00:00 | http://www.eclipse.org/forums/feed.php?mode=m&th=459340&basic=1 | CC-MAIN-2015-22 | refinedweb | 399 | 73.47 |
The SSL/TLS addon in Varnish Plus is a complete setup for doing SSL/TLS (https) termination in front of Varnish Cache Plus.
Varnish Plus SSL/TLS addon consists of a supported helper process (called “hitch”) that does SSL/TLS termination, and PROXY protocol support between the helper process and Varnish Cache Plus.
The SSL/TLS addon can be installed with:
yum install varnish-plus-addon-ssl # redhat systems
or
apt-get install varnish-plus-addon-ssl # ubuntu based systems
This will download and install the addon from the Varnish Plus repositories.
The SSL/TLS terminator, named
hitch is already configured (versions >=1.4.5)
to listen on all interfaces on port
443 in
/etc/hitch/hitch.conf,
and Varnish Cache Plus is also packaged (>= 4.1.6) to listen on
localhost:8443 that hitch uses as a backend.
The only configuration action needed is configuring the certificates, this is
done in
/etc/hitch/hitch.conf by editing the
pem-file entry:
pem-file = "/etc/hitch/testcert.pem"
You can change this to point to your own certificate, and if you have more than
one, simply add one
pem-file statement per certificate.
Alternatively, to test your setup, you can generate a certificate using:
/etc/pki/tls/certs/make-dummy-cert /etc/hitch/testcert.pem
You can then persist and start the SSL/TLS helper process.
# persist systemctl enable hitch # on systemd machines update-rc.d hitch defaults # on Ubuntu Trusty chkconfig hitch on # on EL6 # start service hitch start
As explained,
hitch will try to listen on port
443on all interfaces,
as defined in
/etc/hitch/hitch.conf:
frontend = { host = "*" port = "443" }
The backend is specified as “[HOST]:port” for IPv4/IPv6 endpoints.
By default hitch will find its backend at
127.0.0.1:8443 using the PROXY
protocol. This is configured by the following lines:
backend = "[127.0.0.1]:8443" write-proxy-v2 = on
Or it can be specified as a path to a UNIX domain socket(UDS):
backend = "/var/run/varnish.sock"
This configuration above must match the default configuration of Varnish Plus to listen on the same port, expecting the PROXY protocol:
For IPv4/IPv6 endpoints:
varnishd [...] -a 127.0.0.1:8443,PROXY
with UDS, the mode of the socket must be specified as well:
-a uds=/var/run/varnish.sock,proxy,user=varnish,group=varnish,mode=666
The
-a argument can be specified multiple times in order to make varnish listen to multiple ports. This is useful when support for both http and https is needed. The following configuration will make varnish listen for HTTP on port 80 and PROXY on port 8443:
varnishd [...] -a :80 -a 127.0.0.1:8443,PROXY
VCL code:
import std; sub vcl_recv { # on PROXY connections the server.ip is the IP the client connected to. # (typically the DNS-visible SSL/TLS virtual IP) std.log("Client connected to " + server.ip); if (std.port(server.ip) == 443) { # client.ip for PROXY requests is set to the real client IP, not the # SSL/TLS terminating proxy. std.log("Real client connecting over SSL/TLS from " + client.ip); } }
SSL/TLS addon was added to Varnish Plus starting from Varnish Cache Plus
4.0.3r2. | https://docs.varnish-software.com/varnish-cache-plus/features/client-ssl/ | CC-MAIN-2020-50 | refinedweb | 536 | 58.48 |
George Trojan <george.trojan at noaa.gov> writes: > A while ago I found somewhere the following implementation of frange(): > > def frange(limit1, limit2 = None, increment = 1.): > """ > Range function that accepts floats (and integers). > Usage: > frange(-2, 2, 0.1) > frange(10) > frange(10, increment = 0.5) > The returned value is an iterator. Use list(frange) for a list. > """ > if limit2 is None: > limit2, limit1 = limit1, 0. > else: > limit1 = float(limit1) > count = int(math.ceil(limit2 - limit1)/increment) > return (limit1 + n*increment for n in range(count)) > > I am puzzled by the parentheses in the last line. Somehow they make > frange to be a generator: >>> print type(frange(1.0, increment=0.5)) > <type 'generator'> Functions are never generators, senso stricto. There are "generator functions", which *return* (or yield) generators when you call them. It's true sometimes people refer to generator functions as simply "generators", but in examples like the above, it's useful to remember that they are two different things. In this case, frange isn't a generator function, because it doesn't yield. Instead, it returns the result of evaluating a generator expression (a generator). The generatator expression plays the same role as a generator function -- calling a generator function gives you a generator object; evaluating a generator expression gives you a generator object. There's nothing to stop you returning that generator object, which makes this function behave just like a regular generator function. John | https://mail.python.org/pipermail/python-list/2007-September/452792.html | CC-MAIN-2016-36 | refinedweb | 239 | 51.65 |
class Thing { ... };No, a class called "Thing" is almost no cent better or worse than a class name "xuzsf" as generated by a obfuscating program. They both carry no meaning. The latter just gives you an additional hint that the code got obfuscated, but since you usually have more than one class in a system, this advantage will cease if you only have names such as 'Thing', 'Something', etc. (Note: Similar to 'Object', 'Thing' may be a very good class name). But what if that class models a relation rather than a thing?-) I have an entire class hierarchy rooted at 'abstract class Thing' - the classes represent types of, well, things in a virtual world (like rooms, people, doors), and since I'm programming in Java, using 'Object' as the base class is out of the question. I'd consider this sensible usage =) ''Real evil comes, when the names seem to speak to you. But they lie: A class 'truck' which really represents 'passenger cars'? A method 'getBalance()' which really returns the credit and alters some attributes on the way? Balance? I thought you were about to talk about balancing the tires on your truck...I mean passenger car. :-)
protected void validateReferralID(String referralID) throws ValidationException? { this.mandatoryValidation(referralID, 31227); this.validate(referralID, 31228, this.REFERRAL_ID_LENGTH); this.checkForZeroAndNegative(referralID, 31228); }This use of indenting and multi-line statements once confused me into thinking the exception would be thrown if rs.next() was true. Note the use or "rs", "a" etc for variable names.:
if (rs.next()) return(a); throw new FinderException?("Account "+number+" not known");The same programmer came up with this gem:
import com.XXX.common.*;public interface Account extends EJBObject, AccountConstants? {The XXX is the organization changed to protect the guilty. The bad news is that I am in line to support thousands of lines of code such as that! With respect, this ain't nothing compared with disassembled code mangled by a good obfuscator :-) guess I took the page too literally! You are wrong. The bad thing about hand obfuscated code is that you don't know it is hand obfuscated. That makes it much more evil.
public Object get_properlyResult() {...They certainly must mean "get_propertyResult"... do they? Or how about giving similar, but slightly different names to the same value in the database, the code that fetches it from the database, as a method parameter, as a local variable in that method, the name used to store it in the session properties, and the variable used to refer to it on the JSP page? I didn't invent this!
public int getMax() ( if (0 == a.length) return 0; int m = a[0]; for (int i = 1; i < a.length; ++i) { if (m > a[i]) m = a[i]; } return m; }This is just an example of a bug, not HandObfuscatedCode.
[snip] #define QUAD_MAX 9 #define QUAD_UPPER_LEFT 0 #define QUAD_UPPER_MIDDLE 1 #define QUAD_UPPER_RIGHT 2 #define QUAD_MIDDLE_LEFT 3 #define QUAD_MIDDLE 4 #define QUAD_MIDDLE_RIGHT 5 #define QUAD_LOWER_LEFT 6 #define QUAD_LOWER_MIDDLE 7 #define QUAD_LOWER_RIGHT 8 [snip] static int x_quad = 1; static int y_quad = 1; static int prev_x_quad = 1; static int prev_y_quad = 1; [snip] static int quad_numbers[3][3] = { QUAD_LOWER_LEFT, QUAD_MIDDLE_LEFT, QUAD_UPPER_LEFT, QUAD_LOWER_MIDDLE, QUAD_MIDDLE, QUAD_UPPER_MIDDLE, QUAD_LOWER_RIGHT, QUAD_MIDDLE_RIGHT, QUAD_UPPER_RIGHT }; static int quad_angles[3][3] = { 225, 270, 315, 180, 0, 0, 135, 90, 45 }; static int quad_objects[3][3] = { 1, 1, 1, 1, 0, 1, 1, 1, 1 }; [snip]-- AnonymousCoward Here's another example:
p_send_cmd->panspd = 80; p_send_cmd->panspd = 0x80; p_send_cmd->panspd = -80; p_send_cmd->panspd = 0x80;The above statements occurred at various places in a 100-line-long switch/if conglomeration. Notice that some of the numbers are hex and some are decimal. This is not a bug. A value of 0x80 means off. Values from 0x00 to 0x80 mean left (so they just "happen" to choose 80). Values from 0x80 to 0xFF mean right (so they just "happen" to choose -80). I think this is a fine example of a programmer going out of his way to make the next guy trip up (anti DefensiveProgramming?) [OffensiveProgramming?]. -- same AnonymousCoward
int a[5]; a[0] = 40000; a[1] = 20000; a[2] = 10000; a[3] = 05000; a[4] = 02500;-- RolandIllig? | http://c2.com/cgi/wiki?HandObfuscatedCode | CC-MAIN-2015-22 | refinedweb | 693 | 64 |
Image Classification using pre-trained VGG-16 model
How to use Pre-trained VGG16 models to predict object.
Architecture Explained:
- The input to the network is an image of dimensions (224, 224, 3).
- The first two layers have 64 channels of
3*3 filter size and same padding. Then after a max pool layer of stride (2, 2), two layers have convolution layers of 256 filter size and filter size (3, 3).
- This followed by a max-pooling layer of stride (2, 2) which is same as the previous layer. Then there are
2 convolution layers of filter size (3, 3) and 256 filter.
- After that, there are 2 sets of 3 convolution layer and a max pool layer. Each has
512 filters of (3, 3)size with the same padding.
- This image is then passed to the stack of
two convolution layers.
- In these convolution and max-pooling layers, the filters we use are of the size 3*3 instead of 11*11 in AlexNet and 7*7 in ZF-Net. In some of the layers, it also uses 1*1 pixel which is used to manipulate the number of input channels. There is a padding of 1-pixel (same padding) done after each convolution layer to prevent the spatial feature of the image.
- After the stack of convolution and max-pooling layer, we got a (7, 7, 512) feature map. We flatten this output to make it a (1, 25088) feature vector.
- After this there are 3 fully connected layer, the first layer takes input from the last feature vector and outputs a (1, 4096) vector, the second layer also outputs a vector of size (1, 4096) but the third layer output a 1000 channels for 1000 classes of ILSVRC challenge, then after the output of 3rd fully connected layer is passed to
softmax layer in order to normalize the classification vector.
After the output of classification vector top-5 categories for evaluation. All the hidden layers use ReLU as its activation function. ReLU is more computationally efficient because it results in faster learning and it also decreases the likelihood of vanishing gradient problem.
This model achieves 92.7% top-5 test accuracy on ImageNet dataset which contains 14 million images belonging to 1000 classes
Additional Reading
VGG Paper
ILSVRC challenge
Watch Full Lesson Here:
Importing Libraries
from tensorflow.keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions from tensorflow.keras.preprocessing.image import load_img, img_to_array import os
#creating an object for VGG16 model(pre-trained) model = VGG16()
Downloading data from 553467904/553467096 [==============================] - 255s 0us/step
model.summary()
Model: "vgg16" _________________________________________________________________ _________________________________________________________________
In the below steps, we are performing following activities :
- Converting the image to array and then reshaping it.
- After performig the above steps, we are pre-process it and then predicting the output.
- top=2 in decode_predictions() function means which we are taking top 2 probability values for the particular prediction.
#Here we are taking sample images and predicting the same images on top of pre-trained VGG16 model. #top=2 in decode_predictions() function means which we are taking top 2 probability values for the particular prediction. for file in os.listdir('sample'): print(file) full_path = 'sample/' + file image = load_img(full_path, target_size=(224, 224)) image = img_to_array(image) image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2])) image = preprocess_input(image) y_pred = model.predict(image) label = decode_predictions(y_pred, top = 2) print(label) print()
bottle1.jpeg [[('n04557648', 'water_bottle', 0.6603951), ('n04560804', 'water_jug', 0.08577988)]] bottle2.jpeg [[('n04557648', 'water_bottle', 0.5169559), ('n04560804', 'water_jug', 0.2630159)]] bottle3.jpeg [[('n04557648', 'water_bottle', 0.88239855), ('n04560804', 'water_jug', 0.051655706)]] monitor.jpeg [[('n03782006', 'monitor', 0.46309018), ('n03179701', 'desk', 0.16822667)]] mouse.jpeg [[('n03793489', 'mouse', 0.37214068), ('n03657121', 'lens_cap', 0.1903602)]] mug.jpeg [[('n03063599', 'coffee_mug', 0.46725288), ('n03950228', 'pitcher', 0.1496518)]] pen.jpeg [[('n02783161', 'ballpoint', 0.6506707), ('n04116512', 'rubber_eraser', 0.12477029)]] wallet.jpeg [[('n04026417', 'purse', 0.530347), ('n04548362', 'wallet', 0.24484588)]]
Challenges Of VGG 16:
- It is very slow to train (the original VGG model was trained on Nvidia Titan GPU for 2-3 weeks).
- The size of VGG-16 trained imageNet weights is 528 MB. So, it takes quite a lot of disk space and bandwidth that makes it inefficient. | https://kgptalkie.com/image-classification-using-pre-trained-vgg-16-model/ | CC-MAIN-2021-17 | refinedweb | 697 | 58.89 |
It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
I created a CF using com.keplerrominfo.jira.plugins.keplercf plugin. It is supposed to compute a simple difference between 2 other CFs : start & end.
Code:
interval i ; if (isNotNull(customfield_10613) and isNotNull(customfield_10612) ) { // if (customfield_10613>0) { i = customfield_10613 - customfield_10612; return (string)(i["TOMILLIS"] / 600000) + "m"; // will return "17m" as string } else { // i = currentDate() - created; // return i; return 0; }
Where:
10612 = Actual Issue start time
10613 = Actual issue end time
The code above does not return the proper result
Expected result would be "80m", not "8m".
Am I doing something wrong, or is there an issue with the plugin?
Versions:
JIRA: v6.4.8#64023-sha1:bab6790
Service Desk: 2.5.9
Kepler CF: 3.0.3
CF Searcher: I tried using both Interval & Free text searcher with similar results.
Would someone have any hints?
Thanks
Gabriel
Hi Gabriel,
return (string)(i["TOMILLIS"] / 600000) + "m";
You are dividing by 600.000, but it should be 60.000 ( 1000 for millis to seconds, 60 from seconds to minutes ). The extra 0 is causing the off by 10x error.
Hope this helps,
Silvi. | https://community.atlassian.com/t5/Marketplace-Apps-questions/Kepler-CF-SIL-Script-to-compute-time-difference-not-working/qaq-p/236065 | CC-MAIN-2018-30 | refinedweb | 204 | 59.19 |
I have a simple Bluetooth scanning function that works fine.
Importing the ili9341 driver causes the Bluetooth def bt_irq function to exit after a couple of cycles.
No REPL errors.
Microcontroller still responsive.
Where does one start to track down the conflict.
Using a Lion D32 Pro v2
I have a simple Bluetooth scanning function that works fine.
Hi,
In order to help we need more information, your original information you posted is not enough, at least not for me to try to help you.
I guess you are using the lv_port_esp32 project as base?
Do you have your code hosted somewhere so we can take a look at it?
Do you have the log of the console when you run idf.py monitor?
What version of the esp-idf are you using?
MicroPython v1.9.4-2158-g6b32fae73-dirty on 2020-02-29; ESP32 module (spiram) with ESP32
IDF 4.0
Never used idf.py monitor what information will this give that REPL is not?
esp is not freezing or crashing.
import utime, ubinascii, ubluetooth import lvgl as lv, rot=ili9341.LANDSCAPE, width=320, height=240) _IRQ_SCAN_RESULT = const(1 << 4) _IRQ_SCAN_COMPLETE = const(1 << 5) bt=ubluetooth.BLE() bt.active(True) def ble(x): start = utime.time() x = (["0004", "0005"]) print(x) def bt_irq(event, data): if event == _IRQ_SCAN_RESULT and data[4][2:11] == b'BLEsensor' : print("found a sensor") mf = (ubinascii.hexlify(data[4]).decode("utf-8")) sn = (ubinascii.hexlify(data[1]).decode("utf-8"))[-4:] if sn in x: x[x.index(sn)] = [data[3], int(mf[36:38], 16), (-(int(mf[38:44], 16) & 0x8000) | (int(mf[38:44], 16) & 0x7fff)) /10] print('got sn:', sn) elif event == _IRQ_SCAN_COMPLETE: print("scan completed in",utime.time() - start,'sec') print(x) bt.gap_scan(10_000, 40_000, 40_000)')
Some ideas of things you can check
- Latest stable release of Micropython is v1.12. lv_micropython is aligned to that version.
Are you aligned to that?
- Please check what exactly triggers the problem: Only importing
lvgl? importing
lvesp32? importing
ili9341?
- Are you sure the action of importing a library causes the problem? Maybe it’s the loading of the display driver,
disp = ili9341(...?
- The display driver consumes RAM. Did you try to lowering it? You can configure it to use single buffer instead of double buffer (
double_buffer=False). You can increase
factor. By default it’s 4 meaning 1/4 of the screen is buffered. Try 8 or 16.
- You are saying "
bt_irqexit after a couple of cycles". Please try logging every “event” and “data” that is passed to it. Currently you only act upon
_IRQ_SCAN_RESULTand
_IRQ_SCAN_COMPLETE. Maybe it was called with some other event?
Perhaps there’s some issue with SPI? I know that people have had to change duplex settings to make the display and touchscreen work well together. Maybe there’s something similar happening with Bluetooth.
Hi,
I assumed you where using the esp32 with the idf framework.
What is lvesp32 for?
double_buffer=False… no change
increase
factor… no change
>>> ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371 ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC18,len:4 load:0x3fff001c,len:4932 load:0x40078000,len:11424 load:0x40080400,len:6076 entry 0x400806c8 W (1656) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it. MicroPython v1.9.4-2158-g6b32fae73-dirty on 2020-02-29; ESP32 module (spiram) with ESP32 Type "help()" for more information. sys.version: 3.4.0 sys.implementation: (name='micropython', version=(1, 12, 0), mpy=10757) micropython.mem_info: stack: 704 out of 31744 GC: total: 4098240, used: 5344, free: 4092896 No. of 1-blocks: 20, 2-blocks: 4, max blk sz: 264, max free sz: 255738 GC memory layout; from 3f817740: 00000: h=hhhBMLhDBhSh=hhh============================================== 00400: ================================================================ 00800: ================================================================ 00c00: ================================================================ 01000: =========================hh==h========================B.......h= 01400: ===..h========h.................................Sh........Sh=... 01800: ......h=.........F.............................................. (3995 lines all free) e8800: ............ > MicroPython v1.9.4-2158-g6b32fae73-dirty on 2020-02-29; ESP32 module (spiram) with ESP32 Type "help()" for more information.
output… event & data
MicroPython v1.9.4-2158-g6b32fae73-dirty on 2020-02-29; ESP32 module (spiram) with ESP32 Type "help()" for more information. >>> >>> ble('x') ['0004', '0005'] scan start @ 0 sec >>> 16 (1, b'o\x8cy\x12\xe5\x04', True, -77,03\xf5\xae\x8d\x89b', False, '") 16 (1, b'o\x8cy\x12\xe5\x04', True, -71,1b\xcb\xfd\xa0Y2', False, -75, b'\x1e\xff\x06\x00\x01\t \x02%?%\x1aL\xed\x9e\x86\x07\rt\xeb\x17+\x9e\xb8\xf4\x8c\x7f\x07\x1f\xf4?') 16 (1, b'x7sNc\xf1', True, -54, b'\x02\x01\x1a\x02\n\x0c\x0b\xffL\x00\x10\x06\x03\x1e\xc3\xe6\xe8\x1a') 16 (1, b'\x03\xf5\xae\x8d\x89b', False, '") ----just stops hit enter and returns to repl prompt------
how to change to duplex settings… code sample please.
I’m not sure as I don’t work with ESP32. I just know from reading the issue list that duplex settings have been an issue.
Actually he is using esp32 with the idf framework.
Micropython is just a wrapper around it.
lvesp32 is a library responsible for calling
lv_tick_inc and
lv_task_handler periodically from Micropython context. For more information, have a look at lvgl porting guide.
lvesp32 is implicitly imported by
ili9341 (if you haven’t imported it explicitly).
It’s interesting that importing
lvesp32 is enough for ble drop.
Could you explain what exactly you mean by “ble drop”? Does the ble driver just stop calling your
bt_irq? Or is there some other error happening?
lvesp32 by itself doesn’t do much. It creates a new RTOS timer (
xTimerCreate) which calls
lv_tick_inc and to
lv_task_handler periodically (the later is called indirectly by scheduling it to Micropython).
I don’t see how any of these could be related to BLE, but apparently it somehow does.
If you want to further debug it, I suggest you try to change
lvesp32 not to call
lv_tick_inc and
lv_task_handler (or only call one of them) and see in which cases the problem persists. The source file is
lv_binding_micropython/driver/esp32/modlvesp32.c.
You will not be able to use lvgl if you change
lvesp32 like this, but the goal here is just to see if ble still drops when
lvesp32 is imported, or not.
I don’t see how BLE and SPI are related, so I doubt changing half/full duplex would matter.
I believe def bt_irq() is in its own thread and while scanning
there is a collision over some resource…
what I do not know.
On a fresh reboot you can run ble(‘x’) and
pass thru def bt_irq() varying between 5 to 100 times,
then freezes before the duration of 10 sec is meet.
bt.gap_scan(10_000, 30_000, 20_000)
duration=10 interval=.03 window=.02 seconds
ble(‘x’) refuses to run second time (needs reboot)
>>> in BTmoduleRMG.py ILI9341 initialization completed Enable backlight Double buffer > MicroPython v1.9.4-2158-g6b32fae73-dirty on 2020-02-29; ESP32 module (spiram) with ESP32 Type "help()" for more information. >>> >>> ble('x') ['0004', '0005'] scan start @ 0 sec >>> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 *just freeze before 10 sec... loops are not consistent * *press enter to get REPL prompt... run ble('x') again * >>> ble('x') ['0004', '0005'] scan start @ 0 sec >>> *does not run at all*
On the last run log you sent, you load the display driver.
However, you said the problem happens even if not loading the display driver or creating any lvgl objects.
I’m talking about this line you sent above:
From this line it seems that it’s enough to import lvesp32 to experience the problem.
Let’s start by debugging this simple scenario without the display driver and lvgl objects, before jumping to the full scenario.
I still didn’t understand from your explanations what is a “ble drop”. Please run something like:
import lvgl as lv lv.init() import lvesp32 # Do your ble thing.. # Show us what happens, what is a "ble drop" vs. correct behavior.
Then please try my suggestions above. (changing lvesp32 module)
One more thing you can try is increasing the time in
xTimerCreate.
I would appreciate if you would investigate/debug this as you are deeply familiar with this library. Below is the exact code that was used for above tests.
import utime, ubluetooth import lvgl as lv # import lvesp32, factor=4, rot=ili9341.LANDSCAPE, width=320, height=240) _IRQ_SCAN_RESULT = const(1 << 4) _IRQ_SCAN_COMPLETE = const(1 << 5) bt=ubluetooth.BLE() bt.active(True) N = 1 def ble(x): start = utime.time() x = (["0004", "0005"]) print(x) def bt_irq(event, data): global N print(N) N += 1 if event == _IRQ_SCAN_RESULT and data[4][2:11] == b'AccuTherm' : print("found a sensor") elif event == _IRQ_SCAN_COMPLETE: print("scan completed in",utime.time() - start,'sec') print(x) bt.gap_scan(10_000, 30_000, 20_000) # 10 x .03 x .02')
Again I have no idea how to use that command.
If you are willing to make an effort and debug this, I can try helping you.
But currently I don’t have the time reproducing this on hardware and debugging this myself.
From this screenshot it seems that importing
ili9341 and not importing
lvesp32 causes the problem.
However, from your previous post I understood that it was enough to import
lvesp32:
Could you check that? It’s important to exactly understand the scenario in order to debug it.
Please have a look at modlvesp32.c. That’s the C file where
lvesp32 module is defined.
My suggestion was that you make some changes there, build the firmware and try your script again. Are you willing to make this effort?
btw this is only relevant if importing
lvesp32 alone is enough to reproduce the problem. If this is not the case we would need to check something else. | https://forum.lvgl.io/t/bluetooth-conflict-with-littlevgl-ili9341-driver/1935 | CC-MAIN-2020-24 | refinedweb | 1,654 | 75.91 |
ars Jansens5,348 Points
Python Django task [Python]
Hello, I hava a problem. I don't know how to make a class that should be able to set it through init.
Wow! OK, now, create a class named Player that has those same three attributes, last_name, first_name, and score. I should be able to set them through init.
import re string = '''Love, Kenneth: 20 Chalkley, Andrew: 25 McFarland, Dave: 10 Kesten, Joy: 22 Stewart Pinchback, Pinckney Benton: 18''' players = re.compile(r''' ^(?P<last_name>[\w\s]+) ,*\s (?P<first_name>[\w\s]+) :\s (?P<score>[\d]+)$ ''', re.X|re.M|re.I) | https://teamtreehouse.com/community/python-django-task-python | CC-MAIN-2022-27 | refinedweb | 101 | 79.8 |
Algorithm Implementation/Geometry/Tangents between two circles
From Wikibooks, open books for an open world
This code finds the set of common tangents between two circles.
Java[edit]
import java.util.Arrays; public class CircleTangents { /** * Finds tangent segments between two given circles. * * Returns an empty, or 2x4, or 4x4 array of doubles representing * the two exterior and two interior tangent segments (in that order). * If some tangents don't exist, they aren't present in the output. * Each segment is represent by a 4-tuple x1,y1,x2,y2. * * Exterior tangents exist iff one of the circles doesn't contain * the other. Interior tangents exist iff circles don't intersect. * * In the limiting case when circles touch from outside/inside, there are * no interior/exterior tangents, respectively, but just one common * tangent line (which isn't returned at all, or returned as two very * close or equal points by this code, depending on roundoff -- sorry!) * * Java 6 (1.6) required, for Arrays.copyOf() */ public static double[][] getTangents(double x1, double y1, double r1, double x2, double y2, double r2) { double d_sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); if (d_sq <= (r1-r2)*(r1-r2)) return new double[0][4]; double d = Math.sqrt(d_sq); double vx = (x2 - x1) / d; double vy = (y2 - y1) / d; double[][] res = new double[4][4]; int i = 0; // Let A, B be the centers, and C, D be points at which the tangent // touches first and second circle, and n be the normal vector to it. // // We have the system: // n * n = 1 (n is a unit vector) // C = A + r1 * n // D = B +/- r2 * n // n * CD = 0 (common orthogonality) // // n * CD = n * (AB +/- r2*n - r1*n) = AB*n - (r1 -/+ r2) = 0, <=> // AB * n = (r1 -/+ r2), <=> // v * n = (r1 -/+ r2) / d, where v = AB/|AB| = AB/d // This is a linear equation in unknown vector n. for (int sign1 = +1; sign1 >= -1; sign1 -= 2) { double c = (r1 - sign1 * r2) / d; // Now we're just intersecting a line with a circle: v*n=c, n*n=1 if (c*c > 1.0) continue; double h = Math.sqrt(Math.max(0.0, 1.0 - c*c)); for (int sign2 = +1; sign2 >= -1; sign2 -= 2) { double nx = vx * c - sign2 * h * vy; double ny = vy * c + sign2 * h * vx; double[] a = res[i++]; a[0] = x1 - r1 * nx; a[1] = y1 - r1 * ny; a[2] = x2 - sign1 * r2 * nx; a[3] = y2 - sign1 * r2 * ny; } } return Arrays.copyOf(res, i); } }
External links[edit]
- Circle-Circle Tangents on MathWorld
- Visualizer for the above code is available. (Requires Java. Source is included in the jar archive.) | https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Tangents_between_two_circles | CC-MAIN-2016-26 | refinedweb | 439 | 59.43 |
pthread_getcpuclockid()
Return the clock ID of the CPU-time clock from a specified thread
Synopsis:
#include <sys/types.h> #include <time.h> #include <pthread.h> extern int pthread_getcpuclockid( pthread_t id, clockid_t* clock_id);
Since:
BlackBerry 10.0.0
Arguments:
- thread
- The ID of the thread that you want to get the clock ID for, which you can get when you call pthread_create() or pthread_self().
- clock_id
- A pointer to a clockid_t object where the function can store the clock ID.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The pthread_getcpuclockid() function gets the clock ID of the CPU-time clock of the thread specified by id (if the thread exists) and stores the clock ID in the object that clock_id points to. The CPU-time clock represents the amount of time the thread has spent actually running.
Returns:
- 0
- Success.
- ESRCH
- The value specified by id doesn't refer to an existing thread.
Examples:
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <errno.h> #include <pthread.h> int main( int argc, const char *argv[] ) { clockid_t clk_id; struct timespec tspec; pthread_t tid; tid = pthread_self(); if (pthread_getcpuclockid( tid, &clk_id) == 0) { if (clock_gettime( clk_id, &tspec ) != 0) { perror ("clock_gettime():"); } else { printf ("CPU time for tid %d is %d seconds, %ld nanoseconds.\n", tid, tspec.tv_sec, tspec.tv_nsec); } } else { printf ("pthread_getcpuclockid(): no thread with ID %d.\n", tid); } return EXIT_SUCCESS; }
Classification:
Last modified: 2014-06-24
Got questions about leaving a comment? Get answers from our Disqus FAQ.comments powered by Disqus | http://developer.blackberry.com/native/reference/core/com.qnx.doc.neutrino.lib_ref/topic/p/pthread_getcpuclockid.html | CC-MAIN-2016-44 | refinedweb | 260 | 69.89 |
This paper will discuss.
4a499e9ba7f3664c7a591bdd126df956c5e9ae02bd6a0f8e046e172d1575f496
---------------------------------
Encrypting SNMP 1/v2 with Zebedee
---------------------------------
Ron Sweeney <sween@modelm.org>, Systems Analyst
Jerry Matt <mattjm@bigfoot.com, Systems Engineer
---------------------------------
1. Overview
2. Background
3. Components
4. Firewall Considerations
5. OS/SNMP Security Considerations
6. Configurations
7. trapd
8. snmpd
9. Key Exchange/Target Specification
10. Verfifying your setup
11. Conclusion and Afterthoughts
12. Zebedee Credit
13. References
Overview:
This paper will duscuss.
Background:
"Security Not My Problem" has been the ad-hominen trademark acrononym for SNMP for years.
You literally implemented it knowing of its inherent security shortcomings. Late trends
in information delivery have made this almost unacceptable these days, even on implementations
on private networks. Plans for the protocol to move to a more secure approach
to handling SNMP have flourished only recently. SNMP Research International
has a cooperative project with Hewlett-Packard which developed a SNMP Security
Pack[4] for use with HP OpenView that deploys SNMPv3, the newest version of
SNMP which entirely concentrates on security upgrades from previous SNMP
versions.
The transition may move faster from v2 to v3 than the controversial v1 to v2 upgrade, but it
will weigh in heavy on fiscal budgets and will creep slowly on replacing SNMP devices that
are already in production today.
Aside from the pains of upgrade for the protocol, SNMPv3 still only solves some of the security
problems related to SNMP. In comparison to the solution described in this paper and SNMPv3
the below table lists these vulnerabilities and compares SNMPv3 to a Zebedee solution as it
compares to patching these problems.
1. Disclosure: watching data exchange between agents and management stations to
gather values.
2. Masquerading: stealing the identity of the management station.
3. Modification: packet forging messages to produce bogus operation.
4. Stream Modification: recording entire message streams or injection.
5. Traffic Analysis: watching traffic between agent and management station.
6. Denial of Service: preventing exchanges between agents and the NMS.
Threat SNMPv3 Solution Zebeee Soluton
--------------------------------------------------------------------------------------
Masquerading Verifies by checking Verifies by Key exchange
the origin. and built in ACL.
Modification Checks integrity by MD5 -VULNERABLE-
Disclosure Encrypts packets. Encrypts packets.
Traffic Analysis -VULNERABLE- Protocol conversion and
service listener obsufucation.
Denial of Service -VULNERABLE- -VULNERABLE-
We could spend days debating about host only support for Zebedee, DES vs. BLOWFISH, cost and
business benefit, and squander into qmail vs. procmail debates but the differences are
really insignificant to this paper. The purpose of this paper is to exemplify
a free, secure, enterprise solution for encrypted host based SNMP.
Components:
Working SNMP agent(s) and trapd destinations configured for localhost.
A copy of Zebedee. Currently, Zebedee compiles for win32, linux, solaris, freebsd,
tru64, irix, hpux, macosx, and bsdi.
To build zebedee you will need three libraries:
-blowfish-0.9.5a
-zlib-1.1.4
-bzip2-1.0.1
You can obtain Zebedee from:
Some terminology going forward in this document is as follows:
( I ) [ H-BOMB ] <===> | FW | <===> [ RIZZO ] ( TRUSTED NETWORK )
| |
+----------Zebedee--------------+
Our Host "H-BOMB" resides in the untrusted network and is firewalled from the trusted
network. The Management Server "RIZZO" resides in the trusted network.
Firewall Considerations:
Your firewall rule should allow two bi-directional communication on tcp port
11965 from HBOMB and RIZZO. It should be noted that if you are running in
UDP mode exclusively, a different port will be used.
OS/SNMP Security Considerations:
Please review your respective Operating System SNMP configurations to further
harden your setup. ie. Allowing only localhost to resources on the SNMP agent.
Zebedee
Configurations:
t r a p d
As mentioned in the prerequisites to this document, you will need to have host
H-BOMB configured to send traps to localhost. For most SNMP implementations, it
is designated as "trap-dest #trap destination" in the snmp configuration file(s).
Being as though we want to utilize a service on a remote machine, the trapd destination
host "RIZZO" must be set up as a zebedee server. H-BOMB would then be the client
Zebedee process.
Assuming Zebedee is configured and installed on both machines, run the following
commands on the respective nodes:
RIZZO ~# zebedee -u -s
Start the zebedee process listening for requests as a server.
HBOMB ~# zebedee -u 162:RIZZO:162
Start the process zebedee, in udp mode, listening on my local 162 and sending it to
RIZZO on port 162.
To test it and send a trap from the command line to localhost (HBOMB) port 162.
RIZZO ~# snmptrap -c public -p 162 localhost \
.1.3.6.1.4.1.2789.2500 "" 6 3003 "" \
.1.3.6.1.4.1.2789.3003.1 octetstringascii "RIZZO, here comes the HBOMB"
s n m p d
In the snmpd scenario the management station, RIZZO, is requesting a service from
another machine (polling), thus making it the client in the zebedee process.
H-BOMB in this scenario must run the server configuration for the management
station to enumerate values from the snmp agent.
HBOMB ~# zebedee -u -s
Start the zebedee process listening for requests as a server.
RIZZO ~ # zebedee -u $PORT:HBOMB:161
Start the zebedee client process in udp mode, listening on your specified port number
($PORT), and send it to HBOMB on port 161 (snmp agent).
Testing it can be accomplished by polling your localhost on the listening process
you started the zebedee listener ($PORT). A simple snmpwalk can accomplish this.
RIZZO ~# snmpwalk -c PUBLIC -p $PORT RIZZO system
Communication Process Overview:
t r a p d
1. HBOMB sends trap down localhost port 162
2. Zebedee process is listening on 162
3. Zebedee intercepts the call, encrypts and converts the udp packets
to tcp
4. Zebedee sends tcp packet to defined destination (RIZZO) based on configs.
5. RIZZO Zebedee processes trap.
s n m p d
1. RIZZO polls localhost at specified $PORT
2. Zebedee process is listening on $PORT.
3. Zebedee intercepts the call, encrypts and converts the udp packets to
tcp
4. Zebedee sends tcp packet to defined destination (HBOMB).
5. HBOMB accepts SNMP udp packet and queries the agent.
Key Exchange and Target Specification
The above examples are minimal, yet functional, but highly insecure. By default,
Zebedee establishes an encrypted channel between two points. The data is
encrypted, but there is no way to tell if the tunnel ended up where you think it
did. A Zebedee server will accept connections from any client that can reach it.
To protect against this, a Zebedee tunnel can validate a private key. To generate
a key follow the simple instructions in the man page. I included them here for a
1,2,3 style guide to the process, but you should consult the man page before
attempting to set this up.
Another default server configuration is that a zebedee server will allow any client
to connect to ANY port on the server. We can eliminate this by specifing a Target for
Zebedee clients to connect.
The server and client Zebedee process will need to read from configuration files
respectively at start up to accomadate advanced features (its just plain easier.)
First, quickly generate some keys.
RIZZO~# zebedee -p >client.key
RIZZO~# zebedee -p -f client.key > client.id
Keep client.key in a secure location and send client.id over to the server RIZZO
for inclusion in the server configuration.
Here is a sample client configuration file.
sample client.zbd
#
verbosity 1 # Basic messages only
server false # It's a client
detached true # Detach from terminal
ipmode both
message "Starting Zebedee tunnel to HBOMB"
#Below is the contents of client.key you can also accomplish this by
#pointing to client.key using the below include statement
#include "myclient.key"
privatekey "ec99fd22fa60e480ac0e6a30cb405add674bf910"
compression zlib:6 # Request normal Zlib compression
On the server side, over at HBOMB, construct a server configuration file
to your needs. Below is an example below optimized for SNMP. It includes
a udptimeout directive and target specification. It should also be noted
that there is a limit to the size of a packet on UDP tunneling.
# Sample Zebedee server configuration file
verbosity 2 # Talk to me
message "WHITE PAPER CONFIG FILE READ EXAMPLE IN ZBD DISTRO BEFORE USE"
#Make sure you venture to read the configuration file in the Zebedee distribution tarball.
logfile "/var/log/zbd.log" # tail me for debuggers and operational inspection
detached true # run me into the background
server true # Yes, it's
udptimeout 65535 # Set this to the maximum for use with SNMP
keygenlevel 2 # Generate maximum strength private keys
checkidfile './clients.id' # Hey, there is that clients.key file from RIZZO
redirect none
target localhost:161/udp # only redirect the zebedee requests to here
Start your processes as before, specifying the -f switch to point at the configuration
files.
HBOMB ~# zebedee -u -s -f server.zbd
Start the zebedee process listening for udp requests as a server with the options
specfied in the file server.zbd.
RIZZO ~ # zebedee -u -f client.zbd $PORT:HBOMB:161
Start the zebedee client process in udp mode, reading options from the configuration
file client.zbd, listening on your specified port number ($PORT), and send it to
HBOMB on port 161 (agent).
Send a trap down your localhost, and if all goes well trapd.log on RIZZO will have
a encrypted then decrypted trap as its last entry.
Verifying your Setup:
Tail the log file specified in the server config file for messages and connection
information.
HBOMB ~# tail -f /var/log/zbd.log
zebedee(6412/1): DEFAULT CONFIGURATION FILE -- EDIT BEFORE USE
zebedee(6412/1): waiting for connection on port 11965
zebedee(6412/1): accepted connection from 224.224.224.2
zebedee(6412/1): waiting for connection on port 11965
zebedee(6412/4): key identity matched:
c8690fbe9005fdb211176fbea405559527f67282 rizzo
zebedee(6412/4): tunnel established to port 161
zebedee(6412/4): compression level 0x6, key length 128
zebedee(6412/1): accepted connection from 224.224.224.2
zebedee(6412/1): waiting for connection on port 11965
zebedee(6412/5): tunnel established to port 161
zebedee(6412/5): compression level 0x6, key length 128
zebedee(6412/4): read 302 bytes (401 expanded) in 7 messages
zebedee(6412/4): wrote 167 bytes (267 expanded) in 5 messages
zebedee(6412/4): connection closed
zebedee(6412/5): read 144 bytes (144 expanded) in 6 messages
zebedee(6412/5): wrote 8 bytes (8 expanded) in 2 messages
zebedee(6412/5): connection closed
Conclusion and After Thoughts
This only scratches the surface as it relates to Zebedee, checkout the man page
() for other features not included
in the scope of this document. Zebedee was a sane choice for its exclusive
handling of UDP packets, the only of its kind. Originally,
toying with netcat to carry out TCP => UDP conversion with limited results (nc
-l -p 2345 | nc -u localhost -p 161). One thing that is possible with this
application is encrypting all hosts on a network with a single Zebedee Server
process. A very robust and cost effective solution until SNMPv3 is the
prefacto standard.
Other proven solutions for Zebedee are http, vnc, ftp, and X. On the UDP side,
syslog comes to mind with print related protocols and maybe streaming audio/video
feeds for faster speeds with compression features.
Zebedee Credit
Zebedee is written and copyright Neil Winton.
You may obtain the latest copy of Zebedee, including full source code from and all other inquiries about Zebedee can be
Zebedee is entirely free for commercial and non-commercial use and distributed under
the terms of the GNU General Public License.
This document drafted with a Model M Keyboard.
References
[1] W.Stallings, SNMPv3: A Security Enhancment to SNMP, July 1998
[2] BUGTRAQ List listserv@netspace.org
[3] Essential SNMP, Douglas R. Mario & Kevin J. Schmidt, Oreilly and Associates
[4] SNMP Research International, SNMP Security Pack,
[5] Security Exposures with the Simple Network Management Protocol,
Larry Korba, National Research Council of Canada.
[6] Zebedee Manual, Neil Winton, | https://packetstormsecurity.com/files/29483/snmprizzo.txt.html | CC-MAIN-2022-40 | refinedweb | 1,970 | 56.45 |
import "encoding/xml"
Package xml implements a simple XML 1.0 parser that understands XML name spaces.
const ( // Header is.>
func Unmarshal(data []byte, v interface{}) error.
Unmarshal maps an XML element or attribute value to an integer or floating-point field by setting the field to the result of interpreting the string value in decimal. There is no check for overflow..
Code:}
Copy creates a new copy of CharData.
type Comment []byte
A Comment represents an XML comment of the form <!--comment-->. The bytes do not include the <!-- and --> comment markers.
func (c Comment) Copy() Comment = HTMLAutoClose; // d.Entity =.
func NewDecoder(r io.Reader) *Decoder.
func (d *Decoder) Decode(v interface{}) error.
func (d *Decoder) InputOffset() int64
InputOffset returns the input stream byte offset of the current decoder position. The offset gives the location of the end of the most recently returned token and the beginning of the next token.
func (d *Decoder) RawToken() (Token, error)
RawToken is like Token but does not verify that start and end elements match and does not translate name space prefixes to their corresponding URLs.
func (d *Decoder) Skip() error.
func (d *Decoder) Token() (Token, error).
type Directive []byte
A Directive represents an XML directive of the form <!text>. The bytes do not include the <! and > markers.
func (d Directive) Copy() Directive
Copy creates a new copy of Directive.
type Encoder struct { // contains filtered or unexported fields }
An Encoder writes XML data to an output stream.>
func NewEncoder(w io.Writer) *Encoder
NewEncoder returns a new encoder that writes to w.
func (enc *Encoder) Encode(v interface{}) error.
func (enc *Encoder) EncodeToken(t Token) error. }.
type MarshalerAttr interface { MarshalXMLAttr(name Name) (Attr, error) }.
Copy creates a new copy of ProcInst.
type StartElement struct { Name Name Attr []Attr }
A StartElement represents an XML start element.
func (e StartElement) Copy() StartElement
Copy creates a new copy ofaling TokenReader interface { Token() (Token, error) }.
type UnmarshalError string Decoder.DecodeElement, and then to copy the data from that value into the receiver. Another common strategy is to use Decoder.Token to process the XML object one token at a time. UnmarshalXML may not use Decoder.RawToken.
type UnmarshalerAttr interface { UnmarshalXMLAttr(attr Attr) error }.
type UnsupportedTypeError struct { Type reflect.Type }
UnsupportedTypeError is returned when Marshal encounters a type that cannot be converted into XML.
func (e *UnsupportedTypeError) Error() string | https://static-hotlinks.digitalstatic.net/encoding/xml/ | CC-MAIN-2018-51 | refinedweb | 390 | 53.37 |
view raw
I have an RDD of (key,value) elements. The keys are NumPy arrays. NumPy arrays are not hashable, and this causes a problem when I try to do a
reduceByKey
import numpy as np
from pyspark import SparkContext
sc = SparkContext()
data = np.array([[1,2,3],[4,5,6],[1,2,3],[4,5,6]])
rd = sc.parallelize(data).map(lambda x: (x,np.sum(x))).reduceByKey(lambda x,y: x+y)
rd.collect()
An error occurred while calling
z:org.apache.spark.api.python.PythonRDD.collectAndServe.
...
TypeError: unhashable type: 'numpy.ndarray'
The simplest solution is to convert it to an object that is hashable. For example:
from operator import add reduced = sc.parallelize(data).map( lambda x: (tuple(x), x.sum()) ).reduceByKey(add)
and convert it back later if needed.
Is there a way to supply the Spark context with my manual hash function
Not a straightforward one. A whole mechanism depend on the fact object implements a
__hash__ method and C extensions are cannot be monkey patched. You could try to use dispatching to override
pyspark.rdd.portable_hash but I doubt it is worth it even if you consider the cost of conversions. | https://codedump.io/share/AM53A41kxXpL/1/spark-how-to-quotreducebykeyquot-when-the-keys-are-numpy-arrays-which-are-not-hashable | CC-MAIN-2017-22 | refinedweb | 197 | 61.63 |
How to Use Character Input/Output in C Programming
The simplest type of input and output in C programming takes place at the character level: One character goes in; one character comes out. Of course, getting to that point involves a wee bit of programming.
Input and output devices in C programming
The C language was born with the Unix operating system. As such, it follows many of the rules for that operating system with regard to input and output. Those rules are pretty solid:
Input comes from the standard input device, stdin.
Output is generated by the standard output device, stdout.
On a computer, the standard input device, stdin, is the keyboard. Input can also be redirected by the operating system, so it can come from another device, like a modem, or it can also come from a file.
The standard output device, stdout, is the display. Output can be redirected so that it goes to another device, such as a printer or into a file.
C language functions that deal with input and output access the stdin and stdout devices. They do not directly read from the keyboard or output to the screen. Well, unless you code your program to do so.
Bottom line: Although your programs can get input from the keyboard and send output to the screen, you need to think about C language I/O in terms of stdin and stdout devices instead. If you forget that, you can get into trouble.
How to fetch characters with getchar()
It’s time for your code to become more interactive. Consider the source code from It Eats Characters, which uses the getchar() function. This function gets (reads) a character from standard input.
IT EATS CHARACTERS
#include <stdio.h> int main() { int c; printf("I’m waiting for a character: "); c = getchar(); printf("I waited for the '%c' character.n",c); return(0); }
The code in It Eats Characters reads a character from standard input by using the getchar() function at Line 8. The character is returned from getchar() and stored in the c integer variable.
Line 9 displays the character stored in c. The printf() function uses the %c placeholder to display single characters.
Exercise 1: Type the source code for project ex0701 , as shown in It Eats Characters. Build and run.
The getchar() function is defined this way:
#include <stdio.h> int getchar(void);
The function has no arguments, so the parentheses are always empty; the word void in this example basically says so. And the getchar() function requires the stdio.h header file to be included with your source code.
getchar() returns an integer value, not a char variable. The compiler warns you when you forget. And don’t worry: The int contains a character value, which is just how it works.
Exercise 2: Edit Line 9 in the source code from It Eats Characters so that the %d placeholder is used instead of %c. Build and run.
The value that’s displayed when you run the solution to Exercise 1 is the character’s ASCII code value. The %d displays that value instead of a character value because internally the computer treats all information as values. Only when information is displayed as a character does it look like text.
Technically, getchar() is not a function. It’s a macro — a shortcut based on another function, as defined in the stdio.h header file. The real function to get characters from standard input is getc(); specifically, when used like this:
c = getc(stdin);
In this example, getc() reads from the standard input device, stdin, which is defined in the stdio.h header file. The function returns an integer value, which is stored in variable c.
Exercise 3: Rewrite the source code for It Eats Characters, replacing the getchar() statement with the getc() example just shown.
Exercise 4: Write a program that prompts for three characters; for example:
I’m waiting for three characters:
Code three consecutive getchar() functions to read the characters. Format the result like this:
The three characters are 'a', 'b', and 'c'
where these characters — a, b, and c — would be replaced by the program’s input.
The program you create in Exercise 4 waits for three characters. The Enter key is a character, so if you type A, Enter, B, Enter, the three characters are A, the Enter key character, and then B. That’s valid input, but what you probably want to type is something like ABC or PIE or LOL and then press the Enter key.
Standard input is stream-oriented. Don’t expect your C programs to be interactive. Exercise 4 is an example of how stream input works; the Enter key doesn’t end stream input; it merely rides along in the stream, like any other character.
How to use the putchar() function
The evil twin of the getchar() function is the putchar() function. It serves the purpose of kicking a single character out to standard output. Here’s the format:
#include <stdio.h> int putchar(int c);
To make putchar() work, you send it a character, placing a literal character in the parentheses, as in
putchar('v');
Or you can place the ASCII code value (an integer) for the character in the parentheses. The function returns the value of the character that’s written.
PUTTING PUTCHAR() TO WORK
#include <stdio.h> int main() { int ch; printf("Press Enter: "); getchar(); ch = 'H'; putchar(ch); ch = 'i'; putchar(ch); putchar('!'); return(0); }
This chunk of code uses the getchar() function to pause the program. The statement in Line 8 waits for input. The input that’s received isn’t stored; it doesn’t need to be. The compiler doesn’t complain if you don’t keep the value returned from the getchar() function (or from any function).
In Lines 9 through 12, the putchar() function displays the value of variable ch one character at a time.
Single-character values are assigned to the ch variable in Lines 9 and 11. The assignment works just like assigning values, though single characters are specified, enclosed in single quotes. This process still works, even though ch isn’t a char variable type.
In Line 13, putchar() displays a constant value directly. Again, the character must be enclosed in single quotes.
Exercise 5: Create a new project, ex0705, using the source code shown in Putting putchar() to Work. Build and run the program.
One weird thing about the output is that the final character isn’t followed by a newline. That output can look awkward on a text display, so:
Exercise 6: Modify the source code from Exercise 5 so that one additional character is output after the ! character (the newline character). | https://www.dummies.com/programming/c/how-to-use-character-inputoutput-in-c-programming/ | CC-MAIN-2019-04 | refinedweb | 1,120 | 73.88 |
This function may be used for opening a file in different modes. The function prototype may be written in the following manner:
FILE *freopen(const char* filename, const char* mode, FILE* stream);
The function opens the file whose name is the string filename in a mode pointed to by mode and associates it with the stream pointed to by stream. The function returns pointer to stream if successful otherwise it returns a NULL pointer. Program provides an illustration for re-opening a file in different modes.
#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE* fptr; //filestream
fptr = fopen ("Student_file","w");
clrscr();
if( fptr ==NULL) //test if fopen () fails to open file.
{
printf("File could not be opened.");
exit (1);
}
else
printf("File Student_fileis open for writing.\n");
freopen ("Student_file","a", fptr);
/* reopen filefor appending*/
if(fptr ==NULL)
printf( "Failed to reopen");
else
printf ("Student_file is opened in append mode.\n");
freopen ("Student_file","r", fptr);
/* reopen filefor appending*/
if(fptr ==NULL)
printf( "Failed to reopen");
else
printf("The file is open for reading.\n");
fclose(f | http://ecomputernotes.com/what-is-c/file-handling/function-freopen | CC-MAIN-2019-04 | refinedweb | 176 | 63.7 |
Investors in Gilead Sciences Inc (Symbol: GILD) saw new options become available today, for the June 14th expiration. At Stock Options Channel, our YieldBoost formula has looked up and down the GILD options chain for the new June 14th contracts and identified one put and one call contract of particular interest.
The put contract at the $64.50 strike price has a current bid of $1.82. If an investor was to sell-to-open that put contract, they are committing to purchase the stock at $64.50, but will also collect the premium, putting the cost basis of the shares at $62.68 (before broker commissions). To an investor already interested in purchasing shares of GILD, that could represent an attractive alternative to paying $64.98/share today.
Because the .82% return on the cash commitment, or 23.95% annualized — at Stock Options Channel we call this the YieldBoost.
Below is a chart showing the trailing twelve month trading history for Gilead Sciences Inc, and highlighting in green where the $64.50 strike is located relative to that history:
Turning to the calls side of the option chain, the call contract at the $65.50 strike price has a current bid of $1.60. If an investor was to purchase shares of GILD stock at the current price level of $64.98/share, and then sell-to-open that call contract as a "covered call," they are committing to sell the stock at $65.50. Considering the call seller will also collect the premium, that would drive a total return (excluding dividends, if any) of 3.26% if the stock gets called away at the June 14th expiration (before broker commissions). Of course, a lot of upside could potentially be left on the table if GILD shares really soar, which is why looking at the trailing twelve month trading history for Gilead Sciences Inc, as well as studying the business fundamentals becomes important. Below is a chart showing GILD's trailing twelve month trading history, with the $65.50 strike highlighted in red:
Considering the fact that the $65.46% boost of extra return to the investor, or 20.90% annualized, which we refer to as the YieldBoost.
The implied volatility in the put contract example is 36%, while the implied volatility in the call contract example is 32%.
Meanwhile, we calculate the actual trailing twelve month volatility (considering the last 251 trading day closing values as well as today's price of $64.98) to be 24%.. | https://www.nasdaq.com/articles/june-14th-options-now-available-gilead-sciences-gild-2019-05-02 | CC-MAIN-2021-21 | refinedweb | 419 | 63.9 |
/* *Name: Allan *Purpose: Birthday song test *Date: Feb 14, 2009 */ public class BirthdaySongTest { public static void main(String[] args) { /*Test the BirthdaySong class. * Instantiate a BirthdaySong object named b1. */ BirthdaySong b1 = new BirthdaySong(); //Have b1 print the song. System.out.println(b1); }//end main () }//end BirthdaySongTest
the output is [email protected]
it should be the lyrics to happy birthday as seen below.
In the same folder i have saved BirthdaySong.java. This is what I have in BirthdaySong.java.
public class BirthdaySong { public BirthdaySong() { } public void sing() { System.out.println("Happy birthday to you"); System.out.println("Happy birthday to you"); System.out.println("Happy birthday dear "); System.out.println("Happy birthday to you"); } }
I would greatly appreciate any insights and an explanation on what i have to do to get it to print out the correct lyrics. | http://www.dreamincode.net/forums/topic/86869-birthdaysongtest/ | CC-MAIN-2018-05 | refinedweb | 138 | 60.41 |
Swift OpenGL Loader
This is a simple OpenGL loader library. The repo currently contains code to load a Core profiles from 3.3 to 4.6. The included profiles do not load any extensions.
This repository has been adapted from code originally written by David Turnbull. His code can be found here:
This fork allows generating code for multiple profiles at once and removes the implicit library loading and function binding step of the original code. By requiring an explicit call to loadGL, client code to verify if the required OpenGL profile was loaded correctly.
Using a loader
To load an OpenGL version 3.3 profile
import GLLoader33 guard GLLoader33.loadGL(getGLProc) else { print("Could now load GL 3.3 profile") exit(1) }
The type signature of getGLProc is:
public typealias GLFuncType = @convention(c) () -> Void public typealias GetGLFunc = @convention(c) (_ : UnsafePointer<Int8>) -> GLFuncType?
All bindings default to stub implementations and only point at the real OpenGL functions after loadGL() has returned successfully.
Generating a new loader
If you don't want functions for a Core 3.3 profile, or want to add extensions, "Tools/main.swift" is what you want.
In the repo root:
swift run glgen Tools/gl.xml loader4.6 --profile GL_VERSION_4_6
This will generate a new set of GL functions and loader func in the "loader4.6" directory. As renderers will likely depend on specific profile/extension combinations, it is recommended to fork this repo and add additional products to Package.swift or generate loaders for your desired profile/extensions combinations and add them to your own repository.
The pre-generated code in this repo is handy if you only need a vanilla Core profile.
Shortcomings
The one major issue with the current loader logic is that the load will "fail" if any of the extensions cannot be loaded. Whilst it is reasonable to fail if the any parts of the Core profile cannot be loaded, a mechanism for communicating which extensions were successfully loaded or not is likely more helpful for clients. As it is not yet a requirement for my engine, I have not implemented this.
As always, pull requests are welcome.
Github
Help us keep the lights on
Dependencies
Used By
Total: 0 | https://swiftpack.co/package/Satook/sw-OpenGLLoader | CC-MAIN-2019-30 | refinedweb | 370 | 57.37 |
Introduction
In this article I hope to show you what attributes are, how to use existing
attributes, and how to create your own attributes to use in your own projects.
Essentially attributes are a means of decorating your code with various
properties at compile time. This can be passive, such as marking a
class as Serializable with the SerializableAttribute, or it can take a more active
role, such as the MarshalAsAttribute which tells the runtime how to pass data
between managed and unmanaged code.
Serializable
SerializableAttribute
MarshalAsAttribute
In the former case when you try serializing an object, the runtime checks to
see if the object has the SerializableAttribute applied to it. In this
case the attribute is nothing more than a flag to let the runtime know that the
classes author gave the OK for serialization (since this could expose some
sensitive data to someone who should see it).
In the latter case a more active role is taken. The MarshalAsAttribute
when applied to a field in a struct will tell the runtime what type of data the
.NET type should be formatted as when it is sent to unmanaged code, and what
type it should convert the return value from when it comes back from the unmanaged code.
void MyMethod([MarshalAs(LPStr)] string s);
The above method marshals the string as an LPStr (zero terminated ANSI
string), the string is modified by the runtime so that it can be used by the
function MyMethod.
MyMethod
All attributes inherit from System.Attribute and are classes just like 90% of
the framework. This also means that what you can do with a class you can
do with an attribute; given an instance of an attribute you can get its
underlying type. You can also create attributes at runtime with the
Reflection.Emit classes and bind them to classes you have built with the Emit
package.
System.Attribute
Reflection.Emit
In C# attributes are placed before the item that they will be "decorating"
and they are put inside square braces [].
[Serializable()]
public class MySerializableClass
....
Like C#, VB.NET places attributes before the item that will be decorated,
except VB.NET uses angle brackets <>.
<Serializable()>
Public Class MySerializableClass
....
Notice that even though the real name for the attribute is
SerializableAttribute we didn't write Attribute? The only time that you
can leave off the Attribute portion of the name is when you are applying the
Attribute to a class
SerializableAttribute
The code above actually expands out to
[SerializableAttribute()]
public class MySerializableClass
This shortened name can only be used when the attribute is being applied, in
your code that uses the attribute you must use the full name.
SerializableAttribute [] sa = (SerializableAttribute []) type.GetCustomAttributes(typeof(SerializableAttribute), false);
Note here I had to give the full name just as I would with any other class.
The constructor for MarshalAs is defined as public
MarshalAsAttribute(UnmanagedType);. Note that it only accepts one
parameter, what about the other properties?
public
MarshalAsAttribute(UnmanagedType);
This is the most confusing part about attributes so you may have to do a
couple examples before this part clicks since it deviates from normal C style
methods and gets into a VB-esque style.
You set the properties in the constructor, after all the parameters for the
constructor. For example, we're going to pass an array of three 32-bit
ints to a method, I'll omit the actual void MyMethod garbage since you
can see that above
void MyMethod
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I4)]
I don't want to weigh you down with the specifics of MarshalAs since I just
want to use it as an example, but you can see that the first thing passed in was
a member of the UnmanagedType enum, followed by setting of two properties
SizeConst and ArraySubType. This is how all attributes will
work, if the constructor doesn't allow you to set the property, you can set it
by doing so after the parameters of the constructor.
MarshalAs
UnmanagedType
SizeConst
ArraySubType
VB programmers will remember this as passing by name.
Ok, you've seen how to use an attribute, how about making one?
If you're using VS.NET create a new console project called TestAttribute and
remove any files that are added to it, we'll be replacing them with our own
versions. If you are using the .NET Framework SDK just create a new
directory to house the project.
Commented versions of the code can be found in the source download.
The attribute we will create here will have an imaginary importance in our
demo project. Let's say that it serves as a flag for our program to do
something with the class it is applied to, the number signifying what method of
testing to use. We also wish to have the class name itself, but this isn't
required.
There will be two test classes, one with the default name, and the other
specifying its name.
The driver class will search for our attribute on objects passed in. If
the attribute exists it will printout the classname and call the attributes
PrintOut method. If the attribute doesn't exist, it will print out a
message saying that it doesn't exist.
Open up a new file called TestAttribute.cs (create a new file called
TestAttribute.cs if you're using VS.NET) and put the following code into it
using System;
namespace Test
{
public class TestAttribute : Attribute
{
public int TheNumber;
public string Name;
public TestAttribute(int number)
{
TheNumber = number;
}
public void PrintOut()
{
Console.WriteLine("\tTheNumber = {0}", TheNumber);
Console.WriteLine("\tName = \"{0}\"", Name);
}
}
}
Thats all there is to your most basic of attributes, data is defined on
it and a single method is there to print out the values of those fields.. As you can see its just a class that inherits from System.Attribute,
and it has two public fields, these could have easily been properties if we
wanted, but my focus was on as little code as possible.
Now lets go use it!
Create a file called TestClasses.cs (add a new class called TestClasses if you're
using VS.NET) and add the following code.
using System;
namespace Test
{
[Test(3)]
public class TestClassA
{
public TestClassA()
{
}
}
[Test(4, Name = "TestClassB")]
public class TestClassB
{
public TestClassB()
{
}
}
}
Here we have defined two classes that our attribute uses.
Now lets add the driver so we can see that the attribute truly is there and
how we go about accessing it!
Create a new file called Driver.cs (add a new class called Driver if you're
using VS.NET) and add the following code
using System;
namespace Test
{
public class Driver
{
public static void Main(string [] Args)
{
TestClassA a = new TestClassA();
TestClassB b = new TestClassB();
string c = "";
PrintTestAttributes(a);
PrintTestAttributes(b);
PrintTestAttributes(c);
}
public static void PrintTestAttributes(object obj)
{
Type type = obj.GetType();
TestAttribute [] AttributeArray =
(TestAttribute []) type.GetCustomAttributes(typeof(TestAttribute),
false);
Console.WriteLine("Class:\t{0}", type.Name);
if( AttributeArray.Length == 0 )
{
Console.WriteLine("There are no TestAttributes applied to this class {0}",
type.Name);
return ;
}
TestAttribute ta = AttributeArray[0];
ta.PrintOut();
}
}
}
Now compile the program on the command line by running csc like so csc /out:test.exe /target:exe *.cs
csc /out:test.exe /target:exe *.cs
When you execute the program you should get output like the image at the top
shows.
All of the work is done by the framework with the call to GetCustomAttributes
on the Type object. GetCustomAttributes takes two parameters, the first is
a Type object for the attribute we wish to get, the second is a boolean telling
the framework whether it should look at the types that this class derives from.
GetCustomAttributes returns an object array containing each of the attributes
found that match the Type passed in. In this case we requested all
attributes of a specific type, so we can safely cast that to an array of our
attribute. At the very least we could cast that to an array of
Attribute's. If you wish to get all attributes attached to a type
you just pass in value for the bool.
If you look up the GetCustomAttributes method you'll see that it is defined
on the MemberInfo class. This class is an abstract class which has several
derivatives; Type, EventInfo, MethodBase, PropertyInfo, and
FieldInfo.
Each of those classes represents a part of the very basics for the type system.
Right now the TestAttribute can be applied to all those parts of a class, what
if TestAttribute only makes sense to be applied to classes? Enter the
AttributeUsage attribute.
MemberInfo
Type
EventInfo
MethodBase
PropertyInfo
FieldInfo
TestAttribute
AttributeUsage
Once it has gotten an array of TestAttribute's it determines how many are in
the array; if there are none in the array we know that the class doesn't have
the TestAttribute applied to it; else we take the first one in the array and
tell it to output its values by the PrintOut method we created in the
TestAttribute class.
TestAttribute's
PrintOut
TestAttribute
This attribute is used at compile time to ensure that attributes can only be
used where the attribute author allows. This attribute also allows the
author to specify whether the same attribute can be applied multiple times to
the same object and if the attribute applies to objects that derive from the
class it is applied to.
A simple modification to TestAttribute.cs restricts our attribute to being
applied only to classes.
....
[AttributeUsage(AttributeTargets.Class)]
public class TestAttribute : Attribute
....
Now the TestAttribute can only be applied to classes. By default
attributes aren't inherited and can only be applied once so we needn't do
anything more with it.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
The usage above would allow the attribute to be applied to only classes and
structs.
Below is the list of all the flags in the AttributeTargets enumeration.
The enumeration is marked as Flags so you can combine two or more different
values to allow the attribute to be applied to more than one element.
AttributeTargets
Want a brain teaser? Look at the documentation for the AttributeUsage
attribute, notice that it too has the AttributeUsage attribute applied to it...
So which came first? The AttributeUsage attribute or the AttributeUsage
attribute!
AttributeUsage
Attributes can be attached to virtually everything, classes, methods, fields,
properties, parameters in methods, return values of methods; having at least a
basic knowledge of what attributes are and how to use them is extremely helpful
in the long run. In reading this article you should have learned how to
use them as well as create basic attributes that you can use in your own code.
As usual, any comments or questions post below or e-mail. | http://www.codeproject.com/Articles/1811/Creating-and-Using-Attributes-in-your-NET-applicat?fid=3256&df=90&mpp=10&sort=Position&spc=None&tid=988292 | CC-MAIN-2014-52 | refinedweb | 1,788 | 62.88 |
<<value-type>> Represents a StructType member More...
#include "dds/core/xtypes/MemberType.hpp"
<<value-type>> Represents a StructType member
Encapsulates the name and type of a StructType member along with several IDL annotations (key, optional, bitset, bitbound, id).
Creates a member consisting of a name and a type.
Gets the name.
Gets the member name.
Gets the member type.
Checks if a member is a key.
This corresponds to the @Key IDL member annotation
Checks if a member is optional.
This corresponds to the @Optional IDL member annotation
Checks if a member is a bitset.
Unsupported, always returns false.
Unsupported, always returns 32.
Sets the member name.
Sets the key annotation of a member.
[default] false
Sets the ID annotation of a member.
[default] Automatically assigned as the ID of the previous member plus one previous member
<<extension>> Makes a member a pointer
[default] false | https://community.rti.com/static/documentation/connext-dds/5.2.0/doc/api/connext_dds/api_cpp2/classdds_1_1core_1_1xtypes_1_1Member.html | CC-MAIN-2022-33 | refinedweb | 145 | 53.58 |
Building a Data Science Portfolio: Machine Learning Project Part 3
The final installment of this comprehensive overview on building an end-to-end data science portfolio project focuses on bringing it all together, and concludes the project quite nicely.
Making predictions
Now that we have the preliminaries out of the way, we’re ready to make predictions. We’ll create a new file called
predict.py that will use the
train.csv file we created in the last step. The below code will:
- Import needed libraries.
- Create a function called
cross_validatethat:
- Creates a logistic regression classifier with the right keyword arguments.
- Creates a list of columns that we want to use to train the model, removing
idand
foreclosure_status.
- Run cross validation across the
trainDataFrame.
- Return the predictions.
import os import settings import pandas as pd from sklearn import cross_validation from sklearn.linear_model import LogisticRegression from sklearn import metrics def cross_validate(train): clf = LogisticRegression(random_state=1, class_weight="balanced") predictors = train.columns.tolist() predictors = [p for p in predictors if p not in settings.NON_PREDICTORS] predictions = cross_validation.cross_val_predict(clf, train[predictors], train[settings.TARGET], cv=settings.CV_FOLDS) return predictions
Predicting error
Now, we just need to write a few functions to compute error. The below code will:
- Create a function called
compute_errorthat:
- Uses scikit-learn to compute a simple accuracy score (the percentage of predictions that matched the actual
foreclosure_statusvalues).
- Create a function called
compute_false_negativesthat:
- Combines the target and the predictions into a DataFrame for convenience.
- Finds the false negative rate.
- Create a function called
compute_false_positivesthat:
- Combines the target and the predictions into a DataFrame for convenience.
- Finds the false positive rate.
- Finds the number of loans that weren’t foreclosed on that the model predicted would be foreclosed on.
- Divide by the total number of loans that weren’t foreclosed on.
def compute_error(target, predictions): return metrics.accuracy_score(target, predictions) def compute_false_negatives(target, predictions): df = pd.DataFrame({"target": target, "predictions": predictions}) return df[(df["target"] == 1) & (df["predictions"] == 0)].shape[0] / (df[(df["target"] == 1)].shape[0] + 1) def compute_false_positives(target, predictions): df = pd.DataFrame({"target": target, "predictions": predictions}) return df[(df["target"] == 0) & (df["predictions"] == 1)].shape[0] / (df[(df["target"] == 0)].shape[0] + 1)
Putting it all together
Now, we just have to put the functions together in
predict.py. The below code will:
- Read in the dataset.
- Compute cross validated predictions.
- Compute the
3error metrics above.
- Print the error metrics.
def read(): train = pd.read_csv(os.path.join(settings.PROCESSED_DIR, "train.csv")) return train if __name__ == "__main__": train = read() predictions = cross_validate(train) error = compute_error(train[settings.TARGET], predictions) fn = compute_false_negatives(train[settings.TARGET], predictions) fp = compute_false_positives(train[settings.TARGET], predictions) print("Accuracy Score: {}".format(error)) print("False Negatives: {}".format(fn)) print("False Positives: {}".format(fp))
Once you’ve added the code, you can run
python predict.py to generate predictions. Running everything shows that our false negative rate is
.26, which means that of the foreclosed loans, we missed predicting
26% of them. This is a good start, but can use a lot of improvement!
You can find the complete
predict.py file here.
Your file tree should now look like this:
loan-prediction ├── data │ ├── Acquisition_2012Q1.txt │ ├── Acquisition_2012Q2.txt │ ├── Performance_2012Q1.txt │ ├── Performance_2012Q2.txt │ └── ... ├── processed │ ├── Acquisition.txt │ ├── Performance.txt │ ├── train.csv ├── .gitignore ├── annotate.py ├── assemble.py ├── predict.py ├── README.md ├── requirements.txt ├── settings.py
Writing up a README
Now that we’ve finished our end to end project, we just have to write up a
README.md file so that other people know what we did, and how to replicate it. A typical
README.md for a project should include these sections:
- A high level overview of the project, and what the goals are.
- Where to download any needed data or materials.
- Installation instructions.
- How to install the requirements.
- Usage instructions.
- How to run the project.
- What you should see after each step.
- How to contribute to the project.
- Good next steps for extending the project.
Here’s a sample
README.md for this project.
Next steps
Congratulations, you’re done making an end to end machine learning project! You can find a complete example project here. It’s a good idea to upload your project to Github once you’ve finished it, so others can see it as part of your portfolio.
There are still quite a few angles left to explore with this data. Broadly, we can split them up into
3 categories – extending this project and making it more accurate, finding other columns to predict, and exploring the data. Here are some ideas:
- Generate more features in
annotate.py.
- Switch algorithms in
predict.py.
- Try using more data from Fannie Mae than we used in this post.
- Add in a way to make predictions on future data. The code we wrote will still work if we add more data, so we can add more past or future data.
- Try seeing if you can predict if a bank should have issued the loan originally (vs if Fannie Mae should have acquired the loan).
- Remove any columns from
trainthat the bank wouldn’t have known at the time of issuing the loan.
- Some columns are known when Fannie Mae bought the loan, but not before.
- Make predictions.
- Explore seeing if you can predict columns other than
foreclosure_status.
- Can you predict how much the property will be worth at sale time?
- Explore the nuances between performance updates.
- Can you predict how many times the borrower will be late on payments?
- Can you map out the typical loan lifecycle?
- Map out data on a state by state or zip code by zip code level.
- Do you see any interesting patterns?
If you build anything interesting, please let us know in the comments!
Bio: Vik Paruchuri is a Data Scientist and Developer based in San Francisco. He's the founder Dataquest, where you can learn data science from the comfort of your browser.
If you liked this, you might like to read the other posts in our ‘Build a Data Science Porfolio’ series:
Original. Reposted with permission.
Related: | https://www.kdnuggets.com/2016/07/building-data-science-portfolio-machine-learning-project-part-3.html/2 | CC-MAIN-2019-30 | refinedweb | 1,007 | 60.92 |
On Tue, Jul 19, 2005 at 05:52:14PM +0200, Lars Marowsky-Bree wrote: > The nodeid, I thought, was relative to a given DLM namespace, no? This > concept seems to be missing here, or are you suggesting the nodeid to be > global across namespaces? I'm not sure I understand what you mean. A node would have the same nodeid across different dlm locking-domains, assuming, of course, those dlm domains were in the context of the same cluster. The dlm only uses nodemanager to look up node addresses, though. >. > How would kernel components use this and be notified about changes to > the configuration / membership state? "Nodemanager" is perhaps a poor name; at the moment its only substantial purpose is to communicate node address/id associations in a way that's independent of a specific driver or fs. Changes to cluster configuration/membership happen in user space, of course. Those general events will have specific consequences to a given component (fs, lock manager, etc). These consequences vary quite widely depending on the component you're looking at.. Dave | https://www.redhat.com/archives/linux-cluster/2005-July/msg00185.html | CC-MAIN-2014-10 | refinedweb | 178 | 54.32 |
Yes, this does sound like a Star Wars movie, but no, I'm not a Star Wars geek that just likes to pull lines from my favorite movies (though I rather enjoyed Star Wars). This post will deal with what we've coined "the phantom method". It's the method that the static compiler will bind to during the initial binding phase when it recognizes that the invocation its trying to bind needs to be bound dynamically and cannot be resolved statically. It uses the rules that we talked about last time to determine what types to use at runtime.
Lets consider a simple example:
public class C
{
public void Foo(int x)
{
}
static void Main()
{
dynamic d = 10;
C c = new C();
c.Foo(d);
}
}
When we try to bind the call to Foo, the compiler's overload resolution algorithm will construct the candidate set containing the sole candidate, C.Foo(int). At that point, we consider whether or not the arguments are convertible. But wait! We haven't talked about the convertibility of dynamic yet!
Lets take a quick segue into talking about the convertibility of the dynamic type.
The quick and easy way to think about dynamic conversions is that everything is convertible to dynamic, and dynamic is not convertible to anything. "Wait a sec!", you say. "That doesn't make any sense!" And you're absolutely right, it doesn't make any sense - not until we talk about the special handling of dynamic in situations where you would expect convertibility.
In each of these special situations that you would expect some sort of conversion, the dynamic type signifies that the conversion is to be done dynamically, and the compiler generates all the surrounding DLR code that prompts a runtime conversion.
Lets let the local variable "c" denote some static typed local, and the variable "d" denote some dynamically typed expression. The special situations in question are the following:
We'll look at overload resolution today and explore the concepts, and leave the remaining scenarios as excercises for the reader. :)
Back to argument convertibility. Since dynamic is not convertible to anything else, our argument d is not convertible to int. However, since we've got a dynamically typed argument, we really want the overload resolution for this call to be bound dynamically. Enter the phantom method.
The phantom method is a method which is introduced into the candidate set that has the same number of parameters as the number of arguments given, and each of those parameters is typed dynamic.
When the phantom method is introduced into the candidate set, it is treated like any other overload. Recall that since dynamic is not convertible to any other type, but all types are convertible to dynamic. This means that though all (well, not really all, but we'll discuss that later) of the normal overloads will fail due to the dynamic arguments being present, the phantom method will succeed.
In our example, we have one argument which is typed dynamic. We also have two overloads: Foo(int) and Foo(dynamic). The first overload fails because dynamic is not convertible to int. The second, the phantom, succeeds and so we bind to it.
Once a call is bound to the phantom overload, the compiler knows to generate the correct DLR magic to signal dispatching the call at runtime.
Only one question remains: when does the phantom overload get introduced?
When the compiler performs overload resolution, it considers each overload in the initial candidate set. If the invocation has any dynamic arguments, then for each candidate in the initial set, the compiler checks to see if the phantom overload should be introduced. The phantom will be introduced if:
Recall that earlier we had said that it would be possible for a call containing a dynamic argument to be dispatched statically instead of dynamically. This is explained by condition 2. If the overload in question contains dynamic parameters for each of the dynamic arguments, then the binding will be dispatched statically.
The following example will not yield a dynamic lookup, but will be bound statically:
public class C
{
public void Foo(int x, dynamic y) { ... }
static void Main()
{
C c = new C();
dynamic d = 10;
c.Foo(10, d);
}
}
Once the compiler has gone through each of the overloads in the initial binding pass, if the phantom has not yet been introduced, then overload resolution will behave as it always has, despite the occurrence of a dynamic parameter.
It is important to note that there is a subtle difference between dispatch signaled from the phantom method and dispatch signaled from a dynamic receiver.
With a dynamic receiver, the overloads that the runtime binder will consider are determined based on the runtime type of the receiver. However, with the phantom dispatch, the overloads will be determined based on the compile time type of the receiver.
This is because of intuition - one would expect that though the arguments are dynamic, the receiver is known at compile time, and so the candidate set that the call can dispatch to should be known at compile time as well.
More specifically, one would not expect some overload defined in some derived class (possibly not defined in one's own source!) to be called. This is precisely the consideration we took when designing the behavior of the dynamic dispatch.
Next time, we'll apply the rules and concepts that we talked about today to other invocations - operators, conversions, indexers, and properties.
PingBack from
Given this:
public void Foo(double x, dynamic y);
public void Foo(dynamic x, dynamic y);
Foo(123, (dynamic)456);
what do we get at the third line? compile-time error due to ambiguity?
Hey int19h,
The third line will give you a compile-time dispatched call to the first overload. This is because in terms of betterness conversions, 123 converting to double is better than 123 converting to dynamic.
The conversion to dynamic is a boxing conversion, whereas the conversion to double is simply a numeric one.% | http://blogs.msdn.com/b/samng/archive/2008/11/09/dynamic-in-c-iv-the-phantom-method.aspx | CC-MAIN-2014-15 | refinedweb | 1,004 | 52.09 |
Let's see how 353solutions did in 2016. We'll start with the numbers and then some insights and future goals.
Numbers
- Total of 193 work days (days where customer were billed)
- Up 23 days from 2015
- Out of 261 work days in 2016
- Out of these 61 days are in workshops and the rest consulting
- 18 workshops
- Up from 14 in 2015
- Go workshops
- First docker workshop (teaching with ops specialist)
- First open enrollment class
- In Israel, UK, and Poland
- Only 4 out of the country (vs 8 last year, which is good - I prefer to fly less)
- Workshops range from 1 to 4 days
- Revenue up 10% from 2016
- Several new clients including GE, AOL, Outbrain, EMC and more
Insights
- Social network keeps providing almost all the work
- Doing good work will get you more work
- Workshops pay way more than consulting
- However can't work from home in workshops
- Consulting keeps you updated with latest tech
- Python and data science are big and in high demand
- However Go is getting traction
- Having someone else take care of the "overhead" (billing, contracts ...) is great help.
Last Year's Goals
We've set some goals in 2015, let's see how we did:
We've set some goals in 2015, let's see how we did:
- Keep positioning in Python and Scientific Python area
- Done
- Drive more Go projects and workshops
- Done
- Works less days, have same revenue at end of year
- Failed here. Worked more and revenue went up
- Start some "public classes" where we rent a class and people show up
- Did only one this year
- Publish my book
Goals for 2016 | http://pythonwise.blogspot.com/2017_01_01_archive.html | CC-MAIN-2017-47 | refinedweb | 275 | 51.69 |
Efficiency is important when writing code. Why would you type something a second time if you do not have to? One way coders save time, reduce error, and make their code easier to read is through the use of functions.
Functions are a way of storing code so that it can be reused without having to retype or code it again. By saving a piece of reusable code as a function you only have to call the function in order to use it again. This improves efficiency and reliability of your code. Functions simply take an input, rearrange the input however it is supposed to, and provide an output. In this post, we will look at how to make a function using Python.
Simple Function
A function requires the minimum information
- A name
- Determines if any requirements (arguments) are needed
- The actual action the function is supposed to do to the input
We will now make a simple function as shown in the code below.
def example(): print("My first function")
In the code above we have the three pieces of information.
- The name of the function is “example” and you set the name using the “def” command.
- There are no requirements or arguments in this function. This is why the parentheses are empty. This will make more sense later.
- What this function does is use the “print” function to print the string “My first function”
We will now use the function by calling it in the example below.
example() My first function
As you can see, when we call the function it simply prints the string. This function is not that impressive but it shows you how functions work.
Functions with Arguments
Arguments are found with the parentheses of a function. They are placeholders for information that you must supply in order for the function to work. Below is an example.
def example(info): print(info)
Now our “example” function has a required argument called “info” we must always put something in place of this for the function to run. Below is an example of us calling the “example” function with a string in place of the argument “info”.
example("My second function") My second function
You can see that the function simply printed what we placed in the paratheses. If we had left the parentheses empty we would have gotten an error message. You can try that yourself.
You can assign a default value to your argument. This is useful if people do not provide their own value. Below we create the same function but with a default value for the argument.
def example(info="You forgot to give a value"): print(info)
We will now call it but we will not include the argument
example() You forgot to give a value
return and print
When creating functions, it is common to have to decide when to use the “return” or “print” function. Below are some guidelines
- Print is for people. If a person only needs to see the output without any other execution the print is a good choice.
- Return is appropriate when sending the data back to the caller for additional execution. For example, using one function before using a second function
If you take any of the examples and use “return” instead of “print” they will still work so the difference between “return” and “print” depends on the ultimate purpose of the application.
Conclusion
Functions play a critical role in making useful applications. This is due to their ability to save time for coders. THere are several concepts to keep in mind when developing functions. Understanding these ideas is important for future success. | https://educationalresearchtechniques.com/2018/08/22/making-functions-in-python/ | CC-MAIN-2019-35 | refinedweb | 608 | 63.49 |
I have Blender 2.49b installed and Python installed ok, but it still wont let me import DAE file because it says "\blender-2.49b-windows\blender-2.49b-windows\Lib\xml\parsers\expat.py
from pyexpat import * Import error: No module named pyexpat."
What do I do now??
from pyexpat import * Import error: No module named pyexpat.
An open space where people who use Blender in an academic environment can share progress and the typical problems and needs of academic environments.
Moderators: jesterKing, stiv
2 posts • Page 1 of 1
Which version of Python did you install?
It must be the same version that Blender 2.49 was compiled against.
It must be the same version that Blender 2.49 was compiled against.
Spacemice Wiki -- Input devices for a 3D world.
Spacemice / Blender Compatibility
Spacemice / Blender Compatibility
2 posts • Page 1 of 1
Return to “Academic & Research”
Who is online
Users browsing this forum: No registered users and 0 guests | http://www.blender.org/forum/viewtopic.php?t=24334 | CC-MAIN-2015-35 | refinedweb | 161 | 68.57 |
Create the in-cluster configuration file for the first time from using flags.
Using this command, you can upload configuration to the ConfigMap in the cluster using the same flags you gave to ‘kubeadm init’. If you initialized your cluster using a v1.7.x or lower kubeadm client and set certain flags, you need to run this command with the same flags before upgrading to v1.8 using ‘kubeadm upgrade’.
The configuration is located in the “kube-system” namespace in the “kubeadm-config” ConfigMap.
kubeadm config upload from-flags [flags]
Was this page helpful?
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on Stack Overflow. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement. | https://kubernetes.io/docs/reference/setup-tools/kubeadm/generated/kubeadm_config_upload_from-flags/ | CC-MAIN-2018-51 | refinedweb | 134 | 67.04 |
Ruby on Rails Developer Series: Ensuring Security is Covered in Your Application
Stay connected
Welcome to the last and fourth blog post in my Ruby on Rails Developer Series. In this part, our goal is to go over some major security themes to ensure best practices. We will piggyback from the project you have been building in the other parts and use project-specific scenarios that will help secure the application. The series theme is to make you feel confident as an engineer in building a structured project with Ruby on Rails.
1. Authentication
Having authentication set up helps verify that the user is sanctioned to have access. Say you wanted to access a specific item in our Todo list
todos/{:todo_id}/item/{:item_id}, however, if we don't validate, the user has access to view records. They can easily change the numbers of the
todo_id and
item_id and view those. I recommended you use an existing gem-like devise for authentication. Devise uses Bcrypt which makes it extremely difficult to for hackers to compute a password as it's computationally expensive with time. Devise has modules to also help with recovering passwords, registering, tracking user sign-ins, locking records, etc.
2. Strong Parameters
Having strong parameters is when you securely permit the data being sent to you from a request. Let us say we created a form that creates a Todo record: If we followed this common pattern
Todo.create(params[:todo]. And say the form was altered with fields that don't exist in the model then rails will raise an exception. The same scenario works for updating values in a form if there is something we didn't want to be updated. What do I do? By using strong parameters, you whitelist the values that can be used.
params.require(:todo).permit(:name, :priority)
Now if the user submits the form with incorrect data to the parameterized fields the form will throw an error. How do I use it?
def create Todo.create(todo_params) end def todo_params params.require(:todo).permit(:name, :priority) end
3. Slug it!
A slug is part of a URL that identifies a particular record in an easy-to-read form. Slugs are good because we don't have to reveal the
id of the record. I recommend using FriendlyId as it's the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. After implementing, we can change our
show methods to look like this:
Todo.friendly.find(params[:id])
params[:id] - will contain the slug as we now use it as the id of the record.
4. Use HTTPS
Protect sensitive data, especially logins or payment pages. These are easily sniffed when traffic is unencrypted since cookies are easily obtainable through cross-site scripting (XSS). In the application config file you will need to specify
config.force_ssl = true. Learn how to create an SSL certificate here.
5. Cross-Site Request Forgery (CSRF)
What is this? The attack method of cross-site request forgery is the idea that someone can insert malicious code into the application and trick the server to think the user is authenticated. This could allow the attacker to execute unauthorized commands. How do I enable this? Add
protect_from_forgery with: :exception in the application controller. You can rescue forgery if the request is invalid as follows:
rescue_from ActionController::InvalidAuthenticityToken do |exception| sign_out_user # Example method that will destroy the user cookies end
6. Check for Active Record Exceptions
One good thing we did in the previous part of the series was create an Exception Concern that sat on the top layer of the Application Controller to guard for specific application Active Record exceptions. The module below rescues these specific Active Record Exceptions:
module ExceptionHandler extend ActiveSupport::Concern included do rescue_from ActiveRecord::RecordNotFound do |e| render json: { message: e.message }, status: 404 end rescue_from ActiveRecord::RecordInvalid do |e| render json: { message: e.message }, status: 422 end end end
You can find more exceptions to guard for here.
Wrapping up the series
You have done it! Time to pat yourself on the back as we have planned to build our application and have built a structured project using Ruby on Rails. In this series, the goal was to outline how to bolster your API with strong top layers of infrastructure and Postgres, dockerize your project and add security layers to mitigate attacks to your application. I wanted to thank everyone for reading this series and I hope you feel more confident as an engineer building a rails application! I hope outlined the other parts for you to (re)visit. Part One Part Two Part Three
Additional resources
Read more about continuous security
Try CloudBees CodeShip for free
Download the whitepaper about DevSecOps
Stay up to date
We'll never share your email address and you can opt out at any time, we promise. | https://www.cloudbees.com/blog/ruby-on-rails-developer-series-ensuring-security-is-covered-in-your-application | CC-MAIN-2022-40 | refinedweb | 811 | 54.52 |
NAME
ExtUtils::MakeMaker::Tutorial - Writing a module with MakeMaker
SYNOPSIS
use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Your::Module', VERSION_FROM => 'lib/Your/Module.pm' );
DESCRIPTION
This is a short tutorial on writing a simple module with MakeMaker. Its really not that hard.
The Mantra
MakeMaker modules are installed using this simple mantra
perl Makefile.PL make make test make install
There are lots more commands and options, but the above will do it.
The Layout
The basic files in a module look something like this.
Makefile.PL MANIFEST lib/Your/Module.pm
That's all that's strictly necessary. There's additional files you might want:
lib/Your/Other/Module.pm t/some_test.t t/some_other_test.t Changes README INSTALL MANIFEST.SKIP bin/some_program
- Makefile.PL
When you run Makefile.PL, it makes a Makefile. That's the whole point of MakeMaker. The Makefile.PL is a simple module which loads ExtUtils::MakeMaker and runs the WriteMakefile() function with a few simple arguments.
Here's an example of what you need for a simple module:
use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Your::Module', VERSION_FROM => 'lib/Your/Module.pm' );
NAME is the top-level namespace of your module. VERSION_FROM is the file which contains the $VERSION variable for the entire distribution. Typically this is the same as your top-level module.
- MANIFEST
A simple listing of all the files in your distribution.
Makefile.PL MANIFEST lib/Your/Module.pm
Filepaths in a MANIFEST always use Unix conventions (ie. /) even if you're not on Unix.
You can write this by hand or generate it with 'make manifest'.
- lib/
This is the directory where.
- Changes
- README.
- INSTALL
Instructions on how to install your module along with any dependencies. Suggested information to include here:
any extra modules required for use the minimum version of Perl required if only works on certain operating systems
- MANIFEST.SKIP
A file full of regular expressions to exclude when using 'make manifest' to generate the MANIFEST. These regular expressions are checked against each filepath found in the distribution (so you're matching against "t/foo.t" not "foo.t").
Here's a sample:
~$ # ignore emacs and vim backup files .bak$ # ignore manual backups \# # ignore CVS old revision files and emacs temp files
Since # can be used for comments, # must be escaped.
MakeMaker comes with a default MANIFEST.SKIP to avoid things like version control directories and backup files. Specifying your own will override this default.
- bin/
-
SEE ALSO
perlmodstyle gives stylistic help writing a module.
perlnewmod gives more information about how to write a module.
There are modules to help you through the process of writing a module: ExtUtils::ModuleMaker, Module::Install, PAR | https://metacpan.org/pod/release/NWCLARK/perl-5.8.6-RC1/lib/ExtUtils/MakeMaker/Tutorial.pod | CC-MAIN-2015-14 | refinedweb | 442 | 52.56 |
Topic: MDB Calendar
salman1410
pro
premium
asked 3 months ago
I am trying to use the MDB calendar by importing it from import MDBFullCalendar from 'mdb-react-calendar'; . But this is not working. Please guide how to use pro plugins in the react project.
salman1410
pro
premium
answered 3 months ago
Yes, I have done with the installation and it is working now in my project. I was trying to make the calendar read-only but could not find any way. is there any way to disable click events of days of the calendar? Plus please provide the solution to customize the header of the calendar.
Piotr Glejzer staff commented 3 months ago
It's not possible to make a disable click events of days at the moment. All customization in the calendar is available in the API section.. If you have some suggestions about what we can add to this plugin let us know and we will add tasks about that and try to implement this as soon as possible.
salman1410
pro
premium
answered 3 months ago
@Piotr Glejzer I need to use MDB Calendar as read-only. Please add props (boolean value) through which we can disable click events of days and if required can enable the click event on the basis of props.
Piotr Glejzer staff commented 3 months ago
Thanks. I added to our list to do. We try to implement this. If you have more suggestions, let us know. Have a nice day.
salman1410 pro premium commented 3 months ago
It would be great if we can get this by next week, actually, our project is dependant on this feature. can we get this functionality asap?
Piotr Glejzer staff commented 3 months ago
We have a release in the next Monday, we will try to add this feature to this plugin. Have a nice day.
salman1410 pro premium commented 2 months ago
@Piotr Glejzer any update on the functionality we asked for?
Piotr Glejzer
staff
answered 2 months ago
Add prop
disableEvents to MDBCalendar component. Like that:
<FullCalendar disableEvents tasks={this.state.tasks} />
it should be working. Have a nice day ;)
salman1410 pro premium commented 2 months ago
Thank you for your support. It is working now. I have a use case to click on any tasks added in the calendar and route it to some specific route i.e making tasks Links. Is there any way to achieve this functionality?
Piotr Glejzer staff commented 2 months ago
this a good advice too. I will add this to our task to do but I can't give you an ETA for this now. Sorry about that. We will implement it in future releases. Have a nice day.
salman1410 pro premium commented 2 months ago
Thank you for the response. Actually we need to deploy our system to our client by the end of this week and this functionality is required in the system. We will be grateful to have this on Friday. We won't be able to buy more time any later than Monday. Kindly help to get this functionality ASAP.
salman1410
pro
premium
answered 2 months ago
@Piotr Glejzerwhile working on the calendar I come up with some use cases which need to be considered. Following are the details of these; 1. currently we have six possible colors for displaying the tasks. I did not find any way to customize those colors.2. While adding tasks on a single day, the size of day div increases but some tasks go outside of that day div. It should be wrapped in div which it belongs to. Below is the link to the screenshot of this scenario. In this screenshot we have all the tasks named Testing should lie inside the div of day 15. As I requested earlier, can we get these features on earliest?
Link;
Piotr Glejzer staff commented 2 months ago
I added the task to that. I will see what we can do for that in this sprint but I can't make any promises. Have a nice day.
salman1410 pro premium commented 2 months ago
Thank you very much for your support. I will wait for your response regarding updates.
Piotr Glejzer staff commented 2 months ago
your welcome :)
salman1410 pro premium commented 2 months ago
@Piotr Glejzer Any updates on above functionalities?
Piotr Glejzer staff commented 2 months ago
We didn't add these functionalities like I told that I can't promise anything. We will try to add in this release. Have a nice day.
salman1410 pro premium commented 2 months ago
@Piotr GlejzerAny luck with our updates in new release?
Piotr Glejzer staff commented 2 months ago
Yes, I added more colors and fixed this problem with displaying tasks in the cell.
Piotr Glejzer
staff
answered 2 months ago
For example. I changed prop colors to object like that:
import React, { Component } from "react";import FullCalendar from "mdb-react-calendar"; class App extends Component { state = { tasks: [ { id: "task1", title: "Today", startDate: new Date().setHours(0, 0, 0), endDate: new Date().setHours(23, 59, 59), color: "danger", dark: true }, { id: "task2", title: "Today", startDate: new Date(), endDate: new Date().setDate(16), color: "info" }, { id: "task3", title: "Task name", startDate: new Date().setDate(2), endDate: new Date().setDate(15), color: "warning", dark: true } ] }; render() { const arrOfObjects = [ { color: "elegant-color", title: "Test", dark: true }, { color: "danger-color", title: "Test1", dark: false }, { color: "warning-color", title: "Meeting", dark: false }, { color: "success-color", title: "Home", dark: false }, { color: "info-color", title: "Lunch", dark: false }, { color: "default-color", title: "Something", dark: false }, { color: "primary-color", title: "Pool", dark: false }, { color: "secondary-color", title: "Footbal", dark: true } ]; return <FullCalendar colors={arrOfObjects} tasks={this.state.tasks} />; } } export default App;
and you can use colors from our site but just with
color name. If you change flag dark to true it will be color with dark mode. I also added a possibility to change a title of the color category with the object key
title. It will be available in the next release.
See screenshot below:
salman1410 pro premium commented 2 months ago
Thank you for your support and for adding these functionalities. How are we going on making the tasks as Link i.e redirect to some route when clicking on a Task? We also need this functionality in this release. And When are we expecting the next release?
Piotr Glejzer staff commented 2 months ago
I think is not possible to do that now. I will try to think more about that. The next release on Monday.
salman1410 pro premium commented 2 months ago
It would be kind if you add this functionality too in this release. This is a mission-critical situation here.
Piotr Glejzer staff commented 1 months ago
I will try to add this in this release. Have a nice day.
@Piotr Glejzer I have seen the new release, is making Tasks Link functionality added in this build?
Piotr Glejzer staff commented 1 months ago
We will not implement react-routing in this plugin at the moment.
salman1410 pro premium commented 1 months ago
is there any workaround to achieve this, I mean triggering a custom function on clicking on the tasks?
Piotr Glejzer staff commented 1 months ago
It's not possible at the moment. We have a close repo for this plugin and we will probably open it to users in the future that you will allow modifying code by yourself. I will try to think again about that anchor or other links in the task component.
salman1410 pro premium commented 1 months ago
@Piotr GlejzerI can understand the challenges you are facing. Is there any solution we can add to achieve this functionality at our end because our clients are having trouble using our system without this desired functionality.
@Piotr Glejzer I am getting an error while using file:mdb-full-calendar-4.16.3.tgz in my project. The below link is the screenshot of the error generated when I run my project. is this an issue of the MDB version installed?
Piotr Glejzer staff commented 1 months ago
I will check it. I don't see this error in that plugin.
Edit.
Ok, I see now, I don't know why it is not working because in my development repo everything is working correctly, I have to find out why. If you will have problems please you version 4.16.2.
salman1410 pro premium commented 1 months ago
@Piotr Glejzer We are using Access Token for MDB Dependencies, don't know how to check MDB version and update it?
Piotr Glejzer staff commented 1 months ago
you can write on the #4.16.2 on the back of your token like this
git+
salman1410 pro premium commented 1 months ago
@Piotr Glejzer Thank you so much it worked.
@Piotr Glejzer I found some issues in MDB Calendar responsiveness. Below are the links of screenshots;
1.List View Task overflow issue: 2.Task overflow issue: 3. space between tasks:
Piotr Glejzer staff commented 1 months ago
I fixed number 2 and number 3 but what is a problem with number 1?
salman1410 pro premium commented 4 weeks ago
@Piotr Glejzer In number 1 tasks are overflowing to the right outside the grid.
Piotr Glejzer staff commented 4 weeks ago
We will add a new version in this release so you can use it and if we will have some problems let me know. Thanks.
salman1410 pro premium commented 4 weeks ago
@Piotr GlejzerThank you, brother, for all the support. Are we hoping to have the functionality of making Tasks as Links in this release? Actually we are having a hard time with our clients regarding this functionality.
Piotr Glejzer staff commented 3 weeks ago
No problem! I will look into that problem with
link in this sprint, I have a hope that I will find a good solution for that. Have a nice day!
salman1410 pro premium commented 2 weeks ago
@Piotr GlejzerThank you. When are we expecting this functionality and new release?
Piotr Glejzer staff commented 2 weeks ago
Probably the next Monday
salman1410 pro premium commented 2 weeks ago
@Piotr GlejzerNext Monday means Monday coming on 16th Mar,2020 right?
Piotr Glejzer staff commented 2 weeks ago
Yes, thats right
salman1410 pro premium commented a week ago
@Piotr Glejzer Thank you, brother. Please guide how to make tasks as links? I did not find it in the documentation.
Piotr Glejzer staff commented a week ago
I will update the documentation today, I forgot about that. Sorry about that problem.
salman1410 pro premium commented 4 days ago
@Piotr Glejzer still I do not see it in documentation.
Piotr Glejzer staff commented 2 days ago
we have some problem to update this site.. Sorry about that. We will try to resolve that as soon as possible. You can check this also in our demo app if you download the zip from your profile.
Answered
- User: Pro
- Premium support: Yes
- Technology: React
- MDB Version: 4.24.0
- Device: Lenovo Laptop
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Piotr Glejzer staff commented 3 months ago
did you install all the packages from the package.json? I think it should work normally when you will installed everything with
yarnor
npm/npx install | https://mdbootstrap.com/support/react/mdb-calendar/ | CC-MAIN-2020-16 | refinedweb | 1,887 | 65.83 |
CoffeeScript has classes, but since CoffeeScript is just JavaScript, where do those classes come from? In this article we break down the JavaScript code which is output from a CoffeeScript class and its subclass to see exactly how the magic happens.
Warning: JavaScript Ahead
This article involves some pretty advanced JavaScript. We won’t have time to explain every construct in detail. It also assumes that you’ve read my previous article on prototypes, and that you understand CoffeeScript classes. Of course, you could stop reading right now and continue to write code in ignorance, just like you can eat without knowing much about your stomach. But really, you should stay and learn about the messy guts of what you’re using.
Declassing
Take the following CoffeeScript:
class Bourgeoisie constructor: (@age, @privilegeConstant) ->
The previous code, translates to this JavaScript:
var Bourgeoisie; Bourgeoisie = (function() { function Bourgeoisie(age, privilegeConstant) { this.age = age; this.privilegeConstant = privilegeConstant; } return Bourgeoisie; })();
The outermost variable
Bourgeoisie is assigned an IIFE, which is essentially a construct used for controlling scope. The pattern for an IIFE is shown below.
(function(){ //lots of code return result })();
Only the things that are returned ever make it to the outside world. In this case, it’s an inner
Bourgeoisie constructor function that is returned. The constructor function attaches properties to the instance being constructed. When it’s returned, the constructor is assigned to the outside
Bourgeoisie variable. Next, we add the following functions.
class Bourgeoisie constructor: (@age, @privilegeConstant) -> worry: -> console.log("My stocks are down 1%!") profit: (hardWork, luck) -> return (@age - 23) * hardWork * (luck + @privilegeConstant)
This translates into the following JavaScript.
var Bourgeoisie; Bourgeoisie = (function() { function Bourgeoisie(age, privilegeConstant) { this.age = age; this.privilegeConstant = privilegeConstant; } Bourgeoisie.prototype.worry = function() { return console.log("My stocks are down 1%!"); }; Bourgeoisie.prototype.profit = function(hardWork, luck) { return (this.age - 23) * hardWork * (luck + this.privilegeConstant); }; return Bourgeoisie; })();
Notice that we’re using the
prototype property of the constructor to add more functions. Doing so places the function into the
__proto__ property of each instance, so that it can be used at will. Thus, when we create a new instance of
Bourgeoisie, the
age and
privilegeConstant variables are placed on the instance, while the
worry() and
profit() functions are placed on the prototype of the instance. Using this example as a parent class, let’s explore inheritance.
Inheritance
Take the following
Senator class, which inherits from
Bourgeoisie. Note, the code for
Bourgeoisie is not included, because it has not changed.
class Senator extends Bourgeoisie worry: -> console.log("My polls are down 1%!")
Now, let’s see what this simple class looks like in JavaScript.
var Senator, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) { child[key] = parent[key]; } } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Senator = (function(_super) { __extends(Senator, _super); function Senator() { return Senator.__super__.constructor.apply(this, arguments); } Senator.prototype.worry = function() { return console.log("My polls are down 1%!"); }; return Senator; })(Bourgeoisie);
Holy cow. Let’s take this one step at a time. The following code declares the
Senator variable, and creates a shortcut to the
hasOwnProperty() method.
var Senator, __hasProp = {}.hasOwnProperty,
This next piece of code starts the
__extends() function. The first part manually copies each property of the parent and places it onto the child. Remember that pointers to functions are just variables, so functions are transferred this way as well.
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) { child[key] = parent[key]; } } ...
This next piece is more difficult to parse. First, we create a function called
ctor() which contains, at first, only a constructor function. Then, we assign the
prototype of that constructor function to the
parent, and the
prototype of the child to a new instance of the constructor.
... function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); ...
Whew! What does that get us? Well, the prototype of the constructor acts as the parent class, which means the instance will have a
__proto__ property containing all of the properties of the parent class. This isn’t too complex, if you followed the discussion in my first explanation of prototypes. The confusing part is the seemingly infinite regress of prototype and constructor.
You see,
ctor() has a constructor property of
child, which has a new instance of
ctor() as its prototype. This gives us
child.prototype.constructor = child. If you examine this in Chrome Dev Tools, you’ll get an infinite regress. Luckily, this doesn’t seem to effect performance, but it is still a confusing bit of architecture.
Thankfully, the last piece (shown below) is much simpler. The
child is given an attribute of
__super__, which is assigned the parent’s
prototype. This is something which our implementation of prototypical inheritance does not easily replicate, and it will be very useful when you want to define a new function on a child but still reference the parent’s version of the function. We will see this used in the code for the
Senator.
... child.__super__ = parent.prototype; return child; };
Finally, we return the
child. To be clear, this is the class definition (or the prototype) for the
child, not a specific instance. The code we just discussed is created once, and then used for every inheritance.
The Senator’s Inheritance
The following section of code is specific to the
Senator‘s inheritance. Notice that the IIFE structure has been modified to take in an argument. The passed in argument is
Bourgeoisie, which is referred to as
_super within the IIFE. Also, the
Senator that is returned is assigned to the
Senator on the outside of the IIFE.
Senator = (function(_super) { __extends(Senator, _super); function Senator() { return Senator.__super__.constructor.apply(this, arguments); } Senator.prototype.worry = function() { return console.log("My polls are down 1%!"); }; return Senator; })(Bourgeoisie);
The first thing we do within the code block is call
__extends(), which takes
Senator (the child) and
_super (the parent) as arguments. The
worry() function is defined here in the usual way, overwriting the parent’s version. The
profit() function is on
Bourgeoisie, and is thus inherited through
__proto__. More interesting is the constructor function, which we’ll cover now.
Constructing New Instances
The constructor for
Senator is shown below.
function Senator() { return Senator.__super__.constructor.apply(this, arguments); }
To make this easier to understand, consider the following functionally equivalent statement. This code is simply calling the constructor function on the parent prototype using the passed in arguments. The first definition, created by CoffeeScript, does the same thing, but with a generalized number of arguments.
function Senator(age, privilegeConstant){ return Senator.__super__.constructor(age, privilegeConstant); }
The
arguments variable in JavaScript places all of the arguments passed to a function in an array like object, even if they are not explicitly named in the function definition. The other JavaScript trick we use is the
apply() function.
apply() allows you to specify a function’s arguments, as well as the value of
this. In summary, we’re taking an arbitrary number of arguments, and passing them all to the constructor function of the parent’s prototype. In order to pass an arbitrary number of arguments, we use the
apply() function.
Conclusion
We’ve seen how CoffeeScript classes are created and extended by studying the generated JavaScript code. We’ve also covered all of the basic features of classes. Just be aware that the next official version of JavaScript will include its own implementation of classes. They will compile down to prototypes in a manner that is similar (but not identical) to how CoffeeScript classes compile down to prototypes. Stay tuned.
COURSES >
BOOKS >
No Reader comments | http://www.sitepoint.com/correlating-coffeescript-classes-and-javascript-prototypes/ | CC-MAIN-2016-18 | refinedweb | 1,291 | 51.14 |
Technical Support
On-Line Manuals
CARM User's Guide
Discontinued
#include <math.h>
unsigned char _chkdouble_ (
double val); /* number to check */
The _chkdouble_ function checks the status of the
floating-point number val.
The _chkdouble_ function returns the status of the
floating-point number val:
_chkfloat_
#include <intrins.h>
#include <stdio.h> /* for printf */
float f1, f2, f3;
void tst_chkdouble (void) {
f1 = f2 * f3;
switch (_chkdouble_ (f1)) {
case 0:
printf ("result is a number\n"); break;
case 1:
printf ("result is zero\n"); break;
case 2:
printf ("result is +INF\n"); break;
case 3:
printf ("result is -INF\n"); break;
case 4:
printf ("result is NaN\n");. | http://www.keil.com/support/man/docs/ca/ca__chkdouble_.htm | CC-MAIN-2019-43 | refinedweb | 107 | 60.65 |
On Thu, Feb 28, 2013 at 1:16 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote: > On Thu, Feb 28, 2013 at 10:32 AM, Guido van Rossum <guido at. > > Could you elaborate on what confusion it might cause? Well, x.__class__ is different, repr(x) is different, ... > As to performance relative to dict, this has definitely been my > primary concern. I agree that the impact has to be insignificant for > the **kwargs proposal to go anywhere. Obviously OrderedDict in C had > better be an improvement over the pure Python version or there isn't > much point. However, it goes beyond that in the cases where we might > replace current uses of dict with OrderedDict. What happens to the performance if I insert many thousands (or millions) of items to an OrderedDict? What happens to the space it uses? The thing is, what started out as OrderedDict stays one, but its lifetime may be long and the assumptions around dict performance are rather extreme (or we wouldn't be redoing the implementation regularly). > My plan has been to do a bunch of performance comparison once the > implementation is complete and tune it as much as possible with an eye > toward the main potential internal use cases. From my point of view, > those are **kwargs and class namespace. This is in part why I've > brought those two up. I'm fine with doing this by default for a class namespace; the type of cls.__dict__ is already a non-dict (it's a proxy) and it's unlikely to have 100,000 entries. For **kwds I'm pretty concerned; the use cases seem flimsy. > For instance, one guidepost I've used is that typically **kwargs is > going to be small. However, even for large kwargs I don't want any > performance difference to be a problem. So, in my use case, the kwargs is small, but the object may live a long and productive life after the function call is only a faint memory, and it might grow dramatically. IOW I have very high standards for backwards compatibility here. >> And I don't recall ever having wanted to know the order of the kwargs >> in the call. > > Though it may sound a little odd, the first use case I bumped into was > with OrderedDict itself: > > OrderedDict(a=1, b=2, c=3) But because of the self-referentiality, this doesn't prove anything. :-) > There were a few other reasonable use cases mentioned in other threads > a while back. I'll dig them up if that would help. It would. >> But even apart from that backwards incompatibility I think this >> feature is too rarely useful to make it the default behavior -- if >> anything I want **kwargs to become faster! > > You mean something like possibly not unpacking the **kwargs in a call > into another dict? > > def f(**kwargs): > return kwargs > d = {'a': 1, 'b': 2} > assert d is f(**d) > > Certainly faster, though definitely a semantic difference. No, that would introduce nasty aliasing problems in some cases. I've actually written code that depends on the copy being made here. (Yesterday, actually. :-) -- --Guido van Rossum (python.org/~guido) | https://mail.python.org/pipermail/python-ideas/2013-February/019704.html | CC-MAIN-2018-34 | refinedweb | 526 | 63.7 |
Introduction
What is Snake?Quoting Wikipedia:
Snake is a casual video game that originated during the late 1970s in arcades and has maintained popularity since then, becoming something of a classic. After it became the standard pre-loaded game on Nokia mobile phones in 1998, Snake found a massive audience.
Who is this article for?
In order to get the most out of this article, you should be familiar with the C++ programming language, and have written and successfully compiled a few programs (or games) on your own.
What will I learn?
If I do my job right, you should learn how to develop a Snake clone game. We are going to talk about the basics first, that is, getting something on the screen. Then we will cover gathering input from the player and making things move. Next we will go through the architecture of the game, and finally we will take each step one by one and by the end you should have a solid understanding of how to sit down and write your very own Snake game from scratch.
What do I need?
I will be using a Windows machine, however you may use a Linux or a Mac computer because we are using a cross-platform library so that our game can target as many platforms as possible without changing the code. That said, here is a list of things to bring with you.
- C++ compiler (I will be using the Mingw C++ compiler provided with the Code::Blocks IDE)
- SDL version 1.2.15 which may be obtained here.
- Pen and Paper (or the digital equivalent) for taking notes.
Compiler Setup
First things first.
The first thing we need to do is download and setup our compiler (Remember, we are using Mingw through the Code::Blocks IDE here) to use SDL. Head on over to the SDL download page and download SDL-devel-1.2.15-mingw32.tar.gz then extract the contents to your computer.
You should have a folder called SDL-1.2.15 containing a bunch of files. I like to keep my computer tidy, and I create a root folder called "CLibs" in which I install all my libraries that I will use with the C and C++ programming languages. I would recommend that you do the same in order to avoid confusion later on.
We will only need the include, lib, and bin folders from the SDL-1.2.15 folder. Go ahead and copy those folders into C:\CLibs\SDL-1.2.15\ and then we can move on over to configuring Code::Blocks so that it is able to find the SDL library files it needs.
Start up Code::Blocks and click on the Settings menu, then click on the Compiler and Debugger... menu item. In the window that opens, choose the Search directories tab, and under the Compiler sub-tab, you need to click on the Add button and browse for the C:\CLibs\SDL-1.2.15\include folder and click the OK button to add the folder to the compiler search directory paths. Now click on the Linker sub-tab and repeat the process for the C:\CLibs\SDL-1.2.15\lib folder. Click on the OK button and you are finished with telling Code::Blocks where the SDL files are located.
A vital last step for Windows users is to copy the file SDL.dll into the bin directory in your compiler. In my case, on Windows 7, this happens to be C:\Program Files (x86)\CodeBlocks\MinGW\bin
Testing the install.
We are going to write a very small program to test that Code::Blocks is correctly configured to use SDL.
Step 1.
Select File -> New -> Project from the menu in Code::Blocks, and then select Empty project from the templates and click on the Go button.
Step 2.
If you see "Welcome to the new empty project wizard!" just click on the Next button. Otherwise, if you see "Please select the folder where you want the new project to be created as well as its title." then type in a name for your project. In this case, we are testing SDL, so type in the name SDLTest into the Project title field and then click the Next button, and the Finish button on the next screen.
Step 3.
Select File -> New -> Empty file from the menu and click Yes when asked "Do you want to add this new file in the active project (has to be saved first)?" and enter sdltest-main.cpp as the file name, and save the file to the SDLTest folder created along with your new project. When asked to select the targets, just click the OK button.
Step 4.
Finally we get to write a little code. Enter each line exactly as you see it. I will not explain this test code, because all we are looking for is a yay or nay about SDL being configured correctly, and this article's purpose is not to go over basic code.
#include
int main(int argc, char* argv[]) { if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { return -1; } SDL_Quit(); return 0; }
Step 5.
Last thing, we need to specify the SDL libraries so we can compile the project. Right-click on the SDLTest item in the Projects panel and select Build options... then select the Linker settings tab. Under the Other linker options box, type in the following items each on their own line.
- -lmingw32
- -lSDLmain
- -lSDL
Take note that each line begins with minus sign then a lowercase letter L. Step 6.
Well, I know I said last thing in the previous step, but this really is the last thing. Build the project and Run the project. Select Build -> Build from the menu and as long as there are no errors, select Build -> Run from the menu. If you have any errors, go back to Step 1 and read through and make sure you have done everything as specified. If you continue to have trouble, then contact me with the full error you are having, and I will see if I can help you get things sorted out.
You should get a black console window appear and it should say
Process returned 0 (0x0) execution time : 0.201 s Press any key to continue.
If this is not the case, then something went wrong. If you see the text like above, then you are ready to proceed further into this article.
All systems are go.
Okay great, SDL is installed, Code::Blocks is configured, you know how to get an SDL project created and compiled, we're good to move on to something a little more exciting. We are going to take a small step away from the code and have a look at some pretty pictures to help you understand what we are going to be doing over the next few sections of the article.
This is called the game-loop. Every single game has something like this inside of it. From Pong to Halo to Farmville to World of Warcraft. (Disclaimer: These games and their names are copyright and/or trademarks of their respective owners.) Every Single Game Has A Game Loop of some kind. This fun little loop is what keeps the game going. If nothing ever looped, the game would start, and then they would just about immediately end. That would be really boring. So let's see what exactly is going on here. First we do a little housekeeping, like handling events and what-not, next we update the game world, finally we render the game world, and the whole thing repeats until something tells it not to.
Now, there are hundreds if not thousands of articles and books out there that will explain this in at least a hundred different ways in more detail. I'm not going to add to that total with this article. Instead I am going to jump ahead right into our next project which is called Big Blue Box (Disclaimer: I did not check to see if Big Blue Box is trademarked or copyrighted to anyone. If it is, sorry for using your name.) in which our job as a programmer is to make a big blue box appear on the screen. Fun? Nah... but we have to start somewhere before we can get to the fun stuff.
SDL Basics
Beginnings of Big Blue Box
Just like the SDLTest project, create a new project and configure the linker settings so the project will compile, and also throw in a .cpp file into the mix so we have somewhere to write our code. I'm calling my project BigBlueBox and the source file bigbluebox-main.cpp you can do the same, or change the name. Your choice.
Okay, first we need some include statements and then we need to define some constants for our little program.
#include
#include static const unsigned WINDOW_WIDTH = 800; static const unsigned WINDOW_HEIGHT = 600; static const unsigned BOX_WIDTH = 256; static const unsigned BOX_HEIGHT = 256;
Everything should be self-explanatory. Our window will be 800x600 and the box will be 256x256. Simple enough. We need iostream because we will be using the cerr error output stream for error reporting and naturally we need SDL.h because we are writing a program which uses SDL. Next, we write the main code.
int main(int argc, char* argv[]) { return 0; }
This should be pretty much stuck in your brain if you have had any programming experience with C and C++. The rest of our program's code will fall between the starting brace of the function and the return zero line.
I usually declare my variables when they are used, however in this particular project I will declare all the variables I will use at the top of the function just so that you can refer to a single location to see the datatype of a variable being used.
We are going to need a pointer to an SDL Surface, to represent our primary drawing surface and our program's window. We need an SDL Event object for our event handling. We need an SDL Rect object to define our box's position and dimensions. We need a couple unsigned integers for our box color and the color to make the background, and finally we need a boolean variable for keeping track of our game loop. Let's see the variable declarations now.
SDL_Surface* displaysurface = NULL; SDL_Event sdlevent; SDL_Rect boxrect; unsigned boxcolor; unsigned backgroundcolor; bool running;
The next thing we need to do is initialize SDL. This is accomplished with the SDL_Init function. Then we need to set the video mode to create our program's window. This is accomplished with the SDL_SetVideoMode function. We then set the window caption text to something relevant to our program. This is accomplished with the SDL_WM_SetCaption function. If we don't do this, the caption will be "SDL_app". Let's have a look at the code for all of this now.
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { std::cerr << "SDL_Init Failed: " << SDL_GetError() << std::endl; return -1; }("Big Blue Box", NULL);
Next we are going to set up our box to be the right size using our constants we defined at the start of our code, and then we will position our box in the center of the screen.
Tip: To center an object on the screen, first subtract the object's size from the size of the screen and then you divide the difference by two.
boxrect.w = BOX_WIDTH; boxrect.h = BOX_HEIGHT; boxrect.x = (WINDOW_WIDTH - boxrect.w) / 2; boxrect.y = (WINDOW_HEIGHT - boxrect.h) / 2;
Now we are going to set up our color variables. We want obviously a blue box. And I want a black background, so we are going to use the SDL_MapRGB function to get the right color values. Lastly, we set our running boolean to true.
backgroundcolor = SDL_MapRGB(displaysurface->format, 0, 0, 0); boxcolor = SDL_MapRGB(displaysurface->format, 0, 0, 255); running = true;
We finally arrive at the game loop. Our game loop will be very simple, since our program is not really a game, we don't have much to do here. We just need to handle a couple events and then draw our screen.
while(running) { // handle events // render game }
The most complex part of this will be handling the events, and honestly, this is not really that difficult. We need to handle the SDL_QUIT event, which is sent when the user tries to close the window. If we don't handle this event, well the window would refuse to close and your user will be pretty irritated with you.
Tip: ALWAYS remember to handle the SDL_QUIT event or your users will be very unhappy with you and your game.
Handling the event is pretty simple really. We just need to tell our game loop to stop looping, in our case, we just set our running boolean variable to false. Easy peasy. We would also like to be able to close our game by pressing the ESC key on the keyboard. To accomplish this feat, we need to handle the SDL_KEYDOWN event and check for the SDLK_ESCAPE key, and same as the SDL_QUIT handler, tell our game loop to stop looping. That wraps up the event handling we need to do here.
Now, that we know what events we have to handle, we need to know how to actually find out what events are being fired off. To do this, we need to call the SDL_PollEvent function inside a loop so that we can handle all events that get queued up when our game is running. Let's have a look at the code for our event handling. Remember that this code falls within our game loop.
while(SDL_PollEvent(&sdlevent)) { switch(sdlevent.type) { case SDL_QUIT: { running = false; } break; case SDL_KEYDOWN: { if (sdlevent.key.keysym.sym == SDLK_ESCAPE) { running = false; } } break; } }
Great, now the only thing left to wrap up our game loop is the rendering of our game screen. We will use the SDL_FillRect function to color our background, and to draw our box on the screen. After everything gets drawn, we need to call the SDL_Flip function in order to make our rendering visible on the screen because we are using double buffering (and we definitely want to be using double buffering). And lastly in order to keep our CPU happy, we will call the SDL_Delay function to give a few time slices back to the system.
SDL_FillRect(displaysurface, NULL, backgroundcolor); SDL_FillRect(displaysurface, &boxrect, boxcolor); SDL_Flip(displaysurface); SDL_Delay(20);
Our game loop is done. The rest of the code that follows should be outside the game loop's closing brace. In order to wrap up the game code, we need to clean up after ourselves. Because our game is very simple and we don't allocate anything other than the display surface, we can clean up by calling the SDL_Quit function.
SDL_Quit();
And we are done! Now go ahead and build and run the project. You should see a big blue box on a black screen. Press the ESC key on your keyboard and the window should close.
Moving Boxes.
Our next little project will build on the BigBlueBox project and we will add the ability to move our box around the screen using the arrow keys. We are going to need to add a couple additional variables to the top of our main function. We need an SDL_Rect to define the boundaries in which we can move our box, and an unsigned integer that defines the speed at which the box is able to move.
SDL_Rect boxbounds; unsigned boxspeed = 6;
Now after we set the running boolean to true, before we start the game loop, we need to set up our bounding box rect. There are four variables in an SDL_Rect which we are going to use to specify the left, top, right, and bottom edges of a bounding box in which our box will be able to move. We subtract the size of our box from the size of our window to get the limits of the upper-left corner of our box.
boxbounds.x = 0; boxbounds.y = 0; boxbounds.w = WINDOW_WIDTH - boxrect.w; boxbounds.h = WINDOW_HEIGHT - boxrect.h;
We now are going to check if any of the arrow keys are being pressed, and if they are being pressed, move our box by adding or subtracting the box speed. We also need to ensure the box does not move outside out bounding box we have defined. But first, we have to have a way to read directly the current state of the keyboard. We are able to accomplish this task with the SDL_GetKeyState function. The code should be added to the game loop after the event handling loop and before the code that handles the rendering.
unsigned char* keys = SDL_GetKeyState(NULL); if (keys[SDLK_UP]) { boxrect.y -= boxspeed; if (boxrect.y < boxbounds.y) { boxrect.y = boxbounds.y; } } else if (keys[SDLK_DOWN]) { boxrect.y += boxspeed; if (boxrect.y > boxbounds.h) { boxrect.y = boxbounds.h; } }
Now that takes care of the UP and DOWN movement, so let's take care of the LEFT and RIGHT next.
if (keys[SDLK_LEFT]) { boxrect.x -= boxspeed; if (boxrect.x < boxbounds.x) { boxrect.x = boxbounds.x; } } else if (keys[SDLK_RIGHT]) { boxrect.x += boxspeed; if (boxrect.x > boxbounds.w) { boxrect.x = boxbounds.w; } }
And that is all we are going to need to do. You should be able to build and run the project as before, and this time you can move the box around the screen using the arrow keys, and the box should not move beyond the edges of the screen. We have now covered enough of the basics that you should have enough knowledge of using SDL at this point to start writing your Snake game. So I'm done here.
...just kidding. Well, just about the last part. I'm not done here. I still have to teach you about programming Snake, since that is what this article is really about. This has all just been a crash-course introduction to get your appetite whetted. Now, before we can code our Snake game, we have to talk about how we are going to engineer our game code.
A Look At Snake
I am going to use a very simple design for our little Snake game. For brevity and to help keep the focus on the core subject, I will not be implementing sound, I will not be using any external bitmaps, I will not implement scoring or text output, and I will not implement any sort of game state management or anything that would otherwise further complicate the program. This article is not about how to go about creating a polished, retail-ready game. It is about how to program a Snake game, and that is all I am going to do here.
For our game, we need two objects. The Snake, and a "Collectable Coin" which causes the Snake to grow in length. The rules are simple as well. If the Snake collides with the edge of the screen or itself, then the Snake will die. The player uses the Arrow keys to control the Snake in any of the four directions; Up, Down, Left, and Right. The Snake cannot be made to move in the opposite direction of it's movement, as that would cause the snake to bite itself instantly causing death. We will use simple filled rectangles to represent the various visuals of the game.
The code will consist of three classes and the main() function which houses the sample init and game loop code you have seen in the BigBlueBox project. The body of the Snake will be composed of multiple pieces, referred to as segments which will be held in a deque, or double-ended queue which can be found in the C++ STL. You can read more about deques here.
In order to make the Snake move, we will prepend a segment positioned in the location where the Snake is going to move, and if the Snake is moving into a location where there is no "Collectable Coin", the tail end of the Snake is chopped off. Using a deque makes this process straightforward through the push_front and pop_back methods. In order to cause the Snake to grow in length, we do not chop off the tail if we collide with a "Collectable Coin".
The game screen is divided into a number of "Cells". A single segment and the "Collectable Coin" are both sized the same as a single Cell. The Snake begins in the center of the screen. This should be enough information for us to start writing the code for our little Snake game.
Building Snake
Finally, we get to have some fun programming. In order for us to begin, we will need to include a few header files, and then define our constants. We will need iostream for using cerr for our error reporting, deque to contain our Snake Segments, and of course SDL.h to access the SDL library functionality which powers our game.
We have our window dimensions, the four directions the Snake can move, and some constants to define the scale of the game world, and lastly the starting location and length of the Snake are defined as constants as well.
#include
#include #include static const unsigned WINDOW_WIDTH = 800; static const unsigned WINDOW_HEIGHT = 600; static const unsigned GO_UP = 0; static const unsigned GO_DOWN = 1; static const unsigned GO_LEFT = 2; static const unsigned GO_RIGHT = 3; static const unsigned CELL_SIZE = 20; static const unsigned CELL_WIDTH = WINDOW_WIDTH / CELL_SIZE; static const unsigned CELL_HEIGHT = WINDOW_HEIGHT / CELL_SIZE; static const unsigned START_X = CELL_WIDTH / 2; static const unsigned START_Y = CELL_HEIGHT / 2; static const unsigned START_LENGTH = 3;
The first class in our little game is nothing more than a data structure that keeps track of the position of each segment of the snake.
class SnakeSegment { public: unsigned x; unsigned y; SnakeSegment(unsigned x, unsigned y) { this->x = x; this->y = y; } };
Next up we have the Coin class which keeps track of the position of the coin. The same data as the SnakeSegment, however I wanted to have two distinct classes. The only notable difference between the SnakeSegment class and the [test]Coin[/test] class is a method which randomly sets the position of the "Collectable Coin".
class Coin { public: unsigned x; unsigned y; Coin() { Respawn(); } void Respawn() { x = 1 + rand() % (CELL_WIDTH - 2); y = 1 + rand() % (CELL_HEIGHT - 2); } };
The third class of our game is where the majority of the work is located, and is also inevitably the most complex. The Snake class is a composite of the previous classes along with a few members necessary to implement the desired mechanics. We need to keep track of the direction the Snake is moving, we need a timing mechanism to keep from calling our collision detection code every frame, and a few colors. I also reuse a single SDL_Rect object for all the rendering to minimize the allocations and deallocations per-frame. We need methods to restart the game, update the game, render the game, determine if the game is over, and handle player input and collisions with the walls, the "Collectable Coin" and the snake itself.
class Snake { private: std::deque
segments; Coin coin; bool dead; unsigned direction; unsigned time, timeout; unsigned headcolor, segmentcolor, coincolor; SDL_Rect renderrect; public: Snake(unsigned headcolor, unsigned segmentcolor, unsigned coincolor); ~Snake(); void Restart(); void Update(); void Render(SDL_Surface* dest); inline bool IsDead() { return dead; } private: void UpdateInputControls(); void RenderSnake(SDL_Surface* dest); void RenderCoin(SDL_Surface* dest); void AddSegment(unsigned x, unsigned y); void MoveSnake(); bool CheckForWallCollision(); bool CheckForSelfCollision(); bool CheckForCoinCollision(); };
Before I get into the code that implements the Snake class methods, I want to show you the main function and how the Snake class is used to create the gameplay flow. You have already seen most of the code in the BigBlueBox project, however there are a few small changes in the code arrangement. The layout is still the same: Init, Game Loop (Handle Events, Update, Render), Cleanup.
In the Init section of the main function, the following code should be written. If it is not immediately obvious, the background color is dark green, the head of the snake is red, the body of the snake is bright green, and the coin is yellow.
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { std::cerr << "SDL_Init Failed: " << SDL_GetError() << std::endl; return -1; } SDL_Surface*("Snake", NULL); unsigned backgroundcolor = SDL_MapRGB( displaysurface->format, 0, 64, 0); unsigned snakeheadcolor = SDL_MapRGB( displaysurface->format, 255, 0, 0); unsigned snakebodycolor = SDL_MapRGB( displaysurface->format, 0, 255, 0); unsigned coincolor = SDL_MapRGB( displaysurface->format, 255, 255, 0); Snake snake(snakeheadcolor, snakebodycolor, coincolor); SDL_Event sdlevent; bool running = true;
In the SDL_KEYDOWN section of the event handling code of the Game Loop, after the code that handles SDLK_ESCAPE, the following code needs to be added to allow the player to restart the game after dying by pressing the ENTER (RETURN) key.
else if (sdlevent.key.keysym.sym == SDLK_RETURN) { if (snake.IsDead()) { snake.Restart(); } }
Simply call the Update method of the snake for the Update section of the Game Loop, and call the Render method in the Render section. That wraps up the code for the main function. Next we will take a look at the method implementations of the Snake class.
Be sure to call the Render method AFTER calling the SDL_FillRect function, and BEFORE calling the SDL_Flip function.
Constructing the Snake
First up is the class constructor. Most of the construction process has been delegated to the Restart method, to avoid code duplication. The constructor consists of setting the colors and then calling the Restart function to finish the construction.
Snake::Snake(unsigned headcolor, unsigned segmentcolor, unsigned coincolor) { this->headcolor = headcolor; this->segmentcolor = segmentcolor; this->coincolor = coincolor; Restart(); }
Destructing the Snake
The class destructor just needs to clear out the deque since we do not have any dynamic memory allocations which need to be freed.
Snake::~Snake() { segments.clear(); }
Restarting the Snake
As mentioned before, the construction of the Snake has been delegated to the Restart method to avoid code duplication. When the Snake is restarted, the deque is cleared out, then the starting snake segments are added to the deque. The direction of movement is reset as well as the dead flag and the timing mechanism.
void Snake::Restart() { segments.clear(); for (unsigned i = 0; i < START_LENGTH; i++) { AddSegment(START_X - i, START_Y); } direction = GO_RIGHT; time = 0; timeout = 6; dead = false; }
Adding Snake Segments
We add segments to the tail of the starting Snake by pushing to the back of the deque. This only occurs when building the initial Snake body in the Restart method.
void Snake::AddSegment(unsigned x, unsigned y) { SnakeSegment segment(x, y); segments.push_back(segment); }
Updating the Snake
If the Snake is dead, we do not continue the update. First we update the input controls, then update the timing mechanism. If the time has not timed out, we do not continue the update. If the time has timed out, we check for collisions and finally move the snake.
void Snake::Update() { if (dead) { return; } UpdateInputControls(); time++; if (time < timeout) { return; } time = 0; if (CheckForWallCollision() || CheckForSelfCollision()) { dead = true; return; } if (CheckForCoinCollision()) { coin.Respawn(); } else { segments.pop_back(); } MoveSnake(); }
Controlling the Snake
We do not want the Snake to be able to reverse its direction of movement, so our movement code is a little more than just if key pressed, then move. But nothing too difficult.
void Snake::UpdateInputControls() { unsigned char* keys = SDL_GetKeyState(NULL); if (keys[SDLK_UP] && direction != GO_DOWN) { direction = GO_UP; } else if (keys[SDLK_DOWN] && direction != GO_UP) { direction = GO_DOWN; } else if (keys[SDLK_LEFT] && direction != GO_RIGHT) { direction = GO_LEFT; } else if (keys[SDLK_RIGHT] && direction != GO_LEFT) { direction = GO_RIGHT; } }
When the Snake hits the Wall
Checking for collision between the head of the Snake and a "Wall" is a straightforward process of testing if the head of the Snake has reached any of the four edges of the game world.
bool Snake::CheckForWallCollision() { unsigned headx = segments[0].x; unsigned heady = segments[0].y; return ( (headx == 0) || (heady == 0) || (headx == CELL_WIDTH) || (heady == CELL_HEIGHT)); }
Watch Out For Your Tail
If the Snake's head touches another segment of the Snake body, it dies from the poison. Just loop through the deque starting at the segment after the head and if the head is in the same location as the iterated segment, you have a collision.
bool Snake::CheckForSelfCollision() { unsigned headx = segments[0].x; unsigned heady = segments[0].y; for (unsigned i = 1; i < segments.size(); i++) { if (segments.x == headx && segments.y == heady) { return true; } } return false; }
Collecting Coins
This is the easiest collision check of them all. If the head touches the coin, you collect the coin. Pretty easy stuff after all the code we have written so far.
bool Snake::CheckForCoinCollision() { return (segments[0].x == coin.x && segments[0].y == coin.y); }
Moving the Snake
In order to make the Snake appear to move, we push a new head segment to the front of the deque. Since the Update method takes care of popping the back end segment off of the deque, this gives the illusion that the segments are following the head segment, which looks like the Snake moves as an intelligent entity.
void Snake::MoveSnake() { static const int movex[] = { 0, 0, -1, 1 }; static const int movey[] = { -1, 1, 0, 0 }; unsigned x = segments[0].x + movex[direction]; unsigned y = segments[0].y + movey[direction]; SnakeSegment nextsegment(x, y); segments.push_front(nextsegment); }
Drawing the Snake
If the Snake is dead, we do not continue the rendering process. Coins are rendered first, then the Snake itself. Since all visuals are the same size rectangle, we are able to reuse a single SDL_Rect structure and simply update the x and y values for each component to be rendered in the correct location. Every x and y value needs to be multiplied by the size of a single "Cell" in the game world, so that the on-screen positions line up correctly.
void Snake::Render(SDL_Surface* dest) { if (dead) { return; } renderrect.w = CELL_SIZE; renderrect.h = CELL_SIZE; RenderCoin(dest); RenderSnake(dest); } void Snake::RenderCoin(SDL_Surface* dest) { renderrect.x = coin.x * CELL_SIZE; renderrect.y = coin.y * CELL_SIZE; SDL_FillRect(dest, &renderrect, coincolor); } void Snake::RenderSnake(SDL_Surface* dest) { renderrect.x = segments[0].x * CELL_SIZE; renderrect.y = segments[0].y * CELL_SIZE; SDL_FillRect(dest, &renderrect, headcolor); for (unsigned i = 1; i < segments.size(); i++) { renderrect.x = segments.x * CELL_SIZE; renderrect.y = segments.y * CELL_SIZE; SDL_FillRect(dest, &renderrect, segmentcolor); } }
The End is Here
With that, our little Snake game is complete. Go ahead of build and run the project and you should get a dark green screen with a red & green snake that you can control using the arrow keys to collect yellow coins that randomly appear after you collect each one. If you bite yourself or hit a wall, you die, and nothing will be drawn but the dark green screen. Pressing the Enter key will restart the game, and pressing ESC will quit the game.
If you have any problems with the project, or would like to discuss the project. Feel free to contact me. My email address is ccpsceo@gmail.com. Please include "Programming Snake" in your subject when emailing me. You may also contact me via Skype by adding the user bbastudios and when asking for me to add you, include that you have read this Programming Snake article
Thank you for reading. I hope you have enjoyed this as much as I have.
Sincerely,
Richard Marks
Senior Technical Director
Bang Bang Attack Studios
You need to be a member in order to leave a comment
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now | https://www.gamedev.net/articles/programming/general-and-gameplay-programming/game-programming-snake-r3133/ | CC-MAIN-2019-43 | refinedweb | 5,295 | 71.24 |
import java.io.InputStream; 35 36 /*** 37 * Cuts the wrapped InputStream off after a specified number of bytes. 38 * 39 * <p>Implementation note: Choices abound. One approach would pass 40 * through the {@link InputStream#mark} and {@link InputStream#reset} calls to 41 * the underlying stream. That's tricky, though, because you then have to 42 * start duplicating the work of keeping track of how much a reset rewinds. 43 * Further, you have to watch out for the "readLimit", and since the semantics 44 * for the readLimit leave room for differing implementations, you might get 45 * into a lot of trouble.</p> 46 * 47 * <p>Alternatively, you could make this class extend {@link java.io.BufferedInputStream} 48 * and then use the protected members of that class to avoid duplicated effort. 49 * That solution has the side effect of adding yet another possible layer of 50 * buffering.</p> 51 * 52 * <p>Then, there is the simple choice, which this takes - simply don't 53 * support {@link InputStream#mark} and {@link InputStream#reset}. That choice 54 * has the added benefit of keeping this class very simple.</p> 55 * 56 * @author Ortwin Glueck 57 * @author Eric Johnson 58 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a> 59 * @since 2.0 60 */ 61 public class ContentLengthInputStream extends InputStream { 62 63 /*** 64 * The maximum number of bytes that can be read from the stream. Subsequent 65 * read operations will return -1. 66 */ 67 private long contentLength; 68 69 /*** The current position */ 70 private long pos = 0; 71 72 /*** True if the stream is closed. */ 73 private boolean closed = false; 74 75 /*** 76 * Wrapped input stream that all calls are delegated to. 77 */ 78 private InputStream wrappedStream = null; 79 80 /*** 81 * @deprecated use {@link #ContentLengthInputStream(InputStream, long)} 82 * 83 * Creates a new length limited stream 84 * 85 * @param in The stream to wrap 86 * @param contentLength The maximum number of bytes that can be read from 87 * the stream. Subsequent read operations will return -1. 88 */ 89 public ContentLengthInputStream(InputStream in, int contentLength) { 90 this(in, (long)contentLength); 91 } 92 93 /*** 94 * Creates a new length limited stream 95 * 96 * @param in The stream to wrap 97 * @param contentLength The maximum number of bytes that can be read from 98 * the stream. Subsequent read operations will return -1. 99 * 100 * @since 3.0 101 */ 102 public ContentLengthInputStream(InputStream in, long contentLength) { 103 super(); 104 this.wrappedStream = in; 105 this.contentLength = contentLength; 106 } 107 108 /*** 109 * <p>Reads until the end of the known length of content.</p> 110 * 111 * <p>Does not close the underlying socket input, but instead leaves it 112 * primed to parse the next response.</p> 113 * @throws IOException If an IO problem occurs. 114 */ 115 public void close() throws IOException { 116 if (!closed) { 117 try { 118 ChunkedInputStream.exhaustInputStream(this); 119 } finally { 120 // close after above so that we don't throw an exception trying 121 // to read after closed! 122 closed = true; 123 } 124 } 125 } 126 127 128 /*** 129 * Read the next byte from the stream 130 * @return The next byte or -1 if the end of stream has been reached. 131 * @throws IOException If an IO problem occurs 132 * @see java.io.InputStream#read() 133 */ 134 public int read() throws IOException { 135 if (closed) { 136 throw new IOException("Attempted read from closed stream."); 137 } 138 139 if (pos >= contentLength) { 140 return -1; 141 } 142 pos++; 143 return this.wrappedStream.read(); 144 } 145 146 /*** 147 * Does standard {@link InputStream#read(byte[], int, int)} behavior, but 148 * also notifies the watcher when the contents have been consumed. 149 * 150 * @param b The byte array to fill. 151 * @param off Start filling at this position. 152 * @param len The number of bytes to attempt to read. 153 * @return The number of bytes read, or -1 if the end of content has been 154 * reached. 155 * 156 * @throws java.io.IOException Should an error occur on the wrapped stream. 157 */ 158 public int read (byte[] b, int off, int len) throws java.io.IOException { 159 if (closed) { 160 throw new IOException("Attempted read from closed stream."); 161 } 162 163 if (pos >= contentLength) { 164 return -1; 165 } 166 167 if (pos + len > contentLength) { 168 len = (int) (contentLength - pos); 169 } 170 int count = this.wrappedStream.read(b, off, len); 171 pos += count; 172 return count; 173 } 174 175 176 /*** 177 * Read more bytes from the stream. 178 * @param b The byte array to put the new data in. 179 * @return The number of bytes read into the buffer. 180 * @throws IOException If an IO problem occurs 181 * @see java.io.InputStream#read(byte[]) 182 */ 183 public int read(byte[] b) throws IOException { 184 return read(b, 0, b.length); 185 } 186 187 /*** 188 * Skips and discards a number of bytes from the input stream. 189 * @param n The number of bytes to skip. 190 * @return The actual number of bytes skipped. <= 0 if no bytes 191 * are skipped. 192 * @throws IOException If an error occurs while skipping bytes. 193 * @see InputStream#skip(long) 194 */ 195 public long skip(long n) throws IOException { 196 // make sure we don't skip more bytes than are 197 // still available 198 long length = Math.min(n, contentLength - pos); 199 // skip and keep track of the bytes actually skipped 200 length = this.wrappedStream.skip(length); 201 // only add the skipped bytes to the current position 202 // if bytes were actually skipped 203 if (length > 0) { 204 pos += length; 205 } 206 return length; 207 } 208 209 public int available() throws IOException { 210 if (this.closed) { 211 return 0; 212 } 213 int avail = this.wrappedStream.available(); 214 if (this.pos + avail > this.contentLength ) { 215 avail = (int)(this.contentLength - this.pos); 216 } 217 return avail; 218 } 219 220 } | http://hc.apache.org/httpclient-legacy/xref/org/apache/commons/httpclient/ContentLengthInputStream.html | CC-MAIN-2015-18 | refinedweb | 954 | 73.78 |
from a file or resource
- Run a script from standard input
-m, --main A namespace to find a -main function for execution
-h, -?, --help Print this help message and exit
operation:
- Establishes thread-local bindings for commonly set!-able vars
- Enters the user namespace
- Binds *command-line-args* to a seq of strings containing command line
args that appear after any main option
- Runs all init options in order
- Runs a repl or script if requested
The init options may be repeated and mixed freely, but must appear before
any main option. The appearance of any eval option before running a repl
suppresses the usual repl greeting message: "Clojure ~(clojure-version)".
Paths may be absolute or relative in the filesystem or relative to
classpath. Classpath-relative paths have prefix of @ | http://clojure.org/repl_and_main?responseToken=0830f5cf6e22cbea90c1047ab96ba43d4 | CC-MAIN-2014-15 | refinedweb | 130 | 50.46 |
"DJ Adams is the author of sabber..."
should be
"DJ Adams is the author of s9780596002022..."
Lots of markup conversion errors; there are many instances of
/
which should simply be
/
For example:
<default/>
on page 431 should be, of course:
<default/>
"The conditions are OR'ed together--f any of the conditions..."
should be
"The conditions are OR'ed together--if any of the conditions..."
section "Server vCard
should be:
section "Server vCard"
"(priority values must be a positive integer and cannot be 0 or less)"
should be
"(priority values must be integers, and cannot be less than 0)"
"...in which case the JID will be in the form hostname> with an optional..."
should be
"...in which case the JID will be in the form hostname with an optional..."
<vCard xmlns='vcard-temp' version='3.0'>
should be
<vCard xmlns='vcard-temp' version='2.0'>
"The format of the <tz/> and <display> tags..."
should be
"The format of the <tz/> and <display/> tags..."
<x xmlns='9780596002022:x:expire' seconds='600' stored='993038415'/>
should be
<x xmlns='9780596002022:x:expire' seconds='1800' stored='993038415'/>
The code listing is missing the first few lines (they appear correctly
in the step-by-step breakdown starting on p333). The missing first few
lines are these:
use strict;
use Jabber::Connection;
use Jabber::NodeFactory;
use Jabber::NS qw(:all);
use MLDBM 'DB_File';
use LWP::Simple;
use XML::RSS;
The second sentence "One of the functions..." would really benefit from a rewrite,
especially as it's potentially a bit confusing and difficult to follow the flow with
all the examples, figures and sidebars in this area.
May I humbly suggest the sentence starting "One of the functions.." be replaced with
this:
"What information is returned depends on what information is stored
in the JUD in the first place. You can find out what fields are available for
population by sending an IQ-get in the 9780596002022:iq:register namespace, as shown in
Example 10-3."
<VCARD version="3.0" xmlns="vcard-temp">
should be
<VCARD version="2.0" xmlns="vcard-temp">
© 2013, O’Reilly Media, Inc.
(707) 827-7019
(800) 889-8969
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. | http://oreilly.com/catalog/errata.csp?isbn=9780596002022&order=date | CC-MAIN-2013-20 | refinedweb | 372 | 64.2 |
Michael Niedermayer wrote: > On Mon, Nov 14, 2011 at 08:38:20PM +0900, KO Myung-Hun wrote: >> >> >> Michael Niedermayer wrote: >>> On Sun, Nov 13, 2011 at 09:59:23PM +0900, KO Myung-Hun wrote: >>>> Hi/2. >>>> >>>> NASM does not like that %rep and %endrep are placed in %if...%endif block. >>> >>> would you (maybe with reimar) be interrested in maintaining NASM >>> support in ffmpeg ? >>> >> >> Of course. > > ok, then you should get a public git clone of ffmpeg somewhere > (github for example), where you maintain that support, apply patches > that passed your review and do whatever you need to do ... > and when you are happy with whats in your repo/branch then just tell > me to merge it, and i will ASAP. > The important point is that review happens before code is added to > your repo. > Ok, I'll try. > Also theres > "Reimar Döffinge (2.2K) [FFmpeg-devel] [PATCH] HACK: fix compilation with NASM." > which you should comment/reply to > Ok. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.14 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 1GHz with 512 MB RAM Korean OS/2 User Community : | http://ffmpeg.org/pipermail/ffmpeg-devel/2011-November/116933.html | CC-MAIN-2014-42 | refinedweb | 191 | 73.78 |
The Codehaus XFire team is proud to announce XFire 1.1.2! This is a bug fix release and all users are strongly encouraged to upgrade..2 incorporates several bug fixes since 1.1.1:
- Fix compilation issues with client and JAXB examples
- DOM mode namespace bug fix
- Fix minor JAX-WS fault name generation
Many thanks to those who helped build and test this release!
Download Here
Upgrading to 1.1.2 from 1.1
- If you are using services.xml to register your services, you MUST upgrade to XBean 2.4 from version 2.3.
- The Codehaus Maven repository has changed to. You will need to update your POMs accordingly.
Errata
- None at this time | http://docs.codehaus.org/display/XFIRE/XFire+1.1.2+Release+Notes | CC-MAIN-2015-22 | refinedweb | 117 | 79.46 |
You'll need to install a library to make Arduino IDE support the module. This library includes drivers for the APDS-9960_ALSGesture_Module library is responsible for reading sensor data.
To use the library on Arduino IDE, add the following #include statement to the top of your sketch.
#include <Turta_ALSGesture_Module.h>
Then, create an instance of the Turta_ALSGesture_Module class.
Turta_ALSGesture_Module als
Now you're ready to access the library by calling the als instance.
To initialize the module, call the begin method.
begin()
This method configures the I2C bus and INT pin to read sensor data.
Returns the ambient light value.
int readAmbientLight()
Parameters
None
Returns
Int: Ambient light value
Returns the ambient and RGB light.
void readARGBLight(int a, int r, int g, int b)
Parameters
Int: a out
Int: r out
Int: g out
Int: b out
Returns
None
Returns the raw proximity value.
short readProximity()
Parameters
None
Returns
Short: Proximity value
You can open the example from Arduino IDE > File > Examples > Examples from Custom Libraries > Turta ALS & Gesture Module. There are two. | https://docs.turta.io/modular/als-gesture/iot-node | CC-MAIN-2019-51 | refinedweb | 174 | 57.16 |
08 February 2012 15:07 [Source: ICIS news]
LONDON (ICIS)--Imports of US E90 (90% ethanol blended gasoline) continue to flow into the European market and are expected to exert downwards pressure on European fuel ethanol values until the end of the year’s second quarter, according to sources.
In the EU, denatured ethanol is subject to a flat duty of €102/cbm ($136/cbm).
However, E90 is currently subject to an import duty of just 6.5%, roughly €33/cbm at current prices, as some EU member states classify it as a chemical rather than as denatured ethanol.
The fact that E90 enjoys a lower import duty means its prices are very competitive when compared with European T2 values. This has resulted in softer T2 numbers recently and this scenario is now likely to continue throughout the second quarter.
Renewable Energy Directive (RED) certified T2 fuel ethanol is trading at levels of €560-570/cbm FOB (free on board) Rotterdam, duty paid, while sources quote prices for E90 around €510/cbm FOB Rotterdam on a T1 basis, with 6.5% duty payable on top of that, making the user price about €543/cbm.
Market sources had expected the inflow of imports to decrease during 2012 as the EU had voted in favour of amending import legislation to reclassify E90 as denatured ethanol.
But the publication of this legislation has been subject to delays and sources say that, even if it is published imminently, there will be a three-month holiday period during which, imports of E90 can still legally be imported into the EU under duty of 6.5%.
In addition, the expiration of the US Volumetric Ethanol Excise Tax Credit (VEETC) in December was expected to result in a decrease in US production rates and competitively priced US imports.
However, sources say ?xml:namespace>
“The
( | http://www.icis.com/Articles/2012/02/08/9530617/imports-of-e90-to-continue-undermining-european-fuel-ethanol-values.html | CC-MAIN-2014-41 | refinedweb | 307 | 55.27 |
does the following make sense?
@elidable(CONFIG) def logConfig( what: String ) { log.info( what )}
def test : Int = { logConfig( "testin one two" ) 666}
where log is taken from SLF4s.
that is to say, i understand that in SLF4s logging is suppressed according to log-level set. but what i'd like to have is to not even invoke logConfig at all if i decide so with an elide-below level.
as i see it, log.info would call
def info(msg: => String) { if (slf4jLogger.isInfoEnabled) slf4jLogger.info(msg)}
so without @elidable i'd have
def test : Int = { if (slf4jLogger.isInfoEnabled) slf4jLogger.info("testin one two") 666}
whereas with elidable i would really get
def test : Int = { 666}
if i wanted, right?
thanks, -sciss-
best, -sciss-
if i have
@elidable def log( what: String ) { println( "LOG: " + what )}
and
def test( i: Int ) = { log( "found " + i ) i + i}
when i let scalac eliminate the elidable stuff, the call log( ... ) in test is also removed (as far as i understand, and from what the step debugger tells me), so adding a by-name argument is redundant here, and probably also not preferable performance-wise.
right? | https://groups.google.com/forum/?_escaped_fragment_=topic/scala-user/3LLOQcjDcd4 | CC-MAIN-2016-26 | refinedweb | 191 | 72.26 |
- <<
Using Stylesheets in Flash CS3
Last updated Oct 17, 2003.
By Kris Hadlock will teach you how to create a simple stylesheet, load it using ActionScript 3, and use it to style dynamic text in a Flash movie. The source code for this article can be downloaded here.
The sample requires that you create a CSS file called layout.css and add it to a css directory where you plan on publishing the final swf. If you want to name the file differently, or add it to a different directory, simply change the request.url, which we will set later in the ActionScript file. The CSS for this movie is going to handle setting styles for a body tag and a title class.
body { font-size: 12px; color: #333; } .title { font-weight: bold; color: #ff0000; }
Once we apply the stylesheet to the text in our Flash movie, anything within a body tag will produce a gray font that is 12px in size and anything with the title class assigned to it will produce a bold, red font.
First, open Flash and start by creating a sample text field so that we can later apply our stylesheet to it. To do this, from the Tools menu, select the Text tool and use it to create a text field. Next, open the Property Inspector and make sure that the text field is set to Dynamic Text. Then, give it the name txtField so that we can target it through ActionScript to apply the CSS and embed the font of your choice.
In order to tie a stylesheet to the Flash movie, we are going to create a Document class, which is a best practice for writing object-oriented code.
package com.krishadlock { public class Document extends MovieClip { public function Document() { this.loadCSS(); } } }
Once our class is created, we can either assign it to the movie in the Property Inspector or by using the Publish settings. Unlike linking classes in ActionScript 2, you can now assign the class to the movie rather than a specific symbol, but you must extend the MovieClip when doing so.
The package that you create is usually based on the project that you're working on; in this case, I created a sample package called com.krishadlock. In ActionScript 3, your class path must be true to the actual directory structure in which it resides.
In our Document class, we need to import the appropriate classes and packages. Since we are extending the MovieClip—and we have a text field in our movie to which we will be applying a stylesheet—we need to import the MovieClip, TextField, and Stylesheet classes. Of course, we will also need to load the CSS, which will require us to import the URLRequest, URLoader, and Event classes as well.
import flash.events.Event; import flash.net.URLRequest; import flash.net.URLLoader; import flash.display.MovieClip; import flash.text.StyleSheet; import flash.text.TextField;
In our constructor, we will load the CSS file through a private method called loadCSS.
public function Document() { this.loadCSS(); } private function loadCSS() { var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest(); request.url = "css/layout.css"; loader.addEventListener(Event.COMPLETE, onCSSLoaded); loader.load(request); }
The loadCSS method creates a URLLoader and URLRequest, which it uses to load the CSS file and set a complete event. When the CSS file has loaded and the complete event fires, we will catch the event with the private onCSSLoaded method. Within this method is where we will finally begin to apply our styles.
private function onCSSLoaded(evt:Event) { var layout:StyleSheet = new StyleSheet(); layout.parseCSS(evt.target.data); this.txtField.styleSheet = layout; this.txtField.htmlText = ’<body><p class="title">Using Stylesheets with Flash CS3</p><br/><p>My body text resides here.</p></body>’; }
The first thing that we need to do is create a new StyleSheet object. This object is then used to parse the CSS into a format that we can use to apply the styles to the appropriate textfield. The parsing is made possible with the native parseCSS method, which takes the event.target.data, or in other words, the CSS, which was loaded. Once it is parsed, it can be used as the stylesheet for our text field by simply setting it to the text field's native stylesheet property.
Next, we need to set our dynamic text. In a real world situation, this text would probably be coming from an external source, such as an XML file, a database, and so on, but for the sake of this sample, we will set the text directly in the Document class.
Notice that the text includes a body tag, which encapsulates all of the text. This means that all of the text within it will receive the styles that we defined in the stylesheet for the body tag.
Next, you'll notice that we have used a paragraph tag to set a title class—everything within this tag will receive the title styles from the stylesheet.
Like I said earlier, the best part of using an external stylesheet with Flash is that anyone can change the styles at a later time without having to republish the movie. This means that we can have a stylesheet that styles an entire web site and the Flash movies within it, make a change to that stylesheet, and have it automatically applied to everything. | http://www.peachpit.com/guides/content.aspx?g=webdesign&seqNum=353 | CC-MAIN-2015-40 | refinedweb | 902 | 71.24 |
import * as mod from "";ClassescAssertionErrorFunctionsf_formatConverts the input into a string. Objects, Sets and Maps are sorted so as to make tests less flaky fassertMake an assertion, error will be thrown if expr does not have truthy value. fassertArrayIncludesMake an assertion that actual includes the expected values. If not then an error will be thrown. fassertEqualsMake an assertion that actual and expected are equal, deeply. If not deeply equal, then throw. fassertExistsMake an assertion that actual is not null or undefined. If not then throw. fassertMatchMake an assertion that actual match RegExp expected. If not then throw. fassertNotEqualsMake an assertion that actual and expected are not equal, deeply. If not then throw. fassertNotMatchMake an assertion that actual not match RegExp expected. If match then throw. fassertNotStrictEqualsMake an assertion that actual and expected are not strictly equal. If the values are strictly equal then throw. assertNotStrictEquals(1, 1) fassertObjectMatchMake an assertion that actual object is a subset of expected object, deeply. If not, then throw. fassertStrictEqualsMake an assertion that actual and expected are strictly equal. If not then throw. assertStrictEquals(1, 2). fassertThrowsAsyncExecutes a function which returns a promise, expecting it to throw or reject. If it does not, then it throws. An error class and a string that should be included in the error message can also be asserted. fequalDeep equality comparison used in assertions ffailForcefully throws a failed assertion funimplementedUse this to stub out methods that will throw when invoked. funreachableUse this to assert unreachable code. | https://deno.land/std@0.102.0/testing/asserts.ts?code | CC-MAIN-2022-40 | refinedweb | 246 | 53.07 |
#include <deal.II/base/timer.h>
The Timer class provides a way to measure both the amount of wall time (i.e., the amount of time elapsed on a wall clock) and the amount of CPU time that certain sections of an application have used. This class also offers facilities for synchronizing the elapsed time across an MPI communicator.
The Timer class can be started and stopped several times. It stores both the amount of time elapsed over the last start-stop cycle, or lap, as well as the total time elapsed over all laps. Here is an example:
Alternatively, you can also restart the timer instead of resetting it. The times between successive calls to start() and stop() (i.e., the laps) will then be accumulated. The usage of this class is also explained in the step-28 tutorial program.
Definition at line 118 of file timer.h.
Constructor. Sets the accumulated times at zero and calls Timer::start().
Definition at line 159 of file timer.cc.
Constructor specifying that CPU times should be summed over the given communicator. If
sync_lap_times is
true then the Timer will set the elapsed wall and CPU times over the last lap to their maximum values across the provided communicator. This synchronization is only performed if Timer::stop() is called before the timer is queried for time duration values.
This constructor calls Timer::start().
Definition at line 165 of file timer.cc.
Return a reference to the data structure containing basic statistics on the last lap's wall time measured across all MPI processes in the given communicator. This structure does not contain meaningful values until Timer::stop() has been called.
Definition at line 907 of file timer.h.
Return a reference to the data structure containing basic statistics on the accumulated wall time measured across all MPI processes in the given communicator. This structure does not contain meaningful values until Timer::stop() has been called.
Definition at line 915 of file timer.h.
Print the data returned by Timer::get_last_lap_wall_time_data() to the given stream.
Definition at line 924 of file timer.h.
Print the data returned by Timer::get_accumulated_wall_time_data() to the given stream.
Definition at line 936 of file timer.h.
Stop the timer. This updates the lap times and accumulated times. If
sync_lap_times is
true then the lap times are synchronized over all processors in the communicator (i.e., the lap times are set to the maximum lap time).
Return the accumulated CPU time in seconds.
Definition at line 194 of file timer.cc.
Equivalent to calling Timer::reset() followed by calling Timer::start().
Definition at line 898 of file timer.h.
Return the accumulated CPU time (including the current lap, if the timer is running) in seconds without stopping the timer.
If an MPI communicator is provided to the constructor then the returned value is the sum of all accumulated CPU times over all processors in the communicator.
Definition at line 236 of file timer.cc.
Store whether or not the wall time and CPU time are synchronized across the communicator in Timer::start() and Timer::stop().
Definition at line 336 of file timer.h.
A structure for parallel wall time measurement that includes the minimum time recorded among all processes, the maximum time as well as the average time defined as the sum of all individual times divided by the number of MPI processes in the MPI_Comm for the total run time.
Definition at line 351 of file timer.h. | https://dealii.org/developer/doxygen/deal.II/classTimer.html | CC-MAIN-2022-21 | refinedweb | 581 | 58.28 |
First time here? Check out the FAQ!
Hi All,
I have a large collection of videos in mov format. The video files
are very huge. I want to do these operations on all videos at a time using any
application on Linux/Mac
1. Reducing size of video by maintaining the quality of audio and video
2. Separate audio from video and save as wav and wmv formats specifically.
3. Reduce size of videos to a specific frame size.
Hi,
Did anyone use Motion2D software to estimate 2D parametric motion models in an image sequence?
I am using this Motion 2D to estimate the velocity vector at a point between two adjacent frames. I am unable to track any specified point in a video.
I need some help if anyone has worked in this direction.;
particle* newArr = (particle*)malloc(sizeof(particle)*partn);
sortParticles(pArr,partn);
int counter=partn/15;
int temp=0;
int temp1=0;
for(int p=0;p<partn;p++)
{
temp1 = counter;
while(counter!=0)
{
newArr[temp] = pArr[p];
temp = temp + 1;
counter = counter - 1;
if(temp == partn)
break;
}
if(temp == partn)
break;
counter = temp1 - 1;
if(counter <= 0)
counter = 1;
}
return newArr}
pArr[p].x = nx;
pArr[p].y = ny;
pArr[p].scale = ns;
pArr[p].dx=new_dx;
pArr[p].dy=new_dy;
pArr[p].ds=new_ds;
roi = new Rect(nx - pArr[p].width*ns/2,
ny - pArr[p].height*ns/2,
pArr[p].width*ns,
pArr[p].height*ns);
partHist = getHistogramHSV(hsvIm(*roi));
pArr[p].w = (1-compareHist(partHist,refHist,CV_COMP_BHATTACHARYYA));
totalW += pArr[p].w;
}
//normalize weights
for(int p=0; p < partn; p++)
{
pArr[p].w = pArr[p].w/totalW;
}
}
for (int p = 0; p < partn; p++)
{
float u1,u2,u3,u4,u5,u6,n1,n2,n3,n4,probability,scale,rCorr,gCorr,bCorr,likelihood;
u1 = ((float)rand())/RAND_MAX;
u2 = ((float)rand())/RAND_MAX;
u3 = ((float)rand())/RAND_MAX;
u4 = ((float)rand())/RAND_MAX;
u5 = ((float)rand())/RAND_MAX;
u6 = ((float)rand())/RAND_MAX;
//get normally distributed random numbers using box-muller transform (has mean 0 and std 1)
n1 = sqrt(-2*log(u1)) * cos(2*3.14159265359*u2);
n2 = sqrt(-2*log(u1)) * sin(2*3.14159265359*u2);
n3 = sqrt(-2*log(u3)) * sin(2*3.14159265359*u4);
n1=n1*pArr[p].width * 0.15;
n1+=pArr[p].x;
n2=n2*pArr[p].height * 0.12;
n2+=pArr[p].y;
n3=n3*pArr[p].scale*0.04;
n3+=pArr[p].scale;?
Hi,
Can anyone help me with head tracking and pose estimation in OPENCV.
I want to do head tracking with a Particle filter as described in...
and do the pose estimation by computing texture and colour features.
I am looking at a object detection task. And I want to give the ground truth by annotating pedestrians in a video.
I read information about Caltech Benchmark datasets and Piotr's Matlab Toolbox for annotating. But the Piotr's toolbox is used for behaviour annotation.
And I looked at ViPER -GT also.......
After downloading the ViPER source code, I am not able to understand how to start annotating.
Can anyone suggest how to annotate in a video?
Hi
I want to know the disadvantages and advantages of different segmentation algorithms like
Otsu's multiple thresholds, kmeans, Expectation maximization, mean shift algorithm, normalized cuts etc.
Can anyone share me the source where I can find all the information about these segmentations.
And also I want proper images to demonstrate the advantages and disadvantages of one algorithm with another
Hi all,
Did anyone try implementing Latent SVM without using the built in libraries in opencv for object detection?
Please let me know how to start implementing this.
And also when I work with these models...
there are many misdetections. It is not working so good as the matlab code from vocrelease5.
Thanks for reply. I working with Opencv24x.
Do you know how to generate these models?
When I see the opencv implementation for Latent SVM, it uses pretrained models for object detection. But in the opencv samples only cat.xml file is present. How do I generate these xml file for people?
I tried converting the mat files to xml files from the voc-release5. But the opencv does not accept the xml files in that format. Can anyone help me out with this?
Can anyone help me with the code in the link below....
I am trying to do pedestrian detection using Part Based Models. When I look into the matlab folder, there is a readme file which gives the steps to compile. For training, it says to run "training_demo.m" file for which the annotated pedestrian data set has to be given as input. But I am not able to understand where the annotated file list has to be given.
Please help me to run this code or suggest me with a easy code.
Even I am working on the same problem. The link that you are using always gives a incorrect label. So I tried using the code from this website
This gives 100% accuracy for offline training and testing because it does all preprocessing.
I have one question to ask. How to did you get the name displayed for you and pitt(for ex) in the video? I wanted to know how tagging is done? I am uable to tag people in videos. Can you please share your code?
Hi all,
I am looking for a problem of recognizing known people in a video.
I did according to these links.
But the problem with the first link is that, always it shows the same name to everyone.
And I tried under several illumination conditions. but I failed.
And with the link, I dont know how to tag people with their names. And it always shows a wrong label.
Can anyone help me with these two problems?
Thanks for your suggestion.
I tried the following code for face recognition in videos
And I made necessary changes according to your answer to display names in the program. But I failed to do it.
When I say this
int predicted = model->predict(askingImg);
cout<<names[prediction]<<endl;
nothing is displayed in the command window.
Please let me know if there is a way to tag people in a video.
I actually tried with your answer. But the name of the person is not getting displayed in the video.
I am now trying to display names of person in a video. For that I am using the code from the following link
and I tried your answer to display the names of the persons in the video. But it is failing.
Below is the code
//g++ -ggdb pkg-config --cflags opencv -o basename online_faceRec_video.cpp .cpp online_faceRec_video.cpp pkg-config --libs opencv
pkg-config --cflags opencv
basename online_faceRec_video.cpp .cpp
pkg-config --libs opencv
/*
* Released to public domain under terms of the BSD Simplified license.
using namespace cv;
//using namespace cv::face;
using namespace std;
static void read_csv(const string& filename, vector<mat>& images, vector<int>& labels, vector<string>& names, char separator = ';') {
std::ifstream file(filename.c_str(), ifstream::in);
if (!file) {
string error_message = "No valid input file was given, please check the given filename.";
CV_Error(CV_StsBadArg, error_message);
}
string line, path, classlabel,classnames;
while (getline(file, line)) {
stringstream liness(line);
getline(liness, path, separator);
getline(liness, classlabel);
getline(liness, classnames);
if(!path.empty() && !classlabel.empty()) {
images.push_back(imread(path, 0));
labels.push_back(atoi(classlabel.c_str()));
names.push_back(classnames.c_str());
}
}
}
int main(int argc, const char *argv[]) {
// Check for valid command line arguments, print usage
// if no arguments were given.
if (argc != 4) {
cout << "usage: " << argv[0] << " </path> </path> </path>" << endl;
cout << "\t </path> -- Path to the Haar Cascade for face detection." << endl;
cout << "\t </path> -- Path to the CSV file with the face database." << endl;
cout << "\t <device id=""> -- The webcam device id to grab frames from." << endl;
exit(1);
}
// Get the path to your CSV:
string fn_haar = string(argv[1]);
string fn_csv = string(argv[2]);
int deviceId = atoi(argv[3]);
// These vectors hold the images and corresponding labels:
vector<mat> images;
vector<int> labels;
vector<string> names;
try {
read_csv(fn_csv, images, labels,names);
} catch (cv::Exception& e) {
cerr << "Error opening file \"" << fn_csv << "\". Reason: " << e.msg << endl;
exit(1);
}
int im_width = images[0].cols;
int im_height = images[0].rows;
Ptr<FaceRecognizer> model = createFisherFaceRecognizer ...
I am following the code in this link for online face recognition.
But I am facing a problem
Can anyone help me?
Actually I want to tag known people in a video.(known people - whom i have trained)
Hi,
For online face recognition, I used the following link.
But the problem I am facing is,
1. How do I start online training for more than one person?
2. I tried training one person after another by giving different names. But when I start testing, if the two persons come at a time in video, it is displaying the same name for both persons in the video.
Can anyone help me? I am not able to move ahead after this.
My ultimate goal is to recognize people in a video and tag them with their names.
I am working on the problem of face recognition. I need a help to display, the name of that person in the image by tagging(Display the name of the person by performing face recognition). Can anyone help me with this? | https://answers.opencv.org/users/13894/sowmya/?sort=recent | CC-MAIN-2021-25 | refinedweb | 1,554 | 68.16 |
?
First things first. Like I said, there are a zillion different ways to represent a graph. I want to do so immutably — again, an immutable data type is one where “mutations” return a new object that is a mutated version of the original object, which stays the same. For my purposes today, I want to be able to take an existing graph, possibly empty, and insert new nodes and edges into that graph. The data structure I’m going to choose for my internal representation is that a graph consists of:
- an unordered, no-duplicates set of nodes of arbitrary type. Just like you can have a list of strings or a list of pairs of integers, I want to have a graph where the nodes are strings or giraffes or whatever.
- every node has an unordered, no-duplicates set of outgoing edges of arbitrary type. Again, I want to be able to make the edges anything I want. If I want a graph where the nodes are apples and the edges are tigers, I should be able to get that.
- an edge that leaves one node in a graph goes to another (or the same) node in the graph. That is, the edges have a direction to them; every edge starts at one node and goes to another.
Suppose my edges are integers and my nodes are strings. The constraints above imply that there can be edges 123 and 345 that both leave node “ABC” and arrive at node “XYZ”. But there cannot be an edge 123 from “ABC” to “DEF” and an edge 123 from “ABC” to “XYZ”; the edges leaving node “ABC” must be distinct in their values.
Like I said earlier, there are lots of different kinds of graphs, and these constraints work well for my purposes in this series. If, for example, I wanted edge labels to be costs, say, then this would not work well; if edge labels are costs then you want the opposite characteristics. That is, you want there to be only one edge between any pair of nodes, where that edge indicates the cost of traversal, and it is perfectly reasonable to have two edges leaving the same node with the same cost. But in my case I want the edges to uniquely identify a path through the graph.
With that set of characteristics in mind, we quickly realize that we could say that an immutable directed graph is nothing more than an immutable dictionary, where the dictionary keys are nodes and the dictionary values are themselves immutable dictionaries where the nested dictionary keys are edge values and the nested dictionary values are the destination nodes of those edges.
Rather than making my own immutable dictionary — because that’s not the point of this series — I’ll just use the System.Collections.Immutable package downloadable from NuGet to define my graph. Since this is first, just a super-thin wrapper around a dictionary reference, and second, logically a value, I’ll make it a struct.
using System; using System.Collections.Generic; using System.Collections.Immutable; struct ImmutableDirectedGraph<N, E> { public readonly static ImmutableDirectedGraph<N, E> Empty = new ImmutableDirectedGraph<N, E>( ImmutableDictionary<N, ImmutableDictionary<E, N>>.Empty); private ImmutableDictionary<N, ImmutableDictionary<E, N>> graph; private ImmutableDirectedGraph( ImmutableDictionary<N, ImmutableDictionary<E, N>> graph) { this.graph = graph; }
To add a new node to the graph we first check to see if the graph already contains this node; if it does, we leave it alone. If not, we add it to the map with an empty set of outgoing edges.
public ImmutableDirectedGraph<N, E> AddNode(N node) { if (graph.ContainsKey(node)) return this; return new ImmutableDirectedGraph<N, E>( graph.Add(node, ImmutableDictionary<E, N>.Empty)); }
To add an edge to the graph, we first make sure that both nodes are in the graph. Once that’s taken care of, we get the edge set for the start node and add to it the new edge.
public ImmutableDirectedGraph<N, E> AddEdge(N start, N finish, E edge) { var g = this.AddNode(start).AddNode(finish); return new ImmutableDirectedGraph<N, E>( g.graph.SetItem( start, g.graph[start].SetItem(edge, finish)))); }
Remember, setting an item on an immutable dictionary gives you back a different dictionary with the new item added.
Finally, given a graph and a node, what are the outgoing edges? We could give an error if the node is not even in the graph, but I think it is reasonable to say that the edge set of a node that is not in the graph is the empty set:
public IReadOnlyDictionary<E, N> Edges(N node) { return graph.ContainsKey(node) ? graph[node] : ImmutableDictionary<E,N>.Empty; }
I’m not going to need edge and node removal for my purposes; doing so is left as an exercise to the reader. Note that the data structure I’ve sketched out here does not have an efficient mechanism for removing the edges that are pointing to a removed node; modifying the data structure to make that efficient is an interesting challenge that I’m not going to get into in this series.
As you’ve likely come to expect, to use this thing we start with the empty graph and add edges (and, if we like, nodes with no edges).
Here is a portion of the Zork map where I’ve removed a whole bunch of edges to make a DAG. (Click for larger.)
We can build that map in our graph structure like this:
var map = ImmutableDirectedGraph<string, string>.Empty .AddEdge("Troll Room", "East West Passage", "East") .AddEdge("East West Passage", "Round Room", "East") .AddEdge("East West Passage", "Chasm", "North") .AddEdge("Round Room", "North South Passage", "North") .AddEdge("Round Room", "Loud Room", "East") .AddEdge("Chasm", "Reservoir South", "Northeast") .AddEdge("North South Passage", "Chasm", "North") .AddEdge("North South Passage", "Deep Canyon", "Northeast") .AddEdge("Loud Room", "Deep Canyon", "Up") .AddEdge("Reservoir South", "Dam", "East") .AddEdge("Deep Canyon", "Reservoir South", "Northwest") .AddEdge("Dam", "Dam Lobby", "North") .AddEdge("Dam Lobby", "Maintenance Room", "East") .AddEdge("Dam Lobby", "Maintenance Room", "North");
Notice how there are two paths from the Dam Lobby to the Maintenance room, but our data structure handles that just fine.
Next time: we’ll see how to find all the traversals through that graph starting from any given node.
I’m interested to see how a start-to-end traversal will be stored. If we’re applying this to Zork, and since nodes and edges are strings, I’m suspecting a sequence of “node(-edge-node)*” that reads like instructions. I’m expecting the algorithm to be recursive, but otherwise I’d ask how they’d be stored as they’re built up. Maybe a deque (mutable or otherwise) would be a good candidate.
I’d do a depth first search to find the maintenance room. Since the graph is acyclic, it will always find all possible paths. Carry a reference to a Stack that contains the directions to go. E.g. start with an empty stack, foreach edge { push edgename; recurse on node; pop stack; }
(Yes, I guess you could also use an immutable stack, that should make no difference)
Yeah, I was definitely thinking “depth first”. Although I think acyclic isn’t enough to find all of them; you need to make sure to repeat the search for every node with no incoming edges. Since that’s not easy to determine with this structure, I think we’re making the assumption that there’s exactly one “start” node. As far as carrying a stack; if we do this recursively, the call stack acts as a natural stack (and sort of an immutable one, I guess? I’ve never considered that before). Then, we can build the sequence by returning a stack, and pushing the “current” node and edge on each result. We wouldn’t need to pass the stack along the arguments this way.
Also, if we want the types to be arbitrary, we can’t assume that nodes and edges have the same types, so we’d have to use a non-generic sequence or a specially made alternating sequence.
I’d be interested to see what follows. I’ve always got stuck around here with testing equality on the nodes, and putting them in a set (for example for Dijkstra), and get lost in a forest of wrapper objects that may have reference or structural equality.
What I’d really like to know is whether Eric created this part of the Zork map from memory…
I have fond memories of maps from the original Adventure game hand-drawn on pieces of 14″ fanfold computer paper – all of these rooms were on those maps 30+ years go.
I did not, though I’m pretty sure I could draw most of the Zork I map from memory with the exception of the mazes.
Did you complete Zork I without any “external” help? I remember there were a few problems very hard to solve (like the jewel encrusted egg).
Certainly not! Those Infocom games were hard, particularly the early ones.
When I started thinking of the possible ways to implement this graph I arrived to a different conclusion:
an immutable HashSet that contains “nodes”. Each “node” contains immutable dictionaries where the keys are edges and the values are the destination nodes of the edges.
Considering that I have almost no experience in using and defining graphs, what is the biggest disadvantage with this implementation, in your opinion?
How would you have two different graphs that contained the same nodes?
You mean the same nodes but different edges?
In that case, in my model, the nodes will be different objects too. Like a “Round Room” with a passage to North and a different “Round Room” with a passage to South.
The cost you pay by that approach is an extra object for every node. Plus the extra level of indirection means not being able to easily pose questions like “what are the nodes in common between these two graphs”? With my scheme the only property that a node must have is that it can be a key in a dictionary, and that is a low bar to meet.
Thank you for the explanation. I had no doubt that your scheme was more appropriate to handle this kind of problems.
It is always a pleasure reading your informative articles here in your blog and in StackExchange.
You’re welcome; I want to point out also that your scheme is entirely reasonable, and in fact in my first draft of this article I was considering using a hash set of edges, where edges were data structures, which is very similar to your proposal. It would be perfectly workable; I just realized that I didn’t *need* that additional mechanism.
Nit-pick: There’s a slight lacunae with your three-bullet definition of a graph. After the definition is provided, an assertion is made that the definition contains an implication regarding the concept of “value” though the term “value” has not been defined (or even referred to). In the context of what comes later, the meaning is certainly clear, though the reader needs to skip ahead to do so.
I was also confused by the lack of talk of “value” in the definition, Although I think “value” itself was understood to mean “instance of the node/edge type”. I was more confused because it wasn’t clear that “duplicate” edges meant only in value and not in what nodes it connected. Still, that very next paragraph explained it.
You’re both right, it is somewhat confusing. I’ll try to clarify the text.
Maybe I’m just caught off guard by the “an edge is an arbitrary type” idea. I’m used to thinking of a nodes as having explicit value of arbitrary type (like a linked list with many “next” pointers); nodes were clearly defined by their value. However, when I think of edges I think of a thin connection between two nodes. It took me an extra few brain processor cycles to realize that edges were real, individual entities defined by value just like nodes; their “edginess” is just a factor of how they’re being arranged in the greater data structure.
Indeed, we’re not used to thinking of the “arrows” in, say, a linked list, a tree or a dictionary as themselves having associated values, except in fairly exotic cases such as tries or DAWGS, or in the trivial cases of the arrows being called “left” and “right”, or “next” and “previous”. But in a labeled directed graph, the fundamental thing we’re manipulating in the data structure is an arrow, so it makes sense to make that every bit as “first class” as a node.
Graphs are fun stuff. The edges as an entity idea is a useful concept, especially when doing analysis.
In biological pathways, some graphs could be modeling metabolism, which then your nodes are metabolites (e.g. sugar) and your edges are enzymes.
Other graphs could be modelling signal transduction (e.g. how the brain sends a signal to move a muscle). The nodes are proteins, and the edges are interactions (activation, repression).
I think this will be a fun group of posts.
Pingback: Eric Lippert on Graph Traversal | Dom's Code
Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1727
Great post (also the previous series about combinations)!
Coming from a formal background I always find it astonishing how enumerator blocks + Linq allow for extremely declarative solutions to such problems in C#.
I already came up with a very slim solution for the traversal problem and cannot wait to compare it to yours (maybe I will also share my code in the next post).
PS: It seems that your sample graph is missing the .AddEdge(“Deep Canyon”, “Dam”, “East”) edge.
Pingback: Graph traversal, part two | Fabulous adventures in coding
“public readonly static ImmutableDirectedGraph Empty = new ImmutableDirectedGraph( ImmutableDictionary<N, ImmutableDictionary>.Empty);”
Or, for readable code, use F# 🙂
Seriously, for this series (and the previous) it was tempting. Languages like F# make this sort of thing much more concise. That said, this is a pretty small implementation detail.
Taking a stab at removal – including edges pointing to the removed node…
public ImmutableDirectedGraph RemoveNode(N node)
{
if (graph.ContainsKey(node) == false)
return this;
var query = graph
//Only the nodes with an edge to the node to be removed
.Where(kvp => kvp.Value.ContainsValue(node))
//select both the start node and the selection of edges where
//the node to be removed is actually the destination
.Select(kvp => new
{
kvp.Key,
Value = kvp.Value
//where within nodes the value (node) is the node to remove
.Where(kvp2 => kvp2.Value.Equals(node))
//Get the entire KeyValuePair so we know
//which edge (key) to pair with the start node (prior query)
.Select(kvp2 => kvp2)
});
var retVal = new ImmutableDirectedGraph(graph.Remove(node));
foreach (var startNode in query.Select(a => a.Key))
{
foreach (var edge in graph[startNode]
.Where(kvp => kvp.Value.Equals(node))
.Select(kvp => kvp.Key))
{
retVal = retVal.RemoveEdge(startNode, edge);
}
}
return retVal;
}
and RemoveEdge is trivial…
public ImmutableDirectedGraph RemoveEdge(N start, E edge)
{
if ((graph.ContainsKey(start) && graph[start]
.ContainsKey(edge)) == false)
return this;
return new ImmutableDirectedGraph(
graph.SetItem(start, graph[start]
.Remove(edge))
);
}
Keeping track of the key relationship to the value in the nested dictionary was challenging and lead to what feels like a naive implementation. Would like see more clever approaches.
Pingback: Producing combinations, part five | Fabulous adventures in coding | https://ericlippert.com/2014/10/30/graph-traversal-part-one/ | CC-MAIN-2017-30 | refinedweb | 2,583 | 71.34 |
Making human readable cpp using coder
2 views (last 30 days)
Show older comments
Answered: Benjamin Thompson on 7 Mar 2022
Hi,
I want to use Coder to make some C++ source code, and there are a couple of things that are important to preserve that I'm struggling to acheive.
Basically, it's essential that it keeps the variable names and so on, so that it makes sense in the context of everything else that happens around this source code for suture readers. But, Coder insists on being 'helpful' and dumping these contexts.
Here is a very basic toy example to start with......
function [out1, out2] = myFun(params, foo, bar)
% Vital we keep these variable names by way of explanation
carbon = params(1);
nitrogen = params(2);
oxygen = params(3);
hydrogen = params(4);
% A comment here will explain the calculation
myPar1 = (carbon + hydrogen) * (oxygen - foo);
myPar2 = foo * bar;
% Another comment to keep here....
row1 = [myPar1 myPar2];
row2 = [foo bar];
% Making the outputs is alse expained by variable names...
out1 = [row1 ; row2];
out2 = sin(myPar1) * nitrogen;
end
Now, this is a meaningless snippet, but the point is that it's essential that the reader is able to know that it's 'carbon' etc in order to follow what's going on, but if I run this through coder I end up with....
// myFun.cpp
//
// Code generation for function 'myFun'
//
// Include files
#include "myFun.h"
#include <cmath>
// Function Definitions
void myFun(const double params[4], double foo, double bar, double out1[2][2],
double *out2)
{
double myPar1;
// Vital we keep these variable names by way of explanation
// A comment here will explain the calculation
myPar1 = (params[0] + params[3]) * (params[2] - foo);
// Another comment to keep here....
// Making the outputs is alse expained by variable names...
out1[0][0] = myPar1;
out1[1][0] = foo * bar;
out1[0][1] = foo;
out1[1][1] = bar;
*out2 = std::sin(myPar1) * params[1];
}
// End of code generation (myFun.cpp)
... so all the context has dissapeared. Obviously for this simple example I could just hard code the thing. But in th real code this behaviour makes it impoissible to follow, and frankly next to useless.
I'm running coder like this.....
cfg = coder.config('lib');
cfg.GenerateReport = true;
cfg.ReportPotentialDifferences = false;
cfg.GenCodeOnly = true;
cfg.InlineBetweenUserFunctions = 'Readability';
cfg.InlineBetweenMathWorksFunctions = 'Readability';
cfg.InlineBetweenUserAndMathWorksFunctions = 'Readability';
cfg.TargetLang = 'c++';
cfg.PreserveArrayDimensions = true;
cfg.PreserveVariableNames = 'All';
ARGS = cell(1,1);
ARGS{1} = cell(3,1);
ARGS{1}{1} = coder.typeof(0,[4 1],[0 0]);
ARGS{1}{2} = coder.typeof(0);
ARGS{1}{3} = coder.typeof(0);
codegen -config cfg myFun -args ARGS{1}
This is a very basic example, but in the real thing losing these variable names makes things pretty much unfollowable. Preserving the white spacing would also be incredibly useful.
What am I missing? How can I get Coder to keep my variable names, and as much of the structure of the original Matlab as possible?
Cheers,
Arwel
Answers (1)
Benjamin Thompson on 7 Mar 2022
Try setting cfg.BuildConfiguration to 'Debug' or 'Faster Builds'. The tool is seeing local variables that it can remove to reduce memory usage by your code.
See Also
Categories
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting! | https://au.mathworks.com/matlabcentral/answers/1663879-making-human-readable-cpp-using-coder?s_tid=prof_contriblnk | CC-MAIN-2022-40 | refinedweb | 547 | 57.16 |
Webpack v2 Quick Start
With Webpack 2.x out of the release client phase, we're here with a quick start guide to get your development project running. This guide will guide you through a minimal setup where you will configure
webpack and it's
webpack-dev-sever. The configuration will also process your CSS and transpile ES6 code. The only prerequisites are that you have Node installed (You can download it here) and that you have your favorite terminal and editor apps handy. Let's get started!
To see the final product, checkout this github repository:
Project initialization
To start off create a directory for the project, run
npm init and install
webpack. The init command will create a
package.json file with the project name set to the name of the directory (
demo in our case). The
--save-dev option in the install command will list
webpack as a development dependency inside
package.json. Go ahead and run each of the following commands in succession:
mkdir demo && cd demo npm init -y npm install --save-dev webpack
If you'll be commiting this project to a git repostitory, consider creating a basic .gitignore file to prevent you from unintentionally commiting unnecessary files. At a minimum, you'll want to exclude the
node_modules directory. You could also ignore the
build/ directory:
echo "node_modules/" > .gitignore
Next we'll create a few initial files and an
app directory:
mkdir app touch app/index.js index.html webpack.config.js
Paste the following markup into
index.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Webpack Demo</title> </head> <body> <h1>Demo</h1> <script src="build/bundle.js"></script> </body> </html>
The one item of note in the markup above is the script tag. You may have noticed that we haven't created any such file. This is because we'll be configuring Webpack to bundle all of our code and create that file.
Paste the following code into
app/index.js. Upon execution, it'll append a new DIV tag to the HTML document.
var element = document.createElement('div'); element.innerHTML = "Welcome to the Bendywork's webpack demo!"; document.body.appendChild(element);
And finally, paste the following configuration into
webpack.config.js:
var path = require('path'); module.exports = { entry: './app/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'build'), publicPath: "build/" } };
In the configuration above,
entry identifies what file is going to be serving as the main JavaScript code. This entry point, and all of it's dependencies, will be bundled into the file specified by the
output section.
We can now trigger a webpack build using the following:
./node_modules/.bin/webpack
This will automatically pickup our webpack configuration and is the same as calling
./node_modules/.bin/webpack --config webpack.config.js. If the build is successful, you'll see
./build/bundle.js.
That's it! You now have a minimally configured webpack installation. You can use ES6 style import/export statements and Webpack will manage your code dependencies and bundle them together.
Development Server
Wait! You're still here? Since you're still reading, I suppose you want to do more than just bundle together your source code.
Our next step is to install webpack's dev server:
npm install --save-dev webpack-dev-server
The
webpack-dev-server package is a preconfigured development server that utilizes Express and
webpack-dev-middleware. This provides you with the ability to preview your project in a browser while your code live-reloads in the background. One caveat though: this should be used during development only.
To use the development server to open the page, execute the following:
./node_modules/.bin/webpack-dev-server --open
NPM Scripts
Now, remembering all of these webpack commands can get unwieldly. That's where NPM scripts come in to simplify things for us. Add the
scripts lines below to your
package.json file.
{ "name": "demo_test", "version": "1.0.0", ... "scripts": { "build": "webpack", "watch": "webpack --watch", "serve": "webpack-dev-server --open" } }
To trigger a one-off build of your project, you can execute this:
npm run build
To trigger a build and instruct webpack to watch for file changes, execute:
npm run watch
To trigger the development server and have your browser live-reload upon file changes, execute:
npm run serve
CSS Loading
Webpack can do more than just load and bundle our JavaScript code. Loaders, provide preprocessing functionality for various file types. Plugins are also available and provide more flexible functionality. The UglifyJS Webpack Plugin, for example, allows you to fine tune the way in which your code is compressed.
We are, however, focusing on style-loader and css-loader.
style-loader will add CSS to the DOM by injecting a style tag.
css-loader enables the ability to specify css imports, or dependencies, from within you application. If you were to do all of this inline, every stylesheet would be imported like this:
import css from 'style-loader!css-loader!./stylesheet.css';
By chaining the loaders together, css-loader will load your stylesheet, and style-loader will inject it into the DOM of your web page. Instead of going this route, we are going to modify
webpack.config.js to use the loaders anytime a css file is imported.
First, paste the following inside
./app/style.css:
body { font-family: Georgia; color: #ffffff; } .carbon {; }
Then add the
carbon class to the body tag of
index.html:
<body class='carbon'>
Install the style and css loaders:
npm install --save-dev css-loader style-loader
Add the following line to the top of the
./app/index.js:
import './style.css';
Finally, add the following module rules to
webpack.config.js:
module.exports = { ... module: { rules: [ { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] } ] } };
npm run serve
The configuration above works, but as your project gets larger, you may begin to notice that your stylesheets don't get applied until the page finishes loading your bundle. That's because everything is being served up as a single file, and until that file downloads, none of it is available to the browser.
Webpack provides the ability to perform code-splitting. You might use this to split vendor and library code apart from your application bundle. In our case, we're going to use this feature, and a handy plugin, to extract our stylesheet and create a separate css bundle.
We'll be using the Extract Text Plugin to extract the css for bundling. One thing to note though, the usage below relies on version 2.x of this plugin. As of this writing, only v1.0.1 is available for installation through NPM. So for now, we'll install the latest release available on github:
npm install webpack-contrib/extract-text-webpack-plugin --save-dev
However, in the future you should be able to install the plugin using
$ npm install extract-text-webpack-plugin --save-dev
Next, add the following
link tag to the
head tag inside index.html
<link rel="stylesheet" href="build/styles.css">
Now we'll start modifying the webpack.config.js file. The first step is to load the plugin. Add the following line near the top of the file (above the
module.exports = { line):
const ExtractTextPlugin = require("extract-text-webpack-plugin");
After you've done that, modify the previous css rule and, instead, use the plugin to extract the css:
module: { rules: [ { test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: "style-loader", use: "css-loader" }) } ] }, plugins: [ new ExtractTextPlugin("styles.css"), ]
You can check your results again by running:
npm run serve
Shimming jQuery into the Project
Webpack understand many Javascript module formats, but sometimes you just need to add a third-party library that expects to have the global context available. To accomplish this, webpack provide the ability to 'shim' the dependency into the project. That is, webpack provides an abstraction layer so that you can export the global variables created by the library.
For our project, we're going to add jQuery:
npm install --save jquery
Now, the npm jQuery package defaults to using the minified distributable version of the library. Webpack, however, prefers to have access to the source in order to provide better optimization of your final bundled code. To accomplish this, we'll need to add an alias to the wepback config:
module.exports = { ... resolve: { alias: { jquery: "jquery/src/jquery" } } };
We'll also want to automatically load jQuery whenever one of our source modules makes use of the
$ or
jQuery global variables:
var webpack = require('webpack'); module.exports = { ... plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }) ] };
ES6 with Babel
Our final Webpack configuration step is to install a loader for Babel. Why you might ask? It allows you to make use of newer ECMAScript language specifications in your source code. Babel then transpiles your code back into ES5, which supports a wider range of browsers.
Install babel-loader:
npm install --save-dev babel-loader babel-core
Install the babel
latest preset:
npm install --save-dev babel-preset-latest
Note: as of this writing, the
latest preset includes presets for 2017, 2016, and 2015
Create a
.babelrc file to load the preset:
echo '{ "presets": ["latest"] }' > .babelrc
Game Time!
Now, lets do something fun and put together a simple game. For the purpose of our demonstration, we'll create a simple tic-tac-toe game.
First, install another dependency: lodash
npm install --save lodash
Add ./app/board.js
Add ./app/player.js
Replace ./app/index.js
Replace ./app/style.css
Replace ./index.html
Then serve it up:
npm run serve
For more information concerning Webpack v2, check out their guides here: | https://bendyworks.com/blog/webpack-v2-quick-start | CC-MAIN-2022-40 | refinedweb | 1,597 | 57.27 |
Adobe Flex 4 provides a lot of new features including a component architecture, CSS improvements, MX backward compatibility, new state mechanisms, and a new graphic markup language called FXG. Along with the Flex 4 SDK, Adobe Flash Builder 4 has improvements to help with developing with Flex 4. Migrating Flex 3 applications to Flex 4 can seem like a large task.
In this article I take a real world application and walk you through a real world example of transitioning from Flex 3 to Flex 4. The example provided covers all the major areas of Flex application including CSS, Spark components, customs skins, embedding fonts, and more.
The article provides both the source code for the original Flex 3 application and the converted Flex 4 application for your convenience.
Requirements
In order to make the most of this article, you need the following software and files:
Adobe Flash Builder 4
Adobe Flex 4.1
Sample files:
- MicrophoneExamplesFlex3.zip (ZIP, 405 KB)
- MicrophoneExamplesFlex4.fxp.zip (ZIP, 284 KB)
Prerequisite knowledge
You are familiar with Adobe Flex
The Project and Flex 4 SDK
First thing is to open the Flex 3 project and change settings to point to Flex 4. I’ll walk through the changes needed to get it compiling again and take a look at what visual differences are without using the mx compatibility mode in Flex 4.
Opening the Project
Pull down the MicrophoneExamplesFlex3.zip file and unzip it to a folder of your choosing. Then in Flash Builder 4 follow these steps:
- Select File -> Import -> Flash Builder Project… from the menu bar.
- Select the Project Folder radio button
- Click on the Browse… button and navigate to the MicrophoneExamplesFlex3 folder that you unzipped above.
The original project was using a Flex 3.2 SDK with AIR 2.0 beta overlaid on top of it. What you should see is an error saying “Unknown Flex SDK: ….”. Downloading the Flex 4.1 SDK will include AIR 2.0 and can be obtained at:
Changing the Project’s Flex Compiler’s Flex SDK Version will solve the issue. This is done by opening the project properties panel. Select the Flex Compiler view and then in the Flex SDK Version group select the “Use default SDK (currently Flex 4…)”.
NOTE: If you are using a different Flex 4 and AIR 2.0 SDK or Flex 4.1 version use the Configure Flex SDKs and select the appropriate SDK.
Since the original application is using a beta version of AIR 2.0 the namespace in the application descriptor file needs to updated. Open up MicrophoneExamples-app.xml file and change 2.0beta2 to 2.0. Now that the application is compiling without any errors fire it up and take a look at what it looks like. Although it compiles with no errors the application doesn't look much like the original. You can see the difference below.
Original:
Flex 4 No Code Changes:
This is not quite the same as the original, this is because of the Flex 4 new default CSS and theme values. If you want the Flex 4 compiler to have strict compatibility with the old MX components then there are some compiler options to set these flags on mxmlc.
Namespace Changes
The first thing to do in the migration process is to make namespace changes. The new namespaces changes separate the old mx namespace into three areas: fx, s, and mx. The new areas are mxml language and constructs (fx), Spark components (s), and old MX (aka Halo) components (mx).
In the main, MicrophoneExamples.mxml, application file I removed the old:
xmlns:mx=""
and replaced it with:
xmlns:fx=""
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
Changing the old namespace to the new halo and spark name separation yields two errors. The fix is to change the mx:Style and mx:Script to fx:Style and fx:Script.
With the addition of namespaces covering different sets of components there is the possibility of components having the same name, ie: s:Button and mx:Button. Namespaces purpose is to clearly define the different components package. This is important not only for MXML but for CSS files and styling. With Flex 4 CSS supports namespacing. For the microphone application I opened up the embed_assets/stylesheet_common.css file and added the spark and mx namespaces to the top of the file as shown below:
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
With the new namespaces I had to add the namespace to the components, which I did by adding mx| in front of WindowedApplication, Window, ComboBox, HSlider, RadioButton, and Application. the rest of the styles are specific style names. At this point I also took care of the warning that theme-color is not used and changed it to chrome-color, the changes looked like this:
mx|WindowedApplication,
mx|Window
{
/* make app window transparent */
font-family: "Myriad Web";
font-size: 12;
font-anti-alias-type:advanced;
disabled-overlay-alpha: 0;
chrome-color: #444444;
color: #AAAAAA;
text-roll-over-color: #AAAAAA;
text-selected-color: #AAAAAA;
}
Warning Cleanup
I wanted to clean up the all the Flash Builder 4 warning. I went ahead and made some code changes that used Application.application in a binding scenario in the InformationPanel.mxml. The usage of Application.application is deprecated and the new way is to use FlexGlobals.topLevelApplication, but the new FlexGlobal can't be bound. This led to a change in the InformationPanel.mxml to have a public bindable property that I then bound to in MicrophoneExamples.mxml. Here is the two code segment changes.
InformationPanel.mxml code section:
<mx:Script>
<![CDATA[
[Bindable]
public var applicationVersion:String = "";
]]>
</mx:Script>
<mx:Label
MicrophoneExamples.mxml code section:
<view:InformationPanel
Starting with the Application File
The main application file includes a lot of components that make up the application. In this section, the old Halo components are changed to the equivalent Spark components exploring the new way to layout and style your application.
The Application and its Background
First one up is the main WindowedApplication class, changing mx:WindowedApplication to s:WindowedApplication. Doing so there are a few properties that need to be changed. Four properties where removed: layout, showFlexChrome, horizontalScrollPolicy, and verticalScrollPolicy. The showStatusBar="false" property was added to remove the Flex status bar chrome, which is turned on by default in the Spark WindowedApplication component. The layout property is not type String but type LayoutBase now, and usually is defined by in MXML now. The Spark WindowedApplication’s default layout is equivalent to the old “absolute” layout property. Scrolling in Spark is handled mostly in the Skin and for this component this is the case. Also by default the Spark WindowedApplication does not try and draw any chrome for the application, and assumes the developer will draw chrome if needed.
In the original code a custom background was created with a VBox and css style of mainBox. Since all mainBox style provided was a grey background with the width and height of the application I went ahead and removed the VBox component from the main application and removed the mainBox style from the css file. Then added the backgroundColor="0x666666" property on to the main application class for the same affect.
Layout and Styling Dilemma
In the Halo days both layout and the ability to style (padding, background colors, etc…) where mixed together in one component even if you didn’t use all the features. As the migration of the microphone examples application progresses there are places where you can approach how to take care of layout and styling different. First I started with the next migration step by changing the HBox. The HBox doesn't have a direct one to one component match, especially since the titleBox style class defines padding, border, and background values in the css file. In Spark the Group classes are meant to be lightweight layout and container classes but do not provide any skinning. For skinning or any display components it should be a class that extends SkinnableComponent. Now you can use SkinnableContainer to both display visual content and layout elements within the container. This leads to a lot of options and a bit of confusion.
For this migration since I do have visual content and layout that the HBox was providing I'll go ahead and use the SkinnableContainer class. First I replaced mx:HBox with s:SkinnableContainer, then I created a skinClass called controls.skins.TopBarSkin. In this skin I create the background and bottom border by drawing a Rect and Line with the values from the css stylesheet for titleBox. The SkinnableContainer looks for a skin part called contentGroup, which I turn into a HGroup with the padding values and layout values I used on the HBox and titleBox css. Here is what the new controls.skins.TopBarSkin looks like:
<>
Inside the newly changed SkinnableContainer the first container is a Canvas component that contains the app mic icon and some labels. Its purpose is just to layout components with some specific y values. This calls for mx:Canvas becoming s:Group.
The mx:Image is not loading dynamic image so it can be changed to s:BitmapImage, but with this change you have to use the @Embed code in the source property for s:BitmapImage to work. The mx:Image class allows for both dynamic and static loading of images, but using s:BitmapImage will be smaller class size and faster.
The mx:Label's change to s:Label, but there are differences with on the embedding of fonts in the css to be changed. Flex 4 spark controls use the new Flash Player 10 Text Layout Framework (TLF) to display text, its newer and provides a bunch of features like bidirectional text. But it works with embedded fonts differently. In the css file where @font-face is embedding the different fonts a property of embedAsCFF: true; has to be added, then in the specific style classes that you want to force to use the embedded font you add fontLookup: embeddedCFF;. Here is the changes needed for the stylesheet_common.css css file:
puts a
background color by default so I made it invisible by setting adding a s|Label css style
with background-alpha: 0; in the css file. I also had to add y=”6” and add two
pixels to the x values of the label components to make the text line
up again because of the TLF’s default positioning.
The second group of components in the TopBar are the buttons that resides on the right. These buttons include the navigation left/right between examples, help button and close button. The container class mx:HBox does not have any visual content so it is changed to s:HGroup to preserve the horizontal layout. The horizontalGap property needs to change to just gap but the rest does not need changing.
There are some changes to Spark buttons that are different in the MX controls. You'll see the btnInfo button is set to toggle="true", well by default the Spark button does not implement the toggle functionality. There is a Spark ToggleButton that handles the button's with a selection states. The next big issue is by default Spark button's do not support up, down, over, and disabled skins through styles. But this is not hard to fix. So we basically want to use images for button states and throw away all the drawing of a normal button skin, which is what Flex 4 skinning is all about.
First I changed the mx:Button to s:Button and s:ToggleButton for btnInfo. Then I created a new skin called controls.skins.IconButtonSkin. In the new Skin file I listen for state changes and then using the state value set the icon based on style lookup, the styles are those of the old mx:Button so I don't have to go change the css code. Note it also checks to see if the style is present to make sure it is not trying to set a invalid image source. The IconButtonSkin doesn't contain any drawing code or label but just a s:BitmapImage. The BitmapImage's source property then gets set with values set in the css styles. Here is the skin file:
<>
Since this application has no normal buttons I can go ahead and in the css file set the default skin for s|Button and s|ToggleButton to the newly created IconButtonSkin. Here is the css addition:
s|Button, s|ToggleButton
{
skin-class: ClassReference("controls.skins.IconButtonSkin");
}
Now all the specific button css class styles for up-skin, over-skin, etc... will work with the new s|Button and s|ToggleButton skin file.
From <mx:ViewStack /> to Flex 4 States
Flex 4 overhauled how states work in mxml. This new approach is a lot easier then the old method of all state logic being inside the state mxml blocks. The new states mechanism is a decent approach to replace most of the simple cases of mx|ViewStack functionality.
Spark ViewStack Options
There is no Spark ViewStack direct component replacement but if you want the old selecetedChild property and similiar syntax you can find people that have created a ViewStack Flex 4 Spark component on the web. I choose to use the new state method, in the main applications mxml I added three states for the three views declared in the ViewStack. The three states are called: sampleMic, pitchDetection, and info.
NOTE: The <s:states> property has to be before any content components or you will get a compiler error shown below.
Child elements of 'WindowedApplication' serving as the default property value for 'mxmlContentFactory' must be contiguous. MicrophoneExamples.mxml /microphone/src line 57 Flex Problem
Next I removed the mx:ViewStack and added the includedIn property with the respective state name for each custom component that was in the mx:ViewStack. Here is what the code looks like, MicrophoneExamples.mxml:
<?xml version="1.0" encoding="utf-8"?>
">
<s:states>
<s:State
<s:State
<s:State
</s:states>
<!-- A bunch of code from previous Part 1 and Part 2 migration -->
}" />
<view:InputDeviceSelector
</s:WindowedApplication>
This will compile with some errors in MicrophoneExamplesSource.as file relating to the vsMain.selectedChild = X (X is the id/instance of the custom component), which is then changed to currentState = Y (Y is the string name of the new states). The currentState property when set with a new value fires off events that are used for state transitions. Here is the code snippet change made in MicrophoneExamplesSource.as:
if (view != "info")
{
btnInfo.selected = false;
}
else
{
viewName = "(Application Info)";
currentState = "info";
}
if (view == "mic")
{
viewName = "(Record & Playback)";
currentState = "sampleMic";
}
if (view == "tuner")
{
viewName = "(Pitch Detection)";
currentState = "pitchDetection";
}
Adding a Fade Transition
Transitions are expected use case within Flex 4’s new approach to states. They allow you to easily apply affects to state transitions. For the microphone example I added a Fade state transition for each change in state. This is what it looks like in new Flex 4 transitions approach (added to the MicrophoneExamples.mxml at the top of the file by the <s:states /> declaration):
>
You’ll see a txtExample in with each custom view. This is the label in the top bar that changes with each view. The label didn’t have an id so add id=”txtExample” to the Label in the application with text=”{viewName}”. The finishes up the ViewStack migration piece.
Finishing with Custom View Files
The last pieces of the application to migrate to Flex 4 are the custom component views for the two microphone examples and information panel. Each component migration will seem like a repeat of steps covered above but this will show some reuse of code and skins.
Converting Custom View SampleMicPanel.mxml
Opening up SampleMicPanel.mxml, I started by adding the three new namespaces: fx, mx, and s. I changed the main component from mx:Canvas to s:Group since there was no styling on mx:Canvas. The mx:Script block was changed to fx:Script because of the new namespace change. The first child mx:Canvas component has styleName="controlsBox" which I removed from the css and provided a custom skin to take care of the controlsBox's background and border style values. I removed the styleName property and then change mx:Canvas to mx:SkinnableContainer with skinClass="controls.skins.ControlsBoxSkin". The ControlsBoxSkin will be reused later in the other custom components here is what it looks like:
<>
The second mx:Canvas with id="spectrum" is a place holder for the wave form to be dynamically drawn on. I changed mx:Canvas to s:Group which extends Sprite which can be drawn on programmatically.
For the TOP CONTROLS section of code I changed mx:HBox to s:HGroup, mx:Button to s:Button and s:ToggleButton (removing the toggle property), and mx:Label to s:Label. The s:Label padding is not the same as mx:Label and changed padding-top: 2px to padding-top: 6px. I also set the font-size of footerPTText to 12. I changed mx:Spacer to s:Group with width="100%”. Here is the code:
<!-->
For the TIMING UI section of code I changed mx:HBox to s:HGroup and the property horizontalGap to gap. I changed mx:Spacer to s:Group with width="100%”. I moved down the s:HGroup down four pixels because of padding differences. Here is the code:
<!—>
For the PLAY CONTROLS section of code I changed mx:HBox to s:HGroup, mx:Button to s:ToggleButton (removing the toggle property), all mx:Canvas to s:Group, mx:HSlider to s:HSlider. The playHeadCanvas and playHead components had background colors set onto the mx:Canvas, these css styles where removed and drawn into the s:Group's directly with s:Rect. Drawing directly into the Spark Group component is a departure then the normal skinning practice. I include it here to show of other methods of doing the same thing. This approach is less robust but not necessarily less valid.
The s:HSlider handles the DataTip styling through skins and not styles now, so I had to create a custom skin and added it to the component as skinClass="controls.skins.MyHSliderSkin". I created a copy of the Spark HSlider skin and just tweaked the DataTip section to be a rounded dark rectangle with light grey text, code is found in MyHSliderSkin.mxml. There was no equivalent in the css file but the mx:HSlider would use global styles in setting the DataTip style so this had to be changed manually in the skin for the s:HSlider. Here is the code DataTip section>
Here is the code with all the changes for the PLAY CONTROLS section of the view:
<!-->
NOTE: The HSlider, RadioButton and ComboBox css styling values use custom images for icon style values. As we saw with the s:Button in the previous Parts of this series, I had to do this through skins not styles (or a custom skin that reads styles). The default skin's for the above Spark components is the look and feel I am looking for, although slightly different, so I didn't create custom skins for those components. The approach is like that of the controls.skins.IconButtonSkin but is a little more complex because of nested skins.
For the rest of the code the same type of changes where applied for the various components. The one thing to point out is that the mx:ComboBox to s:ComboBox the dataProvider doesn't take a value of Array but has to be an IList. I wrapped the Array into an ArrayList that implements IList. Make sure to import the ArrayList at the top of the Script block,>
Converting Custom View PitchDetection
This is like the other custom component by adding namespaces and changing all the MX components to their Spark equivalents. The main mx:Canvas was changed to s:Group and the mx:Canvas with styleName="controlsBox" was changed to s:SkinnableContainer with a value of skinClass="controls.skins.ControlsBoxSkin", like in the previous SampleMicPanel component migration. Chalk one up for reuse of skins. Here is code of just the content section of the PitchDetection:
" />
I removed the styleName="mainPaddedBox" from the PitchDetection component in the MicrophoneExamples.mxml file as it was not needed for this component and those styles will not apply to the s:Group view’s top component.I removed the styleName="mainPaddedBox" from the PitchDetection component in the MicrophoneExamples.mxml file as it was not needed for this component and those styles will not apply to the s:Group view’s top component.
Converting Custom View InformationPanel
This component inherits a mx:VBox which I changed to s:VGroup, as well as changed verticalGap to gap. I removed the styleName="mainPaddedBox" from the InformationPanel component in the MicrophoneExamples.mxml file and from the main css file. This is because the Spark component does not do padding through styles but as properties on the s:VGroup component. The old padding style values where applied as properties (paddingLeft="10" paddingTop="8" paddingRight="10") on the InformationPanel declared in the MicrophoneExamples.mxml file.
Changing the mx:Label to s:Label again messed with padding and size of the text, I had to change css infoText to font-size of 12. The mx:HRule is basically a line so I removed this component and added s:Line with weight of 2 for the thickness. Here is the code changes:
<>
Converting Custom View InputDeviceSelector
This custom component makes use of the controlsBox style, which means I can reuse the controls.skins.ControlsBoxSkin in connection with s:SkinnableContainer to replace the mx:Canvas. I made namespace changes of fx:Script, s:Label, and s:VGroup changes like before. The mx:ButtonRadioGroup change to s:ButtonRadioGroup requires that it is placed into a new fx:Declarations code block to keep non-visual declarations separate. Then when I compiled it comes back with an error about using addElement instead of addChild. Spark container components have to implement the IVisualElement interface and use the new addElement method. Changing vbButtons.addChild to vbButtons.addElement fixes the compiler error and its all ready." />
Run the application an enjoy, that’s it for the migration from Flex 3 to Flex 4.
Where to go from here
Applications are never simply straightforward logic, and migrating applications is not a simple task. Once huge plus about the Flex 3 to Flex 4 migration is the ability to mix and match MX and Spark components allowing for conversion of an application to be done in pieces over a length of time. For a deep dive into the specific Flex 3 and Flex 4 component differences take a look the Adobe Developer Center article, “Differences between Flex 3 and Flex 4”. And on another migration note, check out how to move your existing Flex projects from Flex Builder 3 to Flash Builder 4 here.
About the author
Renaun Erickson is a Flash Platform Evangelist at Adobe Systems. Renaun has a wide range of experience with the Flash Platform. Renaun has worked on projects using technologies including ActionScript, Flex, AIR, PHP, ColdFusion, video, audio, logging, SIP/VoIP, casual games, and mobile. Renaun can be found at his blog and at twitter @renaun. When he's not programming, Renaun enjoys playing games, the outdoors, archeology, driving a Jeep, and spending time with his family.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }} | https://dzone.com/articles/transition-flex3-to-flex4 | CC-MAIN-2016-22 | refinedweb | 3,939 | 62.88 |
Now I’m quite lucky to be involved in designing the repo structure from scratch at work.
Sharing some interesting insights here:
1) Coding a common library and sharing that across projects.
Now this doesn’t sound too complicated (I mean, who doesn’t do this right?) but it ain’t that easy after all when there are some constraints, namely: my main.py is not at the root directory level. if it were, things will be really simple - just import! But because we need each project to be self-contained within each of its folder, AND we didn’t want to hard code the path in (other teams may use this in the future) things get complicated (or so i thought).
This is my repo structure.
python_scripts ├── lib │ └── talk.py # def sayhello(x): return(f'Hi, {x}!') │ ├── proj_1 │ └── main.py # from lib.talk import sayhello │ # print(sayhello('Person A') │ └── proj_2 # import lib.talk
if you just do this, it throws an error, ModuleNotFoundError.
the below is a fairly good solution.
import sys, os path = os.path.abspath('../') # if main.py is two levels in, use '../..' instead if path not in sys.path: sys.path.append(path) # Now import import lib
caveats:
- i need to include this at the top of every .py file i have that imports from the common library. if only there was a neater way…
- i need to run it at the project folder level (which is fine for me, but of course if there is an option to run it at any level that would be the best lol - i’m greedy i know)
i tried configuring
__init__.py but doesn’t seem to work for me.
changing the PYTHONPATH apparently works but it becomes difficult when another team (of non-developers) want to run the program and they aren’t too savvy with PYTHONPATH and stuff…
well, i’ll have to take this as the solution in the meantime.
on top of this, pytest becomes complicated.
This is my repo structure.
python_scripts ├── lib │ └── talk.py # def sayhello(x): return(f'Hi, {x}!') │ ├── proj_1 │ └── main.py # from lib.talk import sayhello │ # print(sayhello('Person A') │ ├── proj_2 │ └── main.py # from lib.talk import sayhello │ # print(sayhello('Person B') │ ├── tests │ ├── lib │ │ └── test_talk.py # from lib.talk import sayhello │ └── proj_1 # def test_sayhello(x): │ └── test_main.py # assert test_sayhello('Person A') == 'Hi, Person A!' │ # test_sayhello() │ └── test_setup.py
now if i just run test_setup, it throws an error - even if i include the snippet within the tests. this is because i am running pytest from the root directory i believe… in any case, below is the solution:
# place this code in test_setup.py import sys, os path = os.path.abspath('') if path not in sys.path: sys.path.append(path)
when pytest is run from the top-level directory,
test_setup.py is run since it begins with “test”.
the code appends the current directory name of
test_setup.py (which is the root directory in this case) to the system path within the test environment.
in fact, in this way all my test files will not need to include the earlier snippet when import from the lib.
i tried to do the same for the project folders with
__init__.py to no avail… i think it’s because of where i’m calling the files from. oh wells, it don’t matter.
caveat:
- somehow i can’t run my tests individually using this T.T it only works if i run all of them… (i know
pytest test_setup.py test\lib\test_sayhello.pyis supposed to work but… it doesn’t T.T and i don’t know why!!)
on a side note, i made the foolish mistake of not naming my test functions with a ‘test_’ prefix and my tests didn’t run for the longest time.
be sure that even within your test files, you name your functions with a ‘test_’ prefix!!
on another note, i just learnt what configuration files are (and the difference in using json and YAML for it). basically, it replaces your argparse and stuff.
also, YAML is used for readability and you can comment on it. json is for greater ease of use across languages (or so i heard).
for logging, just
import logger | https://www.yinglinglow.com/blog/2018/04/15/creating-new-repo-structure | CC-MAIN-2021-49 | refinedweb | 708 | 76.82 |
Big Data Hadoop Distributed File System- ( PART 2)
Hadoop Distributed File System
The Hadoop Distributed File System (HDFS) is the primary data storage system used by Hadoop application. It is a distributed file system that provides access to data across Hadoop clusters. It manages and supports analysis of very huge volume of Big Data.
Characteristics of HDFS
1. Fault-Tolerant - HDFS is highly fault-tolerant. HDFS divides the data into blocks after that create multiple copies of the block (default 3) and distribute it across the cluster. So, when any machine in the cluster goes down client then also can access their data from the different machine which contains the copy of that data block.
2. High Availability - HDFS is a highly available file system. HDFS replicates the data present among the nodes in the Hadoop cluster by creating the replica of the blocks on the other slave's machine present in the system. So, at the time of the failure of a node, a user can still access their data from the different nodes as duplicate copies of blocks are present on the other nodes in the HDFS cluster.
3. Scalability - HDFS stores data on multiple nodes in the cluster, when requires we can scale the cluster. There are two scalability mechanism- Vertical and Horizontal Scaling. Horizontal Scaling is preferred over Vertical Scaling as we can scale the cluster from 10s of nodes to 100s of nodes without any downtime.
HDFS Architecture
It is a master and slave architecture.
The main components of HDFS are-
1. NameNode - The NameNode server is the main component of the HDFS cluster. It maintains and executes file system namespace operations such as opening, closing, and renaming of files and directories that are present in HDFS.
The Namenode maintains two files:
- A transaction log called an Edit Log
- A namespace image called FsImage.
2. Secondary NameNode - Secondary NameNode is responsible for maintaining the backup of the NameNode. It maintains the edit log and namespace image information in sync with Namenode.
3. File System - HDFS exposes a file system namespace and allows user data to be stored in files.
4. MetaData - HDFS metadata is the structure of HDFS directories and files in a tree. It includes attributes of directories and files, such as ownership, permissions, quotas, and replication factor.
5. DataNode - Datanode is responsible for storing the actual data in HDFS. It also retrieves the blocks when asked by clients or the NameNode.
Data Block Split
It is an important process of HDFS architecture. Each file is split into one or more blocks and blocks are replicated and stored in the DataNodes. Block size of each block is 128 MB (default).
Replication and Rack Awareness in Hadoop
Rack is a collection of machines that are physically located in a single place/datacenter and connected through a network.
The process of replicating data is very critical to ensure the reliability of HDFS. By default, it is replicated thrice. The following replication topology is used by the Hadoop:
- The first replica is placed on the same node as that of the client.
- The second replica is placed on a different rack from that of the first replica.
- The third replica is placed on the same rack as that of the second one but on a different node.
Anatomy of File Write in Hadoop
- Before the client start writing data to HDFS it grabs an instance of an object of Distributed File System (HDFS)
- DistributedFileSystem makes an RPC call to the NameNode to create a new file in the filesystem’s namespace. TheDistributedFileSystem returns an FSDataOutputStream for the client to start writing data to.
- As the client writes data DFSOutputStream split it into packets and write it to its internal queue i.e. data queue and also maintains an acknowledgment queue, which is consumed by the DataStreamer. The DataStreamer streams the packets to the first DataNode in the pipeline.
- The list of DataNodes forms a pipeline and assuming a replication factor of three, so there will be three nodes in the pipeline.
- When the client has finished writing data, it calls close() on the stream.
Anatomy of File Read in Hadoop
- The client opens the file it wishes to read by calling open() on the FileSystem object, which for HDFS is an instance of DistributedFileSystem.
- DistributedFileSystem calls the Namenode, using RPC (Remote Procedure Call), to determine the locations of the blocks for the first few blocks of the file. For each block, the NameNode returns the addresses of all the DataNodes that have a copy of that block.
- Client calls read() on the stream. DFSInputStream which has stored the DataNode addresses then connects to the and then finds the best DataNode for the next block.
- Blocks are read in order. When the client has finished reading, it calls close() on the FSDataInputStream.
Conclusion
There are many advantages of learning this technology as HDFS is by far the most resilient and fault-tolerant technology that is available as an open-source platform, which can be scaled up or scaled down depending on the needs, making it really hard for finding an HDFS replacement for Big Data Hadoop storage needs. So, you will have a head start when it comes to working on the Hadoop platform if you are able to decipher HDFS concepts. Some of the biggest enterprises on earth are deploying Hadoop in unprecedented scales, and things can only get better in the future. | https://tutorialslink.com/Articles/%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF-Big-Data-Hadoop-Distributed-File-System(-PART-2)/1166 | CC-MAIN-2020-05 | refinedweb | 906 | 62.07 |
This
The Code
def sendKap(x, s): y = x * x y = str(y) s1 = y[: len(y) / 2: ] s2 = y[len(y) / 2::] s3 = int(s1) + int(s2) if (s3 == x): s.append(str(x)) st = input() en = input() s = [] for i in range(st, en + 1): if (i & gt; 9): sendKap(i, s) elif(i == 1): s.append(str(i)) elif(i == 9): s.append(str(i)) if (len(s) == 0): print 'INVALID RANGE' else : print ' '.join(s) < /pre>
Got any problems feel free to comment them here!
Sidharth Patnaik
Tinkerer/Coder/Blogger
Latest posts by Sidharth Patnaik (see all)
- NATASHA: AI assistant using Raspberry Pi - October 26, 2017
- Hackerrank Modified Kaprekar Numbers Solution - October 31, 2015
- My First webpage using Bootstrap Framework - October 29, 2015 | https://www.weargenius.in/hackerrank-modified-kaprekar-numbers-solution/ | CC-MAIN-2019-30 | refinedweb | 127 | 62.48 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.