Add or Remove the menu bar and toolbar from gvim

In _vimrc file:

” Add menu bar
set guioption+=m

” Add toolbar
set guioptions+=T

” Remove menu bar
set guioptions-=m

” Remove toolbar
set guioptions-=T

While already in gvim, enter command line mode, for example:

:set guioptions-=m

Advertisements

Install Android 2.3.7 on Kyros MID7015A

shot_000004 shot_000007 shot_000006

I just flashed and installed another Gingerbread image Android 2.3.7 on my Kyros MID7015A. I believe the mod was done mainly by fun_ who posted on xda-developers. The performance is even better than last Android 2.3.1 mod. More importantly, it solved the rooting issue of last mod. Thank you fun_!

The mod includes ClockworkMod Recovery 5, CyanogenMod 7 and FWDN image. Then install gapps using CWM.

However this mod has problems as well.

  • SD card can’t mount to PC, I have to unmount SD card from the tablet and take it out then plug into PC to access SD card files. It is not the way I like it but I can live with that.
    I found a solution by searching the thread of the xda-developers forum. Install an app USD Mass Storage Watcher, check option Mount USB Mas Storage Automatically. That did the trick. Oulala!
  • After calibration, touch screen won’t work. This issue is more serious. Have to restore backup if it’s accidentally calibrated.
  • There are no volume up and down buttons on the status bar. Have to go to settings to adjust volume.
    Since MID7015A has no hard volume buttons, without soft volume buttons makes it worse when you want to adjust the sound volume. The solution is to install an app named Button Savior. So the soft volume buttons are back. Problem solved.
  • Stock Gallery is not able to load or play any videos. I like the stock Gallery of the last mod as it plays HD videos smoothly while other video players laggy. I think it is hardware acceleration problem.

The calibration problem remains unsolved. But I am happy that this tablet is able to run more apps and faster.

You can go to the following link where I followed step by step and downloaded all the files.

unofficial CyanogenMod 7/ClockworkMod Recovery 5 for TCC8902/TCC8803 tablets
CyanogenMod for Telechips

Look for the latest images for TCC8902 (2011/10/29) on “CyanogenMod for Telechips” page.
COBY Kyros MID7015 GB ROM
ClockworkMod Recovery 5, CyanogenMod 7, FWDN image

After flashing, the tablet will not have Market. To solve that, download gapps-gb-20110828-signed.zip here and install it using CWM.

Python Challenge – level 12 solution

The picture file name is evil1.jpg.
It led me to try evil2.jpg.
The URL evil2.jpg exists and it says “not jpg but .gfx”
The URL http://www.pythonchallenge.com/pc/return/evil2.gfx exists. And we got the binary evil2.gfx
evil2.gfx is a mixed file from 5 picture files. This is solved by looking at the binary files with a hex editor.
The following code separated the file into their original format:

# file evil2.gfx is a combined file from 5
f = open('evil2.gfx','rb')
g = f.read()
f1 = open('evil2-1.jpg','ab')
f2 = open('evil2-2.jpg','ab')
f3 = open('evil2-3.jpg','ab')
f4 = open('evil2-4.jpg','ab')
f5 = open('evil2-5.jpg','ab')

for x in range(len(g)):
    if x % 5 == 0:
        f1.write(g[x])
    elif x % 5 == 1:
        f2.write(g[x])
    elif x % 5 == 2:
        f3.write(g[x])
    elif x % 5 == 3:
        f4.write(g[x])
    else:
        f5.write(g[x])
f.close()
f1.close()
f2.close()
f3.close()
f4.close()
f5.close()

Each of the created file gives a piece of the answer:
dis – pro – port – ional – ity

Python Challenge – level 11 solution

cave3
cave2
The image is mixed 2 pictures. The darker one has the answer.
The following code is for the one which has answer. The other picture was produced by the code just switching the arguments of the 2 getpixel sentences.

import Image, ImageDraw

im = Image.open('cave.jpg')
draw = ImageDraw.Draw(im)
for j in range(im.size[1] / 2):
    for i in range(im.size[0] - 2):
        if i % 2 == 0:
            im.putpixel((i, j), im.getpixel((i, j*2)))
        else:
            im.putpixel((i, j), im.getpixel(i, j*2 + 1))
im.save('cave3.jpg')

Python Challenge – level 10 solution

I was lazy about this one. The code is borrowed from wiki:

def look_and_say(member):
    while True:
        yield member
        breakpoints = ([0] + [i for i in range(1, len(member)) 
                              if member[i - 1] != member[i]]
                        + [len(member)])
        groups = [member[breakpoints[i - 1]:breakpoints[i]]
                  for i in range(1, len(breakpoints))]
        member = ''.join(str(len(group)) + group[0] for group in groups)
 
