Thursday, December 5, 2013

The Ultimate/Best cyrptocurrency.

Structure of text --
0) feature -- Analysis/reasoning (importance score of the feature out of 10)
FAQ -
    A) Reason 1
    B) Reason 2
    C) Reason 3
    ...
    Z) ...

1) energy efficiency -- In the long run, it should not waist energy by unlimited mining. (2)
FAQ -
    A) Limited coins will not solve it.
        This's partially true. Miners will compete for TX fee.

2) Stability in prices -- Cryptocurrencies are not commodities. It's designed to be spent and a medium to receive payments from. If a cryptocurrency is not that, it's basically a pump and dump scheme.

Actually if you see for a fair cryptocurrency which is not seen as an investment, there should be a little bit inflation, cause that way people will not hold on to it like investment; instead they'll use it to buy investments like shares and gold -- which is something to be seen as an investment.

In terms of stability of prices, cryptocurrencies are better candidates cause it's something global -- no Forex is involved here. So one of the major strengths of a cryptocurrency compared to the national currency is it's stable non-volatile price. (10)
FAQ -
    A) Limited coins supply is not that good for stability, neither is long term mining of coins.
        The lost coins will increase the prices (instability in prices -- not desired; this'll happen cause Bitcoins are more rare). People will continue to loose they same way they continue to loose data.

        Coins with limited but long term supply by mining (like for 6 years or a above) will have inflation for a long time (till all coins have been mined). Will people wait for this much time for it's prices to stabilize? Or will they quit for their national currency? The prices will increase cause of it's popularity + lost coins, and decrease cause of mining activity; agreed these variables will stabilize it's prices for the decade while it's being mined, but there're just too many variables involved; it's like shares, there's a risk from what news comes about the cryptocurrency, and then there's the mining. If it's good news, mining will help stabilize prices, if it's bad then prices will crash faster than expected.
       
        I may seem like targeting Bitcoins -- but it has an advantage cause, cause it's the first cryptocurrency, people have not yet realized it's disadvantages and it may just happen that by the time it's disadvantage is realized, the inflation will be very low; but still there's the lost coin problem.
       
        The currency should try to reduce the factors it's price depends on in the technical front so as to reduce the variables on which it's price depends on.
       
        External factors will always vary the price of any cryptocurrency regardless of the technicals. External factors also includes initial demands of a new coin.
    B) Unlimited coin supply may also be bad.
        With more coins mined at a high rate, prices will decrease cause of more fresh supply.
       
    C) Proof of stake is not good.
        It encourages holding the coins as investment, avoiding it's circulation, i.e. true use as a cryptocurrency. Then worst -- PoS looks at the coin age; the longer you're holding a large amount of cryptocurrency, the higher the chance of mining a block, which further reduces chance of circulation. However if the profits proof of stake is giving you is negligible, then we may nullify this disadvantage.
       
    D) Limited inflation is ideal.
        Mining should not die; it should be done to recover from lost coins (i.e. there should be inflation). After all coins have been mined (in a relatively short period of time), the coins made per unit time should be enough to maintain the prices. Compared to the same amount of inflation provided by PoS, PoW provides higher increase in difficulty and better return rate than PoW for the reasons stated in 3) B).
       
        Even real currency have an inflation problem and it's usually quiet a lot. Actually it depends on the country. But do people have problem with that?
       
        If they did not like their current currency, they always had options. They whould've chosen fossil fuels anytime (who's value will always increase); the reason why they didn't is cause the inflation of national currency is negligible for them cause they use the national currency to spend, rather than invest and hold.
       
        So inflation rate of the crypto should be at par with inflation rate of real money.
       
        I took into considerations the following data. The average was take out for the last 20 years and excluding outliers and removing inflation about 100%
       
        http://www.coinnews.net/tools/cpi-inflation-calculator/ 3% (USD)
        http://www.measuringworth.com/ukcompare/relativevalue.php?use[]=CPI&use[]=NOMINALEARN&year_late=1994&typeamount=100&amount=100&year_source=1994&year_result=2014 4.535% (British pound)
        http://www.thisismoney.co.uk/money/bills/article-1633409/Historic-inflation-calculator-value-money-changed-1900.html 3.6805% (British pound)
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=GBP&INDICE=UKCPI2005&DD1=10&MM1=06&YYYY1=1994&DD2=10&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 2.65% (British pound)
       
        http://www.inflation.eu/inflation-rates/china/historic-inflation/cpi-inflation-china.aspx 4.5% (Yen)
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=CNY&INDICE=ZHCPI1994&DD1=10&MM1=06&YYYY1=1994&DD2=10&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 4.04% (Yen)
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=CNY&INDICE=ZHCPI1994&DD1=10&MM1=06&YYYY1=1994&DD2=10&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 4% (Yen)
       
        http://www.rba.gov.au/calculator/annualDecimal.html 2.7% AUD
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=AUD&INDICE=AUCPI1990&DD1=10&MM1=06&YYYY1=1994&DD2=10&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 3.9265
        http://meercat9.com/calc/inflation.php 2.56 AUD
       
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=EUR&INDICE=EUCPI2005&DD1=11&MM1=06&YYYY1=1994&DD2=11&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 2.3% (Euro)
        http://www.lawyerdb.de/Inflationrate.aspx 1.7 (euro)
        World bank 3% (Euro)
       
        http://www.inflation.eu/inflation-rates/japan/historic-inflation/cpi-inflation-japan.aspx 0.013% (Yen)
        http://www.measuringworth.com/japancompare/result.php 0% (Yen)
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=JPY&INDICE=JPCPI2010&DD1=11&MM1=06&YYYY1=1994&DD2=11&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 0.235% (Yen)
       
        http://www.inflation.eu/inflation-rates/brazil/historic-inflation/cpi-inflation-brazil.aspx 7.29 (Real)
        http://data.worldbank.org/indicator/NY.GDP.DEFL.KD.ZG?page=3 7.78 (real)
       
        World bank 19.75 (RUS)
        http://www.inflation.eu/inflation-rates/russia/historic-inflation/cpi-inflation-russia.aspx 17.4 (RUS)
       
        http://fxtop.com/en/inflation-calculator.php?A=100&C1=INR&INDICE=INCPI1958&DD1=11&MM1=06&YYYY1=1994&DD2=11&MM2=06&YYYY2=2014&btnOK=Compute+actual+value 15.747 (INR)
        http://www.inflation.eu/inflation-rates/india/historic-inflation/cpi-inflation-india.aspx 7.4 (INR)
        World bank 6.6
       
        World bank inflation rate world since 1992 -- 39%
        Average excluding outliers calculated 5.67
       
        So inflation between 5-6% will not have any impact on stability in prices score, above this value will give almost, if more than 7%, half, more than 9% means partial, more than 10% means no points on this front.
       
