WordPress 3.0 implode() error

After installing WordPress 3.0 on a client’s web-host (running on PHP 5.2.5 with the wonderful PDO (SQLite) For WordPress plugin) I had a number of minor errors that required custom attention. Here’s the run-down:

Custom file-permissions (777 for install, be careful) needed for ‘wp-admin’, ‘wp-content’, ‘wp-includes’ and the pdo-for-wordpress ‘database’ directories to have install run smoothly.

“Warning: implode() [function.implode]: Invalid arguments passed in /wp-includes/post.php  on line 2552” was what I was seeing every time I tried editing a Page in the Dashboard. Solution was found at WordPress-Hacks (Spanish page): comment out line 2552 and insert replacement like so:

// hack start
// $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
$hierarchical_post_types_string = implode("', '", $hierarchical_post_types);
$hierarchical_post_types_string = addslashes($hierarchical_post_types_string);
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . $hierarchical_post_types_string . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
// hack end
Advertisements

Searching single table column with jQuery

In Codeigniter 1.7.2 there is no way to change the style of an individual cell with the Table class, this is not good and everyone is much looking forward to 2.0 where this sort of magic is apparently going to be included (go to this page and search for “individual cells”). So, say you have a table that contains specific values in some cells that need extra attention – if the table contains no colspan or rowspan then you’re emphatically in luck and can do the following trick with jQuery without custom id tagging of your content:


$('td:nth-child(10)').each(function () { // search 'Deposit'
content = $(this).text();
if (content.indexOf("No") != -1) {
$(this).css('background-color','#ff0000');
} else if (content.indexOf("Waiting") != -1) {
$(this).css('background-color','#fef612');
} else if (content.indexOf("Yes") != -1) {
$(this).css('background-color','#0abd09');
}
});