# Print the 10-element sequence beginning with "1"
sequence = look_and_say("1")
# for i in range(10):
#    print sequence.next()
# The above 2 lines are the only codes I modified as below:
for i in range(31):
    print len(sequence.next())
>>>execfile('pc10.py')
1
2
2
4
6
6
8
10
14
20
26
34
46
62
78
102
134
176
226
302
408
528
678
904
1182
1540
2012
2606
3410
4462
5808

Python Challenge – level 9 solution

good2
The solution is easy but it took me some time to figure out how to use those data.

# draw lines based on the given coordinates

import Image, ImageDraw
t1 = [146,399,163,403,170,393,169,391,166,386,170,381,170,371,170,355,169,346,167,335,170,329,170,320,170,
310,171,301,173,290,178,289,182,287,188,286,190,286,192,291,194,296,195,305,194,307,191,312,190,316,
190,321,192,331,193,338,196,341,197,346,199,352,198,360,197,366,197,373,196,380,197,383,196,387,192,
389,191,392,190,396,189,400,194,401,201,402,208,403,213,402,216,401,219,397,219,393,216,390,215,385,
215,379,213,373,213,365,212,360,210,353,210,347,212,338,213,329,214,319,215,311,215,306,216,296,218,
290,221,283,225,282,233,284,238,287,243,290,250,291,255,294,261,293,265,291,271,291,273,289,278,287,
279,285,281,280,284,278,284,276,287,277,289,283,291,286,294,291,296,295,299,300,301,304,304,320,305,
327,306,332,307,341,306,349,303,354,301,364,301,371,297,375,292,384,291,386,302,393,324,391,333,387,
328,375,329,367,329,353,330,341,331,328,336,319,338,310,341,304,341,285,341,278,343,269,344,262,346,
259,346,251,349,259,349,264,349,273,349,280,349,288,349,295,349,298,354,293,356,286,354,279,352,268,
352,257,351,249,350,234,351,211,352,197,354,185,353,171,351,154,348,147,342,137,339,132,330,122,327,
120,314,116,304,117,293,118,284,118,281,122,275,128,265,129,257,131,244,133,239,134,228,136,221,137,
214,138,209,135,201,132,192,130,184,131,175,129,170,131,159,134,157,134,160,130,170,125,176,114,176,
102,173,103,172,108,171,111,163,115,156,116,149,117,142,116,136,115,129,115,124,115,120,115,115,117,
113,120,109,122,102,122,100,121,95,121,89,115,87,110,82,109,84,118,89,123,93,129,100,130,108,132,110,
133,110,136,107,138,105,140,95,138,86,141,79,149,77,155,81,162,90,165,97,167,99,171,109,171,107,161,
111,156,113,170,115,185,118,208,117,223,121,239,128,251,133,259,136,266,139,276,143,290,148,310,151,
332,155,348,156,353,153,366,149,379,147,394,146,399]

t2 = [156,141,165,135,169,131,176,130,187,134,191,140,191,146,186,150,179,155,175,157,168,157,163,157,159,
157,158,164,159,175,159,181,157,191,154,197,153,205,153,210,152,212,147,215,146,218,143,220,132,220,
125,217,119,209,116,196,115,185,114,172,114,167,112,161,109,165,107,170,99,171,97,167,89,164,81,162,
77,155,81,148,87,140,96,138,105,141,110,136,111,126,113,129,118,117,128,114,137,115,146,114,155,115,
158,121,157,128,156,134,157,136,156,136]

im = Image.open('good.jpg')

draw = ImageDraw.Draw(im)
for i in range(0,len(t1)-4,2):
    draw.line((t1[i],t1[i+1],t1[i+2],t1[i+3]), fill = 128, width = 3)
for i in range(0,len(t2)-4,2):
    draw.line((t2[i],t2[i+1],t2[i+2],t2[i+3]), fill = 128, width = 2)
im.save('good2.jpg')

The script draws a outlined bull in the original picture then saves as good2.jpg.

Python Challenge – level 8 solution

This one is relatively easy. One of the reasons may be there is not much scripting needed.
The riddle designer gave a hint from the forum saying “Look at the password box hint”. When clicking the insect, the dialog shows a hint saying “inflate”. Someone from the forum also said the sound made by the insect. So it’s got to be bz2 and decompress.

>>> import bz2
>>> un = 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00\x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
>>> pw = 'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
>>> print bz2.decompress(un)
huge
>>> print bz2.decompress(pw)
file