Wikipedia:Reference desk/Archives/Computing/2011 February 5

= February 5 =

Code Obfuscation in C++
I was recently practicing code obfuscation in C++ and was writing an obfuscated "Hello world" prgram. However, instead of outputting "Hello world." my program outputs "H << ello world." except with << as the single character meaning much less than (ASCII 0xAE). The code is as follows. Please let me know what's going on. Thanks! Ζρς ιβ' ¡hábleme! 00:09, 5 February 2011 (UTC)


 * Isn't it obvious? You never initialized __________[1] to (char) 'e' in any way.  Uninitialized array elements have unspecified values in C++.  Perhaps you meant __________[(vvvq^vqv)>>9]=__; - your left-shift by a value of 5 assigns the value 'e' to an out-of-bounds array element (which is dangerous and unproductive).  Nimur (talk) 00:15, 5 February 2011 (UTC)


 * What Nimur meant to write was, " Vfa'g vg boivbhf? Lbh arire vavgvnyvmrq __________[1] gb (pune) 'r' va nal jnl.  Havavgvnyvmrq neenl ryrzragf unir hafcrpvsvrq inyhrf va P++.  Creuncf lbh zrnag __________[(iiid^idi)>>9]=__; - lbhe yrsg-fuvsg ol n inyhr bs 5 nffvtaf gur inyhr 'r' gb na bhg-bs-obhaqf neenl ryrzrag (juvpu vf qnatrebhf naq hacebqhpgvir). ".  Comet Tuttle (talk) 00:40, 5 February 2011 (UTC)


 * Thanks Nimur. I'm not sure how I missed that bitshift, but I was looking at different aspects of the program. It never occurred to me to check that. Ζρς ιβ' ¡hábleme! 00:46, 5 February 2011 (UTC)
 * You're practicing code obfuscation in C++? This is no way to learn how to obfuscate.  You need to start with some other, simpler language and learn how to really obfuscate before moving to a language with a lot of cheap obfuscation tools.  Paul (Stansifer) 00:58, 5 February 2011 (UTC)
 * It wasn't really that obfuscated. Cosmetic things, like missing line-breaks, were fixed in one click in my IDE; the control flow is actually trivial: declaration of numerous constants with silly names; creation of a stack array, assignment of characters into the array elements, in no particular order; and then a "for-loop" that writes the array out to console.  With a debugger, you can probe the values of the variables and the array at runtime to see what is amiss.  The obfuscated C++ code I have to work with on a daily basis is far more challenging, and most of it accesses proprietary hardware whose values and statuses can't be read out.  Nimur (talk) 01:06, 5 February 2011 (UTC)


 * The article International Obfuscated C Code Contest should give a few pointers at how to improve the code. Unfortunately that contest is now finished but it is well worth looking at some of the code that has been entered over the years. Dmcq (talk) 13:20, 5 February 2011 (UTC)
 * By the way you might also like the 'opposite' contest, the Underhanded C Contest. Dmcq (talk) 13:29, 5 February 2011 (UTC)
 * Your code isn't strictly portable, because it assumes that the underlying character set is ASCII or something similar. In fairness, most of the IOCCC entries also does this. In addition to the techniques used there, C++ adds a couple of features that are (ab)useful for obfuscation, such as recursive instantiation. Regards, #include template>(n+n+n))&7>struct S:S{template S(c&s):S(s){s<<(i["yeltpcd"]);}};template<>struct S<0>{S(std::ostream&){}};S<8>s((std::cout));int main{}</tt>  (talk) 14:53, 5 February 2011 (UTC)

Shrink an ntfsclone image file to restore to a smaller partition
I'm installing Ubuntu alongside Windows 7 on my laptop. Resizing the NTFS partition and adding an ext4 partition wasn't an option in this case, because the hard drive already had 4 partitions and all of them were primary. I made the mistake of not resizing my NTFS partition before I used ntfsclone --save-image to copy it to my slow external hard drive. Now I need to copy the contents of the image back to a smaller NTFS partition. What I'm doing at the moment is using ntfsclone --restore-image to create a mountable version of the image file; I figure that if ntfsresize doesn't work on the mountable image, I can always just mount it and copy the files.

The problem is that because the mountable image has to go on the same external hard drive as the unmountable one, the process is taking way too long. Is there a way to directly resize the image file instead? Neon Merlin  00:28, 5 February 2011 (UTC)

