Wikipedia:Reference desk/Archives/Computing/2011 May 7

Computing desk
< May 6 << Apr | May | Jun >> May 8 >
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.


May 7

edit

Apple Cocoa NSImage Question

edit

To anybody who is a cocoa developer: I am creating a cocoa application which saves data (an NSMutableDictionaty) to the disk using NSKeyedArchiver, and then loads it back with the NSKeyedUnarchiver. It saves all of my string data and stuff fine, but I also have an Image that I want it to save to disk. It doesn't seem to be saving it because when I load the data, it uses the default image instead of the one I specified to have saved. Any ideas? Please ask me if you need more clarification than that. Thanks in advance --Thekmc (Leave me a message) 01:19, 7 May 2011 (UTC)[reply]

I'm not a Cocoa developer, but searching around finds this Stack Overflow discussion about serialising an NSImage to a sql database. To do that they first make an TIFFRepresentation (and looking at the docs, probably any other NSBitmapImageRep would do too), which gives them concrete access to the image data. Presumably on reconstruction you'll have to build a new NSImage from the image-rep you've retrieved from the dictionary. -- Finlay McWalterTalk 10:07, 7 May 2011 (UTC)[reply]

Thanks for the fast response. I tried TIFFRepresentation, and I think It got saved properly (though I don't know for sure). The problem is that I don't know how to get the NSImage out of the file I'm loading. Do you have any idea of a method I could use to convert the TIFFRepresentation back to a loadable NSImage? I know you're not a cocoa developer, but if you (or anyone else) has any ideas, I would appreciate the help. Thanks again, Thekmc (Leave me a message) 15:30, 7 May 2011 (UTC)[reply]

If I understand things correctly (I can barely read Objective C too...) a TiffRepresentation is just an alias for an (NSData *) (ref), and NSImage has an initaliser initWithData which takes an (NSData *) argument.(ref). So if you have serialised that data correctly, hopefully that should rebuild the image okay. If you can get this to work, please post a super-minimal example of the actual code, as I'm interested to see what it looks like. -- Finlay McWalterTalk 15:46, 7 May 2011 (UTC)[reply]
Minor terminology correction: in the reference you linked, Finlay, TiffRepresentation is not an alias at all; it is the "message interface"; it is analogous to the name of a "function" or "method" in C++ or Java. This message returns a result of type NSData*. Properly, in Objective C, the correct terminology to describe this is that the NSBitmapImageRep class handles a message, called TiffRepresentation; it will respond to this message by returning an NSData* that is a TIFF representation of the receiver. We need not overly complicate this with implementation details about the difference between messages and functions. Some elaboration on this in our article's "implementation" section. In my opinion, this is obtuse terminology; it gets even more obtuse in Objective-C++ where there are both methods and messages. Nimur (talk) 16:23, 7 May 2011 (UTC)[reply]

It still isn't working for me. I'll post all the pertinent code, and any help would be appreciated.

  -(void)applicationWillTerminate:(NSNotification *)notification{ //Save The Data
 	 NSData* myEncodedImage = [[villain objectForKey:kMugshot] TIFFRepresentation]; //getting the TIFF representation
 	  [villain setObject:myEncodedImage forKey:kMugshot]; //changing image in dictionary to the recently retrieved TIFFRepresentation
 	  NSData* savedData = [NSKeyedArchiver archivedDataWithRootObject:villain]; //Changing dictionary to NSData
 	  [savedData writeToFile:[@"~/savedVillain.vil" stringByExpandingTildeInPath] atomically:YES]; //Saving the NSData
   }

Here is the applicationWillFinishLaunching:

 self.villain = [NSKeyedUnarchiver unarchiveObjectWithFile:[@"~/savedVillain.vil" stringByExpandingTildeInPath]]; //Loading the dictionary back into the application
 		NSImage *imageTemp = [[NSImage alloc] initWithData:[self.villain objectForKey:kMugshot]]; //Getting the TiffRepresentation out of the dictionary and changing it to NSImage
 		[self.villain setObject:imageTemp forKey:kMugshot]; //Changing the dictionary's image to the imageTemp NSImage

--Thekmc (Leave me a message) 19:41, 7 May 2011 (UTC)[reply]

Well, are you actually seeing the saved file, "savedVillain.vil"? Can you confirm its contents, or at least test whether the file changes when you save a different image? Nimur (talk) 19:00, 7 May 2011 (UTC)[reply]

Yes, the files are changing. Was there anything noticeably wrong with the code? If you can't see anything, It's okay, because this is only a practice project anyway, and it doesn't really matter if it works. I would like it If I could figure it out, but I you see nothing wrong, then i'll be fine. --Thekmc (Leave me a message) 19:41, 7 May 2011 (UTC)[reply]

Windows Live Messenger Error?

edit

For a few days now, WLM has been telling me I have 1 unread message in my inbox. I use my browser to check my Hotmail, and cannot find this message anywhere. It has happened before (some months back), but I can't remember what I did to solve it. Does anyone know anything about this? KägeTorä - (影虎) (TALK) 06:50, 7 May 2011 (UTC)[reply]

It may be because of some automatic folder sorting system, but that's only a guess. Zakhalesh (talk) 07:10, 7 May 2011 (UTC)[reply]

how to manage add/remove programe on control pannel

edit

In contol pannel-add/temove progrmas,their may be many programes, some of which have same functions ,some are necessay for others to work ,some are not necessary.how can we manage them.For example ,on my computer programs installed are adobe air,acrobat.com,adobe flash player 10 active X,adobe reader 9,adobe shockwave player 11.5 ,Microsoft.Net Framework 2.0 sp2,Microsoft Framework 3.0 , Microsoft.net Framework 3.5 .i want to have necessary programes (in genaeral).how can i manage them,is their any book on managing it —Preceding unsigned comment added by True path finder (talkcontribs) 07:51, 7 May 2011 (UTC)[reply]

You'll probably want all those except adobe air and acrobat.com. ¦ Reisio (talk) 10:30, 7 May 2011 (UTC)[reply]
Whether you want adobe air really depends on your situation - if you run adobe air based programs (the example that I run is BBC iplayer desktop software) you need adobe air. Someone with more knowledge than me may be able to tell you how to find out if you have any adobe air programs installed. Acrobat.com appears to be web conferencing software, so if you do web conferencing you really want that as well. The best way to manage your installed programs is to first install and use good anti-spyware software (e.g. Windows Defender which comes bundled with vista and windows 7, or can be downloaded separately). This should ensure you don't have any programs you really don't want on your computer (you should of course be running anti-virus as well). Secondly the only thing you can do is decide whether you personally use the program - almost all programs except spyware are some use to some user somewhere. Googling the program name can help if you are not sure what it does. If you're not sure whether you use it just leave it - the consequences are frankly minimal and certainly it's better to do that than to remove programs that you later find out you need (even if you are short of hard drive space media usually takes up much more space than installed programs - with the exception of games). Equisetum (talk | email | contributions) 18:39, 7 May 2011 (UTC)[reply]

DVD movie file size

edit

I've been going through the files on my DVD movie collection and have found that the movie file itself is nearly always 1023.X MB. The range is about .3 MB between the biggest and smallest. But no matter whether the movie is a 90 minute comedy or a 2.5 hour drama, they're 1023.X MB. This has held true with one exception... A short 16 minute film that a local director made of which I have a copy since I was part of the crew. Just to clarify what you may be thinking... The film was not shot with a little point and shoot home movie camera. It was a serious film that went on to pretty good success at film festivals and such. The file size for it was 716 MB.

So, my questions are these:

  1. Why have all the films from 90 minutes to 2.5 hours been nearly identical as far as file size?
  2. Why does a 16 minute film, less than 1/4 the length of some of the other films, have a file size that's at least 2/3 the file size of those longer films?

Thanks, Dismas|(talk) 17:25, 7 May 2011 (UTC)[reply]

Basically the DVD authors usually try to set the bit rate of the film to whatever the maximum can be. If it is a short film, you can set it really high, to fill the whole disk. If it is a long film, you can't do that. Most DVD authoring programs these days have the ability to try and dynamically match the compression to the size of the disk. Using less compression increases the final quality. (And it is noticeable under many circumstances.) Basically in figuring out what bit rate to encode your DVD video into, you start with the size of the disk, the length of the movie, and work backwards, to get the most optimal use. There is no advantage in leaving blank space on the disk. On the other hand, for your second question, there is a maximum amount of bit rate that standard commercial DVD players can handle. It's something like 10mbs, if I recall. So you can't increase bit rate arbitrarily. (Note that the numbers can be misleading because the encoding of the audio can affect the overall bandwidth as well.) This page (which I used myself fairly recently) discusses how to calculate the necessary bit rate for DVDs, the maximum bit rates of DVD players, etc. --Mr.98 (talk) 18:36, 7 May 2011 (UTC)[reply]
I would agree with Mr.98 except that a DVD holds about 4.7GB, not 1GB. I suspect that Dismas has used a particular piece of software to rip all his DVDs, and there is a setting somewhere in one of the menus of that piece of software that says "Rip my DVDs to consume 1023MB of space." The software then uses the same principles Mr.98 outlined in order to try to consume exactly that amount of space. Comet Tuttle (talk) 18:40, 7 May 2011 (UTC)[reply]
Yes, that's probably right. --Mr.98 (talk) 18:42, 7 May 2011 (UTC)[reply]
No. That is wrong. I am not looking at the file size that any program on my system generates. I'm looking at the actual file size on the disc. Dismas|(talk) 19:11, 7 May 2011 (UTC)[reply]
I'm a bit confused here. The typical DVD contains multiple VOB files (and a few other file types, for menu logic and such). Each VOB file is limited to 1024 MB, I believe. So, for any movie bigger than that (which is anything longer than around 20 mins), all the VOBS are that length, with the exception of the last one, and usually a few that have various extras, menus, and such. A DVD, in my experience, can be up to almost 8 GB per side. StuRat (talk) 19:04, 7 May 2011 (UTC)[reply]
The files VTS_##_1.VOB through VTS_##_9.VOB are one logical video stream split into parts of under 1GB (because of a limitation of UDF). Most DVD mastering software writes data to file 1 until it's slightly less than 1GB, then closes it and opens file 2, and so on. Most DVD players aren't even aware of this splitting. The VOB files 1 through 9 are stored contiguously on the disc, and the IFO files contain raw sector offsets to each other and to the VOB files, so once the DVD player has found VIDEO_TS.IFO it stops paying attention to the file system. -- BenRG (talk) 20:30, 7 May 2011 (UTC)[reply]
Isn't the 1GB limit more likely to be because of the required additional ISO9660 file system, which has a potential 2GB file size limit and not UDF which even in it's 1.02 or MicroUDF variant has a limit well above 1GB AFAIK Nil Einne (talk) 08:49, 9 May 2011 (UTC)[reply]

Great! Thanks for the explanations, all! Dismas|(talk) 23:55, 7 May 2011 (UTC)[reply]

Nvidia drivers

edit

Some days ago, for no apparent reason (perhaps a windows update) my monitor began flashing and freezed, and when I rebooted the computer it loaded windows and arrived to a black screen. I noticed that if I loaded windows in safe mode and disable the screen drivers, windows could load well, with the basic screen driver that comes with the system. That's well for the moment, but it still needs fixing: I have an 800x600 screen full of giant items and having to scroll around all the time, and many "yellow" tones around (higher resolutions have even worse glitches); not to mention that games are now useless.

I tried reinstalling the drivers from the CD, but that simply restores the black screen. The Nvidia web site is useless to download modern drivers, the autodetection does not detect the video card and the manual search does not provide me working drivers (for example, it makes me download a driver for windows XP 64 bits, which does not work because my XP is not 64 bits, even though I specifically selected "Windows XP" and not "Windows XP 64 bits").

Do you have other ideas? Cambalachero (talk) 19:27, 7 May 2011 (UTC)[reply]

Have you tried downloading from NVIDIA's driver download site? (EDIT: I should read messages more than once when it's late) I'm more than familiar with the automatic driver updates in Windows, so I recommend downloading directly from the vendor. Zakhalesh (talk) 19:37, 7 May 2011 (UTC)[reply]
Longshot - check the card is correctly seated in the slot, any fans or heatsinks are properly attached, secondary power cables are connected etc - or move it into another slot and see if that resolves the issue. Exxolon (talk) 00:18, 8 May 2011 (UTC)[reply]
Have you tried a System Restore to a time when the monitor was working?--Phil Holmes (talk) 14:53, 8 May 2011 (UTC)[reply]
it is also possible that your video card gave up the ghost (which happened with mine, albeit on an iMac). If going back to a different system restore point doesn't fix things, it is likely that the reason behind the video funkiness is hardware-related. Titoxd(?!? - cool stuff) 23:19, 9 May 2011 (UTC)[reply]

Intel i7 and quad precision

edit

Does the Intel Core i7 FPU have Quadruple precision floating-point format? Bubba73 You talkin' to me? 23:28, 7 May 2011 (UTC)[reply]

I'm pretty sure the answer is no, i.e. true floating point logic in silicon is limited to 64-bit double precision. Many compilers will simulate quadruple precision for you in software though, which is generally just as good unless you need extremely high performance. Dragons flight (talk) 00:53, 8 May 2011 (UTC)[reply]
Oh, well. Eighty-bit Extended precision has existed in hardware for 30 years. Bubba73 You talkin' to me? 02:16, 8 May 2011 (UTC)[reply]
For the record, SSE / SIMD / AVX do implement support for some wide instruction types, up to 256-bit in a few cases, and some of these can be exploited to accelerate higher precision math. However, I'm pretty sure they don't provide a complete floating point operation set. Dragons flight (talk) 20:56, 8 May 2011 (UTC)[reply]
I believe the IBM z10 implements quadruple binary and decimal floating point in hardware. So if you want to buy a mainframe you can get it. Now if decimal floating point was in PCs perhaps some of the funnies in Excel where they try and make it look like it works in decimal could be removed. Dmcq (talk) 22:32, 9 May 2011 (UTC)[reply]