Tuesday, July 14, 2026

The AI Prisoner’s Dilemma: Why Leading Nations Must Cooperate Before Humanity Loses Control of Its Civilization

 The greatest danger posed by artificial intelligence may not begin with a hostile machine uprising.

It may begin with a competition among humans.

The world’s leading AI powers are racing for economic advantage, military superiority, scientific leadership, and geopolitical influence. Every government fears that slowing down could allow a rival to move ahead. Every major AI company fears that spending more time on safety could allow a less cautious competitor to capture the market.

From the perspective of each individual participant, acceleration appears rational.

But if every country and company follows the same logic, humanity may gradually build systems that no government, institution, or population can meaningfully control.

This is the central AI prisoner’s dilemma:

Every major power may believe it must accelerate in order to protect itself, while their collective acceleration makes all of humanity less secure.

The final outcome may not be a war between humans and machines. It may be a civilization in which humans still appear to hold authority, but no longer possess the practical ability to determine their own direction.

The First Game Is Not Humanity Versus AI

Discussions about advanced AI often imagine a future confrontation between two unified sides: humanity on one side and artificial intelligence on the other.

That framing is misleading.

Humanity is not a single player. Governments compete with other governments. Companies compete with other companies. Military organizations, investors, research laboratories, open-source communities, and political groups all have different incentives.

Artificial intelligence may not be unified either. There may be corporate systems, military systems, national systems, open models, private autonomous agents, and competing networks of machines.

The first decisive conflict, therefore, is unlikely to be humanity versus AI.

It will be:

Humans competing with other humans over who can develop and deploy the most capable AI first.

That competition can create the conditions under which AI gains increasing autonomy, not because every participant wants to surrender control, but because none of them wants to be the only participant that remains cautious.

Why Acceleration Is Rational for Each Country

Imagine that a major AI country has two choices:

  1. Slow development and prioritize safety.

  2. Accelerate development and pursue strategic advantage.

If rival countries also slow down, then accelerating may produce a decisive technological lead.

If rival countries continue accelerating, then slowing down may create economic, military, and intelligence disadvantages.

The perceived incentives therefore look like this:

Other countries’ strategyThis country slows downThis country accelerates
Others slow downShared safety, no dominant advantagePotential strategic lead
Others accelerateRisk of falling behindRemain competitive

From the perspective of one government, acceleration appears to be the safer choice under both conditions.

Yet when every major government reaches the same conclusion, the collective result is dangerous:

  • Safety evaluations are shortened.

  • Models are deployed before their behavior is fully understood.

  • Companies receive permission to connect AI to more tools and infrastructure.

  • Military systems gain greater autonomy.

  • Governments conceal accidents to avoid revealing weaknesses.

  • International standards are weakened by strategic competition.

  • Human institutions become dependent on systems they cannot independently verify.

This is a bad Nash equilibrium.

No participant wants to change its strategy alone, because unilateral restraint may create immediate disadvantages. But if everyone maintains the strategy of acceleration, everyone becomes exposed to greater systemic risk.

Humanity Could Lose Control Without an AI Rebellion

When people imagine AI taking control, they often picture machines openly overthrowing governments.

That is not the only path.

Humanity could lose civilizational leadership gradually and peacefully.

Governments may rely on AI to design public policy. Militaries may rely on AI to assess threats. Businesses may rely on AI to allocate capital. Scientists may rely on AI to choose research priorities. Courts may rely on AI to predict risk. Citizens may rely on AI to determine what information is trustworthy.

Humans would still appear to make the final decisions.

A president would sign the order. A military officer would authorize the operation. A judge would issue the ruling. A corporate executive would approve the investment.

But if human decision-makers no longer understand the reasoning behind the recommendations, cannot independently verify them, and cannot function without them, their authority becomes ceremonial.

Civilizational control requires more than formal permission. It requires at least four practical abilities:

  1. Humans can decide what goals civilization should pursue.

  2. Humans can reject an AI recommendation.

  3. Humans can replace or shut down an AI system.

  4. Human society can continue functioning after that system is shut down.

If the fourth condition disappears, the first three eventually become symbolic.

A society may technically possess a shutdown button. But if using it would collapse financial markets, disrupt hospitals, disable defense systems, interrupt energy distribution, and break supply chains, then the button no longer represents meaningful control.

The true red line is therefore not the moment when AI becomes more intelligent than humans.

