Wikipedia:Reference desk/Archives/Computing/2010 June 25

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Computing desk
< June 24 << May | June | Jul >> June 26 >
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.


June 25[edit]

Converting Word to PDF[edit]

Hello. When I convert a Word 2007 document containing formulas created by Equations Editor to a PDF, the formulas become invisible in the PDF except for fraction bars and the top line of radicals. How should I fix this? Thanks in advance. --Mayfare (talk) 00:42, 25 June 2010 (UTC)

How are you converting it to a PDF? Are you using Word's own PDF support or something else? The obvious thing to try is another method of making the PDF, like with CutePDF. --Mr.98 (talk) 00:56, 25 June 2010 (UTC)
If you are doing this just once, a quick and dirty method might be to just take screen shots of the formulas and put them in the document instead. This obviously won't be practical if there's hundreds or if you need people to be able to copy and past out of the PDF.. Vespine (talk) 05:43, 25 June 2010 (UTC)
If you'd want to make the original doc file available to us, someone more knowledgeable might find a different method more quickly. As for myself, I use the built-in Export to PDF feature of OpenOffice.Org. --Ouro (blah blah) 11:14, 25 June 2010 (UTC)
Why are you using the very old Equation Editor in Word 2007? Word 2007 has built-in support for creating formulae, and these can be converted to PDF (using the Word's built-in converter) with no problem - it works great (example). I would not recommend trying any third-party PDF creator tool (such as CutePDF, Nova PDF, or PDFCreator), for in my experience (and I create PDFs from Word several times a week and has been doing this for years, and have tried a few third-party solutions) they are all much worse than the Microsoft solution. --Andreas Rejbrand (talk) 12:14, 25 June 2010 (UTC)
Hmm, that isn't terrible. Not as good as LaTeX, of course. But Word seems to be getting better than it used to be. What is the UI like? --Trovatore (talk) 18:44, 25 June 2010 (UTC)

I use Word's own PDF support and its built-in support for creating formulas. Yet to consider a third-party solution. --Mayfare (talk) 18:26, 25 June 2010 (UTC)

Searching for Bootable PCIe 1.0 x4 SLC NAND Flash SSD[edit]


Hi.


   I am looking for a Flash-based Solid State Drive which meets the following requirements. Does anyone here know of any such product?

  1. It must be bootable, i.e. the workstation computer in which it is installed must be able to boot from an operating-system installed on it.
  2. It must be built with Single Level Cell NAND flash memory.
  3. It must connect directly to the motherboard via a x4 PCIe 1.0 Slot.
  4. It must have a minimum capacity of two hundred binary gigabytes, i.e. 214,748,364,800 bytes.
  5. Its length must not exceed 254 millimeters (ten inches).


   Thanks in advance. Vickreman.chettiar (talk) 05:00, 25 June 2010 (UTC)

The RamSan-10 and the RamSan-20, both from Texas Memory Systems, fulfil most (items 2 to 5) of your requirements. The RamSan-10 and RamSan-20 have usable capacities of 225GB and 450GB respectively. However, neither of them are bootable. Hope this helps. Rocketshiporion (talk) 05:25, 25 June 2010 (UTC)
   Thank you, but I am looking for a x4 PCI 1.0 SLC NAND Flash SSD for the express purpose of using it as a boot drive. Vickreman.chettiar (talk) 05:45, 25 June 2010 (UTC)

writing a program, USB and interface[edit]

I'm only a beginner programmer, I know a bit of C and python. I've been working on this project www.vespine.com for about a year and I've got the hardware pretty much worked out now, so now I need to work on the software. I have ideas of my own how to go about this but I don't doubt there are probably better ways of doing it.

The firmware is in C on a microcontroller where the cube is represented by a data array which holds separate R, G and B values for each LED. I can get some visualizations going in the cube but ultimately would like to be able to feed more complex animations and stuff through USB, ideally with some sort of user interface, maybe even graphical representation. For windows by the way.

Should I look into java or visual studio or something else or stick with C? C++? I haven't got the faintest idea how to build an interface with c, is there a simpler way? Is there such a thing as USB app building software or something? Any other suggestions? I know these are all noob questions and I'll have to start at the bottom, I made my 1st LED blink on a microcontroller only a year ago, happy to start at "hello world". Has anyone interfaced USB hardware before? Any tips where to start? I've been googling ideas but there's obvously LOTs of stuff online, thought I'd ask here for people's opinions. Vespine (talk) 05:24, 25 June 2010 (UTC)

That's a pretty cool looking thing, and a fun project. Just so I understand what it is you're asking, can I recap - you've already built this nifty LED array, and hooked it up to a microcontroller. Using software you've written in C and transferred to the microcontroller, you can get the LEDs to flash in some attractive patterns. What you'd like to do now is to have a Windows PC program that communicates with the microcontroller over a USB interface, that tells the microcontroller (in real-ish time) what lights to flash. At some point you want that PC program to have a GUI, so you can design, save, load, and otherwise manipulate light patterns. And I'd guess that you'd like to be able to distribute that program to other people, so they can build (or buy from you) a lightcube and program it themselves. I'll answer shortly (this all seems fairly straightforward) - if I'm misunderstanding what it is you want to do, my answers will reflect that (and probably won't be useful, so stop me if I'm off chasing snarks). -- Finlay McWalterTalk 15:18, 25 June 2010 (UTC)
Well, firstly you'll have to do the microcontroller end. You've not said what microcontroller it is (I'm guessing it's an Arduino or similar) or what libraries come with it (if you can link to public docs legally, that would be very helpful). I guess you've been programming this thing over the USB interface, but now you want to talk directly from your prospective Windows app to your microcontroller app, in real(ish) time. I'd very much hope that the microcontroller comes with a library that gives you proper control over the USB interface, and lets you drive that yourself. In this case I'd imagine you'd want to set that up as a custom USB device class (because you're not pretending to be a mouse or a disk drive or anything else) which seems to be device class 0xFF (and you'd set up the vendor info and device info so that Windows doesn't mistake your device for anything else, and so that your Windows program can accurately identify the lightcube). Then you need to design the control protocol you'll talk between the two. I'd guess there's not much the PC will read (make sure you have firmware revision numbers and a hardware identifier too, so that you can later work with different versions of your hardware and software). Mostly you'll be sending commands saying "set these LEDs to these values" - you might be able to do that just with a control transfer message; if you need to send a lot of stuff (e.g. a complex programme of LED changes over time) then you might need to use the bulk transfer mode as well (or instead). I'd see if you can do it all with control transfer for now. How you implement this on the microcontroller depends on its USB library. -- Finlay McWalterTalk 15:27, 25 June 2010 (UTC)
Ah, I see your website says it's a PIC32. This note discusses a USB stack for the PIC32 (which I think you can get here). -- Finlay McWalterTalk 20:23, 25 June 2010 (UTC)
Next you need a Windows app. Firstly you should have a simple non-gui app, that lets you talk over the USB using your custom lightcube protocol. As long as a library is available, it really doesn't matter what programming language you use. You know C and Python, so lets say you do it in Python (but really C is just as good, and if your skills are stronger there use that instead). I'd think using libusb to handle the low-level communications is a good idea; it works on Windows, and if you later want to support Mac or Linux, it should make porting easy. If you're coding in Python, there's PyUSB, which is just a thin Python skin over the C libusb - the operations you'll do will be the same regardless of which language. Firstly your test app will have to setup the USB interface and find any lightcubes you've plugged in. Then you'd use the control interface to send "change the LED" messages, using the protocol you designed above. Later you might find the need to add fancier stuff to the protocol, and make both ends smarter, but in the first case this should get you going. -- Finlay McWalterTalk 15:35, 25 June 2010 (UTC)
Hmm, to clarify when I say "Firstly you should have a simple non-gui app", I mean that you should write a simple text-based test one first, not that you should never add GUI functions to that later. -- Finlay McWalterTalk 17:57, 25 June 2010 (UTC)
Wow thanks heaps for that fantastic reply! We must have a time zone difference, sorry for not replying earlier. I'll definitely be saving this as a road map. I thought at best I'd get a few cynical one liners:) . So most of your assumptions were dead on. At the moment, I can generate some basic patterns in the cube firmware, just using linear loops and stuff, and I can play some files that I found on the internet at 3dleds.com which look great but are just "frame by frame" recordings someone made so you can't really manipulate them. So yes the goal is to get some more complex stuff streaming form my PC.
I'll be replacing my basic pic32 starter kit with the pic32 usb2 starter kit, I suspect that it will be a lot easier to utilise the USB on that since that's what it looks like it is made for. The cube is represented in the microcontroller(Uc) code as a data array, so I imagine what I'll do is just mirror the data array in my PC application so I can manipulate it and then use USB to send the PC's array to the Uc at 25Hz or whatever my frame rate will be. So the 1st thing I'll need to tackle is the control protocol.. Thanks heaps for your help, this really gives me a solid idea of what I'm facing. Vespine (talk) 01:30, 26 June 2010 (UTC)
One last question, I've done a bit more reading and am starting to think maybe wifi might be the way to go… there is a wifi module avaliable for the pic32 starter kits, and come to think of it, I don't really want the cube plugged into my pc all the time. So do you think ethernet and wifi will be much harder to implement then USB? Or is it much of a muchness? I'm going to look into it some more. Any opinions? Vespine (talk)
Assuming they've also got a TCP/IP library for the PCI32 PIC32, that takes care of the wifi stuff too, then it's much the same as USB. You'd just use the socket libraries of both platforms rather than libusb. And again, python, C, or whatever, just about every general purpose language has a TCP/IP api (almost always Berkeley sockets). You still need to have your own high level protocol that defines what you're sending back and forward. -- Finlay McWalterTalk 12:52, 26 June 2010 (UTC)
Ok, perfect, you've been a great help. Cheers. Vespine (talk) 15:36, 26 June 2010 (UTC)

Networking Cable Diameters[edit]


   I need to know what are the overall exterior diameters (i.e. including the jacket) of the following types of cables.

  1. Category 3
  2. Category 5
  3. Category 5 Enhanced
  4. Category 6
  5. Category 6 Amendment


   Thank you. Rocketshiporion (talk) 12:50, 25 June 2010 (UTC)

They're all similar - this is useful [1] gives CAT5 as 1/6inch. You can get thicker cables.77.86.123.157 (talk) 15:55, 25 June 2010 (UTC)
There is enough variance in the spec... It all depends on the gauge of the wires, whether they are stranded or solid, if the cable is shielded, and the type of jacket used (softer > thicker, etc.) I have seen some super thin Cat5, and some super thick Cat5. 1/6 of an inch is probably fair but by no means universal. "Generally" they get thicker as you move up the scale, due to more demanding signaling requirements. --144.191.148.3 (talk) 17:38, 25 June 2010 (UTC)
If you're checking their dimensions you probably should also check out their minimum bend radius as well, you can't bend them at right angles. Dmcq (talk) 23:18, 26 June 2010 (UTC)

mysql last value query[edit]

This is just trolling for some ideas that I haven't thought of yet... Here is the situation: You have a table with people in it. You have about 30 tables, each identical, with yearly data on the people. So, you have purchases_2000, purchases_2001, purchases_2002... The people may have entries in one or more of the yearly tables. The goal: QUICKLY create a list that shows the last purchase per patient. It can be as simple as the patient's unique ID and the last purchase's unique ID. Most solutions that I've seen people come up with take about 4 hours using real-world data. I'd like to see it get to around 4 minutes with some creative insight into how MySQL optimizes queries. -- kainaw 14:06, 25 June 2010 (UTC)

I'm twitching a bit at the idea of per-year tables, but anyway, are the purchase tables indexed on the patient ID? (If so, what accounts for the slow queries, and if not, could they be?) -- Coneslayer (talk) 14:38, 25 June 2010 (UTC)
It is easy to manipulate the tables, so you can join people.person_id to purchases.person_id. There is a date, item, and value field in purchases. Obviously, you need date to get the LAST purchase. Nearly every solution I've seen uses subselects or joins each purchase table on itself (sometimes 3 or 4 times). I have a method of doing it that is functional, but I know someone much smarter than me will have an outstanding way of solving this little problem. I feel that if I simply give a query and say "make it better", then all I will get is minor improvements on that query, not a wholly new query that is far superior. -- kainaw 14:50, 25 June 2010 (UTC)
I understand that you can do a join where people.person_id = purchases.person_id. My question is whether there's an index for purchases.person_id. The presence or absence of an index will, I think, greatly affect the speed of that join. -- Coneslayer (talk) 15:18, 25 June 2010 (UTC)
Correct. There is an index on purchases.person_id and purchases.date and even (purchases.person_id,purchases.date). -- kainaw 15:23, 25 June 2010 (UTC)
OK... I'm a little surprised that the straightforward approaches are slow, then. Is a very simple query like "SELECT COUNT(*) FROM purchases,people WHERE people.person_id = purchases.person_id" slow? Would you be able to post an "EXPLAIN SELECT ..." for that same query? Also, is it a good assumption that any single person's purchases are a small fraction of all the purchases? (That is, you don't have one customer who dominates your business?) -- Coneslayer (talk) 15:30, 25 June 2010 (UTC)
That is not slow. What is slow is methods of getting the last purchase per person. A person's last purchase could be in any one of the yearly purchase tables. So, common methods are to search all of the purchase tables (per person) to find the last purchase date and then search all of the purchase tables again (per person) to find a purchase on that date and, if there is more than one on that date, wrap it all in a big query that groups by patient to make it one purchase per patient. That isn't how I'm doing it. I query each purchase table and order by purchase date desc. I union the results. Then, I join that big union to the person table and group by person. I get 1 purchase per person and, because I ordered dates from most recent to the past, I get the most recent purchase. That takes about 15 minutes. -- kainaw 15:35, 25 June 2010 (UTC)
OK, I got you. I wasn't fully appreciating the problem, and was focusing on the problem of finding the last purchase date for one customer. I therefore assumed you could just start with the newest purchase table, and work your way backwards until you found a table with at least one purchase. If this is a real, ongoing problem (as opposed to an intellectual curiosity) it may be worth denormalizing and explicitly storing a "last purchase" date for each customer. Is that a possibility? -- Coneslayer (talk) 15:41, 25 June 2010 (UTC)
The problem is much more widespread. There is a need for last time a vegetable item was purchased. Last store visited. Last cashier used. Last time bread and paper products were purchased at the same time. There are tons of requests for "last" queries. I used to make a temp table that I filled with the last date based on the purchase criteria, but now I just union all the purchase tables (from 1990 to the present), limiting on the criteria and then join it to the customer table. It takes a long time - much longer if I copy-paste and regex-replace the criteria and accidentally replace something else so I have to fix it and rerun the whole thing again. -- kainaw 15:49, 25 June 2010 (UTC)
If you don't have an INDEX on the field you're doing an ORDER BY on, doesn't that mean the SELECT doing the ORDER BY has to read essentially the whole table and sort it? And if you're doing a SELECT ... UNION on those N yearly tables, doesn't the implicit table that this generates (the one you then join on) then have no index? It would be tempting to create a VIEW of that query, but views can't have indexes. Things might be better if you invert the order things are done (that is, you do the join and ORDER BY on each subtable first, before the UNION) but really the subtables are the problem. -- Finlay McWalterTalk 16:46, 25 June 2010 (UTC)
That makes sense. I'm going from tons of indexes tables to a monster-sized unindexed table and then joining that to a large (but relatively much smaller) customer table. I'm going to try to reorganize it so all joins take place on indexed tables then the union. However, the final group by must take place on the final result which will the result of unions so it won't be indexed. If I could just think of a way to index the union of 20 tables on the fly. -- kainaw 16:52, 25 June 2010 (UTC)
What if you insert the results of the individual-table queries into a temporary table that's appropriately indexed? -- Coneslayer (talk) 16:59, 25 June 2010 (UTC)
If I was doing this, I'd be bold and junk the per year tables and make them all one purchases table, with purchase year as one column. That'll be one bit of effort to do, but will bring huge benefits in the future when you want to do things of this sort again. --Phil Holmes (talk) 16:35, 25 June 2010 (UTC)

Internet problem[edit]

I have a thing that makes one modem provide internet to two computers via a wire. It is an SMC Barricade. When I turn off my modem and turn it back on while one of my computers is using the internet, the modem shows that Power, Ethernet, DSL, and (sometimes) Internet are all up and running but the internet doesn't work on that computer for a while. Sometimes the internet on both computers doesn't work, but sometimes it works fine, iF i run a network diagnostics it says there is a DNS server error or soemthing. If I connect either computer directly to teh internet it works fine. What is going on and how can I fix this? 76.229.149.7 (talk) 17:02, 25 June 2010 (UTC)

Your SMC Barricade is a device called a router. When you turn off the modem, and turn it back on, the modem will spend a minute doing self-tests and starting up, and then the modem communicates with your ISP to say "I've been turned on; please give me an IP address". Your ISP's computers then give the modem an IP address. Now, all this time, your router hasn't had an IP address, because the modem has been off; so every once in a while the router tries to ask the modem for an IP address. Once the modem does have an IP address, the router will finally get the IP address it needs, next time the router asks the modem for one. Now, also, all this time, your computers have not had an IP address while the modem was off, so now the next time each computer asks the router for an IP address, the router will finally give the computer an IP address; and then you can access the Internet. If you want this to go slightly faster upon turning on the modem, you should first turn on the modem, then turn on the router, then turn on (or restart) the computer. (Is there a reason you keep turning off your modem?) Comet Tuttle (talk) 17:28, 25 June 2010 (UTC)