basics

Django: How do I prepend

Hello, I'm exploring Django and got this particular problem. How do I prepend <span class="label">Note:</span> inside {{article.content_html|safe}}? The content of {{article.content_html|safe}} are paragraph blocks, and I just wanna add <span class="label">Note:</span> in the very first paragraph. Thanks! ...

C++ Basic Class Layout

Learning C++ and see the class laid out like this: class CRectangle { int x, y; public: void set_values (int,int); int area () {return (x*y);} }; void CRectangle::set_values (int a, int b) { x = a; y = b; } I know Java and methods(functions) in Java are written within the class. The class looks like a Java interface...

Noob question: Draw a quad parallel to the view.

Hi all, ok what I want to do is to draw a quad in the scene that lays on a plane parallel to the view. So it should appear flat. More in particular, I think I didn't get very well how the mechanism of gluLookAt works in comparison with the functions glTranslate and glRotate: If I position the view "manually" using the functions glTran...

Creating dynamic text for a literal control

On the ListView1_ItemDataBound of a list view event, i create the literal.text like so... <span style=&quot;position:relative;&quot;> style="position:relative"> <span id=&quot;term1&quot; class=&quot;popup&quot;>This id="term1" class="popup">This is the answer!</span> <a href=&quot;javascript:void(0);&quot;onMouseover=&quot;ShowPop('ter...

is it right to assigning multiple variable like this a = b = c = d = 5 in ruby?

a = b = c = d = 5 puts (a) >> 5 puts (b) >> 5 puts (b) >> 5 puts (b) >> 5 a= a+1 puts (a) >> 6 puts (b) >> 5 i found there is no problem with the assigning value like this. my question is should one assign like the one given above or a , b, c, d = 5, 5, 5, 5 ...

Are there any simple, stupid, module based, cross-platform, c++ projects that I can check out of a repository?

I'm looking for one just to get a general idea of how a standard C++ project should be properly setup. (If that's possible... :-p) Here are my requirements for this project: module-based (has libraries/modules that compile into a main program module) compiles cross-platform I'd like to do this so that I can get a hold on the basics ...

How to set text position programmatically in EditText class?

Hello all, Does smomeone know how I set the scrollbar position in an EditView programmatically. I'm appending the text during special events but I want the EditView to scroll down to the latest text added so it'll be visible. But default the scrollbar does not move automatically when appending text. / Henrik ...

Why is this c++ string concatenation missing a space?

I am working with c++ strings, and am a beginner at programming. I am expecting: 99 Red Balloons But I am receiving: 99 RedBalloons Why is that? #include <string> #include <iostream> using namespace std; int main() { string text = "9"; string term( "9 "); string info = "Toys"; string color; char hue[4] = {'R','e...

how to specify a pointer to an overloaded function?

I want to pass an overloaded function to the std::for_each() algorithm. e.g.: class A { void f(char c); void f(int i); void scan(const std::string& s) { std::for_each(s.begin(), s.end(), f); } }; I'd expect the compiler to resolve f() by the iterator type. Apparently, it (gcc 4.1.2) doesn't do it. So, how can I specify which ...

Resources/Teaching ideas to teach computers to kids

A small initiative from my work place plans to teach very basic computers to not so fortunate kids. I was looking for some very basic topics/resources. These kids are very young and have not seen/worked with a computer before. The fun factor should not be lost and hence I don't want it to be rigorous, just plain, what is computer, keybo...

WMI with Qt examples and info

Where can I find more information on and examples of using WMI with Qt? I have no prior experience with WMI. ...

Template Class – Symbols not found

I've seen a few related posts, but I can't really make sense of what I need to do to fix a program I'm making for my entry-level C++ class. My errors are: Build Final Project of project Final Project with configuration Debug Ld "build/Debug/Final Project" normal x86_64 cd "/Users/nick/Dropbox/|Syncs/Xcode/Final Project" setenv MACOSX...

Why do I get a Warning and a Fatal error when I use ../ ?

When I use ../mysqlConnect.php I get the following messages. Warning: require_once(../mysqlConnect.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/etc... Fatal error: require_once() [function.require]: Failed opening required '../mysqlConnect.php' (include_path='.:/usr/local/php5/...

Some basic Comet/Jquery questions?

My questions are: What's a meta, what do subscribe and unsubscribe do, and what does startBatch/endBatch do? ...

Basics of Strings

Ok, i've always kind of known that computers treat strings as a series of numbers under the covers, but i never really looked at the details of how it works. What sort of magic is going on in the average compiler/processor when we do, for instance, the following? string myString = "foo"; myString += "bar"; print(myString) //replace with...

Rails After Validated Save Go to Edit Path

This seems like a fairly simple problem to me but I have been having some issues. In one of my views I use something like <% if current_page?(:controller => "activities", :action => "new") %> *Do something here* <% end %> and it does something specific on the new page for a form. Easy enough and it works great. Unfortunate...

Android : Loading an image from the Web with Asynctask

How do I replace the following lines of code with an Asynctask ? How do you "get back" the Bitmap from the Asynctask ? Thank you. ImageView mChart = (ImageView) findViewById(R.id.Chart); String URL = "http://www...anything ..."; mChart.setImageBitmap(download_Image(URL)); public static Bitmap download_Image(String url) { //-...

What happens when Dan change text into 'aB' and John to 'abc'?

Imagine a very simple textdocument (text.txt) with as content just the letters 'ab'. This file has been check-in in a canonical (remote) repository. Two people have a local close of this repository and thus this file and start editing it. Dan changes the content to 'aB' (note the capital B) and John edits his version to 'abc'. Dan does ...

CSng() or x 1F ?

Suppose option Strict On; a and b - Integers Dim mySingle as Single = a / b ' implicit conversion error Solution A) Dim mySingle as Single = CSng(a / b) ' CSng Solution B) Dim mySingle as Single = a * 1F / b ' x 1F What solution is preferable? What solution to take if performance is important? ...

How to check if all of the elements in a list return true for a property using Linq?

I would like to have a LINQ statement that calls the property IsValid. If all elements returned true, I want the statement to return true as well. How can it be done? ...