How to implement countdown timer in apex
Hi all,
I want to implement timer in my application.i am working on apex 4.0 version.I am developing online test application,so for this i want to display timer for test.
can anyone suggest me how can i implement countdown timer in my application.
thanks
jitu
Hi,
You can refer "Martin Giffy D'Souza's" Enhanced APEX Session Timeouts example
http://www.talkapex.com/2009/09/enhanced-apex-session-timeouts.html
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1
Similar Messages
-
How to Implement a Time Limit Feature in an Online Test Application ?
I am creating an Online Test application. The time limit can be stored for a Test in the database.
How to implement a time limit such that when the test is started (user clicks on the Start button to go to the fragment containing the Questions) the time left is shown and the test ends (goes to home page) when the timer reaches zero.
ThanksHi,
timestamp is a date and thus cannot be used directly to determine seconds passed. So what you need to do is to build the difference between a saved time stamp and the current time.
http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/Timestamp.html
So if you have two time stamps, then calling getTime() on each and building the difference gives you a value, which is millisecond. So to get this to an int value you divide it by 1000
Frank -
How to implement real-time refresh datas in obiee?
How to implement real-time refresh datas in obiee?
Can you elaborate more...
If you want to see refreshed data in OBIEE Reports, you need to implement Caching mechanism based on how you often refresh warehouse..
[http://download.oracle.com/docs/cd/E05553_01/books/admintool/admintool_QueryCaching6.html] -
How to create countdown timer with sound
Any ideas on how to create a minute and seconds countdown timer that would play a sound and then redirect you to another page?
Hi,
There is no out of the box solution to do so in Muse at the moment. If you can get your own code, you can add it to your site using "Insert HTML" feature.
Regards,
Aish -
How to Implement simple Timer in this code
Hi there guys,
This is a small ftp client that i wrote. It has encryption and all bulit into it. I want to initiate the sendfile function every 5 minutes.
The program starts with the displaymenu function wherein a menu with various options is displayed.
How Do i Do that? I went online and tried doing it myself but cud not possibly think of a reason as to why my changes were not working.
Here is the basic code. I earnestly hope that some of you guys out there will help me. This is a very simple problem and sometimes it is the finer point that eludes us. any help will be deeply appreciated
import java.net.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.crypto.*;
import java.util.regex.*;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
class FTPClient
public static void main(String args[]) throws Exception
Socket soc=new Socket("127.0.0.1",5217);
transferfileClient t=new transferfileClient(soc);
t.displayMenu();
class transferfileClient
Socket ClientSoc;
DataInputStream din;
DataOutputStream dout;
BufferedReader br;
transferfileClient(Socket soc)
try
ClientSoc=soc;
din=new DataInputStream(ClientSoc.getInputStream());
dout=new DataOutputStream(ClientSoc.getOutputStream());
br=new BufferedReader(new InputStreamReader(System.in));
catch(Exception ex)
//encrypto routine starts
class DesEncrypter {
Cipher ecipher;
Cipher dcipher;
// 8-byte Salt
byte[] salt = {
(byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
(byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
// Iteration count
int iterationCount = 19;
DesEncrypter(String passPhrase) {
try {
// Create the key
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
SecretKey key = SecretKeyFactory.getInstance(
"PBEWithMD5AndDES").generateSecret(keySpec);
ecipher = Cipher.getInstance(key.getAlgorithm());
dcipher = Cipher.getInstance(key.getAlgorithm());
// Prepare the parameter to the ciphers
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
// Create the ciphers
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
} catch (java.security.InvalidAlgorithmParameterException e) {
} catch (java.security.spec.InvalidKeySpecException e) {
} catch (javax.crypto.NoSuchPaddingException e) {
} catch (java.security.NoSuchAlgorithmException e) {
} catch (java.security.InvalidKeyException e) {
// Buffer used to transport the bytes from one stream to another
byte[] buf = new byte[1024];
public void encrypt(InputStream in, OutputStream out) {
try {
// Bytes written to out will be encrypted
out = new CipherOutputStream(out, ecipher);
// Read in the cleartext bytes and write to out to encrypt
int numRead = 0;
while ((numRead = in.read(buf)) >= 0) {
out.write(buf, 0, numRead);
out.close();
} catch (java.io.IOException e) {
public void decrypt(InputStream in, OutputStream out) {
try {
// Bytes read from in will be decrypted
in = new CipherInputStream(in, dcipher);
// Read in the decrypted bytes and write the cleartext to out
int numRead = 0;
while ((numRead = in.read(buf)) >= 0) {
out.write(buf, 0, numRead);
out.close();
} catch (java.io.IOException e) {
} //encryptor routine ends
void SendFile() throws Exception
String directoryName; // Directory name entered by the user.
File directory; // File object referring to the directory.
String[] files; // Array of file names in the directory.
//TextIO.put("Enter a directory name: ");
//directoryName = TextIO.getln().trim();
directory = new File ( "E:\\FTP-encrypted\\FTPClient" ) ;
if (directory.isDirectory() == false) {
if (directory.exists() == false)
System.out.println("There is no such directory!");
else
System.out.println("That file is not a directory.");
else {
files = directory.list();
System.out.println("Files in directory \"" + directory + "\":");
for (int i = 0; i < files.length; i++)
String patternStr = "xml";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(files);
boolean matchFound = matcher.find();
if (matchFound) {
dout.writeUTF("SEND");
System.out.println(" " + files[i]);
String filename;
filename=files[i];
File f=new File(filename);
dout.writeUTF(filename);
String msgFromServer=din.readUTF();
if(msgFromServer.compareTo("File Already Exists")==0)
String Option;
System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
Option=br.readLine();
if(Option=="Y")
dout.writeUTF("Y");
else
dout.writeUTF("N");
return;
System.out.println("Sending File ...");
// Generate a temporary key. In practice, you would save this key.
// See also e464 Encrypting with DES Using a Pass Phrase.
System.out.println("Secret key generated ...");
// Create encrypter/decrypter class
DesEncrypter encrypter = new DesEncrypter("My Pass Phrase!");
// Encrypt
FileInputStream fino=new FileInputStream(f);
System.out.println("Initialised ...");
encrypter.encrypt(fino,
new FileOutputStream("ciphertext.txt"));
System.out.println("generated ...");
fino.close();
FileInputStream fin=new FileInputStream("ciphertext.txt");
int ch;
do
ch=fin.read();
dout.writeUTF(String.valueOf(ch));
while(ch!=-1);
fin.close();
boolean success = (new File("ciphertext.txt")).delete();
if (success) {
System.out.println("temp file deleted .../n/n");
for (int j = 0; j < 999999999; j++){}
}//pattermatch loop ends here
else
{ System.out.println(" " + "Not an XML file-------->" +files[i]); }
}// for loop ends here for files in directory
}//else loop ends for directory files listing
System.out.println(din.readUTF());
}//sendfile ends here
void ReceiveFile() throws Exception
String fileName;
System.out.print("Enter File Name :");
fileName=br.readLine();
dout.writeUTF(fileName);
String msgFromServer=din.readUTF();
if(msgFromServer.compareTo("File Not Found")==0)
System.out.println("File not found on Server ...");
return;
else if(msgFromServer.compareTo("READY")==0)
System.out.println("Receiving File ...");
File f=new File(fileName);
if(f.exists())
String Option;
System.out.println("File Already Exists. Want to OverWrite (Y/N) ?");
Option=br.readLine();
if(Option=="N")
dout.flush();
return;
FileOutputStream fout=new FileOutputStream(f);
int ch;
String temp;
do
temp=din.readUTF();
ch=Integer.parseInt(temp);
if(ch!=-1)
fout.write(ch);
}while(ch!=-1);
fout.close();
System.out.println(din.readUTF());
public void displayMenu() throws Exception
while(true)
System.out.println("[ MENU ]");
System.out.println("1. Send File");
System.out.println("2. Receive File");
System.out.println("3. Exit");
System.out.print("\nEnter Choice :");
int choice;
choice=Integer.parseInt(br.readLine());
if(choice==1)
SendFile();
else if(choice==2)
dout.writeUTF("GET");
ReceiveFile();
else
dout.writeUTF("DISCONNECT");
System.exit(1);here is a simple demo of a Timer usage.
public class Scheduler{
private Timer timer = null;
private FTPClient client = null;
public static void main(String args[]){
new Scheduler(5000);
public Scheduler(int seconds) {
client = new FTPClient();
timer = new Timer();
timer.schedule(new fileTransferTask(), seconds*1000);
timer.scheduleAtFixedRate(new FileTransferTask(client), seconds, seconds);
public class FileTransferTask extends TimerTask{
private FTPClient client = null;
public FileTransferTask(FTPClient client){
this.client = client;
public void run(){
client.sendFile();
public class FTPClient{
public void sendFile(){
// code to send the file by FTP
}the timer will will schedule the "task": scheduleAtFixRate( TimerTask, long delay, long interval)
It basically spawn a thread (this thread is the class that you
implements TimerTask..which in this example is the FileTransferTask)
The thread will then sleep until the time specified and once it wake..it
will execute the code in the the run() method. This is why you want to
pass a reference of any class that this TimerTask will use (that's why
we pass the FTPClient reference..so we can invoke the object's
sendFile method). -
How to implement this multi-langual APEX apps
My requirements are:
- login page has a dropdown of two languages: English (en-us) and French (fr)
- page is refreshed when dropdown value has changed.
- language is selected at login page, and this language setting cannot changed during session.
- Use cookie to store the selected language, and this language is selected once the login page is launched next time.
Implementation:
Globalization Settings
- primary lang = en-us
- Application lang derived Form = item preference
- do the translation in XLIFF files
Login Page
- create a SELECT LIST with name "FSP_LANGUAGE_PREFERENCE", list of value definition "STATIC:English;en-us,français;fr"
- After Submit
owa_util.mime_header('text/html', FALSE);
owa_cookie.send(name => 'LANG', value=> :FSP_LANGUAGE_PREFERENCE, expires => sysdate + 30);
- Before Header
l_cookie := owa_cookie.get('LANG');
l_value := l_cookie.vals(1);
:FSP_LANGUAGE_PREFERENCE := l_value;
Problems:
When the cookie is stored with value "fr", the droplist is "francais" but the page is not in French,. Also, I don't know how to set the refresh the page when dropdown value is changed.
Any suggestion ?hello
About Refresh of the page when the value is selected:
You need to change the type of select list to select list with submit/redirect and put also a Branch in the page so the app could know where to go after submit/redirect.
About the cookie problem:
I think that the setting of the value on the page doesn't make this value is set in app.
After setting this value to any field (TEXT or LOV) you need to submit the page so the value will stick.
I remember having the same problem but didn't solved it. :/
And also I don't know if this matters but it's faster:
l_cookie := owa_cookie.get('LANG');
:FSP_LANGUAGE_PREFERENCE := l_cookie.vals(1);
regards
piotr -
How to implement a time watch for an object
Greetings!
I have a container called TupleSpace which consists of elements of type Tuple. Among the attributes, the Tuple also has a "time to live" (the maximum amount of time its presence is allowed on the TupleSpace). After this amount of time passes it should be automatically deleted from the TupleSpace. My question is: what is the best mechanism to implement this ?
My solution so far looks like this:
public void removeExpiredTuple(){
// ts = instance of TupleSpace class
for (int i = 0; i < ts.size(); i++){
ITuple currentTuple = (ITuple) ts.elementAt(i);
long tupleAge = System.currentTimeMillis() - currentTuple.getTimeSubmitted();
// currentTuple.getTtl() = retrieves the Tuple's "time to live"
if (tupleAge > currentTuple.getTtl())
ts.remove(i);
}but I am not at all satisfied with it
Thanks in advance for your answers
Edited by: OctavianS on Jan 18, 2008 12:10 PMok, I'll give it a try and come back with a reply
LE: problem solved. thx again
Edited by: OctavianS on Jan 22, 2008 3:56 PM -
How to implement a time-limited trial version of application?
Hello
I am working on a trial version of my application for Windows Phone 8.1 Runtime.
I based my code on this MSDN tutorial:
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn532253.aspx
It clearly mentions here about a trial-period of an application.
However, when I launched the Store Dashboard, I didn't see any places in which I could set the trial-time period. There's only one checkbox turning on or off an ability for users to download a trial version.
Is it possible for Windows Phone Runtime to make a time-limited trial version of an application? For example - after 48 hours it would block itself from using it.
The important thing is to make sure the trial does not restart when user reinstalls the application (as if it could be done if I used AppSettings for validating a first-app run time).
Thanks in advanceFor windows phone you have to implement your own way to check if the trial is over and apply the action yourself. Although on windows 8.1 store does what you want automatically.
-
How to implement search in Oracle Apex 3.2?
I am new to orale apex & i want to impelment keyword based search in my app. I want a textbox on page 0 so that this textbox will come on every page. User will enter the search criteria & clieck on search button, app. will search that keyword in database & if found will redirect to that page other messa eg to the user.
Any help would be highlt appretiated...
Thanks,
-AmitCreate Page 0;
- Add a HTML Region to it
- Add a Texfield to it within the region
- Add a Button to it within the region
- The button should branch to the to page where the details will be shown (let's say Page 2).
On page 2 you will have a report with the details. The code may look something like this:
SELECT * FROM DETAILS_TBL WHERE ID = :P0_TEXTwhere P0_TEXT is the name of the textfield.
Mike -
How to implement edit time help like Eclipse, IntelliJ in Swing
Hi,
I am developing an DataBase query tool. In my application, there is a area for writing SQL command like select etc. I want to show the names of tables or fields when the user write a select keyword or give a dot(.) after giving a table name like Ecilpse shows the field names of particular class when we give the class name.Hi,
You would need to add keyListener to the text component into which you are entering the query and listen for a particular keystroke. In your case it would just be a space character.
However I would you are going about this the wrong way. How do you plan to handle the fact that in a sql query the column names come first before the table names. I would suggest you have a wizard type gui where you first get the tables involves so you can fetch and display the column names.
Hope this helps.
cheers,
vidyut
http://www.bonanzasoft.com -
can anyone tell me how to implement a timer in my program
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Sudoku extends JApplet implements ActionListener{
JButton button [][] = new JButton [9][9] ;
public void init()
Container container = getContentPane() ;
container.setLayout(new GridLayout(9,9));
for ( int count = 0 ; count <=8 ; count++)
for (int count1 = 0 ; count1 <=8 ; count1++ )
button [count][count1] = new JButton() ;
button [count][count1].addActionListener (this) ;
container.add(button [count][count1]);
public void actionPerformed ( ActionEvent event )
String output = "" ;
output =JOptionPane.showInputDialog ( "Enter a number between 1-9" );
if ( output.indexOf ('.') != -1 )
JOptionPane.showMessageDialog (null, "Please enter an integer between 1-9 " ) ;
else
int num = Integer.parseInt ( output ) ;
if ( num > 9 || num <1 )
JOptionPane.showMessageDialog ( null, "Re-enter an integer between 1-9" );
else
((JButton)event.getSource()).setText(output) ;
}It can be done with Treads, in the example below 3 buttons Start , Pause\Resume and Stop manipulate the timer.
public void actionPerformed(ActionEvent e){
if(e.getSource() == buttonStart) {
counterLabel.setText("0 : 0");
thread = new Thread(this);
thread.start();
buttonStart.setEnabled(false);
if(e.getSource() == buttonStop) {
thread.stop();
buttonStart.setEnabled(true);
if(e.getSource() == pauseButton) {
if(!isPaused) {
thread.suspend();
pauseButton.setLabel("Resume");
isPaused = true;
else {
thread.resume();
pauseButton.setLabel("Pause");
isPaused = false;
public void run(){
int secondCounter = 0;
int minuteCounter = 0;
while(true) {
try {
thread.sleep(1000);
catch(InterruptedException e) {}
secondCounter++;
if (secondCounter == 60) {
minuteCounter++;
secondCounter = 0;
counterLabel.setText(String.valueOf(minuteCounter) + " : " +
String.valueOf(secondCounter));
}Hope i've been of some assistance! -
Best way to implement a countdown timer for a turn based LCCS game
Hello,
I am trying to build a turn based game and sketching out the high level map, so I can focus my efforts towards the direction I should be digging.
One thing I have not seen much in the sample apps is how a turn based game is best handled.
For example, a countdown timer. Should it be a shared property? Or a Baton which is supposed to manage workflows and has a timeout property?
Or, should I forget those two, and time this on the server, although if it would become popular keeping track of all the times in the rooms would cost an arm and leg. Would love to hear some best practices on this.good idea.
Which one or all of them?
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to
suffering - Yoda. Blog - http://www.computerprofessions.co.nr -
How to implement this Form page in ApEx
Hi,
I'm using ApEx 4.0.1 with Oracle 10g r2.
We have an old form (built with Forms 10g) that we want to implement with ApEx.
Data are shown using some items and I can't find how to do the same with ApEx. It is quite hard to explain so here is a screenshot (png) : http://bailly.yann.free.fr/autres/OTNForums/form_mesures_offsets.png
Buttons with arrows allow user to navigate through the records. A PL/SQL program is currently used to fetch rows.
So it seems I can't use a report because I can't fetch all rows with a single query.
And I don't want to use modifiable items (textfields, textarea, ...) like in that form but simply show all data.
Any idea on how I can achieve this ?
Thanks!
Yann.So it looked to me like a single form tied to a custom query to retrieve the data will be sufficient. I would start with about 5 items including your key id. Then create a custom procedure that fires BEFORE HEADER like this:
declare
begin
select COL1, COL2, COL3, COL4
into :PX_VAR1, :PX_VAR2, :PX_VAR3, :PX_VAR4
from MY_TABLE
where KEY_ID = :PX_KEY;
end;You can make the SQL retrieval as complicated as you need. You will have to determine how to populate the Key field, whether that is by passing in a variable from another page or using another process to get it. Once you have a few items working, start creating the rest of your page items and add them to the query procedure.
If you need to change any of them, you can create a second procedure that saves the information back to the DB:
declare
begin
UPDATE MY_TABLE set COL1 = :PX_VAR1, COL2 = :PX_VAR2, COL3 = :PX_VAR3, COL4 = :PX_VAR4
where KEY_ID = :PX_KEY;
end; -
How can I make a countdown timer using After Effects
I'd like to make a video that has a timer that counts down one second at a time. I need one starting at 5:00 (five minutes). Is there a way to easily do this in After Effects without having to manually change the text every second?
Thanks.I'm glad that you found a solution, but I thought that you might appreciate a suggestion of another approach.
Colin Braley provides a tutorial and example project on
his website that show how to use an expression on the Source Text property to animate text to overcome some of the limitations of the Numbers effect.
There's a similar example in the
"Example: Animate text as a timecode display" section of After Effects Help.
Here are some Community Help searches that can lead you to some ideas, too:
Community Help search for 'countdown timer'
Community Help search for 'digital countdown timer' -
How to develop a countdown timer in jsp
Hi all, please i have an online test application that works but i want to include a countdown timer that redirects to another page when the time runs out. please, how do i go about it. please help
Thanks, but thats not the one i need. i want the one that will show the time in hh:mm:ss and then automatically take the user to the result page when the time i up. i have a javascript code i used but the problem is in the Result.jsp page, there are some parameters that are suppose to be passed but i dont know how to do it. this is the code:
<form name="frm2" method="post">
<script language="javascript">
var sec = 10; // set the seconds
var min = 00; // set the minutes
var targetURL="result.jsp"; //the url
var email=this.Field('email').value;
function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1;
} else {
min = min;
if (sec<=9) { sec = "0" + sec; }
time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";
if (document.getElementById) { theTime.innerHTML = time; }
SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD);
window.location=targetURL;
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
func();
addLoadEvent(function() {
countDown();
</script>
<table width="100%">
<tr><b><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></b></tr>
</table>
</form>and this is are the fields needed in the Result.jsp page..
<input type="hidden" name="email" value=<%=exno%> />
<input type="hidden" name="dbase" value=<%=names%> />
<input type="hidden" name="tamt" value=<%=total%> />
Maybe you are looking for
-
How can I DISPLAY MORE THAN ONE ROW OF PHOTOS WHEN CREATING A BOOK?
Can I display more than A SINGLE ROW of ohotos on the right side of the page when I am creating a photo book? I have 500 pics and this single bar is ridiculous.
-
Should files be securely deleted if using File Vault?
Do I need to "shred" or in someway securely delete files and mail that sit in File Vault? I am new to the MacOS and I am not sure where deleted files/mail go. If they don't leave the Home Folder it should be ok but if they somehow are relocated outsi
-
How to merge cell during sort in ALV
Dear all, I wrote a ALV report, there is one columns for T001~BUTXT(company code description, data type: char )which has same contents. Using the 'sort', it is unable to merge the same cells, but it works in standard ALV sorting. And in the Layout, I
-
Can you turn off autosave and versions in mountain lion?
Is this possible?
-
802.1x for server authentication
Hello everybody, this the first time I write on this forum, so please excuse me if I do something wrong. My objective is to authenticate servers in my customer's server farm, so that none can put an unauthorised server in place. I am thinking about u