Professional‎ > ‎

Articles on-line

RGB LED controller

posted Jan 13, 2017, 11:17 AM by Konstantyn Spasokukotskiy

Residential accent light

Here is a holidays 2016 project. I concluded that market lacks a practical budget LED controller. Numerous market propositions for an RGB LED controller have been analyzed. A couple of controllers have been purchased and tested. They left to wish more. My two killer apps would be: a) colored light with automatic daytime or night accents, b) light control via conventional wall-mounted light switches. A long story ended up with the maxim "if you want to do it right, then DIY."

My final LED controller design makes following features available:

1. light with chosen color and light intensity
1.1 color selection via rolling rainbow (two-color cycle and 2 variants for three-color cycles)
1.2 rolling intensity selection (luminosity range 90 - 2500 mcd/LED)
2. push-button instant white light
3. day/night mode (automatically controlled by a build-in clock)
4. direct LED strip application for up to 100W

Controller architecture

  1. user interface unit: one power on/off switch, one function switch, one reset button.
  2. control unit: AVR uC ATtiny85 packaged as a Digispark, DS3231 timer packaged as an Arduino shield.
  3. light unit: light emitter RGB SMD5050 packaged as a common-anode RGB LED strip, and 3 channels PWM power driver.
The strip has 60 LEDs per meter, totaling 14W power consumption per meter if all LEDs are fully loaded. The proposed circuit allows up to 36W per channel, 100W total power on passive cooling. The controller would be enough for up to 7 meters LED strip. More demanding installations should deploy LED amplifiers. Alternatively the MOSFET power drivers IRLR2904 could be actively cooled to increase load or they can be replaced by devices with better characteristics.

The micro-controller ATtiney can be found in many RGB LED controllers. It is cheap and easy to use. The Digispark board adds upon a simple programming interface via USB. It utilizes Arduino IDE (Here v1.6.7 with Digispark add-ons). The issues with ATtiney:
A) the number and functionality of its pins is limited. If one wants to modulate 3 LED channels, and deploy 1-wire interface (I2C occupies actually two pins), and do use a push-button UI, then at least 6 universal pins are required. There are exactly 6 pins available. There is no universality of the pins in ATtiny85. Some of the Digispark pins have already dedicated functions. So at the end the engineering task is complex, but solvable. The resolution comes with pins multi-functionality. Both hardware and software had to be stretched and will probably require a tuning.
In particular, the hardware sets various logical levels for different functions on the same pins. So the values of the soldered elements have to be strictly followed. For the majority of replicas it would be enough. Though, depending on the quality of your power supply unit and on the dynamic range of your load (in practical terms it would be the total length of attached LED strips), the PSU output voltage may deviate from nominal value and the logical levels may significantly fluctuate while light intensity changes. Then the pull-down resistors may require an adjustment. And the code should associate user commands with more appropriate voltage levels.

Here is a realization on a 2x8cm breadboard. From left to right: the timer shield, a Digispark clone, the row of 3 power drivers, a reset button. Red and blue drivers have passive radiators applied. The timer battery CS2032 is recommended to replace with a rechargeable LIR2032. The shield has appropriate circuit to recharge it. It is useful to increase service period for the device. With CS2032 the service period is 8 years.

final board
back side of the board

B) ROM is limited. The software deploys additional code to distinguish multiple functions on the pins. Various functionality at different pins also requires libraries, which take a lot of ROM. The space in Digispark compared to bare ATtiny85 is additionally reduced by micronucleus. The remaining 6kB is meager. The productive method was to strip down libraries to the essentials. Therefore some library snippets are transferred into the sketch. Such libraries are excluded for the declaration list.

Following libraries helped to realize the project:
  1. VirtualWire - handles interrupt for software PWM on all 3 channels. Three hardware PWM on pins 1,3,4 is hard to apply in Digispark since timer1 is in use by micronucleus. The commonly available hardware PWM code doesn't work. The VW library takes approx. 11% of Digispark memmory. The project uses only two external functions from the library. Clipping it reduces ROM usage by 8%.
  2. TinySoftPwm - handles pulse wide modulation. PWM manipulates amount of light emitted by red, green and blue components, which mix to produce distinct colors.
  3. avr/eeprom - stores settings in energy independent memory. It eliminates the common LED controller misconception - forgetting settings after power-off. The forgetting makes many controllers unusable in simple residential applications. The library can be excluded from the sketch to save about 11% ROM. EEPROM operations can be handled by TinyWire library if you utilize EEPROM bank in the DS3231 instead of internal ATtiny bank.
  4. TinyWireM - communication via I2C bus, where uC works as master. It enables to use DS3231 timer (I2C slave). The timer is a precision clock with thermal compensation. It is energy independent and runs while LED controller is powered off.
  5. TinyRTClib - reads timer registers and sets clock. The library takes much space while only three external functions are required. Clipping them reduces ROM usage by 6%.
The sketch code is available in the files repository below. Its comments are fair to understand and improve the code for a solid Arduino software developer.

The sketch has a commented line in the function setup(). The line initializes the clock module at its first deployment. The sketch has to be uploaded to the micro-controller for the first time after PCB assembly is finished. I this case the line has to be uncommented with time parameters set correctly. The sketch would be uploaded and immediately run once. After that the sketch has to be uploaded once again with the line commented out. Since the Digispark ROM utilization by the sketch is 99%, uncommenting the line writing to the timer requires commenting out another instruction. The line that reads values from timer would fit the task.

An operational controller

It should be installed in a serviceable box. It should be attached to:
  1. an appropriately powered 12V PSU,
  2. a LED strip, and
  3. a wall-mounted two latch switch.
An additional wall-mounted switch can be applied as a general power on/off, to cut PSU off AC supply. In this case a micronucleus update is required to eliminate 5 sec boot-loader delay. Digispark enters programming mode for 5 sec after reset button is pushed with micronucleus-1.11-entry-ext-reset-upgrade.hex. Accented light starts immediately after general power switch is turned on.

RGB controller installation example

The typical use cases are depicted below. By default the controller drives RGB strip into color accent after it's switched on. A straight white color can be seen at the same intensity level as accent, if the control button is clicked on and off. The controller starts with accented light again after power off. More functions could be read from the control diagram in the attachment.

user scenarios

Bonus idea

At the end I've opened up a couple of commercially sold controllers. It seems, they do indeed utilize AVR uC. At least they have the 8 pin controllers. The available in the controllers LED PWM drivers a fully functional. Soldering a DIP8 IC socket on such commercial PCB may allow construction of the better controller with minimal soldering and in a decent housing.

The Greatest American Teamsports

posted Dec 24, 2011, 12:36 PM by Konstantyn Spasokukotskiy

America is entering new paradigmatic phase - tribal society. It is a prediction by Howe & Strauss that has been made before social media made the tribalism or a re-invigoration of social order apparent. Though, a tribalism in shared opinion, as it comes through social media, doesn't necessarily ends up as tribalism in social fabric. Common opinion is an indicator of sheepmanship. A functioning society requires more than that. Opinions have to be transformed into generation's soul and be worth defending. A proof to the later is regular action. There is probably no better tool to track tribalism than team sports.

