Things I wish I had time to write more about

Good news.

Related news, from one of the owners of Small Dog Electronics:

Start Soapbox

*****

Fossil Fuel Free by 2018?
By Don, don@smalldog.com

I read with great interest about the challenge that former VP and current Apple board member Al Gore tossed out yesterday. He challenged the USA to completely shift its entire electricity production to renewable energy sources and eliminate the dependence upon oil and coal. Challenging the auto industry to have all electric cars in 10 years and power those vehicles with electricity powered by hydro, wind, solar and geothermal energy is not only a very ambitious plan, but it is an achievable plan that will provide immense benefits to our country. Oilman T. Boone Pickens (don’t you love that name!) also proposed a far-reaching plan to build massive wind energy capacity and has launched a big advertising campaign.

I have some experience in the wind industry as I started a wind energy company in the seventies and did a comprehensive study of the wind industry in the USA in the ’30s and ’40s while I was at Goddard College. Probably a bit ahead of the times, I worked in that industry for fifteen years and know first-hand that the potential for electrical generation by wind energy is simply HUGE. There is no technological barrier to Al Gore’s plan, the technology to harness renewable energy exists now, the technology to produce electric cars exists now and it really does only take a massive commitment on the part of the people to get it done.

The benefits are significant. We are now importing 70% of the oil we utilize and the world’s oil supplies are rapidly diminishing, prices are escalating (and they are not EVER going to come down) and the competition for this scarce resource is and will continue to be the source of conflict around the world. The escalating price of fossil fuels is hurting our economy, it is making it more expensive to commute to work, it is making home heating this winter an emergency situation and is causing the loss of jobs. Contrast that with the massive effort to completely convert to renewable energy. We would be creating thousands of new jobs, new industries and would be buying energy security for our country. Not only that, but we will be significantly reducing the carbon being emitted into the atmosphere. No longer will the USA be the barrier in the battle against global warming, but instead, we will be the leader.

I was pleased that both presidential candidates supported this goal. Now we have to get into the details of how this can be done. This must be a much higher priority than an erroneous war in Iraq that is consuming our resources, both human and financial! The country currently relies on coal for about half of its electric power (49 percent), followed by natural gas (22 percent), nuclear (19 percent) and hydropower (6 percent), according to the U.S. Energy Information Administration. Renewable power accounts for 2.5 percent, although it’s growing rapidly in many states, especially California.

This is really the answer to $4 gasoline today and $10 gasoline tomorrow. We need to shift the prevailing paradigm and realize that with a united effort and an intelligent goal we can once again claim true independence. Al Gore’s plan is more than a remedy for global warming and diminishing fossil fuels, it is a blueprint for a massive economic development program for our country.

*****

End Soapbox

Something I agree with wholeheartedly.

Something depressing.

Something expensive, but worthwhile (especially since we supposedly can’t spend any money on domestic issues until we get a new president, according to my AAAS updates).

 

 

Alliance p2p notes

I’m working my way through this program. I think it works really well, these are just my notes. I haven’t gotten around to posting these in the official forum or bug tracker yet.

Invite Codes
*The only thing the LAN checkbox affects is new invite codes. It does not change how your computer accesses anything else.

*Leaving LAN unchecked uses the web-accessible IP address of the computer. Checking LAN uses the local address (192.168.XXX.XXX).

*You can create two invite codes for each computer: a LAN code and a web code. Sometimes one will work where the other one will not, depending on the relationship between the two computers.

Moving Around
*Switching one computer from one network to another (e.g., from a wireless access point to a wall jack) sometimes results in loss of connection between the machines that cannot be repaired without a)changing the hostname of the buddy to either a local or web-accessible IP or b)deleting a buddy and re-adding them with their invite code.

*It may be the case that Reconnect has to be pressed by users on both ends of a connection after one person has switched networks in order for the change in IP address to register and the connection to be reestablished.