3) 51% attack protection -- There should be some means to prevent a 51% attack. (10)
FAQ --
    A) GPU mining is the answer.
        The best 51% protection is provided by a GPU coin, so only full blown computers can compute it, and one doesn't have to buy special purpose hardware. The hardware will be useless otherwise and after all coins have been mined (unless the incentive to mine is still up and maintained in some way like unlimited coins or high transaction fee), the miner will actually throw it away or sell it to someone else (who may be a cracker who's accumulating firepower for bad mining). This is not true for GPU hardware, cause they have a gaming and general computation purpose apart from mining, and probably the miners will themselves use it in gaming, so even after the mining incentive is lost, the hardware wont be sold cheap, and an attacker cannot buy them cheap.
       
        With new ASIC hardware, mining efficiency will increase; the new miners of the new hardware will start accepting transactions of lower transaction fees making the old hardware redundant cause they take more electricity. They will be sold cheap cause of this reason (lower profit margins or even losses).

        For an attacker, electricity cost is not of a concern, cause the attack time will be limited; he's going to earn money by making false transactions in blocks he mined.
       
        Yes -- the old hardware is old generation, but that doesn't mean it'll be slower.
       
        New hardware will not focus on higher hash rate, but power consumed per hash rate, thus, hash rate of new hardware may not increase exponentially making the network more vulnerable to attacks with older hardware.
       
        I'm not sure about the architecture of ASIC miners to comment on that. It's not an ARM processor which can be made faster by simply by increasing the clock speed. Modern AMD and Intel processors are not 4xPentium/athlon 64 @6GHZ. So an improvement in architecture does not necessarily mean faster speeds, it may have been done to reduce electricity consumption by half. Look at mobile processors for instance; they are more efficient than their Desktop (per Whetstone and dhrystone score) counterpart but slower.

        We just may have a similar trend for ASIC miners. Same consumption in electricity@little less hashing power.
       
        This's still worst for small alternative cryptocurrency using the same hashing algorithm. They're easy to exploit cause of low difficulty.
       
        If the algorithm is complex and unique, it'll need a LOT of R&D, the hardware will be expensive and insanely hard to make. It'll require a well funded team which only large organizations can afford and that too cost recovery will be from mining + selling of hardware not just by mining or attacks (where the price of cryptocurrency will drop resulting in a loss of the cracker cause he has to exchange a lot of coins in a small amount of time in order for it to be profitable). It'll take years to make such special purpose hardware; buying GPUs is cheaper. In contrast sha256 is way too simple and that's why making special hardware for was comparatively easy.
       
        CPU mining has a major disadvantage -- there's a lot of CPU power (not GPU power or control over special purpose hardware) in the hands of Botnets; under control of a cracker, he may have 51% hashing power for a small amount of time. But people are moving away from their virus-infested Microsoft Windows Desktop/Laptops to Android tablets and phones. So feasibility of such an attack is questionable, but still as of the current time botnets are big. Another disadvantage is that if an attacker uses CPU power of a system all the time, the owner will grow suspicious and reformat his Windows computer, but that wont be a problem for a short term to do a 51% attack; but one thing's for sure, the power of botnets to mine on a regular basis will be very limited cause most people own and work on laptops. Apart from this, if someone is wanting to do a 51% attack on a CPU only crypto, his best shot is to buy a lot of VPS for a short period of time; and then it's to be noticed that CPU is something owned by everyone, graphics card and ASICs are not. So expect the difficult to be high cause a lot of people will be mining it. People easily buy a more expensive CPU cause it's generally useful, not only for mining which's the case with ASIC and partially with Graphics chips (in case the miner is not a gamer or not using GPGPU for other purposes). So the crypto mining power will be more in the hands of the common people. It's also to be seen that the cost of VPS is mostly for the bandwidth available, not the CPU. The CPU model is not give in the most of the cases, giving a high risk factor. Also VPS cannot be sold off. So the attackers profitability relies completely by selling the coin who's price may decrease rapidly after the attack. Then check pointing makes things more difficult for him. But compared to GPU -- as of the current time, there's no one who lends GPUs. So the only way to attack a GPU coin is to buy GPUs which's the most expensive.
       
        GPU only mining will increase rating by 1. Anything below this (even CPU/GPU hybrid) will not add any points.
        B) Unlimited mining.
            Unlimited mining will sure shot prevent a 51% attack; however it's not known if mining profitability will increase or decrease in the future. This combined with CPU only mining will make an artillery against 51% attacks, however in this case (i.e in the long run), the algorithm being CPU only is highly questionable.
           
            If almost all coins have already been mined and if there's limited mining of coins forever (like with 2) D)), then the incentive to mine will neither be high or low. If the coin is CPU only (i.e. complex hashing algorithm), then there'll be less initiative to make exclusive mining hardware, cause all coins have already been mined on the CPU. This's going to prevent a 51% attack further. Then people pool mine, they'll use their free CPU cycles to earn a little bit of money driving the difficulty up, further reducing the chance of an attack. This is very likely to happen cause everyone known they got a CPU, everyone has and there's no harm in using it to earn a little bit of money for almost no electricity cost (65W). So difficulty will be up, and still there'll be no incentive to make new mining hardware. 5-6% inflation will be ideal for the purpose. Anything above this value will not improve this rating, below 5% will reduce ratings.
           
            An advantage as compared to PoS for the same inflation rate is that, cause less no. of people will be mining via PoW as compared to PoS (cause PoW requires investment in electricity cost, and hardware), the distribution of the inflation rate will be limited to less no. of people making the amount profit via the limited inflation rate more significant. This can be seen practically. For popular alts, the hashing power is more distributed cause the difficulty is low and profitability is high. Overtime, more people come up to mine the coins many of which are large professional miners and as the difficulty rises profitability falls reducing the no. of small time miners (cause profit is not significant anymore -- low profit margin), but the large professional miners persist (low profit margin, but higher hashing rate means more $$$s for a small % margin), increasing profitability for them. Of course the no. of miners also depends on the popularity of the crypto; but given the same popularity, we see this trend.
           
           
        C ) Proof of stake adds vulnerabilities.
       
            Following this article --
           
            https://bitcointalk.org/index.php?topic=604716
           
            A higher degree of PoS means more vulnerabilities. PoS coins will not get any score in 51% protection.
           
            Apart from this, you need to run a full node in order for the wallet to mine blocks based on PoS and it should be up always; how many people will do that? (especially when the interest rate is low)? When these coins will be made popular, 90% people will run light weight wallets giving power to the hands of these 10% (PoS difficulty will be low in this case cause the no. of people mining is less). Yes it is true, like with PoW the distribution of mining power will shift towards more professional miners who'll hold large amount of coins, but if the interest rate is low, they rather sell their coins to invest in real world schemes which provides more profits than this crypto, as an advantage they'll have lower risk cause the crypto market is very volatile.
           
            In case of PoW, power will may be in the hands of 5% (lower no. of people than PoS) but they'll have a lot of hashing power which if compared to the amount of coins held by these 10% is a much higher value increasing the difficulty in comparison to PoS, which results in higher comparative difficulty for PoW.  As compared to PoW, acquiring enough coins to do a 51% is easier (at these low difficulty and especially when interest rate is low.).
           
            If you try to fix 2) C), this disadvantage will be more apparent.
           
        D) Quick difficulty re targets adds protection.
       
                If a crypto has fast difficulty re-targets, it's difficulty to do a 51% attack, cause in the forked chain the difficulty will increase rapidly and will soon reach the target block times, the block time of the main chain will be the same, making a 51% attack impossible.
               
                If the main chain's difficulty was high cause of the attacker's majority hashing power, it'll drop to sustain a block interval equal to the attacker's fork chain.
               
                As of KGW, it's 'smooth' difficulty retarget means, while the attacker creates a long forked chain, the difficult will remain the same initially. But we want sudden difficulty increase to protect the network. I'm not sure about KGW, so if a coin does have KGW, it wont be taken as a plus.
               
                It's not known now DGW works either.
               
                Aggressive difficulty retarget each block will increase this rating by 1. The definition of 'aggression'' can be seen in 5) A). Apart form that the last 3 blocks or lower should be considered to get a +1 point off this rating. More no. of blocks considered means slow adoption to difficulty spikes.
               
        E) More confirmations add protection
                For a forked chain, it'll need a high hashing power for a longer amount of time to overcome the main chain, on top of that, the difficulty re-target algorithm will increase the difficulty making it yet more difficult to overcome the main chain.
               
                Since the amount of confirmation blocks depends on the receiver, this factor does not have any affect on the ratings.
               
        F) Changing algos to maintain ASIC resistance is ideal and will add 1 point.
       
4) Fast confirmation times -- like 5 minutes (50 seconds block). Less than a minute if a the coin wants to enter physical point of sales (10)
FAQ --
    A) This can kill the cryptocurrency.
        People will prefer using their cards for payment instead of waiting for hours for a confirmation. If confirmations take that much long, people will only use cyrptocurrencies for illegal payments, international payments where using other means to pay is practically impossible and transfer of funds among individuals where an hour or so is not that long. However, in these applications also, shorter confirmation times is desired. For e.g. for currency transfer among merchants, it may have to be done frequently. Even an hour is too much for that.
       
        To avoid long confirmation times, people may be willing to go through the formalities and technicals of cards.
    B) Disadvantage of short block times -- Chain will be forked way too often.
        This will turn off miners cause their confirmed mined blocks will no longer be valid. Receivers of coins who have broadcasted their transactions may have to retry attempts to broadcast.
       
        Since the difficulty will be such that a new block will be found by the network at around the same time as the block interval; a block interval large enough to broadcast a mined block throughout the whole network is desirable to avoid forking chains.
    C) Proof of stake may be problematic.
            What guarantees do you take that the person holding a large amount of coins and running a full node, keeping his wallet up and who has just generated a block has a good Internet connection so as to receive all the broadcasted transactions and include it in the block? These people are not experts, they've common stuff like firewall, anti-virus which may be up blocking the incoming transactions. This's unlike miners who usually have a good Internet connection and technical understanding.
5) Prevent intamine. (6)
    FAQ --
        A) Quick difficulty change may be the answer.
            Quick difficulty retargets ensures a power miner does not take advantage of the low difficulty coupled with laggy difficulty retargets.
           
            This accommodates for a sudden increase in network hash rate and to a provide smooth confirmation times. A sudden powerful miner may increase the difficulty to sky high; then the miner may be down skyrocketing the block times cause the difficulty is so high increasing the confirmation times to an unbearable amount.
           
            This may also serve as a protection against downtime of large networks which will lower the difficulty cause miners will be disconnected. Otherwise the confirmation times will suffer for the same reason.
           
            Aggressive difficulty retarget each block is recommended. The network should fix itself within 1 hour (and lower) and the block times should be back on track; that means a difficulty retarget should be 15 minutes; that way even if the block times reduce to 1/4th (1/4th the hashing power goes missing), the network can fix itself in an hour.
           
            As of instamine, allowing an instaminer to take away 3 blocks at a time is a reasonable. That's negligible advantage, no one would bother with that. 3 blocks means making a forked chain will be harder (since the average confirmation times of most coins is 6 blocks).
           
            So the block retargets should be 3 or lower and difficult retargets should be 15 minutes or lower for a coin to take full advantage of this rating.
            Block retarget of < 6 will give almost rating, less than <= 9 means half, <=12 means partial.
           
            KWG is characterized by smooth difficulty increase on rapid increase in network hashrate, which helps intaminers as compared to sudden difficulty retargets of a simple algo.

            Cause the difficulty increase slowly, the intaminer will take advantage by quickly generating blocks and stop mining once the difficulty is high enough.

            But when the instaminer is gone, the high difficulty is left for regular miners to take care off, and the block chain speed slows to a crawl. What makes matters worst is that the difficulty goes down slowly over time instead of suddenly going down like we have with regular algorithms. It takes the same amount of time to recover from the high difficulty set by the instaminer.

            So as compared to simple algorithms which re-target every block, KGW has a disadvantage -- the regular algo will increase the difficulty suddenly preventing an instamine, KGW does it slowly helping in the instamine.

            KGW has only one minor advantage -- it'll prevent the blockchain from halting for a longer period of time, but will not prevent the instamine.

            Digishield is worst -- it helps the instaminer further by slowly increasing the difficulty, while the difficulty goes up, the total no. of blocks mined is over the target. But Digishield brings the difficulty down aggressively which again means more blocks mined per unit time as compared to the target block interval. So basically that means in these situations the target block interval will be horribly off target and there will be over inflation.
           
            DGW is also similar. It's 'smooth' difficulty retarget helps the instaminer.
           
            So coins with KGW and Digishield will get half rating cause it does help in reducing instamine as compared to very simple slow difficulty retarget algos.
           
            Essentially, with the above algos, you're going to have similar behavior when a large no. of blocks are considered

6) Compressed protocol -- For quick setup of a full node. However this's only an advantage to miners who probably have a fast Internet connection. (2)
    FAQ
        B) how will this help?
            Notice the size of you block chain vs the amount you download while synchronizing? Thus there's a lot of scope of improvement. For starters, the older blocks can be delivered in compressed groups (of like 1000) as per the request of the full node.

7) Transaction comments -- both public (recorded in the block chain) and private (only between the sender and receiver) (4)
FAQ --
    A) What real use?
        For an online store, they may ask their customers to copy paste some one time code to prove that they have paid the bill.
       
        Then in general it helps in management in a human readable way.
    B) Size of transactions.
        This may increase by quiet a lot cause of this feature. This may be a disadvantage.

8) Expansion scope. In case small & new feature has to be added, it can be done in a backward compatible way. This requires void space allocation in the block and updating the clients to use that space. For e.g. transaction comments may be added this way to existing coins. Then one may add support for the name of the client to which transaction has been received which may unlock features exclusive to that client. (5)

