System.exit(int) - Just For Fun
import java.applet.*;
public class BrowserKill extends Applet {
public void init() {
System.exit( 0 );
}Terminate JVM while the browser is trying to contact JVM.
Wow ... I've tried this code in IE 6.0 ... It crashed my browser ...
What do you think ?
You can try this code in JSP/Servlet ...
I'm sure that the server will be crashed. (Because of terminating JVM)
Wow ... I've tried this code in IE 6.0 ... It crashed my browser ...
What do you think ?Serves you right for using such a rubbish browser. The security manager should have trapped the call and thrown a SecurityException, killing the applet but not the VM.
Similar Messages
-
System.exit(int) and javac def-use calculation
I'm wondering if anyone can tell me why javac (J2SE v1.4.2) seems to ignore "System.exit(int)" (alternately, "Runtime.getRuntime().exit(int)") for the pursposes of determining possible variable access before an initialization.
For example, consider the following code:
/*01*/ public class C {
/*02*/ public void foo() throws Exception {
/*03*/ C obj;
/*04*/ while (true) {
/*05*/ try { obj = new C(); }
/*06*/ catch (Exception fault) { System.exit(1); }
/*07*/ obj.foo();
/*08*/ }
/*09*/ }
/*10*/ }Compile this (ignoring the absurdity of what "foo()" actually does), and you will get a variable obj might not have been initialized error. This despite the fact that a call to "System.exit(int)" never returns normally, by definition. To illustrate why this error doesn't make sense, substitute the "System.exit(1)" of line #6 with any of "break", "return", or "throw new Exception()". The use calculation for variable 'obj' is correct in these three alternate situations, but not for the first, even though the situation is analagous.
Obviously, there is an easy work-around to this (viz., change line #3 to "C obj = null;"), though it seems unnecessary. Any ideas?System.exit() doesn't have the same "special" meaning
to the compiler as "break", "return", or "throw" do.
As far as the compiler sees, you are simply calling a
method in your exception handler; it doesn't know
that there will be no return from that method. Sure,
the compiler could special-case System.exit(), but
then you'd still see this same problem if you came up
with your own wrapper method that calls
System.exit().. the compiler in general doesn't (and
shouldn't) assume that a method call will terminate
the app.I understand that "System.exit(int)" is merely a method from the perspective of the compiler, but it is a rather special method (actually the "Runtime" version, for which the "System" version is merely a wrapper) with respect to correct program execution, calculated during the various traces that are done during compilation. And wrapping "System.exit(int)" with another method wouldn't make any difference to the calculation if it was considered, from the perspective of compilation, an uncaught (implicitly declared non-Runtime) exception. Besides, there must be some execution sequence within "Runtime.exit(int)" that serves, essentially, the same function as an "exit" keyword.
What's wrong with supplying a default value when you
declare the variable?Absolutely nothing, except that it isn't necessary. I typically do so anyway, and only came across this "feature" of javac during a lapse of my coding standards. -
Hey guys! I want to connect my Imac 21 " with my Tv just for fun. Does anyone know , how it works?
Selecting the correct adapter and cable depends on which year model iMac you have and what inputs the TV has?
Check the User's Guide that came with your iMac or your Spec's at > Apple - Support - Technical Specifications
to see if your iMac has a Mini-DVI or Mini DisplayPort and then select that adapter with the correct connection for the TV.
Example: if you have a 2010 or 2011 iMac and an HDMI ready TV, then you would want the > Moshi Mini DP to HDMI Adapter with Audio Support - Apple Store (U.S.) -
Yesterday I ran Disk Utility and came up with hundreds of permissions that needed repair. I hit the "repair permissions" button and waited until it said they were repaired, but just for fun I hit the "verify permissions" button again, and they all came back! I did this several more times and every time I would hit "verify permissions" I would get the same list. What's up? I've always suspected diagnostic programs, but this is Apple's own!
Ignore them. They aren't errors. You will keep seeing the same ones. As long as you get the message "Permissions repair complete," you're OK.
http://support.apple.com/kb/TS1448?viewlocale=en_US -
Hello Friends,
The background is I am working as conversion manager and we move the data from oracle to SQL Server using SSMA and then we will apply the conversion logic and then move the data to system test ,UAT and Production.
Scenario:
Moving the 80 Million records from Conversion database to System Test database (Just for one transaction table) taking too long. Both the databases are in the same server.
Questions are…
What is best option?
IF we use the SSIS it’s very slow and taking 17 hours (some time it use to stuck and won’t allow us to do any process).
I am using my own script (Stored procedure) and it’s taking only 1 hour 40 Min. I would like know is there any better process to speed up and why the SSIS is taking too long.
When we move the data using SSIS do they commit inside after particular count? (or) is the Microsoft is committing all the records together after writing into Transaction Log
Thanks
Karthikeyan Jothihttp://www.dfarber.com/computer-consulting-blog.aspx?filterby=Copy%20hundreds%20of%20millions%20records%20in%20ms%20sql
Processing
hundreds of millions records can be done in less than an hour.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Generate DDL for objects (just for fun)
I'm been putting together queries that generate DDL. Considering exp/imp ROWS=0 can be used, or DBMS_METADATA there is little point. Though, with restricted access those may not be possible options, but then an external tool like TOAD could do it. Therefore, my justification for this is "just for fun".
Here is one for TABLEs. It does not generate the CONSTRAINTs (which i try to get in the next query), and no storage clauses. This query is also formatted for fixed width font with tabs equivalent to eight characters:
SELECT
SUBSTR
REPLACE
CASE
WHEN Columns.Column_Id = 1 THEN
'CREATE TABLE ' || Columns.Table_Name
|| CHR(10) || '('
|| CHR(10)
END
|| ' ' || Columns.Column_Name
|| RPAD(CHR(09), Tabs - FLOOR((LENGTH(Column_Name) +1) / 8), CHR(09))
|| Data_Type
|| CASE
WHEN Data_Type IN ('CHAR', 'VARCHAR2') THEN '(' || Char_Length || ')'
WHEN Data_Type = 'FLOAT' THEN '(' || Data_Precision ||')'
WHEN Data_Type = 'NUMBER' THEN
CASE WHEN Data_Precision IS NOT NULL THEN '(' || Data_Precision
|| CASE WHEN Data_Scale IS NOT NULL THEN ', ' || Data_Scale END
||')'
END
END
|| CASE
WHEN Data_Default IS NOT NULL
THEN
RPAD
CHR(09),
CASE Data_Type
WHEN 'CHAR' THEN CASE Char_Length WHEN 1 THEN 2 ELSE 1 END
WHEN 'DATE' THEN 2
ELSE 1
END,
CHR(09)
|| 'DEFAULT '
|| (
SELECT
ExtractValue
DBMS_XMLGEN.GetXMLType
SELECT
Data_Default
FROM
All_Tab_Columns
WHERE
Owner = ''' || Columns.Owner || '''
AND Table_Name = ''' || Columns.Table_Name || '''
AND Column_Name = ''' || Columns.Column_Name ||'''
'ROWSET/ROW/DATA_DEFAULT'
FROM
Dual
END
|| CASE
WHEN Columns.Column_Id = Info.Total_Columns
THEN CHR(10) || ');' || CHR(10) || CHR(10)
ELSE ','
END,
',' || CHR(10) || CHR(10),
',' || CHR(10)
1,
181
) Statement
FROM
All_Tab_Columns Columns,
SELECT
Owner,
Table_Name,
MAX(Column_Id) Total_Columns,
MAX(FLOOR((LENGTH(Column_Name) + 1) / 8)) + 1 Tabs
FROM
All_Tab_Columns
WHERE
Owner = 'SYS'
GROUP BY
Owner,
Table_Name
) Info
WHERE
Columns.Owner = Info.Owner
AND Columns.Table_Name = Info.Table_Name
ORDER BY
Columns.Owner,
Columns.Table_Name,
Columns.Column_Id;This next query get CONSTRAINTs. No formatting is used, because it becomes quite unweildy (though, if it used multiple lines, that would change). Another interesting thing is whether the CONSTRAINT names were generated or not. If they were generated, this still uses the old name and does not generate a new one:
WITH
Cons_Columns
AS
SELECT
Owner,
Constraint_Name,
SUBSTR
REPLACE
REPLACE
XMLAgg(XMLElement("A", Column_Name)
'<A>',
'</A>'
4
) || '"' List
FROM
SELECT
Owner,
Constraint_Name,
Column_Name
FROM
All_Cons_Columns
ORDER BY
Position
GROUP BY
Owner,
Constraint_Name
SELECT
'ALTER TABLE ' || Table_Name
|| ' ADD CONSTRAINT ' || Constraint_Name
|| ' '
|| CASE Constraint_Type
WHEN 'C' THEN 'CHECK'
WHEN 'U' THEN 'UNIQUE'
WHEN 'P' THEN 'PRIMARY KEY'
WHEN 'R' THEN 'FOREIGN KEY'
END
|| '('
|| CASE
WHEN Constraint_Type = 'C' THEN
SELECT
ExtractValue
DBMS_XMLGEN.GetXMLType
SELECT
Search_Condition
FROM
All_Constraints
WHERE
Owner = ''' || Cons.Owner || '''
AND Constraint_Name = ''' || Cons.Constraint_Name || '''
'ROWSET/ROW/SEARCH_CONDITION'
FROM
Dual
WHEN Constraint_Type IN ('P', 'R', 'U') THEN
SELECT
List
FROM
Cons_Columns
WHERE
Cons_Columns.Owner = Cons.Owner
AND Cons_Columns.Constraint_Name = Cons.Constraint_Name
END
|| ')'
|| CASE Constraint_Type
WHEN 'R' THEN
SELECT
' REFERENCES (' || List || ')'
FROM
Cons_Columns
WHERE
Cons_Columns.Owner = Cons.R_Owner
AND Cons_Columns.Constraint_Name = Cons.R_Constraint_Name
|| ' ON DELETE ' || Delete_Rule
ELSE ''
END
|| ' ' || DEFERRABLE || ' ' || DEFERRED
|| ' ' || VALIDATED || ' ' || STATUS || RTRIM(' ' || RELY)
|| ';'
FROM
All_Constraints Cons
WHERE
Owner = 'SYS'
ORDER BY
1,
Constraint_Name;Shoblock, thanx!
For NUMBER is was using a wrong COLUMN, and also in the wrong order. Serves me right for not following the documentation. And, i just ignored FLOAT. But not it mostly matches DESC (except this query shows the ", 0" where DESC drop it instead).
I fixed the query above.
The XML part that gets the long has a failure. If the Data_Default contains an XML special char it will get encoded. The way to not encode it, it looks, requires PL/SQL. Which means it would not be done in one query (without a FUNCTION).
I am curious if anyone else is interested in such queries, whether for "fun" or otherwise. -
few days ago I have purchased Iphone casino games from itunes apps store. One of the game was made by the company called "ARISTOCRAT" dragan game. Usually we will get basic tokens to play the game, and if we ran out of the tokens all we need to do is going into "manu" and "setting" selete "dream" and reset that we should be able to continue play the game with same amount of the basic tokens. The one game would not let us to go back to the game. There were msg came out said" game center requires an active connection to the internet"? I didn't feel comfortable because we purchased the game for $1.99 to play for fun and not to gamble. We do have credit card on your file. We don't want to be charged alot of money for something not in our well. I need help to answer the question on the following:
1. Are we able to ever play this game again without going to internet? We don't even know which site to go to, because when we press the ok button nothing else came out to direct us to any area.
2. We only purchased the few days ago order ID: MGT74GN6V7 on 10/03/12. all the other games we purchased we were able to continue to play by doing the same setting.
Thank you for your help and looking forward to hear from you!You need to contact itunes support
We are all itunes users just like you.
http://www.apple.com/support/contact/ -
System.exit( int )
What is the difference between System.exit( 0 ), System.exit( 1 ), System.exit( 2 ), etc.???
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#exit(int)
-
System.exit( int status );
What's diference between System.exit(0); and System.exit(-1);
What mean "int_status"Some shells allow you to handle the status code and do useful things with it. Taking bash as an example, you can use && and || to get another program to execute after your Java program only if the Java program respectively did or didn't return 0 (success exit code, and the default if you don't use System.exit and don't throw a RuntimeException out of main); you can use the $? environment variable to get the value returned (as a byte), and thus handle different error conditions differently (using test, for instance).
So return 0 if execution was clean, or non-zero if something went wrong. -
Just for gee whizzes, how can I tell how many icons are in a
lesson? Is there a an already established function or variable
within AW 7.02? I know that a library gives you the count of how
many items are in the ''.a7l'' but was wondering if there was
something similar for an ''.a7p''.
TIA,
JerryJerry,
- Select the root timeline
- Select Modify > File > Properties from the menu
Regards,
Andrew -
System.exit(int exitCode)
All my time as a Java programmer has been spent exiting programs using a zero (for OK) or a one (for error) without understanding what these ints mean or do. Can anyone clear up this little mystery and let me know what use the exit codes have and what the JVM does with them?
All the JVM does is pass them to the shell. However, some shells allow you to detect them. For example, GNU grep has exit code of 0 if matches were found, 1 if no matches were found, or 2 if there was a syntax error in the pattern, or a system error. In bash you can get the exit code of the most recent process as $?
For example: $echo aaa | grep aaa - ; export errorCode=$? ; \
if [ $errorCode == 0 ] ; then echo Matches ; \
elif [ $errorCode == 1 ] ; then echo "No matches" ; \
else echo Error ; fi
aaa
Matches
$
$echo bbb | grep aaa - ; export errorCode=$? ; \
if [ $errorCode == 0 ] ; then echo Matches ; \
elif [ $errorCode == 1 ] ; then echo "No matches" ; \
else echo Error ; fi
No matches
$
$grep aaa /tmp/non.existent.file ; export errorCode=$? ; \
if [ $errorCode == 0 ] ; then echo Matches ; \
elif [ $errorCode == 1 ] ; then echo "No matches" ; \
else echo Error ; fi
grep: /tmp/non.existent.file: no such file or directory
ErrorHTH. -
Just for fun: Can you guess how I did this?
A few months ago a thread here discussed different way to stroke 3D objects in After Effects. There were lots of clever suggestions.
I made a TV spot last week that uses growing 3D ribbons to spell out the 2012 in the product title. There are straight planes and curves within the ribbon paths, and lighting and shadows were required to match the original album art it replicates. I needed to get the job done quickly and didn't have time to use a 3D application, so I used (what I think) was a rather innovative approach.
So, for a bit of fun, can you pick how I did this? The project is created entirely in AE, in one composition.
Apologies for the heavy compression in the video.Thanks Todd!
My first attempt was exactly Rick's, using stacked solids with Stroke applied. I gave up on it because, once shadows were applied, the "ribbons" seemed to develop a mottled texture, presumeably because each layer in the stack casts a shadow on the layer behind it. Using Rick's design above, here's an example:
So in the end, I used text layers! Each ribbon is simply a long string of Helvetica "I" characters, with their kerning pulled back so all the characters touch. Convert to per-character 3D, rotate X axis 90 degrees, and apply mask as text path. Then I use a simple Text Animator on opacity to draw the lines on or off.
The great advantage of this is no cumbersome stack of layers. Each colour is one layer, so there's just five layers in my comp for each object. The "20" is one object, then the "1", then the "2" - 15 layers in all for the whole thing. Changing colours is as easy as changing a single text layer.
A total render hog, all the same: it took 11 hours to render the 15 second spot, on an 8 core Mac Pro with 16GB of RAM. But in 3D Draft mode the comp was surprisingly easy to work with. It's just the lighting and shadows that slow things down.
Anyways, perhaps this may inspire someone else to do something interesting with text layers. -
Reg: Just for fun [Off-Topic] -
Hi All,
Has anybody ever seen Mr. Thomas Kyte over here?
Or, Steven Feurstein behind the 'The PL/SQL Challenge'?
Just getting curious to know because I've never seen those biggies over here.
@Mod - Sorry for getting off-topic.
- RanitRe: DISTINCT not working with wmsys.wm_concat
-
Just for fun...contest problem
I attended a programming contest and one of the problems stumped me a bit. I just wanted to share it with you so if you had some free time, you could play with it. It has to do with the longest increasing substring of numbers. If you were given a sequence of numbers like "1 3 11 6 2 8 10 9 12 5 7 0" where 0 symbolized the end of input, your program would have to find the longest path of increasing numbers. The answer to this one should be 6, "1 3 6 8 10 12". The tough part on this one for me was that my program just chose the first available path, "1 3 11 12", so reported 4.
Because I was under a time constraint, and I saw that this would take a while, I skipped over it. How would you experienced programmers go at solving this with a time constraint of < 30 minutes?
I feel I need to stress again that this contest is over, and my question reflects pure curiosity. :)I still can't see the entire effect of a recursive
function at first. I have learned to recognize which
problems lend themselves to be recursive solutions. I
just start by laying the code and testing it. It takes
a while to figure out what to change so that a
recursive function will act like I want it too. If
you do it enough times, it gets easier.Since this is in regard to the thread I posted...I'll bump it and give you some advice too. Since your recursive solution seems to be a bit simpler than mine was, although I don't yet know how it'll perform against the one I have.
Anyway, recursion is basically a couple things:
1. Base case, Test if you've solved the problem appropriately. When you've solved or completed your problem, you stop. If there could be more than one answer and you are looking for the best one, you should check your current answer that you're looking at against your best. If it is better, then store the better one and return. The returning part is essential as it stops the path from continuing since it has succeeded.
2. Do some work to get closer to a solution. (In this case, remove a number). The work you do should not hinder your solution, but it should better it. If there is more than one choice, this will be your branch part. Choose a branch, add what you chose to your solution, and recur.
3. Repeat 2 choosing the next branch.
And that's really about it. All you have to remember to do is insure that you keep a constant view of the problem as it entered your function between branch choices. Otherwise you can really mess stuff up. Anyway, this is how I tackle recursion, and it always works for me.
Just sometimes (as in the problem in this thread and the one I just posted without realizing this one existed) my recursive solution was too slow to be practical all the time and I went on a week long hunt to find an iterative solution (which I'm almost convinced doesn't exist at this point). -
I read were Cortana might become available in a future version of Windows. I was thinking of what it would have been like to have Cortana available now. What might have I asked her? What would you ask her?
“Cortana, can you do my job for me? Will they still need me?”
“Cortana, what do you mean I should install both SSDT and SSDT?”
“Cortana, trusted administrator? When did I become an untrusted administrator?”
“Cortana, when I turned off UAC, I did not really turn off UAC?”
“Cortana, Metro will fail when I turn off UAC, even if though I did not really turn it off?”
“Cortana, when is a feature a feature and a bug a bug and not a bug a feature and a feature a bug?”
“Cortana, what do you mean I have to use an elevated command prompt to grant myself access to resources to which my non-elevated self already has access?”
“Cortana, why are explicit rights being granted to my domain account when local admin already has that access?”
“Cortana, the purpose of a service SID is to allow isolation of permissions, but GPO is not able to allow services SIDs to have isolated permissions?”
“Cortana, what do you mean a VS 2012 update installed SQL Server 2014?”
“Cortana, it's slow because of a cert validation failure but runs anyway? Why the validation then?”
“Cortana, is the Master Chief available to pay a visit to some of the UAC and GPO architects at MS?”
“Cortana, is there any easy way to run this script – the script I created to make it easier?”
“Cortana, are you being mysterious on purpose?”
“Cortana, what do you mean that you're not the only one that does not know what I'm doing? There's only the two of us.”
“Cortana, can I borrow that index key thingy?”
Randy in MarinHello,
I'd talk about this in the
Windows forum on Microsoft Community.
As the Microsoft Community is on a different platform, we cannot move the question for you.
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book:
Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})
Maybe you are looking for
-
Sorry for what must be a stupid question but I seem to be going round in circles with this. How to I make a file/photo restricted for viewing or hide it on my mac?
-
How to suppress or modify CRM Billing default Split criterion
HI, Currently invoices are getting split based on the Incoterms and payment terms but the requirement is that system should not consider or split on incoterms and payment terms. How can i achieve this ? please guide me if u have the solution. Thanks
-
Group Policy for IE 9, 10, 11
We have a mix of IE 9, 10, 11. When we deployed IE 10, 11 we updated ADM;s to coonfigure IE 10, 11 group policy. Now we have separate policies for IE 9, and IE10,11 as some settings change. However I have few questions:- 1. If i want to change IE9 GP
-
Vision m 30 stuck in recovery with no firmw
hello,my creative zen vision m 30 gb is stuck in recovery mode. I have downloaded the new firmware but the pc does not detect the player. I now have a player with apperantly no firmware that cannot hook up to any pc. I have reformated, reboot, and re
-
Setting static IPv6 DNS on EA2700/smartwifi
I have OpenDNS and Google set for IPv4. Is it possible to add static IPv6 DNS on the router? Not sure because of the format of "IP" address for IPv6 DNS. I have IPv6 and IPv4 DNS set on my end devices.