riahc3 50 Â Team Colleague

@riahc, do the following:

switch e.getLocalizedMessage() with e.printStackTrace()
for a more complete error message, and convey the exact error message!

Great minds thing alike :P

I use those 2 methods when my web service has a issue and using that it sends a email to me with the errors.

It is solved so thank you.

riahc3 50 Â Team Colleague

Since I couldnt get it to work using Route A, I used Route B and it solved the problem.

There is more than one way to skin a cat they say :P

Thanks dantinkakkar

riahc3 50 Â Team Colleague

:\ lemme think

Same thing I thought every time I thought of this problem :P

Thank you for the help always :)

riahc3 50 Â Team Colleague

So now the question is why can't I do it in my original program?

riahc3 50 Â Team Colleague

Do it using absolute paths.

Jumped the gun :P and did it with absolute paths and it worked

riahc3 50 Â Team Colleague

This code in a complete other program:

import java.io.File;


public class BorrarArchivosFunciones {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{

		File f=new File("C:\\Archivos de programa\\MyEclipse for Spring\\Common\\plugins\\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\\tomcat\\bin\\200000110_1_135046720_1\\200000110_1_135046720.bmp");
		if (f.delete()==true)
		{
			System.out.println("Deleted");
		}
		else
		{
			System.out.println("Not deleted");
		}
	}

}

Perfectly deletes the file.

riahc3 50 Â Team Colleague

There're two things that I'd like to ask, now that you've cleared that up:

1. Did you try deleting with a separate piece of code in a separate file, that is, instead of doing it in the same program?

2. The method zipFolder(), does it close up everything?

