Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
mario_n
Posts: 13
Registered: ‎05-31-2012
My Device: 9360
My Carrier: Vip

Re: POST/READ data to PHP/MYSQL on webserver

Hi,

 

I tryed to start MDS, but then this pops-up:

 

Error: loading: C:\Jre7\bin\msvcr100.dll
Error occurred during initialization of VM
Unable to load native library: Can't load IA 32-bit .dll on a AMD 64-bit platform

C:\BlackBerry WebWorks SDK 2.3.1.5\mds>

 

I have installed Win7 64 bit.

 

Don't know whether is BlackBerry WebWorks SDK 2.3.1.5 - 32 or 64 bit, I have downloaded it from: https://developer.blackberry.com/html5/download/sdk, and there you can not choose between 32 or 64 bit. version.

 

Can you please advice?

Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

[ Edited ]

I don't know if there is a better option or not, but you could always download the JDE and use the mds from within that JDE...

 

http://us.blackberry.com/developers/javaappdev/javadevenv.jsp

 

The MDS I am using is part of the 7.1 JDE which I installed prior to delving into webworks. 

 

I will do my best to help you out but I am sure there is many more people who would be better in providing support for this matter. It is my suggestion that you create your own thread to address this issue as I believe this will lead to a faster resolution concerning your matter.

 

Let me know how it goes.

 

Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

Hello Erik, 

 

I got a little sidetracked last week. The application is very near completion and as I was waiting for the UI to be finished I started developing another app(which is nearly done as well..), so I hadn't gotten around to testing the base64 issue. 

 

However I will be doing that today or tomorrow and will post back here with results. 

 

regards, 

 

justam

 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: POST/READ data to PHP/MYSQL on webserver