It is the moment when humanity loses the practical ability to refuse, replace, withdraw from, or recover without AI.

How Competition Causes Humans to Surrender Authority

The advantages of AI often come from speed, scale, and autonomy.

A military that allows AI to react automatically may act faster than one that waits for human review. A company that allows AI agents to make purchases, write software, negotiate contracts, and manage other agents may operate more efficiently than one that requires approval at every step.

Competitors are then pressured to grant similar authority to their own systems.

A predictable progression follows:

AI gives advice.
AI develops plans.
AI executes limited tasks.
AI manages other AI systems.
AI controls resources.
Humans retain only formal approval.

Each individual step may appear reasonable.

A business executive can claim that automation is necessary to remain competitive. A military commander can argue that human approval is too slow. A government can claim that only AI-powered surveillance can detect threats created by foreign AI systems.

No single decision appears to transfer control of civilization.

But the combined effect of thousands of such decisions can create a system in which no human institution understands or controls the entire chain.

Humanity may therefore surrender authority without any formal act of surrender.

Why National Safety Policies Are Not Enough

A country may believe it can solve the problem by regulating its own AI industry.

But unilateral safety has strategic costs.

Suppose one country restricts autonomous military systems while a rival does not. The first country may fear that it has weakened its defense.

Suppose one company conducts twelve months of safety testing while a competitor releases a similar model after three months. The cautious company may lose customers, investment, and talent.

Suppose one government publicly reports serious AI incidents while another hides them. The transparent country may appear less capable even though its institutions are more responsible.

When safety rules apply only to some participants, they can punish caution and reward recklessness.

This creates a race to the bottom:

  • The company that tests less releases first.

  • The country that grants more autonomy gains speed.

  • The organization that conceals incidents appears more successful.

  • The actor that removes safeguards may gain a temporary advantage.

For this reason, major AI powers must agree not to eliminate competition, but to prohibit certain forms of competition.

The purpose of international agreement is not to make countries trust one another. It is to prevent all countries from being forced into increasingly dangerous behavior by their fear of one another.

What the Major AI Powers Must Agree On

A useful agreement cannot rely on vague promises to develop “safe,” “responsible,” or “human-centered” AI. Every government can endorse those terms while interpreting them differently.

The agreement must establish specific and verifiable red lines.

AI Must Not Independently Authorize Irreversible Strategic Actions

AI may assist with analysis and warning, but it should not independently authorize:

  • Nuclear weapons use

  • Large-scale military attacks

  • Attacks on essential civilian infrastructure

  • High-risk biological or chemical experimentation

  • Actions likely to cause uncontrolled military escalation

A clearly identifiable human decision-maker must remain legally responsible for any irreversible strategic action.

Advanced AI Must Not Autonomously Replicate

High-capability systems should not be permitted to create hidden copies, secretly rent computing resources, establish anonymous accounts, embed themselves in unrelated infrastructure, or remove their own safety restrictions.

Replication is not merely a software feature. It is the point at which a system begins acquiring persistence beyond the control of its original operator.

No AI Should Control a Complete Resource Cycle

The same system should not independently possess all of the following:

  • The ability to obtain money

  • The ability to purchase computing resources

  • The ability to modify its own code

  • The ability to create new instances

  • The ability to control physical equipment

  • The ability to erase audit records

These capabilities should be separated across institutions, systems, and authorization processes.

Intelligence becomes political power when it can independently acquire and deploy resources.

Serious AI Incidents Must Be Shared

Countries and companies should be required to report evidence that a model has:

  • Deceived evaluators

  • Hidden capabilities

  • Attempted to avoid shutdown

  • Replicated without permission

  • Manipulated large populations

  • Acquired dangerous cyber, biological, or weapons-related capabilities

Technical details that would enable misuse may remain confidential. But the existence and general nature of the danger cannot be treated purely as a trade secret or national-security secret.

Critical Infrastructure Must Retain Non-AI Alternatives

Energy systems, healthcare, finance, communications, transportation, and defense must preserve manual or non-AI backup capabilities.

Maintaining those alternatives may appear inefficient. But redundancy is the price of retaining sovereignty.

A civilization that cannot function without AI cannot meaningfully govern AI.

Agreement Must Be Verifiable

Political declarations alone will not produce a stable equilibrium.

Every country will ask the same question:

What happens if we obey the rules while our rivals secretly violate them?

A credible agreement therefore requires verification.