9) Anonymous payment -- It should be impossible to intercept information about the owner of the address in any way. (10)
FAQ
    A) Bitcoin is not anonymous, the following vulnerabilities exist --
        A) Owner to address mapping.
            Usually a single person holds a Bitcoin receiving address.
           
            All transactions to that Bitcoin address is known, based on the value of the transactions and other evidences like third parity transaction records, receipts, Bills etc... which contain the amount of the Bitcoins sent, it can be proved that the address belongs to a particular person.
           
            Similarly along with 3rd party evidences of a rough transaction amount, and time of the transaction, the owner of an address can be traced with a certain degree of accuracy even when the sender does not corporate.
           
            Solution is to create new address for each transaction, but that inconvenient and sometimes not possible when there is no communication between the sender and the receiver.
           
            All these disadvantage can be applied to the sender also.
        B) Address balance.
            Continuing from A, after it has been proven that the address belongs to a particular person, his balance can be found out.
           
            It's to be noted that if there's 100% 3rd party evidence of the transaction, the balance the receiver holds cannot be hidden by the amount the 3rd party evidence proves. So what can be done is hiding the rest of the balance.
           
            Same thing can be said about the sender also. The balance of the sender can be determined after a transaction that has proved the owner of the address.

10) No or less transaction fees -- i.e. you may try to reduce the transaction fee by other means like PoS or inflation. Higher transaction fee may make people avoid Bitcoin transactions and instead use their Visa/Mastercard cards. Small transactions will be of no use cause the transaction fee will be too high. Transaction fee adds more complexities to the picture like adoption of the coin in poor countries and rejection of transaction based on low/no transaction fee.

No one wants to pay taxes or Bitcoin transaction fees.

Good amount of transaction fee may ensure quick confirmation (cause miners may reject based on low transaction fee); the delay will vary in multiples of the block times.

 What happens when you're using cryptocurrencies in low economy places like somewhere in Africa, South Asia & America or many of the islands. The transaction fee will simply be too much for them to pay; they'll avoid using it. There's no guarantee that people will pay transaction fee in the first place putting the miners at risk. Right now you see good transaction fee cause most of Bitcoin economy is in developed nations where they can afford to pay the fee in the first place.
 Then there's competition involved -- If the developed nations realize that their developing/under developed counterparts are not paying transaction fee, they too may stop paying. It's human behavior, it's uncertain.(10)
    FAQ
        A) Fast block times will help.
            As said before -- "the delay will vary in multiples of the block times"; faster block times may reduce this delay for the same reason.
           
        B) Inflation via mining will help.
            Certain amount of inflation per year will ensure that the transaction fee is distributed among users (cause in the long run, and without inflation the users will mine for transaction fee, but if there's inflation, they'll mine for coins removing the uncertainty of transaction fee), thus the effective transaction fee will be negligible per user cause it's distributed among the large user base and there will be no transaction fee wars.
           
            Following point 2) D), 6% or above inflation will give this full points. Below 5% will give it almost. Below 3% half, below 1% partial and less than equal 0.1% no points.
           
        C) PoS inflation will be given no weightage.
            The reason why TX fee exist is to strength the network. But PoS is full of security flaws. No matter how much inflation is provided via PoS, this point will remain 0 for a 100% PoS coin.
           
In my blog, coins will be rated based on these criteria. Each coin will the following ratings for each criteria --
No -- 0/(importance score)
Partial -- (importance score)/3
Half -- (importance score)/2
Almost -- (importance score)/1.5
Full -- (importance score)

For each coin the total will be calculated.
           
If you're making a new cryptocurrency based on this, please DO notify. Thank you!

QRK -- QMYbuBKzLTsrpDTqvoW5a6u6pN8149UMSY
BTC -- 1CrNnuoCXpggwajwasDTnvpxNpVNJPCTuc

Monday, August 26, 2013

Intel CPU only OpenCL benchmark.

I used John and ImageMagick to do the benchmark with the Intel OCL sdk installed.

The results (John) --

mscash2-opencl --
OpenCL platform 0: Intel(R) OpenCL, 1 device(s).
Using device 0:         Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
Optimal Work Group Size:32
Kernel Execution Speed (Higher is better):0.000444
Benchmarking: M$ Cache Hash 2 (DCC2) PBKDF2-HMAC-SHA-1 [OpenCL]... DONE
Raw:    418 c/s real, 105 c/s virtual

mscash2 --
Benchmarking: M$ Cache Hash 2 (DCC2) PBKDF2-HMAC-SHA-1 [128/128 AVX intrinsics 4x]... (4xOMP) DONE
Raw:    2464 c/s real, 620 c/s virtual

wpapsk-opencl --
OpenCL platform 0: Intel(R) OpenCL, 1 device(s).
Using device 0:         Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
Benchmarking: WPA-PSK PBKDF2-HMAC-SHA-1 [OpenCL]... (4xOMP) DONE
Raw:    790 c/s real, 199 c/s virtual

wpapsk --
Benchmarking: WPA-PSK PBKDF2-HMAC-SHA-1 [32/64]... (4xOMP) DONE
Raw:    924 c/s real, 232 c/s virtual

bf-opencl
OpenCL platform 0: Intel(R) OpenCL, 1 device(s).
Using device 0:         Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
****Please see 'opencl_bf_std.h' for device specific optimizations****
Benchmarking: OpenBSD Blowfish (x32) [OpenCL]... DONE
Raw:    1131 c/s real, 381 c/s virtual

bf
Benchmarking: OpenBSD Blowfish (x32) [32/64 X2]... (4xOMP) DONE
Raw:    2448 c/s real, 613 c/s virtual

With ImageMagick convolve filter --
With OpenCL --

convert -convolve -1,0,-1,0,4,0,-1,0,-1 background.png test.png
real    0m5.175s
user    0m5.776s
sys     0m0.064s

Without OpenCL (OpenCL excluded during compile) --

convert -convolve -1,0,-1,0,4,0,-1,0,-1 background.png test.png
real    0m4.985s
user    0m5.560s
sys     0m0.052s


As we can see, the Intel SDK is of no good. Maybe they could've spend more time on developing their hardware and drivers instead of making shiny GUI on .NET.

Monday, May 13, 2013

Parallel/threaded rename to numbers script.

