How to get the object of radio button from id in android?
I declared my RadioButton like this
RatioButton rad1 = (RadioButton)findViewById(R.id.rb1);
With R.id.rb1 i want to get rad1 which is my object. Is this possible? Can
anyone help me with this.
Saturday, 17 August 2013
Friday, 16 August 2013
Postfix command line with php page
Postfix command line with php page
We created a php page that sends mail with Postfix. It sends email when
someone loads the page using Firefox. Now we'd like to automate that
process and have Ubuntu load the page once a day, which should send out an
email.
I've tried testing from the command line using the below:
/usr/bin/php /var/www/webpage.php
The problem looks to be that postfix is inserting the username into the
from field.
postfix/pickup uid=33 from=username
...
postfix/qmgr from=username@noreply@domain.com
How do we fix this?
We created a php page that sends mail with Postfix. It sends email when
someone loads the page using Firefox. Now we'd like to automate that
process and have Ubuntu load the page once a day, which should send out an
email.
I've tried testing from the command line using the below:
/usr/bin/php /var/www/webpage.php
The problem looks to be that postfix is inserting the username into the
from field.
postfix/pickup uid=33 from=username
...
postfix/qmgr from=username@noreply@domain.com
How do we fix this?
Saturday, 10 August 2013
Is boost::any movable?
Is boost::any movable?
This code compiles but I don't think it does what I intended, that is,
move, don't copy, the boost::any object that was created on the stack into
a std::vector<boost::any>
boost::any var;
var = std::string("StackOverflow");
std::vector<boost::any> vm;
vm.push_back(std::move(var));
for (auto i : vm)
{
cout << boost::any_cast<std::string>(i))) << endl; // yes a copy exists
}
cout << boost::any_cast<std::string>(i))) << endl; // but this copy still
exists too. was it not moved??
This code compiles but I don't think it does what I intended, that is,
move, don't copy, the boost::any object that was created on the stack into
a std::vector<boost::any>
boost::any var;
var = std::string("StackOverflow");
std::vector<boost::any> vm;
vm.push_back(std::move(var));
for (auto i : vm)
{
cout << boost::any_cast<std::string>(i))) << endl; // yes a copy exists
}
cout << boost::any_cast<std::string>(i))) << endl; // but this copy still
exists too. was it not moved??
What does 'return *this' mean in C++?
What does 'return *this' mean in C++?
I'm converting a C++ program to C#, but this part has me confused. What
does return *this mean?
template< EDemoCommands msgType, typename PB_OBJECT_TYPE >
class CDemoMessagePB : public IDemoMessage, public PB_OBJECT_TYPE
{
(...)
virtual ::google::protobuf::Message& GetProtoMsg() { return *this; }
}
How would it translate into C#?
I'm converting a C++ program to C#, but this part has me confused. What
does return *this mean?
template< EDemoCommands msgType, typename PB_OBJECT_TYPE >
class CDemoMessagePB : public IDemoMessage, public PB_OBJECT_TYPE
{
(...)
virtual ::google::protobuf::Message& GetProtoMsg() { return *this; }
}
How would it translate into C#?
Minidlna - Not Sure Of Source
Minidlna - Not Sure Of Source
I'm using the 13.04 distro and I've installed minidlna so I can access
movies on my LG LHB535 Bluray player. Minidlna shows up on my device but
all of the folders are empty. Where do I find the locations that minidlna
is trying to pull from? I added some files to the video folder in my home
folder and that didn't work either.
Please advise.
I'm using the 13.04 distro and I've installed minidlna so I can access
movies on my LG LHB535 Bluray player. Minidlna shows up on my device but
all of the folders are empty. Where do I find the locations that minidlna
is trying to pull from? I added some files to the video folder in my home
folder and that didn't work either.
Please advise.
Friday, 9 August 2013
Testing tool for javaScript, CSS , HTML , jQuery
Testing tool for javaScript, CSS , HTML , jQuery
I'm developing an extension for Google Chrome. I have several .js , .css ,
.html files in my project and I'm using notepad++ for coding. But i have
to do some testing before each phase ends. Is there any standard way to do
testing for them. (eg : in java we have JUnit, likewise)
I'm developing an extension for Google Chrome. I have several .js , .css ,
.html files in my project and I'm using notepad++ for coding. But i have
to do some testing before each phase ends. Is there any standard way to do
testing for them. (eg : in java we have JUnit, likewise)
Underscore.js template throwing syntax error in IE 8/9 only
Underscore.js template throwing syntax error in IE 8/9 only
The site I am working on is using backbone and underscore in conjunction
to render out page elements from data pulled out of a JSON file.
Everything was working fine and dandy across all browsers, until I set IE
to test in compatibility mode for IE 9. (I am not test in a native IE 9
enviortment - rather using the IE 10 developer window and setting browser
mode for IE9 and Document Mode for IE9 standards).
The error is specifically:
SCRIPT1002: Syntax Error
with a pointer to the throw e; line of the try/catch call at the end of
the _template function in underscore.js. (This is the section commented as
If a variable is not specified, place data values in local scope) Now I
can't imagine why the throw call would be generating the actual error, so
I assume there is a problem somewhere up the line that is throwing the
error in the try/catch, and IE is returning that instead of the line that
actually made the error occur.
Full source for that section is:
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + "return __p;\n";
try {
render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
I have spent a good amount of time in the IE developer window sifting
through the code line by line with breakpoints, but at the point the error
occurs, I have no idea what is actually being done by jquery / underscore,
except that template is being called to render the elements. The only
solution I found online so far was from people using reserved words as
keys in their JSON, but that does not seem to be the case for me.
An individual object is the JSON file would look like:
{
"id": "1",
"title": "Project Title",
"client": "Client Name",
"scope": "Design and Producion",
"projectCode": "homeEnt",
"projectType": "Home Entertainment",
"description": "Blah blah blah",
"video" : "false",
"mainImg": "images/gallery-he/project.jpg",
"fullImg": "images/gallery-he/project-full.jpg"
}
The two types of templates used in the HTML are:
<script id="projectTemplate" type="text/template">
<div class="<%= projectCode %>-box" rel="<%= id %>">
<div class="gradient-strip <%= projectCode %>" ><%= projectType
%></div>
<img src=<%= mainImg %> alt="<%= title &>" class="project-img">
</div>
</script>
<script id="projectModel" type="text/template">
<div class="model-frame" rel="<%= id %>" style="display:none">
<div class="model-gradient <%= projectCode %>"><%= projectType %></div>
<div class="close-button"></div>
<a class="model-left-arrow"></a>
<img class="fullArt" src="<%= fullImg %>" alt ="<%= title %>" />
<a class="model-right-arrow"></a>
<div class="model-text-block">
<p class="model-text"><span class="bolded"><%= title %> </span></p>
<p class="model-text"><span class="bolded">Client: </span> <%=
client %></p>
<p class="model-text" style="padding-bottom:10px;"><%= scope %></p>
<p class="model-text"><%= description %></p>
</div>
</div>
</script>
Even with some selective commenting, I was not able to deduce which of
these was the problem child, as commenting out one broke the other, and
vice versa.
Last, the view code:
var ProjectModelView = Backbone.View.extend({
tagName: "div",
className: "model-wrap",
events: {
// events are here, removed to save space
},
initialize: function() {
this.template = _.template($(this.options.templ).html());
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
return this;
},
// added functions are here (removed to save space)
});
var ProjectView = Backbone.View.extend({
tagName: "div",
className: "project-wrap",
initialize: function () {
this.template = _.template($('#projectTemplate').html());
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
return this;
},
events: {
// events...
},
// added functions...
});
var ProjectModelListView = Backbone.View.extend({
el: '#modelList',
initialize: function() {
this.collection = masterProjectList;
this.render();
},
render: function() {
this.$el.html("");
this.collection.each(function(project) {
this.renderItem(project);
}, this);
},
renderItem: function(project) {
var isVideo = project.get('video');
if (isVideo == "true") {
var projectModelView = new ProjectModelView({ model: project,
templ: '#videoProjectModel' });
this.$el.append(projectModelView.render().el);
} else {
var projectModelView = new ProjectModelView({ model: project,
templ: '#projectModel'});
this.$el.append(projectModelView.render().el);
}
}
});
var ProjectListView = Backbone.View.extend({
el: '#projectList',
initialize: function() {
this.collection = masterProjectList;
this.render();
},
render: function() {
this.$el.html("");
this.collection.each(function(project) {
this.renderItem(project);
}, this);
},
renderItem: function(project) {
var projectView = new ProjectView({ model: project });
this.$el.append(projectView.render().el);
}
});
Sorry this is so much text, but I am at a complete loss as to what aspect
is causing this to fail in IE 8 / 9, so I am unsure what specifically I
need to be modifying. Any ideas what would be making underscore go crazy
in just specific browser versions?
You can see the site here:
http://www.thecrpgroup.com/crpweb/promo-site/
Thanks.
The site I am working on is using backbone and underscore in conjunction
to render out page elements from data pulled out of a JSON file.
Everything was working fine and dandy across all browsers, until I set IE
to test in compatibility mode for IE 9. (I am not test in a native IE 9
enviortment - rather using the IE 10 developer window and setting browser
mode for IE9 and Document Mode for IE9 standards).
The error is specifically:
SCRIPT1002: Syntax Error
with a pointer to the throw e; line of the try/catch call at the end of
the _template function in underscore.js. (This is the section commented as
If a variable is not specified, place data values in local scope) Now I
can't imagine why the throw call would be generating the actual error, so
I assume there is a problem somewhere up the line that is throwing the
error in the try/catch, and IE is returning that instead of the line that
actually made the error occur.
Full source for that section is:
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + "return __p;\n";
try {
render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
I have spent a good amount of time in the IE developer window sifting
through the code line by line with breakpoints, but at the point the error
occurs, I have no idea what is actually being done by jquery / underscore,
except that template is being called to render the elements. The only
solution I found online so far was from people using reserved words as
keys in their JSON, but that does not seem to be the case for me.
An individual object is the JSON file would look like:
{
"id": "1",
"title": "Project Title",
"client": "Client Name",
"scope": "Design and Producion",
"projectCode": "homeEnt",
"projectType": "Home Entertainment",
"description": "Blah blah blah",
"video" : "false",
"mainImg": "images/gallery-he/project.jpg",
"fullImg": "images/gallery-he/project-full.jpg"
}
The two types of templates used in the HTML are:
<script id="projectTemplate" type="text/template">
<div class="<%= projectCode %>-box" rel="<%= id %>">
<div class="gradient-strip <%= projectCode %>" ><%= projectType
%></div>
<img src=<%= mainImg %> alt="<%= title &>" class="project-img">
</div>
</script>
<script id="projectModel" type="text/template">
<div class="model-frame" rel="<%= id %>" style="display:none">
<div class="model-gradient <%= projectCode %>"><%= projectType %></div>
<div class="close-button"></div>
<a class="model-left-arrow"></a>
<img class="fullArt" src="<%= fullImg %>" alt ="<%= title %>" />
<a class="model-right-arrow"></a>
<div class="model-text-block">
<p class="model-text"><span class="bolded"><%= title %> </span></p>
<p class="model-text"><span class="bolded">Client: </span> <%=
client %></p>
<p class="model-text" style="padding-bottom:10px;"><%= scope %></p>
<p class="model-text"><%= description %></p>
</div>
</div>
</script>
Even with some selective commenting, I was not able to deduce which of
these was the problem child, as commenting out one broke the other, and
vice versa.
Last, the view code:
var ProjectModelView = Backbone.View.extend({
tagName: "div",
className: "model-wrap",
events: {
// events are here, removed to save space
},
initialize: function() {
this.template = _.template($(this.options.templ).html());
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
return this;
},
// added functions are here (removed to save space)
});
var ProjectView = Backbone.View.extend({
tagName: "div",
className: "project-wrap",
initialize: function () {
this.template = _.template($('#projectTemplate').html());
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
return this;
},
events: {
// events...
},
// added functions...
});
var ProjectModelListView = Backbone.View.extend({
el: '#modelList',
initialize: function() {
this.collection = masterProjectList;
this.render();
},
render: function() {
this.$el.html("");
this.collection.each(function(project) {
this.renderItem(project);
}, this);
},
renderItem: function(project) {
var isVideo = project.get('video');
if (isVideo == "true") {
var projectModelView = new ProjectModelView({ model: project,
templ: '#videoProjectModel' });
this.$el.append(projectModelView.render().el);
} else {
var projectModelView = new ProjectModelView({ model: project,
templ: '#projectModel'});
this.$el.append(projectModelView.render().el);
}
}
});
var ProjectListView = Backbone.View.extend({
el: '#projectList',
initialize: function() {
this.collection = masterProjectList;
this.render();
},
render: function() {
this.$el.html("");
this.collection.each(function(project) {
this.renderItem(project);
}, this);
},
renderItem: function(project) {
var projectView = new ProjectView({ model: project });
this.$el.append(projectView.render().el);
}
});
Sorry this is so much text, but I am at a complete loss as to what aspect
is causing this to fail in IE 8 / 9, so I am unsure what specifically I
need to be modifying. Any ideas what would be making underscore go crazy
in just specific browser versions?
You can see the site here:
http://www.thecrpgroup.com/crpweb/promo-site/
Thanks.
Subscribe to:
Posts (Atom)