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

Saturday, January 15, 2011

Find Pic Diff 01/15/2011

 

The following picture is also taken from Ronald Reagan Presidential Foundation and Library, Air force One:

Please find 9 differences in the pictures:

20110115125418_question

Page down for the answer:

 

 

 

 

 

 

20110115125422_answer

Tuesday, January 4, 2011

Find Pic Dif 01/04/2011

 

The following picture is taken from Ronald Reagan Presidential Foundation and Library, the Oval office.

http://www.reaganlibrary.com/details_f.aspx?p=LM2002EX&h1=7&h2=3&lm=libraryandmuseum&args_a=cms&args_b=32&argsb=N&tx=15&sw=15

Please find 9 differences in the pictures

 

20110104091455_question

 

Page down for the answer:

 

 

 

 

 

 

 

 

 

20110104091526_answer