Saturday, 14 September 2013

Query Mongo collection for all documents with empty array nested in an array

Query Mongo collection for all documents with empty array nested in an array

I have documents that look like this in a collection called movies:
{
"_id" : ObjectId("51c272623021490007000001"),
"movies": [
{
"name": "Booty Call"
"play_times": []
},
{
"name": "Bulletproof"
"play_times": [{...},{...}]
}
]
}
I would like to query for documents where "play_times" is not empty or
null. Basically I only care about movies with play times.

Setting custom class/attributes c#

Setting custom class/attributes c#

little forward: I wasn't sure on exactly what I'm looking for, I know it's
possible and I know there's a name for it, but I wasn't sure of what to
search to find it. The answer to this may be as simple as directing me to
the right place, which would be much appreciated! Anyway here's what I'm
trying to do. I'd like to set up a new class, say "class1" then I'd like
to have an attribute, lets say "dead" randomly selected, so that I can
create an instance of the class and the following code will work class1
player1 = new class1(); if (player1.dead == true) { //do whatever }
I apologize if I've used the wrong words in my explanation, again I'm not
sure exactly what I"m looking for. Thanks!

mPDF - Correct permissions on UNIX

mPDF - Correct permissions on UNIX

Today I had to reinstall my OS (Ubuntu) and apache server (Lamp), now I
forgot how was my permissions set up for mPDF. I can't create PDF file
because server doesn't allow me so. My code is ok since everything worked
before reinstallation of OS. I tried using chmod +r+w location/to/folder
but that doesn't work. Also I tried to give all permissions to www-data
but still no luck. Can someone tell me what permissions I need to set so
mPDF can create PDF files with no problem

Friday, 13 September 2013

Why NVPROF and Nsight not profiling one of the kernels?

Why NVPROF and Nsight not profiling one of the kernels?

I have this CFD program in cuda, which when I execute using block of
dimension 16 * 16 and profile it, it gets profiled perfectly and shows a
kernel "NLMMNT" to be taking most of the GPU time. But I execute the same
program using block dimension 32 * 32, the program accelerates upto 5
times faster than before, and the results of the program are correct, but
now the profiler is not showing the profiling output for NLMMNT. When I
see the log of Nsight, there also its not showing the profiling of NLMMNT
to be complete. I can figure what may be the reason, I tried running that
application for hours but still NLMMNT's profile info is absent from the
profiler's output.
Log of Nsight can be seen in this screenshot...
http://s23.postimg.org/hbaect7uz/profoutput.png
By the way I am facing the same problem in Nvprof in Nsight eclipse
edition as well .
I have also cross checked that the kernel is getting launched finished
succesfully by checking the cudaError_t status before and after launching
the kernel. I am facing the same problem in both Nsight on Visual Studio
Editon 2010, cuda toolkit 5.0, Geforce GT 520MX and Nvprof on Ubuntu
studio 12.10, Nsight Eclipse Edition, nvprof v 4.0 , cuda toolkit 5.5
Geforce GTX 480.

CMS to use in creating a native android or ios app

CMS to use in creating a native android or ios app

Help needed
I need to know what is the proper way to create a native android and IOS
apps. Is it possible to use CMS' like Drupal, Wordpress or Joomla if not
Is PHP compatible in building apps using framework CODEIGNITER?
My skills: Client side: HTML5 CSS3 Javascript
Server side: PHP Codeigniter framework - beginner

How to connect Xcode and iTunes Connect

How to connect Xcode and iTunes Connect

I have completed my first app. iTunes Connect is waiting for its upload
and has designed the app "Waiting for Upload". I started the process of
archiving. When complete, I clicked the Validate button and received this:
"No identities available for signing". I tried to download identities and
received the warning sign and message " An administrator must request
identities before they can be downloaded".
The validation provided the following warning "warning: Application failed
codesign verification. The signature was invalid, contains disallowed
entitlements, or it was not signed with an iPhone Distribution
Certificate. (-19011)".
I have researched these messages through the forum and though there are
several sightings, I cannot for the life of me figure out what to do. I
assume there is some sort of breakdown in communication between Xcode and
iTunes Connect. My roles in iTunes connect are "admin" and "legal". I am a
team of one. Assistance would be greatly appreciated, for I have come far
and find defeat near at hand.

php : storing reference to other class object

php : storing reference to other class object

I come from a java background and m trying a hand at php. Right now I m
trying to pass a object to constructor of a class and trying to store a
reference to it inside the class and upon a function call to this call
execute a method from the stored reference.
$phpBook = new Book("Php Book", 500);
$vihaan = new Person("Vihaan", $phpBook);
Person.php
class Person
{
private $_book;
private $_name;
public function __construct($name, $book)
{
$_this->_book = $book;
$_this->_name = $name;
}
on this line
$_this->_book = $book;
I get a warning.
PHP Warning: Creating default object from empty value in
/home/vihaan/workspace/AdapterPattern1/Person.php on line 12
and this function call never enter the if block as $_book seems to be empty.
public function openBook($pageNumber = 0)
{
if(!empty($_book))
{
$_book->open($pageNumber);
}
}