enyo
A JavaScript application framework emphasizing modularity and encapsulation
i am nooby to WebOS3.0 (also in Mojo).
And now days i am working on palm pad apps dev.
and i want to know how to debug enyo apps?
Source: (StackOverflow)
All,
I am working with WebOS enyo, but having a really senior moment....
Basically the fact its enyo has no relation to my question however...
I have a method:
clickPopulate: function(){
// Do some SQL
};
I am using a database class to handle my SQL lite Db connection, the interface for the method i am using is:
* Execute an arbitrary SQL command on the database.
*
* If you need to execute multiple commands in a transaction, use queries()
*
* Parameters:
* - sql (string or query object, required)
* - options (object):
* * values (array): replacements for '?' placeholders in SQL
* (only use if not passing a DatabaseQuery object)
* * onSuccess (function): method to call on successful query
* + receives single argument: results as an array of objects
* * onError (function): method to call on error; defaults to logging
*/
query: function(sql, options)
So anyway i send it some SQL and some options, one of which is the onSuccess callback.
this.$.db.query("SELECT fullName, count(*) FROM user WHERE username=? and password=? GROUP BY username",
{values: [inUser,inPass], onSuccess: enyo.bind(this, this.callBackFunction)});
What i really want to be able to do is have the SQL result array return to my click handler function - clickPopulate, but as its the calling method, i cant get it to work?
Any ideas?
Source: (StackOverflow)
When developing a WebOS application with Enyo, is it possible to access the clipboard contents? That is, if I copy a bit of text to the clipboard on a Touchpad or Pre device , can I programmatically grab that piece of text, or programmatically replace it?
From what I've read in the SDK documents, I assume I'd need a Service to do this. Is this correct?
If so, which service? Are there a list of services available, and/or is there a way to reflect into the framework to see which services are available?
(New to WebOS development, so error on the side of speaking loudly and slowly)
Source: (StackOverflow)
I have a enyo.List with two items: an enyo.Image and a text component. I setSrc on the Image during onSetupItem.
This loads the image immediately , since I have over 10 rows they don't appear till all the images load. Is there anyway to load these images asynchronously (additionally display the image with a "fade-in" animation ?). Thanks.
Source: (StackOverflow)
I'm a kind of newbie webOS Developer, and I'm currently
developing an App where I need to take a picture of
a certain user.
I've been looking for many resources and sites on the
internet but I can't find a solution for my problem.
I follow the instructions that list here:
How to take a picture using command line on webOS on HP touchpad?
I want to let clear that I don't want to take the photo from the command line.
I tried the following:
A. Include in my depends.js
"$enyo/../lib/mediacapture/"
B. In my scene
enyo.kind({
name: "MyComponent",
kind: "Pane",
components: [
{
kind: "enyo.MediaCapture",
name: "mediaCapture",
onInitialized: "onImageCaptureInitialized",
onError: "onImageCaptureError",
onImageCaptureComplete: "onImageCaptureComplete"
}
],
...
..
.
});
C. Inside the onCreate function
create: function () {
this.inherited(arguments);
this.$.mediaCapture.initialize(this.$.ViewPort);
},
D. Inside the onInitialized Event
onImageCaptureInitialized: function () {
var keyString;
for(var i = 0; i < this.pb.deviceKeys.length; i++) {
if(this.pb.deviceKeys[i].description.indexOf("Camera/Camcorder") >= 0) {
keyString = this.pb.deviceKeys[i].deviceUri;
break;
}
}
if(keyString) {
var formatObj = {imageCaptureFormat: this.pb[keyString].supportedImageFormats[0]};
this.$.mediaCapture.load(keyString, formatObj);
}
},
D. Inside the onclick Event of a certain button
takePhotoClickEvent: function (inSender) {
this.$.mediaCapture.startImageCapture("/media/internal/CanalCocina/recipe_photo.jpg",
{
"bitrate":128000,
"samplerate":8000,
"width":480,
"height":320,
"mimetype":"image/jpeg",
"codecs":"jpeg"}
);
},
When I run the app on the HP TouchPad I get the next log in my console:
info: MediaCapture::ServiceProxy =====
MediaCapture::_initializeMediaServerInstanceSuccess()
...palm://com.palm.mediad.MediaCaptureV3_1814440/,
/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:83
[20111017-16:52:32.906482] info: MediaCapture::ServiceProxy
@@@@@@----------- FIRST PROPERTY GRAB -----------@@@@@@,
/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:106
[20111017-16:52:32.913991] info: MediaCapture::ServiceProxy
inResponse:
{"propertyValues":[{"name":"ready","value":false},{"name":"supportedAudioFormats","value":[{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"samplerate":44100,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"samplerate":44100,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":128000,"samplerate":8000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":256000,"samplerate":16000,"width":0,"height":0,"mimetype":"audio/vnd.wave","codecs":"1"},{"bitrate":705600,"sampl
However when the app tries to load the mediaCapture Object I get:
Uncaught TypeError: Cannot read property 'deviceKeys' of undefined,
source/CCRecipesStep1View.js:186
I know and I understand that this error is because the App try to access a property that doesn't exist. In this
case the particular line is:
onImageCaptureInitialized: function () {
var keyString;
for(var i = 0; i < this.pb.deviceKeys.length; i++) <<------------ Here
...
..
.
}
The file MediaCapture.js and the instructions I follow talk about the "Property Bag" , I understand that this is where you declare the properties, however I don't know how
to get the device keys that I need to load the MediaCaptureObject.
When the button is pressed I get:
MediaCapture::ServiceProxy #######----------- CHANGE PROPERTIES EVENT
-----------######vuData , /usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140
[20111017-17:07:35.401836] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,
/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140
[20111017-17:07:35.653586] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,
/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140
[20111017-17:07:35.885940] info: MediaCapture::ServiceProxy
#----------- CHANGE PROPERTIES EVENT -----------######vuData ,
/usr/palm/frameworks/enyo/1.0/framework/lib/mediacapture/helper/MediaCaptureProxyHelper.js:140
And start an infinite loop :S
I hope you cal help me.
This App is very important.
Thank you.
Source: (StackOverflow)
I am trying to code a vertical slider in enyo (Like a control on mixing desk). I was trying to avoid starting from scratch so I started tweaking the onyx.Slider class. I changed to styles from left to top and from width to height and with a few other tweaks, it's working. I'm now stuck on getting the slider to fill from bottom to top as at the minute it is vertical but it fills from the top down. Thanks in advance for any help.
Here are the code changes I have done:
in ProgressBar.js:
updateBarPosition: function(inPercent) {
this.$.bar.applyStyle("height", inPercent + "%");
},
in Slider.js (dividing by 64 is a temporary hack):
valueChanged: function() {
this.value = this.clampValue(this.min, this.max, this.value);
var p = this.calcPercent(this.value);
this.updateKnobPosition(p/64);
if (this.lockBar) {
this.setProgress(this.value);
}
},
updateKnobPosition: function(inPercent) {
this.$.knob.applyStyle("top", inPercent + "%");
},
calcKnobPosition: function(inEvent) {
var y = inEvent.clientY - this.hasNode().getBoundingClientRect().top;
return (y / this.getBounds().height) * (this.max - this.min) + this.min;
},
CSS:
/* ProgressBar.css */
.onyx-progress-bar {
margin: 8px;
height: 400px;
width: 8px;
border: 1px solid rgba(15, 15, 15, 0.2);
border-radius: 3px;
background: #b8b8b8 url(./../images/gradient-invert.png) repeat-x;
background-size: auto 100%;
}
.onyx-progress-bar-bar {
height: 100%;
border-radius: 3px;
background: #58abef url(./../images/gradient.png) repeat-x;
background-size: auto 100%;
}
Tom
Source: (StackOverflow)
I am trying to write image data received from Evernote getResourceData
-method, into local system in JavaScript code using Node.js. The image file is getting saved successfully, but looks like it is corrupted, and I'm not able to open it.
The function getResourceData
returns binary data of the resource with the provided GUID. For example, if this were an image resource, this would contain the raw bits of the image.
Here's the code:
Client.js:
var onSuccess = function(resource, transport) {
self.showResourceData(resource);
//console.log("Got Resource: "+resource);
};
NoteStore.getResourceData(onSuccess,this.showAlertMessage.bind(this,
"Failed to get Resource"), inSender.getValue());
showResourceData: function(resource) {
//Calls WriteFileAssistant service
this.$.writeFile.call({ path: "/downloads/logo1.png", content: resource });
}
WriteFileAssistant.js:
WriteFileAssistant.prototype.run = function(future) {
var filePath = this.controller.args.path;
var content = this.controller.args.content;
var downloadfile = fs.createWriteStream(filePath,
{'flags': 'w', encoding: 'binary'});
downloadfile.write(content, encoding='binary', function(err) {
future.result = { path: filePath, bytes: content.length, error: err };
});
}
Any help will be greatly appreciated.
-Petro
Source: (StackOverflow)
I have recently started venturing into some HP webOS development and I am wondering if anyone knows if there is a code-generation command similar to the webOS Mojo palm-generate tool.
Source: (StackOverflow)
Currently I'm looking at attempting a web request and seeing if that fails to determine if I'm online or not, but ideally it'd be nice if there was some hook in the OS that would alert me when I'm offline and go online.
Does anyone know if this is possible today?
Source: (StackOverflow)
currently, i'm developing LG Smart TV apps using HTML5, css and javascript and i dont use Enyo Framework. Everything fine on local browser.
But when i deploy to my LG WebOS Emulator (.ipk file) using LG SDK CLI, i cannot open Internal Link (browser.html).
my question is why i cannot open internal link on my index.html?
below is part of index.html code :
<a rel='nofollow' href="browser.html">Browser </a>
The Error Messages : "Network Error (7), Network is not connected. Please check network settings."
I'm expecting my apps can open browser.html
Source: (StackOverflow)
I have been trying to call a pdk plugin from the mojo hybrid app and have also tried the same with enyo app. In both cases my pdk plugin is shown as , Interesting thing is in case of enyo, i received the plugin_ready response which is sent after the plugin registration is complete.
in the web-os site, they mentioned that it is the issue with pdk plugin that makes it look defunct.
but i could not find a method to resolve it.
This is how my plugin looks,
PDL_bool powerCall(PDL_JSParameters *params) {
runsine();
char *reply = "Done";
PDL_JSReply(params, reply);
return PDL_TRUE;
}
int main(){
int result = SDL_Init(SDL_INIT_VIDEO);
PDL_Init(0);
PDL_RegisterJSHandler("pawar", powerCall);
PDL_JSRegistrationComplete();
PDL_CallJS("ready", NULL, 0); // this is for enyo
PDL_Quit();
SDL_Quit();
return 0;
}
please suggest me how to solve this issue. i know its a very simple task and am frustrated that its taking this long.
Thanks
Shankar
Source: (StackOverflow)
this.db.transaction(function (tx)
{
tx.executeSql('SELECT tsk.*, cont.firstName, cont.lastName ,cont1.firstName, cont1.lastName, list.listId FROM tbl_tasks tsk, tbl_contacts cont,tbl_contactequests cont1, tbl_lists list WHERE (tsk.assignedId=0 or tsk.assignedId=cont.contactId or tsk.assignedId=cont1.contactRequestId) and tsk.taskCategoryType != "INBOX_NOT_ACCEPTED" and list.listId=tsk.listId and list.listId='+window.defaultlistid+' group by tsk.taskId', [], enyo.bind(this,this.queryResponse), enyo.bind(this,this.errorHandler));//call queryResponse
}.bind(this));
Now as you can see cont.firstName (Table tbl_contacts) & cont1.firstName has (Table tbl_contactequests) has same fields first name
for (var i = 0; i < len; i++)
{
list[i] = results.rows.item(i);
fname = list[i].firstName;
lname = list[i].lastName;
fullname = fname+' '+lname;
//alert(fullname);
if(list[i].assignedId==0)
{list[i].name = '';}
else
{list[i].name=fullname;}
}
with this loop i can able to featch first value of tbl_contacts field firstname.Now suppose if i can't to access tbl_contactequests table firstname.
Source: (StackOverflow)
i have a set of HFlexLayout('s) inside of a VFlexLayout, a vertical list of buttons(e.g., X,Y,Z) with 5 fields after each button. when a button is pressed, i want one of the fields to toggle from off to on.
{X}[0][0][0][0][0]
{Y}[1][0][0][0][0]
{Z}[1][1][1][1][0]
for the fields to be toggled (in order) by the buttons, what element is appropriate to use? I would like to be able to change the color of the field upon toggle, but these aren't buttons that need to be pressed. I would be happy with 5 blocks next to each other as long as i can set the color of each block individually.
I think I'm going to try using disabled buttons if I can set their color, or maybe a progress bar that move's 20% after each button press, but when all i want are colored blocks, each of those options feels like a hack to me.
Source: (StackOverflow)
I have to create a web page that for the purposes of this question is a single image centered both vertically and horizontally in the center of the screen. It has the following requirements:
- The screen size of the client is unknown (mobile)
- The image is user-defined and therefore is of unknown dimensions
- The image must be perfectly centered both vertically and horizontally on all devices
- The image centering must persist through a screen rotation (i.e. from portrait to landscape)
Being a bit of a CSS newb, I went and created this the only way I knew how, using javascript to position the content:
http://jsfiddle.net/error454/8YL9a/
I'm looking for a solution that functions identically to my solution but uses CSS instead of hard equations.
Source: (StackOverflow)