Wikipedia:Reference desk/Archives/Computing/2010 November 21

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Computing desk
< November 20 << Oct | November | Dec >> November 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.


November 21[edit]

Full Disk Encryption: RAID Controller & Self-Encrypting HDDs[edit]

Hello Everyone,

   This is not a homework question.

   The objective is to create an RAID array with hardware-based encryption. Will either or both of the following configurations work?

  1. Encryption-capable RAID Controller, with Self-Encrypting HDDs.
  2. Encryption-capable RAID Controller, with regular (i.e. non-self-encrypting) HDDs.

   Thanks in advance to all RefDesk volunteers. Rocketshiporion 03:35, 21 November 2010 (UTC)

Both will work. Each has potential security holes but will be much more secure than using no encryption. In particular, hardware disk encryption usually uses ECB mode. See that article for related issues. 69.111.192.233 (talk) 07:25, 21 November 2010 (UTC)

Core i5 vs i7[edit]

I have an option of a laptop with an Intel Core i5 460M processor and one with an Intel Intel Core i7-720QM Processor.

  • Core i5 460M- 2.53 GHZ Turbo Boost up to 2.8GHZ
  • Core i7-720QM- 1.6 GHz Turbo Boost up to 2.8GHz

The normal speed of the i7 (without Turbo Boost enabled), i.e. 1.60GHz, is far less than that of the i5, so why is the i7 more expensive and supposedly more faster? Thanks. --119.155.8.225 (talk) 05:12, 21 November 2010 (UTC)

The i5-4xxM has two processing cores while the i7-xxxQM has four processing cores. Dragons flight (talk) 05:22, 21 November 2010 (UTC)

So the i7 has a max speed of 11.2 GHz while the i5 has a max speed of 5.6 GHz (half that of the i7)? --119.155.8.225 (talk) 05:59, 21 November 2010 (UTC)

That's like saying a fleet of four 60mph cars can go 240 mph while two 60 mph cars can only go 120 mph. It's more accurate to say the 4 cars can take 2x as many people as 2 cars in the same amount of time. They are still all going 60 mph. 69.111.192.233 (talk) 07:30, 21 November 2010 (UTC)
The smaller clock rate is the maximum sustained clock rate with all cores active. The "Turbo Boost" rate is the actual maximum clock rate. Because the i7 has twice as many cores, "all cores active" means roughly double the heat production at a given clock rate versus the i5. Power increases as roughly the square of the clock frequency, so the i7 with four active cores runs roughly a factor of √2 slower than the i5 with two active cores. It's not actually slower in any meaningful way. With two active cores it will run at at least 2.53 GHz, and probably at 2.8 GHz since the active cores can be cycled around to spread the heat better. -- BenRG (talk) 09:34, 21 November 2010 (UTC)

cell phone as workstation[edit]

Current fancy cell phones are comparable in power and capacity to desktop computers of maybe 5 years ago (1 ghz processor, 1gb ram, 32gb flash "disk"), and some run various Linux-based OS's. Some of them have HDMI output also. Does it sound practical to set one up as a general purpose Unix workstation, using a bluetooth keyboard and mouse, and an HDMI monitor? Thanks. 69.111.192.233 (talk) 06:19, 21 November 2010 (UTC)