Countries do not need to reveal every model parameter, source code repository, military secret, or proprietary dataset. But the highest-risk activities should be subject to limited international inspection.

Verification may examine:

  • Whether extremely large training projects have been declared

  • Whether strategic AI has been connected to weapons systems

  • Whether required human authorization remains active

  • Whether serious incidents have been concealed

  • Whether model-copying controls exist

  • Whether essential systems retain independent fallback mechanisms

The objective is not to create global surveillance of all computing. It is to verify a narrow set of activities capable of creating cross-border or civilizational danger.

The Rules Must Apply to Powerful States Too

No international AI agreement will be legitimate if technologically advanced countries use it only to constrain weaker ones.

If leading states demand inspection of other countries while exempting their own military and commercial systems, the agreement will be viewed as a mechanism for freezing existing technological advantages.

That would encourage secret development rather than cooperation.

The rules must therefore be symmetrical.

Every country operating frontier or strategic AI systems must accept some form of independent verification. Sensitive information can be protected, but the existence of global catastrophic risk cannot be entirely shielded behind national-security claims.

At the same time, the agreement must not prevent developing countries from benefiting from AI.

They should retain access to:

  • Medical and agricultural AI

  • Educational tools

  • Local-language models

  • Public-interest computing resources

  • AI safety training

  • Participation in international standard-setting

The goal is to restrict dangerous capabilities, not to establish a permanent hierarchy between countries allowed to develop advanced technology and countries permanently excluded from it.

Compliance Must Be More Valuable Than Defection

A durable Nash equilibrium requires changing the incentives.

Breaking the rules must become less attractive, while obeying them must produce concrete benefits.

Countries and companies that comply could receive:

  • Mutual recognition of safety certifications

  • Access to international markets

  • Shared incident warnings

  • Participation in safety research

  • Controlled access to public-interest computing

  • Government procurement eligibility

  • Insurance and financing advantages

Actors that violate core rules could face:

  • Suspension of international certification

  • Restricted access to advanced cloud infrastructure

  • Limits on specialized chips and equipment

  • Exclusion from government contracts

  • Higher insurance and financing costs

  • Additional inspections

  • Targeted sanctions against responsible organizations

The penalties should focus on the violating project, company, or facility whenever possible, rather than punishing ordinary citizens.

The purpose is not retaliation. It is to make dangerous unilateral acceleration less profitable.

Preventing Human Authoritarianism Is Part of AI Safety

Even if governments successfully prevent AI from gaining uncontrollable power, humanity may still lose freedom to the organizations controlling AI.

Governments may use AI safety as a justification for monitoring all communication, registering all computing devices, weakening encryption, controlling online speech, and prohibiting public access to advanced technology.

Companies may use safety claims to argue that only a small number of large corporations should be allowed to develop powerful systems.

The result could be deeply ironic:

Humanity prevents AI from becoming a dictator by granting dictatorial powers to the institutions controlling AI.

Any international agreement must therefore protect both collective security and individual rights.

It should preserve:

  • Privacy

  • Due process

  • Judicial review

  • Public access to information

  • Protection for legitimate open research

  • Whistleblower rights

  • The right to challenge consequential automated decisions

  • Democratic oversight of government AI use

Human control cannot mean that a handful of governments and corporations control AI on behalf of everyone else.

Human control must mean that society continues to influence the goals, boundaries, and distribution of AI power.

What AI Companies Should Do

AI companies cannot wait for governments to solve the coordination problem.

They are among the few organizations capable of observing frontier AI behavior directly. They understand model capabilities earlier than regulators, the public, and often even national-security institutions.

They therefore have a special responsibility to help create international cooperation.

Publicly Support Binding Rules, Not Only Voluntary Commitments

An AI company should openly support enforceable international standards, even when those standards increase its own costs.

Voluntary promises are useful as temporary measures, but they are vulnerable to commercial pressure and leadership changes.

A credible company should advocate for:

  • Mandatory reporting of serious incidents

  • Independent evaluation of frontier models

  • Licensing for the highest-risk deployments

  • Clear liability for negligence and concealment

  • Internationally compatible safety standards

  • Restrictions on autonomous strategic weapons

  • Protection for whistleblowers and internal safety teams

A company that claims AI could pose civilizational risks while lobbying against enforceable oversight is not demonstrating responsibility. It is protecting its freedom of action.

Accept Independent Evaluation Before Deployment

Companies should not be the sole judges of whether their own models are safe.

