Jump to content

Wikipedia:Reference desk/Archives/Computing/2012 September 21

From Wikipedia, the free encyclopedia
Computing desk
< September 20 << Aug | September | Oct >> September 22 >
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.


September 21[edit]

What algorithm or method is used to split color and bw?[edit]

To pick just one example, there's a movie called Pleasantville where this happens a lot. There will be a scene where everything is black and white except for one person in color and they are moving around and the color edges of their body against the black and white everything-else are crisply defined. From that article, I saw "The black-and-white meets color world portrayed in the movie was filmed entirely in color and selectively desaturated and contrast adjusted digitally." I want to know the nitty-gritty details of that " selectively desaturated and contrast adjusted digitally." I read the Spirit DataCine article but didn't see an answer to my specific question there. What algorithm can keep track of all the edges of something like a human in a complex moving sequence of frames? 20.137.18.53 (talk) 13:06, 21 September 2012 (UTC)[reply]

Means for identifying objects in a scene and altering their colour (usually for adding rather than removing it) are discussed rather generally at Film colorization#Digital colorization. The processes involved are described rather more formally in video tracking and feature extraction. These will help automate the process, but aren't a general solution, so I think such a process will still require a human hinting for the system and repairing mistakes it makes. -- Finlay McWalterTalk 13:48, 21 September 2012 (UTC)[reply]
I have no clue as to what was used for Pleasantville, but don't dismiss completely the idea that someone (or probably multiple someones) went through things frame-by-frame to draw the edges between the color and the black and white sections. Keep in mind that prior to computer inbetweening, each and every frame for animated movies (such as Snow White, Cinderella, and Fantasia) were drawn by hand (although cel animation was used to reduce the workload). Even now, stop motion films (such as Wallace and Grommit and Coraline) are shot in a laborious frame-by-frame process. In comparison, going through each frame by hand to specify the edges of a human (and then letting the computer digitally desaturate and contrast adjust everything outside) is simple. -- 205.175.124.30 (talk) 02:32, 22 September 2012 (UTC)[reply]
  • This page describes the technology in considerable detail, but all it says about this specific question is, "One of the key tools they used was Shake, an open-system compositing software toolset created by the Venice, California, software film Nothing Real which formed the basis for their proprietary interactive color-correction software program." Looie496 (talk) 03:05, 22 September 2012 (UTC)[reply]

Selecting/clearing current cell's contents in Excel[edit]

Resolved

When typing formulas in Microsoft Excel, I often mess up somewhere along the way and find it easiest to clear up and start over. The problem is that there doesn't seem to be any relatively short series of actions to get there. If I click anywhere away from the cell, Excel helpfully warns me about the bad formula and forces me back into it. Ctrl-A does nothing whatsoever. Ultimately, I have to manually select the content of the cell and hit Backspace or Delete. Does anyone have a faster method? (I don't want to disable the warning because it is useful if I actually intend a given mal-formed formula.) 173.163.25.70 (talk) 15:56, 21 September 2012 (UTC)[reply]

There's the X to the left of the formula bar, but that means a single mouse movement rather than a keystroke solution. --Tagishsimon (talk) 16:07, 21 September 2012 (UTC)[reply]
Ah. <ESC> is your friend. --Tagishsimon (talk) 16:09, 21 September 2012 (UTC)[reply]
Thank you! (same person, different IP) 72.72.196.226 (talk) 21:55, 21 September 2012 (UTC)[reply]

Default program of same name won't stick[edit]

