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

{{#ifeq:{{PAGENAME}}|Special:Undelete| |{{#if:|

}} {{#ifeq:{{NAMESPACE}}|Wikipedia|{{#switch:{{NAMESPACE}}|= |
}}|{{error:not substituted|Archive header}}
}}}} {{#if:|
}}
width = "100%"
colspan="3" align="center" | Computing desk
width="20%" align="left" | < July 19

! width="25%" align="center"|<< Jun | July | Aug >>

! width="20%" align="right" |{{#ifexist:Wikipedia:Reference desk/Archives/Computing/2012 July 21|July 21|Current desk}} >

align=center width=95% style="background: #FFFFFF; border: 1px solid #003EBA;" cellpadding="8" cellspacing="0"
style="background: #5D7CBA; text-align: center; font-family:Arial; color:#FFFFFF;" | Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is {{#ifexist:Wikipedia:Reference desk/Archives/Computing/2012 July 30|an archive page|a transcluded archive page}}. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.

__TOC__

= July 20 =

Java Security (Quick fix for hosting a local file?)

{{Resolved}}

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 JApplet to a JFrame with a static main(String[]) method that properly instantiates your JFrame and invokes your init and start 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:

public static void main(String[] args) {

JFrame f = new JFrame("Applet");

f.setSize(600, 450);

JApplet app = new swingapplet(); // CHANGE THIS

f.getContentPane().add(app);

app.init();

f.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent w) {

System.exit(0);

}});

f.setVisible(true);

app.start();

}

: 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:

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

: And you've wrapped the applet up as a JFrame-application. Or you can use appletviewer, as I discussed below. -- Finlay McWalterTalk 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 [http://docs.oracle.com/javase/tutorial/security/tour1/index.html 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 McWalterTalk 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)

{{Resolved}}

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 [http://www.mediachance.com/pbrush/monitor.html] or this old source [http://www.xbitlabs.com/articles/monitors/display/professional-monitors_2.html] for example. Or try these tests [http://www.lagom.nl/lcd-test/viewing_angle.php] 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)

{{resolved}}

::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 [http://apcmag.com/overcharge.htm 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)

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/ 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 McWalterTalk 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 {{user link|Finlay McWalter}} 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)