User talk:Πrate

From WikiProjectMed
Jump to navigation Jump to search

Need Software: Unique color counter

I'm looking for a software which can count the number of an unique color in a picture. For example, I want to know how many numbers of the color (20,167,99) in a picture. --百楽兎 11:15, 29 May 2009 (UTC)[reply]

The following (Python program) does that. It needs Python Imaging Library.
image_name = 'test.jpg'            # change as appropriate
desired_colour = (20,167,99)       # change as appropriate

import Image  # python imaging library

count=0
i = Image.open(image_name)
width,height = i.size
read_pixel_access = i.load() 

for x in range (0, width):
    for y in range(0, height):
        if read_pixel_access[x,y]==desired_colour:
            count += 1

print 'found', count, 'copies'
Let me know if you want it to find a unique colour, rather than just counting a specific one. 87.114.167.162 (talk) 11:55, 29 May 2009 (UTC)[reply]
Thank you but I can not run Python in this environment. Could you compile it to be an executable program for me? And actually, I have to count many colors' number, not only (20,167,99).--百楽兎 12:05, 29 May 2009 (UTC)[reply]
I have written you a Win32 executable. Please download [1]. If you use Linux, it will run under Wine. --Andreas Rejbrand (talk) 12:28, 29 May 2009 (UTC)[reply]
I guess you mean a Windows executable - I'm afraid I don't have a Windows machine to hand to do that (but maybe someone who does will do a py2exe for you). Anyway, here's the code to count all the colours in the image and display them in descending popularity (most first) sort order:
image_name = 'test.jpg'

import Image  # python imaging library
d = {}
i = Image.open(image_name)
width,height = i.size
read_pixel_access = i.load() 

for x in range (0, width):
    for y in range(0, height):
        (r,g,b) = read_pixel_access[x,y]
        if d.has_key((r,g,b)):
            d[(r,g,b)] += 1
        else:
            d[(r,g,b)] = 1

for col,count in sorted(d.items(), key=lambda (k,v): (v,k), reverse=True):
    print col, '-->', count
Hope this helps. 87.114.167.162 (talk) 12:30, 29 May 2009 (UTC)[reply]
Yes, it is really helpful! Thanks very much to 87.114.167.162 and Andreas Rejbrand!
And by the way, (please see this screenshot first) what is the purpose of the question area? It's always blank.--百楽兎 14:00, 29 May 2009 (UTC)[reply]
I intended to show the bitmap there, but obviously I forgot to add the code for it! --Andreas Rejbrand (talk) 14:05, 29 May 2009 (UTC)[reply]
It's alright and not a problem, although showing the bitmap may be convenient to pick a color. And thank you for so kindly help again.--百楽兎 22:48, 29 May 2009 (UTC)[reply]

How to find out duplicate lines?

There is a plain text file and contains thousands of lines in it. It looks like:

frkookoww
fdewkoofow
koroorg
fwkoofw
gktoot
gogoldds
fdewkoofow
koroorg
kofroroooooa
.
.
.

Some lines are the same. I want to find duplicate lines out and delete them. Do you know any softwares for this job? By the way, supporting Unicode is better. --百楽兎 (talk) 13:36, 24 July 2009 (UTC)[reply]

