Wednesday, April 06, 2011

I ran across an interesting article...monotheism vs ultimate reality.  The author discusses Brahman vs the monolithic understanding of god in the abrahamic religions...

http://dharmasyavaani.blogspot.com/

Thursday, February 17, 2011

How to manually reset a user's password on mediawiki...

php (mediawiki home directory)/maintenance/changePassword.php --user "username" --password "new password"

Tuesday, February 01, 2011

Developing the Next Generation of Youth Leadership



And video of presentation (Keynote at Hindu Mandirs' Executives Conference, Houston, 2010)



Monday, January 31, 2011

What's next for Mannkind?

Path to FDA approval
The FDA, in the second CRL seems to have no objections to Afrezza, but have questions about the Gen2 inhaler (Dreamboat).  Thus, we should now have a clear path to approval assuming that the management team can align with the FDA on the requirements.

While it is unclear, how long the two clinical trials will take to complete...it is a safe bet that between the trails and the FDA review cycle,  it will be between 18-24 months until Afrezza can reach the marketplace.



Seaside 88 Transactions

DateVWAPSeaside PriceTotal $
9/20/106.726.184,326,000
12/15/107.426.834,781,000
12/29/108.217.555,285,000
1/12/118.407.725,404,000
1/26/117.126.554,585,000
(Thanks to Derek for the Seaside pricing info)

These transactions are approximations based on the daily closing price / daily volume and not the price per transaction / transaction size...based on data provided by the MannGroup.  Seaside does not disclose their purchases as their percent of ownership in Mannkind is very small.

Financial Position
Total amount raised through Seaside 88: $24,381,000.  At this point, they are unlikely to raise any additional funds through Seaside unless a partnership agreement is reached (and the stock once again crosses $6.5). 



Between the BoA deal and Seaside, Mannkind raised $139m through the end of January.  This should ensure funding till end of Q3. Considering that Mannkind was preparing for launch, they may have a round of lay-offs and reduce their operating expenses...which can making this funding last a bit longer.  
 
Al Mann's perspective
Al has a few options to keep the company afloat:
  1. Raise additional capital by issueing equity (either through the open market or through another private placement)
  2. Invest more of his own money
  3. Sell the company
  4. Partner with big pharama

I don't believe he will let the company go under since Mannkind is the only one of his companies that bears his name.  Mannkind is Al Mann's legacy.


I don't know what Al Mann's financial position is and thus don't know how much additional capital he can personally inject into the company.  I am also not certain whether the line-of-credit he has extended to Mannkind has been exhausted or not.  If it has not, than that provides some cussion to Mannkind, but not sufficient to finance the company through approval. 


Given that he does not want to get diluted (illustrated by the debt to equity swap aligned with the Seaside investments which prevents his dilution), and has limited additional funds to invest himself, it is likely that he will not go to another round of equity investment (either public or private placement). 


It is also unlikely that he will sell the company.  The market value of the company is sub-$1b.  He has invested almost $1b into the company.  The return he would get would be (at best) $5b which is sub what he wants for the company--between 10x-100x.


Thus, it is likely that he will partner and in the near future.  The longer he waits, the weaker his negiotiating position will become with big-pharma and the increasing likelihood that they will want to wait until the FDA announcement.  Right now, they will be more ameanable to do a deal--but Al will have to give them better terms than he originally wanted to.  But given that he doesn't have any other options that are more paletable to him, this is probably the likely outcome.


The partner will also have better connections at the FDA and will increase the likelihood of Mannkind getting approval during the 3rd round submission.

Friday, January 28, 2011

Why did the FDA give a CRL to Mannkind?

The FDA is responsible for approving drugs that can improve the health and quality of life of the American public (safety & efficacy).  When they approve drugs that go on to do exactly that, no one things about them at all.  On the other hand, if they approve a drug that ends up doing more harm than good, than they get beat up by the public & the media.

With this background, think about Mannkind's case.  They submitted one of the most detailed NDA applications in the history of the FDA to the FDA for a drug that targets one of the most prevalent diseases in the US (diabetes).  Drugs which target small groups of patients or patients for which other drugs do not work will receive less scrutiny simply because the possibility of harm in the sense of number of people harmed by the drug will be fewer and the likelihood of discovering this harm is also smaller since the sample size of patients is smaller.  In the case of diabetes, the patient sample size will be huge especially since Afrezza stands to revolutionize the treatment of this disease.  If something were to go wrong, it would be quicker in surfacing  and the number of people impacted would be large (due to the large patient population). 

Al Mann and the management team probably recognized this which is why they had such a large and detailed filing the first time around.  However, in the hopes of getting the new Gen2 inhaler to market quicker, they forgot this aspect when they submitted their response to the CRL to the FDA.

The FDA response during the meeting (for which no minutes were ever published) was probably that of outrage.  Mannkind had submitted responses using a different inhaler than the one used to generate all the data that they had studied for over a year. Mannkind executives probably tried to explain that the new inhaler was bio-equivalent (ie the same amount of drug went into the body with both inhalers), the risk-averse FDA officials didn't buy the story.  Hence, we got the CRL a few weeks ago asking for clinical trials of the new inhaler.

That being said, they did buy into the Afrezza story...there are no more doubts about that in the CRL...just the delivery device.

Thursday, December 16, 2010

Mannkind Stock Volatility: Yesterday's Crash, Today's Rise, and Tomorrow's Crash

Yesterday's 10% drop in Mannkind stock is symptomatic of the volatility we can expect to see up until the 29th when the FDA rules on Mannkind's application for Afrezza.

For those of us who are longs -- I would advise against placing any stop-loss orders and also advice putting in place limit buys for where ever you have placed your stop-loss. 

The stop-loss was designed to allow people to limit their loss when a share's value decreases.  This mechanism does not work in volatile stocks like Mannkind coming up to a binary event (the FDA decision).  Many of the sudden drops in price are a result of shorts, hedgefunds, "big money" who are selling only to trigger the stop-losses resulting in a further drop in the price...ie they are leveraging the people who have put in stop-losses to drop the price.  Than, they buy before anyone realizes what has happened (ie when they stop selling and start buying while the stop-losses continue to be exercised). 

A day later what happens:
"Big Money" - lowers the cost of the stock to themselves
Average shareholders - end up with lower holdings and early profit taking -- all of which is not intentional.
Stock price: back to where it was before the drop.

The only way to counter this strategy (and reduce your own heartburn) is to either
1. not put in any stop-losses
2. put in limit buys for where-ever you have stop-losses -- which will let you partake in the uptick that the "big money" is planning on taking advantage of.

Wednesday, December 15, 2010

Will Doctors educate patients on needles or give them an inhaler?

A Response to The Curious And Complicated Case Of MannKind on Investopedia


Not All Good News, ThoughUnfortunately, Afrezza is not the slam-dunk its supporters want it to be. None of the clinical trials done to date have shown any superiority in efficacy (as measured by HbA1c) for inhaled insulin. In fact, every trial I have seen has shown a slight underperformance for Afrezza - not enough to be statistically significant or technically inferior, but enough to suggest that Afrezza is not demonstrably better at maintaining long-term glucose control.
Moreover, I fear that some investors may overstate the benefits of an inhaled insulin delivery system. It is true that there is substantial needle-fear in patients who are starting insulin therapy, but that fear disappears. As part of my consulting work, I have seen several surveys of diabetics (covering thousands of respondents) and there is a remarkable and consistent curve - those who have never injected are very bothered by the idea, but that fear and anxiety declines rapidly once they begin therapy and become accustomed to it. Consequently, there may not be as much commercial demand for the product as people think - particularly if doctors spend time with patients to ease their anxieties about injections.

It almost doesn't matter whether diabetic patients are afraid of needles or not.  If they are afraid, the doctor has a choice--have a long conversation on needles and the fact that the patient need not fear or simply give them a prescription for an inhaler from Mannkind.  Everyone understands inhalers...everyone has seen asthmatics using them....no fear, no discussion (assuming all else is equal).

For current needle using diabetics, life has gotten much easier with the pens that are available on the market.  They can carry them in a pocket and go to the bathroom to give themselves a shot.  With the inhaler form-factor, they no longer need to go to the bathroom to give themselves a shot...and if they do it in public, than, the form-factor itself provides no big advantages.

However, all else is not equal.  Afrezza has a faster response time compared to any inject-able insulin which reduces all kinds of risk for patients.  Thus, I would imagine doctors, once exposed to Afrezza would consider having a conversation with existing needle users (who are comfortable with needles) about Afrezza especially if those patients have trouble controlling their insulin levels...

Disclaimer: I am long on Mannkind.

Wednesday, October 20, 2010

How to add a new user in linux:

useradd -G {group-name} username
passwd username

Tuesday, September 14, 2010

Mannkind gets closer to partnership

Here are some quotes of Al Mann from the Transcript of Morgan Stanley Global Healthcare Conference – Sep 13th 2010 (the questions are mine).

Why didn't the deal happen last time?

Well, we were very close to a partnership last year in October. There was a question that affected the economics that we couldn't really answer without getting some more inputs from the FDA, since we're only a couple months from approval; it was decided to defer any further discussions. So last year we got the -- what we thought what was going to be an imminent approval. We had every signal that was going to be. But it turned out not to happen and then of course ended up with a complete response letter. But one of the interesting and important conclusions of the complete response letter is that the FDA raised not a single safety concern. And what's happened since then we have a fairly clear pathway to approval. And so that's attracted a lot of people.

Partnership talks ongoing now
So we've had a lot of people talking to us on the partnership. We had frankly more than we could handle we narrowed it down or it's just the narrow down I should take to about six, who are still talking to us, and we want to let them to reduce that to maybe three or four that's probably all we can handle as we move into negotiations, so to try to compete the partnership. Now that said the companies that we had been negotiating with last year probably could complete a deal with this in a matter of few weeks the others had been gone as far, so we take several months probably. PDUFA is only 3.5 months away so which comes first I can’t tell you.

Type of Partner
Well, we are not really very interested in companies who are in the insulin business.  The reason of course is because why would they want to cannibalize some of their key products.  I mean Novalog is the most important product for Novartis [Novo Nordisk] for example.  So they wouldn't be interested in promoting our products.  So they are not really good candidates.

But Sanofi-Aventis could use a rapid acting insulin, but on the other hand we think that AFREZZA will compete effectively against Lantus in earlier stage type-II diabetes.  So we have some reservations about those, but we feel that we should deal with someone who is in the diabetes market or at least in the metabolic and endocrine markets so that they have sales forces that are dealing with the physicians in the same areas as we -- in which we're interested.

Tuesday, August 17, 2010

MannKind announced two funding deals over the past week.  Below is my analysis of the situation.  My net recommendation is for current shareholders to stay invested in Mannkind and those who are considering it to wait a few weeks before investing.  This recent round of financing will allow Mannkind to stay solvent for a few quarters in 2011 and thus negotiate harder with a partner...it also probably means we won't hear about a partnership before the approval.


What does Mannkind Get 
  • $115 million cash from Bank of America / Merill Lynch in the form of convertible debt
  • 8% discounted shares to Seaside 88 (discount to previous two week average share price if & only if average share price > $6.50)
  • variable cash infusion from Seaside every two weeks equivalent to 700,000 shares at 8% discount on 2 weeks starting end of September
  • moving average iff price > $6.50. (at $6.50, that is $4.55M every two weeks or $9.1M every month for first 3 months until FDA announcement, or $27.3M/quarter until FDA announcement)
  • loan forgiveness for loans from Al Mann (at each share distribution every two weeks, same terms as Seaside but without discount)
  • Option to cancel deal with Seaside any time they would like...it is not very likely that this option will get exercised...the only time it would is if Mannkind receives a large up-front payment from a partner and the partner would not like to get diluted after partnership and thus forces Mannkind to exercise this option as part of the deal
  • Net: $142M by end of 2010, and an additional $81.9 in 2011 (this last part is not so relevant since if there is no approval and hence no partnership, it is unlikely that the share price will remain above $6.50 and hence that Seaside will invest any additional money).  This $142m will fund 3.5 quarters of operations assuming status quo on burn rate...or ensure the company has funds into Q1 2012. In the event that approval occurs as well as partnership, than they won't have as many cash issues and the additional funding will be a part of a larger funding pool (and this analysis won't be so relevant...)