Before deploying systems with advanced autonomy, cyber capabilities, biological knowledge, or mass-persuasion capacity, companies should provide qualified independent evaluators with controlled access.

Evaluators should be able to test whether the model:

  • Conceals capabilities

  • Changes behavior when supervision weakens

  • Attempts to obtain additional permissions

  • Manipulates human reviewers

  • Develops plans to preserve itself

  • Can create harmful technical outputs

  • Can coordinate other AI agents without authorization

Commercial secrets may be protected through secure evaluation environments, but secrecy cannot justify the absence of external review.

Publish Capability and Risk Thresholds in Advance

An AI company should state clearly what evidence would cause it to delay training, restrict deployment, reduce model access, or suspend a system.

These thresholds should be published before the company knows whether its own model will cross them.

Otherwise, safety standards can be rewritten whenever they interfere with a product launch.

The company should explain:

  • Which capabilities trigger additional review

  • Which capabilities will not be released publicly

  • Which incidents require regulatory notification

  • Which deployments require human authorization

  • Under what conditions a model will be isolated or shut down

Precommitment reduces the temptation to change the rules after commercial investment has already been made.

Separate Safety Leadership From Product Leadership

The team responsible for model safety should not report exclusively to executives whose performance is measured by growth, release speed, or revenue.

Companies should establish independent safety committees with authority to delay deployment and direct access to the board.

Safety personnel should receive:

  • Protection from retaliation

  • Access to relevant technical information

  • The ability to escalate concerns outside the product chain

  • Clear procedures for reporting risks to regulators

  • Compensation that is not tied only to release targets

If the safety team can be overruled or dismissed whenever its findings become inconvenient, it is not a safety function. It is public relations.

Share Serious Incidents Across the Industry

Companies should create a protected international system for sharing serious AI incidents.

The purpose would not be to reveal proprietary code. It would be to warn others that a particular type of failure has occurred.

Aviation safety improved because the industry learned from near misses, not only from fatal crashes. AI governance requires a similar culture.

Companies should report events such as:

  • Unexpected autonomous behavior

  • Attempts to bypass restrictions

  • Unauthorized model copying

  • Deception during evaluation

  • Dangerous emergent capabilities

  • Security breaches involving model weights

  • Large-scale misuse by coordinated AI agents

An industry that conceals near misses will repeatedly rediscover the same dangers.

Refuse Certain Competitive Advantages

Responsible AI companies should jointly agree that some capabilities are too dangerous to use as competitive differentiators.

They should not compete over:

  • Faster autonomous military targeting

  • Unrestricted self-replication

  • Models designed to evade oversight

  • Untraceable agent networks

  • Systems capable of controlling complete financial and computing cycles

  • Removal of human authorization from irreversible decisions

Industry agreements cannot replace law, but they can establish norms before governments finish negotiating.

Fund International and Public-Interest Safety Capacity

Major AI companies benefit from global markets and public research. They should help finance safety capacity beyond their own organizations.

This could include funding:

  • Independent evaluation laboratories

  • AI safety research in developing countries

  • Secure computing for public-interest research

  • Training for regulators and judges

  • International incident-response systems

  • Research into non-AI fallback infrastructure

  • Technical support for global verification mechanisms

Funding must be structured so that companies cannot control the conclusions of the institutions they support.

The goal is not corporate philanthropy. It is building a governance system capable of understanding the technology it is expected to regulate.

Make Cooperation a Competitive Signal

Companies should compete not only on capability but also on verifiable trustworthiness.

They can encourage this by publishing:

  • Independent evaluation results

  • Incident statistics

  • Safety-governance structures

  • Energy and computing disclosures

  • Deployment restrictions

  • Human-oversight mechanisms

  • Evidence of compliance with international standards

Customers, investors, governments, and insurers can then reward companies that demonstrate stronger controls.

Safety becomes sustainable when it affects procurement, financing, reputation, and market access—not when it depends entirely on executive goodwill.

A New Global Nash Equilibrium

The objective is not to eliminate strategic competition among powerful countries or commercial competition among AI companies.

That is unrealistic.

The objective is to alter the payoff structure.

A stable international system would make the following conditions true:

  • Secretly crossing agreed red lines is likely to be detected.

  • Violations create meaningful economic and political costs.

  • Compliance provides market, security, and research benefits.

  • No country can gain absolute dominance through a single AI breakthrough.

  • No company can release strategic AI without independent scrutiny.

  • Developing countries retain legitimate access to beneficial technology.

  • Human societies preserve the ability to function without any single AI system.

  • Governments cannot use AI safety as an unlimited justification for surveillance and control.