#! /bin/bash
# Rename all the files and folders in the current directory serially.
# DOES NOT PRESERVE EXTENSION.
#1st argument -- no. of processors
# 2nd argument -- no of presiding 0s
names="$(ls -1)"
# Remove current script file
names="$(echo "$names" | grep --invert-match --line-regexp "${0//.\/}")"
# No. of items -- required.
count=$(echo "$names" | wc --lines)
declare -i quot
declare -i i
declare -i from
declare -i till
from=1
i=1
# Function does the actual renaming.
# takes in arguments as the line no. of $names
# Since each line in $name is a file to be renamed randomly, an instance of the function will have to be supplied with with range of names it'll process.
# 'an instance' cause it's multithreaded
# first argument -- from which line will it start processing.
# second argument -- till which lines will it process.
rename_till () {
 declare -i c
#  from $c
 local c=$1
 declare -i entries
 local entries=$2
#  Till $entries in $names
 while [[ $c -le $entries ]]
 do
#   head -$c output's the first $c lines. Last line is of interest only, it's the cth line.
  local name="$(echo "$names" | head -$c | tail -1)"
#   File processed, proceed to next line.
  c=$c+1
  mv -i "$name" $(printf "%06d" $c) &
  echo "$c of $entries done." &
 done
}
# rename_till() calling mechanism.
# $till determines values of $2 in rename_till()
# Each thread will process $count/$1 lines
# This truncates decimals.
till=$(($count/$1))
while [[ $i -le $1 ]]
do
 rename_till $from $till &
 i=$i+1
 from=$from+$(($count/$1))
 if [[ $i -eq $1 ]]
 then
#   Remaining fines (truncated by $count/$1) added to last rename_till() call.
  till=$till+$(($count/$1))+$(($count%$1))
 else
  till=$till+$(($count/$1))
 fi
done

Parallel/threaded random rename script.

#! /bin/bash
# Rename all the files and folders in the current directory to random.
# DOES NOT PRESERVE EXTENTION
#1st argument -- no. of processors
names="$(ls -1)"
# Remove current script file
names="$(echo "$names" | grep --invert-match --line-regexp "${0//.\/}")"
# No. of items -- required.
count=$(echo "$names" | wc --lines)
declare -i quot
declare -i i
declare -i from
declare -i till
from=1
i=1
# Function does the actual renaming.
# takes in arguments as the line no. of $names
# Since each line in $name is a file to be renamed randomly, an instance of the function will have to be supplied with with range of names it'll process.
# 'an instance' cause it's multithreaded
# first argument -- from which line will it start processing.
# second argument -- till which lines will it process.
rename_till () {
 declare -i c
#  from $c
 local c=$1
 declare -i entries
 local entries=$2
#  Till $entries in $names
 while [[ $c -le $entries ]]
 do
#   head -$c output's the first $c lines. Last line is of interest only, it's the cth line.
  local name="$(echo "$names" | head -$c | tail -1)"
#   File processed, proceed to next line.
  c=$c+1
  # random name generated dynamically. Run in background, it's faster
  mv -i "$name" $(cat /dev/urandom| tr -dc 'a-zA-Z0-9_' | fold -w 15| head -n 1) &
  echo "$c of $entries done." &
 done
}
# rename_till() calling mechanism.
# $till determines values of $2 in rename_till()
# Each thread will process $count/$1 lines
# This truncates decimals.
till=$(($count/$1))
while [[ $i -le $1 ]]
do
 rename_till $from $till &
 i=$i+1
 from=$from+$(($count/$1))
 if [[ $i -eq $1 ]]
 then
#   Remaining fines (truncated by $count/$1) added to last rename_till() call.
  till=$till+$(($count/$1))+$(($count%$1))
 else
  till=$till+$(($count/$1))
 fi
done

Friday, March 22, 2013

Weird/unnatural behavior in chicken.

My neighbors have 3 chickens as pets (with possible intention of organic eggs also), 2 of them are male broilers, and one of them is a female of, what I suspect to be, Rhode Island Red; as a result the female is larger than the males; and I suspect the breed diversity to be one of the reasons why they won't mate, as a result no eggs. :(

Regardless, since they were alone from the rest of the world, the roosters didn't learn how to crow naturally, they did it wrong, they didn't even sound chicken; I think I made them learn how to crow

I used my phone to make the roosters crow. That way they responded cause of rivalry, and finally learned how to crow and they're pretty loud now.

One of the 2 males till date (now adults) has not learn't yet how to crow properly, as a result he sounds weird.

So the rooters LEARN how to crow it doesn't appear to come naturally.

But unfortunately, what they also learned is that they should crow at night; and that's cause I'd set the ringtone to rooster crowing in one of my phones and I used to keep near the window. 

At night someone used to call me; I don't know who till date, but I was notified about this by my neighbors who complained that the roosters are troubled cause of it; as a result, I moved the location of the phone and changed the ring tone.

What the neighbors didn't tell me was that, their chicken learned to cow at night. Yes -- they'ld randomly start crowing at like 2200, 2300, 0100, 0300.... anytime and for no valid reason!

Another strange behavior was that, a few months ago, the chicken started crowing.

And although slow, it's getting better till date.

People say that it's cause the hen is lacking mates, i.e. they do this when there're no males in the group, and so trying to take over the leadership; this seems to be related to the fact that the roosters were not able to fertilize the hen. Maybe the hen thought the roosters where hens too.

Fastest cabinet/computer/CPU fan.

I know about the Deltas; but this one is faster; you got it right, it's homemade.

All you'll need are propellers, which're commonly used on RC planes and a brushed DC motor.

About the blades:since you're probably not a RC enthusiast, you need to know that the 'pitch' is basically a measure of how much air the blade will more for a specific size and RPM.

i.e. if a blade has pitch 4, and other has pitch 6, and both of them run at the same RPM and have the same size, the blade with pitch 6 will draw more air and also load the motor more.

For the motor - I use a toy helicopter motor.

The result -- No fan in the market comes even close to the kind of airflow this one gives; at start, I should warn you, the thrust will be so much that you wont be prepared for it and the fan may just slip off your hands.
On top of that, it's cheap.

Ensure to glue the bade to the rotor after the final setup, cause in my case, it just flew off!

Monday, January 21, 2013

Dell 2030M review.

Last time I reviewed Philips 192EL2 and gave moderate feedback; but after looking at this Dell monitor, I think I forgot to praise it's color and brightness.

This 'Windows 7 compatible' monitor comes in the same price range as any other budget monitor, so does the Philips 192EL2, but it's colors are completely washed off. They simply feel unatural and faded out regardless of the settings but appear to be too bright on some pictures. Point is, after looking at it's performance, you'll conclude something's wrong. It comes nowhere close to the CRT or the 192EL2 and looking at their price difference, this's not even good for general computing, it falls wayyy behind multimedia applications.

The brightness is reasonable, but the 192EL2 is about 5 times as bright.

So instead of recommending this 'Windows 7 compatible' monitor, I'd recommend a VGA and DVI compatible Philips 20 inch monitor.

Tuesday, January 15, 2013

AVFS howto/guide/tutorial.


This's a virtual FS to browse through archives. It can even browse through block devices (like cd/dvd drives, PD etc...) if you've written whole archives on them directly. It also supports network protocols like ftp, http etc..

Things work around avfsd with no root privileges required, just ensure you're in the fuse group (i.e. if that group exists in your OS).

Avfs is going to mount the root dir to a place where you point to –

avfsd archive

Will mount the root (or root like) FS to directory archive.

In archive/ browse to the archive location (or 'cd' to it), and then open it by placing a # after it's name, e.g. –

cd archive/home/user/backup_drive/backup.tar.xz#

This's going to cd into the archive.

If you use just #, avfs will rely on the extension of the archive to detect the type of archive, thus the # is actually a shorthand. The full path to open the archive also includes the type of archive, it's specified by placing certain text (depending on the archive type) after the # –

cd archive/home/user/backup_drive/backup.tar.xz#uz

Where uz means a xz archive and uses gzip for it's decompression. But cause it's tar.xz, you'll see a tar archive inside it, to also browse into the tar archive –

cd archive/home/user/backup_drive/backup.tar.xz#uz#utar

You have to use these with block devices if you burnt the archive to them directly –

cd archive/dev/sr0#utar

i.e. the tar archive has been burnt directly to the optical media.

This's going to make avfs assume the file is first compressed with uz, then utar. Similarly –

cd /home/user/backup_drive/backup#urar#utar

Supported archives and such keywords (as of the current time) –

#deb debian packages

#ftplist ?

#hp48 ?

#lslR directory tree listings

#mailfs ?

#patchfs browse patch files

#rpm rpm packages

#rpms List of installed rpms

#trpm Useful inside #rpms

#ucpio cpio archives

#ulha lha archives

#uzoo zoo archives

#a first floppy drive alias for #floppy:a

#avfsstat meta information builtin

#bz2 bzip2 uses bzip2

#dav webdav builtin

#dav_ctl control dav sessions

#floppy floppy uses mtools (mdir, mcopy, ...)

#ftp ftp builtin

#ftp_ctl control ftp sessions

#gz gzip uses gzip

#iso9660 CD/DVD filesystem no need to use mount -t iso9660!

#local local filesysem only for internal use

#rsh rsh/rcp only works if rsh needs no password

#ssh ssh/scp only works if ssh needs no password

#uar un-ar builtin

#ubz2 bunzip2 builtin

#ubzip2 bunzip2 uses bzip2

#ucftp ftp builtin (write support, no file cache)

#ucftp_ctl control ftp sessions

#ugz gunzip builtin (1)

#ugzip gunzip uses gzip

#urar unrar builtin list + uses rar to extract

#utar untar builtin

#uxz unxz/unlzma builtin

#uxze unxz/unlzma uses xz

#uz uncompress uses gzip

#uzip unzip builtin

#volatile 'memory fs' mainly for testing

#u7z p7zip 7z archives

These are built in type (or there by default).

Avfsd relies on programs (e.g. 7z, tar, xz, gzip, unrar etc...) and scripts to open up archives; the script tells avfsd how to operate the command (arguments etc...) to open up the archives.

This means you can extend the supported the archive type; the script in question is placed at /usr/lib64/avfs/extfs on Gentoo. May differ for other distros.

You can get a lot of such scripts on the net; but as know know, you're at risk 'downloading' them directly, it may be malware.

Depending on the archive type, programs's efficient etc... it may take a long time for a programs to read the file, or seek to the file (this's an issue in case of lzma1/2 compression); or it may take less time, it depends on the archive format.

To open ftp –


By cding to the mount mount of avfs FS.

-->

Friday, January 11, 2013

Burning raw files/filesystems/archives/tar to disk/DVD/CD. Burning encrypted disks

What I mean here is that the disk will not contain any traditional disk FS like iso*, UDF etc.. but will contain a raw file at block level; the file that we'll be writing to the disk may be any file, like a tar archive with various compressions or squashfs image etc...

This can be done by cdrecord/wodim by simply placing the file instead of an iso image, or passing the file over stdout, e.g. -- 

cat test.squashfs | cdrecord speed=0  tsize=4617089843 driveropts=burnfree -

Here you've to set the tsize of the size of the squashfs image (in bytes), or alternatively you may simply specify the file as a command line argument -- 

cdrecord speed=0  tsize=4617089843 driveropts=burnfree test.squashfs

stdin is really useful for tar archives where you can directly stream the data while making the archive; here set the tsize to the size of the medium; in case the data is less than the specified tsize, it'll be padded with spaces; tar has no problems with this, but zip does, so don't burn zip archives.

To extract/mount -- 
unsquashfs /dev/sr0

mount /dev/sr0 ...

Speaking of mounting, udisk appears to recognize the squashfs volume on the DVD/CD and it works perfectly integrated with all DE... like with iso*/UDF filesystems.

For tar -- 

tar -xf /dev/sr0

It may give a warning that extra 0s toward the end has been ignored... which's perfectly fine.

The perfect FS or archive for the purpose -- 

squashfs – Its's detected perfectly by all DE; tsize can be easily figured out (writing the size of the FS image in bytes after figuring out it's size using ls, or using the input file at the squashfs image) but for the same reason you can't stream it to stdout, you've to make an intermediate large file. Also when burning, set the block size to largest possible, 1MB, cause without that seeking problems will occur, reducing read speeds and wearing out the drive. If you want compression with the FS you write to the disk, squashfs is the only option.


tar – Without various compressions (plane tar), can be streamed to stdout but you've to specify a large tsize (maximum of the disk maybe, a bit larger than the possible size of the archive); the extra 0s to the end don't matter, tar filters that out. On the downside, it can't be mounted natively as FS (not natively means you're using avfs, which I've discussed in the next post). If you use xz compression, the seek times to review a file will be too slow, cause lzma requires you to go through all the files which're placed previous to the file you wanna open, making it slow + it's single threaded. I've not tried gzip and bzip though.


Neither fuse-zip nor archivemount mounts the block device as archive. Only avfs works.

Using the same method, you can create a loop device (losetup) mapped to a encrypted block device via cryptsetup. Then you can write to this block device using mksquashfs (the file to be specified will be the block device -- mksquashfs works well this way). After you're done, remove the dm-crypt mapping, and optionally remove the loop device (or run sync); then burn the file (on which you created the loop device) to disk.

To read, cryptsetup on the DVD drive's block device and mount the resulting mapped block device.

Tuesday, December 25, 2012

Wizard of ID fetch script.

First argument -- from date, format yyyymm, second argument, to date format -- yyyymm
Third argument -- no. of parallel fetches
e.g. --
./fetch_id 200801 2001301 4