A snapshot for the state of American team sports uses data provided by the Sporting Goods Manufacturers Association (SGMA). It spans four years from 2007 to 2010. The most significant metrics of a sport would be 1) what percent of total population is participating, i.e. general involvement; 2) what percent of the sport participants are doing it on a regular basis, i.e. core involvement; 3) how does the general involvement fluctuates throughout the years, i.e. involvement volatility. The following chart benchmarks all American team sports that made it over the threshold of 1% general involvement. Only inherent team sports were considered. These sports require regular team work for basic training, offering no escape for individualistic performers. The made-up team sports like relay races etc. are not taken into account.

team sports participation in America

General involvement
is a popularity metric. Popularity is driven by the perceived overall quality of the sport as well as by commercial sport show-business. The more money is flowing within the professional sport leagues, the more popular would be the sport as recreational activity. Popularity is inversely impact by the novelty of the sport. The younger the sport, the less likely is massive participation.

Basketball and football top the list being show-capable sports.

The NBA revenue is currently in the range of $4.1B. The NCAA Division I brings $0.76B in. Assuming that a sports-accented fashion is a promotion vehicle, retail revenue should be accounted as a part of popularity metric. Judging by the share of the generally involved population, the U.S. sporting goods retail industry for basketball makes from $6B to $16B annually. The total basketball value exceeds $11B.

NFL revenue is $9B. High school football has several dozen millions investment capital. Most of it is spent on training needs and sporting goods. Judging by the share of the generally involved population, the U.S. sporting goods retail industry for football makes from $4.8B to $12B annually. The college football revenue approaches $3.2B. The total football value exceeds $17B.

Involvement volatility is the attraction metric. It shows how the participation in recreational activity is stimulated by the outside factors. Success in massive commercial operations and marketing efforts would determine inflow of recreational sportsmen and women. When these efforts weaken, there are not enough freshmen to compensate expected involvement deterioration caused by disenchantment.

The absolute disenchantment champions are football and volleyball. Both have rather extensive requirements for playing grounds as well as minimal viable team size. In addition to that football has high potential for sport injuries - roughly 2 times higher than basketball, i.e. 28% chance vs 15% - that makes it less attractive for viewers, who wanna be players. Both sports, football and volleyball, require significant skills development prior to reaching the point of flowing game and enjoyable pastime.

If involvement volatility is a scale for an advertizement driven participation, the adjusted general involvement, that isn't heated by football being #1 commercial sport, would not exceed 4%. It would place football among the games of mediocre quality.

The absolute true-to-value champions are soccer, basketball and frisbee. The games are most likely better to play than they seem to be for outsiders and viewers. All three sports have an above average potential to be marketed to recreational sportsmen.

Core involvement is the affection metric. It shows how well the sport serves to the intrinsic needs of the participating individuals. The values can be of physical as well as hedonistic nature.

In the later sense interesting observation is that the most expensive sport, i.e. sailing, and the least expensive sport, i.e. frisbee, are in the same ball park. Possible explanation is that the sports are indeed on the opposite ends of a bell curve. Frisbee is not attractive enough to keep players striving for fame and show-off. Sailing is exclusive enough to be inaccessible on a regular basis for the people, who would like to participate. The steady demand is confirmed by low involvement volatility. A better market positioning for frisbee could make it significantly more popular and addictive.

To prove the point that tribal life is becoming more popular and it can be quantified by an associated metric - team sport participation - we will need to wait for a statistically significant period of time.  The listed sports involve today about 38% of the U.S. population. Let's check it again in 10 years.

Optimal Do/Tell Balance

posted Oct 20, 2011, 12:07 PM by Konstantyn Spasokukotskiy   [ updated Oct 20, 2011, 12:15 PM ]

The self-accountable product development teams and particularly entrepreneurial teams often have to balance where do they sink available talent and resources. If the balance isn't concisely defined and consensually maintained, there could be a significant drawback. For once it could result in overspending while reaching required milestones. Or it can instill a counterproductive egalitarianism. In any case the result can be a blame game or worse canceling the project. The positive side of explicit balancing is that one can actually plan required performance and talent demand in advance with great accuracy. It can reveal deficiencies and priorities for team development. hidden image

The classic microeconomics approach is to split the activity in out-capabilities and in-capacities, i.e. an ability of the team to wrap a product in a desirable package and an ability to actually produce the product up to the expectations. The outwards activity is in vogue referred as sales or Tell. The inwards activity is referred as Do. Herewith the required project resources are defined as:

Resources = Do + Tell

The created value, or the recognized by the market performance of the team, would be roughly proportional to the product of talent components:

Performance ~ Do*Tell


The value of the product never ever progresses linear with applied effort. Most project managers know that a tiny fraction of the efforts defines success. Particularly, a typical well-managed technical project delivers more than 50% of value in the first third of the time. It is a logarithmic function. So the Do recalculated in output terms would transform last equation into:

Performance ~ log(Do)*Tell

If we assume that the performance evaluator is rational, knowledgeable and merit-striving then no further transformations of Do are required. An indifferent person is cynical. Such a person would have a product performance expectation level Expectation. She will depreciate the value of all all lesser results:

Performance ~ [exp(log(Do)/Expectation)/e]*Tell

There are special cases if product value becomes apparent strictly at the end of a project. Those are typically integration and MVP projects. Many truly innovative projects belong to this category too (see my presentation about Innovation Cycle, as well as note the performance metrics in the chapter "Effort Balance" below). Such projects can't be described by a logarithmic performance function. A step function or an exponential function would be more appropriate. The approach for a well-meaning thoughtful customer can be formalized as:

Performance ~ Do*exp(Do/100)/e*Tell

An approach for cynical customer would take following form:

Performance ~ exp(Do*exp(Do/100)/(e*Expectation))/e*Tell


Similar to the efforts for product creation the efforts for marketing the product don't translate into results one-to-one. There are two aspects here. 1) applied marketing tools, 2) diminishing efficiency of marketing efforts as the number of recipients grows. The later is similar to the case of logarithmic production output:

Performance ~ D*log(Tell)

The former represents three promotion methods:
  • Linear Marketing

    This is a message distribution method for saturation products. Doctor offices, competing grocery stores, nice to have, lifestyle products, etc. There is nothing exceedingly exciting about the product. The sales efforts don't differ from knocking on the doors and begging. The maximum Tell performance is conversion of 100% people you've pitched to, while facing one person after another. There are rarely well-meaning prospects in this category. The appropriate equation will look like:

    Performance = exp(log(Do)/Expectation)/e*Tell

    There is no adversary effect if the sales force reaches larger crowd. The costs of approaching prospects is high, so the effort will be wisely applied any way. The better your legs are, the better the outcome.

  • Power Marketing

    This method is applicable for mildly interesting products, when customers may mention the product once in a while during a communication with their peers. Or it can be applicable for saturation products if sales force uses active push tactics, like referral bonuses, coupons, etc. Assuming a well-minded prospect that multiplies sales effort by providing references Reference Multiplier, the appropriate equation is:

    Performance = log(Do)*Reference Multiplier*Tell

    The reference Reference Multiplier is a multiplication factor. It remains a low single digit number. Most likely it doesn't exceed 2. There is no significant adversary effect on the marketing efforts. Essentially it is still a job that leaves bones worn out.

  • Viral Marketing

    This method applies to sensational products and skillful marketing teams. Rumors and other guerrilla marketing instruments may create a wave of "uncontrolled" referrals. The description of marketing performance for this method is roughly similar to the logic in Metcalf's Law:

    outcome ~ nodes*(nodes-1)/2

    The outcome asymptotically equals nodes2. On the other side of the coin, viral marketing uses broadcasting instruments that demonstrate diminishing return if the size of target group increases. The appropriate total performance can be -best case- described as follows:

    Performance = log(Do)*log(Tell)2

    wost case:

    Performance = exp(log(Do)/Expectation)/e*log(Tell)2