I'd use sort and uniq. Assume my file is called "lines.txt", I would run: "sort lines.txt | uniq > newlines.txt". If you don't have Linux/Unix, you can get Windows versions of sort and uniq. -- kainaw 13:39, 24 July 2009 (UTC)[reply]
If it's not acceptable to re-order the file, the following Perl command will do the job:
perl -ne 'print unless $seen{$_}++' lines.txt > newlines.txt
--Sean 14:06, 24 July 2009 (UTC)[reply]
Thank you. I think sort and uniq for windows seems easier to me. But I just want to uniq it without sorting, what should I do? --百楽兎 (talk) 15:14, 24 July 2009 (UTC)[reply]
The uniq function requires a sorted list. It simply will not work on an unsorted list. If you want to get real technical, uniq requires duplicate lines to be grouped together - and sort groups them. The other option is to write a script (like the perl script above). Some are one-liners (like perl) and some will be multiple lines. If you are looking for efficiency, this is a semi-common computer science homework problem. It has a recursive solution. Cut the file in half. Remove duplicates in each half. Compare both halves to see of they have any lines in common and remove them from one half or the other. The first step (remove duplicates in each half) is the recursion. You cut that half in half and remove duplicates in each half... On a single computer it isn't very efficient. If you are running on a parallel system, you can farm out the work to many other computers. -- kainaw 15:33, 24 July 2009 (UTC)[reply]
You could load the file in your browser, paste the following:
javascript:c=s=""; h={}; a=document.firstChild.innerHTML.split(/\n/g); for (v in a) if (!h[a[v]]){h[a[v]]=true; s += a[v] + "\n"}; s
into the location bar, and then save the file as text. It worked for me in Firefox, but your mileage will certainly vary. --Sean 16:32, 24 July 2009 (UTC)[reply]
It's not as nifty as the other options given above, but you could also do this in Excel fairly easily. Copy and paste the list into Sheet1 and again into Sheet2. Assuming your lists start in cell A1, type the following in cell B1 of Sheet1: =countif(Sheet2!a:a,a1) and then double click the box in the bottom right corner of the cell to auto-fill in the formula - the results will be the number of iterations of each term in the list. In column C, put a 1 in cell C1 and a 2 in cell C2 and use the same double-click trick to auto-fill column C with numbers (to preserve the original order). Sort by column B to find and delete the duplicates, then sort by column C to restore the original order. Matt Deres (talk) 19:48, 24 July 2009 (UTC)[reply]
Thanks all friends! I learned very much from your wise solutions. All are cool. --百楽兎 (talk) 23:44, 24 July 2009 (UTC)[reply]

http://gnuwin32.sourceforge.net/packages/coreutils.htm

Please help in finding citations for this article. Thanks! -- 李博杰  | Talk contribs email 00:18, 29 August 2009 (UTC)[reply]

GoogleTrans as a Chrome extension

Hi there,

Thanks for the positive feedback. Since the javascript of GoogleTrans is public domain you can go ahead and use it to make a Chrome extension yourself. If you do this, please let me know how it goes.

I, myself, can look at this as well, but will need around 2 weeks since I have got myself involved in a commercial project right now.

Endo999 (talk) 17:32, 26 January 2010 (UTC)[reply]

Hi there,

I have looked at Chrome extensions and doubt whether I can quickly make the tool an extension for this platform. The extension does not run in the document space of the webpage. I trap several events that I probably cannot do via the extension.

However, I do have a version of the tool available for people surfing the web:

http://www.securecottage.com/cgi-bin/reference.cgi

This is a slightly earlier version of the tool that does the following. Any website you link to, via a link or via the input field of the form in the above website, will get gotten by a perl script I keep. This perl script will change all the links to point to itself, and will inject the javascript tool into the html it presents to you. As such, you can surf the web and have the tool on 99 percent of the webpages out there. You always stay on my webpage, but my webpage gets any URL for you. It's a type of proxy. The effect will be almost exactly the same as you have seen with GoogleTrans on Wikipedia.

Thanks again for interest in the tool. I use the tool to read French and Spanish webpages. Like most Anglos, I don't have full command of a second or third language, and need to decipher a word or two in a French article (and more in Spanish). One day I hope to be able to understand French or Spanish as it is spoken, but I am not there right yet.

Endo999 (talk) 06:57, 27 January 2010 (UTC)[reply]

License tagging for File:The Dahm Tower.png

Thanks for uploading File:The Dahm Tower.png. You don't seem to have indicated the license status of the image. Wikipedia uses a set of image copyright tags to indicate this information; to add a tag to the image, select the appropriate tag from this list, click on this link, then click "Edit this page" and add the tag to the image's description. If there doesn't seem to be a suitable tag, the image is probably not appropriate for use on Wikipedia.

