simple

C return and comparation inline

Hi everyone, I'm just to figure out what does this method do, I know there must be a way to put this line by line, can you help me please? Thanks int conditional ( int n, EXPRESSION * * o ) { return (evaluateExpression( *o++ )? evaluateExpression( *o ) : evaluateExpression( *++o ) ); } UPDATE: This is the evaluateExpression Code ...

ONE TO ONE LEFT OUTER JOIN

Hi everybody, I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, but there exists only ONE record that match that condition, so when it found its pair on B, it must stop and continue with th...

.htaccess redirect to a directory

This is a very silly question but I am pretty weak in htaccess. I want all files (php, css, javascripts and images) located at http://localhost/template/* to point to http://localhost/* along with a 404 Error Handler that is located at http://localhost/tempalte/404.php I almost got it here but when I change RewriteRule ^(.*)\.(css|php...

simplest way to do recursive t-sql for multiple selects

Hi all, I am developing a Bill Of Materials cost calculator program and I am struggling to fathom a simple solution to some recursive selects I want. I am using SQL Server 2005 for this part of the application. Say I have Product A, which contains assembly B, and Part C. Assembly B will contain parts D and E, but, here is where I s...

C++ Object without new

Hi, this is a really simple question but I havn't done c++ properly for years and so I'm a little baffled by this. Also, it's not the easiest thing (for me at least) to look up on the internet, not for trying. Why doesn't this use the new keyboard and how does it work? Basically, what's going on here? CPlayer newPlayer = CPlayer(posi...

python: how can i avoid " list index out of range" in this simple while loop

my L1 array contains numbers like 0.029999999999999999 which i want to print off as 0.03 my code works, but gives an error at the end because the last count is out of range. i understand why it breaks, but dont know how to fix it. thanks count = 1 while L1: print "%.2f" %L1[count] count = count + 1 ...

Very simple bar graph

First I will have to apologise for my ignorance as I'm sure this is a very simple question but I am very new to R. My question is that I have a data frame that looks like this; countrydes Insured USA 4500 CANADA 4500 USA 7500 CANADA 7600 All I want to do is aggregate the sum of...

Simple C++ Instant messenger

I want to make a very simple c++ instant messenger for lan networks and internet (direct IP connect). I know little about sockets. I searched the internet, but nothing really helped. I would someone to suggest a howto/tutorial/guide. I just want to send and receive messages (in a console window, I'll create the gui later). I want it to b...

How do deal with developers that over complicate projects

Hey, So I think every team has one of those developers that is always "cutting edge" or wants to over complicate something that can be kept simple. My preference is why build a rocket when you only need a bike? So how do you deal with those team members? What if they have the mentality that since you are telling them its to complicated...

Horizontal Navbar (jQuery)

I'd like to create a very simple horizontal navbar based on the following HTML: <div id="nav"> <ol class="clear"> <li><a href="#">Parent 1</a></li> <li><a href="#">Parent 2</a> <ul class="clear"> <li><a href="#">Child 1</a></li> <li><a href="#">Child 2</a></li> ...

C++ - Hold the console window open?

Hi, my question is super simple, but I'm transitioning from c# to c++, and I was wondering what command holds the console window open in C++? I know in C#, the most basic way is: Console.ReadLine(); Or if you want to let the user press any key, its: Console.ReadKey(true); How do you do this in c++? The only reason I ask this simpl...

c++ - How to get rid of this Constructor error?

Hi there, I've taken 2 OOP C# classes, but now our professor is switching over to c++. So, to get used to c++, I wrote this very simple program, but I keep getting this error: error C2533: 'Counter::{ctor}' : constructors not allowed a return type I'm confused, because I believe I have coded my default constructor right. Here's my co...

Implementation of a simple algorithm (to calculate probability)

EDIT: I've got it, thanks for all the help everyone! + Cleaned up post a little bit. Also, this article was very helpful: http://www.codinghorror.com/blog/archives/001204.html?r=1183 Hi all, I've been asked (as part of homework) to design a Java program that does the following: Basically there are 3 cards: Black coloured on bot...

Simple XML deserialization

I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test: import java.io.StringReader; import java.io.StringWriter; import junit.framework.TestCase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Root; import org.simpleframework.xml.Seri...

[Android] Beginners problem

Hi, I am pretty new to programming and just to try Andorid. I am trying to create an simple app that ask after a string from the user and after that I want my program to go out on the internet with the web-browser. But I get 2 things wrong, one thing is my way to go on the internet but that I know I chose the wrong method, but the other...

Simple 'require' problem in Ruby

Hello, I'm following along with 'Why's Poignant Guide to Ruby' in order to learn Ruby and I am having some problem when he first introduces the 'require' method(?) in his tutorial. Essentially I make a file called 'wordlist.rb' which contains: code_words = { 'starmonkeys' => 'Phil and Pete, those prickly chancellors of the New Rei...

A simple jQuery plugin to open a modal window

Please, I need help. I am new to jQuery and I have link which on click should open a modal window of some sort (I want to be able to controll the position of it). This is a simple window. It only contains some text and I want it to have just a closing button. That is all. How can I do this in jQuery? I want something very simple, wit...

Adding a "Big Icon" to the Joomla admin dashboard

I've done this befor but with all my memory, search efforts and logic failing I can't figure out how to add a new "Big Icon" link on the main dashboard of the Joomla administration. What file am i looking to change? I'm sitting on a fresh install of 1.5.15 ...

Error when return XML via Python Simple Web Server

I wrote a small web server using wsgiref.simple_server in python. It get and parse request via URL (environ.get('PATH_INFO')). Data return in xml format. I've test it, everything ok before return to client, xml string no problem (using print xml to view before return). With Firefox, IE, sometimes xml string show in FF, IE has error: XML...

AWK subtract numeric record two from record one

I cannot solve a very simple problem. My data file looks like: Crap Crap 0.123456789D+09 Crap Crap Crap Crap 0.123456798D+09 Crap Crap I need to use AWK to subtract the number in the third column; the SECOND row minus the FIRST row. I tried: cat crap.txt | awk '{ A[NR-1] = $3 } END { print A[1] - A[0] }' to no success. Maybe the f...