Effort Balance

Almost every project team has limited total amount of efforts as described above by the resource equation. Assuming the total amount equals 100%:

100 = Do + Tell, 
Tell = 100 - Do

The question is how to distribute the efforts among the Do and Tell activities. There are two tasks while balancing efforts: 1) efficiency, 2) effectiveness.

The efficiency task seeks the maximum productivity, gain that is obtainable by a given work capacity. Assuming there is no penalty for bending discrete nature of labor units (product producer doing marketing job and vice verse), we can obtain a performance curve for different Do & Tell models. The curve will give us optimal efficiency balance at the point of maximum performance (see chart, vertical axis). Do value can be read from the chat below, horizontal axis. Tell value can be calculated as stated above.

The actual pike value suggests maximum relative performance for different approaches if calculated as a Performance1/Performance2 ratio. By comparing to the maximum yield (here small group viral marketing, i.e. Performance2) we can estimate effectiveness of other approaches.

efficiency balance at highest point
  • Small Group Viral Marketing
    Do 15%, Tell 85%, Performance 19750 = 1 unit

    A micro-scale viral marketing is the most effective marketing method. It is about 40 times better than the next closest method. If you can precisely identify your target group, it's the cheapest way to get desired results. One needs to dedicate approximately 15% of resources to manufacture a product and 85% to market it.

    Interestingly, in the USA only 18% of GDP is produced by manufacturing sector (all sectors that remotely produce goods 25%). It seems, the country is well-segmented in "little villages". The available communication instruments are effective to say at least.

    For integration projects: Do 41%,Tell 59%, Performance  79122 = 4 units

  • Linear Marketing
    Do 23%, Tell 77%, Performance 73 = 0.004 units

    This method is the most attainable. It can be practiced by non-professionals. Many purely technical startups, particularly B2B and nice to have B2C, practice it. The efficiency is quite fair, considering that material expenditures can be quite low - an attractive target for the Lean Startup movement.

    Integration projects: Do 0%, Tell 100%, Performance 37 = 0.002 units
    With optimal Do at zero here is a proof that cynicism kills normal business.

  • Power Marketing
    Do 24%, Tell 76%, Performance 483 = 0.025 units

    Power marketing can deliver second best effectiveness. It is 6 times better than the low-key linear marketing. For the best efficiency the manufacturing efforts should consume about a quarter of all resources.

    Integration projects: Do 62%, Tell 38%, Performance 3222 = 0.16 units

  • Viral Marketing - thoughtful attitude
    Do 36%, Tell 64%, Performance 62 = 0.003 units

    Integration projects: Do 74%, Tell 26%, Performance 606 = 0.03 units

  • Viral Marketing - cynical attitude
    Do 38%, Tell 62%, Performance 19 = 0.001 units

    A full-scale viral marketing -no matter what is the perception mode- isn't particularly effective. This is also a signal that nothing goes by itself. Great buzz requires a lot of guidance and nurturing. It costs a lot. An advantage is distant (non-face-to-face) leads processing. It can be used by robots as practiced in web businesses. Another advantage is a flat top. Viral marketing approach is tolerant to management mistakes, while doing resource allocation and project progress management. This is often an enabler for teams that don't have sufficient management expertise.

    Project teams want to add significantly more bells and whistles into their open beta products ~ 2.5 times more than closed alpha, i.e. comparing to small group viral marketing; and 1.5 times more in comparison to pet projects, i.e. linear marketing. The next chapter "Effort Costs" will give you an idea what it means to have a more advanced product from get-go.

    Integration projects: Do 68%, Tell 32%, Performance 9 = 0.0005 units
The performance distribution curves for in-core innovative or integration projects are on the following chart.
innovation performance in relation to production efforts
An important lesson is that innovation projects need 2-3 times more prefabricated substance before roiling out with any marketing approach. Given that innovative products generally require more intense marketing than incremental (anticipated) improvements, the lower marketing share for innovation products is actually larger in absolute terms. Assuming marketing costs are equal for incremental and breakthrough improvements, the optimal investment in innovative technology sans marketing should be at least:

Investment Multiple = (Dobreakthrough*Tellincremenal)/(Doincremental*Tellbreakthrough)

That multiple is 5.2 for power marketing, 3.9 for viral small groups, 5.1 for viral marketing to thoughtful people, 3.5 for viral marketing to general population. So much about the notorious micro-VC argument. Sufficient seed financing, capital formation at very early stages is probably the most important thing to keep entrepreneurial America afloat.

Effort Costs

Besides effort balancing the next most interesting questions in this ball park are: 1) what are the minimum required skills to accomplish a project, and 2) what are the tolerances for resource allocation that wouldn't jeopardize the project, i.e. acceptable range for management mistakes. With a little help, using a couple of industry specific metrics, these questions can be reliably answered.

First essential variable is Productivity Increase Multiplier that is capable to attract free floating capital. There was an estimation for the U.S. market in my presentation about Financial Bubbles that had said 5 times (>500%). Similar method can be applied to any other country. The data will be based on the particular national stock and business practices at the time of analysis.

The productivity increase can be supported by both superior soft skills of the business team (companies with service profile) and superior technology that provides functional gains or/and costs advantages to consumers (asset profile).

In case of service there is no much variance. A sales person can vary her work intensity from 0% to 100% and modulate it by selecting an appropriate marketing approach. Despite significant gains/losses that occur by preferring a particular marketing approach, the modulation isn't freely available. It is limited by the product's nature and availability of complimentary resources that the talent has to leverage -all largely exogenous factors. For example, if there is no budget for referral bonuses and promotional material the power marketing approach would necessarily default to linear marketing. Sales approach can impact customer engagement. For the only case when it matters - viral marketing - the difference in parameters is negligible and the real-life difference in performance is less than 3 times. It is safe to assume that a Tell-talent is primarily characterized by her ability to utilize given time productively, while avoiding mission impossible endeavors. The amount of productively spent time can be measured as a percentage point of the entire time resource. Summarizing: the sales people talent has a narrow effective bandwith from 0% to 300% of standard sales performance.

Similarly, the sophistication of created goods and assets can be liked to time utilization of an average engineer. Bright minds aren't necessary if standard combinatorial product development can do the trick. But in case the Do*Tell team-performance doesn't live up to required level, an inspired engineer can invent. Unlike sales, a technical talent would be able to add a magnitude at the Do-scale. Though, this immediately will throw the project into the in-core innovation basket, hence shifting all project parameters and making it harder to sell.

Assuming that the standard settled-down industrial complex has final productivity proportional to 100% of human time utilization, i.e.

Productivity ~ N*100

where N is the number of employees. The project team's productivity has to be:

Productivityproject ~ Productivity Increase Multiplier*N*100

If we have two primary competences Do and Tell, while each can be up to 100 productivity units or per cent, then the outstanding project's performance has to be at least:

Performance = Productivity Increase Multiplier*(Do + Tell)

The minimum required skills level can be calculated by solving the equation:

Productivity Increase Multiplier*(Do + Tell) = f(Do)*g(Tell)

where f(x) and g(y) are appropriate effort-to-result functions as described in the chapters "Do" and "Tell".