Images and videos are invisible
On my home computer, a old Dell machine running some version of MS Windows, probably about 20% of youtube videos are invisible to me---I just see a black screen where the video should be---although I can see them on other machines. In Wikipedia's article titled trigonometric functions, I can see the image whose caption begins with "The sine, tangent, and secant functions of an angle constructed geometrically in terms of a unit circle." but I can't see the one below it. I can see its caption. On all other machines I can see it. Same for various other images in Wikipedia articles; I haven't kept a list. Now I look at this page on facebook, and see a blank space where, with a machine in a library, I saw things I could click on and hear song excerpts. There's also a blog where I posted a comment more than a year ago, where I can't reload the page (but can on other machines) and see only the page as it existed when I posted there.

What's going on? Michael Hardy (talk) 04:13, 5 February 2011 (UTC)


 * Sounds like maybe you need a new graphics driver or a new graphics device (or just a new computer). ¦ Reisio (talk) 10:51, 5 February 2011 (UTC)
 * By why would things that I formerly could see be invisible? If images or videos require a graphics device that I don't have, then I would think I wouldn't have been able to see them earlier. Michael Hardy (talk) 17:30, 5 February 2011 (UTC)


 * It's possible that the sources that you are trying to reach have not remained static, although you have. Companies providing content try to keep their systems as up to date as possible, even though that may mean abandoning some users along the way.  For example, I have an old version of Internet Explorer still working on my old PC, but many commercial and govt websites don't bother to support its features; some just outright say "update your browser."  You may need to update your drivers to keep up with everyone else.--Romantic Mollusk (talk) 18:22, 5 February 2011 (UTC)


 * Beyond that, I would suggest telling us 'what browser', 'what OS', 'have you updated Flash recently', 'are the other computers where you don't get the problem operate on the same network/off the same router' etc would probably help. Nil Einne (talk) 02:10, 6 February 2011 (UTC)

The browser is firefox; the OS is some version of MS Windows; I just downloaded a new version of adobe flash. The problem persists. I've also had the same problem with internet explorer and google chrome. Would "flash" have an effect on the illustrations in Wikipedia's trigonometric functions article? Why would this problem afflict one of two illustrations in that article that I created with the same software and the same time and uploaded at the same time, and have no effect on the other one? Michael Hardy (talk) 03:54, 8 February 2011 (UTC)

Windows Aero does not work even when I select it
The problem is I try select a Aero theme. It will let me, but the effects (transparency, peek, and window shadows etc) will not work. Alt+Tab brings up only 2D and the Orb+Tab 3D preview does not work. Only I can change the background. At the personalization screen, when I try to change the Window colour, It takes me to the Window Colour and Appearance window, not the window to change the transparency. I tried to run the troubleshoot but it couldn't detect anything wrong. Please help! (I'm running Windows 7 Ultimate)General Rommel (talk) 06:24, 5 February 2011 (UTC)
 * There are possible causes I can think of: (1) your computer's graphics card (if it has one) is not powerful enough for Windows Aero; or (2) your graphics card is powerful enough, but you don't have the right drivers installed. What kind of graphics card do you have? To check, go to the Start Menu, right-click on Computer, select Manage, then Device Manager &rarr; Display Adapter. Also, right click on Computer in the Start Menu and select Properties, then, click on the Windows Experience Index. You need at least a 3.0 in the graphics section to use Aero. If you have a good graphics card, then I would recommend visiting your manufacturer's web site and downloading the latest drivers for your graphics card.--Best Dog Ever (talk) 07:36, 5 February 2011 (UTC)
 * In addition to the above recommendations, I also recommend that you run this automated troubleshooting tool: .--Best Dog Ever (talk) 08:59, 5 February 2011 (UTC)
 * My drivers were suddenly out of date, despite when pressing update driver in the device dialog box it coudn't find a suitable update. Now it works with a new catalyst version. Thanks! (now how do you put the resolved dialog box?) General Rommel (talk) 09:45, 5 February 2011 (UTC)
 * You add   to display the Resolved box.CS Miller (talk) 12:41, 5 February 2011 (UTC)
 * Thanks! General Rommel (talk) 00:08, 6 February 2011 (UTC)