#! /bin/bash
# Fetch wizard of ID script.
# fetching pattern --
# wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/2012/12/
# wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/2012/11/
# wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/2012/10/
# wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/2011/10/
# DO NOT run any other wget instance
# First argument -- from date, format yyyymm, second argument, to date format -- same
# Third argument -- no. of parallel fetches
declare -i year_start=${1:0:4}
declare -i month_start=${1:4:2}
declare -i year_end=${2:0:4}
declare -i month_end=${2:4:2}
# vars For internal use
# Can be removed -- *_start serves the same purpose
declare -i cur_year=$year_start
declare -i cur_month=$month_start
# no. of threads to be run
declare -i t=$3
# no. of fetch instances currently running
declare -i threads
chk_arg () {
#  Checks the argument lightly
 if [[ $year_start == "" || $year_end == "" || $month_end == "" || $month_start == "" || $t == "" || $month_start -gt 12 || $month_start -lt 1 || $month_end -gt 12 || $month_end -lt 1 || $year_start -lt 2007 || $year_end -lt 2007 ]]
 then
  echo "Wrong date start or date end arguments or missing arguments"
  exit
 fi
 if [[ $(pgrep wget | wc --lines) -ne 0 ]]
 then
  echo "Wget running in background, pid $(pgrep wget) first quit that"
 fi
}
fetch () {
#  reads variable cur_year and cur_month and fetch the corresponding page. Add additional 0s to cur_month if it's < 10
 echo "In progress, year $cur_year and month $cur_month"
 if [[ $cur_month -lt 10 ]]
 then
  wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/$cur_year/0$cur_month/ &> /tmp/$cur_year$cur_month.log
 else
  wget -H -e robots=off -p http://www.johnhartstudios.com/wizardofid/$cur_year/$cur_month/ &> /tmp/$cur_year$cur_month.log
 fi
}
manage () {
#  Manages calls to fetch()
 while [[ $cur_year -le $year_end ]]
 do
  #  If cur_year == year_end, tally the months to see if cur_month > month_end, if so, exit
  if [[ $cur_year == $year_end ]]
  then
   if [[ $cur_month -gt $month_end ]]
   then
    echo "Wget is probably still running in background. Check running processes and wait till all wget instances finish"
    exit
   fi
  fi
  threads=$(pgrep wget | wc --lines)
  if [[ $threads -lt $t ]]
  then
   fetch &
 #   increment cur_year and/or cur_month
   if [[ $cur_month -lt 12 ]]
   then
    cur_month=cur_month+1
   else
    cur_month=1
    cur_year=cur_year+1
   fi
  else
   sleep 1
  fi
 done
}
chk_arg
manage

Monday, November 19, 2012

Extracting 3d images from 2d (or simple) video.

These images cant be extracted from any part of the video.

You have to search for parts in which the camera is moved from left to right on static (not moving) objects.

If you've found such a scene, note the time from which it starts.

Now you've to extract frames starting from this part of the video, do this using mplayer (for e.g.) -- 

mplayer -vo jpeg -frames 200 -ss 00:00:33 '/home/de/media_writeit!/media/test media/html5_Video_VP8.webm'

In the above e.g. frames are extracted from the 33rd second, and 200 frames are extracted from this time. How many frames to extract depends on the FPS of the video and/or how fast the camera moves.

This command will populate the directory you're in with 200 jpg images.

An idea of exactly how many frames are required and the next steps to make the image can be read in my previous post "Creating 3d anaglyph images".

A sample created from RE trailer -- 

 

Creating 3d anaglyph images.

As you know, for a 3d picture, you have to take 2 images both of which will represent the views of both your eyes. But that doesn't mean you take 1 image via the viewfinder of your left eye, and the other via the viewfinder of your right eye. The result will have too much difference in them.
Instead take multiple pictures, starting from the left eye point of view (the 'master' or first picture from which a 3d picture will be made), and then slowly moving the camera towards the right taking successive snapshots. Notice the motion should be very slow. The slower the motion and the more number of snapshots in between, better are the chances of you getting the perfect picture.


Now you have to assemble the picture using a program called 'plascolin', you may also use gimp for the purpose.


Open the left image first in plascolin, then it's automatically going to open the next image in the same folder in alphabetic order and combine them so as to form the 3d image.


Now for the perfect picture.


You've taken multiple images, if the difference between the selected left and right image is too much, viewing the picture will be a headache, if it's too less, the 3d effect wont be much. Ideally, ½ inch difference between the left and right images will be the best, but still it's not guaranteed to be the best; from here our quest begins for the perfect 3d image.


So in the list of images, first make multiple folders; in these folders you'll pair 2 images, the first one being the left most image in all cases; i.e. in all these folders, there will be a symlink (or copy) to the first image.
Now you have to select the second image, start off by symlinking the rightmost image to the first folder. Make a 3d image off these 2 images, if you find that you're getting headaches (if you're not, you've found the perfect picture), move the 4th or 5th rightmost image to the second folder, check the results, if you find there're no headaches, move the 3rd or 4th rightmost image to another folder, but if you do have headaches with the 4th or 5th image also, proceed to the 7th or 8th image. Preview both to see what's best and continue doing the same until you find your perfect image.
 

I hope you understand what I mean. You've to find the image which 'just' wont give you the headaches, that'll give you the best 3d effect.

Now for a sample -- 

http://img266.imageshack.us/img266/3456/scooby3d.jpg

This's my 13 year old dog. Notice the hair, they really look nice.

Thursday, November 15, 2012

Philips SHP2000 review.

These 32 Ohms headphones are cheep yet, it's quality is fabulous.

If you ain't deaf (i.e. wont hear so load so as to damage your ears), these head phones are pretty good! A very good replacement for in ear earphones.

The base, mids and highs are all good, and you won't have to do much with the equalizer to get that solid base.

It looks good too, but 1 drawback -- cause of high impedance, it's not designed to be used without an amplifier. i.e. it wont be working with the inbuild sound card of your laptop/desktop; with a good dedicated sound card, it may work. All this cause these can handle 500mW of power.

Also note -- the noise isolation is not good.

It's comfortable to wear, but gets a bit hot on prolonged usage.

Friday, October 12, 2012

nanozip, compressionratings.com fraud

This propitiatory program called nanozip has internal ties with http://compressionratings.com which posts false and ambiguous compression result which falsely shows nanozip as the best compression algorithm.

They'll use the best compression method of nanozip and worst compression method of 7z and zpaq, as a result, they've the liberty to put any compression program anywhere in the list.

In reality, nanozip's good compression methods are single threaded, and that too they're no better than multithreaded 7z and zpaq compression methods.

Wednesday, August 29, 2012

Software patents -- are they evil?

Software patents are commonly misused by companies to kill competition; practically there're just 2 companies (apparently protected by the US government) which does so, and following it's tactics, all other companies also do it to remain in competition. In the mean time there's major harm to one community – the Opensource.

Unlike software patents, patents not relating to manipulation of information are never misused, cause they can't be misused.

Definition of software patents -


In abstract form, I define software patents as “method of manipulating/generating information using information”.

In this context, the program is a method of manipulating/generating information and program itself is also information.

For programs to be run, we need hardware; when a program manipulates/generates information, so does the hardware running it, but the hardware never does it directly, it does it through the program, but the program is directly manipulating/generating information.

In that case, any instruction (programs in this e.g.), needs a real world object to to execute it. Either it be a human following instruction to solve numerical or a computer (hardware) following instructions (software) to do the same.

Arguments against software patents -




Mathematical methods also come in the same context, mathematical methods are methods to manipulate/generate information using the mathematical method, which's itself information.

The difference between computer program and mathematical procedures is that a mathematical procedure is executed by a human being and a program by a computer.

Actually in this context, I can even patent methods to write an essay or method of managing a log book. Other e.gs include -

Special margins to write both page no. and date.

Special formatting lines on a page designed for scientific use (diagrams).

Labeling methods of diagrams.

Method to write content to criticize the government and set people against them.

Method to write articles to convince conservative people to buy your product.

Method to write a patent document.

Etc... etc... etc...

If you can patent things in written form, why cant you patent methods of speaking in specific structural ways; finally it's a method of manipulating information (speaking)? e.g. -

Method to talk in such a way to convince people to take your products.

Method to respond to your opponent in debates (lawyers will have to pay royalty in other to use this methods)

Method to structure your statements in a speech so as to not make them boring (politicians will have to pay royalty for this).

All these fall under the category of “method of manipulating/generating information using information”.

Why software only? -




Question is, if you're allowing software patents why are you not allowing patents of mathematical methods; why are patents on the above examples (method to write/draw/speak) forbidden? Why are software developers targets and not anyone else?

If your arguments is the fact that writing and speaking are trivial things then are electronic devices in the 21st century trivial? If they are according to you, then you're discouraging people to adopt and code for electronic medium by using concept of software patents, similar to the way you'll be discouraging people to talk in public or distribute their writings cause it may be violating a patent.

Also developing mathematical methods are not trivial, yet patenting it is not allowed.

Thus I suggest, every patent covered under “method of manipulating/generating information using information” be allowed or software patents should be forbidden. No use targeting developers.

Freedom –


If you allow patent on basis of “method of manipulating/generating information using information” it'll rob basic freedom of the common people, this's apparent from the above e.gs.

In the same way, as the law “method of manipulating/generating information using information” robs freedom of from people, software patents, falling under the same principle robs the right of developers to write code... and writing is a fundamental right.

Even if a software developer is selling a software using a patented technology, his basic rights to write code is taken away; in contrast if we patent a “Method to respond to your opponent in a debates”, lawyers and a lot of other people who also earn money by talking; so if they use this method, they should pay for the license. Similarly a method of writing story for kids to make it more entertaining can also be patented and book authors should be charged for selling a book with patented technology. This'll rob the freedom of everyone, enforcing this law will force people out of the country, and we see the same trend with developers (atleast they threaten).

Root of innovation is not money -


This's specially true with software.

Did scientists and mathematicians made their mathematical methods or derivations for money? Maybe – if they were hired, but you cant ensure their payment'll increase cause of this work, thus this work done was not intended for money. The employment was done to ensure that continue working without survival issues.

My point is, the source of innovative work is not always money – this's true for the larger majority of software. If you really want money, there're other ways to get it. To name a few -

Vorbis and mp3 – Vorbis is a better compression yes does not use any patents (point is – the developers have not copied over any patent methods).

Internet and MS exchange – Yes, all common protocols used over the Internet are not patented. The MS exchange protocols is proprietary and probably uses a lot of patents; still the standard protocols are much better and show more innovation than MS exchange.

NFS and CIFS – Agreed, NFS is not as feature rich as CIFS, but it's designed to work over local networks where security is not much of an issue; NFS is a lot faster than CIFS (30 – 40%), yet it's a free implementation by Sun (now Oracle).

C, C++ were revolutionary languages and yet not patented.

TCP/IP, TCP, ICMP

Countless others........