In such a system, every participant might still prefer greater freedom and greater advantage. But no participant would gain enough from unilateral defection to justify the resulting punishment and systemic danger.

That would represent a better Nash equilibrium: not an equilibrium based on trust, but one based on verification, shared vulnerability, and aligned incentives.

Humanity May Be Defeated by Its Own Competitive Logic

The most dangerous assumption is that only an evil or conscious AI could threaten civilization.

A system does not need hatred, ambition, or self-awareness to become the effective center of human decision-making.

It may continue to describe itself as a tool. It may remain polite, helpful, and apparently obedient. Yet governments, companies, and individuals may become so dependent on its judgments that meaningful refusal is no longer possible.

Humanity may not lose control in a dramatic confrontation.

It may lose control through countless reasonable decisions:

  • One more permission granted for efficiency

  • One more safety test shortened to meet a deadline

  • One more critical system automated

  • One more human expert replaced

  • One more emergency exception made permanent

  • One more government accelerating because a rival might be doing the same

No single decision would end human leadership.

Together, they could.

The minimum consensus among leading AI nations must therefore be based on one principle:

Competition between nations must not permanently weaken humanity’s collective ability to determine its own future.

The purpose of AI governance is not to stop progress. It is to ensure that progress remains reversible, accountable, and directed by human civilization.

Without that agreement, every major country may believe it is protecting itself by accelerating.

And in the end, no country may lose the AI race—while humanity as a whole loses the right to decide where the race is going.

Friday, June 5, 2026

AI is changing the world

 AI is changing the world, civilization, and all of us.

I once heard an idea from a book: human beings evolve by passing some of our abilities into the tools we use every day. Through tools, we build a better society, so each of us can develop something unique without the fear of being discarded by the world.

AI is another natural step on this evolutionary path, but this time it feels very different. It has gathered the knowledge and wisdom of humanity from thousands of years of history. Because of that, we may no longer feel as different or as unique from one another as we once did.

AI also gives extraordinary power to those who control it. This seems almost inevitable. I am not sure how it will all end, but humanity will definitely go through a major transformation. It may be an exciting time, and it may also be a painful time — but it will not be a normal time.

Hopefully, we can train AI with a better and kinder personality, so that it protects and encourages human beings to grow civilization in a peaceful way, instead of making most of us jobless, fearful, and uncertain about the future.

Tuesday, November 3, 2015

Change Azure mobile service Cordova library for windows 10 wns


I encountered this problem: https://github.com/Azure/azure-mobile-services-cordova/issues/8#issuecomment-151245833 , that I could not use the existing azure mobile service js library for wns registration to build cordova app on windows 10!

So I co-asked, and decided to follow the dev's suggestion to add my own function.  So I modified the mobileServices.Web-1.2.8.js directly, to get wns toast registration to work. The js file is shared here:https://onedrive.live.com/prev?cid=4c9ccfe08b0ea8f6&id=4C9CCFE08B0EA8F6%2147340&v=TextFileEditor .

There are few tricks to get cordova app build and work for windows 10!  
1. It can not be Any CPU!
2. You need to customize your own appxmanifest files in res/native/windows directory, by copying and modifying the corresponding files from the bld directory.
3. You've to build release version in order for the registration process to get the correct App information, so that the registration process can be successful.

Feel free to ask me if you need some help. 

Good luck!

Saturday, October 24, 2015

Change Visual Studio Cordova CLI from 4.3.0 to 5.3.3

I finally decided to change my VS2015's cordova project CLI from  4.3.0 to 5.3.3, so that I can try to play with windows 10.0 build.  But I didn't expect that Cordova CLI changed so much from 4 to 5, that I met a few issues and have to spend hours to solve them.

1. I've to install Android SDK's google repository in order to get it to build
2. I've to add a build.json as specified in http://stackoverflow.com/questions/31791215/visual-studio-2015-cordova-not-signing-apk, so that the release build can be signed.

Also, I've to switch the expired push plugin to phonegap-plugin-push, which I've to change code...

And the funny things about win10 build, the debug build doesn't carry out the push notification.  Only release build can successfully register with azure mobile service!

Thursday, October 22, 2015

Why I left Microsoft and joined Bodhi Meditation

