Difference between using .ipp extension and .cpp extension files
Suppose I have 2 header files, 1 .ipp extension file and a main.cpp file:
First header file(like interface in Java):
template<class T>
class myClass1{
public:
virtual int size() = 0;
};
second header file:
#include "myClass1.h"
template<class T>
class myClass2 : public myClass1<T>
public:
{
virtual int size();
private:
int numItems;
};
#include "myClass2.ipp"
And then is my myClass2.ipp file:
template <class T>
int myClass2<T>::size()
{
return numItems;
}
Last one is my main:
#include "myclass2.h"
void tester()
{
myClass2<int> ForTesting;
if(ForTesting.size() == 0)
{
//......
}
else
{
//.....
}
}
int main(){
tester();
return 0;
}
myClass1, myClass2 and myClass2.ipp belong to header file. main.cpp in
source file. What's the advantages by using this way to implement your
program instead of using just .h and .cpp files? And what is .ipp
extension file? The difference between .ipp and .cpp?
Wednesday, 2 October 2013
How to add remove dynamic elements using jquery?
How to add remove dynamic elements using jquery?
This code works when adding a dynamic table with data coming from an ajax
request but can not remove the dynamic table. I code below shows whenever
I click on a tree node, it should load its mysql table data into a HTML
table.
$("#treeNodes").on("select_node.jstree", function(event, data)
{
var node = data.rslt.obj;
var nodeID = node.attr("id");
event.stopImmediatePropagation;
if(/leaf/.test(nodeID))
{
$(".tableData > *").remove(); // remove all table data (tr
rows) before adding the new data and not working or firing
off.
addTableData(); // This function get the data from a mysql
table and loads it into an HTML table.
}
});
<table>
<tbody class='tableData'></tbody>
</table>
Would someone kindly show me how this code can recognize the newly added
dynamic table data so it can be removed?
This code works when adding a dynamic table with data coming from an ajax
request but can not remove the dynamic table. I code below shows whenever
I click on a tree node, it should load its mysql table data into a HTML
table.
$("#treeNodes").on("select_node.jstree", function(event, data)
{
var node = data.rslt.obj;
var nodeID = node.attr("id");
event.stopImmediatePropagation;
if(/leaf/.test(nodeID))
{
$(".tableData > *").remove(); // remove all table data (tr
rows) before adding the new data and not working or firing
off.
addTableData(); // This function get the data from a mysql
table and loads it into an HTML table.
}
});
<table>
<tbody class='tableData'></tbody>
</table>
Would someone kindly show me how this code can recognize the newly added
dynamic table data so it can be removed?
Notification Hub Implementation for WIndows phone
Notification Hub Implementation for WIndows phone
Hello friends i have to implement a notification hub for sending
toast(push notification) to all app users but the link provided by windows
azure for implementing notification hub for windows phone is not working i
am able to create my notification hub. so i just wanted to know am i
missing something or what is proper way of implementing it. i know this
question is little bit weird but i am just tired to not able to get how to
do it.any fully working link or any help is appreciated here is the link
Hello friends i have to implement a notification hub for sending
toast(push notification) to all app users but the link provided by windows
azure for implementing notification hub for windows phone is not working i
am able to create my notification hub. so i just wanted to know am i
missing something or what is proper way of implementing it. i know this
question is little bit weird but i am just tired to not able to get how to
do it.any fully working link or any help is appreciated here is the link
Tuesday, 1 October 2013
How do i wrap structs that contain struct pointers in CFFI?
How do i wrap structs that contain struct pointers in CFFI?
in the IplImage struct documentation here
http://docs.opencv.org/modules/core/doc/old_basic_structures.html?highlight=iplimage#iplimage
it describes the IplROI* roi slot and it seems to be a pointer to the
IplROI struct defined here in the core types_c.h header file:
typedef struct _IplROI
{
int coi; /* 0 - no COI (all channels are selected)
, 1 - 0th channel is selected ...*/
int xOffset;
int yOffset;
int width;
int height;
}IplROI;
but it also describes the IplImage* maskROI slot and in the core types_c.h
file there is no typedef struct for that...
if some one could help me find it i would appreciate it but i did grep the
entire opencv download and found nothing.....Im attempting to wrap the
IplImage struct with lisp and i wrapped it with swig and got this
(cffi:defcstruct ipl-image
(n-size :int)
(id :int)
(n-channels :int)
(alpha-channel :int)
(depth :int)
(color-model :pointer)
(channel-seq :pointer)
(data-order :int)
(origin :int)
(align :int)
(width :int)
(height :int)
(roi (:pointer (:struct ipl-roi)))
(mask-roi :pointer)
(image-id :pointer)
(tile-info :pointer)
(image-size :int)
(image-data :string)
(width-step :int)
(border-mode :pointer)
(border-const :pointer)
(image-data-origin :string))
i changed it a bit here
(cffi:defcstruct ipl-image
(n-size :int)
(id :int)
(n-channels :int)
(alpha-channel :int)
(depth :int)
(color-model :int) ;;Ignored by OpenCV - was :pointer,
changed to :int so the struct values
would match OpenCV's
(channel-seq :int) ;;Ignored by OpenCV - was :pointer,
changed to :int so the struct values
would match OpenCV's
(data-order :int)
(origin :int)
(align :int)
(width :int)
(height :int)
(roi (:pointer (:struct ipl-roi))) ;; changed so i could access
(:struct ipl-roi)
(mask-roi :pointer)
(image-id :pointer)
(tile-info :pointer)
(image-size :int)
(image-data :string)
(width-step :int)
(border-mode :pointer)
(border-const :pointer)
(image-data-origin :string))
so when i ran the below code in emacs(shown with output) all the slot
values would match the opencv output from the exact same code, which they
do and so i could access the ipl-roi struct with the ipl-image struct
using this line
(roi (:pointer (:struct ipl-roi))) ;;
because my gut tells me its the right way
; SLIME 2012-05-25
CL-OPENCV> (size-of '(:struct ipl-image))
128
CL-OPENCV> (defparameter img-size (make-size :width 640 :height 480))
(defparameter img (create-image img-size +ipl-depth-8u+ 3))
IMG
CL-OPENCV> (cffi:with-foreign-slots ((n-size id n-channels
alpha-channel depth color-model
channel-seq data-order origin
align width height roi
mask-roi image-id tile-info
image-size image-data width-step
border-mode border-const image-data-origin)
img (:struct ipl-image))
(format t "n-size = ~a~%id = ~a~%n-channels =
~a~%alpha-channel = ~a~%depth =
~a~%color-model =
~a~%channel-seq = ~a~%data-order =
~a~%origin = ~
a~%align = ~a~%width = ~a~%height =
~a~%roi = ~a~
%mask-roi = ~a~%image-id = ~a~%tile-info =
~a~%
image-size = ~a~%image-data =
~a~%width-step =
~a~%border-mode = ~a~%border-const =
~a~%image-
data-origin = ~a~%"
n-size id n-channels
alpha-channel depth color-model
channel-seq data-order origin
align width height roi
mask-rOI image-id tile-info
image-size image-data width-step
border-mode border-const image-data-origin))
n-size = 144
id = 0
n-channels = 3
alpha-channel = 0
depth = 8
color-model = 4343634
channel-seq = 5392194
data-order = 0
origin = 0
align = 4
width = 640
height = 480
roi = #.(SB-SYS:INT-SAP #X00000000)
mask-roi = #.(SB-SYS:INT-SAP #X00000000)
image-id = #.(SB-SYS:INT-SAP #X00000000)
tile-info = #.(SB-SYS:INT-SAP #X00000000)
image-size = 921600
image-data =
width-step = 1920
border-mode = #.(SB-SYS:INT-SAP #X00000000)
border-const = #.(SB-SYS:INT-SAP #X00000000)
image-data-origin = NIL
NIL
CL-OPENCV>
but for the IplImage* maskROI slot there is no struct to wrap so i was
hoping some one could give me a quick lesson on how to wrap structs that
contain struct pointers in CFFI and if i'm right in thinking this line
(roi (:pointer (:struct ipl-roi)))
is the right thing to do and how to use it
I would really apreciate any help on this
in the IplImage struct documentation here
http://docs.opencv.org/modules/core/doc/old_basic_structures.html?highlight=iplimage#iplimage
it describes the IplROI* roi slot and it seems to be a pointer to the
IplROI struct defined here in the core types_c.h header file:
typedef struct _IplROI
{
int coi; /* 0 - no COI (all channels are selected)
, 1 - 0th channel is selected ...*/
int xOffset;
int yOffset;
int width;
int height;
}IplROI;
but it also describes the IplImage* maskROI slot and in the core types_c.h
file there is no typedef struct for that...
if some one could help me find it i would appreciate it but i did grep the
entire opencv download and found nothing.....Im attempting to wrap the
IplImage struct with lisp and i wrapped it with swig and got this
(cffi:defcstruct ipl-image
(n-size :int)
(id :int)
(n-channels :int)
(alpha-channel :int)
(depth :int)
(color-model :pointer)
(channel-seq :pointer)
(data-order :int)
(origin :int)
(align :int)
(width :int)
(height :int)
(roi (:pointer (:struct ipl-roi)))
(mask-roi :pointer)
(image-id :pointer)
(tile-info :pointer)
(image-size :int)
(image-data :string)
(width-step :int)
(border-mode :pointer)
(border-const :pointer)
(image-data-origin :string))
i changed it a bit here
(cffi:defcstruct ipl-image
(n-size :int)
(id :int)
(n-channels :int)
(alpha-channel :int)
(depth :int)
(color-model :int) ;;Ignored by OpenCV - was :pointer,
changed to :int so the struct values
would match OpenCV's
(channel-seq :int) ;;Ignored by OpenCV - was :pointer,
changed to :int so the struct values
would match OpenCV's
(data-order :int)
(origin :int)
(align :int)
(width :int)
(height :int)
(roi (:pointer (:struct ipl-roi))) ;; changed so i could access
(:struct ipl-roi)
(mask-roi :pointer)
(image-id :pointer)
(tile-info :pointer)
(image-size :int)
(image-data :string)
(width-step :int)
(border-mode :pointer)
(border-const :pointer)
(image-data-origin :string))
so when i ran the below code in emacs(shown with output) all the slot
values would match the opencv output from the exact same code, which they
do and so i could access the ipl-roi struct with the ipl-image struct
using this line
(roi (:pointer (:struct ipl-roi))) ;;
because my gut tells me its the right way
; SLIME 2012-05-25
CL-OPENCV> (size-of '(:struct ipl-image))
128
CL-OPENCV> (defparameter img-size (make-size :width 640 :height 480))
(defparameter img (create-image img-size +ipl-depth-8u+ 3))
IMG
CL-OPENCV> (cffi:with-foreign-slots ((n-size id n-channels
alpha-channel depth color-model
channel-seq data-order origin
align width height roi
mask-roi image-id tile-info
image-size image-data width-step
border-mode border-const image-data-origin)
img (:struct ipl-image))
(format t "n-size = ~a~%id = ~a~%n-channels =
~a~%alpha-channel = ~a~%depth =
~a~%color-model =
~a~%channel-seq = ~a~%data-order =
~a~%origin = ~
a~%align = ~a~%width = ~a~%height =
~a~%roi = ~a~
%mask-roi = ~a~%image-id = ~a~%tile-info =
~a~%
image-size = ~a~%image-data =
~a~%width-step =
~a~%border-mode = ~a~%border-const =
~a~%image-
data-origin = ~a~%"
n-size id n-channels
alpha-channel depth color-model
channel-seq data-order origin
align width height roi
mask-rOI image-id tile-info
image-size image-data width-step
border-mode border-const image-data-origin))
n-size = 144
id = 0
n-channels = 3
alpha-channel = 0
depth = 8
color-model = 4343634
channel-seq = 5392194
data-order = 0
origin = 0
align = 4
width = 640
height = 480
roi = #.(SB-SYS:INT-SAP #X00000000)
mask-roi = #.(SB-SYS:INT-SAP #X00000000)
image-id = #.(SB-SYS:INT-SAP #X00000000)
tile-info = #.(SB-SYS:INT-SAP #X00000000)
image-size = 921600
image-data =
width-step = 1920
border-mode = #.(SB-SYS:INT-SAP #X00000000)
border-const = #.(SB-SYS:INT-SAP #X00000000)
image-data-origin = NIL
NIL
CL-OPENCV>
but for the IplImage* maskROI slot there is no struct to wrap so i was
hoping some one could give me a quick lesson on how to wrap structs that
contain struct pointers in CFFI and if i'm right in thinking this line
(roi (:pointer (:struct ipl-roi)))
is the right thing to do and how to use it
I would really apreciate any help on this
Passing unicode characters to Jython
Passing unicode characters to Jython
I am trying to run a python code on Jython, and this code contains some
Unicode literals. I'd like to pass the code as a String (rather than load
from a file).
It seems that upon exec() method call the unicode characters are converted
to "?" characters:
PythonInterpreter interp = new PythonInterpreter(null, new PySystemState());
System.out.println("â".codePointAt(0)); // outputs 257
interp.exec("print ord(\"â\")"); // outputs 63
I can't seem to find a way how to pass the string to the interpreter
without messing those characters up.
I am trying to run a python code on Jython, and this code contains some
Unicode literals. I'd like to pass the code as a String (rather than load
from a file).
It seems that upon exec() method call the unicode characters are converted
to "?" characters:
PythonInterpreter interp = new PythonInterpreter(null, new PySystemState());
System.out.println("â".codePointAt(0)); // outputs 257
interp.exec("print ord(\"â\")"); // outputs 63
I can't seem to find a way how to pass the string to the interpreter
without messing those characters up.
How to log in to Skype via command line
How to log in to Skype via command line
pI am aware of how to install Skype via command line - by adding the
Canonical Partner repo and using apt-get./p pHowever, how can I log in via
the command line? There are two reasons I want to do this. First is down
to this being Ubuntu Server with no connected monitor and no desktop
window manager running (and I don't want one, this is running on AWS
micro). Second is to automate login upon boot up./p pThe end goal here is
to build a Skype bot using Skype4Py (a Python lib)./p pThanks in advance/p
pI am aware of how to install Skype via command line - by adding the
Canonical Partner repo and using apt-get./p pHowever, how can I log in via
the command line? There are two reasons I want to do this. First is down
to this being Ubuntu Server with no connected monitor and no desktop
window manager running (and I don't want one, this is running on AWS
micro). Second is to automate login upon boot up./p pThe end goal here is
to build a Skype bot using Skype4Py (a Python lib)./p pThanks in advance/p
Find $dx/dy$ by implicit differentiation of $\tan(x + y)$ at point $(0,0)$
Find $dx/dy$ by implicit differentiation of $\tan(x + y)$ at point $(0,0)$
I want to first know how to find the derivative of my trig function using
chain rule. Help
I want to first know how to find the derivative of my trig function using
chain rule. Help
Subscribe to:
Comments (Atom)