This equation has no practical solution for linear marketing. The maximum performance level at 73 units is by factor 14 less than required. Significant ingenuity is essential to make such projects attention worthy.

Assuming that the project team has all favorable conditions and acquired top-notch sales talent (100% performance and the performance boost at maximum = factor 3), the project performance will not exceed 700 units. In plain English: an extraordinary sales guy alone will not cut it on incremental improvements. The engineering team has to be 1.4 times more productive than a good engineer. Should the engineering team be 7 times more efficient, the marketing team has still to exceed expectations by at least 2.5 times. The entire productivity function that considers minimal requirements for linear marketing approach looks like following:
linear marketing, minimal requirements and productivity
Values of Tell over 300 = 3x average productivity at 100% efficiency, i.e. no-mistakes, dedicated employee, as well as Do over 1000 = 10x average productivity, or technology efficiency at the moment of market entry, are not realistic. There is just a narrow strip where an incremental improvement project can be successful. The success means reaching EVA at the level that is attractive for all stakeholders in free-market economy.

The skills function for viral marketing of incremental projects has no solution whatsoever. No effort will ever create sensible EVA. If you know such projects, they are a wealth redistribution or an ideologically painted highway robbery. It seems, any incremental or lowest-costs innovation project isn't a practical solution for positive wealth creation. If not counting for small scale business, as in case of small group viral marketing, it is either impractical or outright impossible. 

The skills function solution for viral marketing of in-core innovative projects is as follows:
The skills function solution for power marketing of core-innovative projects reveals that it is quite effective method to process projects. Despite high upfront capital requirements, the risk is low. The projects can be processed by ordinary humans. A realistic long-term 50% work intensity for both technical and marketing team members would be sufficient. It explains why rigid corporations, having minimal incentives to innovate, are actually successful and have relatively low project fail rate. The ability to subsidize market entry, i.e. to provide significant upfront incentives for committed distribution partners, pays off.
power marketing, truly innovative projects, performance requirements
To obtain real talent productivity metrics the reads form the charts above have to be related to Typical Employee Productivity metrics across the industries - the second industry specific variable. For example, it is common for automotive suppliers to have a revenue per employee in the range of $200k annually. In the IT sector this metric is in the range $300k to $1.3M. Most likely an average technical IT-guy would qualify for the genius role on a project in automotive industry. At the same time, an average IT-sales guy would be helpless in automotive industries, where there is not enough profit to sponsor large capital intensive break-through and promotional programs as done in web. The necessarily low-key marketing approach will demand much more refined individual skills to lead the projects into fruition.    


The theoretical contemplation shows that the decision making in resource allocation for innovation projects is complicated. Depending on how one restricts the thinking plane and sets of important variables, there are sub-optimums in resource allocation. I've seen a lot of failures when professional managers clearly fall for those sub-optimums AND were defending their straight as well as just optimal decisions.

Nonetheless, theory is just that a tool - not a master. A master beats theories by being even more sophisticated. Please write back if you have positive cases when this theory didn't work or was too exclusive while considering important phenomena in project management.

A Tail of Payment: one, two, ...

posted Jun 30, 2011, 4:13 AM by Konstantyn Spasokukotskiy   [ updated Jul 1, 2011, 2:37 PM ]

Mobile payment is becoming hot, shiny, new hype thing. There are different mobile payment approaches. There are approaches to make sense of the approaches. Here I add my spices to the soup. This article builds upon two methods. First, the historical perspective. Second, the utilitarian perspective. To be sure, none of them is sufficient in predicting what's next. But a superposition of the methods as well as data that you already know may give a clearer crystal ball view.

A brief history of modern payment

There was a time when cash was the predominant payment method. Let's call it payment 1.0.

Advancing industrial (engineering) revolution demanded new ownership form for capital stock - corporations. Huge sums of capital were required to pull the industrial thing off. At the time industrial assets were too expensive to be purchased and owned by sole individuals. The ideas of collectivism quickly won over. In fact, collectivism was so powerful in the real economy terms that by inertia gave birth to socialistic notions. For example it had been a driving force behind French Revolution. The revolution may had been an overshot, but the corporations as a collective ownership of production means became the worldwide standard.

Collective ownership and high production output brought two problems: 1. big sums of money, 2. unwillingness of management to be accountable. Big money were bulky, hard to store, hard to transport, hard to defend. Management didn't want to risk life for ensuring money storage and financial transactions. Banks came to the rescue. Noncash (cashless) payment: warrants, checks and transfers as we know them, had become strong during the time. Everybody won. Managers got rid off a substantial risk. Banks could grow rich by collecting fees for handling real money, while practicing fractional reserve and clearing houses. The payment 2.0 was conceptualized.

Noncash payment in it's infancy had the potential to advance our society only up to the 1.5 level. The cashless operations were at first reserved to business entities and few affluent people. A significant portion of economy ran cash. Consumers didn't have enough incentives to go cashless. Banking inevitably introduces additional business processes to transactions. Individuals didn't want to pay the price. For a while banks were not interested in winning consumers over. Big sums were processed for the industry. It provided good return to effort ratio. Penny pinching personal banking wasn't very attractive.

Over time individual craftsmen, small farmers and traders went out of business. Consumption goods are almost entirely produced and distributed on industrial scale since the second half of the twentieth century. The cushion that separated cash and noncash operations had gone. Banks have become direct intermediary between individuals and businesses. Cash flow doesn't bypass banks any more. Banks are forced to handle cash from consumers. Handling cash is hard and expensive. Banks got a reason to think anew. Consumers still didn't want to assume the noncash burden - no avail.

The first attack was a frontal assault - forcing personal checks upon consumers for retail payments. Noncash payment had been sold to many businesses. For example, many government entities don't take cash. Households have only other choice - money order - that is overall more expensive than maintaining a checking account. This effort to engage banking effectively converted nonconsumption into nominal customer base, but de-facto cash changed hands wherever possible.

The second attack exploited a more sophisticated back-door plan and thus has been more successful. Electronic payments provide convenience to consumers while shift most of the transaction costs to businesses. Particularly debit card can be seen as checks progeny. Since 2006 debit card use has grown 14.8% - more than any other payment method. Finally, the amount of cash and cash-like resources dwindles as electronic payment is being adopted.

Noteworthy, it wasn't the debit card that broke the ice. A more convenient "check" handling wasn't the decisive feature that motivated consumers to acquire new payment habits avoiding cash. Among the deal-breakers were: too much transaction transparency; lack of convenient facility to exchange funds between neighbors, who live back in the woods; etc. The gains of electronic payment were balanced by losses.

The success of debit card rides on the back of electronic credit card. An easy, no-smile, immediate access to money was the killer application. In the early 1980's reckless lending was enabled by new monetary policy. It attracted swarms of consumers. Credit effectively sponsored learning and switching costs. Consumers adopted noncash everyday payment as requirement for getting easy money. Payment by credit cards is in decline today (2006-2009 payments by credit card reduced -0.2%). An exuberance paved the way to electronic era.

The utilitarian analysis

If history is any guide, mobile payment is just a flavor of electronic noncash payment.

The overall economic potential equals the inefficiency costs that still remain in the system. The costs can be estimated. An extrapolation of historical value that was released by moving from payment 1.0 to 1.5, then to 1.X can provide the scale of upgrade from 1.X to 2.0. It is fathomable that another 3.0 horizon could present itself after we reach 2.0 milestone. But for now, 2.0 milestone alone seems to be an adventurous task. Even if 1.X - 2.0 upgrade doesn't sound like a great deal, it really is larger than prior developments. The significant metric here is value release/year. Speedy value release is due to a multiplicity of factors that favor rapid adoption of noncash payment. A compressed time scale makes little shifts high paced and substantial.

