basics

Whats up with the £ symbol

I'm a bit confused with the '£' symbol in Ruby. In JRuby if I do : puts '£40' in a .rb file I run this, I get ¬£40 In JRuby IRB I get : >> pung = 'h40' => "h40" >> pung.gsub!('h', '£') pung.gsub!('h', '£') => "\24340" The pound symbol is output as \243. In pure Ruby IRB, I cant even enter the £ symbol.. The cursor jumps to the...

What do I have to add to the manifest to debug an Android application on an actual Device?

What kind of permission/Flag do I have to add to the manifest to debug my application on an actual Android device? ...

=rand(100,60) - MSOffice Problem

Oho ! Have you tried this one ?? Very simple office utility question. The question is something like this. Open Microsoft word ( 2003 or 2007 ) whatever you use. After opening the word. Let's have a new empty blank document. ( It's up to you to have it or not ) Press enter to go to a new line. now type "=rand(100,60)" in new line No...

I'm making a simulated tv

I need to make a tv that shows the user the channel and the volume, and shows whether or not the television is on. I have the majority of the code made, but for some reason the channels won't switch. I'm fairly unfamiliar with how properties work, and I think that's what my problem here is. Help please. class Television(object): de...

Spaceship objects

I'm trying to make a program which creates a spaceship and I'm using the status() method to display the ship's name and fuel values. However, it doesn't seem to be working. I think I may have messed something up with the status() method. I'm also trying to make it so that I can change the fuel values, but I don't want to create a new met...

Codeigniter: Retrieving a variable from Model to use in a Controller

Hi, I bet this is easy but been trying for a while and can't seem to get it to work. Basically I am setting up pagination and in the model below I want to pass $total_rows to my controller so I can add it to the config like so '$config['total_rows'] = $total_rows;'. function get_timeline_filter($per_page, $offset, $source) { ...

setenv variable with spaces in launchd.conf ?!

I'm a Linux user that just recently got a mac. I'm trying to set up my IDE and found out that Macs don't use .bashrc / .bash_profile / etc. for GUI apps. So, if you have a GUI app that needs an environment variable, you're apparently supposed to do it in /etc/launchd.conf The thing is, this file uses csh style setenv syntax ("setenv key...

Get a list/tuple/dict of the arguments passed to a function?

Given the following function: def foo(a, b, c): pass How would one obtain a list/tuple/dict/etc of the arguments passed in, without having to build the structure myself? Specifically, I'm looking for Python's version of JavaScript's arguments keyword or PHP's func_get_args() method. What I'm not looking for is a solution using *...

Returning References from Function in VBScript

Hi, I am loosing my hair on VBScript. How the heck can I pass a reference as return value of a function? Currently my code looks like this: Set objUser = FindUser("bendert") REM Searches Directory for the User Function FindUser(UserLoginName) Wscript.Echo "Querying AD to retrieve user-data" Set objConnection = CreateObject("AD...

Scala array initialization

You have: val array = new Array[Array[Cell]](height, width) How do you initialize all elements to new Cell("something")? Thanks, Etam (new to Scala). ...

What to know - for building a form with PHP and MySQL

Hello all, I have three weeks to perform the following basic task. I wish to create an online form in PHP that will get 5 numbers and with them: save the numbers to a MySQL DB do a simple computation on the numbers and return them as an output to the visitor I already have a domain, hosting and a MySQL database+user. I don't know ...

Rails User Rating Another User

Hello, I am working on an application where a user has the ability to leave feedback on another user. Currently, I already have an implemented user model. Is this considered a self referential association? This seems a bit wierd to me (how to set it up through Active Record Associations). How would I go about setting this associatio...

rails Creating a model instance automatically when another is created

Hello I have a user model and a ratings model. Whenever a new user is created I want to create a new feedback model with it automatically. Each user model has one feedback model and each feedback model has many ratings. My Classes class User < ActiveRecord::Base end class Feedback < ActiveRecord::Base belongs_to :user has_many ...

include and using namespace in C++

for using cout, I need to specify both: #include<iostream> and using namespace std; Where is cout defined? in iostream, correct? So, it is that iostream itself is there in namespace std? What is the meaning of both the statements with respect to using cout? I am confused why we need to include them both. ...

Java - Multithreading !

If a thread holds a lock , what happens when the thread needs to enter another critical section controlled by the same lock? ...

(log(n))^log(n) and n/log(n), which is faster?

f(n)=(log(n))^log(n) g(n)= n/log(n) f=O(g(n))? ...

Define a swig interface file for generation of wrapper to every type from some header file

Hi! We're using some C library in our Java project. Several years ago some other developer which has retired few years ago (as always) has created all the wrappers for us. The wrappers were generated by the swig, but the interface file is lost now. The basic idea of library and the wrappers for it is following: There only one function...

Constructors in Programming languages

Why constructor is not considered as member of a class ? Is there any specific reason ? Thanks and regards. ...

Local variables in java

Hello , I went through local variables and class variables concept. But I had stuck at a doubt " Why is it so that we cannot declare local variables as static " ? For e.g Suppose we have a play( ) function : void play( ) { static int i=5; System.out.println(i); } It gives me error in eclipse : Illegal modifier for par...

Short intruduction to OOP basics

Hi. Can somebody point me to good intruductions into OOP main paradigms, like inheritance, polymorphism, encapsulation? I am looking for short article, about 2-3 pages, for very quick reading. Thank you very much. ...