Wikipedia:Reference desk/Archives/Computing/2012 July 20

= July 20 =

Java Security (Quick fix for hosting a local file?)
I am developing a java applet for independent research. The file is intended to read the directory the applet is running from, using the code:

String currentDir = new File(".").getAbsolutePath;

.... after that it flushes an image buffer to png image format. However, i forgot that, unlike java applications, java applets are highly restricted. As expected, the code above causes the applet to throw a security exception, because my applet isn't signed. I was reading this page:

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html

... there seem to be many steps just to allow access to the local file system. Is there any easier way to just tell the browser that the applet it is loading is MINE and that i accept its use of my files? I would rather not go find out how to make a public key, a certificate, and a security policy. Thanks in advance!

172.163.3.207 (talk) 03:42, 20 July 2012 (UTC)


 * It's usually a simple task to adapt an applet into a standalone application, e.g. switching from a  to a   with a   method that properly instantiates your   and invokes your   and   methods. Of course if you're only running the applet locally, then you probably have some reason why you need it to stay in applet form. Could you upload the file to a LAN server and have the applet fetch it? BigNate37(T) 04:46, 20 July 2012 (UTC)

So.... Container pane = getContentPane; becomes a JFrame instead? Would the class still extend JApplet, or something else? Also, once i figure that all out, how do i run the thing? Your suggestion seems the best way to go. I don't need it to be an applet, so long as i can still display and interact with the graphics in the same way (mouse, button listeners still work i hope) :) 172.162.254.31 (talk) 12:41, 20 July 2012 (UTC)


 * You can exploit the fact that Applet and JApplet are subclasses of java.awt.Container by simply adding them to a frame (so you don't need to change the applet code to be a frame). Add the following main to your applet's class:


 * and change the class swingapplet to the name of the applet class (I did write some code to figure this out automatically, but it was pure evil). At the top add some extra imports:


 * And you've wrapped the applet up as a JFrame-application. Or you can use appletviewer, as I discussed below. -- Finlay McWalterჷTalk 15:18, 20 July 2012 (UTC)

The JDK comes with a program that allows you to run applets (as if they were applications) already - it's called appletviewer. Assuming you already have an html file index.html with the applet tag in, you just say appletviewer index.html And that works for lots of simple applets. But if you try that with your code, you'll still get a security exception, because the appletviewer installs its own security manager, which checks signatures and limits permissions, just as the equivalent code in a web browser does. What you can do is create your own java security policy file which allows you to grant exceptions to this security sand box just for this invocation (so it's a safer and cleaner thing to do, rather than messing around with the equivalent for your browser, and then forget to undo that, leaving your browser very vulnerable). Here's a minimal security policy file (call it my.policy) which grants total access (so it's the same as a java application gets) grant { permission java.security.AllPermission; }; Now, with that in place, and your index.html and .class files in the same directory, you can invoke appletviewer and have it use that special policy file: appletviewer -J-Djava.security.policy=my.policy index.html Which should allow total access. Naturally you have to trust the code (which is fine if you wrote it, and you trust yourself), so it's obviously not a wise thing to do in general with code you didn't write and whose source you don't have good reason to trust. -- Finlay McWalterჷTalk 13:48, 20 July 2012 (UTC)

I used the wrapper option. It works wonderfully, thank you all for the input! 172.162.132.72 (talk) 01:08, 21 July 2012 (UTC)

Texniccenter
When I type things like \begin{equation}, how do I make it automatically give \end{equation}? Money is tight (talk) 05:38, 20 July 2012 (UTC)

TFT monitor colours
Does anybody know why colours displayed on a TFT monitor are darker at the top of the screen than at the bottom? Suppose I have a small window containing a simple graphic (eg a blue arrow). If the window is at the top of the screen, the blue is much darker than if the window is at the bottom of the screen. If happens in both Linux and Windows XP, so clearly it is something the monitor is doing. It does it in both daylight and artificial light too. It makes getting the colours right when editing graphics very tricky. Thanks! --TrogWoolley (talk) 09:58, 20 July 2012 (UTC)


 * I do not believe that holds true to any monitor.~It certainly isn't true to mine. Maybe yours is defective. 188.76.169.66 (talk) 12:03, 20 July 2012 (UTC)
 * Actually poor LCD viewing angle is the likely cause, see or this old source  for example. Or try these tests  on a bunch of cheap LCDs and you'll probably see the problem yourself. I thought perhaps things had advanced since I last looked but it sounds like cheap LCDs still often have TN panels and so aren't great if you're planning to do serious graphical work, the CRT some random person is giving away is probably better from a colour standpoint (it may not be anywhere near as sharp particularly since it's old). Nil Einne (talk) 13:18, 20 July 2012 (UTC)


 * Thanks for the links; the first one was very useful. My monitors at work and at home both have the problem, and it looks as though the solution is either buy a more expensive monitor (can't see work doing that) or live with it.--TrogWoolley (talk) 18:12, 20 July 2012 (UTC)

PS3 games: PAL and NTSC
Hi, I live in Australia, and I'd like to buy some PS3 games from overseas, cos you know, gaming outlets love to overcharge us Aussies. Anyway, I'm wondering what the differences are between the Australian and UK PAL versions, as well as PAL versions from other countries, and whether they'd cause any significant changes in gameplay. I've been given to understand that NTSC games are also compatiable with my PAL PS3 provided that I've got HD connection with my TV (which I do) -- can somebody confirm this? Also, can somebody point me to an official article that explains the differences between: the PAL regions; and between PAL and NTSC versions? It'll be great if people can respond to my queries. Thanks --Sp33dyphil ©hatontributions 10:35, 20 July 2012 (UTC)
 * Our Regional lockout article suggests the PS3 has the technical ability to regionally lockout games but the only time it was tried, it was abandoned due to complaints. However it also suggests you may have prolems if you want to buy content from the PS3 store. Whether Australia is in a different region from the Europe when it comes to the PS3 I can't say. In less complicated regions systems Australia and NZ usually end up with Europe. Nil Einne (talk) 11:36, 20 July 2012 (UTC)

Wikipedia's links with space instead of underscore
Why (I think) only Wikipedia's addresses can have a space instead of a underscore? Even if it gets converted, why other web-sites don't perform this trick? Persominus (talk) 13:42, 20 July 2012 (UTC)


 * Strictly, your browser is performing the conversion ("percent-encoding"), not Wikipedia's server software. Space characters are not valid in a URL query string.  Wikipedia's software - MediaWiki - has an intelligent mapping between spaces and underscore characters because wiki syntax is designed to streamline the conversion between human-readable and machine-readable text.  Other websites that run MediaWiki automatically use these conventions.  Other server-software may use a similar convention, at the discretion of the web designer.  Nimur (talk) 13:49, 20 July 2012 (UTC)


 * Most other websites do perform that trick, at least for links to webpages within the same website. If you are seeing a "Contact_us" link instead of "Contact us", for example, it's very poor webpage design.--Shantavira|feed me 14:52, 20 July 2012 (UTC)

You're referring to simple URI remapping, Apache HTTP Server would do it like so, for example. A lot of websites using Content Management Systems that weren't designed by total goobers (not as many as you might think) promote such remapping. A lot of websites have no content management system or back end to speak of, and operate much more simply. ¦ Reisio (talk) 20:53, 20 July 2012 (UTC)

To really understand this sort of issue is confusing, because there are a lot of different things going on. So what actually happens if you construct a URL for a Wikipedia article by hand, containing a space, is that your browser converts it to %20, and Wikipedia's web server translates it back to a space, and then the higher-level Wikipedia software converts the space into an underscore when looking up the article name in the database, but displays it to you as a space. Over the river and through the woods (and twice around the barn), to Grandmother's house we go... —Steve Summit (talk) 15:00, 22 July 2012 (UTC)
 * 1) Strictly speaking, URLs (web addresses) cannot contain spaces.
 * 2) Spaces must be encoded in URLs as %20.
 * 3) Since spaces in names and URLs are a nuisance, Wikipedia arranges that actual article names do not contain spaces, but rather underscores.  But that would be a huge nuisance, too, so Wikipedia automatically does the right thing.  Article titles are printed at the top of the screen with spaces instead of underscores (although you can still see the underscores in the URL in your browser's address bar).  If you refer to an article title using spaces, Wikipedia automatically assumes the underscores.  For example, this page's name is Wikipedia:Reference_desk/Computing, but it appears as the top of the page as "Wikipedia:Reference desk/Computing", and I can refer to it in wikitext as either  Reference desk/Computing </tt> or <tt> Reference_desk/Computing </tt>.  It shows in my browser's address bar as <tt> http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Computing </tt>.
 * 4) Most browsers jump into the DWIM act, too.  If you type a space into the address bar, most browsers automatically convert it into <tt>%20</tt> for you.