Sounds great, keep me posted! (I'm between airports until the weekend but will do my best to keep an eye on this.)

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

[ Edited ]

Hi Erik, 

 

It seems as though the encoding methods are very different. Even though it is encoding to base64 I am getting very different results from my server generated base64 data. 

 

Here is my code:

 

var file1 = "file:///SDCard/bgd.png";
if(blackberry.io.file.exists(file1)){
	blackberry.io.file.readFile(file1, handleOpenedFile);
}else{
	alert("File does not exist!");
}

function handleOpenedFile(fullPath, blobData) {

	try{
		serverBase64 = "iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAIAAAABc2X6AAAQi0lEQVR4nO1aaXhUVZo+5251a0stqaSSSipLJaFCEpIQiSwJiPI44sYiAbe2FbX1kbaxR+1H2z/qr+lBbXtmbGbmeabpkQFFBUVEwAiCgAESAoIsCUtCFgghldR66+7nzI8bKkVlYUnS7fN03h+V+5669zvfd77vvOfcU4EIIXAVEEIAAMYYQqh93jLVrP0cqfYn5rGG2K3xLTGa8O1gOtyDN0vHAwTGOBZzQq+x9oQb4r8dksYeGSUd7NjoKdRKOpbxG0HCzeNHxwNUfDdDTktwAzUMxqGkb7ygborC+KT/nOfeWGFgDidgNKWYYPBnRQkwDIbLIb6KIWnM7uiVZpykixpySEaeCcONX/wAJVT4rdExnGUxSkA4MJO16/iO40Md7tvBTo+hUCfMuNHTGxWtvwvGI8MwNgNHWBJAXJJvhP6cQSVMaw0J8ccawc3M89EX9o1uj2+GEgnuJtS9hsEtw2FMtGq4fseEjiRaQz55IxjbsMcW/3CiNbDxSNhmDu77b0/HcHkbqOLBBwBgkBSBOB0eQQ+GvP+W6ThhaNHqX7Ju0t14Iwk2b43GMIZ0QrSuYkK0JkRrQrQmRGsM6JhjWNFKwHjox43QMQd1/VtuGPFzIb4yR0MT1GH0lBqyYgeLUCyeWFSD6WgHbBgfxpZec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DmAKIIokGYYBJHXFH2ht72g6fcp3+TISeUriH3rw/rlz52ZnZ0+dOtXhcGgzeYROb4qO10E8xpjjuIaGhn9dtWr/4aMizRImGzSYIMUQJEETEKqKKAiqEEU8hwUOi7yOAFOLi+6///6UlBSPx1NUVJSSkkJR1Niey/dnOMHp+CJJoIPzf425uFRrGuPz+Y4dO7Znz57v9+1vae8QVVVBGGEAMCYAIAmgI4nszMypZaVFRUU2m81qtebm5ubm5losFu2FPKF8RkkTfyIdMoaRhyD+2YTh1AQmHA77/f5gMBgIBDo6Onw+XyQSQQjRNG0ymbS9KkEQFoslLS0tLS3NarWyLBuzlpCGUdLE/4gfPBtvAQmPa8eXgiBwHMdxHM/zgiAoihKTVoPBYDQaTSaTXq+nKErT/Fs7yr4uHS/RGm4uoKuIfUVcRUJKx0qlEug/3K+HxJClm7C+aRexz+Fo7CI+vaOkN9j1jdPxFa1RYkxUKoH+LUTr1ug4iRYxuI/Bt0IIB18MSWOPx766ZRrvw1jSCdHq73VCtCZEa3hMiNaEaE2I1oRoXePSGNIJ0Yobj1jLhGhNiNaEaI0JJkRrQrQmROu6mBCtCdG6BUyI1s9ItP4f2VOIo0ppbEsAAAAASUVORK5CYII=";
		var baseBlob = blackberry.utils.blobToString(blobData); 
		alert(baseBlob);
		alert(serverBase64);
		if(baseBlob == serverBase64){
			alert("Same");
		}else{
			alert("not the same");
		}
	}catch (err){
		alert("Error: " + err);
	}
		
}

 

The serverBase64 data is what my php is sending me and it does work using:

 

<img src="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAIAAAABc2X6AAAQi0lEQVR4nO1aaXhUVZo+5251a0stqaSSSipLJaFCEpIQiSwJiPI44sYiAbe2FbX1kbaxR+1H2z/qr+lBbXtmbGbmeabpkQFFBUVEwAiCgAESAoIsCUtCFgghldR66+7nzI8bKkVlYUnS7fN03h+V+5669zvfd77vvOfcU4EIIXAVEEIAAMYYQqh93jLVrP0cqfYn5rGG2K3xLTGa8O1gO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ItP4f2VOIo0ppbEsAAAAASUVORK5CYII="/>

 and if I include it on my vcf it will display the image in the contacts app.

 

So it seems passing my base64 to contact.setPicture is not going to work. I might be stuck downloading the image from my webserver and getting the blobData that way. I'd prefer not to go this route however. Any ideas?

 

Regards, 

 

Justam

 

 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: POST/READ data to PHP/MYSQL on webserver

Hello Justam,

 

The concern of downloading the image vs. getting your stored Base64 data, is that a matter of transmission size or do you have other reasoning for avoiding that?

 

From what I see, instead of saving just the data to your own local DB and loading that for setPicture, if you simply save the image to the filesystem and re-use that, that should effectively provide the same result as if you had it in a database (aside from some differences in how the data is accessed.) This would avoid "re-downloading" the image each time and, at this point, if it is a viable workaround, may be something that needs to be explored.

 

I have a feeling the data is still being lost somewhere in that blob conversion, unfortunately I'm not sure what else to recommend at this point that we haven't tried already. For refrence, what does baseBlob come out as (assuming it is the "same" photo to begin with)?


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

[ Edited ]

I would like to avoid downloading the image file as the image will only be used once for that request and will be destroyed after the contact has been saved. Also because there will be simulateous requests to my server from many different clients I think its best to send the base64 or binary data. 

 

The image and the base64 data are the same. When i tried to show the blobData it have me an unspecified type error. So I called :

 

var baseBlob = blackberry.utils.blobToString(blobData); 
alert(baseBlob);

Which gave me some data starting with:

 

PNG

....

If i decoded my base64 data I also got the same 

 

PNG

....

 

So maybe the question is how can I take my decoded base64 data and put it back into a blob which the system can use. 

 

blackberry.utils.stringToBlob(data, "binary") was a hack which tim implemented on the playbook sdk. I couldnt find the files/parts of the ext which needed replacing to take advantage of this hack. So using the binary call I'm stuck. 

 

What I am thinking now as I can't think of how to convert the output of blobToString back to stringToBlob is using the binary data from the image file directly and recieve that through an xmlhttp request. 

 

I think if I capture the php buffer for the image data(which is coming from a cropped image) it should be the binary image data, so I can store this in a string, insert into mySQL db and then call when the request is recieved from the client. I don't know if I will need to encode/decode the data but worth a shot for the short term. 

 

Is decoding the base64 decoding to binary?? I am a little confused on all this decoding/encoding and I think thats the cause of all this fuss. 

 

Here is my base64 decode function:

 

var keyStr = "ABCDEFGHIJKLMNOP" +
               "QRSTUVWXYZabcdef" +
               "ghijklmnopqrstuv" +
               "wxyz0123456789+/" +
               "=";

  function decode64(input) {
     var output = "";
     var chr1, chr2, chr3 = "";
     var enc1, enc2, enc3, enc4 = "";
     var i = 0;

     // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
     var base64test = /[^A-Za-z0-9\+\/\=]/g;
     if (base64test.exec(input)) {
        alert("There were invalid base64 characters in the input text.\n" +
              "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
              "Expect errors in decoding.");
     }
     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

     do {
        enc1 = keyStr.indexOf(input.charAt(i++));
        enc2 = keyStr.indexOf(input.charAt(i++));
        enc3 = keyStr.indexOf(input.charAt(i++));
        enc4 = keyStr.indexOf(input.charAt(i++));

        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;

        output = output + String.fromCharCode(chr1);

        if (enc3 != 64) {
           output = output + String.fromCharCode(chr2);
        }
        if (enc4 != 64) {
           output = output + String.fromCharCode(chr3);
        }

        chr1 = chr2 = chr3 = "";
        enc1 = enc2 = enc3 = enc4 = "";

     } while (i < input.length);

     return unescape(output);
  }

 

Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

[ Edited ]

Originally posted from my 9700 as the edit capabilities didnt seem to be present on the mobile website. The content from this post has been appended to the above post. Please ignore this post.

Please use plain text.
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700
My Carrier: Rogers

Re: POST/READ data to PHP/MYSQL on webserver

[ Edited ]

Hi Erik,

 

So I figured it out...

 

I needed to decode my base64 string using that javascript function above and then I called blackberry.utils.stringToBlob(DecodedBase64String); and voila! 

 

Now the only thing left for this app is to crop an image and get the base64 of that image and send it to my server...

 

I have been searching for a cropping sample for webworks and haven't found one. On my website I do use JCrop but it doesnt seem to work at all with non touch devices.......Do you know of a html5/javascript cropping utility which may work on the BB or is there some sort of webworks sample available I haven't discovered?

 

Kind of a side thought....The issue with jcrop seems to be with the trackpad / mouseevents within jquery/javascript. What happens is the intial click on the pic with show the crop box and then you can drag to the desired size. When you click again to accept the size of the box it dissapears. What I think might be happening is the mousedown or mouseclick events may not be working properly with the trackpad on non touch devices. I am thinking I may be able to bind those events to a keypress(eg ascii 13 for enter) which may allow the box to remain....just a thought...

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: POST/READ data to PHP/MYSQL on webserver

Good work Justam!

 

You'll be a pro at this in no time. We don't have any native APIs to perform this sort of cropping.

 

The trackpad itself should send the necessary mouseevents, and it seems that JCrop would detect a mobile device for this as on a PC, the behaviour is more click/drag/release than click/move/click. The source code for the library is available should you want to dive deep into that :-) Alternatively, maybe a better start is to reach out to JCrop directly.

 

From what I can find, JCrop seems to be the leading solution for something like this.

 

Beyond that, the alternative that I can see is a lot of math, conversion, and byte traversing to perform this manually.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.