Wikipedia:Reference desk/Archives/Computing/2012 November 10
Computing desk | ||
---|---|---|
< November 9 | << Oct | November | Dec >> | November 11 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
November 10
editA php "Baz"
editwhat does "Baz means here?
<?php
interface a
{ public function foo();
}
interface b extends a
{
public function baz(Baz $baz);
}
// This will work
class c implements b
{
public function foo()
{
}
public function baz(Baz $baz)
{
}
}
// This will not work and result in a fatal error
class d implements b
{
public function foo()
{
}
public function baz(Foo $foo)
{
}
}
?>
— Preceding unsigned comment added by Exx8 (talk • contribs) 11:37, 10 November 2012 (UTC)
- Nothing; it's just a variable name, like "something" or "whatever". See Metasyntactic variable. -- Finlay McWalterჷTalk 11:40, 10 November 2012 (UTC)
- There's the article Foobar as well, which also answers the question. --NorwegianBlue talk 20:31, 10 November 2012 (UTC)
- I ask what:
- There's the article Foobar as well, which also answers the question. --NorwegianBlue talk 20:31, 10 November 2012 (UTC)
public function baz(Baz $baz);
changes. what is the different between this command to that:
public function baz($baz);
Exx8 (talk) 21:01, 11 November 2012 (UTC)
- PHP has "type hints" for function arguments, which are basically like static typing. Type hints won't work with int or string or other primitives, though, because they are not actual objects in PHP. So, the following code:
<?PHP
function foo(integer $x) {
return 1;
}
echo foo(4);
produces this error: PHP Catchable fatal error: Argument 1 passed to foo() must be an instance of integer, integer given, called in...
The same thing happens with string. →Σσς. (Sigma) 22:34, 11 November 2012 (UTC)
To answer the question explicitly, including the "Baz" means that the function will only ever accept variables which are Baz class objects. Handing anything else to that function will immediately cause an error. It's equivalent to a "Baz objects only, all others forbidden" sign. The Masked Booby (talk) 03:35, 12 November 2012 (UTC)
Chinese keyboard
editWhat does chinese keyboard look like? Bennielove (talk) 13:20, 10 November 2012 (UTC)Bennie
- Chinese input methods for computers has pictures of several kinds, and links to the various input methods that are used to allow selection of the large number of Chinese characters without a gigantic input device. -- Finlay McWalterჷTalk 13:28, 10 November 2012 (UTC)
- That article is a little misleading - all of the pictures are of specialised Chinese keyboards, but in reality these are very rare. Virtually all computers in China have a standard US keyboard; people enter the pinyin pronunciation of the character(s) they want to type, and choose the matching character from IME software such as Google Pinyin. Here is a picture:
- 114.252.106.198 (talk) 16:10, 11 November 2012 (UTC)
- I imagine many articles will be misleading if you only look at the pictures and don't read. It does actually cover the pinyin approach. ¦ Reisio (talk) 18:58, 11 November 2012 (UTC)
- Well, the OP wanted to know what a Chinese keyboard looks like, and the article has lots of pictures of Chinese keyboards, none of which is what normal keyboards in China actually look like. And it's not just the pictures. The article mentions pinyin, along with many other methods, but doesn't emphasise that it is overwhelmingly the most common input method. It even says "in mainland China, wubi (shape-based) and pinyin methods such as Sogou Pinyin and Google Pinyin are the most popular", which is true in the same way as "in America, DVORAK and QWERTY keyboards are the most popular" is true. The fact is, the vast majority of Chinese people use standard US keyboards and a pinyin IME, and the article Finlay McWalter linked doesn't reflect that reality. 59.108.42.46 (talk) 03:34, 12 November 2012 (UTC)
- Non-free image removed. →Σσς. (Sigma) 00:32, 12 November 2012 (UTC)
- Oh come on, that was clearly fair use and directly relevant to the question. If anyone is wondering what the image was, it was File:GooglePinyin.png. 59.108.42.46 (talk) 03:34, 12 November 2012 (UTC)
- Fair use or not is irrelevent. It's clearly forbidden under our WP:NFCC policy Nil Einne (talk) 14:58, 12 November 2012 (UTC)
- Oh come on, that was clearly fair use and directly relevant to the question. If anyone is wondering what the image was, it was File:GooglePinyin.png. 59.108.42.46 (talk) 03:34, 12 November 2012 (UTC)
- I imagine many articles will be misleading if you only look at the pictures and don't read. It does actually cover the pinyin approach. ¦ Reisio (talk) 18:58, 11 November 2012 (UTC)
TRANSFERING MY ENTIRE Itunes LIBRARY FROM STATIONARY PC OVER TO MY LAPTOP
editHey.
I have one stationary computer with 700 songs on my Itunes there, and I have a laptop with zero songs on my Itunes. Do I have to burn all the 700 songs over on innumerable cd's and then move them over to the laptop the??? That's too much...
Surely there must be possible somehow to transfer these songs over from Itunes to Itunes on my two different computers by using a USB wire or HDMI cable or something. Don't think my stationary's got HDMI though.
Anyway, there must be some easy way, right?
109.247.62.59 (talk) 18:07, 10 November 2012 (UTC)
- Yes, over your network would likely be simplest, and putting them on a portable drive (a USB stick, for example) and copying them over probably fastest. ¦ Reisio (talk) 20:17, 10 November 2012 (UTC)
Image clean-up
editI'd like to be able to clean-up Wikipedia images, like the one shown here. In this case, I see three colors. One is yellow-orange, with RGB values of approximately (224,160,64). The others are close enough to use white (255,255,255) and black (0,0,0). So, the first step in the clean-up would be to change each pixel to one of those three colors. I want to avoid any attempt at stippling. After I have the image converted to those three colors, I can manually clean up the rest, such as the apparently yellow-orange ink smudges.
So, my question is, is there a nice free, off-the-shelf program to do the first part, or do I have to write one myself ? StuRat (talk) 18:56, 10 November 2012 (UTC)
- What OS are you using? If you're on a Mac, try GraphicConverter. It's shareware, so you can try it out and see it it works and then decide if you want to pay or not. Another one to look at is GIMP, which runs on several different platforms. RudolfRed (talk) 20:08, 10 November 2012 (UTC)
- Windows XP SP3. StuRat (talk) 22:35, 10 November 2012 (UTC)
- In GIMP: Colors > Map > Color Exchange… ¦ Reisio (talk) 20:09, 10 November 2012 (UTC)
- Thanks, I'll try that. StuRat (talk) 22:35, 10 November 2012 (UTC)
- I just tried it and I need some help (the help button on the panel produces a file not found error). They ask me to set the "From Color" red, green, and blue values, and also red, green and blue threshold values, all ranging from 0 to 1. There's also a "Lock threshold" check box. So, am I defining a range of RGB values ? If so, which is the low value, the one labeled "red" or "red threshold" ? And if a pixel falls within the red and green ranges, but not the blue range, does that mean it's changed, or not ? (I'm trying the think of how to use this feature to ensure that every pixel is converted into one of 3 colors. If the answer to the last Q is "no", then that would make this complicated, as some pixels may be within the range for the R and G but not the B, and thus not get converted.) StuRat (talk) 00:33, 11 November 2012 (UTC)
- You can find the online help at http://docs.gimp.org/2.8/en/plug-in-exchange.html. It's a little convoluted, but it does work. I wouldn't say there's really a silver bullet for what you want, though (and I don't actually care for the popularity of altering photographs and recreating computer graphics around here just for the sake of a slight increase in prettiness, but that's another discussion :p). ¦ Reisio (talk) 05:01, 11 November 2012 (UTC)
- Also, one could try to vectorize the image in InkScape. By playing with settings it should be possible, I think, get a SVG which, in addition to being "clean", would scale well, too Asmrulz (talk) 23:45, 10 November 2012 (UTC)
- In general though one doesn't actually want to reduce images to merely three colors — it destroys all aliasing and looks bad. Usually when you want to do something like reduce the yellowish backdrop to white you use something like the "Curves" function in Photoshop, which lets you set a "white point" and a "black point" and normalizes everything else around those points. Then you can move the curves around further to make sure that the "interior" colors are what you want them to be. The advantage of such a method, aside from being dead-easy to do quickly, is that it preserves the natural edges in between the extremes you pick, which keeps things from looking like bad forays into 1980s computer graphics. --Mr.98 (talk) 13:08, 11 November 2012 (UTC)
- Try Paint.NET if GIMP doesn't suit your needs.— The Hand That Feeds You:Bite 22:42, 14 November 2012 (UTC)