That will select the 10th column and search it for specific value and change the container cells depending thereupon, result can be seen in screenshot. Ah yes. Side-note: of course you would need to wrap your jQuery code in the pre-requisite $(document).ready(function() and so forth (Google is our mutual friend).

Resources used in connection to above snippet:
http://www.javascripttoolbox.com/temp/table_cellindex.html
http://tylermuth.wordpress.com/2008/12/17/jquery-selectors-will-change-your-life/

Chrome Desktop Notifications and why they are useless

Responding mainly to the optimistic vibe in the article and comment section on 0xfe’s brilliant article on webkit notifications I have the following brief’ish commentary:  first of all the chrome dev’s need to get the window-on-top-feature under their belt, otherwise these messages/notifications are simply going to disappear in mass numbers into the land of behind-the-app. [edit: thnx to NoFancyNick for pointing out that my browser is broken]

Secondarily I’m in 2 minds about the permission asking (same with localstorage i html5) – as in: is there any web-developers that will make use of features that demands their non-super-geek-userbase to press novel and scary invented-for-the-occasion buttons in their browsers before their site/app will work as intended? I seriously wonder: if I am to construct a notification (which is actually the case in regards to the db admin shell I’m currently working on) it is obviously better for me to use a jQuery attention grabber (like Tim Benniks’ “growl-like”). It would in essence never work for my no-tech users that they had to take into consideration whether a yellow bar is asking them some obscure message about accessing their desktop during their admin session.. it would spell out consistent and reoccurring user problems!

Lastly, while these app-like features are definitely needed we do need to find another option than the permission asking game – it works for users that are installing Firefox add-ons as second-nature thing but the rest of humanity have just come around to NOT clicking every single thing asking them for permission because it caused their computer to die of virus overload (which you and I had to fix for them). Not good.

Practical Strategies for Dental Health

thanks to 3dchem.comThis brief article provides a summary of practical strategies for achieving and maintaining good tooth-health. Since this blog is not health focused per say the article heavily references other articles and blogs but aims towards including all basic information needed for good dental health inline. It is important to note that teeth are in a constant cycle of re-mineralization which is why that, contrary to popular belief, cavities can re-seal, and more importantly do not need to occur in the first place.

Now lets get down with the data. The linked material often contains tool-tips with further information so do allow the mouse to hover before it clicks. A number of the links associated to Vitamin K2 MK-4 points towards material referenced from Winston Price who worked with a formula knows as Activator X, it has been confirmed to actually be Vitamin K2 MK-4 in 2007 by Chris Masterjohn. While most studies have been done on the MK-4 variant I have personally found a vitamin K complex to be of more benefit against dental plaque (I’m not the only one),  see recommended products at end of article for specifics.

Diet & Supplementation

To avoid

  1. No sugar (causes bacteria, lactobacillus and streptococcus mutans mainly, to digest sugars and break them down into acid that destroys enamel and allows cavities to form)
  2. No wheat (phytic acid causes extra excretion of phosphorus which in essence means loss of teeth mineralization material. Also gluten sensitivity causes mal-absorption of minerals in many people)
  3. Preferably no nuts (again phytic acid)
  4. No soft drinks (same issues as with sugar, only worse due to phosphoric acid which causes even more acidity and is linked to lower bone density)

To include

  1. Vitamin D (even without major diet change Vit. D is able to shift balance towards more cavities being healed than being formed, it promotes absorption of calcium and phosphorus in the gut which is essential because tooth enamel is primarily made out of hydroxylapatite; a crystalline  calcium phosphate)
  2. Vitamin K1, K2 MK-4 & MK-7 (helps all bone and teeth health via improved calcium bonding and balances and activates the effects of Vitamin D and A, it also seems to eradicate bacteria and changes saliva from phosphorus-accepting to phosphorus-donating, meaning that your own spit starts maintaining teeth enamel instead of gradually breaking it down).
  3. Omega 3 (1.5 times less occurrence of periodontal disease)
  4. Rosemary (stabilizes Omega 3 oils in the body to avoid oils becoming rancid & provides anti-viral, anti-bacterial, anti-inflammatory, anti-oxidant, and interestingly, anti-glycation effects, see recommendations below on how to prepare soundly and cheaply)
  5. Xylitol (intake routinely linked to lower incidence of cavities through anti-bacterial and alkalizing effects)

As a general guide adequate amounts of magnesium, calcium and vitamin A and vitamin C (non-acid source preferred, such as sodium ascorbate) needs to be present in the diet for vitamin D and K to work their magic. Supplement these conservatively if in doubt.

edit: post still missing dose recommendations, will be added shortly

CSV Email Stripper Program

EmailStripper 0.1 screen compilation

Here’s a little open source Email Stripper freeware application that is essentially hacked together by yours truly in response to the mess that Hotmail exports. I needed a clear list of emails (for import in MailMan), cleaned for duplicates and without linebreaks and with a specific line deliminator; see screenshot for basic operation. The regexp detection is based on RFC 2822. Since I’m still Linux/OSX challenged this little app is Windows XP/Vista/7 only.

You can download the compiled exe from here:
EmailStripper.zip (version:2010-02-04 (0.1)) (thanks to Citif.dk for hosting) –note: AU3 compiled exe’s has history of being falsely detected as vira/malware,

And here is the source code (AU3 based), please post improvement in comments and I’ll update the post accordingly.


#cs ----------------------------------------------------------------------------
Script Name: email_stripper
Script Version: 2010-02-04 (beta)
Author: softhacker
Script Aspects:
    Strips emails from for an example csv outputs from hotmail or others
    RegExp taken from http://www.regular-expressions.info/email.html (RFC 2822)
#ce ----------------------------------------------------------------------------
#Include "Array.au3"
$pathtofile = FileOpenDialog("Please select file to strip from",@ScriptDir,"Pure txt files (*.txt;*.csv)",1)
$filehandle = FileOpen($pathtofile,0)
$text = FileRead($filehandle)
$text = StringLower($text)
FileClose($filehandle)
$emailarray = StringRegExp($text, "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", 4)
Dim $cleanedemailarray[UBound($emailarray)]
For $i = 0 To UBound($emailarray) - 1
    $match = $emailarray[$i]
    For $j = 0 to UBound($match) - 1
        $cleanedemailarray[$i] = $match[$j]
    Next
Next
_ArraySort($cleanedemailarray)
$cleanedemailarray = _ArrayUnique($cleanedemailarray)
_ArrayDelete($cleanedemailarray,0)
$deliminator = InputBox ( "Please enter the delimiter needed between emails", "Enter deliminator(s) (; , | - )", ";")
$linebreakanswer = MsgBox(36,"Linebreaks or not","Do you want linebreaks after each entry?")
If $linebreakanswer = 6 Then $emailstring = _ArrayToString($cleanedemailarray,$deliminator & @CRLF)
If $linebreakanswer = 7 Then $emailstring = _ArrayToString($cleanedemailarray,$deliminator)
$filenametosaveto = FileSaveDialog("Please select file to save stripped material to",@ScriptDir,"Pure txt file (*.txt;*.csv)",16)
$filehandle = FileOpen($filenametosaveto,2)
FileWrite($filehandle,$emailstring)
FileClose($filehandle)

Rocketfuel Self-Heating Black Coffee Review

This is utterly unscientific from about 4 to 52 angles so please stop reading if you’re inclined towards sanity.
Disgusting rat coffee
Now, for the rest of us: this is a review of “Rocketfuel (self-heating) Black Coffee (Hot Energy Strong Black Coffee Powered by Guarana)”, see image for visual appreciation and deep scientific understanding of the issue at hand. Ok, so here’s the, erowid.org-style, personal trip report from the encounter:

Dose: 1 (oral) Rocketfuel Black Coffee (wet)
Body weight: 69 kilo (152lb or 11 stone)

First, before I begin, despite what may be deducted from the intro and everything else, this ALL HAPPENED TO A FRIEND and it is only for ease of writing that I have adopted a first person perspective to re-tell the daring tale of despair.

15:47
I first spot the much feared yet also tantalizing substance flaunted on display at a local news agent in the area. After the initial doubt over the slightly hefty price of £1.45 my curiosity gets the best of me (its coffee.. it HEATS ITSELF!) and I commence to pay for the drug with my girlfriend’s (named “Y” for anonymity in the rest of this report) money as I’m as always low on cash.

15:56

After calming myself down (by walking out of the store and thinking about a watermelon and listening to an psychedelic ambient music album by Shpongle) I promptly read the simple yet tantalizing instructions on the side of the jar: 1) “Click the base (once)” 2) Shake for 40 seconds 3) Drink (after opening). Because I’m largely fearless, and mildly retarded, I proceeded to press the base nearly 10 times to make sure it was more than ordinarily pressed and…