For help in choosing the correct tag, or for any other questions, leave a message on Wikipedia:Media copyright questions. Thank you for your cooperation. --ImageTaggingBot (talk) 08:05, 10 February 2011 (UTC)[reply]

Tencent

I removed your contribution to the Tencent page. While I want you to contribute to the page and have no objection to your adding information about Tencent's lack of innovation, that information does not belong in the lead section. If you feel I am wrong, please discuss it on the "Discussion" page of the Tencent article. Thanks, Fleetham (talk) 17:24, 3 April 2011 (UTC)[reply]

Same goes for your edit on the Baidu page. ~a (usertalkcontribs) 06:51, 8 April 2011 (UTC)[reply]
I really do want you to contribute, but please don't put material back in the lead when someone says that's not its proper place. If you feel I am wrong, please say so on the Talk:Tencent Holdings page. Let's talk instead of WP:Edit warring. Fleetham (talk) 13:53, 8 April 2011 (UTC)[reply]
If you want your material to be included, you will have to add it lower down on the page. Fleetham (talk) 05:46, 10 April 2011 (UTC)[reply]
I added a "Copying claims" section to the page. It's not in the top part, and you can see it at: Tencent Holdings#Products and services#Similar services. Please edit this section if you feel it is deficient. I assume there's a QQ version of everything from web browsers to micro-blogging services to whatever happens to be popular. I think this is what is meant by "QQ copying"--that they provide the same services as other do. Am I right or is Tencent's copying more like intellectual property theft? Fleetham (talk) 14:36, 10 April 2011 (UTC)[reply]

Tencent response

Can I get you to respond Πrate? I'd like to hear how you feel about my additions to the Tencent article. Fleetham (talk) 11:07, 11 April 2011 (UTC)[reply]

Tencent again

Sorry to tell you, but I reverted your latest edit to the Tencent page. I didn't delete the section name "Copying claims", and I kept your change of "Pony Ma" to Ma Huateng, but I removed your other additions.

I really would like to discuss this with you. I don't live in China, and so I don't know what "Tencent copying" is like.

I think by "copying" you mean that all of Tencent's products (IM, e-commerce, mobile IM, games, etc.) are not innovations.

But to claim "copying" might be a large claim. For example, the QQ car is copying. But you don't say "all automakers copy" because they all sell compact cars. Even if Nissan made the first compact car, you don't say "all automakers copy Nissan".

I don't know which example Tencent is like. I don't live in China, and I don't use Tencent services. If you know Tencent is really copying, please tell me. Because I think it sells "similar services" and (just like the auto company that makes a compact car) doesn't "copy". Fleetham (talk) 14:55, 25 April 2011 (UTC)[reply]

Please do not add original research or novel syntheses of previously published material to our articles as you apparently did to Baidu. Please cite a reliable source for all of your information. You seem to be ignoring our many discussions here. Thank you. ~a (usertalkcontribs) 14:09, 13 May 2011 (UTC)[reply]

Tencent respon 2

Hi. You're right, I shouldn't remove material that has a citation. But when the citation is in Chinese, you're right: I can't know or agree. Can you provide a translation? Fleetham (talk) 04:56, 17 May 2011 (UTC)[reply]

Okay, thanks for responding. I asked because the machine translation (Google Translate) allows me to see that the citation is relevant. I know it's not just a random news article in Chinese, but I don't really know what it says. Anyway, I don't think "Pony Ma" should say such things! It's probably dangerous? Maybe he means "don't tell me what to do, Mr. Government"? Because the Government wants innovation but Ma can't deliver. I don't really know enough to think I am correct.Fleetham (talk) 05:38, 3 June 2011 (UTC)[reply]

The article Dahm Tower has been proposed for deletion because of the following concern:

This scene/setting from a game does not meet WP:N. It doesn't have significant coverage in reliable sources independent of the subject, especially such to warrant its own encyclopedia article.