What exactly would you use it for? Also, I'm not aware of any cell phones with 1 GB of memory. I know of some that have 512 MB of RAM. It's confusing because manufacturers in the cell-phone industry call secondary storage "memory." You'd be able to use a cell phone like that for checking your e-mail, word processing, and browsing the web. But it wouldn't be ideal for 3D, gaming, or editing video.--Best Dog Ever (talk) 06:48, 21 November 2010 (UTC)
Hmm, looks like MyTouch 4g has 768mb but 1gb certainly has to be coming soon. Yeah I'd want to run browsers, text editors, compilers etc. Not games or video editing probably. If I can run the stuff that ran tolerably on 2005-era laptops then I'm more than satisfied. Although, some of those phones can do realtime video encoding with accelerators on the cpu. My main question is whether a phone HDMI output can run a 1920x1080 computer monitor the way a fullsize computer can. Thanks. 69.111.192.233 (talk) 07:36, 21 November 2010 (UTC)
Droid phones only output photos or video to external monitors. They can't output their home screen. They act like remote controls for TVs. As for a bluetooth keyboard, yes, you can use one of those. The Freedom Pro is a popular choice. This seems academic, though. The average desktop sold in 2005 had a 2 – 3 GHz Pentium IV with around 256 MB of RAM. But, yes, most of those applications would work fine except perhaps compilation. I doubt a 1 GHz CPU would be ideal for compiling a Gentoo installation. A top-of-the-line smartphone costs about $200 with a two-year contract. The contract is for both a voice plan and a data plan. The voice plan is about $40 a month on Verizon. The data plan adds at least $15 to the $40. So, it makes me wonder why you'd want a smartphone for something you could do on a used desktop that costs perhaps $100 off of Craig's List.--Best Dog Ever (talk) 08:15, 21 November 2010 (UTC)
The smart phone is much easier to travel with. Just get hold of a monitor and keyboard at the other end. It occurs to me that the phone screen itself could be used as a touchpad. But, not being able to show the phone screen on the external monitor would seem to kill the idea. Is that just some Android software weirdness? Maybe there is a workaround. I'm actually more interested in Meego than Android anyway. 69.111.192.233 (talk) 10:52, 21 November 2010 (UTC)
One of the big problems with these "smart" phones is that they are unable to use standard wireless network access. All network traffic runs through the telephone company. So, that will greatly limit your ability to use it as a workstation. My experience with phone-based Internet is that it is somewhere between dial-up and 802.11B. If the phone did have capability to use modern wireless, it would be usable. -- kainaw 14:08, 22 November 2010 (UTC)
Sorry? Many or even most expensive smart phones (and increasingly even the cheaper ones) have wifi (usually 802.11B only I believe). That includes the myTouch 4G which the OP has. I mean even the original iPhone known for excluding features most other phones already had, and all the iPhones since which have sometimes improved but still often been behind, had wifi. And Blackberrys seem to mostly have wifi too [1] [2] [3]. Frankly if I was spending the amount of money that many of these phones cost (unsubsidised) I don't see why you wouldn't demand wifi. Of course what the phone can actually do with the wi-fi may sometimes be limited although I believe most genuine smart phones allow apps to use the wifi and in any case if you want to do what the OP is planning I presume your planning to root your smartphone anyway. Having said, I'm not sure if things are as easy as the OP thinks. Bluetooth wireless keyboards do exist (including some very expensive ones for media PCs) and are used by some game consoles, but even many wireless ones are not Bluetooth even if they use the 2.4ghz band so just finding one where you go may not be easy if you aren't willing to buy one. Nil Einne (talk) 14:27, 22 November 2010 (UTC)
Well, one place I go regularly is my mom's house, so I could just buy a bluetooth keyboard and leave it there. Yes I would root the phone. Yes all Linux phones that I know of have wifi and it wouldn't have occurred to me to use a phone without wifi. So I'm wondering mostly about the screen issue. Thanks for all answers so far. 69.111.192.233 (talk) 09:54, 23 November 2010 (UTC)

Copy alternate rows in Excel[edit]

I have a spreadsheet which contains data imported from a web page. I have create some charts using this data. But half of the rows alternate ones) contain junk data which I do not want to be displayed in my chart. I can of course filter out alternate data. But the data is not fixed; it changes when I refresh the connections. I need some formula to copy only the alternate rows to another sheet so that I can use this sheet for my chart. Is ther any way to do this? That is, from a sheet like the following

Day 1 Cost
Junk Junk
Day 2 Cost
Junk Junk

I need to get

Day 1 Cost
Day 2 Cost

I can use =Sheet1!A1, =Sheet1!A3,etc. but it doest get automatically filled up (with odd rows only) when I use Fill Handle and drag. 180.149.48.245 (talk) 11:17, 21 November 2010 (UTC)

You could put the values (say) A1, A3, A5 in one columnm, and then use the indirect() function to reference those values. Using the drag to extend these now provides references to only the odd numbers. --Phil Holmes (talk) 12:10, 21 November 2010 (UTC)

One way is to start by linking all the cells in Sheet1, so you have Sheet1!A1, Sheet1!A2, etc, which you can extend by copying. Then delete the junk rows, and you'll be left with Sheet1!A1, Sheet1!A3, Sheet1!A5, etc. AndrewWTaylor (talk) 09:21, 22 November 2010 (UTC)

If it's always alternate rows

  • Copy your data to a new sheet using copy/paste values.
  • On this new sheet insert a new column to the left of the data.
  • In the new column type 'Good' next to the first row of good data and 'Bad' in the cell below then drag fill those two cells to the bottom row of the data. You should end up with something like