Microsoft Windows Storage Server 2008 R2 Editions
Hello. I'm trying to find out what the technical differences between the three editions of Microsoft Windows Storage Server 2008 R2, the three editions being Standard, Enterprise and Workgroup. I've tried asking at the Microsoft TechNet Forums, but I'm usually told that "as Microsoft Windows Storage Server 2008 R2 is an OEM product, please check with your hardware vendor for details and specifications." The hardware vendor isn't of course interested in answering questions to someone who doesn't intend to buy anything from them - I've tried HP, IBM and Dell. Thanks to all RefDesk volunteers. Rocketshiporion ♫ 11:28, 5 February 2011 (UTC)


 * See this article. 118.96.155.180 (talk) 09:29, 6 February 2011 (UTC)


 * Thank you, 118.96.155.180, that was just the information which I was looking for! Rocketshiporion ♫ 15:12, 6 February 2011 (UTC)

Clash of the antivirus programs
I have F-Secure as my main program, but installed and ran Antivir when an F-Secure scan showed I'd been infected. Antivir detected two other nasties (but not the one F-Secure found). I read that antivirus programs can interfere with each other, so my question is, if I deactivate Antivir Guard, is that enough? It's Windows Vista. Clarityfiend (talk) 12:00, 5 February 2011 (UTC)
 * Update: the two problems Antivir detected (and quarantined) were apparently from F-Secure's database, so it appears I've screwed that up. Clarityfiend (talk) 01:18, 6 February 2011 (UTC)

Office 2007
Hello. I lost my Office 2007 CD but have the serial key recorded on my email. Where can I download the software if I need to reinstall it? Thanks in advance. --Mayfare (talk) 15:56, 5 February 2011 (UTC)
 * It seems that Microsoft does not supply a copy. I'd advise on you to email Microsoft Support about it, and they may help you get 2007 running and activated. If you want to try a different tack,you can try downloading a trial version and entering your product code ( If you don't have a product code you will need to request one through Microsoft for a product key with your serial number) General Rommel (talk) 00:18, 6 February 2011 (UTC)

Lightweight browser for Windows
Can anyone recommend a graphical freeware (i.e. doesn't have to be opensource) lightweight browser for Windows 7? Other then being graphical (i.e. no Lynx) I don't really need much. Something like Dillo will work fine. In particular Flash etc support isn't needed. I'm already using Chrome for other stuff but I'm looking for something else. K-meleon seems to a common recommendation and perhaps it's a decent browser but I found it incredibly frustrating so gave up on it. In case you're wondering, unless I'm missing something there's no way to disable third party plugins without either using another plugin (which I couldn't seem to get to work) or some complicated setup work even though it seems the browser must be aware they're there to use them (after all they're shown in about:plugins). I'm just as mystified why they recommend Flashblock (which I'm sure is great if you want Flash on some sites but seems pointless when you don't want Flash at all and the browser could simply not call it). Cheers Nil Einne (talk) 17:48, 5 February 2011 (UTC)


 * Are you talking about Firefox in the last part? I went to Tools -> addons and under the plugins tab disabled "shockwave flash" and then tested on youtube and the videos don't play. 82.43.92.41 (talk) 00:28, 6 February 2011 (UTC)


 * No I'm referring to K-meleon, you're right it's easy to disable plugins in Firefox as well as Chrome and even IE which is why I'm even more mystefied by the absence of any such feature in K-meleon. I've actually decided to use K-meleon with Flashblock (which is built in) which works okay and doesn't have the problem Chrome was giving me although I'm still mystified why it's so hard to disable 3rd party plugins in K-meleon and would still be intersted in any suggestions. Nil Einne (talk) 02:06, 6 February 2011 (UTC)


 * How about Internet Explorer shells? They are quite lightweight, as they don't need to supply their own rendering components. Many of them also support disabling scripting, ActiveX, plugins (like Flash), BHOs (toolbars and extensions), etc. 118.96.155.180 (talk) 09:10, 6 February 2011 (UTC)

computer updates
Is it possible to delete an update that has not yet been installed on my computer? You see, every time I try to turn it off, it comes up saying it is installing updates, but then it just does nothing, spending sometimes hours pretending to load just the first one, before I get bored and switch it off. I worry that something will go wrong if I keep turning it off like that, so how to I get that particular update gone?

148.197.121.205 (talk) 21:03, 5 February 2011 (UTC)

Noone? I guess it is impossible, then. Might have to take it to the mechanics instead. 148.197.121.205 (talk) 18:24, 6 February 2011 (UTC)


 * I'm not an expert, but I think it is sometimes possible. You need to tell the experts here what operating system or software is running the hanging update.  Most software will allow you to view update history, and Windows will sometimes allow you to undo updates (e.g. in Vista: Start -> Windows update -> View update history or "Installed updates" under "See also").    D b f i r s   23:26, 6 February 2011 (UTC)