When I open a file in Microsoft Word on my mac it opens with version 14.0.0 by default. I want to change it so that all Word files open by default with version 12.1.0, which I also have. The problem comes in that they are both named the same thing. I know one way to change the default for all files, but it doesn't work in this case because of the name being the same. Specifically, if I highlight a Word file, then go to "Get info", then go to "open with" and choose version 14.0.0 to version 12.1.0 it will of course open the fie in that Word version, but when I click on "change all" just below after selecting 12.0.0, it doesn't recognize any difference between the Word versions; the "open with" resets before my eyes to the later version (as I can see from the Icon changing to 14.0.0's icon) and so there's no change for other Word Files. Any help?--108.27.102.226 (talk) 19:07, 21 September 2012 (UTC)[reply]

I don't know about Word specifically, but many programs don't support you having more than one version on your computer at once (they always use the most recent). If Word is like that, you'd need to uninstall version 14.0.0 (and possibly reinstall 12.1.0, if the uninstall takes too much). A dual-boot system with two different file partitions is one way to have two versions at once on the same computer, for software which doesn't inherently support this ability. StuRat (talk) 19:21, 21 September 2012 (UTC)[reply]
Ah, that just sucks, though I appreciate the information. Thank you. I really do like the earlier version for some things, and the later for others. I have no problem in switching between them using "open with", and haven't noticed any problem with them co-existing other than the default opening issue. Sigh.--108.27.102.226 (talk) 19:40, 21 September 2012 (UTC)[reply]
I work with several different (graphic & page-layout) application versions; all I have to suggest is the workaround I use, which is to keep the non-default versions in the Dock and drag documents onto the icon for the particular version I want to open them with. (You can also right-click and choose an application to “Open With”, unless the versions' mini-icons are also indistinguishable.)—Odysseus1479 (talk) 05:08, 23 September 2012 (UTC)[reply]
I've managed to keep two versions of Word on a Mac before. I don't know the ins and outs of how the file associations work, though. There's got to be some under-the-hood way to do it, but it's beyond me; I'm not sure what's changing it back before your eyes (is it Word? is it something else?). --Mr.98 (talk) 21:29, 21 September 2012 (UTC)[reply]
First of all, remember that OS X is a unix based operating system. Now, I don't have a Mac and don't know how Microsoft Office is installed on it, so the following might not be accurate, but it might give you a way to look for a solution.
Unix can use symbolic links to point to different version of the same package. So, one version of Word might be installed at /usr/msoffice-14.0.0/word while the other version might be installed at /usr/msoffice-12.1.0/word. Which one is actually run, depends on where the link /usr/msoffice points to. Of course, the actual names of things might be different, or the link might be at the level of the program itself, but it is possible to have multiple versions installed. Whether OS X lets you fiddle around with installed programs in this way, is a different question. Astronaut (talk) 10:26, 22 September 2012 (UTC)[reply]
Unfortunately, that's not at all how the majority of GUI applications on Mac OSX work. They tend to be installed in the /Applications/ folder (and each application is actually a folder itself). Office 2011 creates a subfolder 'Microsoft Office 20111' under /Applications/, and puts all of its applications there. To the OP, I wonder if it helps to rename the older version of 'Microsoft Word.app' to 'Microsoft Word old.app', if Mac indeed only links them by their name. Unfortunately I don't have 2 copies of Office here to test it myself, but Word 2011 itself doesn't seem to mind being renamed Unilynx (talk) 14:06, 22 September 2012 (UTC)[reply]
I poked around a bit under the hood. Warning: if you manipulate these files, things might break. Make backups.
Default file associations are kept in ~/Library/Preferences/com.apple.LaunceServices.plist. You can open this file in a text editor; it is just XML. I actually open all of my Word files in Pages by default. Here's what mine looks like for MS Word files:
		<dict>
			<key>LSHandlerContentType</key>
			<string>com.microsoft.word.doc</string>
			<key>LSHandlerIgnoreCreator</key>
			<true/>
			<key>LSHandlerRoleAll</key>
			<string>com.apple.iwork.pages</string>
		</dict>
You can see what it's doing — when it finds a file that is of the type com.microsoft.word.doc, it basically says, "ignore what you know about MS Word files, and treat it like a Pages file instead." Kind of clever.
Separately, I also find this little bit of code:
		<dict>
			<key>LSHandlerContentTag</key>
			<string>mht</string>
			<key>LSHandlerContentTagClass</key>
			<string>public.filename-extension</string>
			<key>LSHandlerIgnoreCreator</key>
			<true/>
			<key>LSHandlerRoleAll</key>
			<string>com.microsoft.word</string>
		</dict>
This I interpret as saying, "if you find a file with a file extension of .mht, treat it like an MS Word file." Now I don't have something comparable for a .doc or .docx extension, so I don't know how it knows what those are. However it does have things like this:
		<dict>
			<key>LSHandlerContentType</key>
			<string>com.microsoft.word.openxml.document</string>
			<key>LSHandlerRoleAll</key>
			<string>com.microsoft.word</string>
		</dict>
Which makes it look like it somehow "just knows" what .docx files are and thereby knows to send them to Word.
Of course, your problem is, where does com.microsoft.word go to by default? I don't really know. When I look at the Info.plist file embedded inside the Word 2008 package, it has a line that identifies its CFBundleIdentifier as com.microsoft.Word. Is this what the OS is using to identify the program? I don't know. Word 2004 is not a package and probably runs through Rosetta or something like that. Could one change that Info.Plist file inside the one you don't want to be considered Word and thus "disassociate" it? I don't know. It might break things. I'm not so curious that I want to monkey with my install. The likely thing is that both of the Word versions are using the same CFBundleIdentifier, which is causing the problem with the default file associations.
Anyway, none of this is very conclusive, but I offer it up in case there are others who know a bit more about it. (Though from the responses above, I doubt it, since many of those who are trying to comment on this seem to be totally ignorant of how OS X does things like this.) --Mr.98 (talk) 23:19, 22 September 2012 (UTC)[reply]

Adding image file name in excel[edit]

Is the following possible in Excel?: 1. user selects a cell; 2. user clicks on "browse for images" (name is my invention); 3. a file or image browser appears; 4. user clicks on/selects an image; 5. file/image browser disappears and the image file name (perhaps including its directory name) appears in the cell selected in "1" above. This process needs to be fool proof, so I am not looking for a copy/paste solution using several programs. If this is not possible in Excel, are there any other possible solutions? bamse (talk) 19:33, 21 September 2012 (UTC)[reply]

This is about as far from the original purpose of Excel (a spreadsheet program) as you can get. I doubt if they support this, and, if they did, this would be a serious case of bloatware, IMHO. What is your actual goal, to have a two-dimensional array of file names arranged as you want, then you pick on them to see the full images ? If so, just using Windows Explorer (File Manager) to arrange links to those files may be the way to go. I believe there are options to use small icons, and you can arrange the links to file names as you like, in a folder. I think there's a way to make it use a snapping grid, too, so you will get a nice layout. StuRat (talk) 21:14, 21 September 2012 (UTC)[reply]
My guess (from my own doing the same thing) is that they have a large flat file database, and want to just add easy file-browsing/displaying capability to the cells. It's not a crazy thing to want. It's a nice compromise between making some sort of big Access database and just keeping a bunch of files separate on the hard drive. --Mr.98 (talk) 21:32, 21 September 2012 (UTC)[reply]
I've written some code that can do just this. It's long, though, and a bit complicated. Post an e-mail address to my talk page and I'll send it to you as a ZIP file. I haven't tested it on the latest versions of Excel (I've tested it on Excel 2003 and 2007 for Windows, and Excel 2004 for Mac; it definitely won't work on Excel 2008 for Mac because in that version Microsoft stripped out VBA support), though. --Mr.98 (talk) 21:42, 21 September 2012 (UTC)[reply]
Thanks will post an e-mail in a moment. You guessed right. It is basically a way to populate a database. Somebody (not actually near the mysql database) will create a spreadsheet or csv containing image file names in column 2 and image description (i.e. text) in column 1 (simplified view but it contains the essence). Said person needs to select the "best" image (which is to be entered to the DB) from a large number of images. That's why an image viewer would come in handy. This spreadsheet will then eventually be used to create the database. I don't know anything about VBA macros and only little about Excel at the moment, but hopefully this will improve. Alternatively I am considering to have some directory structure and/or file naming conventions and to create the csv with shell scripts, but I am concerned that this might be more error prone on the user side. bamse (talk) 21:51, 21 September 2012 (UTC)[reply]
I've sent the files; see if they help. --Mr.98 (talk) 22:59, 22 September 2012 (UTC)[reply]

You can easily turn the contents of a cell (or part of the contents) into a hyperlink. The link doesn't have to be to a page hosted on a website. The only thng is that the hyperlink will open in your web browser, not in the speadsheet cell. Alternatively, there is probably a way to do what you want with VBA (depending on your version of Excel), but that would require some programming knowledge. Astronaut (talk) 10:07, 22 September 2012 (UTC)[reply]

There are actually problems with making hyperlinks work in a friendly way with files, if I recall from my own struggles with this. I don't remember the specifics but it didn't work out well. My memory of this is that Excel's hyperlink handling functions are more brittle than you'd expect them to be. --Mr.98 (talk) 22:59, 22 September 2012 (UTC)[reply]
The basics of launching an arbitrary files in VBA for Windows is defining a Windows API call to ShellExecute and then another to fbShellout:
ShellExecute and fbShellout code
The following discussion has been closed. Please do not modify it.
    'ShellExecute documentation:
    'http://support.microsoft.com/?kbid=238245
    'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp
    Private Declare Function ShellExecute& Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long)
    
    'Error value constants
    Private Const ERROR_SUCCESS = 32&
    Private Const ERROR_NO_ASSOC = 31&
    Private Const ERROR_OUT_OF_MEM = 0&
    Private Const ERROR_FILE_NOT_FOUND = 2&
    Private Const ERROR_PATH_NOT_FOUND = 3&
    Private Const ERROR_BAD_FORMAT = 11&
    
    'ShellExecute display flags
    Public Enum ShowType
    SW_HIDE = 0
    SW_SHOWNORMAL = 1
    SW_SHOWMINIMIZED = 2
    SW_MAXIMIZE = 3
    SW_SHOWNOACTIVATE = 4
    SW_SHOW = 5
    SW_MINIMIZE = 6
    SW_SHOWMINNOACTIVE = 7
    SW_SHOWNA = 8
    SW_RESTORE = 9
    End Enum
    
    'ShellExecute operation flags
    Public Enum ExploreType
    ExecuteExplore = 0
    ExecuteOpen = 1
    ExecutePrint = 2
    ExecuteFind = 3
    End Enum

    Public Function fbShellOut(ByRef lExecute As ExploreType, _
    ByRef szPath As String, _
    ByRef lDisplay As ShowType) As Boolean
    Dim lResp As Long
    Dim lHwnd As Long
    Dim vTask As Variant
    
    
    Dim szAction As String
    'How to execute
    Select Case lExecute
    Case 0
    szAction = "explore"
    Case 1
    szAction = "open"
    Case 2
    szAction = "print"
    Case 3
    szAction = "find"
    End Select
    
    'Find the handle to this excel window
    If Val(Application.Version) >= 10 Then
    lHwnd = Application.hwnd
    Else
    lHwnd = FindWindow("XLMAIN", vbNullString)
    End If
    
    'Try to shell first
    lResp = ShellExecute(lHwnd, _
    szAction & vbNullChar, _
    szPath & vbNullChar, _
    vbNull, vbNull, lDisplay)
    
    
    'We are greater than 32, good to go
    If lResp > ERROR_SUCCESS Then
    
    fbShellOut = True
    
    Else
    
    'Less than 32, figure out which error and return a message
    Select Case lResp
    Case ERROR_NO_ASSOC:
    vTask = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
    & szPath, lDisplay)
    lResp = (vTask <> 0)
    Case ERROR_OUT_OF_MEM:
    MsgBox "Error: Out of Memory/Resources. Couldn't Execute!", 16
    Case ERROR_FILE_NOT_FOUND:
    MsgBox "Error: File not found. Couldn't Execute!", 16
    Case ERROR_PATH_NOT_FOUND:
    MsgBox "Error: Path not found. Couldn't Execute!", 16
    Case ERROR_BAD_FORMAT:
    MsgBox "Error: Bad File Format. Couldn't Execute!", 16
    Case Else
    MsgBox "Error: Unknown. Couldn't Execute!", 16
    End Select
    
    End If
    End Function

    Public Sub ShellWindows(path As String)
        fbShellOut ExecuteOpen, path, SW_SHOWNORMAL
    End Sub