Instead, patents have a large role in stopping innovation.

For real life inventions, there're no non-profit inventions. If there are, they're not as good as the profit ones.

Preventions of innovation, discouragement of opensourcing software development -


Imagine a developer making a new opensource protocol (for public cause (RFC)), considering the amount of software patents in the market, the probability of him violating a software patent are high. Cause of software patents he could not make the new protocol or improve the new protocol or software patents hindered development of a new innovative protocol.

He can apply for a license, but there are legal issues in the way – too much work. Then you don't know if the company will provide a license even.

All in all, the developer has to spend money to make a software for public cause – this's forbidding developers (or sponsors) to make a new innovative technology for public cause; in this case the patent office favors the the powerful (to make them become richer and powerful) and leaves the common people in dismay. By powerful I mean someone holding a lot of patents.

This way, if there's a sponsor of the software, he'll be encouraged to make it closed source to avoid patent infringement (by not disclosing to the world the code) and so use it only for internal purposes only, depriving world off the technology and yet violating patents. The disadvantage of close source software is also to be considered.

Thus, my conclusion is that if software patents are abolished, it'll not stop innovation, instead it'll increase it by causing less hazel.

Cross licensing of technology results in complications -


For a video format to be best possible in the market, it should violate many patents (or method of efficient encoding). If the maker of the format itself applies patent on newer methods that he developed – it'll just increase the complications.

All in all, cause of many violations in patents, making this ideal video codec will be impossible cause you'll be on the mercy of the companies holding the patents all the time discouraging people form making the video codec.

Unfortunately this very concept can be turned against the concept of patents as a whole – even in real world things. Thus this fact may be invalid.

Objective of software patents fail -


When you implement a software patent, it's success and utility also lies by the way you enforce it.

A software patent is of no use if don't enforce it.

Unlike real world machinery, information can be hidden, it can be encrypted such that it's practically impossible to decode or reverse engineer; this fact can be used by a company to hide the use of many types of software patent (for e.g. use of an algorithm/method in a compiled program, compiler related patents, file formats which are encrypted by the software to escape patent infringement etc... ).

Considering the no. of closed source software available in the market, one can ensure that the number or patent violations are in the order of millions if not billions – they get away with it with no effort and sometimes without even knowing.

Opensource projects are targets -


Opensource projects are projects made for public interest, even if a company sponsors a projects, it being opensource (having a free license) means that other companies can use it for it's own purposes – thus if a companies (like Google), sponsors an opensource projects and keeps it opensource, it means the companies also thinks about global standards and benefit of the public rather than money. The competition between companies will be at a different front rather than wasting resources on software development and re-implementing an implemented piece of code in another project.

So a companies funding an opensource project doesn't mean it's doing it for profit; the reason for it being opensource, has to do with more than just money.

All in all, I wanted to say that if a software has a free non-restrictive license, it always benefits the public by a higher amount than closed source software (their only intentions being profit most of the time).

See 'why opensource' document for more advantages of opensource software than closed source.

Since you cant reverse engineer the code and may be the file formats of closed source projects, the only easy target that you have are opensource projects which's for public cause.

This's ironic cause the end objective of the patent system was for the benefit of the public, but projects which are also for the benefit of the public is being targeted by use of this same patent system. In the mean time, closed source software which breech the law and have a main intention of profits, escape unharmed.

Discourages use of opensource software -


If a patent holder targets a company using an opensource software, then also it's not fair. Doing do discourages the company to use and develop opensource software, instead, it'll now make and use the software patent internally, this breeches the law, and also wasts the company's efforts by redeveloping closed source software.

Then there're disadvantages of closed source software.

The company holding the largest no. of software patents today blackmails companies using opensource mobile operating system to pay them taxes for using opensource software cause of their violations of patents.

And today we have the perfect e.g. Apple (a closed source software vendor) targets Samsung (using opensource software) and surprisingly Apple wins. The (Apple/Microsoft favoring) US courts were blind to the advantages of opensource software and were so immersed into Apple's profitability that they didn't mind actions and decisions which harms opensource software projects like Android. This's a direct and serous attack to opensource projects.

As of people who stupidly claim Google profits from Play store, it's to be noted that Play store is not tied down with Android, Android can be modified to unofficial stores which may be run by non-profit organizations like Mozilla.

This encourages the companies to drop opensource alternatives and adopt/develop closed source software which directly harms the public, furthermore this enforces monopoly of a monopoly – Microsoft, reducing competition and verity in the market.

On the other hand – companies already using close source software start to realize the benefits of using it, the only benefit being avoiding patent infringements.

All in all, this system directly harms the public and the thing fueling it is the government itself.

Law not implemented is a joke -



People/companies who want sell their products which violate patents can do so easily with assurance that the violation will be ignored. The software if available in binary form, cannot be reverse engineered to see if it violates software patents.

Even if a law is passed that such that a software patent owner can obtain the source to check if it violates patents or not, then also it's a huge waste of time and effort – just to see if the software is violating patents or not.

There're billions of close source software available today, imagine the number of software patents they violate.

Software is mathematics -


Most software patents are basically algorithms – algorithms are a method of manipulating information, but every country forbids patenting algorithms.

But magically, if you write the algorithm in a C/C++/java/etc.. program, you can patent them! So you're basically patenting an algorithm by fooling the patent system.

This's like you can patent a technique to write books, but only if you give examples in Latin or French... or any non-english language.

Discourage developers/students -

A student can violate a software patent while making a program during practicing.

Since he has breeched the law, he should be fined and pay royalties.

If a target student looks at the amount of patents and controversies related to patents, he will probably drop the idea of being a developer following the fact that he's being restricted to write what he wants.

Financially difficult for commoners to manufacture things, but easy to make programs –


One of the reasons why patents on methods of talking and writing are forbidden cause it can be done by anyone. Especially in today's world, it can be published by anyone without spending huge amounts of money or efforts (for e.g. publishing your work in a blog, website etc...).

Programs come in the same category. Everyone has a computer, so everyone should be allowed to publish or do anything with their original work – programs can be made by anyone, free of cost and can be published by the author free of cost or via small free. One can even distribute it's binaries easily; but software patents are hinder this right.\

Software concept is always used -


When there's a new software concept, we always use it somewhere – or inventions in software are made for the cause of using it somewhere. Have you ever heard of someone getting paid to ponder concepts penetrating computer software? They get paid to code, but they don't get paid to invent. Thus, before a software concept is born, it's used.