Good Day 1 Cost
Bad Junk Junk
Good Day 2 Cost
Bad Junk Junk
Good Day 2 Cost
Bad Junk Junk

Then sort the data on column 1 and discard the bad half. Blakkand ekka 14:17, 25 November 2010 (UTC)

.png vs. .jpg[edit]

.png images seem to take longer to load on Wikipedia pages than .jpg - why is this? (And, as a corollary, why are .jpg images being replace with .png ones here?) Thanks. DuncanHill (talk) 13:56, 21 November 2010 (UTC)

JPG files are supposed to store photographic images, and nothing else. JPG utilizes a lossy compression that is barely visible on photographs, but would look terrible if used on an illustration containing straight lines, text etc. PNG files, however, are used to store illustrations, screenshots, etc. PNG does not utilize any lossy compression. Therefore, if one would save a photograph as a PNG, the resulting file would be bigger than if saved as JPG. --Andreas Rejbrand (talk) 15:27, 21 November 2010 (UTC)
See: lossy compression. Fly by Night (talk) 15:29, 21 November 2010 (UTC)
See also Wikipedia:Image use policy#Format and Wikipedia:Preparing images for upload. —Bkell (talk) 00:28, 22 November 2010 (UTC)

Language specific search in Google from the search box of Opera by adding code[edit]

I would like to be able to do a Google search in a specific language by adding some code next to the searched phrase in the search box in Opera, like this:

"stuff i want to know about" lr=lang_hu (or something)

I created a custom search engine in Opera using the

www.google.com/search?q=%s&lr=lang_hu&

syntax and that works but I'm curious if it is possible to do it as I described at beginning. —Preceding unsigned comment added by Jib-boom (talkcontribs) 19:17, 21 November 2010 (UTC)

a web browser can run different javascript every session, can a program run different code each session (as downloaded)?[edit]

So, if you have a web browser, it can go to different sites and run different code.

Could a program do the same thing, downloading a small amount of bytecode to run directly, which can be different each session, without tripping all sorts of antivirus and Windows warnings? There is nothing nefarious here, I just want to be able to update the exact code for evaluating certain formulas transparent to the user. Obviously I can do that if it is fully interpreted code (i.e. interpreted by my program), but can I also do that if it is directly machine-executable code and I just download the code and run it? It would be from my own server, so trust is not really an issue, and since it is just doing math calculations, the actual behavior would not trip any antivirus heuristics. The only thing I'm curious about is whether like windows vista or antivirus users will get a lot of messages if I'm downloading bytecode and running it to get a value? (The downloaded code will not do anyhting else other than compute with a better function than I have on hand now. I would like to ship the program with what I have, finish working on the better formula, if I can, then let users download it when they chart those kinds of functions.) Thanks a million! 84.153.230.45 (talk) 21:44, 21 November 2010 (UTC)

Javascript is an interpreted language. If you don't plan on using an interpreted language, or writing your own interpreter/parser, you'll need to use dynamic loading with have a dynamic-link library which you'll download as the update. Using dll or parser probably won't get antivirus messages, though it depends on the vendor you're using. However, if you choose the approach of polymorphic code, you will likely trigger every antivirus program=P.Smallman12q (talk) 23:28, 21 November 2010 (UTC)
Yes, "polymorphic code". Rather than being truly polymorphic, is there any way that I could allocate an array, fill it with some code I just downloaded, and run it? Or, would that also count as "polymorphic" (even though my executable, nor the footprint it started running with, is not changing at all!) In other words, can I just execute some of my data, which I happen to be downloading? 92.230.67.51 (talk) 00:20, 22 November 2010 (UTC)
p.s. Again, the newly downloaded data won't do anything but calculate, i.e. return a value to me. Rather than trigger obnoxious virus warnings, I'd rather write an interpreted language, and then interpret the new data, rather than running it. But can't I just run it, somehow? Do I have to go the dll route, which seems needlessly complex to me me, and not even remotely cross-platform. Thanks. 92.230.67.51 (talk) 00:22, 22 November 2010 (UTC)
As you asked about javascript I assume you mean something like this:
<html><body>
  <script type="text/javascript" src="b.txt"></script> //Here "b.txt" is the name of the file which contains the code you might change later
  <script type="text/javascript">
   document.write("When function is called with 10 the return value is:");
   document.write(dynfunc(10)); //"dyncfunc" is the the name of the dynamic function
  </script>
</body></html>

when the file "b.txt" contains:

function dynfunc(x){return (x+1);}

