Blackberry Package project issue -1.debug - blackberry

I'm using BlackBerry_JDE_PluginFull_1.1.2.201003212304-12 (BB 5 SO).
When i rich click project -> BlackBerry -> Package Project its, generates some files on my deliverable folder. This files are the one u use to put the App on the web so my client can download the app and install it on his BlackBerry.
Now i'm facing a problem, some times, its create a file that prevent me install the app on BB. this file is ProjectName-1.debug.
What is making this error is why i am here. I don't know why this is happening.
My code that works fine:
public void agendar(){
String msg = "asdasd";
boolean seguir = true;
if(_cedula.getText() == null){
seguir = false;
}
if(seguir && _fechaNac.getDate() < 1){
seguir = false;
}
if(seguir && _tel.getText() == null){
seguir = false;
}
if(seguir && _pnombre.getText() == null ){
seguir = false;
}
if(seguir && _papellido.getText() != null){
seguir = false;
}
int i = Dialog.ask(Dialog.D_OK, msg);
}
Same code with one line that makes the "error":
public void agendar(){
String msg = "asdasd";
boolean seguir = true;
if(_cedula.getText() == null){
seguir = false;
msg = " xxx ";
}
if(seguir && _fechaNac.getDate() < 1){
seguir = false;
}
if(seguir && _tel.getText() == null){
seguir = false;
}
if(seguir && _pnombre.getText() == null ){
seguir = false;
}
if(seguir && _papellido.getText() != null){
seguir = false;
}
int i = Dialog.ask(Dialog.D_OK, msg);
}
The only difference is the line msg = " xxx ".
The components im using are BasicEditField and one DateField.
Also if i add this
int i = Dialog.ask(Dialog.D_OK, "aaaaaaaaa asdasd ");
the package get corrupted.
Yesterday, i created a new class in the project and just that was enough to corrupt the package.
So far, i re installed the eclipse plugin, and nothing changed. I can't fine any reference to this problem on google. Im stuck here with this and i dont know what else to check. On the simulator its works fine.
What is making this happening? What does -1.debug mean? When i try to install the app it looks for -1.cod file.
Any help is appreciated.
Regards.

Answered on the Official BlackBerry Java Forum:
http://supportforums.blackberry.com/t5/Java-Development/Blackberry-Package-project-issue-1-debug/td-p/2508105
As requested, here are the important details from the linked post:
There is no corruption, what is happening here is that your project has got large enough to exceed the limits of a single cod, and so the project is being built into multiple cods.
Typically you don't see that, because the build process zips up the individual cods, and puts them all in one large cod. However the debug-n files are a good indication that you exceeded one cod file - these are always kept separate and there is a debug-n file for each cod file.
So take your single file ".cod", rename it to ".zip", and then open the zip file. You will probably see 2 cods in there.
Unzip this and put the multiple cod files on the web site for download. If you check the jad file that has been created, you will see that it lists multiple cods.
If you want to read more about this, search the BlackBerry forum for 'sibling'. The multiple cod files are generally referred as sibling cod files.
Also see here for more on this:
http://supportforums.blackberry.com/t5/Testing-and-Deployment/The-maximum-size-of-a-BlackBerry-7-or-earlier-smartphone/ta-p/1300209

Related

Inability to display image after deployment to Azure server but works in localhost

I am having difficulty displaying images after deploying to Azure.
I am currently developing my application on ASP.NET MVC 5.
My methodology is for admin to upload a particular image, which would be accessible by users. The image is to be uploaded into a folder.
The issue is that I am able to get the image upload and displaying to work in my own localhost. However, it failed to work when I publish my app to Azure.
I have tried with many of the suggestions found in stackoverflow.
E.g. Changing the Permission settings in the folder, but up to no avail.
I have attached my code for reference. I appreciate any help! =D
Controller (file upload):
if (file != null && file.ContentLength > 0)
try
{
string path = Path.Combine(Server.MapPath("~/ExerciseImagesDepository"),
Path.GetFileName(file.FileName));
file.SaveAs(path);
ExerciseImage eI = new ExerciseImage();
eI.ExerciseID = ex.ExerciseID;
eI.ImageURL = Path.GetFileName(file.FileName);
db.ExerciseImages.Add(eI);
db.SaveChanges();
}
catch (Exception exc)
{
ViewBag.FileUploadErrorMessage = "ERROR:" + exc.Message.ToString();
}
Controller (Details display)
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
List<ExerciseViewModel> evmLIst = new List<ExerciseViewModel>();
int a = 0;
List<Exercise> exercise = db.Exercises.ToList();
foreach (var item in exercise)
{
ExerciseViewModel evm = new ExerciseViewModel();
a = a + 1;
evm.ExerciseViewModelID = a;
evm.ExerciseRegion = db.ExerciseRegions.Find(item.ExerciseRegionID);
evm.ExerciseDescription = item.Description;
evm.ExerciseType = db.ExerciseTypes.Find(item.ExerciseTypeID);
int ExerciseID = item.ExerciseID;
ExerciseVideo ev = db.ExerciseVideos.Where(m => m.ExerciseID == ExerciseID).SingleOrDefault();
evm.VideoURL = ev.VideoURL;
ExerciseImage ei = db.ExerciseImages.Where(m => m.ExerciseID == id).SingleOrDefault();
if (ei != null)
{
evm.ImageURL = ei.ImageURL;
}
else
{
evm.ImageURL = "No Image Is Available For This Exercise";
}
evm.Exercise = item.Name;
evmLIst.Add(evm);
}
View
<div>
<p> TESTING HERE #Html.Raw(Model.ImageURL) </p>
<img src="~/ExerciseImagesDepository/#Html.Raw(Model.ImageURL)"/>
Folder Structure:
I solve it! I figured that perhaps folder that are not default in the MVC 5 framework might be causing the issue. So instead, I created a new folder within the content directory and added a folder inside. Next, I tried changing that particular folder permission settings by adding a group or usernames "IUSR" and allowing full control. I then published the particular folder specifically to Azure and it works. Although I have no idea why I manage to do it.