While all contributions to Wikipedia are appreciated, content or articles may be deleted for any of several reasons.

You may prevent the proposed deletion by removing the {{proposed deletion/dated}} notice, but please explain why in your edit summary or on the article's talk page.

Please consider improving the article to address the issues raised. Removing {{proposed deletion/dated}} will stop the proposed deletion process, but other deletion processes exist. In particular, the speedy deletion process can result in deletion without discussion, and articles for deletion allows discussion to reach consensus for deletion. czar · · 07:37, 18 October 2012 (UTC)[reply]

Orphaned non-free image File:Hotel Indigo.svg

⚠

Thanks for uploading File:Hotel Indigo.svg. The image description page currently specifies that the image is non-free and may only be used on Wikipedia under a claim of fair use. However, the image is currently not used in any articles on Wikipedia. If the image was previously in an article, please go to the article and see why it was removed. You may add it back if you think that that will be useful. However, please note that images for which a replacement could be created are not acceptable for use on Wikipedia (see our policy for non-free media).

Note that any non-free images not used in any articles will be deleted after seven days, as described in the criteria for speedy deletion. Thank you. Nick⁠—⁠Contact/Contribs 16:56, 1 September 2015 (UTC)[reply]

Hi,
You appear to be eligible to vote in the current Arbitration Committee election. The Arbitration Committee is the panel of editors responsible for conducting the Wikipedia arbitration process. It has the authority to enact binding solutions for disputes between editors, primarily related to serious behavioural issues that the community has been unable to resolve. This includes the ability to impose site bans, topic bans, editing restrictions, and other measures needed to maintain our editing environment. The arbitration policy describes the Committee's roles and responsibilities in greater detail. If you wish to participate, you are welcome to review the candidates' statements and submit your choices on the voting page. For the Election committee, MediaWiki message delivery (talk) 13:57, 23 November 2015 (UTC)[reply]

Orphaned non-free image File:Crowne Plaza.svg

⚠

Thanks for uploading File:Crowne Plaza.svg. The image description page currently specifies that the image is non-free and may only be used on Wikipedia under a claim of fair use. However, the image is currently not used in any articles on Wikipedia. If the image was previously in an article, please go to the article and see why it was removed. You may add it back if you think that that will be useful. However, please note that images for which a replacement could be created are not acceptable for use on Wikipedia (see our policy for non-free media).

Note that any non-free images not used in any articles will be deleted after seven days, as described in section F5 of the criteria for speedy deletion. Thank you. --B-bot (talk) 20:15, 26 May 2017 (UTC)[reply]

Orphaned non-free image File:Kadokawa Group Holdings.svg

⚠

Thanks for uploading File:Kadokawa Group Holdings.svg. The image description page currently specifies that the image is non-free and may only be used on Wikipedia under a claim of fair use. However, the image is currently not used in any articles on Wikipedia. If the image was previously in an article, please go to the article and see why it was removed. You may add it back if you think that that will be useful. However, please note that images for which a replacement could be created are not acceptable for use on Wikipedia (see our policy for non-free media).

Note that any non-free images not used in any articles will be deleted after seven days, as described in section F5 of the criteria for speedy deletion. Thank you. --B-bot (talk) 18:34, 23 February 2024 (UTC)[reply]

Orphaned non-free image File:CandleWood.svg

⚠

Thanks for uploading File:CandleWood.svg. The image description page currently specifies that the image is non-free and may only be used on Wikipedia under a claim of fair use. However, the image is currently not used in any articles on Wikipedia. If the image was previously in an article, please go to the article and see why it was removed. You may add it back if you think that that will be useful. However, please note that images for which a replacement could be created are not acceptable for use on Wikipedia (see our policy for non-free media).

Note that any non-free images not used in any articles will be deleted after seven days, as described in section F5 of the criteria for speedy deletion. Thank you. --B-bot (talk) 02:06, 16 April 2024 (UTC)[reply]