Wikipedia:Reference desk/Archives/Computing/2009 November 24
Computing desk | ||
---|---|---|
< November 23 | << Oct | November | Dec >> | November 25 > |
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 24
Formatting Text in Java
I asked about String vs. Pattern delimiters earlier. Anyway, I have a really basic program that will read in the file using the scanner and break it up into pieces and can assemble them the way I want. Just one question --- it reads only from .txt as far as I know (a Scanner with a File) so I put all my file from a .doc into a .txt, losing all the formatting (i.e bold, centered text). Is there any way that I could redo that formatting using my program. The delimiter breaks my file into chunks and I'm trying to format a piece of that chunk, not the whole chunk. I just need to make text bold and centered. Is there any way possible?
I don't think I explained it very clearly so: What I mean to say for a chunk is that my delimiter is TEST. So I have a set of text that goes TESTTOSS-UP Math Short Answer Question. Answer. TOSS-UP. All I'm trying to do is make the TOSS-UP bold and centered.
—Preceding unsigned comment added by 66.133.196.152 (talk) 01:15, 24 November 2009 (UTC)
- You should read our article on plain text. A document that is saved by Word (for example), as a .doc, includes significantly more data beyond just the text that appears on screen. There is formatting data, and significant amounts of other metadata. Unless you have the file format documentation, or if you are using a pre-written library to access .doc file formats, you will have trouble with plain text operations. Nimur (talk) 01:40, 24 November 2009 (UTC)
- EDIT: I'm dumb nm 66.133.196.152 (talk) 02:04, 24 November 2009 (UTC)
- An alternative option would be to save the text as HTML which can then be relatively simply parsed and changed. --Phil Holmes (talk) 12:10, 24 November 2009 (UTC)
Getting only part of an integer with Mathematica
In Mathematica, I am trying to make a function that inputs an integer and outputs the integer mod squares. Hopefully that makes sense, but an example would be if I plug in any square integer, I get 1. If I plug in a square free integer, I get itself back. If I plug in 32, I get 2 because it removes an even number of powers of 2. If I input 2^5 * 3^4 * 5^9 * 11^13, I get back 2 * 5 * 11. I have tried factoring the integer with FactorInteger and then using the Cases command to take only the prime factors which have odd exponent, but I am not getting it. Any help would be much appreciated! StatisticsMan (talk) 02:54, 24 November 2009 (UTC)
- If you don't get an answer here, you might want to move this Q to the Math Desk. StuRat (talk) 04:28, 26 November 2009 (UTC)
- You may have to break this into several steps to see where it went wrong. Are you actually getting the list of factors in the form you have with ^ and * ?. Can you actually spot the odd exponent,rather than and odd factor? If the factors come out OK, can it multiplyt them out again? sed could probably do this: substitute the even exponent factors to nothing and get rid of the odd exponents. I think your algorithm sounds OK but I don't know mathematica.
- Phew, I finally worked something out! You've started right with FactorInteger, and I think Cases would work too - but I thought of using Mod to take the powers mod 2. I think this code ought to work (when surrounded by the usual Module stuff):
numberout=1; flist=FactorInteger[n]; listlength=Length[flist]; (* ie the number of pairs *) Do[ (* repeat the steps below for each pair - fno is the number of the pair we're on *) pair=flist[[fno]]; (* take the fno'th pair of numbers *) pfactor=pair[[1]]; (* pfactor is the first number in pair, ie the prime factor *) pwr=pair[[2]]; (* pwr is the second number in pair, ie the power *) pwr=Mod[pwr,2]; (* now take pwr mod 2, ie 0 if it's even or 1 if it's odd *) numberout=numberout*(pfactor^pwr) ,{fno,listlength}] numberout
- (the (* ... *) are comments)
- This is the compressed version, without all those variables:
numberout=1; flist=FactorInteger[n]; Do[ numberout=numberout*(flist[[fno,1]]^Mod[flist[[fno,2]],2]) ,{fno,Length[flist]}] numberout
- Warning: I haven't used Mathematica for years, and I can't test this code - so there may be mistakes in it!
- (Incidentally, there's a useful guide to Mathematica at http://reference.wolfram.com/mathematica/guide/Mathematica.html - that's how I refreshed my very patchy knowledge!) AJHW (talk) 11:56, 26 November 2009 (UTC)
- Oh, drat, I forgot to say: n is the integer input. AJHW (talk) 11:59, 26 November 2009 (UTC)
mv command with three arguments
I'm trying to install an application called Drupal and one of the instructions is to "Move the contents of that directory into a directory within your web server's document root or your public HTML directory" with the command
mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html
I'm a little confused as to why there appear to be three arguments after the mv command, which mv doesn't seem to support. Can someone please clear up my confusion? Thanks! — Sam 76.24.222.22 (talk) 04:10, 24 November 2009 (UTC)
- You have a bad reference. (Or a weird mv but that's unlikely.) See 'man mv', 'mv --help' and possibly 'info "(coreutils) mv invocation"' for proper info. The leading arguments will go to the last argument and the last argument should be a directory. --194.197.235.240 (talk) 07:28, 24 November 2009 (UTC)
- In other words, if you supply mv with more arguments - like mv a1 a2 a3 b, then it moves a1, a2 and a3 to directory b. Better description of mv on the web is for example here. Lukipuk (talk) 10:36, 24 November 2009 (UTC)
Windows 9x
Why haven't there been any DOS/9x Windows versions since ME? jc iindyysgvxc (my contributions) 09:25, 24 November 2009 (UTC)
- As those versions ran on MS-DOS which is 16-bit they had all manner of limitations (the total amount of usable memory being the main one) and the way forward was to move to a true 32-bit platform and now becoming more common is the 64-bit platform. ZX81 talk 12:56, 24 November 2009 (UTC)
- The Windows 9x family of operating systems was very unstable. If one program crached, the entire OS was likely to crash. Also, there were no such thing as "security". The entire platform was very obsolete. --Andreas Rejbrand (talk) 17:25, 24 November 2009 (UTC)
What 'mainstream' applications use .NET?
Most .NET development is (generally speaking) focused on creating web applications or in-house business applications. What 'mainstream' applications also use .NET? By 'mainstream' I mean, non-business apps and something that a non-programmer might use. I can think of Paint.NET, Windows PowerShell and SyncToy. Are there any others? 12.165.250.13 (talk) 16:05, 24 November 2009 (UTC)
- Many modern PC games use .NET as you learn with the inevitable DirectX and .NET updates with so many games you install. I can't think of any examples outside the ones you provided when it comes to productivity applications. I'm not sure what level .NET is used in most games either. Someone who is more familiar with the framework may be able to provide a more complete answer. 206.131.39.6 (talk) 17:50, 24 November 2009 (UTC)
- QuickBooks, PowerQuest Backup, the ATI control panel, Microsoft Expression, and Hallmark Card Studio are some of the apps I know of.--Drknkn (talk) 20:45, 24 November 2009 (UTC)
- MediaPortal, Beyond TV and other stuff I can't remember (I usually just install .NET and then don't have to care if an app requires it). Many specialised simple apps that you find in forums and in user websites also use .NET. You also need the .NET framework for the DirectX Video Acceleration on Windows XP I believe (you definitely need it for the EVR renderer). An interesting this is to try searching wikipedia for ".NET framework" [1]. While some of these are discussing other stuff, some of them are applications that require the .net framework. For example I found out that the Nokia Map Loader uses it. Obviously this only finds a small percentage of applications using it. A Bing or Google search for 'requires .net framework' [2] [3] is also likely to find some interesting stuff. For example I was reminded Nero 9.0 requires .NET Framework [4]. Precisely what component needs it I don't know (possibly the media portion) but it won't install without it no matter what you choose... This is of course all on Windows. Somewhat controversial I believe a number of Linux apps use Mono (software)#Software developed with Mono, Tomboy (software) probably being the most prominent, and there may be more in the future [5] Nil Einne (talk) 22:39, 24 November 2009 (UTC)
Symbols, colors, fonts won't copy into email
Referring back to this question:[6]
I now find myself unable to copy and paste this information into emails. Is this something new in Internet Explorer 8?
I do recall warnings that I was telling the computer to do something unsafe and that was stopped, but I hardly see where just the symbols would cause a problem. I do remember video or something else moving and I was told don't use Explorer. I stay away from Firefox and use plain text when possible, but copying the symbols manually is such a pain. Vchimpanzee · talk · contributions · 20:43, 24 November 2009 (UTC)
- No. The problem is not IE8. Probably, your email client is set to using just plain text. If you switch to using html, it should work (at least sort-of-work). See E-mail#Plain_text_and_HTML. --NorwegianBlue talk 21:14, 25 November 2009 (UTC)
Need another printer suitible for cartridge refilling, or renovate the old one
My HP Deskjet 930C has got blinking error lights which prevent printing (I do already know what the manual says about them thanks), and despite several times in the past being able to fix the same pattern of blinking lights and get it working, this time I have not been able to. It has been a robust printer in the past, pity I cannot get it to work this time. a) I refill my own black-ink cartridges to save money. What robust reliable model of printer would suit this please? I have an old computer with WinXP, and thus cannot run some modern printers. I am happy to buy a 2nd hand printer. b) Are there any unofficial instructions about how to renovate this model of computer? HP says nothing about removing the cover etc. The printer is too old for paying for maintenance to be worthwhile - buying new would be cheaper. c) Is there any way to find out more specifically what the problem is? None of the HP software can do this, it would have to be some diagostic program an independant programmer has done, if anything exists at all. Thanks 92.24.170.160 (talk) 21:20, 24 November 2009 (UTC)
- Check eBay! There is a used HP Deskjet 930C for sale (with about 13 hours left to run at time of writing) with no bids on it so far, another with a "Buy it now" price of $16 and yet a third with "Buy it now" at $10. Beware the $25 shipping...but maybe you can get a good deal. I've been getting HP OfficeJet K80's from eBay (I have three of them now) - they are easy to fix when you have spares, and I agree profoundly about refilling ink cartridges. Sadly, modern printers have fancy electronic ink carts that won't work even if you do re-fill them...manufacturers sell printers at a steep loss and make their money back from ripping you off on ink to an insane degree. So if you have one you can reliably re-fill, stick with it! SteveBaker (talk) 00:48, 25 November 2009 (UTC)
I wish it were possible to buy or unofficially modify a printer so that instead of having to play around with injecting ink into cartridges, you just poured ink into it like filling a car. If it were not for the business model used, that would be how they would be designed. Roll on the days when we have fabrication machines and can make freeware designs of objects. 78.146.176.198 (talk) 23:01, 25 November 2009 (UTC)
- Yes - I agree. I really wouldn't mind paying $200 or $300 on a printer if the ink cartridges cost a more realistic $10 or so - or if you could just fill the thing up when it gets empty. But if you stand around in the printer aisle at Fry's - you'll see that nobody ever asks "How much are the print cartridges and how many pages can they print?" - they do look carefully at the printer prices - but they totally fall for the scam. Fabrication machines are coming...RepRap is a working fabricator - and if you are handy enough to assemble one, they cost under $1000. I actually own a CNC milling machine that I built myself for $200...I can't make a printer with it - but we're well on the way to being able to do this. Things like printers are tough to fabricate though - those teeny-tiny thermal print heads are not the kinds of thing that you can make with these kinds of generalized robotic bulding systems. SteveBaker (talk) 05:57, 26 November 2009 (UTC)