Wikipedia:Reference desk/Archives/Computing/2008 August 15
Computing desk | ||
---|---|---|
< August 14 | << Jul | August | Sep >> | August 16 > |
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. |
August 15
editC++ and java programming
editHi. I'm a bit new to all this programming thing, and I'm reading about C++ and Java. I read on WIkipedia that C++ is mostly used for applications and system.
My question is then: Can you program a system or large fully funtional programs with java, if yes, is it a good idea to used java for systems of large applications?
Thanks. —Preceding unsigned comment added by 194.239.172.228 (talk) 07:23, 15 August 2008 (UTC)
- Yes, you can programme a large fully functional programme with Java, but it's not very often done because of the slower speed of Java due to the fact that it runs on a virtual machine. (Yes you can use JNI but you wouldn't be programming in Java if you use that, would you?) --antilivedT | C | G 08:48, 15 August 2008 (UTC)
- These days, in my experience it's a myth that Java is inherently slow. JIT compilers are the norm; startup takes longer, but once the application runs, it's often not much slower than C++. Unless speed is critical and you're doing massive amounts of calculations, I doesn't really matter. --Tokikake (talk) 13:00, 15 August 2008 (UTC)
- Also, it depends on the resources in your company. For example your developers might be Java experts in which case the company would be forced to make a decision to write a new large system using Java as the front end, rather than hire C programmers and thereafter teach them the business etc. Of course, your system would most likely comprise some sort of database - these database calls (JDBC) can be made from within java to, for example, stored procedures within the database, so this would eliminate performance restrictions as business rules and functions can be stored and executed in the database code. Sandman30s (talk) 11:44, 15 August 2008 (UTC)
It is difficult to compare. The other reason may be because Java programs generally have more features in them anyway, compared to C+. Vuze is slower than Transmission (BitTorrent client). But why? Because Vuze is Java and Transmission is in C+, or because Vuze does absolutely everything you could possibly want, and even what you would never want?84.13.87.28 (talk) 13:51, 15 August 2008 (UTC)
- The primary issue is the need for a native executable. In general, people want programs that just run. They don't want to deal with a virtual machine. You also have issues with the virtual machine upgrading and causing errors in your program. So, C/C++ is commonly used to make a native executable that just runs on whatever operating system it was designed for. There are third-party programs that can turn a Java program into a native executable for Windows, but the end result is rather huge because weird licensing issues require you to bundle every single bit of Java into the executable instead of only including what you need. All in all, if the JIT compilation would allow you to save the executable, Java would be just as fast as C/C++ and be very portable (send the executable to anyone with the same operating system). Sun will not allow that to happen, so Java is stuck in virtual machine hell. -- kainaw™ 16:36, 15 August 2008 (UTC)
- I don't think it's true that "if the JIT compilation would allow you to save the executable, Java would be just as fast as C/C++". There are other things that slow Java down, like
- Bounds checks on every array access. Some C++ implementations let you turn this on for the standard containers, but usually it's off.
- More dynamic binding (virtual function calls), I think. They're harder to predict and can't be inlined.
- A lot more dynamic type casting and checking, to work around limitations and gaping holes in Java's static type system. C++ has dynamic_cast and typeid, but they aren't often used. The C++ equivalent of casting from Object is casting from void*, which has no runtime cost on most implementations. (It's also unsafe, but we're talking about speed here.)
- All data is heap allocated except for a few magical built-in types. This costs an extra word for the reference, extra instructions to dereference it, and allocation and garbage collection overhead, and it hurts memory locality. It also means Java has a runtime abstraction penalty that doesn't exist in C++. If you declare a variable of type complex<double> in C++ it behaves pretty much like two variables of type double from a code generation perspective, even though complex is not special to the compiler. In Java a class with two double fields is a lot more expensive than two doubles. The only way to get good performance from complex numbers is to make them magical to the compiler or write all the complex arithmetic out by hand. In C++ you can wrap a class to provide a different interface (containment and delegation—can't believe that's a redlink) with no runtime cost. In Java every layer of wrapping creates another heap allocated object and another reference. This kind of wrapping is good programming practice and it's common in both Java and C++.
- There are probably also cultural differences that have nothing to do with the languages as such, like
- Java probably attracts more inexperienced programmers who don't notice that they're writing an O(n³) sorting algorithm nor know why that's a bad thing.
- People who are trying to write fast software (and are going to put effort into optimizing it) are more likely to choose C++, making the higher speed a self-fulfilling prophecy.
- -- BenRG (talk) 12:46, 16 August 2008 (UTC)
- I don't think it's true that "if the JIT compilation would allow you to save the executable, Java would be just as fast as C/C++". There are other things that slow Java down, like
- This reminds me of a Carmack quote about writing the 3D engine for Quake II. He said that you can try to optimize your C++ code all you want, but if you don't get into the assembler and work on the actual assembly code, you're always going to run at least 10% slower in your framerate. So... inexperienced programmers who don't know assembly will certainly write slower programs. -- kainaw™ 14:24, 19 August 2008 (UTC)
Spam
editI think my question will be a little light on necessary technical information, but anyway...my organisation tried to switch ISPs. Our domain name was, at some point, incompletely transferred, and there was confusion. In the course of working to solve the problem, basically by trying to reverse the switch and go back to the way everything was...I've been unable to either send email or receive it. I can't send to myself, I can't send to my other (external) email address, I can't receive from my other (external) email address, and I am not receiving from other external addresses. Except spam. Somehow, spam messages are still able to find their way to my address...an address I don't even know where it lives now myself...and into my inbox. How do they do that? If no other email reaches me, how can the spams do it? Thanks if you can provide any insight. —Preceding unsigned comment added by 80.101.134.43 (talk) 09:09, 15 August 2008 (UTC)
- I think the system administrator is the spammer XD -59.95.106.83 (talk) 15:15, 15 August 2008 (UTC)
- Even if the DNS routing is screwed up, your server has a stable IP address. If you e-mail yourname@192.168.1.1 (with your e-mail server's IP address instead of that one) it should get to you. I've never tried it personally, but it seem to be the most likely possibility. ---J.S (T/C/WRE) 18:15, 15 August 2008 (UTC)
- You can see what address the spam messages were sent to and try to send an email to that address. ARTYOM 03:53, 16 August 2008 (UTC)
Laptop battery no longer charges
editHello. I have a Lenovo/Thinkpad laptop (purchased new May 2007) running WIndows Vista. Yesterday, without warning or any apparent reason, I noticed that--according to the battery display icon on the right side of the taskbar--my battery is no longer capable of charging. When plugged in, the computer runs fine. When I pull out the power cord, the battery (now at 35%) begins to deplete as it normally would, but when I reinsert the power cord, the battery will begin to charge back up. Any ideas? Thank you very much for your help! —Preceding unsigned comment added by 24.211.242.80 (talk) 11:29, 15 August 2008 (UTC)
- For Lenovo Thinkpads, the battery has a "Charge when below x%, charge to y% then stop" function. You can check whether if your computer is always kept at full charge (charge after batter drops below 96%) or if a different scheme is enabled by clicking on the battery in the taskbar and going to the Lenovo power manager, Battery information tab, battery maintenance button. Coolotter88 (talk) 12:37, 15 August 2008 (UTC)
- Unfortunately I don't think that's the solution, becuase it's set to automatically charge when below 94%, and it's already far below 94%. I didn't change my battery settings at all recently so that's why the situation is so confusing. -- 24.211.242.80 (talk) 12:57, 15 August 2008 (UTC)
- Your battery may be defective or simply outside of it's useful life. Call the support line for Lenovo (IBM?) and see if it's still under warrenty. Might get lucky and get it replaced for free. ---J.S (T/C/WRE) 18:08, 15 August 2008 (UTC)
- btw - Lenovo batteries have a 1 year warranty. --mboverload@ 02:13, 16 August 2008 (UTC)
- My older laptop used to do that long before the battery went completely dead and unrechargeable. I guess sometimes the batteries just won't charge completely for a while, but will still charge later at some point. ARTYOM 03:56, 16 August 2008 (UTC)
- Where I work we deal with a ton of Dell laptops, and their batteries. 30 or so. Three times now the battery failed within a few months of the warranty expiration date. The other 20+ have had their batteries for 2-3 years and are working fine. The article on Lithium-ion battery discusses the life-span a bit. ---J.S (T/C/WRE) 04:01, 16 August 2008 (UTC)
How to create my own wikia or wiki
editI'm just asking how can I create an wikia with my own content.
Thanks 85.220.107.122 (talk) 12:22, 15 August 2008 (UTC)
- You can request one here. the wub "?!" 17:01, 15 August 2008 (UTC)
- Or, if you want to get a little more control, you can start your own using the same back-end software. Check out the website for mediawiki.org. ---J.S (T/C/WRE) 17:28, 15 August 2008 (UTC)
.org domain name changing
editWe heard that .org domain names can't be switched from an ISP, and then switched elsewhere or switched back, in less than 60 days. Supposedly this is a restriction specifically on .org names. Can anyone confirm this, and explain whose regulation that would be, who enforces it and how, and how an exception could be made? —Preceding unsigned comment added by 80.101.134.43 (talk) 13:11, 15 August 2008 (UTC)
- No special restrictions on .org domains that I'm aware of. ---J.S (T/C/WRE) 18:03, 15 August 2008 (UTC)
source code
editafter hearing that the makers of lost are diong a new arg game on the net i thought id have a go ive spoke to people and they keep saying theres hidden stuff in the websites source code how do i find the source code? i realise this is proberly a stupid question but im stumped —Preceding unsigned comment added by 212.248.225.148 (talk) 13:38, 15 August 2008 (UTC)
- Every web browser ever made has an option, normally labelled "view source". You have to tell me which web browser you are using before I can tell you specifically which menu item to click on. Of course, if you have trouble finding the "view source" option in your browser, you will never find the easter eggs in the source code of the web page. -- kainaw™ 13:43, 15 August 2008 (UTC)
- In both IE and FireFox on XP, it's under the "View" dropdown box. The option is "Page Source" in FF2 and "Source" in IE6. It will be something similar in most other versions of IE/FF. Should be close in Safari and Opera, but I don't have them installed to check. ---J.S (T/C/WRE) 18:07, 15 August 2008 (UTC)
- It's View + Source in Opera. StuRat (talk) 01:38, 19 August 2008 (UTC)
linux and windows
edithi...i have suse 10 and windows xp installed on my computer...I'm able to access windows file sys in linux but am not able to access linux file sys in windows...is there any way by which i can access the files in linux partition while using windows..
thanking you in advance.. —Preceding unsigned comment added by Piyushbehera25 (talk • contribs) 17:07, 15 August 2008 (UTC)
- I did a quick google search and you can access ext2/ext3 with diskinternals linux reader.Coolotter88 (talk) 17:24, 15 August 2008 (UTC)
I use Linux Reader to copy files from ext file system to Windows. fs-driver can do both read/write but what I've heard is that you should not write to Linux filesystems using these drivers because they ignore file permissions and can often mess up things. -Abhishek (talk) 18:34, 15 August 2008 (UTC)
- There's usually no harm done if you don't touch the root file system though. But I still set my ext2IFS to read-only mode just in case some random virus decides to delete everything on my partitions. --antilivedT | C | G 04:51, 16 August 2008 (UTC)
Why, windows, WHY?!?!
editI have been pestered for a week by a message saying "this version of Windows XP is no longer secure. To get up to date security features, please download the latest service pack" or something along the lines of that. So i finally downloaded it, and i restarted.
Now, i get the Windows XP screen, and then a blank screen after that. i dont know what the problem is, and i cant get into safe mode to do a system recovery. it just stops at the screen with the list of system files.
For the hell of it, with the blank screen up, i typed in my password, thinking maybe it was working but the display was messed up. Sure enough, i heard the startup jingle shortly afterward. So its obviously a display problem.
Ive never encountered something like this. what can i do?the juggresurection IstKrieg! 18:30, 15 August 2008 (UTC)
- I think the original message was from some Adware/Malware. Can't really help you without sitting down in front of your computer and spending a few hours working on it. Basically, you may need to take your computer to a professional at this point, or, reformat and reinstall everything from scratch. I hope I'm wrong and someone will have an easier fix for you. ---J.S (T/C/WRE) 19:42, 15 August 2008 (UTC)
- i hope so too, i got alot of music i dont want to lose...if i make it out of this with all my files intact, im gonna back it all up. Please if anyone has a better way, feel free to say something. the juggresurection IstKrieg! 19:50, 15 August 2008 (UTC)
- This is a longshot, but Do you have one monitor connected to a graphics card equipped for dual monitors? Once I had my computer somehow decide it wanted to output exclusively to the port that nothing was connected to. I forget exactly how I fixed it, but the computer became usable again just by switching the monitor to the other output. APL (talk) 22:46, 15 August 2008 (UTC)
- The message appears to be legit. It sounds like a video driver problem, in which case I'm surprised you can't boot into safe mode. Is there any chance you're doing it wrong? APL's suggestion sounds good also. Another thing you can try is to log in, then press Win+R (which opens the Run dialog), then type "cmd" followed by Enter (which opens a command prompt), then press Alt+Enter (which makes the command prompt go full screen, which changes the video mode, which might make the video card come back to life). This trick has actually saved my skin once or twice. -- BenRG (talk) 23:01, 15 August 2008 (UTC)
- Well, i tried the above technique, and all i get is that system sound similar to if you were in a dialogue box and you tried to click outside the window. —Preceding unsigned comment added by The juggresurection (talk • contribs) 23:21, 15 August 2008 (UTC)
- Sounds like some sort of dialog is showing up when you log in. Try pressing Esc a few times, or maybe use Ctrl-Alt-Del and go to the Task Manager, which has its own Run menu option, I think. I don't have such a machine to hand, so I can't tell you exactly how to get to Task Manager blind. --Tardis (talk) 15:08, 18 August 2008 (UTC)
- Does it give you an error message at the end of the list of files when you try to start in the safe mode? If not, you might just wait a couple of minutes to see if it starts up; I have had situations before when the list of file stayed on the screen for a minute or so before the safe mode actually started. ARTYOM 04:05, 16 August 2008 (UTC)
- Nope, it stayed that way for many hours. im gonna end up reinstalling XP here pretty soon, im running out of options. the juggresurection ಠ_ಠ 04:20, 17 August 2008 (UTC)
- Do you currently have an external hard disk? Because using a Linux Live CD, you should be able to copy all your data to an external disk. I recommend Knoppix, it's free. - Akamad (talk) 09:20, 18 August 2008 (UTC)
- It sounds to me like the monitor drivers that come with that service pack don't fully support your current monitor. If you have some other monitors around, I'd try those. StuRat (talk) 01:35, 19 August 2008 (UTC)
- Unfortunately i dont have an external hard disk, ive wanted to try that in the past when i had a Ubuntu live disk. and i left my other monitor behind when i moved to AZ. All I really care about is the 7GB of music....could someone tell me how to hook up my hard drive to another comp, and i could dump the music there while i reinstall Windows?the juggresurection ಠ_ಠ 03:15, 19 August 2008 (UTC)
- Internal hard disks (depending on their age) are either [P]ATA or SATA (see the articles for pictures); it's as simple as disconnecting the drive from that data connection and from power (and from screws, usually) in one case and adding it to the power and data cables in another computer. Be careful with the data cables, though; some PATA cables can be connected upside-down (which won't work), and the SATA article says that those connectors are somewhat fragile. There can also be issues with the drive(s) already in the other computer. If there aren't any free spots, you may have to temporarily remove a disk that doesn't hold its operating system (which can cause confusion but shouldn't cause damage). If you're putting two disks on one PATA cable, you'll need to make sure you have the "master"/"slave" settings correct on them; if using SATA, it may be necessary to acquire a splitter to attach more than one disk. And of course, if the dead computer is SATA and the other is PATA, it can't work; the other way around will work but will require a bridge adapter. If you can look inside both machines and describe what you have to work with, I can be more explicit. --Tardis (talk) 15:33, 20 August 2008 (UTC)
- Unfortunately i dont have an external hard disk, ive wanted to try that in the past when i had a Ubuntu live disk. and i left my other monitor behind when i moved to AZ. All I really care about is the 7GB of music....could someone tell me how to hook up my hard drive to another comp, and i could dump the music there while i reinstall Windows?the juggresurection ಠ_ಠ 03:15, 19 August 2008 (UTC)
- You can avoid diving into another computer by using a Disk enclosure. You can put your hard disk into it, and plug it in via a usb cable into another computer. - Akamad (talk) 01:11, 21 August 2008 (UTC)
Initializing and backgrounding, please wait...Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". ogl_open: Can't get an appropriate visual. Done
I don´t know anything about Linux. What should I do? —Preceding unsigned comment added by Mr.K. (talk • contribs) 20:40, 15 August 2008 (UTC)
- Have you got OpenGL installed? How you do this depends on your type of Linux. For Ubuntu, try
sudo apt-get install libgl1-mesa-glx libgl1-mesa-dri
. --h2g2bob (talk) 22:25, 15 August 2008 (UTC)
Linux After Puppy Linux
editI tried Puppy Linux as my Windows was broken and I loved it. If I want to do some serious work in Linux like BRL-CAD, should I change now for a different version or is this version as good as anyone else? —Preceding unsigned comment added by Mr.K. (talk • contribs) 20:48, 15 August 2008 (UTC)
- A general rule of thumb with your operating system: the larger the user community, the easier to find support and assistance with your problems which will inevitably pop up from time to time. In light of this, I recommend ubuntu linux because it is currently very mainstream with immense technical support and online help available. Nimur (talk) 23:24, 15 August 2008 (UTC)
- I like Puppy Linux, but it has some serious limitations. I'd recommend that it's not a great solution for a modern computer who's use will be typical computing tasks. As Nimur said, Ubuntu is a good choice. ---J.S (T/C/WRE) 00:53, 16 August 2008 (UTC)