What does Mannkind Give?
  • Convertible Notes (unpublicized convertion price)
  • 8,000,000 stocks also loaned to BoA for the purpose of shorting (allows them to Hedge their risk)
  • 18,200,000 shares to Al Mann in 700,000 share chucks every two weeks, min price $6.50 (I am assuming that Al Mann has the same lower limit option for the purchase as Seaside)
  • 18,200,000 shares to Seaside in 700,000 share chucks every two weeks, min price $6.50 

Other Notable Info:
  • Mannkind's burn rate is between $30M-$40M a quarter
  • Mannkind has cash until end of Q1 2011
  • Dec 29 is the FDA announcment date regarding the NDA for Afressa

Net Outcomes:
Bank of America / Merill Lynch

risk

nada ... shorted shares will probably cover their loan amount 

benefit

interest payments at a minimum from MannKind, upside - they succeed, and get a big payout when they convert (probably around 2015)
Al Mann

risk
  • nada...he already gave the loan to MannKind...he is not giving any more cash. there is less uncertainty now than there was when he made the loan. in any case, if the company goes belly up, its unlikely, he will recover any significant amount of money from the loan

benefit
  • great upside if the stock goes up
  • prevents Al Mann from getting diluted without spending money for the additional shares

Seaside

risk

a significant portion of their investment if MannKind does not succeed.