The most important question for technologists is "who's horse to bet on?" There are three principles to consider:
1. mobile payment is a new trick to bridge old capability gap. That means old motivations and reasoning persist. The main adoption drivers would be: ease of use for consumers and low transaction costs for banks.
2. consumers do not adopt new payment technologies unless advantages are overwhelming. A winning solution has to minimize adoption burden and attach benefits that originate outside of banking ecosystem. The later means that
3. technology perks matter. Technology availability and costs/function will determine which payment system wins. It is not to expect that payment industry will be costs-efficient by sponsoring proper technology. Vice versa, technology will sponsor establishment of successful payment methods.
It seems that physical availability of technological infrastructure would be one of the determining factors. Technologies like near field communication (NFC) are relatively easy to use but will never ever be prevalent. A scenario: two people shake hands in a desert and exchange funds - will take very long time to occur with NFC. It requires active, integrated into the circuitry NFC chip that is available in all phones.

At the same time simple second-hand phones are already ubiquitous in many corners of the World. Technologies that don't rely on hardware capabilities have timing advantage. A modified voucher-like system -that doesn't have any hardware anchor- would have good chance winning the race. Unfortunately none of the contemporary systems lives up to the task. Be it lack of direction, too much greed or else, great applicability and thus potential availability aren't supported by the ease of use and low costs. An opportunity, once, twice, ...

Radiation Calculator

posted Mar 23, 2011, 7:04 PM by Konstantyn Spasokukotskiy   [ updated Jun 30, 2011, 3:30 AM by Konstantyn Spasokukotskiy ]

The annualized radiation exposure model estimates your overall dose and compares it to the general population.The calculator compares individual exposure to the overall average exposure levels. It also compares the levels to the average among the inquirers of this site. The calculator estimates time (ETA) to earliest possible cancer occurrence that is due to the given radioactive exposure.

You can estimate what-if scenario. Please indicate such scenario as "what-if" in the field "last name". It will be cleansed from the database automatically. Significant impact have: exposure to natural radiation by venturing outside (Yes, bunkers are the safest.); airline use; visiting nuclear disaster sites or living nearby.

The top bar shows data for the last processed entry. Fill in the following form and after a reload you'll see an updated chart with your data. To reload the chart you can manually reload the page or wait a minute - it'll be updated automatically. By submitting the form you agree to publish the results for public view.

Is Midwest new entrepreneurial powerhouse?

posted Mar 18, 2011, 8:41 AM by Konstantyn Spasokukotskiy   [ updated Mar 22, 2011, 10:25 AM ]

The Midwestern states and the Southern states at the same longitude appear to drive the core entrepreneurial activity in the US. The Kauffman Foundation's report about Index of Entrepreneurial Activity for the year 2010 delivers basic statistics. After some data clean up true centers of innovative work are revealed.

The original 2010 Index of Entrepreneurial Activity (IEA) distribution map:

The IEA doesn't say a lot about the entrepreneurial zeitgeist or quality of pro-entrepreneurial governance. It accounts for all phenomena leading people into venturing on their businesses. The fundamental flaw of such approach is that it doesn't respect structural discrepancies within entrepreneurial community. For example, an entrepreneur starting business on the basis of having productive new business idea has significantly greater chances to succeed than an entrepreneur starting business to serve the customers abandoned by her previous employer. Actual statistics doesn't differentiate those entrepreneurs. In fact, the new-idea-entrepreneur is a sign of economic growth. It is what we attribute the hope of impact for such activity with. The serve-abandoned-customers-entrepreneur, on the contrary, is a sign of desperation and shrinkage. Corporation can't serve the customers costs efficiently any more. Some newly unemployed employees pick the clients up. The costs structures for little shops are worse than those of the corporations. The only way to cover the costs and the fall out of standard profits is lower personal income. It is economy winding down. There is no point for entrepreneurship. That is in the times of epic economic change the IEA should consider structural entrepreneurial differences.

One way to get real with IEA is to clean it up, to remove the induced entrepreneurship component. That could be that objective lack of jobs forces people to jump start on their own. People have no other choice. There are two hints here. First, the long-term unemployment growth. Second, founder's confidence.

The long-term unemployment growth is a difference between actual unemployment level and the normal levels of unemployment throughout the time. The basis for the later is unemployment rate in the year prior to crisis. The official unemployment report 2007. The relevant for Kauffman's report unemployment data is official unemployment report 2010. To obtain recent unemployment growth metric use official data in unemployment report 2009. To consider relevant long-term unemployment growth for the year 2010 one can use average long and short term unemployment growth as

