Null in OSB Poinet alert
Hello
When I try to send an email on als it generates null pointer error in the newspapers, I tried to find the cause but I'm stuck, please help me guyz...
# < 16 sep, 2014 12:49:25 IST > < error > < ALSB alert engine of rules > < mann-ncr-sandee > < ServiceBusSamples > < pool-2-wire-1 > < < anonymous > > <>< bb95dafb3717109e:-3062fb57:1487d2dfba1: - 8000-0000000000000003 > < 1410851965016 > < BEA-394004 > < cannot call to action e-mail belongs to alert destination dbConnection/AlertDestination_SLA AlertDestination. Resource: BusinessService dbConnection/business-service/PROC_CONSPOLIZASTRABAJADOR_db. Name of the alert rule: My_SLA.
com.bea.wli.sb.transports.TransportException
at com.bea.wli.sb.transports.email.EmailOutboundMessageContext.send(EmailOutboundMessageContext.java:81)
at com.bea.wli.sb.transports.email.EmailTransportProvider.sendMessageAsync(EmailTransportProvider.java:152)
at sun.reflect.GeneratedMethodAccessor662.invoke (unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
to com.bea.wli.sb.transports.Util$ 1.invoke(Util.java:83)
to $Proxy131.sendMessageAsync (Unknown Source)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageWithoutService(TransportManagerImpl.java:513)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:440)
to com.bea.wli.sb.init.FrameworkStarter$ TransportServiceImpl.sendMessageAsync (FrameworkStarter.java:402)
at com.bea.alsb.alert.action.email.EmailActionProvider.executeAction(EmailActionProvider.java:204)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.executeProviderAction(AlertDestinationHandlerImpl.java:95)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.sendAlertToDestination(AlertDestinationHandlerImpl.java:76)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.sendAlertToDestination(AlertDestinationHandlerImpl.java:64)
at com.bea.alsb.alert.sla.SlaAlertManager.generateAlert(SlaAlertManager.java:149)
in com.bea.alsb.alert.sla.SlaAlertManager.access$ 100 (SlaAlertManager.java:33)
to com.bea.alsb.alert.sla.SlaAlertManager$ RuleListenerForAlertGeneration.onRuleTrue (SlaAlertManager.java:227)
to com.bea.alsb.rule.RuleEngine$ ListenerInvocation.invokeListener (RuleEngine.java:76)
to com.bea.alsb.rule.RuleEngine$ ListenerInvocation.access$ 000 (RuleEngine.java:61)
at com.bea.alsb.rule.RuleEngine.addFact(RuleEngine.java:115)
at com.bea.alsb.alert.sla.SlaAlertManager.intervalCompleted(SlaAlertManager.java:202)
to com.bea.alsb.alert.sla.TaskCollector$ RuleEvaluationTask.run (TaskCollector.java:177)
to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:441)
to java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:139)
to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:886)
to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:909)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at com.bea.wli.sb.transports.email.util.EmailUtil.send(EmailUtil.java:288)
at com.bea.wli.sb.transports.email.EmailOutboundMessageContext.send(EmailOutboundMessageContext.java:69)
at com.bea.wli.sb.transports.email.EmailTransportProvider.sendMessageAsync(EmailTransportProvider.java:152)
at sun.reflect.GeneratedMethodAccessor662.invoke (unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
to com.bea.wli.sb.transports.Util$ 1.invoke(Util.java:83)
to $Proxy131.sendMessageAsync (Unknown Source)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageWithoutService(TransportManagerImpl.java:512)
at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:440)
to com.bea.wli.sb.init.FrameworkStarter$ TransportServiceImpl.sendMessageAsync (FrameworkStarter.java:402)
at com.bea.alsb.alert.action.email.EmailActionProvider.executeAction(EmailActionProvider.java:202)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.executeProviderAction(AlertDestinationHandlerImpl.java:95)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.sendAlertToDestination(AlertDestinationHandlerImpl.java:76)
at com.bea.alsb.alert.AlertDestinationHandlerImpl.sendAlertToDestination(AlertDestinationHandlerImpl.java:64)
at com.bea.alsb.alert.sla.SlaAlertManager.generateAlert(SlaAlertManager.java:149)
in com.bea.alsb.alert.sla.SlaAlertManager.access$ 100 (SlaAlertManager.java:33)
to com.bea.alsb.alert.sla.SlaAlertManager$ RuleListenerForAlertGeneration.onRuleTrue (SlaAlertManager.java:227)
to com.bea.alsb.rule.RuleEngine$ ListenerInvocation.invokeListener (RuleEngine.java:76)
to com.bea.alsb.rule.RuleEngine$ ListenerInvocation.access$ 000 (RuleEngine.java:61)
at com.bea.alsb.rule.RuleEngine.addFact(RuleEngine.java:115)
at com.bea.alsb.alert.sla.SlaAlertManager.intervalCompleted(SlaAlertManager.java:198)
to com.bea.alsb.alert.sla.TaskCollector$ RuleEvaluationTask.run (TaskCollector.java:177)
to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:441)
to java.util.concurrent.FutureTask$ Sync.innerRun (FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:886)
to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Which exact group of hotfixes OSB 11 g version you are on? PS5 and PS6?
The exception, he said EmailUtil.java:288 line lift the NPE. There may be changes of code between versions fixes group.
Until unless I know that release, I couldn't know what line throws the exception.
Tags: Fusion Middleware
Similar Questions
-
Why the cfreturn is null?
I have mandated a call to a cfc which is a ftp get into a local temporary file. Then he reads the file and is supposed to return the content of the file as a string cfreturn. I know the code works, when I remove CFC in a file usually cfm, it does exactly what is expected
However, in my proxy callBackHandler, the return of cfc is null.
< cfajaxproxy cfc = "ftpfunc" jsclassname = "jsobj" / >
function getFTP() {}
...
var instance = new jsobj();
instance.setCallbackHandler (ftpSuccess);
instance.setErrorHandler (ftpError);
instance.setReturnFormat ('plain');
instance.getJCL (lpar, remoteFile, userName, password);
}
function ftpSuccess (ftpReturn)
{
If (ftpReturn.length == 0)
Here thrown error: "ftpReturn is Null".
{
Alert ("your FTP get returned an empty file");
}
}
ion says:
Can I prevent it from executing onLoad?
Hi ion,
You're welcome and Yes. Can you please try this:
Application.CFC
----------------------
component {myIdName = "TestCFAjaxproxyCFC" ;}
Text.txt
----------------------
my text
MyCFC.cfc
----------------------
component {remote string function myCFCFunction (string required myArg) {return fileRead(expandPath("./text.txt")) & '-' & ARGUMENTS.myArg ;}}}}
index.cfm
----------------------
function myCallbackHandler(result) {
alert(result);
}
function myErrorHandler(statusCode, statusMsg) {
alert('Status: ' + statusCode + ', ' + statusMsg);
}
function myJSFunction() {
var instance = new myCFCJSObj();
instance.setCallbackHandler(myCallbackHandler);
instance.setErrorHandler(myErrorHandler);
instance.setReturnFormat('plain');
instance.myCFCFunction(document.getElementById("myfield").value);
}
//myJSFunction();
By clicking 'submit' should attract the attention of "my text-foobar.
Thank you
-Aaron
-
I use the code below for form validation
var x is return ["form2"] ["weeks"] .value;.
If ("x == null | x ==" ")
{
Alert ("duration must be checked");
Returns false;
}
but the weeks is actually the radio buttons
< input type = "radio" value = "364" name = 'weeks' / >
< input type = "radio" value = "301" name = 'weeks' / >
How to convert the code above works with a radio button
Thank you
in advance
They have demos on their website which should give you a complete overview.
You can also download the file source here: http://jquery.bassistance.de/validate/jquery-validation-1.9.0.zip
This kit includes demos, CSS, JS and all files associated with. They should help you get started.
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head><title>Test Boxes</title> <script type="text/javascript"> var svg; var svgns="http://www.w3.org/2000/svg"; var g1,g2,g3; // wrap,main,cont var a1,b1,c1; // buttons function rct(x,y,w,h,s,f) { var rc; rc=document.createElementNS(svgns,'rect'); rc.setAttributeNS(svgns,"x",x); rc.setAttributeNS(svgns,"y",y); rc.setAttributeNS(svgns,"width",w); rc.setAttributeNS(svgns,"height",h); rc.setAttributeNS(svgns,"stroke",s); rc.setAttributeNS(svgns,"fill",f); return rc; } function txt(id,x,y,msg) { var cc=document.createTextNode(msg); var tx=document.createElementNS(svgns,"text"); tx.setAttributeNS(svgns,"id",id); tx.setAttributeNS(svgns,"x",x); tx.setAttributeNS(svgns,"y",y); tx.appendChild(cc); return tx; } function doBox(id,par,x,y,w,h,s,f) { var grp,bx,tx,xt,yt; grp=document.createElementNS(svgns,"g"); grp.setAttribute("id",id); bx=rct(x,y,w,h,s,f); xt=parseInt(x,10)+6+' '; yt=parseInt(y,10)+16+' '; alert("DOBOX x,y="+xt+','+yt); tx=txt(null,xt,yt,id); grp.appendChild(bx); grp.appendChild(tx); par.appendChild(grp); return grp; } function initSVG() { svg=document.createElementNS(svgns,'svg'); svg.setAttributeNS(svgns,'width','250'); svg.setAttributeNS(svgns,'height','190'); svg.setAttributeNS(svgns,'version','1.1'); document.body.appendChild(svg); return svg; } function init(evt) { svg=initSVG(); alert("INIT svg="+svg); g1=doBox("wrap",svg,"10","10","230","170","#000","#999"); g2=doBox("main",g1,"30","40","190","120","#000","#bbb"); g3=doBox("cont",g2,"50","70","150","70","#000","#ddd"); a1=doBox("A1",g3,"70","100","30","20","#000","#fff"); b1=doBox("B1",g3,"110","100","30","20","#000","#fff"); c1=doBox("C1",g3,"150","100","30","20","#000","#fff"); } </script> </head> <body onload="init()"> </body> </html> <?xml version="1.0" standalone="no"?> <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg" width="250" height="250" onload="init(evt)"> <script type="text/javascript"> var svg; var svgns="http://www.w3.org/2000/svg"; var g1,g2,g3; // wrap,main,cont var a1,b1,c1; // buttons function rct(x,y,w,h,s,f) { var rc; rc=document.createElementNS(svgns,'rect'); rc.setAttributeNS(svgns,"x",x); rc.setAttributeNS(svgns,"y",y); rc.setAttributeNS(svgns,"width",w); rc.setAttributeNS(svgns,"height",h); rc.setAttributeNS(svgns,"stroke",s); rc.setAttributeNS(svgns,"fill",f); return rc; } function txt(id,x,y,msg) { var cc=document.createTextNode(msg); var tx=document.createElementNS(svgns,"text"); tx.setAttributeNS(svgns,"id",id); tx.setAttributeNS(svgns,"x",x); tx.setAttributeNS(svgns,"y",y); tx.appendChild(cc); return tx; } function doBox(id,par,x,y,w,h,s,f) { var grp,bx,tx,xt,yt; grp=document.createElementNS(svgns,"g"); grp.setAttribute("id",id); bx=rct(x,y,w,h,s,f); xt=parseInt(x,10)+6+' '; yt=parseInt(y,10)+16+' '; tx=txt(null,xt,yt,id); alert("DOBOX x,y="+xt+','+yt); grp.appendChild(bx); grp.appendChild(tx); par.appendChild(grp); return grp; } function init(evt) { svg=evt.target.ownerDocument.documentElement; alert("INIT svg="+svg); g1=doBox("wrap",svg,"10","10","230","170","#000","#999"); g2=doBox("main",g1,"30","40","190","120","#000","#bbb"); g3=doBox("cont",g2,"50","70","150","70","#000","#ddd"); a1=doBox("A1",g3,"70","100","30","20","#000","#fff"); b1=doBox("B1",g3,"110","100","30","20","#000","#fff"); c1=doBox("C1",g3,"150","100","30","20","#000","#fff"); } </script> </svg>
A good place to ask for advice on web development is to the 'Web Standards Development/evangelism' MozillaZine forum.
Aid to this forum are better informed on issues related to web development.
You must register on MozillaZine forum site to post in this forum. -
BitmapField consumes all clicks on the screen
Hello
I hope someone can help me with this problem: I have a screen that has only BitmapField is on. When you click on this 'something' BitmapField should be here which works very well.
The problem is that even if I click elsewhere on the screen the 'click' fires.
This is the main code on the screen:
VerticalFieldManager view = new VerticalFieldManager(); Bitmap bm = Bitmap.getBitmapResource("image.jpg"); // size 60x60 MyBitmapField bmf = new MyBitmapField(bm, BitmapField.FOCUSABLE); bmf.setChangeListener(this); view.add(bmf); add(view);
And that the implementation of the 'MyBitmapField ':
public class MyBitmapField extends BitmapField { public MyBitmapField(Bitmap bitmap) { super(bitmap); } public MyBitmapField(Bitmap bitmap, long style) { super(bitmap, style); } protected boolean navigationClick(int status, int time) { FieldChangeListener listener = getChangeListener(); if (null != listener) { Dialog.alert("Clicked"); listener.fieldChanged(this, 1); return true; } return super.navigationClick(status, time); } protected boolean touchEvent(TouchEvent message) { /* if (TouchEvent.CLICK == message.getEvent()) { int index = this.getManager().getFieldAtLocation(message.getX(1), message.getY(1)); if (index == -1) return super.touchEvent(message); Field field = this.getManager().getField(index); if (field != this) return super.touchEvent(message); FieldChangeListener listener = getChangeListener(); if (null != listener) listener.fieldChanged(this, 1); }*/ return super.touchEvent(message); } }
In the touchEvent method is a point that I also tried - but that didn't work either.
The fieldChanged Manager is as usual:
public void fieldChanged(Field field, int arg) { if (field instanceof MyBitmapField) { MyBitmapField bmf = (MyBitmapField) field; Dialog.alert("Clicked: " + Integer.toString(arg)); } }
I'm actually on the 9550 Simulator.
Can someone please help me and tell me what I need to do to avoid that the click event is fired even if I click outside the BitmapField (I also put a border, just to make it visible, it is not expanded).
Thank you very much
That's exactly how BlackBerry works, even if it is IMHO pretty buggy: the key CLICK event is translated into navigationClick() in the field that currently has the focus. The problem lies in the fact that EVENT moves the focus to the field under him that if there is an active field where you press the screen, otherwise the focus remains where it is.
To overcome this obstacle, program your touchEvent similar to this:
protected boolean touchEvent(TouchEvent message) { if (TouchEvent.CLICK == message.getEvent()) { int x = message.getX(1); int y = message.getY(1); XYRect myExtent; getExtent(myExtent); myExtent.translate(0, 0); // getX, getY values are relative to this field's upper-left corner if (!myExtent.contains(x, y)) { return true; } } return super.touchEvent(message); }
You can allow a 'near miss' avoid the frustration of users - extend the myExtent in any quantity you want of each side.
-
Picture taken with the camera...
Hi all
I am currently facing a lot of problems to use the camera. After days and days of trying to change/adapt my code, you are my last hope...
What I want to do is:
- Departure from camera
- The take a snapshot
- Resizing in my application
- Store in the FET (don't cause me problems)
Here is part of my code:
- Beginning camera & look the file system
public CameraBlackBerry() { // invoking camera UiApplication.getApplication().addFileSystemJournalListener(this); Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments()); }
2 get path to the new image and transfer to another class
public void fileJournalChanged() { AIDOO.debug(">>>>>>>> FS MODIFIED !!!"); Application app = UiApplication.getApplication(); app.removeFileSystemJournalListener(this); long USN = FileSystemJournal.getNextUSN(); for (long i = USN - 1; i >= 0; i--) { System.out.println(">>>>>>>> FS MODIFIED !!! : " + i); FileSystemJournalEntry entry = FileSystemJournal.getEntry(i); if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED) { path = entry.getPath(); if (path.endsWith(".jpg")) {// Try to kill camera app here by injecting esc. HAD to remove condition '&& path.indexOf("IMG") >= 0' because changed in OS6 //#ifdef DebugMode AIDOO.debug(">>>>>>>> Found a file added ending with jpg @ :" + path); //#endif // Get out of camera app EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 0); inject.post(); inject.post(); app.requestForeground(); AIDOO.currentCameraBlackBerry = null; new CameraBlackBerryFileHandler(path); break; } } if (entry == null) { // we didn't find an entry. break; } } }
3. how to get a FileConnection
private FileConnection openFile() { try { FileConnection file = (FileConnection) Connector.open("file://" + path); if (file != null) { boolean fileExists = file.exists(); int existCount = 0; while (!fileExists && existCount < 50) { AIDOO.debug("fileExists sleeping for 100 msecond"); Thread.sleep(100); fileExists = file.exists(); existCount++; } if (existCount < 50 && fileExists) { return file; } else { return null; } } else { return null; } } catch (InterruptedException ex) { alerta = new Alert(Lng.getString(Lng.a_alert), "InterruptedException while opening picture connection : " + ex.getMessage() + " " + ex.getClass() + " path :" + path, null, null); AIDOO.handleError("Exception while opening picture connection", ex); return null; } catch (IllegalArgumentException ex) { alerta = new Alert(Lng.getString(Lng.a_alert), "IllegalArgumentException while opening picture connection : " + ex.getMessage() + " " + ex.getClass() + " path :" + path, null, null); AIDOO.handleError("Exception while opening picture connection", ex); return null; } catch (ConnectionNotFoundException ex) { alerta = new Alert(Lng.getString(Lng.a_alert), "ConnectionNotFoundException while opening picture connection : " + ex.getMessage() + " " + ex.getClass() + " path :" + path, null, null); AIDOO.handleError("Exception while opening picture connection", ex); return null; } catch (IOException ex) { alerta = new Alert(Lng.getString(Lng.a_alert), "IOException while opening picture connection : " + ex.getMessage() + " " + ex.getClass() + " path :" + path, null, null); AIDOO.handleError("Exception while opening picture connection", ex); return null; } }
4 getting the stream
private DataInputStream tryAccessingImage(FileConnection file) { DataInputStream is = null; nbBytes = 0; try { is = file.openDataInputStream(); } catch (IOException ex) { return null; } if (is != null && file.canRead()) { try { nbBytes = file.fileSize(); isAvailNbBytes = is.available(); int unreadableCount = 0; while (nbBytes <= 0 && unreadableCount < 50) { AIDOO.debug("fileSize problem, sleeping for 100 msecond"); Thread.sleep(100); nbBytes = file.fileSize(); unreadableCount++; } if (unreadableCount < 50) { return is; } else { return null; } } catch (InterruptedException ex) { String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "(2) " + ex.getMessage() + "/ InterruptedException can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path; append(problem, imageProblem); alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null); return null; } catch (IOException ex) { String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "(2) " + ex.getMessage() + "/ IOException2 can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path; append(problem, imageProblem); alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null); return null; } } else { alerta = new Alert(Lng.getString(Lng.a_alert), Lng.getString(Lng.pic_couldnt_be_stored) + "(2) / InterruptedException can read file : " + file.canRead() + " " + nbBytes + "bytes / " + path, null, null); return null; } }
5 reading the stream
private byte[] readingImage(DataInputStream is) { byte[] raw = new byte[(int) nbBytes]; isReadBytes = -2; // -2 to differ from eventual -1, 0 or n (positive) returned by read() try { isReadBytes = is.read(raw); return raw; } catch (IOException ex) { String problem = Lng.getString(Lng.pic_couldnt_be_stored) + "readingImage " + ex.getMessage() + "/ IOException1 can read file : " + nbBytes + "bytes / " + path; append(problem, imageProblem); alerta = new Alert(Lng.getString(Lng.a_alert), problem, null, null); return null; } }
6 then I do the following
try { is.close(); screenWidth /= 4; screenWidth *= 3; screenHeight /= 4; screenHeight *= 3; append("resizing image", imageBlank16); raw = resizeImage(raw, 640, 480); append("resize for preview image", imageBlank16); byte rawPreview[] = resizeImage(raw, screenWidth, screenHeight); AIDOO.debug("ok here"); append("creating preview image", imageBlank16); imagePreview = Image.createImage(rawPreview, 0, rawPreview.length); AIDOO.debug("ok here2"); String devinceInfo = DeviceInfo.getSoftwareVersion(); AIDOO.debug(devinceInfo); AIDOO.debug("ok here3"); //#if !BlackBerry_OS_46 && !BlackBerry_Older_than_46 //raw = resizeImage(raw); nbBytes = raw.length; //#endif if (nbBytes > CAMERA_IMAGE_MAX_SIZE) { alerta = new Alert(Lng.getString(Lng.a_alert), Lng.getString(Lng.pic_size_is_too_large) + " : " + nbBytes, null, null); System.out.println("error 2 after insert"); returnValue = false; } } catch (IOException ioe) { alerta = new Alert(Lng.getString(Lng.a_alert), "IOException : " + ioe.getMessage() + "available Bytes : " + nbBytes, null, null); AIDOO.handleError("IO problem while saving picture 0", ioe); System.out.println("error 2 after insert"); returnValue = false; }
7 Behold my image resizing function
private byte[] resizeImage(byte[] image, int width, int height) { AIDOO.debug("Start of image resizing"); Bitmap bmp1 = null, bmp2 = null; try { bmp1 = Bitmap.createBitmapFromBytes(image, 0, -1, 1); bmp2 = new Bitmap(width, height); } catch (IllegalArgumentException ex) { throw new IllegalArgumentException("exception while createBitmapFromBytes()" + ex.getMessage() + "isAvailNbBytes = " + isAvailNbBytes + " isReadBytes = " + isReadBytes + " length = " + image.length + " nbBytes = " + nbBytes + " image = " + image); } AIDOO.debug("Scale into"); bmp1.scaleInto(bmp2, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT); AIDOO.debug("End of Scale into"); JPEGEncodedImage encoded = JPEGEncodedImage.encode(bmp2, 90); return encoded.getData(); }
My problems are:
1. sometimes the image is cropped, this size (w/h) is OK, but for some strange reason it is not all the time. There is always a large black area at the bottom of the image. It seems that something has not been correctly readen.
2. sometimes I had an IllegalArgumentException in createBitmapFromBytes() function.
I read a lot of posts that talk about these problems, but I have found no solution.
Is it so hard to take a picture of the camera and display it?
Anyone have a good example/code example on how to handle this?
Thank you for your support and for reading me
(Sorry for my English )
I suspect that these problems are caused by the fact that the earpiece of the paper you use is told on the file being written until the writing is actually completed.
I think that Ihad this problem in an application that I wrote and to get around it, rather than process the image in the JournalListener, I actually got the JournalListener to save the file created in the method of invocation of the "onExposed" screen, I checked to see if the name of the file has been updated and if so , I would treat it then. onExposed is not get leads until the camera application has closed at this time, according to me, that it is save saying that the file has been saved.
I think that there are other options. For example, you could start a thread check the size of the file and if it does not grow after a second or two, you might assume that the writing was completed.
In all cases, this is where I would start looking for the problem.
-
I need solution for this...
Hi all... I am a beginner in blackberry development.
The code below is every time we click the ok button, it retrieves the content of the
Saran.txt the SD card file and displays them on the screen. So far so good, but the problem
is whenever I click on ok again, the content is displayed again. I don't want it to be
displayed again instead, I want that he should be replaced. I am facing this kind of problem with all areas
that appears on the screen, that is to say, the second time I click the button only one copy of this field is
display again.
can someone suggest a solution for this...
package myText; import java.io.*; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.file.FileConnection; import net.rim.device.api.io.transport.ConnectionDescriptor; import net.rim.device.api.io.transport.ConnectionFactory; import net.rim.device.api.system.Bitmap; import net.rim.device.api.system.EncodedImage; import net.rim.device.api.system.PNGEncodedImage; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.*; public class myText extends UiApplication { public static void main(String[] args) throws IOException { myText theApp = new myText(); theApp.enterEventDispatcher(); } public myText() throws IOException { new Textdisplay(); } } final class Textdisplay implements FieldChangeListener { MainScreen mainScreen=new MainScreen(); ButtonField ok=new ButtonField("OK"); //HttpConnection hc; //String url = "http://wordpress.org/extend/plugins/about/readme.txt"; //InputStream is=null; public Textdisplay() throws IOException { UiApplication.getUiApplication().pushScreen(mainScreen); mainScreen.setTitle("Text file Fetching......"); mainScreen.add(ok); ok.setChangeListener(this); } /*public void downloading() throws IOException { ConnectionFactory connFact = new ConnectionFactory(); ConnectionDescriptor connDesc; connDesc = connFact.getConnection(url); if (connDesc != null) { HttpConnection httpConn; httpConn = (HttpConnection)connDesc.getConnection(); try { final int iResponseCode = httpConn.getResponseCode(); Dialog.alert("Response.. code: "+Integer.toString(iResponseCode)); mainScreen.add(new LabelField(httpConn.getHost()+"\n"+httpConn.getRequestMethod())); is=httpConn.openInputStream(); StringBuffer buffer= new StringBuffer(); int chars; while((chars = is.read()) != -1) { buffer.append((char) chars); } String text = new String(buffer); mainScreen.add(new LabelField(text)); } catch (IOException e) { System.err.println("Caught IOException: " + e.getMessage()); } } } */ public void Fetching() throws IOException { String path = "file:///SDCard/BlackBerry/textfiles/saran.txt"; FileConnection FileConn=null; InputStream is=null; TextField label = null; int chars; Dialog.alert("entering"); try{ FileConn = (FileConnection) Connector.open(path,Connector.READ); Dialog.alert("file connection"); if(!FileConn.exists()){ FileConn.create(); } Dialog.alert("connection created"); //int length = (int) FileConn.fileSize(); //byte[] data = new byte[length]; is = FileConn.openInputStream(); //dis.readFully(data); Dialog.alert("not yet"); StringBuffer buffer= new StringBuffer(); while((chars = is.read()) != -1) { buffer.append((char) chars); } String text = new String(buffer); Dialog.alert("Click to read data......."); label.setText(text); mainScreen.add(label); is.close(); } catch(Exception e){ System.out.println("file not found:" + e); Dialog.alert("file not found"+e); } finally { try{ FileConn.close(); } catch(Exception e){} } } public void fieldChanged(Field f, int context) { try { //Dialog.alert("Fetching the file......."); mainScreen.add(new LabelField("Fetching the data...........")); Fetching(); } catch (Exception e) { e.printStackTrace(); } } }
In your current code, ButtonField 'ok' is global, so you can refer to this anywhere. Add a BitmapField which is overall too. And then in your transformation, set this to the new Bitmap that you created and invalidate the screen (mainScreen.invalidate ()).
If you add a BitmapField and it doesn't have a bitmap, it will not display.
-
How to get the version of the manifest extension?
Hello
We know that to get the extensionID that simply use CSInterface.getExtensionID ().
But, I want to know what version of my extension (Extension Id = Version X = X) is in the manifest file, anyone know how?
Thank you!
var csInterface = new CSInterface(); var url = "file://"+csInterface.getSystemPath(SystemPath.EXTENSION)+"/CSXS/manifest.xml" var req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); xmlDocument=req.responseXML; alert(xmlDocument.getElementsByTagName("Extension")[0].attributes.Version.value);
HTH
-
I bring the solution to all your problems in this simple easy-to-read * excerpt from script!
#target illustrator function test(){ var SymbolSampleScript = { displayProps : function (item){ var msg = []; for(var all in item){ try{ msg.push(all + " : " + item[all]); } catch(e){ msg.push(all + " : " + e); } } return msg.join("\n"); }, getPropListFromArray : function (srcArr, prop){ var arr = []; for(var i = 0; i < srcArr.length; i++){ arr.push(srcArr[i][prop]); }; return arr; }, SymbolChanger : { chooseSymbolDialog : function(){ var w = new Window('dialog', 'choose symbol'); var list = w.add("listbox", undefined, SymbolSampleScript.getPropListFromArray(app.activeDocument.symbols, "name")); list.size = [150, 200]; var g_btn = w.add("group"); var btn_ok = g_btn.add("button", undefined, "Ok"); var btn_ccl = g_btn.add("button", undefined, "Cancel"); btn_ok.onClick = function(){ if(SymbolSampleScript.SymbolChanger.validate(list)){ w.close(); } else { return; } } if(w.show() == 2){ return null; } else { return { selectedSymbol : list.selection.text }; } }, validate : function(list){ if(list.selection != null){ return true; } else { alert("Please select an item from the listbox."); } return false; } }, main : function(){ var doc = app.activeDocument; var s = doc.selection; if(s != null && s.length > 0 && s[0].typename == "SymbolItem"){ var userInput = this.SymbolChanger.chooseSymbolDialog(); if(userInput != null){ s[0].symbol = doc.symbols.getByName(userInput.selectedSymbol); } else { alert("Cancelled"); } } else { alert("Please select one symbol instance on an artboard in your document."); } } }; SymbolSampleScript.main(); }; test();
* relatively speaking
-
How to restrict user access to must enter a value in the mandatory fields
Greetings!
I had a personal information form. I want to restrict the user to enter values in all areas of mandatory for example fields (username, date of birth, etc.)
How to limit the search user must enter a value in the mandatory fieldsCreate dynamic actions for each of the fields, or you can create javascript.
for example create dynamic action 1 with event as tune-up losing select the item and the condition as NULL and action as alert and type the message you want to display in the text section.Thank you
Mehabub -
Dear Indesign scripting,
I am having a very old script that I made for CS2 and still use for CS5.
Now, I'm having a hard time giving him the possibility to choose the resolution in a dialog box.
Know I type the resolution manually in the script but I wonder if there is a way to do it with a dialog box.
var myDoc = app.documents[0]; app.scriptPreferences.version = "6.0" if(app.documents.length != 0){ var myFolder = Folder.selectDialog ("Choose a Folder"); if(myFolder != null){ myExportPages(myFolder); } } else{ alert("Please open a document and try again."); } function myExportPages(myFolder){ var myDocument = app.activeDocument; var myDocumentName = myDocument.name; //________________________________________________________________ app.jpegExportPreferences.resolution = 150; app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM; // JPEGOptionsQuality.LOW, JPEGOptionsQuality.MEDIUM, JPEGOptionsQuality.HIGH, JPEGOptionsQuality.MAXIMUM //________________________________________________________________ app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange; app.scriptPreferences.version = "7.0" app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.RGB; app.scriptPreferences.version = "6.0" app.activeDocument.sections.everyItem().includeSectionPrefix = false; p = app.activeDocument.pages.everyItem().getElements(); for (i = 0; i < p.length; i++) { f = File (myFolder + "/" + p[i].textFrames.item ('labelcode').contents + ".jpg"); app.jpegExportPreferences.pageString = p[i].name; app.activeDocument.exportFile (ExportFormat.jpg, f ); } } alert('Done!');
Already thanks for the help.
Greetings.
Try the code below,
If you want to create the user interface, Peter Kahrel documentation will be very useful for you.
http://www.kahrel.plus.com/InDesign/scriptui.html
var myDoc = app.documents[0]; app.scriptPreferences.version = "6.0" if(app.documents.length != 0){ var myFolder = Folder.selectDialog ("Choose a Folder"); if(myFolder != null){ myExportPages(myFolder); } } else{ alert("Please open a document and try again."); } function myExportPages(myFolder){ var myDocument = app.activeDocument; var myDocumentName = myDocument.name; //________________________________________________________________ var w = new Window ("dialog", "Resolution Dialog"); var e = w.add ("edittext", undefined, "type your resolution here"); w.layout.layout(); e.active = true; w.add ("button", undefined, "OK"); w.show(); //________________________________________________________________ app.jpegExportPreferences.resolution = Number(e.text); app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM; // JPEGOptionsQuality.LOW, JPEGOptionsQuality.MEDIUM, JPEGOptionsQuality.HIGH, JPEGOptionsQuality.MAXIMUM //________________________________________________________________ app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange; app.scriptPreferences.version = "7.0" app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.RGB; app.scriptPreferences.version = "6.0" app.activeDocument.sections.everyItem().includeSectionPrefix = false; p = app.activeDocument.pages.everyItem().getElements(); for (i = 0; i < p.length; i++) { f = File (myFolder + "/" + p[i].textFrames.item ('labelcode').contents + ".jpg"); app.jpegExportPreferences.pageString = p[i].name; app.activeDocument.exportFile (ExportFormat.jpg, f ); } } alert('Done!');
Vandy
-
How to add buttons in the script, and then click on run different codes?
If we run the script, then it should display ok, cancel button 6 button. If we click on button1 coding with button1 dangerousness must be running and so on.
Button1
Button2
Button3
Button4
button5
Button6
OK Cancel.
Marie rosine
// DialogSimpleButton.jsx // http://forums.adobe.com/thread/1327372?tstart=0 // how to add buttons in script, which on click run different codes? // regards pixxxelschubser function SimpleDialog() { var w = new Window('dialog', ''); this.windowRef = w; w.orientation = "column"; btn1 = w.add('button',undefined,'Button 1'); btn2 = w.add('button',undefined,'Button 2'); btn3 = w.add('button',undefined,'Button 3'); btn4 = w.add('button',undefined,'Button 4'); btnOK = w.add('button',undefined,'OK'); btnCancel = w.add('button',undefined,'Cancel'); btn1.onClick = function() {alert("Button 1");}; btn2.onClick = function() {alert("Button 2");}; btn3.onClick = function() {alert("Button 3");}; btn4.onClick = function() {alert("Button 4");}; defaultElement = btnOK; cancelElement = btnCancel; btnOK.active = true; btnOK.onClick = function() { stuff = "your stuff"; w.close(); } w.show(); } var stuff = null; SimpleDialog (); if (stuff) alert(stuff);
-
Back the action descriptor has no keys
Hi everyone and thanks for your support,
I did an action descriptor for a tool of perspective (using CS6) truncation. He received corner points and the midpoint. When the action is executed, the user can change the corner points and selection of crops. The value returned by executeAction is stored under a new action descriptor. Despite, this action descriptor is empty and no key. I was expecting to hold the keys with the new corner point values.
Code is below.
app.preferences.rulerUnits = Units.PIXELS var srcDoc = app.activeDocument; var width = srcDoc.width; var height = srcDoc.height; var m1, m2, x1, x2, x3, x4, y1, y2, y3, y4; var settings_dflt=[m1, m2, x1, y1, x2, y2, x3, y3, x4, y4]; settings_dflt = [width/2,height/2,0,0,width,0,width,height,0,height]; var actionDescriptor=new ActionDescriptor(); cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); }; function defaultActionDesciptor(Fa){ var Ga=new ActionDescriptor(); var Ha=new ActionDescriptor(); var Ia=new ActionDescriptor(); Ia.putUnitDouble(cTID('Hrzn'),cTID('#Pxl'),Fa[0]); Ia.putUnitDouble(cTID('Vrtc'),cTID('#Pxl'),Fa[1]); Ha.putObject(cTID('Cntr'),cTID('Pnt '),Ia); var Ja=new ActionDescriptor(); Ja.putUnitDouble(cTID('Hrzn'),cTID('#Pxl'),Fa[2]); Ja.putUnitDouble(cTID('Vrtc'),cTID('#Pxl'),Fa[3]); Ha.putObject(sTID('quadCorner0'),cTID('Ofst'),Ja); var Ka=new ActionDescriptor(); Ka.putUnitDouble(cTID('Hrzn'),cTID('#Pxl'),Fa[4]); Ka.putUnitDouble(cTID('Vrtc'),cTID('#Pxl'),Fa[5]); Ha.putObject(sTID('quadCorner1'),cTID('Ofst'),Ka); var La=new ActionDescriptor(); La.putUnitDouble(cTID('Hrzn'),cTID('#Pxl'),Fa[6]); La.putUnitDouble(cTID('Vrtc'),cTID('#Pxl'),Fa[7]); Ha.putObject(sTID('quadCorner2'),cTID('Ofst'),La); var Ma=new ActionDescriptor(); Ma.putUnitDouble(cTID('Hrzn'),cTID('#Pxl'),Fa[8]); Ma.putUnitDouble(cTID('Vrtc'),cTID('#Pxl'),Fa[9]); Ha.putObject(sTID('quadCorner3'),cTID('Ofst'),Ma); Ga.putObject(cTID('T '),sTID('quadrilateral'),Ha); Ga.putUnitDouble(cTID('Wdth'),cTID('#Pxl'),0.000000); Ga.putUnitDouble(cTID('Hght'),cTID('#Pxl'),0.000000); Ga.putUnitDouble(cTID('Rslt'),cTID('#Rsl'),0.000000); return Ga; } // function CallAppropriateAction() { var fb = new ActionDescriptor(); try{ fb = executeAction(cTID('Crop'),actionDescriptor,DialogModes.ALL); } catch(e){ alert("User cancelled operation"); } if(fb!=null){ srcDoc.selection.selectAll(); alert(fb.count + " = number of keys in fb\n" + fb.typename + " = type of fb") } } // function main() { srcDoc.selection.selectAll(); actionDescriptor=defaultActionDesciptor(settings_dflt); CallAppropriateAction(); } // app.activeDocument.suspendHistory("CropTool", "main()") </code>
OK, never mind, I found the embarrassing error.
The problem was this:
var settings_dflt = [m1, m2, x 1, y1, x 2, y2, x 3, y3, x 4, y4];
settings_dflt = [width/2, height/2,0,0, width, 0, width, height, 0],
I thought a little that the variables in the table would be initialized with the values given in the table. However when I remove the second line and initialize variables with starting values before assigning to the table, everything works fine.
var m1, m2, x 1, x 2, x 3, x 4, y1, y2, y3, y4;
M1 = width/2;
M2 = height/2;
x 1 = 0;
Y1 = 0;
x 2 = width;
Y2 = 0;
x 3 = width;
Y3 = height;
X 4 = 0;
Y4 = height;
var settings_dflt = [m1, m2, x 1, y1, x 2, y2, x 3, y3, x 4, y4];
-
Check with button if a field contains a specific character to another otherwise message box
Hi guys,.
Can I get some help please?
I have a button and I would like to add some javascript in there to check some fields.
If the field contains a '-' character then nothing
otherwise it displays a message.
If ((name_7.rawValue.match(/-/) == 0) {}
}
else {app.alert ("Fill - in with!") ;}}
Thank you
encleadus
Hello
The MATCH function will be return a null value if there is no match, then try;
If (name_7.rawValue.match(/-/)==null)
{
App.Alert ("Fill - in with!");
}
-
I've got 2 labels "select" in my form that allows a user to choose tour_1 or tour_2 BUT NOT both. Tour_1 and Tour_2 cannot be 'options' in the same select tag because they have different collection points that appear in the "select" separate tags. I don't want the user to be able to send the form, unless one or other of the 'select' tags was chosen, BUT NOT both.
So I can t get one to work:
var document.forms.purchaseTickets.tour_1.value = pp;
var PA = document.forms.purchaseTickets.tour_2.value;
If (pp == null | pp == "")
{
Alert ("Please select a point!");
Returns false;
}
This verifies only that tour_1 'select' tag is not empty BUT if I select also something tour_2 "select" tag it will also allow to be sent so, bum! Bum!
I can't check for both "select" labels being empty, as only that prompts the user to choose a selection of both.
So what I need is to allow the form to be sent if the user has chosen an option of one or the other "select" tags, but not if they chose and the option by mistake.
See you soon
Operating system.
SELECT does not directly give a value. You can use the selectedIndex property or the value of the selected option (once again, selectedIndex).
Assuming that the form name is purchaseTickets:
pp var = return ["purchaseTickets"] .tour_1;
var PA = return ["purchaseTickets"] .tour_2;
If (pp.selectedIndex == 0 & pa.selectedIndex == 0) {/ / no selected option}
do things
}
If (pp.selectedIndex! = 0 & pa.selectedIndex! = 0) {/ / the two selected options}
If something else
}
^_^
Maybe you are looking for
-
How can I get my email to stop doing all the updates of mac support?
How can I get my e-mail to stop receiving all messages from the community of mac support? My Inbox is implode!
-
CRAVING for laptop - 15-k201tx: download HP Hotkey to URGE support for laptop - 15-k201tx
HII, Where can I download the "Hotkey" to WANT software for laptop - 15-k201tx? I already ordered the computer, and it will be delivered over the next 48 hours. I have download all the drivers and save them to a disk exernal hard. My current laptop (
-
How can I permenatly delete my messages so that they cannot be corrected
I want to delete my messages on msn so that they cannot be corrected
-
How upgrading to Windows XP Service pack 3?
Help to update my operating system I just had my computer reloaded XP Svc Pack 2 operating system. Lose all the updates I've had in the last 5 years and you want to update again to Windows 7, what should I do to upgrade to Svc Pack3 - which I suppo
-
For Dimension 4600 AGP graphics card
Hi all I recently acquired an old Dimension 4600. I'll use it on the side for general use for example browsing the internet, email, etc. Nothing heavy. Its current specifications are; Intel Pentium 4 Northwood 2.8GHz 512 Kb 533FSB 4 GB RAM PC3200 NVI