I know, totally fun. To launch a "select a file" dialog box, all you need to do is call filename = Application.GetOpenFilename(), which will populate the filename variable with whatever file is chosen, if one is chosen.
Trickier is making Excel do all this on command — e.g., turning a cell into a button. You do this by putting a function into the ThisWorkbook code:
Double click catching code
The following discussion has been closed. Please do not modify it.
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)
Cancel = YourFunctionThatHandlesClicks(Target)
End Sub
This will pass the reference of any cells that are double clicked to your function. Your function then has to figure out whether the cell in question is the one to treat as a button (I did it by having all "button" cells contain a formula, which itself was a function that would tell you if the filename in another cell could be found or not), and then decide what to do with it (in my case, if the filename was valid, it would launch the file in the default program, using the ShellWindows function above; if the filename cell was blank or missing, it would prompt the user to find the file they wanted, and then replace the filename cell with whatever they picked).
Anyway, all totally doable, but kind of a pain in the neck to do from scratch. But I did all this work two years ago for a project, so I had it all ready to go. There is not an easier solution that I could find, spending several days working on this back in 2010. --Mr.98 (talk) 22:59, 22 September 2012 (UTC)[reply]

Google News blanks my search terms out[edit]

1) I go to Google, type in a search term and see the results listed.

2) Now I want to know if there's any news about that topic. I pick the News tab, and Google blanks out my search terms.