wikiasari
what is the domain name for wikiasari — Preceding unsigned comment added by 90.194.140.253 (talk) 15:35, 20 July 2012 (UTC)
 * http://www.wikiasari.net Tombo7791 (talk) 17:20, 20 July 2012 (UTC)

Video "prt sc"
I know there is such a thing a "prt sc" to print whatever there is on the screen and save as a JPG. Is there such a thing as a video "print screen" that will capture the video on the screen (e.g. mouse moving around the screen, clicks and different screens produced; YouTube video presentations on the screen) and save as a MPEG? I have a newer HP laptop with Windows 7. Is there something in Windows Live Movie Maker that will capture video on the screen?--Doug Coldwell talk 18:24, 20 July 2012 (UTC)


 * It sounds like you want to make a Screencast - that article and Comparison of screencasting software should get you on your way. -- Finlay McWalterჷTalk 18:50, 20 July 2012 (UTC)


 * Finlay got there before me. If you're into using MS products, apparently Microsoft Expression Encoder does it. I haven't used it myself. - Cucumber Mike (talk) 18:52, 20 July 2012 (UTC)


 * The "PrtSc" thing ("print screen", variously written PrntScr, PrtScr, and so on on keyboards) is called a "screenshot", and the video equivalent is (as pointed out) a "screencast". There are a number of other programs capable of producing these; among them are Fraps, which is especially well-liked by people who make videos of games, and Camtasia Studio.  dalahäst (let's talk!) 02:38, 21 July 2012 (UTC)
 * Thanks. You all have given me good leads.--Doug Coldwell talk 12:20, 21 July 2012 (UTC)