The best part is that it you type in "sex party", it automatically replaces the text with "kittens" instead.
--Greg
The best part is that it you type in "sex party", it automatically replaces the text with "kittens" instead.
--Greg
Depends on what you think you are measuring. Personally, I think average milligrams-per-minute of cortisol produced in viewers who watched the movie at room temperature is the only valid metric.
--Greg
Asking about "top hosting companies" is like asking about "top colleges". Yes, some are obviously better than others, and there is probably a small set of known names that you want to choose from. HOWEVER, within that set of trustworthy, known names, the one that will be "best" for you will depend on the details of your preferences, your needs, and your goals. And just like with a college, if your needs and desires are sufficiently outside the normal curve, the "best" hosting company for you might not be one of the ones that everyone else recommends. So I recommend taking the advice of anything that anyone mentioned here, of course, but then using that only as a starting point for doing your own research. The one that I would add to the list of items for you to consider: pair.com They have a wide variety of levels, they are very "friendly" for developers (in that you can customize and tweak most installations and server settings yourself), and have good customer support.
--Greg
What makes this concern specific to HTML5, in particular?
--Greg
Ben Breeg wrote:
Light on dark seems rather counter-intuitive to me considering the majority of books use dark on light.
Back when I was a programmer in Morganville, which is what they called Shelbyville back in those days, computer monitors were lit up by vacuum tubes powered by little steam engines. Each of the pixels took a decipascal of steam pressure to power it. A decipascal is what we called a barad in those days, when measuring steam pressure. That's why we programmed in Pascal, back then, as well. Anyway, as I was saying, each pixel took a decipascal of pressure, so you had to keep most of the pixels black most of the time to save on energy. Energy was scarce, because of the war. So that's why back then, most monitors were all black with white text. But it was ok, because we had monitors with little switches to change the text to AMBER. That was always a lot of fun.
--Greg
I am not answering your entire question, but I have a thought about one component of it: Do you have any control over the date format of the initial XML that is provided to you? If you were to receive the date values in ISO format (YYYY-MM-DD), then you could use a simple string comparison (greater than or less than) in your xpath or xsl to determine whether the dates fall in date ranges.
--Greg
You have to think about it this way: PHP code works with what the server "knows". Javascript code works with what the browser / client "knows". To get them to interact, you need to explicitly "pass" information back and forth between the two. For example, if you have a variable in the javascript, you can "pass" the value to the server by passing it with a GET variable, e.g.
<script language="javascript">
Fuction PassNumber(nVal) {
location.href = 'mypage.php?n='+nVal;
}
</script>
Then, on the server side, you receive the GET variable to produce the effect that you want:
<?php
$nval = $_GET['n'];
if ($nval)
{
print('<script>alert('.$nval.');</script>');
}
?>
Contrariwise, when you have the PHP variable on the server side, you can use that to feed it to the Javascript function when rendering your onclick function:
<input type="text" name="text1" value="200" /><br />
<input type="button" value="Go" onClick="PassNumber(this.text1.value+<?php print($nval) ?>)" />
This requires a re-load of the page, and change of URL, each time you click the button. To do it more "subtley", without a reload, you would have to use AJAX: but the principle would be the same. Pass the information between Server and Browser using calls to the PHP page with GET.
--Greg
Would simply using PHP's built-in session handling be sufficient for your purposes? see, e.g., http://www.tizag.com/phpT/phpsessions.php[^] If not, let me know exactly why not and maybe we can come up with an alternative idea.
--Greg
Thanks for the suggestion! I've done it, and the article is now posted. Cheers!
--Greg
Only if we start calling it "anberic current" instead of "electric current". ;)
--Greg
I would like to know which of the following options will produce the fastest transactions (and why). Unfortunately, I don't know enough about the low-level "nuts and bolts" of database operation to really have a good intuition on this. My PHP script resides on one server, my MySQL database resides on another. I believe that by performing operations on a regular MyISAM table, I am incurring time costs related to both 1) communicating between the web server and the database server, and 2) performing disk operations because of MyISAM is disk-based storage engine. I do not, however, know how much of the time cost is associated with each of these factors or if both are really significant (in the sense of important). I have some temporary data that I want to manipulate on a per-session basis, and the way I see it I have two options: I can create a local memory database and create a table there.
$wm = sqlite_open(':memory:', 0666);
sqlite_query($wm,"CREATE TABLE patterns (pattern varchar(500))");
Or, I can create a table in memory on the existing MySQL database.
mysql_connect("not.localhost.com", "admin", "example");
mysql_select_db("example");
mysql_query("CREATE TEMPORARY TABLE patterns (pattern VARCHAR(500)) ENGINE=MEMORY");
Which one of these will be faster to perform queries on? Will there be a noticable difference? My intuition is that the second will be slower because it is a transaction on a non-local database, but I don't know this for sure. When the table is in-memory, which computer's memory is it actually in? How much volume would have to be going on for a difference to actually be noticable? Any thoughts would be very much appreciated.
--Greg
Like rotating a three-dimensional puzzle: making something simpler from one perspective always makes it more complex from another perspective. What you think the simplest answer is depends on what perspective you care about the most. This is, of course, not the first some a person has gone on a lone crusade to change an accepted formal notation because he thinks that he has found something "better" in some way. My favorite example of this kind of crusade was Spencer-Brown's "Laws of Form". A book on formal logic, where Spencer-Brown actually builds an entire formal language from scratch and proves that it is formally equivalent to first-order predicate logic. Why? Because instead of the atomic concepts of his system being truth and falsity, the atomic concepts in his system are the act of making a "distinction" and making an "indication" (of one side or the other of a distinction boundary). Spencer-Brown expounds at length, in the appendix, about how there is no such thing as absolute truth, and how all of reality depends on the actions of a subjective observer: what an observer decides to distinguish from the background, and what he indicates as relevant. And wouldn't the whole world be more peaceful and open-minded and accepting of differences if we all just realized that there was no such thing as "truth" and "falsity"? And how can we become peaceful and open-minded if hegemonic notions such as "truth" are embedded in the roots of our very arithmetic?? Everybody wants to make things better. But alas! Like Dvorak Keyboards and Esperanto, these endeavors are destined to never be more than historical curiosities. "Simple" is always with respect to a viewer, after all, and based on the distinctions that that viewer makes and what that viewer think "matters". It's all very subjective. Isn't that right, Spencer-Brown? ;)
--Greg
I finally found out what was wrong, and came up with a solution! I hope it isn't considered "bad form" to link to a blog post, but I wrote a long and involved blog explaining my frustration and what I found out the problem to be here: http://talkingowlproject.blogspot.com/2011/06/simplexml-and-namespace-quirks.html[^] And I actually wrote my own class, SimpleRDFElement
, to extend the SimpleXMLElement class and solve the problems. You can read my description of my extension class and download the 1-page source code here: http://talkingowlproject.blogspot.com/2011/06/simplerdfelement-class-extension-of.html[^] In a nut shell: the built in functions with SimpleXML handle namespaces poorly, the children() and attributes() methods only allow you to select children and attributes in a particular namespace (not all at once), and there are no functions specifically for extracting the namespace portion of the tag of the current top-level element. So, my extension class, SimpleRDFElement, provides functions to solve all of these problems, as well as a method for parsing an RDF XML string into triples. I hope that this helps anyone else who is interested in this question!
I have a string variable $xml
which contains this string:
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:sumo="http://www.ontologyportal.org/translations/SUMO.owl.txt#" xmlns:dul="http://www.loa-cnr.it/ontologies/DUL.owl" xmlns:owl="http://www.w3.org/2002/07/owl" xmlns:top="http://talkingowlproject.com/schemas/top-level-concepts-10/" xmlns:wps="http://talkingowlproject.com/schemas/wordnet-parser-schema-10/"><rdf:Description rdf:id="#me">
rdfs:labelPigwidgeon</rdfs:label>
<rdf:type rdf:resource="http://talkingowlproject.com/schemas/top-level-concepts-10/TalkingOwl" />
</rdf:Description>
<rdf:Description rdf:id="#you">
rdfs:labelgreg</rdfs:label>
<rdf:type rdf:resource="http://talkingowlproject.com/schemas/top-level-concepts-10/User" />
</rdf:Description></rdf:rdf>
I have the following code:
$xmlobj = simplexml_load_string($xml);
if ($xmlobj===false) die('bad news');
print_r($xmlobj);
The result displayed is (appears to be?) an empty structure:
SimpleXMLElement Object
(
)
And when I try to iterate over members of the object, it performs no iterations (confirming that the structure is empty). Is there something wrong with the XML string? Is there a problem because of the namespace declarations or the use of namespaces on every tag? When I remove the namespace declarations in the root tag, I actually get a structure with contents .... but then it doesn't know the namespaces, so it can't use them when I'm parsing the object. (I need to be able to identify namespaces with nodes.) Thank you for your help. --Greg
I've been trying to create a group of rules in .htaccess that will deny bots access to specific groups of pages in my site. Specifically, my site is a Wiki (running MediaWiki), and I would like to prevent bots from accessing any pages in the "User", "Talk" or "Special" namespaces, while allowing them to spider other pages on the site. Below is my attempt... but it's not working. The basic approach I'm trying to use is this: 1. set an environment variable that identifies if the REQUEST_URI's that I want to exclude 2. set an environment variable that detects if the user agent is a bot 3. If both of the above environment variables are set, deny the page. Can anyone give me a tip as to why the code below is NOT doing what I describe above?
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=User:.* [OR]
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=Talk:.* [OR]
RewriteCond %{REQUEST_URI} ^/reference/index.php?title=Special:.*
RewriteRule ^.* - [E=PAGE_NO_BOT:1]
RewriteCond %{HTTP_USER_AGENT} ^.*Googlebot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*robot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Slurp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Scooter.*
RewriteRule ^.* - [E=CLIENT_IS_BOT:1]
RewriteCond %{ENV:PAGE_NO_BOT} ^1$
RewriteCond %{ENV:CLIENT_IS_BOT} ^1$
RewriteRule ^.* - [F,L]
Hmm.... I'm not sure you understand. I'm still trying to make use of a class name in the external assembly, but I'm trying to make use of it in a code-behind page, rather than a compiled class. Specifically, I have installed an external assembly called SimpleChart, which gives me a file called SimpleChart4.dll. Then, in a code-behind page I say: Imports SimpleChart4 which is the name of the namespace, and is the line used in all of their example code. However, it gives me an error, telling me that it doesn't recognize the type. In theory, if I had the Visual Studio.NET application, I could click on "Add Reference", choose the "COM" tab, and add a reference to the DLL, and then suddenly it should be able to recognize the SimpleChart4 namespace/type. However, since I do not use the Visual Studio.NET application, I'm wondering how to do this without.... ----Greg
First of all, thank you for your reply, it was very helpful! One follow-up question, though: What if I want to make use of the Class (that is defined in the DLL) in a code-behind page? Since I'm not compiling the code in the code-behind page, I wouldn't be using cs.exe and wouldn't have an opportunity to use /reference, correct? Or am I misunderstanding how/when to use the /reference option? Thanks again for your help! ----Greg
I am working on a project developing an ASP.NET (1.1) web application. However, I am not using the Visual Studio.NET front-end design application. I'm simply using notepad to create .ASPX, .VB, and other related documents. When I want to write a pre-compiled visual basic class, I use the command-line vbc.exe compiler, and place the output DLL in the /bin/ folder. Up to this point, this has worked fine for me. Now, I am trying to use a third-party COM module with the site (simplechart.net). I have installed the module on the server. Now, in the instructions that come with the simplechart.net module, I am told: "In the Solution Explorer, Right-click on References and select Add Reference. Select the COM tab in the resulting Add Reference dialog. Scroll down to the SimpleChart Toolkit 2.1, highlight it and click Select." But.... I don't use the Visual Studio.NET front end. So my question is this: What is it that this "Add Reference" process really DOES, in the background? Can I do the same thing manually, without going in to Visual Studio.NET? ---Greg p.s. please don't reply with "Why would you want to do that?" and go on to extoll the virtues of using the Visual Studio.NET application. I am first interested in whether or not it is possible (whether or not you think it's advisable) to do without.
Thank you so much!
I would like to prevent the user's browser from ever storing and filling in the password automatically on the site that I'm developing, regardless of their browser settings. Is there a straightforward way of doing this? -----G