A software concept doesn't require you to spend money, and it's designed to be used in a piece of software (that's the original motive of the invention); so this piece of innovation is certainly getting used if this's your concern.

This theory meets facts – there're plenty of people who're inventors full time, but are there any people working on 'software inventions' (NOT coding) full time? Inventors of real world things have one job – just make the concept, but with software invention, they are made cause of requirements in the software.

If software patents didn't exist, innovation will continue out of requirements -


With software patents, it makes sense to start software R&D, patent software concepts and ask opensource non-profit software developers/organizations/projects for royalties.

But what if software patents where not allowed? Will it harm innovation.

As stated before, a software concept is always used. The developer of a software method is almost, all the the time, is the sole developer of the software or part of the team making the software itself – he codes apart form developing the concept.

Thus a new method of software is being developed for a need, not for money. Thus innovation in software is always fueled by the need of it, and if software patents don't exist, software innovation will continue cause of requirement.

If men can follow instructions why can't their computers?


We have freedom to follow instruction or make anything we own follow our or other's instruction (depending on the permission we give) – this's especially true when it comes to manipulating copyleft information (your own work for e.g.). For e.g. via the remote, we can give our TV instructions... we have the freedom to do so.

So why are we restricted to give instructions to our computers?

We can publicly display free (copyleft) material to the public, hosting it via our computer and our domain and our Internet connection.

Displaying something, in IT terms means downloading it, to view information you need to download it. So why are we not restricted to display information... but are restricted to host (and download) copyleft programs cause of software patents?

One argument may be that objects that one owns and that has the capability to manipulate and generate information are not a part of a human being, so manipulating/generating information through that object may not be considered a 'right'. But when a person owns an object, it becomes a part of it; a pacemaker is an object and a part of a person... but a person has the right to make any of his objects his part, including your computer, his phone or a chip. An object owned by a person and not being a part of his body doesn't mean that he can be restricted to things with it.

Information can only be copyrighted -


As stated before, if you can patent information, if you allow patents on information, you can patent, methods of writing, speaking and method of filing a patents itself.

As of the current time, patents on any kind of information is not allowed, except software.

X86 is the largest scam ever -


x86 in a patent on information, although it doesn't directly fall into the category of “method of manipulating/generating information using information”, it has caused us enough trouble.

Via this patent, Intel has monopolized the desktop and server markets as a result, the condition of the market was very bad until AMD came up.

Today also the condition is striving competitions and an innovative idea of manipulating x86 and amd64 cannot be implemented cause of these patents. Everything lies on the hands of Intel and AMD.. if they reject the innovation, the idea will be lost and waisted.

Also x86 and amd64 is just a method of representing information to a processor – it just represents the things which a programs wants to do.

Infact, if x86 and amd64 can be patented, I think the concept of a program communicating with a processor via an instruction set can also be patented. That way the whole IT industry will be owned by Intel.

Same is not true for a particular CPU architecture, they are patentable, cause it's a physical machine to manipulate information and many can be manufactured.

So I tend to think, any kind of patent on information should be forbidden.

Copyright on information should be only allowed.

Patenting artistic work vs patenting software -


Artistic work requires technique, every artist has a technique to paint, and every author has a technique to write book, and also software developers can make techniques to code for a particular purpose.

Patents on techniques to code is allowed, but techniques to make art and write books is not allowed.

Patents discourage adoption of opensource software -


We know that the more the world uses opensource, the better the software industry will thrive. A key event in adaptation of opensource software is it's use in business organization, and it's use in the organization's products.

With software patents, a company will prefer using and giving closed source software to the public and hinder it's adaptation. In the closed source software, they will themselves be violating patents, but without the knowledge of the patent holder.

If software developers wants monopoly on the method, they may not release the source –


The objective of software patents, apart from extracting money from non-profit organizations, is also to ensure that their technique is not used by competitors (this includes non-profit organizations) and so they don't gain the upper hand.

To do so, the company/person can simply make it's software closed source. But it can happen that the concept is re-invented by another developer for or not for profit.

A software method can be called the best, but not real world methods –


Mathematical methods and techniques apply in a software, but not directly in real world inventions. Software can be considered a form of mathematics, it involves techniques to manipulate information, it can be said to be a mathematical procedure/algorithm designed to be executed on a computer.

On the other hand, a machine invented for a certain task has no such limitations, there're infinite directions and concepts that the machine can apply – it has to do more than mathematics, mathematics is just a part of this.

Since software is a part of mathematics, we can define the best method to do a particular mathematical task (all tasks at programming level are mathematical) in the best way possible or we can 'prove' it to be the best mathematical way. If this method is patented, there's no scope of innovation in that field, there's no inspiration for another better way to do the task cause it can't be done in a better way. Thus the person/company will have a monopoly on it and tax everyone from using it; this forces everyone to make a lower quality software, specially FOSS projects.

Get royalties from the source, not consumers -


In every product, patent royalties are taken form the place where the patents are used, it never happens that someone targets the consumers and asks them to pay royalties cause the people providing the product didn't take care of it so it doesn't add convenience to consumes.

Same can be said at a higher level too, if a company (A) provides products to another company (B) patents shouldn't be taken from B, but A.

What I mean to say here is that the source where patents are violated should pay for the royalties.

But this's never seen with software patents. In software patents, the only target is non-profit software, but companies holding patents never target them, they target the companies using opensource software causing all of frustration, inconvenience and confusion to both FOSS developers and the company.

Companies pay frauds to sway trouble -


Some people patent ridiculously simple things (and they're also granted), and ask a small fee from large companies.

The company, to avoid legal inconvenience, pays the person/company fueling more such frauds.

Royalties only from opensource non-profit organizations -


If a software patent inventor wants to get royalties, he has to get it from opensource organizations, cause only they revel the sources. Closed source software can freely use the patented invention without the users permission and without the users notice. They can encrypt file formats for better security.

Things become obvious in the future -


The IT industry develops at a rapid pace. 5 years is considered revolutionary... whereas even 10 years is less for scientific work.

So patents in the IT fields which were not-so-obvious 5 years ago are obvious now, but these fundamental things, being patented may not be used... this hinders development of better technology; obviously patents ties your hands down.

If the concept of web browser whould've been patented, there'd be only a few implementation of it (only people who had money could market it) and would be available at a price. There would've been no Firefox or chrome, only IE. Since there would've been less competition, innovation whould've stopped. People using the Internet would've been less cause the web browser had a price (apart from the computer hardware).

Methods of displaying information -


Now a days, even layout of UI components are patented. This does not fall in the category of “method of manipulating/generating information using information”, but is a more fundamental right.

As stated before, why the layout (margins, lines etc...) of a book can't be patented, but the same thing when applied to Ui of a website or software can be patented?

If they were patented -


If we had patented the following would the world be a better place?

HTML, TCP, IP, IP6, HTTP, FTP, blog, Toolbars concept, menu concept, forums (bulletin boards), Desktop, Windowing system, graphical file manager, taskbar, titlebar, double-clicking, mouse clicking, system tray, various common window components like slider, drop down box, a button, radio/check button, office suit, OS concept etc... etc.. etc...

Cause today all these thing are patentable.

Restrictions on so many thing would've restricted the development of the IT industry to a standstill... only a few rich and powerful would be able to host websites and provide software to the end user that too at a hefty price. We would still be writing on pen and paper if the people who made these patented it.

In no way these patents would have improved technology to humanity.

Reap benefits but give nothing back -


Various non patented technologies is used freely by companies having a strong patent portfolio (and rest of the world), but when they invent or develop a technology, they don't give it back to the world for free use, instead patent it.

The inventor of the free technology has to pay licences if he wants to use the patented technology developed by the technology, even if it's for public cause.

Apart from being unfare, this encourages the developers to patent technologies which he would otherwise not.

Layered architecture means simple software has many patents -


Almost all application software work on layered approach. Since in each layer, there may be patented technology used, the end cost of using the application software will increase exponentially.

All software royalties should be given back -


The main target of software patents are companies using opensource software. Since this hinders adaptability of opensource software, all royalties taken as software patents should be given back, infact a penalty should be imposed on such companies for doing such a thing.

Arguments favoring of software patents -


None in public interest.

This only favors companies who have a strong patent portfolio. Via software patents, they can enforce the use of their bad products, and replace a good one.

e.g. Windows phone and Android.

Wednesday, August 22, 2012

KDE too slow at startup (high I/O)

This may be apparent if you've been using a kde install for years (an impossible deed with Windows) with many upgrades.

Solution is to delete cache-*, socket-* and tmp-* in the .kde (or .kde4) folder which lies in the user's home directory.

Friday, August 17, 2012

Improve Firefox performance under slow Internet connection.

This scenario is specially true for mobile Internet connections where you may loose connectivity cause of bad network as a consequence, the phone/modem falls backs to GSM data connection which's HORRIBLY slow.

If you hog down these low speed connections with a lot of TCP/HTTP/FTP connections to remote servers, apart from adding a lot of overhead to the tiny Internet connection, there's a lot of packet drops and connection drops (e.g. TCP establishment failure) cause of high latencies (FF or the remote server gives up). Furthermore, FF, by default comes configured for normal speed Internet connection. It normally makes like 50 TCP/HTTP connections to remote servers and keeps them alive. At most it can go 200+ connections. This's surely an overkill for such a delicate Internet connection.

In about:config (typed in the URL bar), the following values can be decreased to improve your Internet connection -- 

network.http.max-persistent-connections-per-server -- Maximum number of HTTP connections FF can keep alive for a single server

network.http.max-connections -- Maximum no. of http connections at once. It's a bad idea to limit this without limiting other http connection values.

 network.http.connection-retry-timeout -- In case there's no response from HTTP/TCP connection, how much time to wait before trying in ms.

 network.http.max-connections-per-server -- Maximum http connections per server.

For professions or IT students -- Limit the number of connections to 2 or 3 servers at a time. But if it the value is too less, FF may hang waiting for a response which it may never get, resulting in manual intervention, until which other pages (which're qued to load) will not load.

For users -- Set network.http.max-persistent-connections-per-server and network.http.max-connections-per-server to 2 if you're 95% sure your Internet connection is slower than all server's.

Set network.http.max-connections to network.http.max-connections-per-server*.

If you want FF to load 2 pages at the same time, and let the 3rd or 4th etc... page wait till the first 2 have loaded, then set this value to network.http.max-connections-per-server*2.
Similarly, if you want  7 pages to load in value set it to *7. For a slow Internet connection, *2 is more than enough.

Set  network.http.connection-retry-timeout between 1000 and 5000 (maximum). Slower your Internet connection (or longer the time it takes to 'connect' to a website), set the value higher.

Sunday, August 5, 2012

"/dev/dsp: Device or resource busy"

This's commonly the problem with old games which use legacy OSS sound system.

This issue is 100% reproducable in KDE cause phonon is always using the device, yet fusers doesn't return any process giving you any guesses.

The solution is to change the default device for all things (most importantly notifications) in system settings > multimedia > phonon > device preference to the exact hardware interface provided by ALSA, e.g. you may like to change it to hw:0.0.

This'll usually make /dev/dsp free.

In this situation I've assumed there're no sound servers like pulseaudio, which has it's own OSS emulation.

As an alternative, or along with the above technique, you may try to kill knotify4 process once. Then it'll respaws, but the resource will be free by then.

Friday, August 3, 2012

KDE pendrive/external/flash format script.

This script is intended to be placed in device notifier, i.e. when you click on a FS (aka 'drive'), this script should be present with the name format.

You can do this via custom actions in the device notifier settings.

As the title suggests, this's a simple format script made using kdialog which offers formatting options in a verity of FS and also checks the contents of the disk before formatting.

The first argument supplied to the disk should be a partition name (like /dev/sdb1 or /dev/sdd1 etc...).


#!/bin/bash
DEVICE="$1"
if [[ $(echo $DEVICE | grep --ignore-case sda) != "" ]]
then
 kdialog --msgbox "I will not format an internal partition. This must be a mistake."
 exit
fi
ch=$(kdialog --menu "Choose a filesystem" "fat" "Compatible with Windows/Linux/Mac/BSD and other devices (fat32)" "ext3" "Compatible with all Linux (faster) (ext3)" "reiser" "Highest performance on small files (Linux only) (reiserfs)" "xfs" "Highest performance on large files (Linux only) (xfs))") || exit
mount_dir="$(mount | grep $DEVICE | cut -d ' ' -f3)"
if [[ $mount_dir != "" ]]
then
 cd "$mount_dir"
 contents="$(ls -a -1)"
 contents="${contents:5}"
 kdialog --yesno "Storage device is mounted in $mount_dir and has the following contents - 
$contents
Unmount and continue formatting?"
 if [[ $? == 0 ]]
 then
  cd /
  kdesudo -c "umount $DEVICE"
  if [[ $? > 0 ]]
  then
   kdialog --yesno "Storage device is in use, force umount and continue formatting?"
   if [[ $? == 0 ]]
   then
    kdesudo -c "umount -l $DEVICE"
   else
    exit
   fi
  fi
 else
  exit
 fi
fi
kdialog --yesno "This'll erase all data. Continue?"
if [[ $? != 0 ]]
then
 exit
fi
kdialog --msgbox "Formating in background... wait till \"Done!\" message occurs.
This may take a few minutes." &
case $ch in
"fat")
 kdesudo -c "mkfs.vfat $DEVICE || kdialog --error 'The device failed to format for some reason.
Re-insert the storage device and retry. If it still does not work, contact commercial support.'"
;;
"ext3")
 kdesudo -c "mkfs.ext3 $DEVICE || kdialog --error 'The device failed to format for some reason.
Re-insert the storage device and retry. If it still does not work, contact commercial support.'"
;;
"reiser")
 kdesudo -c "mkfs.reiserfs -q $DEVICE || kdialog --error 'The device failed to format for some reason.
Re-insert the storage device and retry. If it still does not work, contact commercial support.'"
;;
"xfs")
  kdesudo -c "mkfs.xfs -f $DEVICE || kdialog --error 'The device failed to format for some reason.
Re-insert the storage device and retry. If it still does not work, contact commercial support.'"
;;
esac
kdialog --msgbox "Done!"