Mobile web application: download attachments on iOS

In my mobile web application i have one page within user can view attachments.
The attachment can be any type of file (jpg,png,txt,doc,zip, etc).
The view attachment action is in the form of <a> tag that points to an aspx file that process the request.
HTML:
<a class="attachBtn" href="_layouts/ViewFile.aspx?messageAttachmentInstanceId={some id}"></a>
ViewFile.aspx:
public partial class ViewFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.IO.BinaryWriter bw = null;
System.IO.MemoryStream ms = null;
System.IO.StreamReader sr = null;
try
{
string contentType = string.Empty;
byte[] content = null;
string fileName = string.Empty;
if (!string.IsNullOrEmpty(Request.QueryString["messageAttachmentInstanceId"]) &&
!string.IsNullOrEmpty(Request.QueryString["messageInstanceId"]))
{
int messageInstanceId = Int32.Parse(Request.QueryString["messageInstanceId"]);
Guid attachmentInstanceId;
GuidUtil.TryParse(Request.QueryString["messageAttachmentInstanceId"], out attachmentInstanceId);
MessageInstance messageInstance = WorkflowEngineHttpModule.Engine.GetService<IMessagingService>()
.GetMessageInstance(messageInstanceId);
if (messageInstance != null)
{
MessageAttachmentInstance attachmentInstnace = messageInstance.Attachments[attachmentInstanceId];
contentType = attachmentInstnace.ContentType;
fileName = attachmentInstnace.FileName;
content = attachmentInstnace.Content;
}
}
this.Response.ContentType = contentType;
string headerValue = string.Format("attachment;filename={0}",
this.Server.UrlPathEncode(fileName));
Response.AddHeader("content-disposition", headerValue);
bw = new System.IO.BinaryWriter(this.Response.OutputStream);
bw.Write(content);
}
catch (Exception ex)
{
LogError("ViewFile.aspx, "
+ ex.InnerException, ex);
}
finally
{
if (sr != null)
sr.Close();
if (ms != null)
ms.Close();
if (bw != null)
bw.Close();
}
}
}
The Problem:
in Android devices when user click on attachment the file is downloaded automatically which is the desirable behavior because the user can open the file later with any tool he wants and even if the file type is not supported user can later on download a tool which can open it.
but in iOS devices the file is not downloaded but instead redirects to ViewFile.aspx and tries to open the file within the browser and if the file type is not supported it shows alert: "safari cannot download this file".
even if the file type is supported i want it to be downloaded and not open by default.
How can i achieve this behavior?
AFAIK, you cannot download files on iOS.
Known files that Safari (or any app that has registered a file type, e.g. ZIP) supports will open or show a dialog letting the user choose how to open the file.
You can't control the behavior from your web app/site.

NullPointerException with Texlipse and Miktex 2.9