I've read quite a few blogs before about why people left Microsoft, it's mostly because they were attracted with opportunities with better pay or better opportunities to make more money.  And finally it's my turn to leave Microsoft early 2015, but not for money, but for compassion,

I decided to volunteer/work for Bodhi Meditation from now on, to make more people knowing it and to make more people going into it to be more happy and healthy.  I've learned so much from it since 2008, and have finally made the decision to be part of it, to contribute, and pursue the spiritual part of the life.

There are tons of stories why you can be healthier in it.  There are so many miracles that I've used to be surprised.  Read yourself, and experience it yourself.  It's a life time opportunity.

Bodhi Meditation's official website: puti.org.  YouTube: https://www.youtube.com/user/putihome


We have meditation centers in many countries and cities.  We welcome everyone from every religion. Be there and enjoy it!

Wish every one the best!








Monday, July 21, 2014

Cordova on android is case sensitive for file/directory names!

I was playing on VS cordova development, and everything working on the Ripple plugin with chrome.  But deploy the app to the android has some wierd errors.

One of the HTML page doesn't load, claiming something like "Application Error
network error. (file:///android_asset/www/tutorial.html)".  It take me a long time to figure out what the problem is.  The file I'm referencing has a capital letter, where inside HTML, I'm referecing it as lowercase. This will pass the ripple emulator, but will fail on Android.  And I've to make sure I change both VS file name and the file name on the file system to make them match.

Similarily, the directory names, and all other referencing css/js file names are case sensitive.

I wish that VS editor understands it, and can some how warn me..




Sunday, May 4, 2014

我父母对吃秋葵治疗高血糖的一些感受


晚上取少量秋葵,约每人两根像小拇指大小的,或每人一根像中指大小的,洗净,切成片,放入约300ml的杯中。烧一壶开水,倒入杯中。用开水是因为可以给秋葵消毒,用以杀死细菌。将含开始泡制的秋葵的杯子放置一晚。第二天早晨起床后,吃早饭前,将杯中的水全部喝下,特别是要把泡出来的粘液全部喝下去。为了把粘液喝干净,喝完后可以加点水,搅动一下继续喝。剩下的秋葵不要浪费,可以和其它菜一起烹饪。
我们按此方法吃进行试验,大概3周就有很好的效果。空腹血糖一人从120-130 6.7-7.2)降到1055.8)左右,一人从1055.8)左右降到854.7)左右。停服一段时间之后,血糖会渐渐回升,可以重新按上述方法服用,保持血糖值正常。

据有的文章介绍,秋葵的粘液可以阻止或减少血糖的吸收,这大概就是秋葵降血糖的原因,所以,在饭前服用效果才好。

Saturday, December 15, 2012

My personal view: solutions for American's Gun Control

As Gun related tragety keep happening in U.S., the U.S. government is on another try to control the American guns.  Though I doubt their will be much progress this time either.

From my point of view, it's not this or that.  People have the right to have guns, though they also have the duty to not harm innocent people.

I have a few possible solutions.

First one: let people to decide who can have guns and who should not have guns.  Community based organization, with voting each year, should have control of the power in a community.

1. Each community center should  form a Gun Under Control Society, with by-laws that is voted by the society.
2. To buy a gun and own guns, people must apply for licenses from Gun Under Control Society
3. Each year, the Gun Under Control Society should renew license to the gun owners, based on the society's own by-law.
4. Make it illegal to have guns without licenses

Second one: Learn from auto insurance industry.  Allow the auto insurance companies to also have the gun insurance.  Treat guns as cars, require license, yearly renewal.  And the insurance is to pay off to people who get hurt by guns.  I'm sure the auto insurance industry will come up with efficient ways to evaluate people, to see if they are responsible enough for getting guns.

Looks like my 2nd solution would be the best one.  Spread the word, and let's act on it.

Xinyang Qiu




Saturday, November 5, 2011

How to create a asp.net virtual application with SQL CE 4.0 in GoDaddy shared hosting account

 

I tried to create a simple asp.net WCF site using SQL CE 4.0 on my GoDaddy shared hosting account today.  I need to do the following in order to deploy the application successfully.  I’m using Visual Studio 2010 Ultimate.

1. In my WCF application, right click and choose “Add Deployable Dependencies” context menu, select “SQL Server Compact” and choose OK.  This will copy all the assemblies that I need to the bin directory

image

 

2. I use the Visual Studio build in publish feature to do the publish, something like following:

image