3) So, either I have to retype them or hit the back button, cut the phrase, then hit the forward button, and paste it.

Is there a way to have Google maintain my search term when I switch to News ? StuRat (talk) 21:45, 21 September 2012 (UTC)[reply]

The behavior you describe happens when you click the "News" tab button at the top of the page. Alternatively, you should press the "News" button that appears to the left-side of the page: this will keep your search term once you switch pages. Hisham1987 (talk) 23:09, 21 September 2012 (UTC)[reply]
Thanks !
Resolved

Which part of the computer governs/instructs the monitor?[edit]

Resolved
 – ± Lenoxus (" *** ") 23:00, 21 September 2012 (UTC)[reply]

I'm in a class about hardware, learning all about the various parts of a motherboard. I understand that the CPU performs all (most?) of the calculations. What I'm wondering is this: which part "tells" the computer screen what to display? Or is that the wrng question because it's (somehow) no one part? ± Lenoxus (" *** ") 22:57, 21 September 2012 (UTC)[reply]

Ah, just figured it out myself: video card. ± Lenoxus (" *** ") 23:00, 21 September 2012 (UTC)[reply]
Also note that many PCs have a limited ability to display to the monitor without a graphics card/video card, by using the graphics capability of the motherboard. At the very minimum, this should be able to display enough to allow you to figure out that the video card isn't functional. StuRat (talk) 23:03, 21 September 2012 (UTC)[reply]
You don't even any video output to report non-functional video components. That's what the POST beep codes are for. Mitch Ames (talk) 07:06, 22 September 2012 (UTC)[reply]
And the processor chips have "good" integrated graphics handling nowadays. [1] Moberg (talk) 07:28, 22 September 2012 (UTC)[reply]