Obviously you won't use "b.txt" but an url to your website where you host the function that might be updated. (in practice it may need some fall back for when the user isn't connected to the internet..) I don't think it will trigger any problems with vista - as for an antivirus - I'm not sure - it obviously contains code, but then so does a standard webpage. I doesn't seem likely to be problematic. Is that what you meant?
For an offline non javascript program it doesn't seem problematic either - basically it seems that you're describing something very similar to an auto update - except every time the program is run it connects to the internet to look for a new version of a function - possibly this could trigger a firewall - ie the program might need to be added to an exception list.

I collapsed bit because I think I misunderstood your question initially.

77.86.15.94 (talk) 01:04, 22 November 2010 (UTC)

Native code downloaded and run in a browser is possible in several browser-dependent ways, all requiring the user's permission (or else it is a security hole). See browser plugin, ActiveX control and related articles. Note that the latest browsers have tremendously optimized javascript interpreters with embedded JIT compilers to run the javascript as fast native code, so you can do some fairly computation intensive things in browser javascript these days. 69.111.192.233 (talk) 01:20, 22 November 2010 (UTC)

Nothing but calculate? You're probably looking for the equivalent of eval in your programming language. The dll route isn't terribly complex, though a java library might work as well (it's cross-platform).Smallman12q (talk) 02:34, 22 November 2010 (UTC)

more info (from OP[edit]

This is C++, and the browser-running-javascript was just a metaphor for getting the code just-in-time. C++ has no "eval" or other obvious way to interpret anything. 92.230.67.51 (talk) 03:23, 22 November 2010 (UTC)

Can you explain the application? As in, "what is it about javascript that fails to do what you want"? The usual way to run code in browsers is javascript. What you want to do that standard browser scripting doesn't give you? 69.111.192.233 (talk) 05:26, 22 November 2010 (UTC)
It certainly can be done, but you may not be able to do it very easily. If you want to compile and run C++ code on the fly, you need to link your program with a C++ compiler that supports that. The most popular C++ implementations (gcc, MSVC) like to run in a separate process, read their source code from disk files and write machine code to exe/dll files (or the platform equivalent). You could try using LLVM and a C++ frontend for it, I suppose. If you have a memory block full of machine code for your platform and you want to run it (generally a bad idea), it might be as simple as ((void (*)()) memory_block_addr)();. But that may fail on systems that (for security reasons) mark data blocks as non-executable by default. In that case you need to ask the OS to reclassify the memory. On Windows the function for that is VirtualProtect. Technically, the cast I wrote above is not legal C++, but it works on popular compilers. -- BenRG (talk) 11:07, 22 November 2010 (UTC)
Alternatively, you may write the function in applescript/vbscript/powershell and call the script function from your program. For updates, you would simply download a newer script. This won't be the most secure method (in that people may be able to view the source unless you obfuscate it...but it will work). See here, here, and http://www.dreamincode.net/forums/topic/177177-vbscript-call-function-from-c-dll-library-from-vbscript/ here] for example.Smallman12q (talk) 13:55, 22 November 2010 (UTC)
If you just want to evaluate infix expressions like 1+2*3, it's pretty easy to write an expression parser in flex and bison. It's a standard example in tutorials, and it might even be in the official documentation (I haven't looked in a while). -- BenRG (talk) 22:15, 22 November 2010 (UTC)

It sounds to me like you want to write a program that calls some function. But rather than writing that function ahead of time and compile it into the program in the normal way, you want to distribute the program now, and then later have the program download and run the latest version of that function. Also, you want to write your program in C++, and you want it to be cross-platform. Also, you want to download the function in the machine code form, and directly execute it out of RAM (rather than download the function in the form of some human-readable source code in some interpreted language, or in the form of a DLL file you can store on disk).

Such a program technically has self-modifying code -- see that article and just-in-time compilation for more information on these techniques and situations where they don't work and links to source code examples. In particular, follow the Mozilla Nanojit link, and look at the four lines of source code marked "// Call the compiled function." -- is that what you are looking for?

This is effectively the same as the cryptic code BenRG mentioned -- I hope it is easier to understand in the context of a complete program.

I hope you know that you are making things unnecessarily difficult for yourself by insisting on C++ and executable machine code. It is much easier and more cross-platform to write a program in some language that supports eval(), and have that program download new functions in the form of source code in that same language. But that wouldn't be nearly as educational now, would it? --68.0.124.33 (talk) 05:25, 25 November 2010 (UTC)