The founder's confidence is to consider as it's variance. I.e. the larger is variance (span of founder's confidence within a state) the more drastic are structural differences in the entrepreneurial community. The data can be obtained from Kauffman's report. The True IEA can be calculated as

The final Core Entrepreneurial Activity Index (CIEA) is defined as
It wipes out the induced entrepreneurship form IEA metric entirely. Here is CIEA map:

Well, it doesn't look like a heat map for the origin of entrepreneurial blog messages, entrepreneurial clusters or VC residencies, does it? But it bears a close resemblance to the wind power distribution in the US ():
Under the link is another interesting chart. It hints indeed that the real business growth beyond the job regeneration level occurs in energy sector, far away from the usual suspects. California, Georgia and others make surely a lot of efforts to kick-start entrepreneurial ventures. But! It is merely enough to replenish business fall-out and to maintain existing productivity levels. Such states are riding crowded, increasingly less productive industries, having no real growth in sight.

What do you think?

Индикация свободного пространства на samba диcке | Script

posted Mar 5, 2011, 1:30 AM by Konstantyn Spasokukotskiy   [ updated Mar 7, 2011, 6:04 AM ]

Самба сервер - дешевый и надежный способ управления сервером данных. samba server - это стандартный компонент для подавляющего большинства серверов работающих на операционной системе linux. Он позволяет обмениваться файлами в сетях microsoft, т.е. позволяет компьютерам с windows сохранять и получать файлы без использования дополнительных программ.

Современные домашние сети и сети для мелкого бизнеса могут включать в себя несколько серверов и сетевых хранилищ данных (network attached storage NAS). В свою очередь, они могут содержать несколько независимых и  логически раздельных устройств для хранения информации. При работе с сетевыми хранилищами данных полезно быстро определять свободное пространство и общий объем хранимых данных.

Один из способов - это присоединение сетевых дисков к локальному компьютеру (network drive mapping). После назначения сетевому ресурсу буквы локального диска в окне "компьютер" можно увидеть объем диска и доступное свободное пространство. Недостатком метода является необходимость присоединения каждого сетевого ресурса по отдельности.

Другой способ - это просмотр сетевых ресурсов в режиме "детали (details)". Самба сервер позволяет индицировать коментарии к каждому отдельному сетевому ресурсу. Достоинство этого способа в отсутствии недостака, который характерен для способа присоединения сетевых дисков. Никаких других действий, кроме просмотра доступных ресурсов, не требуется. Эта статья рассказывает о том, как правильно настроить самба сервер.

1. создайте директорию sambaservice на linux сервере, в которой будут храниться вспомогательные файлы.

cd /home | mkdir sambaservice
cd /home/sambaservice

2.  создайте исполняемый файл, который принимает имя жесткого диска, как параметр, и возвращает  строку: "свободное место на диске [размер диска]"

#! /bin/bash
# returns disk usage.

# June 2010 by Konstantyn Spasokukotskiy
# execution example: ./ hda3
# output example: 134G [548G]

SIZE=`df -h | grep $DISC | awk ''{print $2}''`
FREE=`df -h | grep $DISC | awk ''{print $4}''`

echo $FREE "["$SIZE"]"

3. создайте исполняемый файл cron-task-diskusage-samba, который будет создавать динамические строки кометариев для отдельных дисков файловой системы. Строка коментариев состоит из ключевого выражения " comment =". После этого выражения идет любая текстовая строка. В данном случае, строка будет динамически отражать свободное место на диске, размер диска и стационарный коментарий, который описывает содержание самба ресурса.

вам нужно модифицировать этот файл под конкретные условия вашей дисковой системы и предоставляемых самба ресурсов. В данном примере имеется дисковая система:
    sda (sda1 - ubuntu linux 8GB raid, sda2 - swap 1GB, sda3 - /home 268G)
    sdb (sdb1 - ubuntu linux 8GB raid, sdb3 - swap 1GB, sda3 -  /home/share 548G)
    sdc (sdc1 - /home/mldonkey 980G, sdc2 - /home/data 346G)

#! /bin/bash
# returns disk usage that is formated for smb.conf comment string
June 2010 by Konstantyn Spasokukotskiy

# run as chron task as frequently as you need (but not more often) to update disk usage

# change the following variables to fit for your infrastructure:

COMMENTHOME="here is your network resource description"

COMMENTSHARE="here is your network resource description"

COMMENTTORRENT="here is your network resource description"

# don''t touch these paramenters unless your know what you are doing
STRING="comment = "

# execution code

service samba restart

При исполнении представленной версии программы будут созданы три файла с следующим содержанием:
      comment = 173G [268G] here is your network resource description
      comment = 134G [548G] here is your network resource description
      comment = 289G [346G] here is your network resource description

Содержание файлов будет изменяться по мере того, как заполнение дисков изменится.

4. Разрешите исполнение программ в п.2 и п.3 любому пользователю.

chmod 0755 cron-task-diskusage-samba

5.  Измените настройки самба сервера в файле smb.conf. В стстемах ubuntu linux файл настроек находится по адресу /etc/samba/smb.conf В данном примере из всех доступных дисковых ресурсов только три будут доступны через сеть. Ресурс sda3 предоставляет защищенное место для отдельных пользователей. Ресурс sdb3 предоставляется, как share, доступный всем пользователям без исключения. Ресурс sdc1 предоставляется, как downlads, доступный только зарегестрированным пользователям. Вам нужно модифицировать настройки,  которые здесь представленны, как пример. Желательно, чтобы настройки соответсвовали вашей системе и в строке include = ... ссылались на файлы, которые действительно сгенерированы в программой в п.3.

     comment = user directories. This comment is shown if dynamic comment doesn''t load
     include = /home/sambaservice/sdb3.size
     browsable = no
     read only = no
     create mask = 0700
     directory mask = 0700

     valid users = %S
     comment = files and programs. This comment is shown if dynamic comment doesn''t load
     include = /home/sambaservice/sda3.size
     path = /home/share
     read only = no
    guest ok = yes
     comment = fresh and shared torrent files. This comment is shown if dynamic comment doesn''t load
     include = /home/sambaservice/sdc1.size
     path = /home/mldonkey/incoming
     read only = no

6. Поместите программу в список планировщика выполнения задач. Если вы хотите обновлять данные о заполнении дисков ежедневно, то в системах ubuntu linux поместите файлы в /etc/cron.daily. Выполните это следующей командой:

cp /home/sambaservice/cron-task-diskusage-samba /stc/cron.daily/diskusage-samba

7. Проверте работоспособность системы. Запустите программу следующей командой:


Найдите самба ресурсы, пройдя по адресу: windows -> network -> (microsoft network -> ваш domain/workgroup) -> имя вашего сервера. Включите детальный показ в окне.  Если программирование было осуществлено без ошибок вы увидете список ресурсов наподобие такого:
Name Type Comments
downloads share 289G [346G] here is your network resource description
konstantyn share 173G [268G] here is your network resource description
storage share 134G [548G] here is your network resource description

SSD with CompactFlash | for robust servers

posted Mar 5, 2011, 12:35 AM by Konstantyn Spasokukotskiy   [ updated Mar 7, 2011, 7:03 AM ]

Solid State Disks (SSD) based PCs are more robust than their HDD (disks with moving parts) versions. It is important for servers. Small office, home office (SOHO) servers are typically hidden in closets. Closets expose computers to extreme heat (yes, some of your servers are direct neighbors to HVAC heaters) and continuous vibrations from other equipment. This environment kills HDDs quickly. SSD can provide immunity, since electronics handles heat and vibration much better than mechanical parts. Read here  about other benefits (like speed-up etc.)

 Though as of 2009, the complete HDD replacement  for SSD isn''t a viable solutions for SOHO. It is too expansive for the majority of applications. Fortunately, many applications can live with a partial solution. For example backup servers can fail. The data is most probably available on the workstations by the time of a failure. So the main feature is quick and hassle-free HDD swap. That is the HDDs with work data can be lost, but the HDD with system data (operations system, settings, user accounts, etc.) have to persist. A small and thus inexpensive SSD would resolve the maintenance and reliability challenges if it harbors only system data.

Small SSD can be substituted by CompactFlash cards (CF). CF provides even cheaper alternative. Firstly, the cards have much more size steps (everything from 16MB to 128GB in small increments). So you can easily find the closest fit to your needs and only pay for what is required.  Secondly, CF cards most parts use the same storage technology as SSD. There is no cut on core performance and longevity. What differs is packaging, which significantly varies from CF to SSD. Packaging is the technical challenge that prohibits CF from being a main stream. This how-to will help you to master the technical challenge and put some smarts in your purchases by exploiting {packaging sophistication = costs) phenomenon, so you can enjoy SSD benefits on smaller budget; or you can bring SSD in tiny spaces.

 SSD combines storage and storage controller - the same concept used in HDD. The concept has been introduced in mid 198X and known as IDE (integrated drive electronics). There were many modifications of IDE concept since then. The most recent (2003) and significant (total prevalence since 2007) change is SATA (serial ATA interface). Though, SATA is alive implementation of IDE (IDE is a parent term for all ATA) it is commonly referred as different from IDE because of new cabling and transfer mode. IDE  today is used in context of older, parallel ATA (aka PATA, ATA-1, ATA-2, ATA-4, EIDE, ATAPI). SSD exists in both formats SATA and IDE. CF exists only in IDE format (CFast SATA cards are expected in 2010, but excluded here). That constitutes a significant problem for new PCs not having older IDE ports. Such systems may require PCI-to-IDE extension cards (~$17 to $50) if used with CF. The extention card is also advisable if you want to upgrade transfer speeds (read about it later in step 2.)

 (Watch that the PCI2IDE chip is supported by your system (for Linux you''ll want to compile kernel and integrate the module. Check out supported chipsets in menuconfig.) And you need a bootable card. That is that the card''s BIOS can interact with motherboard''s BIOS. Typically the card is recognised as SCSI. It''s BIOS setup prompt appears right after motherboard''s setup prompt.)

The reach legacy of IDE variations presents constrains on applicability of CF cards. CF-cards are designed for mass consumer markets, where price and brand lock-in are decisive factors. Therefore, IDE controllers in such cards support limited set of IDE protocols.  So you typically can save money while buying the same kind of cards because others wouldn''t work.

 Three flavors of IDE protocols (that are relevant for CF) are PIO, DMA (aka WDMA, MW DMA) and UDMA. 1. Check what protocols are supported by your motherboard or PCI-to-IDE card. You can find it in your BIOS settings if you choose an IDE port and set it manually up. The protocols have a number attached to the protocol name. The numbers are decisive. If there is no match in both protocol and number, the CF card will not work.

The numbers also say about maximum data transfer speed. There is no need to buy a speedy card if it can''t be utilized by the motherboard. The price difference for different card speeds is substantial. 2. Determine maximum speed supported by your hardware. Check the speeds for IDE protocols in the following tables.

PIO modes
 Mode  Max Transfer Rate (MB/s)  Defining standard
 POI-0  3.3  ATA-1
 PIO-1  5.2  ATA-1
 PIO-2  8.3  ATA-1
 PIO-3  11.1  ATA-2
 PIO-4  16.7  ATA-2
 PIO-5  20  CompactFlash 2.0
 PIO-6  25  CompactFlash 2.0

DMA Modes
Max Transfer Rate (MB/s)
Defining standard

Multi- Word-2
CompactFlash 2.1
CompactFlash 2.1

UDMA Modes
Max Transfer Rate (MB/s)
Defining standard

ATA/ATAPI-4, Ultra ATA/33
ATA/ATAPI-4, Ultra ATA/33
ATA/ATAPI-4, Ultra ATA/33
ATA/ATAPI-5, Ultra ATA/66
ATA/ATAPI-5, Ultra ATA/66
UDMA-5, UDMA/100
ATA/ATAPI-6, Ultra ATA/100
UDMA-6, UDMA/133
ATA/ATAPI-7, Ultra ATA/133

 3. Find out maximum CF card speed. CF card speeds are  given in three basic forms: a) directly in MB/s, b) in multiples of a standard speed of a CD-ROM, i.e. x80, x133, x300 etc., c) hidden behind a trade mark. In the later case you''ll need to find out specs for the given mark. The specs are typically presented in form a or b. Note, that CF card speeds are rounded to the next larger nice looking number. For example, 15MB/s aren''t 15 but rather 13.6, 12.7 or even 10.2 MB/s. You may want to find on the net real test data rather than rely on manufacturer''s marketing collateral. In addition to that there are two different speeds: reading and writing. You want both of them closer to higher level. There are some older technologies out there with difference in the speeds up to factor 3. Actual technologies give less than 30% speed drop for writing.