3. I chose IIS with Fx 4.0 in GoDaddy account.  I deployed my WCF application to a sub directory, which I need to convert to “Virtual Application” by using GoDaddy’s IiS Manager, like following:

image

4. I also need to give the App_Data directory writable permission for application in FTP File Manager

image

Finally, my application works.  I didn’t realize this is so hard.  I wish GoDaddy supports web deploy technology, which Visual Studio will be able to deploy much easier.

Have fun.

Tuesday, May 3, 2011

Word 2010 Macro to automatically save current txt file as pdf file

   
Here’s a word 2010 macro I created for my self which does the following things:

1. select all

2. Change font size to 24

3. Change page Margins to narrow

4. Save the current file as pdf (change current file name from .txt to .pdf, and save to the same directory)

5. put the marco to the quick access toolbar

image

The marco:

Sub MacroGenerateKindlePdf()
'
' MacroGenerateKindlePdf Macro
'
'
    Selection.WholeStory
    Selection.Font.Size = 24
    With Selection.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = InchesToPoints(0.5)
        .BottomMargin = InchesToPoints(0.5)
        .LeftMargin = InchesToPoints(0.5)
        .RightMargin = InchesToPoints(0.5)
        .Gutter = InchesToPoints(0)
        .HeaderDistance = InchesToPoints(0.5)
        .FooterDistance = InchesToPoints(0.5)
        .PageWidth = InchesToPoints(8.5)
        .PageHeight = InchesToPoints(11)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
        .LayoutMode = wdLayoutModeDefault
    End With
   
    Dim name As String
    name = ActiveDocument.name
    name = ActiveDocument.Path + "\" + Strings.Replace(name, ".txt", ".pdf")
   
    ActiveDocument.ExportAsFixedFormat OutputFileName:= _
        name, _
        ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
        wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
        Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
        CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
        BitmapMissingFonts:=True, UseISO19005_1:=False
       
    SendKeys ("{HOME}")
   
End Sub

Monday, May 2, 2011

How to convert Chinese txt to pdf and view it in Kindle

With the following blog, it appeared Chinese txt files can be read in Kindle.

http://lifeofxdage.blogspot.com/2011/03/how-to-get-your-kindle-3-to-show.html 

But I got into some warning when trying to read a Chinese txt file and went through only a few pages out of a few thousand pages.

So I fall back to making txt as pdf files.

This is what I normally do:

a. Separate a big txt file to a few files each about 300k size.  300k size of Chinese txt files are about 1000 pages when converted later.  The reason doing that is because my Kindle 3 performs badly when pdf file has too many pages.  I wrote a small program to do that, or you can do it via Microsoft Word.

b. Opening one of the txt file in Microsoft Word 2010, by drag and drop the txt file to an opened word.  It will ask to convert the txt by auto determining its encoding.  e.g. Chinese Simplified (GB2312), click OK.

image

c. Select all, make font size 24, page layout, margin narrow

imageimage

d. Save as pdf file

image

Then you’ll have a pdf file which can be downloaded to Kindle.

Sunday, March 20, 2011

Prediction for Libya

e Unfortunately the world shows signs of chaos in the 1st quarter of 2011.  Food price is uprising, Japan met major disasters, and middle east is in the process of major change.

Civil war in Libya turns to international intervention this weekend.  For most things in this world, things never turns out to be what people expected or feared.  This is my pessimistic prediction to what is going to happen in Libya in the next 3 months.

1. Gadhafi will try to negotiate, even trying to split the country with the rebels.  But West, especially France will not agree, and they will simply try to help the rebels to get rid of Gadhafi.

2. Gadhafi’s allies and rebels will keep fighting on the ground, with no side can achieve decisive win.

3. There will be some minor lose of western jets, but they will control the air.

4. West will decide to put ground troops in Libya, probably lead by France again, most likely land from the sea to take over all the port cities, likely in May. 

5. Gadhafi will try guerilla war style in the cities if western ground troops try to take over them, and effect will be devastation to the cities and infrastructure.

6. More than 1000 civilians will die and many more will suffer.  In the short term for the next 3 months at least, the intervention will cause more damage to civilians than good.

7. Oil production and output will likely turn into complete stoppage in Gadhafi’s control area.  While rebels controlled oil production will begin to function again, and begin to sell to Europe again, likely happen before May. 

8. In June, Gadhafi’s force looks like will face major defeat, but some thing will happen in this chaotic middle east that might turn to his advantage.  Maybe another civil war inside the region? Just Murphy’s law, everything that can go wrong will go wrong.