1. No I didnt. Do I do it with a absolute pathname (as in: new File("C:\\folder\\anotherfolder\\thefile.bin") or do I do it relative? Absolute would obviously make my life easier :P
2. Yes, sorry about that. zipFolder closes everything also too.

riahc3 50 Â Team Colleague

In my main, when trying to delete it, it simply says unable to delete. Nothing else.

riahc3 50 Â Team Colleague

Hey, chill riahc, don't turn it into a battlezone. Just post your code, and I'll help you out with it!

I apoligize. Just really annoys me when "veteren" members try to treat everyone else like newcomers.

Here is the code to that binary file:

public class Generar_Binario 
{
	
	public void GenerarBinario(String corte)
	{
		File fe = new File(corte);
		File fd = new File("Path1.bin");
		int i=0;
				
		try 
		{
			FileOutputStream file_outpute = new FileOutputStream(fe);
			FileOutputStream file_outputd = new FileOutputStream(fd);
			DataOutputStream data_oute=new DataOutputStream(file_outpute);
			DataOutputStream data_outd=new DataOutputStream(file_outputd);
			BinaryOut ue=new BinaryOut(data_oute);// Parte de la liberia
			BinaryOut ud=new BinaryOut(data_outd);// Parte de la liberia
			
			for (i = 1; i < Globales.size_array; i++) 
			{
					ud.write(Long.reverseBytes(Double.doubleToRawLongBits(Globales.pos_servo_1[i])));
					ud.write(Long.reverseBytes(Double.doubleToRawLongBits(Globales.pos_servo_2[i])));															
			}
			
			ud.close();
			
			Globales.tabla_st3[0]=20;
			Globales.tabla_st3[1]=100;
			Globales.tabla_st3[2]=Globales.size_array*0.004;
			//Globales.tabla_st3[3]=0;
			Globales.tabla_st3[4]=60;
			
			for (i=0; i <=Globales.tabla_st3.length ; i++) 
			{
				if(Globales.tabla_st3[i]==Globales.CODIGO_FIN)
				{
					ue.write(Integer.reverseBytes((int)Globales.tabla_st3[i]));
					break;
				}
				ue.write(Integer.reverseBytes((int)Globales.tabla_st3[i]));
			}
				
			ue.close();
			ud.close();
			
			
			//Mas lineas
			
			file_outpute.close();
			file_outputd.close();
			data_oute.close();
			data_outd.close();
		} 
		catch (FileNotFoundException e) 
		{
			System.out.println("ERROR: No se puede encontrar el fichero: (" + e.getLocalizedMessage() + ")");
		} catch (IOException e) 
		{
			System.out.println("ERROR: No se puede cerrar bien el fichero: (" + e.getLocalizedMessage() + ")");
			
		}		 
				         	    	    		
	}
}

As you see on this end, I close it.........Now when I zip it up:

public void CrearEstructura(String archivo,int i)
	 {		 
		 File ff=new File("Path1.bin");
		 System.out.println("He creado el path bin");
		 new File(archivo+"/"+archivo).mkdirs(); 
		 File bin=new File(archivo+".bin"); 
		 String[] trozos=archivo.split("_");
		 String archivobmp=trozos[0]+"_"+trozos[1]+"_"+trozos[2];
		 System.out.println("El string resultante es: " + archivobmp);
		 File bmp=new File(archivobmp+".bmp");
		 bmp.renameTo(new File(archivo+"/"+archivobmp+".bmp"));			 
		 ff.renameTo(new File(archivo+"/"+archivo+"/"+ff.getName()));
		 bin.renameTo(new File(archivo+"/"+archivo+"/"+bin.getName()));
		 
	 }

First the structure I create for inside the zip (The variable "i" isnt implanted yet as I need …

riahc3 50 Â Team Colleague

Stul

I especifically said it was a binary file for that reason; so noone thinks it is a text file that can be opened in another program. Only our PLC can read it.

I am asking you, no fuck that, begging you to quote me where I said "can I have the code to" or "do you have code" or ANYTHING that asks for code. As a matter of fact, noone has said any code and the only logical question is if my OutputStream was closed. But please, go ahead, quote me.

I simply replied to your comment, which you obviously did not read what I posted, because if you did you would know it is a binary file, I was just going away on my lunch break and I did not ask for code at all, just tips on what it may be. And AFAIK you haven't volunteered to help out anyone, as you simple came into this thread with a attitude on your mine.

Here's another tip for you: Don't have anything useful to say in a polite matter? Don't post at all. Simple as that.

Last post towards you if you have nothing helpful to say.


Dant

Alright, I'm getting back to work right now so ill analize some of the code and see if I can post what you need that you might see where the problem is. 15-20 minutes. Thank you very much for your help.

riahc3 50 Â Team Colleague

Quoting on a cell phone is a bitch so ill just reply as normal

Dant - What I use to delete the BMP is that simple function from the Apache commons library. And the BMP is generated in the same program as I call that simple function.

Stul - First, calm the fuck down. That's first off. I haven't in any moment demanded anything or replied with a attitude until now. If you notice, I generate a BMP. Why on earth would I open that in Notepad?

More so, I never said "give me code". I have code and I know what it does but it won't delete it. I tried with the delete function in the File class as well, in case you think I still NEED code. I asked for tips why my code might not work

And last, I just said I went on my lunch break and that's why I couldn't put any code. As soon as I get back ill put some code.

Here is a tip for you: Next time instead of treating everyone with a attiude and like newcomers, READ THE ENTIRE THREAD. It will help you not look like a fool.

Thanks to the rest helping out :)

stultuske commented: wow-wee ... aren't we the adult. next time READ the actual posts, not just the ones you like -3
riahc3 50 Â Team Colleague

No, you don't close that. It's different. A little more code, please?

And before that, just try deleting the file with a separate piece of code after writing to it once. Like, try deleting it programmatically in a different program. If that doesn't work, give a little more code - the writing part.

(Lunch break :P )

There is also another file inside of another dir I cannot delete. It is a bin binary file and this seems to be closed (all streams in that part of code are close). Could it be something else?

Thanks and ill try to give you for info. Can't give you code as like I mentioned I'm on my lunch break and not at the PC

riahc3 50 Â Team Colleague

After generating the BMP file, did you close your Output Stream?

Not closing may be the cause.

When writing the image, I use ImageIO.write ....Not sure if I can close that or/and if that was what you ment...

riahc3 50 Â Team Colleague

Modified it to this and still nothing.......

DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `linkacorte`(vid_pedido int(11), vid_producto int(11),vtiempo varchar(50),vid_pastelero int(11),vcorte varchar(200),vnum int(2))
begin
declare campo varchar(20);
DECLARE EXIT HANDLER FOR SQLSTATE '42000'
    SELECT 'Ha introducido un campo incorrecto. Solo se permite 1,2 o 3';

if vnum=1 then
    set campo='programa_corte_1';
    SELECT 'Prueba 1';
elseif vnum=2 then
    set campo='programa_corte_2';
    SELECT 'Prueba 2';
elseif vnum=3 then
    set campo='programa_corte_3';
    SELECT 'Prueba 3';
else
CALL raise_error;
end if;
set @sqltext=concat('UPDATE pedidos_productos SET ',campo,'=',vcorte,' WHERE id_pedido=',vid_pedido,' AND id_producto=',vid_producto,' AND tiempo=',vtiempo,' AND id_pastelero=',vid_pastelero);
prepare stmt from @sqltext;
execute stmt;
deallocate prepare stmt;
#update pedidos_productos set @campo=vcorte where id_pedido=vid_pedido and id_producto=vid_producto and tiempo=vtiempo and id_pastelero=vid_pastelero;
commit;

end
riahc3 50 Â Team Colleague
Have you tried placing another BMP file and then trying to delete it? There may be a problem with the specific BMP file. Just give it a try, and if it still doesn't get erased, re-post; and I'll see what I can do.

Its a BMP I generate running the program (at mid point). But I dont use anything else except putting it in that zip file.

riahc3 50 Â Team Colleague

Hey

I have this code

FileUtils.forceDelete(new File(nombreprograma+".zip");
FileUtils.forceDelete(new File(nombreprograma+"/"+nombrebmp+".bmp"));

Deleting the zip inside of the root works perfect but for some reason the BMP inside of a folder, doesnt.

The error it gives is that it cannot delete the file, nothing else.

Any tips?

riahc3 50 Â Team Colleague

Hey

All of a suddent my Apache Tomcat server has broken. Very strange but I try going to http://localhost:8080 and I get a HTTP 400 error. How do I fix this as it is very strange that this suddenly appears. Using MyEclipse.


Note, I believe I installed NetBeans which installed its own Apache Tomcat server. I uninstalled that and it still doesnt work. Fucking NetBeans....

riahc3 50 Â Team Colleague

SELECT in a stored procedure does not display anything. Therefore you cannot use it for debugging.
In your 2nd sample you have a type: ANDA instead of AND.
campo is not the same variable as @campo.

The ANDA is a stupid error. Fixed.

How can I use campo instead of @campo..........?

New:

DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `linkacorte`(vid_pedido int(11), vid_producto int(11),vtiempo varchar(50),vid_pastelero int(11),vcorte varchar(200),vnum int(2))
begin
declare campo varchar(20);
DECLARE EXIT HANDLER FOR SQLSTATE '42000'
    SELECT 'Ha introducido un campo incorrecto. Solo se permite 1,2 o 3';

if vnum=1 then
    set campo='programa_corte_1';
    SELECT 'Prueba 1';
elseif vnum=2 then
    set campo='programa_corte_2';
    SELECT 'Prueba 2';
elseif vnum=3 then
    set campo='programa_corte_3';
    SELECT 'Prueba 3';
else
CALL raise_error;
end if;
set @sqltext=concat('UPDATE pedidos_productos SET ',campo,'=vcorte WHERE id_pedido=vid_pedido AND id_producto=vid_producto AND tiempo=vtiempo AND id_pastelero=vid_pastelero');
prepare stmt from @sqltext;
execute stmt;
deallocate prepare stmt;
#update pedidos_productos set @campo=vcorte where id_pedido=vid_pedido and id_producto=vid_producto and tiempo=vtiempo and id_pastelero=vid_pastelero;
commit;

end

It says " Unknown column 'vid_pedido' in 'where clause' ". Any ideas?

riahc3 50 Â Team Colleague

Calendar.getInstance(); really does get the latest time each time you execute it. but...

You have a machine that clocks at - I don't know but maybe 1GHz give or take a factor of 3? That's 1 million clock cycles per milliSec. That's can be a huge amount of calculation.
Also most ordinary desktop computers get the time from a simple traditional clock circuit that updates every 1/60 sec. So if you keep printing the time in mSec in a loop you will probably see it jumping in increments of 16 mSec. Not a lot you can do about that, other than go out and buy a proper workstation!

OK....then I guess it is just that. It cant get it EXACTLY EXACTLY because as you said, my PC is too "fast" lol....

Thanks

riahc3 50 Â Team Colleague

Also tried this:

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `linkacorte`(vid_pedido int(11), vid_producto int(11),vtiempo varchar(50),vid_pastelero int(11),vcorte varchar(200),vnum int(2))
begin
declare campo varchar(20);
DECLARE EXIT HANDLER FOR SQLSTATE '42000'
    SELECT 'Ha introducido un campo incorrecto. Solo se permite 1,2 o 3';

if vnum=1 then
    set campo='programa_corte_1';
    SELECT 'Prueba 1';
elseif vnum=2 then
    set campo='programa_corte_2';
    SELECT 'Prueba 2';
elseif vnum=3 then
    set campo='programa_corte_3';
    SELECT 'Prueba 3';
else
CALL raise_error;
end if;
set @sqltext=concat('UPDATE pedidos_productos SET ',@campo,'=vcorte WHERE id_pedido=vid_pedido ANDA id_producto=vid_producto AND tiempo=vtiempo AND id_pastelero=vid_pastelero');
    SELECT 'prepare';
prepare stmt from @sqltext;
    SELECT 'execute';
execute stmt;
deallocate prepare stmt;
#update pedidos_productos set @campo=vcorte where id_pedido=vid_pedido and id_producto=vid_producto and tiempo=vtiempo and #id_pastelero=vid_pastelero;
    SELECT 'commit';
commit;

end

Nothing at all. The select doesnt even display I believe.

riahc3 50 Â Team Colleague

I have this:

DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `linkacorte`(vid_pedido int(11), vid_producto int(11),vtiempo varchar(50),vid_pastelero int(11),vcorte varchar(200),vnum int(2))
begin
declare campo varchar(20);
DECLARE EXIT HANDLER FOR SQLSTATE '42000'
    SELECT 'Ha introducido un campo incorrecto. Solo se permite 1,2 o 3';

if vnum=1 then
    set campo='programa_corte_1';
elseif vnum=2 then
    set campo='programa_corte_2';
elseif vnum=3 then
    set campo='programa_corte_3';
else
CALL raise_error;
end if;

update pedidos_productos set campo=vcorte where id_pedido=vid_pedido and id_producto=vid_producto and tiempo=vtiempo and id_pastelero=vid_pastelero;
commit;

end

Now I need "campo" to be a column in a row but depending on which number I choose, it is a different one. How can I do this? Thanks.

riahc3 50 Â Team Colleague

I created this:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class DateClass
{
	
	public String GetTimeNow()
	{	
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd EEE HH:mm:ss.SSS",Locale.getDefault());
		Calendar cal = Calendar.getInstance();
		return dateFormat.format(cal.getTime()).toUpperCase();
	}

}

But when I try:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class SomeOtherClass
{
	
	public void SomeOtherFunction()
	{	
            DateClass d=new DateClass();
            System.out.println("Time now 1: " + d.GetTimeNow());
            System.out.println("Time now 2: " + d.GetTimeNow());
            System.out.println("Time now 3: " + d.GetTimeNow());
	}

}

All three lines are the same when there should be at least a milisecond of difference right? What Im wondering if it gets the same time or if it is different (each calling) and it really is that quick to run the code.

Thank you

riahc3 50 Â Team Colleague

PDF libraries like iText and Apache PDFBox can help you with it

I know about iText but does that support straight HTML code writing to a PDF?

riahc3 50 Â Team Colleague

FINALLY......what I did is that I unzipped the file that I originally created by searching for that BMP inside the ZIP file. That creates it back to where I need and i creates the PDF perfectly.

Ive been about a week with this so finally.....

riahc3 50 Â Team Colleague

Damn......oh well. Ill include some details in the email but I dont like this "solution"....

riahc3 50 Â Team Colleague

well it would help posting your code, and the error message and line number and the output of your new path you are trying...

Its a lot of code and kind of complicated but I think it is around here:

String ruta= System.getProperty("user.dir")+ "\\";													//ruta=ruta+ "\\";																						System.out.println("La ruta es: " + ruta);											System.out.println("Voy a crear un zip " + System.getProperty("user.dir") + " " + binpath + " " + projectpath + " " + realprojectpath );										Crear_Zip z=new Crear_Zip();											String[] trozos=nombreprograma.split("_");												String nombrebmp=trozos[0]+"_"+trozos[1]+"_"+trozos[2];										System.out.println("El string del BMP es: " + nombrebmp);											//FileUtils.copyFile(new File(nombreprograma+"\\"+nombrebmp+".bmp"), new File(nombrebmp+".bmp"));																																	System.out.println("Voy a copiar desde: " + ruta+nombreprograma+"\\"+nombrebmp+".bmp");											System.out.println("Voy a copiar ha: " + nombrebmp+".bmp");																																	//String desde=ruta+nombreprograma+"\\"+nombrebmp+".bmp";																					String nuevodesde=realprojectpath+nombreprograma+"/"+nombrebmp+".bmp";																			System.out.println("nuevo: " + nuevodesde);																				FileUtils.copyFile(new File(nuevodesde), new File(nombrebmp+".bmp"));

And there is the output:

La ruta es: C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin\
Voy a crear un zip C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin file:/C:/Archivos de programa/MyEclipse for Spring/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806/tomcat/lib file:/C:/Archivos de programa/MyEclipse for Spring/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806/tomcat/ C:/Archivos de programa/MyEclipse for Spring/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806/tomcat/
El string del BMP es: 234_99_165544300
Voy a copiar desde: C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin\234_99_165544300_1\234_99_165544300.bmp
Voy a copiar ha: 234_99_165544300.bmp
nuevo: C:/Archivos de programa/MyEclipse for Spring/Common/plugins/com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806/tomcat/234_99_165544300_1/234_99_165544300.bmp
Ha fallado: Rollback time!
2012-02-16 JUE 16:55:44.300 : Ha ocurrido un error generico: Source 'C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\234_99_165544300_1\234_99_165544300.bmp' does not exist

riahc3 50 Â Team Colleague

what do you mean what line?

You could also just use a lastIndexOf("\\"), which will get the the position of the last '\' and then you just replace it so then you;d have:C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806

What instruction line do I use?

Yeah, used lastindex as a alternative I suppose but after finding the path, I cant get it to copy. It says that it cant find the path when the path is perfectly correct as I print it out before I do it and when the exception jumps, the path is exactly the same.....

What could be wrong? Man this is killing me :(

riahc3 50 Â Team Colleague

Ah, regular expresions......OK.......

But what line exactly would I use? Not too sure...

riahc3 50 Â Team Colleague

You could feed the path into [regexp (.+)/.+] to take off the last folder in the path.

How do I do that? Dont understand that exactly....

What is regexp?

riahc3 50 Â Team Colleague

If Im located there, how would I go up a directory (To "C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat" ) ?

riahc3 50 Â Team Colleague

Java 6 only.


The thing is I cant get the directoy where it saves it which is

"C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat\bin"

It is driving me nuts.

riahc3 50 Â Team Colleague

Maybe it is YOU!
Junk mail filters usually work on WHERE e-mail is coming FROM (ie. your domain).

The thing is then why does the PDF work and not the zip...

riahc3 50 Â Team Colleague

Hey

I have a folder in my current working path and I want to make a copy of a file inside it to the the current working path. Its kind of a dumb question, I know, but how do it do it?

Thank you.

riahc3 50 Â Team Colleague

The PDF now goes to the inbox for some reason....

riahc3 50 Â Team Colleague

Hey I have this following code:

try
        {
            // Connection props
            Properties props = new Properties();
            props.setProperty("mail.smtp.host", host);
            props.setProperty("mail.smtp.starttls.enable", "true");
            props.setProperty("mail.smtp.port", "25");
            props.setProperty("mail.smtp.user", usuario);
            props.setProperty("mail.smtp.auth", "true");
            
            // Prepare the session
            Session session = Session.getDefaultInstance(props);

            // Constuct the message
            MimeMessage message = new MimeMessage(session);
            /*Test*/   message.setHeader("Content-Type", "multipart/mixed");
            message.setFrom(new InternetAddress(CorreoOrigen));
            message.addRecipient(Message.RecipientType.TO,new InternetAddress(CorreoDestino));
            
            message.setSubject(asunto);
       
            
            Multipart mp = new MimeMultipart(); 
            BodyPart texto=new MimeBodyPart();
            /*Test*/   texto.setHeader("Content-Type", "multipart/mixed");
            texto.setContent(mensaje,"text/html");
            mp.addBodyPart(texto);
            MimeBodyPart ajunto=new MimeBodyPart();
            ajunto.setHeader("Content-Type", "multipart/mixed");
            ajunto.attachFile(NombreArchivo);
            mp.addBodyPart(ajunto);
            
            message.setContent(mp);
            
         //   message.setContent(mp, "text/html");
            
            // We send it
            Transport t = session.getTransport("smtp");
            t.connect(usuario,contraseña);
            t.sendMessage(message, message.getAllRecipients());

            // Close.
            t.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

Everytime I send it, it gets sent to the junk folder in Outlook 2007 and I rather it good directly to inbox. It contains simple text (nothing more, I put HTML in case we want to make it "prettier" in the future) and a attachment which can be a generated PDF or a generated ZIP. Once moved to the inbox, the PDF and the ZIP and be downloaded perfectly and opened and its content can be viewed so there is nothing stange or anything about it.

How can I fix this so it goes directly to the inbox? Thank you.

BTW, /*Test*/ lines did not work.

riahc3 50 Â Team Colleague

Perfect :)

If it outputs in the complied language, oh well.....

riahc3 50 Â Team Colleague

binary

As a binary file? Is there some easier way and much more simple?

riahc3 50 Â Team Colleague

The difference is that with SSS, you are providing a padding for the millisecond field. So if the milliseconds elapsed are 9, it'll be shown as "009". If you instead had just "S", it would be shown as "9". Regarding the 'E' format specifier, you can simply replace the 3 E's with a single E without any visible change in the output. If you have more than or equal to 4 E's, it'll use the full form of the day of the week. For e.g. with a single E, the output would be 'Fri' but with 4 E's it would be 'Friday'.

Also, the locale for a date formatter is by default the default locale so you can drop the second argument to the SimpleDateFormat constructor.

Great, I perfer the 3 digit milisecond count.

Is the locale the default system locale or the default locale from the machine the code was complied from? Besides, doesnt hurt to leave it.

riahc3 50 Â Team Colleague

Hey

I want to use something like Dreamweaver to design a HTML page. (Excluding all the links to pictures and such) how do I get Java to get all that and convert it to a well designed PDF document like I was seeing in Dreamweaver?

Thanks

riahc3 50 Â Team Colleague

Hey

Im wondering if various users can a web services at the same time and execute the same code to generate something. Does it do it at the same time on difference threads/objects? Is it FIFO (First in, first out)?

Questions like those.

Thank you.

riahc3 50 Â Team Colleague

Hmm I used (before I read your replies):

DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd EEE HH:mm:ss.SSS",Locale.getDefault());

Difference?

riahc3 50 Â Team Colleague

Use an instance of SimpleDateFormat to format a new Date()

Yes...

DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy - HH:mm:ss");

But how do I include the miliseconds (and the localized version of the day of the week)?

riahc3 50 Â Team Colleague

Hey

I want to get the date and time with miliseconds in a format such as:

2012-02-09 12:41:52.982

or

2012-02-09 16:41:52.129

How can I do this in Java?

(If I can get a localized version of "Tuesday" as "Tues" as well even better but if not, I dont mind. Something stupid and unrequired.)

riahc3 50 Â Team Colleague

Hey

Im looking to store date and time with miliseconds in TIMESTAMP column but it seems to be a new feature so Im not sure exactly how to store it. current_timestamp() doesnt allow me to do this.

Im willing to change the column to some other datatype as the database is new and for now, nothing depends on it.

How can I do it?

Thanks

riahc3 50 Â Team Colleague

uhm yes im sure you can, because it wont proceed with the command until its gets a 'Y' look into what jamescherrill was saying you can use input and outputstreams, to get the replies from the shell. But now your talking c#? uhm youare definitely not going to get the best c# answers here

Im trying to see which language is easier to do this in.
C# isnt giving me much choices...

But i just thought of what you said. If you create a shell script and don't supply a /y switch it will cause the console to wait and ask for input(which is where you are asking how do you respond to it), but if you supply the /y switch it wont ask and it would just delete the file. The same will be for other shells, why do you want to give a command thats going to wait for another command as a response? because as i see it, say now your app allows a person to delete a file, your app would then let them select the file to delete, then your app would ask if they are sure, and if they click yes, you will then send the command with the correct switches(to not produce any output to the user and aslo to not produce a response you have to act on). The way i see what your asking is you want them to say delete this file, and immediately you delete it but …

riahc3 50 Â Team Colleague

Nothing like this exists for C#?

riahc3 50 Â Team Colleague

If I start another shell (such as bash or "someshell") from CMD and it supports the command "deleteall" and I have to answer "Y" to confirm, that is the problem: Can I answer "Y" from my C# program?

riahc3 50 Â Team Colleague

So you want a java program to act as a console much like command prompt? you want to be able to type echo hello in your java console and it must output:"hello" have i understood you correctly?

In the end, yes. This is something similar to what I want to do.

You can run batch jobs as at the command prompt frim Java by using ProcessBuilder (Google for examples and details), but you may get a far better solution all round by embedding a JavaScript script in your Java program. Check out scripting language support in Java (Java 1.6 or later).

Javascript is not a strong point on me so I rather leave it at just Java

if JamesCherrill is on track with what you asked then i would also suggest maybe just writing to a batch file and executing it, thats what i did in my one app:

From with this is that I cant answer things from other shells right? Thats why I put the "someshell" example. I know I can print out echo world, thats not a problem.

riahc3 50 Â Team Colleague

Hey

I would like to do a ".bat' type of command in Java: Something automated. Im trying to run a program that is sort of shell itself so it just need to input certain words/letters into the command line box. Lets see if I can explain it better with a theoretical example:


[start of cmd]
C:\>echo hello
hello

C:\>someshell
[start of someshell: It has a command deleteall that deletes everything. It has a command bye that exits someshell]
> deleteall
Are you sure you want to delete all? [Y/N] Y
Everything has been deleted!
> bye
[end of someshell]
C:\>exit
[end of cmd]


As you can see the things I would have to type in the prompt if in cmd are:

echo hello
someshell
deleteall
Y
bye
exit

The biggest problem is the "Y" I believe, since cmd invokes someshell which at the same time and during invokes deleteall.

How could I do this in Java? Thanks.

riahc3 50 Â Team Colleague

Hey

I would like to do a ".bat' type of command in C#: Something automated. Im trying to run a program that is sort of shell itself so it just need to input certain words/letters into the command line box. Lets see if I can explain it better with a theoretical example:


[start of cmd]
C:\>echo hello
hello

C:\>someshell
[start of someshell: It has a command deleteall that deletes everything. It has a command bye that exits someshell]
> deleteall
Are you sure you want to delete all? [Y/N] Y
Everything has been deleted!
> bye
[end of someshell]
C:\>exit
[end of cmd]


As you can see the things I would have to type in the prompt if in cmd are:

echo hello
someshell
deleteall
Y
bye
exit

The biggest problem is the "Y" I believe, since cmd invokes someshell which at the same time and during invokes deleteall.

How could I do this in C#? Thanks.