When using Texlipse together with Miktex 2.9 on my Windows machine, the system throws a NullPointerExcpetion each time the document is compiled.
The problem disappeared after I have updated the Miktex 2.9 distribution using the Update manager. Hope this helps others who have the same problem.
Regards,
Pwndrian
To me it happens too.
This is a workaround I did, however I think that it is not quite optimal solution.
I saw that there is a bug opened http://sourceforge.net/tracker/?func=detail&aid=3306779&group_id=133306&atid=726818.
There is the class net.sourceforge.texlipse.builder.TExlipseBuilder, I made the following changes to overcome this problem(Please note the differences in both functions). The problem is that in TExlipsePlugin in the function getCurrentProject the actEditor is null since there is no active editor when importing projects or when pressing on clean while no editor is open.
#Override
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
BuilderRegistry.clearConsole();
IWorkbenchPage page = TexlipsePlugin.getCurrentWorkbenchPage();
IEditorPart actEditor = null;
if (page.isEditorAreaVisible()
&& page.getActiveEditor() != null) {
actEditor = page.getActiveEditor();
}
if ( actEditor == null )
return null;
if (isUpToDate(getProject()))
return null;
Object s = TexlipseProperties.getProjectProperty(getProject(), TexlipseProperties.PARTIAL_BUILD_PROPERTY);
if (s != null) {
partialBuild(monitor);
} else {
buildFile(null, monitor);
}
return null;
}
/**
* Clean the temporary files.
*
* #see IncrementalProjectBuilder.clean
*/
#Override
protected void clean(IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
BuilderRegistry.clearConsole();
IWorkbenchPage page = TexlipsePlugin.getCurrentWorkbenchPage();
IEditorPart actEditor = null;
if (page.isEditorAreaVisible()
&& page.getActiveEditor() != null) {
actEditor = page.getActiveEditor();
}
if ( actEditor == null )
return;
// reset session variables
TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_LATEX_RERUN, null);
TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_BIBTEX_RERUN, null);
TexlipseProperties.setSessionProperty(project, TexlipseProperties.BIBFILES_CHANGED, null);
// check main file
String mainFile = TexlipseProperties.getProjectProperty(project, TexlipseProperties.MAINFILE_PROPERTY);
if (mainFile == null || mainFile.length() == 0) {
// main tex file not set -> nothing builded -> nothing to clean
return;
}
cleanTempDir(monitor, project);
cleanOutput(monitor, project);
monitor.subTask(TexlipsePlugin.getResourceString("builderSubTaskCleanMarkers"));
this.deleteMarkers(project);
project.refreshLocal(IProject.DEPTH_INFINITE, monitor);
monitor.done();
}

"A generic error occurred in GDI+" error while showing uploaded images

i am using the following code to show the image that has been saved in my database from my asp.net mvc(C#) application:.
public ActionResult GetSiteHeaderLogo()
{
SiteHeader _siteHeader = new SiteHeader();
Image imgImage = null;
long userId = Utility.GetUserIdFromSession();
if (userId > 0)
{
_siteHeader = this.siteBLL.GetSiteHeaderLogo(userId);
if (_siteHeader.Logo != null && _siteHeader.Logo.Length > 0)
{
byte[] _imageBytes = _siteHeader.Logo;
if (_imageBytes != null)
{
using (System.IO.MemoryStream imageStream = new System.IO.MemoryStream(_imageBytes))
{
imgImage = Image.FromStream(imageStream);
}
}
string sFileExtension = _siteHeader.FileName.Substring(_siteHeader.FileName.IndexOf('.') + 1,
_siteHeader.FileName.Length - (_siteHeader.FileName.IndexOf('.') + 1));
Response.ContentType = Utility.GetContentTypeByExtension(sFileExtension.ToLower());
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BufferOutput = false;
if (imgImage != null)
{
ImageFormat _imageFormat = Utility.GetImageFormat(sFileExtension.ToLower());
imgImage.Save(Response.OutputStream, _imageFormat);
imgImage.Dispose();
}
}
}
return new EmptyResult();
}
It works fine when i upload original image. But when i upload any downloaded images, it throws the following error:
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
For. Ex: When i upload the original image, it shows as logo in my site and i downloaded that logo from the site and when i re-upload the same downloaded image, it throws the above error. It seems very weird to me and not able to find why its happening. Any ideas on this?
I'd guess that your problem lies here:
using (System.IO.MemoryStream imageStream = new System.IO.MemoryStream(_imageBytes))
{
imgImage = Image.FromStream(imageStream);
}
Because after using .FromStream, the Image owns the stream and might be very upset if you close it. To verify if that's the problem you can just try:
using (System.IO.MemoryStream imageStream = new System.IO.MemoryStream(_imageBytes))
{
imgImage = new Bitmap( Image.FromStream(imageStream) );
}
I've found that error usually comes from a file access problem. Sounds obvious, I realize, but double-check that the file path is correct and that the file exists, and also that the IIS process has permissions to that file.

How to retrieve data from a attached zip file in Blackberry application?

I am using eclipse to build application for Blackberry. I attached a zip file with my application. Please help me, I don't know how to retrieve data form the zip file in application development.
In BlackBerry we can use two compression standarts: GZip and ZLib.
Choose one, then compress your file and add to project.
Then you should be able to open it as an resource.
After that decompress it with GZIPInputStream or ZLibInputStream accordingly.
Example (uncompress and print text from test.gz attached to project):
try
{
InputStream inputStream = getClass().getResourceAsStream("test.gz");
GZIPInputStream gzis = new GZIPInputStream(inputStream);
StringBuffer sb = new StringBuffer();
int i;
while ((i = gzis.read()) != -1)
{
sb.append((char)i);
}
String data = sb.toString();
add(new RichTextField(data));
gzis.close();
}
catch(IOException ioe)
{
//do something here
}

Resources