Wednesday, 2 October 2013

Objective C adding C++

Objective C adding C++

I have been given some C++ classes to incorporate into my Objective C
project. I've never done this before, so I have to ask:
Is there something special I need to do or can I just rename the .cpp to .mm?
What about importing (or including) the .h file? Anything special I need
to do there?
Just baby steps here. Thank you.

PHP if statements with multiple values

PHP if statements with multiple values

Is there a shorter way of writing this?
<?
if($_GET['id']==1 ||
$_GET['id']==3 ||
$_GET['id']==4 ||
$_GET['id']==5)
{echo 'does it really have to be this explicit?'};
?>
Something like this perhaps?
<?
if($_GET['id']==1 || 3 || 4 || 5){echo 'this is much shorter'};
?>

Pointers in B Tree

Pointers in B Tree

I read about B trees and understand their input, delete methods. I read
with an introduction like this:
When we build structures on disk, we must deal with certain realities of
access and transfer time:
Random access to disk typically requires on the order of 10-20 ms access
time to position the head and wait for data to come up under it.
Once the head position is right, data can be transferred at rates in
excess of 1 million bytes/sec.
Observe, then, how total transfer times behave for different size blocks
(assuming a fairly fast 10 ms access time, and 1 megabyte/sec transfer
rate)
So, B Tree Data Structure is made for serving from disk ( which is what
makes them great for Databases ). But when I tried to implement it, I hit
this problem.
Normal B Tree diagrams shows pointers to child nodes which then descend
down to leaves.
But how do I make pointers on the disk? Is it like a file name ?

Tuesday, 1 October 2013

Access igraph R objects from Python

Access igraph R objects from Python

I have a graph object created with the igraph R package. If I understand
the architecture of the igraph software package correctly the igraph R
package is an interface to use igraph from R. Then since there is also a
igraph Python interface I wonder if it is possible to access my igraph
object created with R via Python directly. Or if the only way to access
and igraph R object from Python is to export the igraph R object with
write.graph() in R and then import it with the igraph R package.

Custom URL in PHP

Custom URL in PHP

I am trying to create custom profile URLs using PHP.
I currently have the following URL:
http://mysite.com/profile.php?user=1
where user_id 1 is Kyle Hagler in the database.
I would like to allow access to this same page through the following url:
http://mysite.com/kylehagler

Cont'd Decimal Expansion, rational or not?

Cont'd Decimal Expansion, rational or not?

This is a follow up from this question.
Since it's proven by Calvin Lin that $0.11235813213455...$ (Fibonacci
Sequence), I'm not wondering if the sequence
$$0.123456789101112131415...$$
(which is just natural numbers) is rational or not. Thanks for the help in
advanced!

which shell will sudo use to execute a shell script without the shebang line – unix.stackexchange.com

which shell will sudo use to execute a shell script without the shebang
line – unix.stackexchange.com

My environment is Ubuntu 12.04 LTS, and the sudo version is 1.8.3p1. First
I login as a normal user: $ whoami fin $ cat /etc/passwd | grep -i
"root\|fin" root:x:0:0:root:/root:/bin/bash ...