Thursday, 3 October 2013

Javascript validation for checkboxes in JQuery DataTable

Javascript validation for checkboxes in JQuery DataTable

I have a table which is binding with JQuery datatable.
<table id="grid1">
<thead>
<tr>
<th>Name</th>
<th>View</th>
<th>Modify</th>
</tr>
</thead>
</table>
Below is the javascript code for binding the table/grid-
function grid1_LoadData() {
grid1.fnDestroy();
grid1.dataTable({
"sScrollY": "200px",
"bStateSave": true,
'bDeferRender': true,
'sAjaxSource': '/controller/GetData,
'aoColumns': [
{ 'mDataProp': 'Name' },
{ 'mDataProp': 'View', "sWidth": "55%", sType:
'bool', bSearchable: false, bSortable: false, mData:
'View',
"mRender": function (data, type, full) {
return "<input class=\"enabledbool\"
name=\"CanView" + full.ID + "\"
type=\"checkbox\" " + (data ? "
checked=\"true\"" : "") + "/>";
}
},
{ 'mDataProp': 'Modify', "sWidth": "65%", sType:
'bool', bSearchable: false, bSortable: false, mData:
'Modify', "mRender": function (data, type, full) {
// console.log(data);
return "<input class=\"enabledbool\"
name=\"CanModify" + full.ID + "\"
type=\"checkbox\" " + (data ? " checked=\"true\""
: "") + "/>";
}
},
]
});
}
Before saving the grid/table data, I want to check at least View or Modify
check box is checked. I need to write a javascript validation function.
This is what I have tried-
function Validate() {
$(grid1.fnGetData()).each(function () {
if ($(.checkbox).is(':checked')) {
return true;
}
else {
return false;
}
});
}
Waiting for the valuable suggestions.

Wednesday, 2 October 2013

vagrant virtualbox cannot make a POST request to a local rails app

vagrant virtualbox cannot make a POST request to a local rails app

I have a rails app running locally on port 3000.
From an app on Vagrant:
Requests::post( 'http://0.0.0.0:3000', $header, $payload );
Response:
'Cannot connect to host'
Note: When I run the same code out of the context of Vagrant, it works
perfectly.

Use values from a column to run a SELECT statement Oracle

Use values from a column to run a SELECT statement Oracle

I need to iterate through column values in a query.
Table1
index value
1, Nice
2, School
3, Day
pseudocode:
FOR all values in Table1
SELECT parent, function(value)
from Table2

C++ Code for Screen Capturing

C++ Code for Screen Capturing

I need to write code which will do screen sharing like WebEx or Team
Viewer for Windows PC. The requirement is I don't have admin access and I
can not Install any application or software for this. I know below
technology but none of them is working for me. I have tried all sample for
this code project URL
http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen
(1) GetDC(NULL) and BitBlt with SRCCOPY <= This will not capture
Transparent Window and It cause GDI hung (Just try drawing in Paint.. your
pencil stuck for some time when BitBlt operation performerd)
(2) GetDC(NULL) and BitBlt with SRCCOPY and CAPTUREBLT Option <= This will
hide Cursor when I call BitBlt Operation and also GDI Hung when BitBlt
Operation Performed.
(3) I also tried with DirectX using GetFrontBufferData.. This cause
Flicker of my Transparent Window.
(4) I tried with Windows Media API but this require Windows Media Encoder
to be Installed.
(5) I tried with Mirror Driver also but this require Driver to be
Installed with Admin Access.
Can any one please suggest API where without any Installation I can
capture entire screen and No flicker or GDI hung problem.
Thanks in Advance.....

Tuesday, 1 October 2013

undefined method {....}_url when calling create in api controller

undefined method {....}_url when calling create in api controller

I'm working on a rails app that serves some json and I'm having hard time
understanding what is going on in the code below (simplified for the
purpose of understanding the issue).
module Api
class ProjectController < ApplicationController
respond_to :json
def show
x = {"id"=>17, "name"=>"abc", "version"=>1}
respond_with x.to_json, status: 200
end
def create
x = {"id"=>17, "name"=>"abc", "version"=>1}
respond_with x.to_json, status: 200
end
end
end
The show action works fine but when I call the create action I get
NoMethodError (undefined method '{"id":17,"name":"abc","version":1}_url'
for Api::ProjectsController:0x007fbb2294cd18)
Why do I get this error while show works just fine? is it because create
makes a post instead of a get?
How can I solve it?
Thanks for your help and have a nice day.

how to create 2 separate war files

how to create 2 separate war files

I'm working on this huge java maven project that has several components to
it. This project will be delivered to several clients the exact same way
except for 1 small part for 1 of the clients.
This client provided me a single jar file that I should use when logging
information.
Now here's my question - how do I create two war files - 1 with the jar
file that the customer provided me, and 1 without.
I started looking into feature toggling - but feature toggling would
require me to deliver the proprietary jar file to other customers because
the code won't compile since there is still a dependency and I would only
have 1 war file.

I understand a question that was marked as unclear=?iso-8859-1?Q?=2C_but_I_may_be_the_only_one=2C_what_do_I_do=3F_=96_meta.?=stackoverflow.com

I understand a question that was marked as unclear, but I may be the only
one, what do I do? – meta.stackoverflow.com

What do I do if I understand a question that was marked as unclear? I want
to answer it but I am unable to... I flagged it, informing the moderators
that I am able to understand the question and ...