CF Card Rating
Max Speed (MB/s)


HDD speed is also similarly impacted. HDD''s and SSD''s never ever live up to the standards they carry on the hood. Recent consumer grade UDMA/100 disks give 40 to 70 MB/s UDMA/133 may have 60 to 90 MB/s. If you use disks attached via USB 2.X, the max speed is limited around 25 MB/s. A random data access/storage on HDD can slow down the process to as low as 1 MB/s to 2 MB/s. SSD''s and CF -on the contrary- can proceed overall much faster despite slower max speed ability. So if your hardware supports speedy protocols, it doesn''t mean you should max out the ability. 4. Consider practical max speed limitation for your application. Slower chips may be cheaper and more mature in terms of reliability. Additional info on CF advantages and applicability read here. 5. Take the lower value of steps 3 and 4.

 6. Determine required CF Size. For modern operations systems the size is typically considered in GB increments. An actual-build PC-Linux kernel with overhang can be trimmed without much hassle to the size of approx 250 MB.  A no-brain server installation would fit into 2GB. A really comfortable environment with source code, man and space for system add-ons and work will be completely satisfied by a 4GB CompactFlash.  Windows Server 2008 can be trimmed to work on about 1 GB, provided there is 2 GB for operations somewhere else. A no-brainer would be 3.5 GB + 3 GB somewhere else. A comfortable environment starts depending on the size of installed applications with 8 GB. Anyway, check your properties.

7. Find and buy proper CF card. Recommend: start search with size, drill down to speeds and finally check supported protocols that they match with your hardware. If there is no data on that, DON''T buy, unless you can return the item at no costs. Many cards don''t fit. Once you''ve pointed out your cards and brands, find out the best delivery and/or price you can get.

In general use equipment there is no CF card slot. Though CF cards support IDE, you can''t attach them directly. You need an IDE-to-CF adapter. 8. Purchase an IDE-2-CF card. There are variations with several layouts and features. Among most important: supports one or two CF cards; attaches directly to IDE port or requires cable; connector for 2.5 IDE (laptops) or 3.5 IDE (desktops); straight-through or some electronics on board restricts card to certain IDE protocols. Typical costs $10 to $30 a piece.

IDE 2 CF card example for 3.5 IDE

If you use a PCI-to-IDE card than check if you have enough room in the PC for directly attached IDE2CF adapters + CF card atop of it. It can be too high. Otherwise buy a cable version. Check that the adapter supports your selected speeds and protocols. It is important that the IDE2CF card supports boot-up process. Two CF cards typically aren''t cheaper than one of doubled size. So there is no point for a double slot adapter, unless it is the same costs and you want to upgrade overall SSD capacity later. One slot cards are easier to screw down. Two slot cards are better to use directly plugged into IDE slot.

9. Install hardware and operations system. Once you have all right equipment, the process should be pretty straight forward. Your motherboard should recognize the disk. You handle it as if it were a hard drive. Put it forward in the boot sequence. Period.

Some systems may require manual setup. It typically constitutes Cylinders, Heads and Sectors (CHS) or LBA + disk size as well as transfer protocol setup for your card. For example Transcend TS4GCF133 has CHS 7769/16/63, PIO 6 or DMA 4, or UDMA 4 to offer.

10. Optimize the system for CF operations (optional).  More about this read here.

Automatic website login | script

posted Mar 4, 2011, 11:58 PM by Konstantyn Spasokukotskiy   [ updated Mar 7, 2011, 5:58 AM ]

The following script allows an automatic login into any generic http web resource as if it were human.  It is supposed for robotic maintenance of internet services such as authorized internet access, keeping alive various forum and discussion board access, systematic account check-in, web site serviceing and terms renewal.

The script runs on Unix/Linux and is capable of scheduled repitition. The later function is provided by cron automation. It is a bash environment program. It requires utilites: perl and curl. To setup the script you need basic understanding of HTML code - particulary HTML forms. You need to be able review web site code and  HTTP headers. The later can be done -for example- by Firefox plugin "Live HTTP headers".

The code is provided as is. There is no obligation authors enter if you use the code.

login script (html processor)
# Script for auto-login to forum
# reactivates webhosting account automatically
# Ideation by Matthew Beckler beck0778 @
# Created by Konstantyn Spasokukotskiy 01.2009
# /home/remote/autologin/weblogin
# file name: weblogin, executable

# site settings ####################################
# normal page to be on
# login page
# unique indication of the logged-in status
# the meassage spreading in the html code

# values - form settings ###########################
# additional fields to submit
# SUBMIT=Log%20in
# your hashcode here if password hashed by js
# to find out the js results investigate the HTTP header you send

