Wikipedia:Reference desk/Archives/Computing/2011 April 12
Computing desk | ||
---|---|---|
< April 11 | << Mar | April | May >> | April 13 > |
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. |
April 12
[edit]Linux packets
[edit]Hi. If I install dpkg on Arch Linux, will the system be able to use Debian's packages? 212.68.15.66 (talk) 09:09, 12 April 2011 (UTC)
- Yes, with certain compatibility caveats. All dpkg does is unpack a .deb, and then manage the contents' meta-data: what files are installed, which versions, in which directories, and so forth. (It's really little more than a standardized nomenclature for an archived program: see deb (file format)). In some cases, deb package metadata may indicate a required dependency; and dpkg does not handle the retrieval and installation of dependencies. The actual program may require certain system utilities or packages that are not installed by default on your *nix system. If you don't want to worry about those compatibility issues, or if you're unfamiliar with manually managing program and library dependencies, consider switching to a Debian or Ubuntu installation, where the system package managers are a little more user-friendly. And of course, this says nothing about whether your .deb package contains a valid program for your machine architecture; make sure you get the correct version. If all else fails, you can rebuild free-software programs from source, when your version of *nix is not binary-compatible with the intended target. Nimur (talk) 14:32, 13 April 2011 (UTC)
Capturing webpages
[edit]Please suggest some good free software by which I can capture the image of any webpage? And is there any firefox add-on avalible for this? I use Firefox 4. --Reference Desker (talk) 10:09, 12 April 2011 (UTC)
- I assume you mean a screenshot utility for capturing the whole page - yes, there is! See Fireshot. 212.68.15.66 (talk) 11:17, 12 April 2011 (UTC)
- Thanks! --Reference Desker (talk) 12:08, 12 April 2011 (UTC)
- No problem! 212.68.15.66 (talk) 12:15, 12 April 2011 (UTC)
- There is one that comes prebuilt in Win7 (I'm not sure about Vista) which is called Snipping Tool. Just search it in the start menu. General Rommel (talk) 03:13, 13 April 2011 (UTC)
- AFAIK The Snipping tool is a bit clumsy. It also doesn't, if I recall correctly, taking a screenshot of the whole web page, only the visible portion which is also capturable simply by using print screen. 212.68.15.66 (talk) 12:03, 13 April 2011 (UTC)
- I use a Firefox extension called "Screengrab", which works quite well.217.158.236.14 (talk) 12:45, 13 April 2011 (UTC)
- Go to File, and select Save As. Then navigate (in the resulting dialog box) to your desired directory, type in the desired filename, then under Save as type:, select Web archive, single file (*.mht) and click the Save button. Rocketshiporion♫ 14:18, 14 April 2011 (UTC)
broadband in Altona, Vic, Australia?
[edit]Sorry for such a very local question, and no worries if there are no answers, but I'm enquiring on behalf of a friend who lives in the above suburb - she's using Virgin ADSL, but it's incredibly slow - something to do with poor coverage, she thinks. Can anyone recommend a better provider? She's currently paying about 60 dollars a month, but is willing to pay more, I think.
Thanks Adambrowne666 (talk) 10:28, 12 April 2011 (UTC)
- I don't know the specifics of the Australian ADSL market, but if it's anything like that in the US or the UK, the ISP may not be the source of the problem. In those markets the local loop (the wire from your house to the phone company's premises) is owned by, and installed by, a single phone company (which used to be the actual monopoly, and generally retains a de-facto monopoly because it has the men and the trucks and the premises and so forth). That company (I guess in Australia it's Telstra) frequently operates the DSLAM too, and sometimes several hops on the IP network beyond that. So regardless of who your ADSL provider is, the cable to your house, the DSLAM, and maybe some of the IP network too, are all the same (Telstra's). If the slowdown is there, changing ISP won't help, as the ISP only handles your traffic somewhere downstream of the DSLAM. Before I worried about the ISP I'd first look at:
- is the PC okay (no malware)
- is the ADSL modem/router okay (what data rate does the modem report?)
- is the microfilter okay (those are easy to swap out)
- is the ADSL equipment being interfered with by a radio source or a noisy power main?
- is the phone wiring inside the house okay - old wiring can be sufficient for voice calls, but with lots of patches and branches and junk it can degrade a data connection
- beyond that, if you're far from the exchange, or the line from your home to the exchange is old and noisy (and in some cases, for long lines, impaired by a loading coil), that can degrade performance. The phone company can test this remotely (although persuading them to can be a challenge), and they can sometimes even be persuaded to replace the old line with a fresh clean new one.
- 87.112.90.1 (talk) 16:02, 12 April 2011 (UTC)
- Thanks for the detailed answer - I'll pass the info onto her. Adambrowne666 (talk) 02:09, 13 April 2011 (UTC)
- Would it be worth asking the Prime Minister? She's a local! HiLo48 (talk) 02:36, 13 April 2011 (UTC)
- She is indeed - I bet she has good broadband - good idea - I'll ask her next time I'm around Adambrowne666 (talk) 12:14, 13 April 2011 (UTC)
- Australia has had local loop unbundling for a while so there are a few other companies who have Dslams connected to the lines other then Telstra. Whether this is the case for the location the OP mentions I can't say. In any case this may not help if the line itself is the problem, e.g. the distance from the line to the exchange or even just your own internal wiring. Checking the sync rate of the ADSL modem as 87 suggests would be a good first step in giving you an idea of where the problem may lie. Nil Einne (talk) 07:39, 14 April 2011 (UTC)
Platform for new system
[edit]I'm planning to get a small system developed for my business that will need to run on about 10 computers (individually, not networked). If I get it developed in Java with a MySQL database, I know I will have to install the Java runtime environment for the program to work. But will I also need to install MySQL and manually create a database on every computer? —Preceding unsigned comment added by 122.255.9.36 (talk) 11:37, 12 April 2011 (UTC)
- If they're not networked (and that means the different instances of the app won't communicate or share state) then you'd need to install the database server on each. If you can network them, then you'd be able to run just a single MySQL database server and all the java clients could talk to it. -- Finlay McWalter ☻ Talk 11:43, 12 April 2011 (UTC)
- If you're not networking them, you might want to use something other than MySQL, e.g. in an SQLite database. MySQL is a lot of overhead to bring if you aren't having multiple users access it at the same time. --Mr.98 (talk) 11:45, 12 April 2011 (UTC)
- I understand there might be constraints that are forcing you to use non-networked machines, but you could consider a web-based system, in which case your 10 computers would require nothing other than a web browser. You would have to maintain a server to run the database and web server (it could be Java, PHP, Rails, Python, etc) but I think the benefits of performance, comparability and longevity would abound. There is no need to connect this cluster of clients/server to the internet, you could run an isolated LAN. --rocketrye12 talk/contribs 17:55, 12 April 2011 (UTC)
- Are the 10 installations supposed to share state (that is, should one be able to see changes performed by the other)? If so, you need to have only one database server, and have them all connect to it over the network (though there are other possible setups, like Rocketrye12's suggestion). If not, you'll need to install database software and create a database on each server. Paul (Stansifer) 04:40, 13 April 2011 (UTC)
Re: SSD as C:\
[edit]I'm not sure if this is a temporary issue with Ref desk but I can't seem to be able to edit my previous section entry? Anyway I just wanted to thank those who have provided responses, they have been very helpful. However by and large they have been quite theoretical (which is useful) but I was also wondering if anyone here actually has been running a SSD for any significant period of time as their C:\?
@75.57.242.120 yeah they are a bit expensive but Windows 7 takes up 16 gig and a desire for extra space on C:\ is actually one of my main reasons for upgrading from my 74GB WD raptor which is becoming too cramped...
Thanks again --58.175.32.140 (talk) 12:09, 12 April 2011 (UTC)
- It's an ongoing problem, the cause of which is still unknown. Try purging the cache and then see if the section edit links come back. If they don't, I could copy your message to the other section for you if you like 82.43.89.77 (talk) 14:25, 12 April 2011 (UTC)
- Yes, over here an SSD has been the machine's C: drive for months. Do you have a question? Comet Tuttle (talk) 16:50, 12 April 2011 (UTC)
- My 150GiB boot partition resides on a RAID 1 array of two Kingston SSDNow V+ 512GB 2.5” SATA II SSDs, and my OS is Microsoft Windows 7 Professional Edition. My computer has been running continously since 6-March-2010, except for 20-second reboots. My pagefile also resides on RAID 0 partition on the same pair of SSDs. Rocketshiporion♫ 10:44, 13 April 2011 (UTC)
- Oh great (sorry for slow reply to comments) - @ Comet Tuttle, nothing in specific I just wanted to make sure the theory works when it hits the ground :) I have had memory keys die on me in the past so you can understand I was a bit dubious about having a SSD as my C: but if its working for you guys thats reassuring. Thanks! --58.175.32.140 (talk) 12:29, 16 April 2011 (UTC)
Downloading google books
[edit]Is there any script/software available by which I can download an entire book in a single click? Right now I use Google Book Downloader, but the problem with this script is that I have to download each of the page separately which is a pain in the ass. So I want something by which I can download a free/preview book with a single click. Thanks! --Reference Desker (talk) 12:14, 12 April 2011 (UTC)
- For some books Google Books presents you a PDF link, so you can download them directly.
- For some other books Google Books would be allowed to give you a PDF link, but for some reason doesn't. E.g. this used to be the case in Europe with most books, even those that were printed in the 18th century. In such cases you can get around it by using a proxy server in a country where Google offers a download link (if you know how to get one), or by looking for the book in the Internet Archive. [1]
- For some books it's illegal and therefore Google correctly won't let you do it. You should not try to find a workaround. Whether a book is out of copyright or not may depend on your country. Hans Adler 12:20, 12 April 2011 (UTC)
Desktop wallpaper is always stretched
[edit]Hi there, I have Windows 7 and when I put a picture on my desktop it always (almost) goes to STRETCH even when I select CENTER or some other display. What is even more frustrating is that once in a while it does center. WTF? Thanks! —Preceding unsigned comment added by 66.151.171.194 (talk) 17:27, 12 April 2011 (UTC)
- Not sure about the cause, but a workaround might be to create a wallpaper that's the full size of the screen. You could put a black frame around it, for example, if that's what you want. If that's part of the pic, then Windows won't remove it. StuRat (talk) 22:21, 12 April 2011 (UTC)
C# expression parsing
[edit]Today at work, I noticed this kind of C# code:
string s; /* ... */ string text = "the value of s is " + s == string.Empty ? "empty" : s;
I thought it should handle null strings too, so I changed it to:
string s; /* ... */ string text = "the value of s is " + string.IsNullOrEmpty(s) ? "empty" : "not empty";
Surprise surprise, this code no longer compiled, causing an error message saying "Cannot convert string to bool". I changed it to:
string s; /* ... */ string text = "the value of s is " + (string.IsNullOrEmpty(s) ? "empty" : "not empty");
and the code compiled again. So I wrote the following code at home on my Fedora 12 Linux system:
using System; public class Test { public static void Main(string[] args) { string s = string.Empty; string test = "the value of s is: " + s == string.Empty ? "empty" : "not empty"; Console.WriteLine(test); } }
and compiled it with mcs and ran it with mono, and printed out:
not empty
Does this mean that the statement:
string text = "the value of s is " + s == string.Empty ? "empty" : "not empty";
in fact means the following?
string text; if (("the value of s is " + s) == string.Empty) { text = "empty"; } else { text = "not empty"; }
Because that is the only way I can see that the first version compiles and the second one does not, and also why I got the output that I did. JIP | Talk 19:00, 12 April 2011 (UTC)
- The operator is a ternary operation. It is in the form: boolean ? code : code; So, what you have is a string and you are adding some more string based on the ternary operation. The error was a complain that the String.IsNullOrEmpty(s) function was a string, not a boolean. What I think is that you meant to use s.InNullOrEmpty(). That runs the is null or empty function on s. The way you did it was you ran a class-static (however you want to refer to it) function called IsNullOrEmpty and you passed it a string. It probably only accepts booleans if anything at all. -- kainaw™ 19:20, 12 April 2011 (UTC)
- Also, your translation is not accurate. It translates to:
- string text;
- if(s.isEmptyOrNull())
- text = "the value of s is "+"empty";
- else
- text = "the value of s is "+"not empty";
- Ternary operations are very similar to if-else controls, but not exactly the same. A ternary operation allows "code" in the if-else part. It doesn't have to be a complete expression. Depending on the language, you can also apply this to the left-side of an expression. I did this before in a very special case. It looks like:
- country.type == 1 ? state : province; = form.sp;
- That checks to see the country type and, depending on that, decides if it will set the state or province variable. -- kainaw™ 19:24, 12 April 2011 (UTC)
- Kainaw, I can't make any sense of your answer. It appears to be completely wrong.
- The answer to the question is yes. If you look at a C# operator precedence table you'll see that ? : has very low precedence; almost any operator will "bind tighter" than it, including + and ==. (To be more precise, if you think of "? expr :" as a fat binary operator, it is right-associative with the precedence given in that table. Between the ? and the : there can never be a precedence conflict, so you can put anything there unparenthesized, even an assignment expression.) -- BenRG (talk) 20:02, 12 April 2011 (UTC)
- As a general stylistic rule, safe and portable code shouldn't rely on operator precedence, but should make liberal use of parentheses. Though relying on operator precedence is valid syntax, it is at the very least confusing syntax for human programmers (and for compilers, which are not always bit-exact to the language specification). The GNU C Style Guidelines recommend excessive parentheses for absolute clarity, as do many code style and intro-to-programming textbooks. Nimur (talk) 20:45, 12 April 2011 (UTC)
- As an aside, have you tested whether this actually works if the string is null? I'm not too familiar with C#, but the way that dynamic dispatch works in most languages like this, you can't dynamically dispatch off null. Some people suggest that stuff like this makes null a terrible language feature. Paul (Stansifer) 03:58, 13 April 2011 (UTC)
- It's a class method (string.IsNullOrEmpty(s)). -- BenRG (talk) 07:25, 13 April 2011 (UTC)
- Oh, of course. Never mind! Paul (Stansifer) 13:12, 13 April 2011 (UTC)
- It's a class method (string.IsNullOrEmpty(s)). -- BenRG (talk) 07:25, 13 April 2011 (UTC)