Miscellaneous
*It is unclear what “Reconnect” actually does.

*It is unclear how long it should take for certain things to happen. Sometimes it takes a couple minutes for everything to get situated after starting Alliance or switching networks. It also lags a couple minutes when someone leaves the network before removing them from the active users list.

*Should you be able to add friends of friends with whom you cannot connect? There is no dialogue or notification when they are unavailable after clicking “Finish.” I know that not everyone’s friends of friends will be online all the time, but if they are, and are not accessible from the current location, that should be reflected somewhere for the user.

*What port is being used to send invite codes? Is it possible that the router is getting mixed up and using the wrong port? Is this encoded into the invite code?

*When downloading, then disconnecting, then attempting to download from a different buddy, download will not begin. After removing everything in the download queue, restart is still required before downloading will commence. This may be related to switching networks too.

*Is there a limit on number of files that can be shown per directory? Alliance will not display a folder with 4840 files (kicks the connection for a few minutes), but when searching will display files in that folder that match the search criteria. This may also be related to funky characters in a filename within the folder–since those files weren’t part of the search results, the folder displayed just fine. It was the number of files–keep it under about 1,000.

*Sometimes the checkbox to browse a folder just disappears. Why is this? Because the shared directory name has been changed and the folder doesn’t exist anymore.

*When you have two laptops on the same wireless network and very few people using Alliance in general, it acts like there needs to be a critical mass in order for sharing to really occur. Such as, A and B are in the same room, on the same network, and can see each other. B can see a third computer C, on a different part of the network (outside the wireless access point), but A cannot. In this case, Friends of Friends seems to work, but user C never shows up for A.

Passing and using variables in SMARTY tags (among other things)

I’m posting this because I could find NO answers to this question anywhere.

I wanted to pass a Smarty variable (for example {$hello}) through to the PHP side in Serendipity, get an extended property from the Serendipity database, run a query on the SMF database based on that property, and echo the output.

Comments are ***, which should be removed when copying and pasting.

In entries.tpl:

***Checks if the entry is one its own page or not.
{if !$is_single_entry}

***Assigns a new variable from a Smarty variable  {$entry.id}.  Note the backticks (``) around the variable name.
   {assign var='entryid' value=`$entry.id`}

***Capture the output of the Smarty function, within which is passed the variable $entryid
   {capture name=plural}
        {numbersmfcomments entryid="$entryid"}
   {/capture}

***Outputs some HTML with the Smarty function.  Distinguishes "Comment" or "Comments" based on the capture output.
   {numbersmfcomments entryid="$entryid"}
   {if $smarty.capture.plural == 1}
        Comment
   {else}
 Comments
   {/if}
   --Add yours!
{/if}

 

In config.inc.php:

 

 

***Makes a new Smarty function
$serendipity['smarty']->register_function('numbersmfcomments', 'numbersmfcomments');
function numbersmfcomments($params, &$smarty)  {

***Gets access to the SMF database and Serendipity globals.
require_once('/home/pmp6nl/public_html/talk/SSI.php');
global $serendipity;

***Gets entry id out of passed variable in Smarty function.
$id=$params['entryid'];

***Gets extended info about entries, which is where the SMF topic ID is stored.
$props = serendipity_fetchEntryProperties($id);
$SMFTopic =  $props['ep_SMFTopic'];

***Run a query to count the number of messages in that SMF topic.
$result = mysql_query("SELECT * FROM pmp6nl_talk.smf_messages WHERE ID_TOPIC = '$SMFTopic'");
$numbercomments = mysql_num_rows($result);

***Output that number, minus the original message.
echo $numbercomments-1;
}

I hope this may be helpful to someone in the future.

References:
http://www.s9y.org/78.html#A4
http://www.smarty.net/manual/en/language.custom.functions.php#language.function.assign
http://www.programmingtalk.com/showthread.php?t=11586
http://www.smarty.net/manual/en/language.builtin.functions.php#language.function.capture