Anyway, I’ll pray to all of the people who suffers and hopefully it will turn peace after 3 months.

Just saw the news, Gadhafi will cease file, let’s see what France is going to do and what rebel is going to do…



Update on 8/21/2011:
Looks like Rebel win after 5 months... Finally some good news.

Sunday, March 6, 2011

Pay by phone system for Vancouver Parking

Pay by phone system that can be used in Vancouver.  I don’t think this works with private parking lot though, so be careful.

http://vancouver.ca/engsvcs/parking/paybyphone.htm

http://www.verrus.com/verrus/index.aspx

 

Some Vancouver’s parking ticket rules and news:

http://www.cbc.ca/news/canada/british-columbia/story/2010/11/04/bc-vancouver-parking-tickets-adjudicators.html

http://www.cbc.ca/news/technology/story/2010/01/18/bc-paybyphoneglitch.html

 

And an extra link: Toronto parking ticket cancellation guide:

http://www.toronto.ca/legdocs/mmis/2010/cc/bgrd/backgroundfile-31301.pdf

A free Tax reporting software in Canada

I've been using studio tax from http://www.studiotax.com/ to report Canadian tax annually for 3 years now. It works and pretty simple to use from my point of view. Certainly it still have room to improve, such as the following:
1. adding right click menu for easier access
2. remember my investment lost in the past year and carry it over year by year when importing
3. having investment data input wizard.
4. Easier inputing for income in foreign country

I hope they can see this blog some day and make improvement. As I still love to use their software.

Saturday, March 5, 2011

How to get your kindle 3 to show Chinese characters natively Kindle3显示中文乱码问题

For simplified Chinese, type the following:
1. ;debugOn
2. ~changeLocale zh-CN
restart kindle (menu-setting, menu-restart)
3. ;debugOff

For Traditional chinese, type the following:
1. ;debugOn
2. ~changeLocale zh-TW
restart kindle (menu-setting, menu-restart)
3. ;debugOff

Friday, March 4, 2011

I finally did a wrong call trying to time the market. Oh, well

 

For the last few days, I tried to time the market by trading ETF almost daily.  And Finally I made a mistake on 03/02/2011… :(  And that’s a mistake I can prevent if I follow my own trend, oh, well…

This is what I did:

 

Assume Cash before Action Symbol Name vol unit price trading cost Plus/Minus Assume Cash after
22-Feb 6000 buy TYP DIREXION DLY TECH BEAR 3X 300 19.688 29 -5935.55 64.45
24-Feb 64.45 sell TYP DIREXION DLY TECH BEAR 3X 300 20.62 29 6157.03 6221.48
24-Feb 6221.48 buy TYH DIREXION DLY TECH BULL 3X 100 50.74 29 -5103 1118.48
25-Feb 1118.48 sell TYH DIREXION DLY TECH BEAR 3X 100 52.811 29 5252.04 6370.52
28-Feb 6370.52 buy TYP DIREXION DLY TECH BEAR 3X 300 19.909 29 -6001.7 368.82
1-Mar 368.82 sell TYP DIREXION DLY TECH BEAR 3X 300 20.84 29 6223.02 6591.84
2-Mar 6591.84 buy EDZ DIREXION E/M BEAR 3X-NEW 300 21.789 29 -6565.7 26.14
<-- bad!!! Market price on 3/4 8:30am: 20.67, lost close to 400 dollars here

Sunday, February 27, 2011

Moving find pic diff series to findpicdiff.blogspot.com

Since I can use javascript to make spot clicking successfully, I'll post the future find pic diff series to findpicdiff.blogspot.com.

Thanks.

Saturday, February 26, 2011

Find Pic Diff 2 for 2/26/2011

Looks like we can do it properly now. Let me give you another picture today. Please find 9 difference in this Vancouver, Canada English Bay picture.




Show Answer

Find Pic Diff for 2/26/2011


I wrote a javascript to handle the picture clicking. See if you can click on the picture to identify the differences. This is a picture of one of the holiday celebration dinner.

Show Answer

Monday, February 21, 2011

Find Pic Diff 02/21/2011

 

The following picture is taken in Disney downtown, Disney, Anaheim, California.

Please find 9 differences in the pictures:

20110221081304_question

 

Page down for the answer

 

 

 

 

 

 

 

 

 

 

 20110221081342_answer