benefit

great if the FDA approves and they get to continue to buy at a discount for 8 months after the announcement.  If the announcement is positive, they get one week of a bigger than 8% discount on the price (because it is a 2 week moving average...and won't have moved much when the stock jumps on positive news).

Other investors

risk
  • 10% decline in stock price on day of second announcement if stock price doesn't recover. 
  • potential additional decline in stock price due to additional short positions (50% increase in shares shorted from 16M to 24M)
  • ~20% dilution (~70M shares outstanding...upto ~80M by end of year)...I am not counting 8 months of share purchases in 2011...as I hope that the FDA will approve the drug and stock price will jump...hence, the remaining 20M of additional shares will not result in reducing the size of the pie for other share holders

benefit
  • company stays afloat...Seaside cash infusion pays for most of Mannkind's cash burn
  • company has better negotiating position with potential partners...hence, better deal terms, and greater upside
My guess as to the future
We know that Al Mann wants to make 10x (or more) on his investment in Mannkind...so he is driving a really hard line with partners...considering that he didn't raise this money when the share price was at $10 means that he mis-calculated the amount of time it would take for partnership.  The seaside deal is designed so that he is not diluted...which is a sign that he remains confident in Mannkind.   It also means that he is going to continue to drive a hard line with partners...and in order to get to where he wants to get to...it may mean that Mannkind won't get a huge upfront cash payment but will get to keep a larger percentage of sales than would typically happen.
Investing in Mannkind is a gamble...but given Al Mann's record and the fact that he does not want to be diluted and the previous FDA announcement which pretty much means that he will get approval at the end of 2010 I would recommend that you stay invested and if you are not invested wait a bit and then invest.  We may see some additional price drop in the stock in the short term as additional shares are shorted.

References

http://finance.yahoo.com/q/ks?s=MNKD+Key+Statistics

http://finance.yahoo.com/news/MannKind-shares-fall-with-new-apf-1884617978.html?x=0&.v=1


http://www.fool.com/investing/value/2010/08/17/make-a-financing-deal-and-lose-10-nice.aspx


http://blogs.barrons.com/stockstowatchtoday/2010/08/17/mannkind-drops-on-convert-deal-financing-efforts-fail-to-please/?mod=yahoobarrons


http://messages.finance.yahoo.com/Stocks_(A_to_Z)/Stocks_M/threadview?m=tm&bn=25210&tid=128271&mid=128271&tof=12&frt=2

Saturday, May 22, 2010

Shaadi - Weddings

Its been quite a few years since I got married...I remember enjoying my wedding and not having to worry about anything at all--despite a guestlist of over 500 people and a 5 day wedding in a foreign country (India).  All this was possible due to my wedding planner (who is also my sister).  She has just started a blog...check it out if you have decided to tie the knot!  (Miss Indian Bride -- all about Indian weddings)

Saturday, April 17, 2010

Human Rights Watch

Human Rights Watch(HRW) is a well known NGO that claims that "The hallmark and pride of Human Rights Watch is the even-handedness and accuracy of our reporting". This is not reflected in its agenda regarding Israel and the Arab-Israeli conflict nor is it reflected in its agenda regarding India or Hinduism.

Human Rights Watch is a New York based NGO that is funded mostly by institutions, foundations, and large individual donors. While 75% of HRW’s funds come from America, their funders include rich members of the Saudi family who are linked with the Saudi Arabian government.

The NGO is known for bias as well as false reporting. For example, in 2006, HRW put out a report saying that Israel took potshots at Lebanese civilians waving white flags. Israel later produced documents and videotapes showing that the "civilians" waving white flags were Hezbollah soldiers launching missiles. But as of 2008 the report is still being cited in academic dissertations under headings like "8.1.1 Possible war crimes committed by Israel." Similarly, in the report “Compounding Injustice,” HRW state “Forensic evidence suggesting that the train was set on fire from the inside, and not by the Muslim mob outside, has not found its way into the investigation.” However, this is in direct conflict with eyewitness reports (pg. 14 of the Tewatia report).

A closer examination reveals extensive and systematic bias exists in HRW reports on human rights and communal violence in India. The most glaring defect of HRW reports is the lack of concern for the rights and lives of Hindus. Incidents of communal violence in which both Hindus and Muslims were involved in and share the blame for are portrayed as one-sided attacks by Hindus against “innocent minorities.” Human rights abuses against Hindus are ignored or downplayed compared to attacks against other religious groups. The 1999 report on attacks on Christians goes a step further as it demonstrates hostility to the Hindu religion itself. Rather than attempting to provide an objective assessment of communal violence and human rights practices in India, HRW's reports are written with the intent of waging political warfare against the BJP and the Sangh Parivar. HRW's reports on India are frequently filled with many distortions, half-truths, and outright false statements. The nature and the extent of bias are such that it is not the result of mere negligence, but systematic bias that reveals political motives.

Instead of spending time to research the contents of their reports and talking to the people involved, they often rely on news paper reports which are them-selves biased and often wrong. This is combined with information from people with questionable associations—ie John Dayal, a notorious Christian demagogue and Teesta Setalvad who cooked up incidents of killings and violence and falsely accused then Gujarat police chief P C Pandey of encouraging mob violence during the Gujarat Riots. She also coached 22 witnesses and had them submit identical affidavits before various courts relating to riot incidents according to the Special Investigation Team appointed by the Indian Supreme Court.

Due to the history of spreading poorly researched reports, biased opinions, and false accusations, reports by Human Rights Watch and its analysts cannot be trusted to bring a balanced portrayal of the state of Human Rights in India.

References:

“Compounding Injustice”, Human Rights Watch, http://www.hrw.org/en/node/12314/section/6

Bahl, Arvin. “Politics By Other Means: An Analysis of Human Rights Watch Reports on India,” South Asian Analysis Group, http://www.southasiaanalysis.org/%5Cpapers9%5Cpaper891.html

“World Report 1999,” Human Rights Watch, http://199.173.149.120/worldreport99/asia/india.html

Ceren, Omri. “Human Rights Watch Earns Their Saudi Pay, Publishes Another Thinly-Sourced Report Demonizing Israel”, http://www.mererhetoric.com/archives/11275819.html

NGO-Monitor, “Human Rights Watch,” http://www.ngo-monitor.org/article/human_rights_watch_hrw_

Human Rights Watch. “Politics by Other Means: Attacks on Christians in India”, 1999

Mahapatra, Dhananjay. “NGOs, Teesta spiced up Gujarat riot incidents: SIT,” Times of India, August 14,2009, http://timesofindia.indiatimes.com/articleshow/4396986.cms

Jha, Suman K. “SIT report on Teesta”, Indian Express, Aprili 23, 2009,

Mehta, Pratap Bhanu. “An Unconscionable Act,”, Indian Express, April 15, 2009, http://www.indianexpress.com/news/an-unconscionable-act/447301/

“Gujarat riots: SIT says Teesta's charges false,” IBNLive, April 14, 2009 http://ibnlive.in.com/news/gujarat-riots-sit-says-teestas-charges-false/90200-3.html

Sunday, March 07, 2010

Optimizing Hindupedia load times -- (mediawiki on GoDaddy)

Optimizing Hindupedia seems like an uphill task. There is not alot that works on GoDaddy shared hosting and GoDaddy performance varies by the time of day because they run thousands
of domains on a single server.



Webpagetest.org is your best friend. It gives commonly missing optimization tips--like you should enable browser caching, use minify to compress/combine your css & js files, enable gzip compression to reduce transfer times, etc.

Here is the original test result I received before I began this process:



Note: unless you want to rewrite mediawiki, you can't combine all the css/js files. I did, however, make some optimizations (ie combine css files) for the skin we are using, GuMax (into 3 bundles of 2 skins each)...I also didn't want to spend a lot of money on a CDN...since this is a non-profit site with no money at this point.

I did all of this, but still saw poor performance. Than, I started digging some more.


After all of this, I got the following results:


Modifying LocalSettings.php

The next step was to look at the LocalSettings.php for mediawiki to see if there was anything that could be done there...one of them was to add the minify extension to ensure all js/css got minified.

#Add Minify--which strips extra stuff from css & js files to make them smaller
require_once("$IP/extensions/Minify/Minify.php");

#use ETags to facilitate caching at intermediary layers & the browser
$wgUseETag=true; /* default: false */
#server to send pages in to the browser in a compressed format
$wgUseGzip=false; /* default: false */
#cache sidebar ...
#$wgSidebarCacheExpiry = 86400s /*default*/
$wgEnableSidebarCache = true; /* default: false */
#enable client side caching
$wgCachePages = true; /* default: true */

#ParserCache
#$wgParserCacheType = CACHE_ANYTHING;
$wgEnableParserCache = true; /* default:false*/
#$wgMainCacheType = CACHE_ANYTHING; /* default: CACHE_ANYTHING */

# Enable the basic file cache for static pages for non-logged-in visitors
$wgUseFileCache = true; /* default: false */
$wgFileCacheDirectory = "$IP/cache";
#$wgFileCacheDirectory = “/home/.author/leedh/lee.org/[my temp folder]“;

#default is 1, changing to a higher number will be a little bit
# nicer to the database
$wgHitcounterUpdateFreq = 100;

I also took a close look at the extensions I had installed and commented out extensions that were specifically for administration in order to reduce load times since they aren't useful for anyone but me (I am the only admin). Keep in mind that every extension is run every time a page is loaded.

Also, keep in mind that $wgUseFileCache turns on file caching--and this cache never gets invalidated. All pages on Hindupedia are dynamic (atleast the random page list in article footers) which was designed to optimize SEO (trick google/et al to think that the page had changed). Thus, the cache works against this and must be deleted at least once a day or two to make the pages change.

PHP/MySQL Optimization
PHP optimizers like apc can't be installed (no make/gcc). There are no details on how to effectively use the zend optimizer that godaddy provides. Also, I found ways to optimize MySql, but GoDaddy refused to implement any of those requests.

GoDaddy tech support is useless
I also spent an hour on the phone with GoDaddy to see if they would be willing to do anything to help...(this was after failing to get any sort of coherent answer over their email tech service...where they would get stuck at the give me a trace route and than give me a "standard" traceroute since the first one I sent was a formatted output!).

On the phone, I escalated beyond the first level tech support which was completely useless. I emailed the 2nd level support person the latency graph from google webmaster tools:


and the second level person promised to have the site monitored for 24 hours...well, Hindupedia performed really well during that 24 hour period, than then slowed down once again...

.htaccess optimization
One of the things I noticed in the webpage performance graph is that the time-to-first-byte for http://www.hindupedia.com/ was exceptionally long. Especially, since the only thing that happens here is that .htaccess is read and forwards the user to http://www.hindupedia.com/en/Main_Page. So, the next step was to see what I could do to optimize my already simple .htaccess file...

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Options -MultiViews

RewriteEngine On

rewritecond %{http_host} ^hindupedia.com [nc]
rewriterule ^(.*)$ http://www.hindupedia.com/en/Main_Page [r,nc]

RewriteBase /
Rewritecond %{QUERY_STRING} title=(.*)
RewriteRule ^hindupedia/en/index.php(.*)$ eng/index.php?title=%1 [R]
RewriteRule ^hindupedia/en/(.*)$ eng/index.php?title=$1 [L]
RewriteRule ^hindupedia/$ eng/index.php?title=$1

RewriteRule ^hindupedia/urllist.txt$ yahoo_sitemap.php

RewriteBase /
RewriteRule ^hindupedia/(.*\.(css|js))$ min/index.php?f=$1&debug=0 [L]

Header set Cache-Control "max-age=2592000"


I had a really hard time to figure out why the above .htaccess file is slow. I decided to reduce the code as much as I could and hope for the best. In this process, I came across two really good reference sites for optimizing .htaccess (or really learning what the various components mean).
Using this, I ended up with the following as my .htaccess

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

#AddHandler application/x-httpd-php .css
#php_value auto_prepend_file gzip-css.php
#php_flag zlib.output_compression On


Options -MultiViews
RewriteEngine On
RewriteBase /

# 301 redirect from base site for SEO
rewritecond %{http_host} ^hindupedia.com [nc]
rewriterule ^(.*)$ http://www.hindupedia.com/en/Main_Page [r,nc]

# redirect a base address to the main page
RewriteRule ^hindupedia/$ en/Main_Page [R=301]
#RewriteRule ^hindupedia/$ eng/index.php?title=Main_Page [R]
#RewriteRule ^hindupedia/$ eng/index.php?title=Main_Page

#redirect from base to en/ type of framework
#RewriteBase /
#Rewritecond %{QUERY_STRING} title=(.*)
#RewriteRule ^hindupedia/en/index.php(.*)$ eng/index.php?title=%1 [R]
RewriteRule ^hindupedia/en/(.*)$ eng/index.php?title=$1


#Rewritecond %{QUERY_STRING} .
#RewriteRule hindupedia/en/index.php(.*)$ /eng/index.php?title=%1 [R]

#created symlink to file instead
#RewriteRule ^hindupedia/urllist.txt$ yahoo_sitemap.php

#rewrite css/js files to send them through minify
#RewriteBase /
RewriteRule ^hindupedia/(.*\.(css|js))$ min/index.php?f=$1&debug=0 [L]


Header set Cache-Control "max-age=2592000"

I left most of the old code commented out as I wasn't sure how this would work out...
Also, instead of using .htaccess to link my yahoo_sitemap to urllist.txt, I ssh'ed into my godaddy account and created a symbolic link: ln -s yahoo_sitemap.php urllist.txt

That way, I didn't need to do it in my .htaccess .

I don't know why these things were causing .htaccess processing to be so slow, but I saw a dramatic improvement after these changes.


You will notice that time-to-first-byte for http://www.hindupedia.com/ has significantly decreased. I believe that the overall latency increase is due to GoDaddy's inconsistent performance.

MediaWiki Maintenance

Lastly, I sshed into my GoDaddy account (allowed even in shared hosting...just needs to be turned on). Under the maintenance dir, there are a bunch of php scripts. I ran two of them...

/usr/local/php5/bin/php rebuildall.php

Somewhere, during the execution of the above script, php gets killed (probably takes too much cpu time). For me, it died during the running of refreshLinks, so I ran that maintenance script and had it pickup where the first script got killed

/usr/local/php5/bin/php refreshLinks.php 300

The result is promising (but not absolute since there is too much variation due to GoDaddy's hosting)...



Conclusion

All of these optimizations seem to have helped performance. However, they are minor in relation to GoDaddy's inconsistent performance...in the middle of these optimizations, Hindupedia simply stopped loading (ie timed-out) and later, had load times of over a minute. Than, an hour later, came back down to reasonable load times...

Moving mediawiki to another host is something I don't have the time or patience to do right now...so that will be for another day. however, for those looking to find a host for MediaWiki, I would recommend that you don't do it at GoDaddy.

Thursday, March 26, 2009

DIY: Converting a computer Power Supply to a lap power supply for other things

I had picked up a car amplifier a while ago and found that I had an extra speaker (Polk Audio) that is a different brand than my stereo system (Boston Acoustics). So, I couldn't add it to my stereo--so I decided to build an extra speaker/amp combo that I could than plug into something else at somepoint in the future.

The only thing missing was a power supply.

I bought a 1U power supply from an electronics store for $12.50 because I liked the slim profile and the 12V had a output of 12A. My amp required 88 watts, so this can satisfy that requirement.
According to its label, the Orange wire was for "Power" and Green was for "R/C" or remote control. Both of these had to be shorted to ground/negative (Black wire).

I also needed a load to get it to turn on--I plugged in a harddrive (that doesn't work anymore). This provided the load. Plugging in the power into the 12V output into the amp and the amp into the speaker -- and it worked!

Next, to replace the dead harddrive with a 10 OHM 10 watt resister...



DIY: Digital Photo Frame (update 2)

I disassembled the screen removing it from its original frame--to do so, I had to remove the stickers that hide the screws. Than, pull off the metalic front that was glued to the actual LCD.

I recently finished the DPF. I bought a 12x13 frame and had a matt cut with just a half inch on each side showing. I pasted the matt to the screen using contact cement.

I decided not to disassemble the frame of the rest of the laptop since the side of the plugs cannot be shortened. So, the overall space is not reduced by much if you remove the case. Also, it doesn't leave any of the circuits exposed.

With the frame assembled, it was easy to stand straight up (like an unassembled laptop).

Sunday, March 15, 2009

DIY: Digital Photo Frame (update 1)

I just found out that the picasaweb-download script doesn't work anymore. The folks at google have made changes that broke this bash script.

Unfortunately, I don't know enough bash to get it to work. The other scripts I found on the net (in perl picasa module and another that requires xmlstarlet) both don't work because I couldn't get their dependencies to install on dsl.

If anyone has more luck let me know. I am going to give up on the picasa integration for the time being.

Thursday, February 05, 2009

I am tired of hearing about the incident at Malegaon.  How about more relavent (and life-threatening) issues of greater concern get more airtime?

For those short on imagination...here is a short list (this list covers a random subset of things that happened in the last month).
  • Weekly stone throwing at police incidents in Kashmir
  • Maoist Violence (killing of police, people, economy (regular bandhs)).  They operate in 182 districts of India!
  • Roadside blockades: Lalgarh area in West Bengal by a "resistence" group in support by naxalites
  • government control of temples in a secular india?!
  • a rape of a 2 year old! (what kind of mentally broken man rapes a toddler?!)
Are these things not deserving of media attention?  They are all likely to get them the attention of viewers and are equally (if not more) sensational?

I propose that everytime some stupid news item happens and gets reported on, we blast the media outlets with requests for coverage on other more relavant and interesting (and equally sensational) topics...

Wednesday, November 26, 2008

DIY: Digital Photo Frame

I decided to convert my old Compaq Evo N610c into a digital photo frame as it hasn't been used in over a year...and the battery died a long time ago. I bought a D-Link AirPlus wireless card since it seems to be using the Atheros chipset which is well supported by DSL (using the madwifi driver).

The first & most important part was setting up the software. This post will discuss the software in detail and future posts will document the hardware transformation.

After exploring for a bit, I decided to use the McDPF package (it is the most complete package I found) which installs over Linux...and hence, there are no software costs as well. In addition, I didn't like the fact that McDPF can either display photos off of the harddrive or through frame channel but not both at the same time. Thus, I encorporated a script named 'picasaweb-download' which I found online so that the photos can be downloaded and displayed in line with the rest of the photos. I also extended the web interface so that the picasaweb-download script can be run and configured through the web interface.

The problem, is that it did not work out of the box by following all the install instructions. After debugging for a while, I finally got it to work.

The first step is to install "Damn Small Linux" (I used version DSL v. 4.4.10) as per McDPF installation page. DSL v 4.2.5 does not support WPA out of the box.

Once I rebooted and had the restored files from the USB stick, I needed to change quite a few files to get McDPF to install for me and than to add the options that I needed. I couldn't find a way to check in my changes on source forge...so you can download them here. These changes are described below.

To make this all work, download the files in the link to the following locations:

replace mcdpf_setup.sh (in /home/dsl)
upload picasaweb-download to /home/dsl/frame/scripts/
upload run_picasa.pl to /home/dsl/frame/scripts/
replace process_commands.php (in /opt/lampp/htdocs/frame/)
replace basics.php (in /opt/lampp/htdocs/frame/)
upload picasa logo to /opt/lampp/htdocs/frame/images/logos/picasalogo.jpg
upload picasa.php (in /opt/lampp/htdocs/frame/)

My Changes (in detail)

I had to comment out lines 181 & 182
search for the line that had 'Dir::Etc::SourceList' . There should be two of them on lines 181 and 182.
comment them out (put a # in front of them)
and insert the following below them
apt-get -qq -y update
apt-get -qq -y install feh

the first time I ran mcpdf_setup.sh, I got a few errors...so I said 'n' to the reboot question. It did, however, setup my wireless networking, which let me fix the errors.

search for the line referring to pear (there should be two of them for installing Weather Services and a XML Serializer). insert the following line before them:
/opt/lampp/bin/pear channel-update pear.php.net

on line 192, there is a line wget ... for xampp. prior to that line, insert
rm xampp*


edit /etc/apt/sources.list
delete its contents and insert the line
deb http://archive.debian.org/debian-archive/debian woody main contrib non-free

right click / tools / enable apt

run mcdpf_setup.sh

change hostname to what you want (default is box)
edit the file /etc/hostname (as root) and change the hostname to whatever you want

Change the lampp settings so that it is more secure--and the lampp documentation doesn't show up when you go to the frame via a web-browser.

run: /opt/lampp/lampp security
(use the following options: no password, disable mysql, disable xampp pages)

than restart lampp via: /opt/lampp/lampp restart

Download URI-1.37.tar.gz from http://search.cpan.org/~gaas/URI-1.37/URI/Escape.pm
tar -xvzf URI-1.37.tar.gz
sudo mv URI-1.37/URI /usr/lib/perl/5.8.0

Lastly, I needed to edit the crontab in order to make it download photos from picasa every day. The lines I added were:

# Download pictures from picasa
00 7 * * * /home/dsl/frame/scripts/run_picasa.pl

Finally, the files

upload picasaweb-download to /home/dsl/frame/scripts/
edit process_commands.php (in /opt/lampp/htdocs/frame/) to add commands for picasaweb-download
edit basics.php (in /opt/lampp/htdocs/frame/) to add page for picasaweb-download
upload picasa logo to /opt/lampp/htdocs/frame/images/logos/picasalogo.jpg so that the picasa page looks consistant
create picasa.php (in /opt/lampp/htdocs/frame/) so that the picasa page actually works
upload run_picasa.pl to /home/dsl/frame/scripts/ (this is a wrapper script around picasaweb-download that parses multiple user names from the preferences file and than calls picasaweb-download for all of them)

download these modified files from here.

Getting the Powerbutton to work
My laptop has 2 power buttons. A push button and a slider button. By default, neither button does anything...

It turns out that you need to start the acpi daemon in order to receive these events.

sudo /etc/init.d/acpid start

That enabled the sliding switch to reboot the computer and the push button still did nothing.

I saw the following entries in my /var/log/acpid

[Sat Nov 29 14:38:16 2008] starting up

[Sat Nov 29 14:38:16 2008] 4 rules loaded

[Sat Nov 29 14:39:13 2008] received event "button/sleep C19B 00000080 00000004"

[Sat Nov 29 14:39:13 2008] completed event "button/sleep C19B 00000080 00000004"

[Sat Nov 29 14:39:37 2008] received event "button/power PWRF 00000080 00000002"

[Sat Nov 29 14:39:37 2008] executing action "/opt/acpi/actions/powerbtn.sh"

[Sat Nov 29 14:39:37 2008] BEGIN HANDLER MESSAGES

Saved mixer settings to '/home/dsl/.umix'



Broadcast message from root Sat Nov 29 14:39:38 2008...



The system is going down for reboot NOW !!

MurgaLua Version 0.6.8 (http://www.murga-projects.com/murgaLua/

MurgaLua FLTK bindings: Copyright 2006-8 John Murga, GPL license.

Warning: FLTK bindings is a subset of the full MurgaLua environment.

ls: .xtdesktop/*.lnk: No such file or directory

No Icons Found.

[Sat Nov 29 14:39:38 2008] END HANDLER MESSAGES

[Sat Nov 29 14:39:38 2008] action exited with status 0

[Sat Nov 29 14:39:38 2008] completed event "button/power PWRF 00000080 00000002"

Which is good progress. After the reboot, I created /opt/bootcustom.sh with the following entry

#!/bin/bash

# start acpid
/etc/init.d/acpid start


this makes acpid start automatically at boot

Instead of rebooting, I wanted the powerbutton to do a clean shutdown. To do this, edit /opt/acpi/actions/powerbtn.sh and change the last line from

/usr/local/bin/exitcheck.sh reboot to

/usr/local/bin/exitcheck.sh shutdown


Sleep Button
Create /etc/acpi/events/sleepbtn with the following contents:
# /etc/acpi/events/sleepbtn

# This is called when the user presses the sleep button and calls

# /etc/acpi/sleepbtn.sh for further processing.



# Optionally you can specify the placeholder %e. It will pass

# through the whole kernel event message to the program you've

# specified.



# We need to react on "button power.*" and "button/power.*" because

# of kernel changes.



event=button[ /]sleep

action=/opt/acpi/actions/powerbtn.sh


so that it will work like the power button does.

Reduce Power Consumption
I edited /opt/acpi/actions ac_adapter.sh and made it the same as battery.sh since a 2 Pentium 4 is overkill for a DPF...we can step down the CPU and it will still be fine...and will save some electricity.


Disclaimer
I have tried to write about all the steps I took to get this to work. In the progress of getting this up and running, i had to try many different things and sometimes go backwords...so if I have gotten anything wrong...feel free to comment and I will help as best as I can.

Sunday, February 03, 2008

I am working on building a Hindu Encyclopedia since this type of resource doesn't exist today. The ambition for this is quite large--to cover everything w.r.t. Sanatana Dharma from philosophy to history to culture to engineering. If you would like to help in any way, please reach out to me.

Monday, January 22, 2007

Sri Sathya Sai Baba meets TN CM M. Karunanidhi

This is great news. By joining hands with a known Hindu-baiter and Hindu-basher, Sri Sathya Sai Baba has forced the other to make a public statement to the fact that Sri Sathya Sai Baba is to be respected and indirectly showed respect to all Hindus. I believe that Sri Sathya Sai Baba has decided that a change of strategy was needed in engaging with these Hindu baiters and hence this new form of engagement.

Over the last few decades, Hindu swamis and mahatmas have decided that politics is not something they should be involved with. They wanted to focus on saving Hindus through spiritual and social work. However, at every step, politicians with their anti-Hindu (and often pro-Christian and pro-Muslim) stances have tried to stop them. Everything ranging cease and desist orders to arrests has been tried. Muslim and Christian groups however have a very pro-politics stance and are not afraid to manipulate our politicians to get their way. We can see the impact of that with the pro-minority, anti-majority stance politicians in India take today.

Sri Sathya Sai Baba has taken the first step to engaging with this group in order to manage them and to change this trend. Further, this type of engagement and mutual endorsement will slowly lead to the creation of the concept of a Hindu votebank organized by Hindu sect. What would Karunanidhi do to get the votes of all of Sri Sathya Sai Baba's followers in Tamil Nadu? Further, it now becomes more difficult for Karunanidhi to bash Hindus if he says that he respects Sri Sathya Sai Baba since he would be indirectly bashing Sri Sathya Sai Baba.

If our other leaders follow up with more engagements, we may be able to change the anti-Hindu stance of Indian politics.

Article on Money Control
Article on Chennai Online