Rails Nginx Unicorn: cap:deploy is not udpating code
Even my hard coated html code is not being updated after cap:deploy. My
repository on git is updated and it is pushing that to the server but the
code won't update! I have restarted Nginx and Unicorn on several
occasions.
Wednesday, 4 September 2013
Tuesday, 3 September 2013
PyList_GetItem not idempotent
PyList_GetItem not idempotent
I'm trying out Swig and have the following C code and interface respectively:
// example.c
#include <Python/Python.h>
PyObject *test ( PyObject *self, int i) {
PyObject **x;
x = malloc(sizeof(PyObject *));
*x = PyList_GetItem(self, i);
return *x;
}
// example.i
%module example
%{
/* Put header files here or function declarations like below */
extern PyObject* test(PyObject *self, int i);
%}
extern PyObject* test(PyObject *self, int i);
It compiles properly and I can import the extension module fine. In fact,
when I define a variable a to be [{1:1},{2:2}] and do example.test(a, 0)
for the first time, it properly returns {1,1}. When I enter a into the
Python shell, I get [{1:1},{2:2}] as expected. When I try
example.test(a,0) again, I get a segmentation fault. Any ideas why this is
happening?
I'm trying out Swig and have the following C code and interface respectively:
// example.c
#include <Python/Python.h>
PyObject *test ( PyObject *self, int i) {
PyObject **x;
x = malloc(sizeof(PyObject *));
*x = PyList_GetItem(self, i);
return *x;
}
// example.i
%module example
%{
/* Put header files here or function declarations like below */
extern PyObject* test(PyObject *self, int i);
%}
extern PyObject* test(PyObject *self, int i);
It compiles properly and I can import the extension module fine. In fact,
when I define a variable a to be [{1:1},{2:2}] and do example.test(a, 0)
for the first time, it properly returns {1,1}. When I enter a into the
Python shell, I get [{1:1},{2:2}] as expected. When I try
example.test(a,0) again, I get a segmentation fault. Any ideas why this is
happening?
Async ajax calls messes up image source
Async ajax calls messes up image source
I'm using D3.js in conjunction with the Facebook PHP SDK to display the
visitors friends. Each friend is displayed in a small div with name and
profile picture.
My problem is that the Facebook API doesn't return a direct link to the
profile picture. Instead, you have to use a URL like
https://graph.facebook.com/UserID/picture?redirect=false, and the URL to
the picture is returned in JSON. All other friend data is already fetched
and stored in a Javascript array.
Now, I set up an AJAX call to deal with this, but it doesn't work because
of its asynchronous nature. Once the picture URLs are fetched, the DOM is
already loaded and the images get <img src="undefined">.
From main.js
function ajax(path) {
$.ajax({
type: "GET",
url: "ajax.php",
data: {'path': path},
success: function(data) {
return data; //returned data is correct
}
})
}
// d3 code
profile.append("img")
.attr("src", function(d) { return ajax(d.id); }) //this is "undefined"
.attr("class", "thumb");
From ajax.php
$path = file_get_contents('https://graph.facebook.com/' . $_GET['path'] .
'/picture?redirect=false');
echo json_decode($path)->data->url;
I'm using D3.js in conjunction with the Facebook PHP SDK to display the
visitors friends. Each friend is displayed in a small div with name and
profile picture.
My problem is that the Facebook API doesn't return a direct link to the
profile picture. Instead, you have to use a URL like
https://graph.facebook.com/UserID/picture?redirect=false, and the URL to
the picture is returned in JSON. All other friend data is already fetched
and stored in a Javascript array.
Now, I set up an AJAX call to deal with this, but it doesn't work because
of its asynchronous nature. Once the picture URLs are fetched, the DOM is
already loaded and the images get <img src="undefined">.
From main.js
function ajax(path) {
$.ajax({
type: "GET",
url: "ajax.php",
data: {'path': path},
success: function(data) {
return data; //returned data is correct
}
})
}
// d3 code
profile.append("img")
.attr("src", function(d) { return ajax(d.id); }) //this is "undefined"
.attr("class", "thumb");
From ajax.php
$path = file_get_contents('https://graph.facebook.com/' . $_GET['path'] .
'/picture?redirect=false');
echo json_decode($path)->data->url;
Repeated code to check for iOS version
Repeated code to check for iOS version
I use this snippet repeatedly in my app. So, it is better to read it once
and store it in the global variable or appDelegate or just keep executing
the snippet whenever needed?
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice
currentDevice] systemVersion] compare:v options:NSNumericSearch] ==
NSOrderedAscending)
if (SYSTEM_VERSION_LESS_THAN(@"7.0"))
return NO;
return YES;
I use this snippet repeatedly in my app. So, it is better to read it once
and store it in the global variable or appDelegate or just keep executing
the snippet whenever needed?
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice
currentDevice] systemVersion] compare:v options:NSNumericSearch] ==
NSOrderedAscending)
if (SYSTEM_VERSION_LESS_THAN(@"7.0"))
return NO;
return YES;
Get pointer to class method with 'using' keyword
Get pointer to class method with 'using' keyword
I'm using Visual Studio 2010.
Why can't I get a pointer to a class method which was "upgraded" to public
in a child class?
The following code does not compile:
#include <iostream>
#include <functional>
class Parent {
protected:
void foo() {
std::cout << "Parent::foo()\n";
}
};
class Child : public Parent
{
public:
//void foo() { Parent::foo(); } //This compiles
using Parent::foo; //This does NOT compile
};
int main() {
Child c;
c.foo();
std::function < void () > f = std::bind(&Child::foo, &c);
return 0;
}
It gives the error:
error C2248: 'Parent::foo' : cannot access protected member declared in
class 'Parent'
I'm using Visual Studio 2010.
Why can't I get a pointer to a class method which was "upgraded" to public
in a child class?
The following code does not compile:
#include <iostream>
#include <functional>
class Parent {
protected:
void foo() {
std::cout << "Parent::foo()\n";
}
};
class Child : public Parent
{
public:
//void foo() { Parent::foo(); } //This compiles
using Parent::foo; //This does NOT compile
};
int main() {
Child c;
c.foo();
std::function < void () > f = std::bind(&Child::foo, &c);
return 0;
}
It gives the error:
error C2248: 'Parent::foo' : cannot access protected member declared in
class 'Parent'
"setProperty()" can be done from Qt Forms in QtCreator?
"setProperty()" can be done from Qt Forms in QtCreator?
I'm trying to understand the example of using the customized class
QLedIndicator, found here. There in the ui_mainwindow.h file I found the
following lines of codes:
ledIndicator_0->setEnabled(true);
ledIndicator_0->setChecked(false);
ledIndicator_0->setOnColor1(QColor(255, 0, 0));
ledIndicator_0->setOnColor2(QColor(176, 0, 2));
ledIndicator_0->setOffColor1(QColor(28, 0, 0));
ledIndicator_0->setOffColor2(QColor(156, 0, 2));
Normally in Qt Creator the lines of codes in ui_***.h file is written
automatically with the changes made in the forms, but I can't see how I
can enable these lines of codes from the forms. Could you please explain?
Thanks.
I'm trying to understand the example of using the customized class
QLedIndicator, found here. There in the ui_mainwindow.h file I found the
following lines of codes:
ledIndicator_0->setEnabled(true);
ledIndicator_0->setChecked(false);
ledIndicator_0->setOnColor1(QColor(255, 0, 0));
ledIndicator_0->setOnColor2(QColor(176, 0, 2));
ledIndicator_0->setOffColor1(QColor(28, 0, 0));
ledIndicator_0->setOffColor2(QColor(156, 0, 2));
Normally in Qt Creator the lines of codes in ui_***.h file is written
automatically with the changes made in the forms, but I can't see how I
can enable these lines of codes from the forms. Could you please explain?
Thanks.
What is bitmask ? How to use it?
What is bitmask ? How to use it?
How do i use it in C++ ? when is it useful to use ?
Please give me an example of a problem where bitmask is used , how it
actually works . Thanks!
How do i use it in C++ ? when is it useful to use ?
Please give me an example of a problem where bitmask is used , how it
actually works . Thanks!
Subscribe to:
Posts (Atom)