15:57

… immediately after I was transferred to another reality zone of complete appreciation in regards to just how well the self heating cup functioned as a hand-warmer; this effect is so strong that it was also commented on by Y who was my sitter throughout the trip [Erowid Note: always use a sitter when trying out dangerous/novel substances].

15:58 (ingesting the substance)

This is f*cking mind-blowing, the coffee just heated itself (at least mildly) and now I’m drinking it… ARGH, the issue is that it taste as if someone is forcefully injecting roughly one imperial gallon (yes that is 4.54609188 liters) of sewer waste into my gullet. The shock causes a strong onset of hallucinations involving small pixies dancing with metal boots in my groin while laughing hysterically. This hallucination however rapidly fades and gives way to swirling visions of me kicking the manufacturer of this coffee in the groin and then finally disappears.

16:05 (the come-down)

I now strongly need a toothbrush and industrial strength hydrogen peroxide to clean my mouth from the vile taste. The lingering taste even as I’m writing this reminds me exactly what sort of price one should be willing to pay for buying pre-manufactured self-heating coffee crap. As I wipe tears from my eyes due to the emotional impact of this trip I cannot help but wonder whether this experience will make me think twice next time. I think I learned my lesson, crac.. coffee isn’t for me, self-heating or not.

Bookmark and Share

The Human Hormonal Systems

Most of us will equate the human hormonal system with the endocrine, blood vessel, hormone system. A closer look will reveal a close interrelationship between 2 vastly different hormone systems; the autocrine (also at times referred to as the paracrine*) and the endocrine. From a health perspective it pays off to know these systems a bit more in detail which is what this article will focus on. Common characteristics of the two systems include that they both depend on hormone receptors; a receptor is “a receptor protein on the surface of a cell […] that binds to a specific hormone”.

*not strictly true – paracrine hormones can communicate between different types of cells whereas autocrine only work on similar types

We will start with the autocrine system since this makes sense in evolutionary perspective; it came first into existence. It is worthwhile to note that several hormones, for an example acetylcholine, are functioning (and synthesized) in both hormonal domains. The description of both systems includes a standardized ending named “Health Perspectives”, while this section is of course written to be relevant to each of the hormonal systems it is reasonable to infer that something that enhances one system will in essence also help balance the other.

Autocrine Hormone System

This system is characterized by its local cellular function. It basically involves one, or multiple, cell(s) releasing locally acting hormones. By “locally acting” I mean that the hormones released will return to act either on the originator cell or its immediate neighbors.  Autocrine hormones do not enter the bloodstream. Since these hormones are the ‘base unit’ of cellular communication they have the power to ‘overrule’ the effects of endocrine hormones – as a metaphor think about them as neighbors or close friends; what they say will most often matter vastly more than any message you may get off the internet (at least short-term).

Example of compound(s) or drug(s) that modifies the activity of the Autocrine system

