I've added a few more things to the Hebrew Dates plugin patches I mentioned earlier.
(more...)
Posts Tagged ‘Technical’
More Hebrew Dates Updates
ב' מרחשון תשס"ז - October 23, 2006Wordpress and Hebrew Dates
א' מרחשון תשס"ז - October 22, 2006I've modified the Hebrew Dates plugin from KosherJava slightly, so that all configuration data is now stored in the database (not hard coded into the PHP file). Additionally, it can now compute the dates of posts or comments based on local sunset time. That way, comments made in the evening will be assigned the the proper Hebrew date!
(more...)
Block spam harvesters
כ"ח תשרי תשס"ז - October 19, 2006On my site, I have a few "special" pages who's only purpose is to ban bots that ignore robots.txt (or worse, use it as a hint for where "the good stuff" is!). Here's how I do that:
(more...)
Dividing Integers (& Casting Precedance)
כ"ו תשרי תשס"ז - October 17, 2006Quiz:
What does the following code print:
int i,j;
float k;
i = 5;
j = 2;
k = i/j;
printf("%f\n",k);
Conditional Assignments
כ"ד תשרי תשס"ז - October 15, 2006Sometimes, you'll have a scenario with two variables, and you need to use one of them based on a simple test. Rather than a long and awkward if / else statement, C allows the use of the ? : form. It is perfectly acceptable to write:
int i,j,k,l;
...
i = (j > 5? k : l)
which will set i to k if j is greater than 5, and l otherwise.
Another common use is [sf]?printf statements:
printf("The test %s\n",(status == OK) ? "passed" : "failed");
However, one can't use it to handle selective assignments. The following code is illegal:
int i,j,k;
...
((i>5) ? j : k) = 5;
This cannot be used to choose whether j or k is set to 5.
There is, however a way this can be done. Using pointer, we can select which one to deference:
*((i>5) ? &j : &k) = 5;
This will work.