# field names - form settings ######################
# F_REMEMBERME=cookieuser

# system settings ###################################

curl -e $SITE -A $AGENT -L -c $COOKIEJAR -o site.html $SITE &> /dev/null
if [[ $? = 0 ]]; then

# optional ##########################################
# find the form lines and filter out hidden variable values to submit
H1=`./ < site.html | grep "NAME=\\"s\\"" | tr -s ''\\"'' ''\\n'' | grep -v "Input" | grep -v "s" | grep -v "VALUE" | grep -v "(HIDDEN)"`
ENTRIES=`./ < site.html | grep "NAME=\\"s\\"" -c`
for i in $(seq 2 $ENTRIES)
    H1=$(echo $H1 | tr -s '' '' ''\\n'' | sed ''1d'')
H2=`./ < site.html | grep "NAME=\\"securitytoken\\"" | tr -s ''\\"'' ''\\n'' | grep -v "Input" | grep -v "securitytoken" | grep -v "VALUE" | grep -v "(HIDDEN)"`
ENTRIES=`./ < site.html | grep "NAME=\\"securitytoken\\"" -c`
for i in $(seq 2 $ENTRIES)
    H2=$(echo $H2 | tr -s '' '' ''\\n'' | sed ''1d'')
# end optional ######################################

# web site available - time to login ################
# adjust the form fileds you need to pass to the remote server
curl -e $SITE -F $F_USERNAME=$USERNAME -F $F_PASSWORD=$PASSWORD -F $FH_1=$H1 -F $FH_2=$H2 -F $FH_3=$H3 -F $FH_4=$H4 -F $FH_5=$H5 -A $AGENT -b $COOKIEJAR -c $COOKIEJAR -L -o /dev/null $SITETWO &> /dev/null
#waiting 30-120 seconds - you might want to adjust this
sleep 30
#finalize the login
curl -e $SITETWO -A $AGENT -L -b $COOKIEJAR -c $COOKIEJAR -o site.html $SITE &> /dev/null

# log the results ###################################
    if [[ $ENTRIES != '''' ]]; then
    `echo $DATE '' ##### SUCCESS! #####'' $USERNAME ''was logged as follows:'' >> logfile`
    `echo $ENTRIES >> logfile`
    exit 0
    `echo $DATE '' ### FAILURE ### the loggin to'' $SITE ''as'' $USERNAME ''failed'' >> logfile`
    exit 1
    `echo $DATE ''### FAILURE ### the site:'' $SITE ''is not accessible'' >> logfile`
exit 1
###### END ###########################################

controller script
# Konstantyn ->
# login into forum to keep web account alive
# belongs to ubuntu server. (Jan. 2009)
# file name: autologin-cron-script, executable
# cron weekly

# change the folder /home/remote/autologin/
# to the actual folder, where you install the script
cd /home/remote/autologin/
if [[ $? = 0 ]]; then
   # adjust timout (sec) for the second chance login
    sleep 96000
    exit 0
exit 1

html form extracting script

#!/usr/bin/env perl
# $Id: formfind,v 1.6 2004/10/19 18:36:17 bagder Exp $


# This script gets a HTML page on stdin and presents form information on
# stdout.
# Author: Daniel Stenberg <>
# Version: 0.2 Nov 18, 2002
# 0.1 - Nov 12 1998 - Created now!
# 0.2 - Nov 18 2002 - Enhanced. Removed URL support, use only stdin.
# place in hte same dir as weblogin script
# no adjustment needed


if($ARGV[0] eq "-h") {
print "Usage: $0 < HTML\\n";

sub namevalue {
my ($tag)=@_;
my $name=$tag;
if($name =~ /name *=/i) {
if($name =~ /name *= *([^\\"\\'']([^ \\">]*))/i) {
$name = $1;
elsif($name =~ /name *= *(\\"|\\'')([^\\"\\'']*)(\\"|\\'')/i) {
else {
# there is a tag but we didn''t find the contents

else {
# no name given
# get value tag
my $value= $tag;
if($value =~ /[^\\.a-zA-Z0-9]value *=/i) {
if($value =~ /[^\\.a-zA-Z0-9]value *= *([^\\"\\'']([^ \\">]*))/i) {
$value = $1;
elsif($value =~ /[^\\.a-zA-Z0-9]value *= *(\\"|\\'')([^\\"\\'']*)(\\"|\\'')/i) {
else {
# there is a tag but we didn''t find the contents
else {
return ($name, $value);

while(<STDIN>) {
$line = $_;
push @indoc, $line;
$line=~ s/\\n//g;
$line=~ s/\\r//g;

while($in =~ /[^<]*(<[^>]+>)/g ) {
# we have a tag in $1
$tag = $1;

if($tag =~ /^<!--/) {
# this is a comment tag, ignore it
else {
if(!$form &&
($tag =~ /^< *form/i )) {
$method= $tag;
if($method =~ /method *=/i) {
$method=~ s/.*method *= *(\\"|)([^ \\">]*).*/$2/gi;
else {
$method="get"; # default method
$action= $tag;
$action=~ s/.*action *= *(\\''|\\"|)([^ \\"\\''>]*).*/$2/gi;


if ($enctype =~ /enctype *=/) {
$enctype=~ s/.*enctype *= *(\\''|\\"|)([^ \\"\\''>]*).*/$2/gi;

if($enctype eq "multipart/form-data") {
$enctype="multipart form upload [use -F]"
$enctype = "\\n--- type: $enctype";
else {

print "--- FORM report. Uses $method to URL \\"$action\\"$enctype\\n";
elsif($form &&
($tag =~ /< *\\/form/i )) {

print "--- end of FORM\\n";
if( 0 ) {
print "*** Fill in all or any of these: (default assigns may be shown)\\n";
for(@vars) {
$var = $_;
$def = $value{$var};
print "$var=$def\\n";
print "*** Pick one of these:\\n";
for(@alts) {
print "$_\\n";
undef @vars;
undef @alts;
elsif($form &&
($tag =~ /^< *(input|select)/i)) {
$mtag = $1;

($name, $value)=namevalue($tag);

if($mtag =~ /select/i) {
print "Select: NAME=\\"$name\\"\\n";
push @vars, "$name";
$select = 1;
else {
if($type =~ /type *=/i) {
$type =~ s/.*type *= *(\\''|\\"|)([^ \\"\\''>]*).*/$2/gi;
else {
$type="text"; # default type
if(lc($type) eq "reset") {
# reset types are for UI only, ignore.
elsif($name eq "") {
# let''s read the value parameter

print "Button: \\"$value\\" ($type)\\n";
push @alts, "$value";
else {
print "Input: NAME=\\"$name\\"";
if($value ne "") {
print " VALUE=\\"$value\\"";
print " ($type)\\n";
push @vars, "$name";
# store default value:
elsif($form &&
($tag =~ /^< *textarea/i)) {
my ($name, $value)=namevalue($tag);

print "Textarea: NAME=\\"$name\\"\\n";
elsif($select) {
if($tag =~ /^< *\\/ *select/i) {
print "[end of select]\\n";
$select = 0;
elsif($tag =~ /[^\\/] *option/i ) {
my ($name, $value)=namevalue($tag);
my $s;
if($tag =~ /selected/i) {
$s= " (SELECTED)";
print " Option VALUE=\\"$value\\"$s\\n";

script, Linux, automation, web , login, seite, bash, program, forum, automatic, password, user'

1-9 of 9