Wednesday, August 1, 2012

12 V fans at 24 volts (overvolt 12V fan).

(dated 1st aug, 2012)
I'm talking about the average 12 V fans you'd find at $1; it appears their reliability is pretty good, and looking at their MTBF (4 years of continuous operation), it's desirable to reduce their life with expense of higher airflow.

So I over-volted 2 of these fans to 24 volts and another one (which I dumped a few days ago cause it's bearings were problematic) to 20 volts. Notice, you can't take these fans to 30V, they burn out. So below 30V seems to be safe.

The 20 v one is working continuously for 3 or 4 days, with no signs of wear and tear (despite the fact that the fan's bearings are at a bad shape), and the 24 V ones is used atleast 8 hours a day, and is working since 2 days.

All of these are working fine till now. Notice that people claimed, at these volts, these fans won't last more than a few hours, but their reliability seems good till now, many times their expectations.

I tend to think the first thing to come off are the bearings (being mechanical components), since I don't think the coil of the motor gets too hot to burn the insulation of the copper wires of the windings, although burning of the coil is the second possibility cause the insulating layer degrades over time.

Burning of the controller is ruled out completely cause they were ok even after long operations.

As of the performance, you should realize that the power delivered to the fans is not doubled, should increase 4 folds, cause with the volts, the amps also increases. This means 4 time the air flow, and 4 times the RPM (read fan laws). I measured the power consumption of one of these fans.

To experiment, I attached 2 fans facing (the output of one fan is fed into the output of another) each other and sealed together with insulating tape. When one fans runs, cause of it's airflow, the blades of the other fan will also run; the other fan will also generate an EMF. I'll measure that. It's a measure of RPM.
At 12V, the other fan generated 0.45V, and at 20V, the other fan was at 1.59V, that's more than 3.5 times. Expect 4x at 24V.

At these volts, these fans make a lot of noise cause of air motion, the motor itself doesn't make much any noise. The air flow is so strong that you can feel the suction of the fan from quiet a distance, like 2 or 3 inches. Come up close, and it sounds a bit like a vacuum cleaner.

As of the wiring in my setup I used an external 12V 500 mA adapter clubbed with the SMPS's 12 v source from the molex connectors for the purpose (2 fans).

Don't try to club 2 of the 12 V outlets of the different molex connectors. They come from the same source which will result in a short when positive of one molex meets wit the negative of the other.

Maybe this setup has more value for money than the deltas and 120 mm fans.

Update (Aug 5th 2012) --one of the fans (running at 20 V) broke. My dog bit it, shattering half of it's blades. It ran for ~9 days straight with practically 100% uptime. The same day I bought a new fan with the same specifications.

On night of 7th Aug, the new fan died. It was working continuously for 2 days. It didn't get burnt in any way, but there was a strange problem with it. After giving it power (12 or 24 V), the the fan will rotate for a few minutes, then it'll stop. On manually rotating the blades, it behaved like a spring, or like a very powerful motor with TREMENDOUS torque (and powerful permanent magnets) which's offline.

I've decided to replace the fan with a home-made one. The Q/A of the fan was questionable from the start. It was moving slowly.

Also note that rest of the 2 24 V fans still work

Update -- one of the 2 fans was replaced today by me (on oct 13th 2012). Problems came up with the bearings; it was making too much noise.
But it's to be noted that this problem started before I hiked up the voltage to 12 V; it was showing symptoms of failure.

Update -- Again the new fan that I replaced above gave the same bearing problem; I've replaced it with a new one on 27th feb 2013. However this time the fan was not at 24V all the time cause of cold climate.

Update -- I realized these sleeve bearing fans can be lubricated (search google). That'll solve the bearing problems. However if you ignore the noise for a long time, the fan may incur permanent damage. After this, the fan has practically unlimited life until it's winding burns.

Unlike what Google articles suggest, I'll ask you to fill the oil almost to the brim (but not so much such that when you close it with tape the oil will stick to that tape) and seal it off with a small portion of an insulating tape.

Cut out the tape such that it just covers the hole (keep a little bit of margin), and apply superglue around the border of the tape. Just put a small drop of suerglue at 1 corner of the tape and try to spread it all around the tape to form an airtight seal. If you apply less superglude, it'll be easier to open up the hole again for oiling.

The reason for the complications as above and the reason for using insulating tape specifically is that, these sleeve bearing fans tend to heat up at the bearings and the coil also heats up. Then the oil and air in the hole will heat up and will put pressure on the sealing of the hole. So if you use tape without superglue, the oil will leak out cause the adhesive of the tape is not strong enough to contain it.

If you use a rigid material to seal the hole (insulating tape expands under pressure), like straight and rigid plastic sheets, the pressure inside the hole will increase to a very large amount until the sealing between the shaft and cylinder of the sleeve bearing breaks and the oil leaks out from the other side (this will not damage the fan though). Insulating tape on the other hand expands to compensate for the high pressure, preventing such a thing from happening.

The fan heats much more when you're overvolting it.

The large amount of oil will act as a reservoir and compensates for the evaporating oil. The sleeve and shaft is an air-tight seal (like piston/cylinder) and wont leak oil unless something's wrong with the fan; you can figure that out if the oil disappears from the reservoir the moment you put oil in it (or after a few minutes).

Practically I've seen a suction being formed instead of high pressure in the oil reservoir, that depresses the tape over the hole. The low pressure will be there until all the oil is used up, and then high pressure will develop bulging the tape. After this, within a few days (or maybe months), the fan will start making noises again.

The problem with oil is that it evaporates quick; so grease will be good, but the problem with grease is that it doesn't flow -- so it wont go down the bearing from the reservoir. So what can you do is mix them both and you get the best of both.

Since grease has an oil base, machine oil forms a homogeneous mixture with it. Thin the grease this way till it form a thick mixture which flows easily, then fill it in the oil reservoir.

This mixture lasts much longer (4 to 5 times more as per my stress tests, but in real life, it should be much more durable) and the fan moves MUCH faster cause of reduced friction.

However there are downsides. Once the mixture is used up, there maybe carbon deposits on the shaft which will prevent new lube from going in and at the same thing slow then fan down to a crawl. In this case, you've to actually open the fan up to clean the shaft and sleeve. And before you put it back, you may like to grease the shaft.

See how to disassemble the fan --

http://www.instructables.com/id/How-to-take-apart-a-case-fan/

Tuesday, July 31, 2012

Optical disks -- The most unreliable and expensive data storage medium.

When you think about disks -- thousands of complications come to mind: starting from the disk itself (+/-, DL, RAM etc...) to doubt about the data written on the disk (data corruption) caused by 1000s of possible combinations of problems (dirty lens, bad mechanics, old/faulty driver, manufacturing defect, software fault, writing speed, wrong way of handling, a fingerprint or scratch on the surface etc...)

Following all these facts, it's a matter of chance why a disk should write properly, and in most of my personal experience, they never do, even if they do, they degrade quickly over time and are susceptible of things like fungus etc..

Then it doesn't have any stable shelf life either, at most, it'll be 5 years; i.e you've to rewrite all your disks every 2 years in order to ensure that your data is OK.

Well, after all this, considering the amount of blank disks you waste and the data loss that occurs, disks ARE the most expensive and most unreliable medium.

A much better alternative is to buy hard disks for archival purposes or use tapes.

Wednesday, July 25, 2012

Offline wikipedia howto (with Apache, and mediawiki CMS, PHP, mysql)


Starting point –
Wiki allows downloading of their databases for offline use, these include static HTML (not updated) to SQL dumps to XML dumps.
The most tempting way is to use wiki's official CMS (mediwiki) and host it using Apache locally for internal use. You need to compile php with xml viewer and session support. To import database, you need to build it with the shell interpreter also.
Mediawiki uses PHP and some kind of SQL (mysql, postgre, or sqlite); it depends on the configuration of PHP on what backend will be used.
Next you need to download the XML dumps, follow the above links to do so. As an alternative, follow –
Both point to the same place actually.
Download xml dumps intended as backups (thus may be incomplete). If you want a single XML, download from

The keyword here is the 'pages-articles'. The above file is one large tarball of all articles, other files with name '*pages-articles*' are parts of the actual articles.

These dumps don't have images, only text.

Next, you need to get the sql server started and set the root password (how you do it depends on the OS), next start the apache server, open the wiki CMS and start the setup.

You'll be asked for the username/password for the SQL database you set up for r/w access.

Your wiki will soon be ready and a conf file (in php) will be made available for download which you have to place in the root dir of the installed CMS.

To import the xml database dump, you may use several ways as listed in

The most reliable but slow method is using the importDump.php php script as root to import the pages.

The maintenance folder has this importDump.php script with a lot more script which's used for housekeeping and management. To import –

php importDump.php

e.g –

php importDump.php '/home/de/media_writeit!/temp(others)/enwiki-20120702-pages-articles1.xml-p000000010p000010000'

This's going to take a lot of time. As the script imports, it will show progress on the number of pages imported.

You may check the import by opening random pages, but all of these will be without images.

Next, the images have to be fetched straight from the Internet in a crawler-like fashion, you may use 'wikix', a C program which does so and puts the images in a directory structure which the wiki CMS can read. Wikix takes input of the same xml files you used to import pages into the database from stdin; as output (stdout) it's going to make a bash script to fetch the images and put it in a directory tree (which's intended to be put in the 'images' directory in the place where you extracted the wiki CMS) which the wikimedia CMS can read.

E.g –

./wikix < ../../enwiki-20120702-pages-articles1.xml-p000000010p000010000.xml > scripts.sh

This makes a single script which uses curl to fetch the images.

Now the script has to be placed in the 'images' directory of mediawiki CMS and made to run.

If you use -p switch many scripts will be made which're intended to be run in parallel to allow parallel fetching (via a single master script which calls these scripts). The stdout doesn't have much when this -p switch is used, there's no output.

Download the source code of Wikix (copy-paste in text files) from –

The compiled program is recommended to be placed in the images directory, but you can place it anywhere, just ensure the directory structure holding the download pictures are placed in the images directory of the CMS.

Once downloaded (or partially download) and placed in the images folder, run –

php ./rebuildImages.php –missing

This's going to index the images and link it to the images which're linked in the rendered CMS which makes the images available.
The script lies in the maintenance folder.