An excellent, and mass publicized, example of a autocrine activity modifier is aspirin which temporarily disables the two enzymes COX-1 and COX-2 that are essential to the production of a number of the autocrine prostanoid hormones. The good news is that COX-2 repression quells inflammation (and thus helps protect against everything from cancer to arthritis) while COX-1 repression helps stop the production of thromboxanes, which otherwise promote (at times fatal) blood clotting. The bad news is that new study reviews are showing that the increase in bleeding related accidents by supplementing with aspirin makes it so that this practice in essence only makes sense for people who have already suffered from heart-related problems.

Examples of Autocrine hormones

Eicosanoids (“derive[d] from either omega-3 (ω-3) or omega-6 (ω-6) EFAs. The ω-6 eicosanoids are generally pro-inflammatory; ω-3’s are much less so […] with effects on cardiovascular disease, triglycerides, blood pressure, and arthritis“) [source]

Cytokines (“[derived from] proteins, peptides, or glycoproteins. [They are] substances that are secreted by specific cells of the immune system [in the] general region of the pathogen infected cells, so other immune molecules which follow the signal will arrive at that site”) and they hold a (“possible role in […] autoimmune disorders. Several inflammatory cytokines are induced by oxidant stress. The fact that cytokines, themselves trigger the release of other cytokines and lead also to increased oxidant stress, makes them important in chronic inflammatory disorders.”) [source]

Health Perspective

Omega 3 fatty acids are undeniably a very subtle, efficient and proven way of positively helping the autocrine system do its job. Also, should a pro-inflammatory cycle in the autocrine system already be present then a number of compounds, such as Turmeric (Curcumin), are perfectly able to help short-circuit the negative loop by manipulating the expression of inflammatory autocrine factors downwards.

Endocrine Hormone System

Human Endocrine Glands

Human Endocrine Glands

The endocrine system is characterized by its use of the blood system as communication highway for all its hormonal activity. The system has its control unit in the form of the hypothalamus (located in the middle of the brain) which, via the pituitary gland (which is in direct control with the blood stream), links the endocrine system (7 hormonal glands) up with the nervous system. This system lends itself well to illustration so have a look at included image (modified CC licensed image from Wikipedia) for reference.

In essence the hypothalamus gets incoming data in the form of feedback (via both communication via the nervous system and by sampling the amount of hormones in the bloodstream) from another gland that says “enough” or “more” of a given hormone which it uses to regulate production.

Endocrine sets of hormones are often functioning in axis setups; a famous, and often felt, example is the hormonal glucagoninsulin axis. In order for people to be fully functional and awake these two hormones needs to be in balance within a relatively small window. Insulin drives blood glucose down while glucagon drives it up. If we eat moderate amounts of carbohydrate in conjunction with protein then the pancreas uses these two hormones to keep the blood-glucose level within a very tight window. Should we overeat carbohydrate then the blood-glucose will go up a lot, eventually causing a strong release of insulin to drive it back down, this time however, the pancreas will not be able to stop the falling blood-glucose levels because protein is required for glucagon synthesis – result is that we get sleepy after over-eating for example pasta (or drinking fizzy drinks). Since insulin disables use of stored glycogen as energy long term stressing of the pancreas insulin production is likely to cause combination of overweight and eventually diabetes due to falling production of insulin.

Example of compound(s) or drug(s) that modifies the activity of the Endocrine system

Iodine is essential for the production of thyroid hormone. “The thyroid controls how quickly the body burns energy, makes proteins, and controls how sensitive the body should be to other hormones.” Iodine deficiency can lead to “extreme fatigue, goitre, mental slowing, depression, weight gain, and low basal body temperatures.” which happens not just in developing countries but also in Europe: “In Germany it has been estimated to cause a billion dollars in health care costs per year.”) (sources 1 and 2)

Examples of Endocrine hormones

Growth hormone (GH) (Is a “protein-based poly-peptide hormone. It stimulates growth and cell reproduction and regeneration in humans and other animals [.. and is secreted by the] pituitary gland.”) (source)

Pregnenolone (One of several pro-hormones that can undergo further steroid metabolism to be converted into a range of other hormones including the the axis hormones estrogen and progesterone as well as being a “precursor to testosterone and estrone“) (source)

Health Perspective

A re-occurring theme in the above information on the endocrine system has been the hormonal axes and how their maintainance of a fairly tight balance is of vital importance to health – it is worth understanding this process fully to aid this process through diet. After all imbalances can lead to diabetes which is actually being used as a accelerated model of aging. In essence minimizing excess blood glucose through dietary habits, along with exercise to promote healthy GH levels, will likely continue to be the most effective way to stabilize the endocrine system for years to come.

Bookmark and Share