For clarification: I know how evil globals are and when not to use them :)
Is there any performance penalty when accessing/setting a global variable vs. a local one in a compiled C++ program?
Is there any method or plugin available that will alert the user to upgrade an app if the version they are using is not the latest? I suppose I could ping a web service to check what the current version is and compare with the user's version and go from there. As an aside, is there a way to check the current version of the app (some property I don't know about) or do you simply have to hardcode the version as some float variable or something?
Thanks
I have just seen this in code
var thisYear = (new Date()).getFullYear();
See it live on JSbin.
This is cool, as I've always done something like that in 2 lines, i.e. create the new object instance and assigned it to a variable, then called the method on it.
Is this new method fine to use everywhere? Any gotchas?
Hello.
I have the function with following signature:
void box_sort(int**, int, int)
and variable of following type:
int boxes[MAX_BOXES][MAX_DIMENSIONALITY+1]
When I am calling the function
box_sort(boxes, a, b)
GCC gives me two warnings:
103.c:79: warning: passing argument 1 of ‘box_sort’ from incompatible pointer type (string where i am calling the function)
103.c:42: note: expected ‘int **’ but argument is of type ‘int (*)[11] (string where the function is defined)
The question is why? Whether int x[][] and int** x (and actually int* x[]) are not the same types in C?
Hello
I'm looking for a piece of relatively simple software to browse large C++ project. What I would like is something that is somewhere between a simple text editor and a full-blown IDE like Eclipse. I would like syntax highlighting, a way to see all classes/methods defined in a file, a way to find where a particular method is called from and where a variable is declared/defined.
Any ideas?
Thank you!
For example:
In Perl:
@array = (1,2,3);
system ("/tmp/a.sh @array" );
In my shell script, how do I handle this array in shell script? How do I handle the shell script to receive the arguments, and how do I use that array variable in shell script?
I have an asp.net page where I get the user_id from who's logged in. Now I need to pass this user_id to a flex application that runs in an asp.net page as a .swf.
How can I get this user_id in a variable in my flex application.
Or what is the best way to get the user_id into flex.
Thanks
I have a form into which the visitor can enter data, and I want to store this data in a mysql database via the $_POST variable. What do I need to prevent sql injection?
Could somebody please explain why the variable named foo remains true in the code below, even though it's set to false when the method is called? And why the symbol version behaves as expected?
def test(options = {})
foo = options[:foo] || true
bar = options[:bar] || :true
puts "foo is #{foo}, bar is #{bar}"
end
>> test(:foo => false, :bar => :false)
foo is true, bar is false
I've only tried this using Ruby 1.8.7.
import random
def some_function():
example = random.randint(0, 1)
if example == 1:
other_example = 2
else:
return False
return example, other_example
With this example, there is a chance that either one or two variables will be returned. Usually, for one variable I'd use var = some_function() while for two, var, var2 = some_function(). How can I tell how many variables are being returned by the function?
I'm experiencing a problem of $.get function.
The url contains JSON
this is my code:
xyz = null
$.get('http://www.someurl.com/123=json', function(data) {
var xyz = data.positions[0].latitude;
});
alert(xyz);
//some more code using xyz variable
I know that xyz will alert a null result because the $.get is asychronous.
So is there any way I can use the xyz outside this get function?
Thank you
I want to send the below data to default.ctp, I want to display menus in all the pages, I'm using Auth, The problem is if I'm logged in I get the Menus correctly, but if I logout, I'm getting error saying variable'$topMenu' not found.
The MenuController can be accessed only if logged in.
$this->loadModel('Menu');
$this->set('topMenu',$this->Menu->find('all'));
Any help on how to solve this?
Suppose this is my URL route:
(r'^test/?$','hello.life.views.test'),
How do I make it so that people can do .json, .xml, and it would pass a variable to my views.test, so that I know to make json or xml?
Hello,
GNU Emacs 23.1.1
I am maintaining someones code. There are many files and directories for the headers and source files.
I am wondering if there is a easy way to use emacs that when I highlight a variable name I can go straight to where it is declared?
Some of the structures I am working in are declared in other header files, rather than go searching for them, I just want to be taken straight to them.
Many thanks for any suggestions,
Hi ,
I wanted to know if there is any system variable which is can use to access package execution start and end times. My requirement is that i need to store this in 2 relevant fields in a table in the database.
Thank you.
Abhi
I have a program that I'm working on that register global hotkeys
I would like to use that ability to trigger highlighted text or data to be copied to the clipboard and then read from the clipboard into a variable in my program
which i will later use in reverse to paste it back out.
(example ctrl+1 copys to quque #1 and alt+1 pasts what is in quque 1)
thanks so much.
In scripting languages like Perl, it is possible to read a file into a variable in one shot.
open(FILEHANDLE,$file);
$content=<FILEHANDLE>;
What would be the most efficient way to do this in C++?
if i have defined a global variable(with initialization) in header file, and included this file in two file and try to compile and link, compiler gives linking error
-----------------
>>headers.h
#ifndef __HEADERS
#define __HEADERS
int x = 10;
#endif
>>1.c
#include "headers.h"
main ()
{
}
---------------------
>>2.c
#include "headers.h"
fun () {}
How to create a new data type which to can check/validate its schema when is created a new variable (of that type)?
By example, to validate if a string has 20 characters, I tried:
{{{
// Format: 2006-01-12T06:06:06Z
func date(str string) {
if len(str) != 20 {
fmt.Println("error")
}
}
var Date = date()
type Account struct {
domain string
username string
created Date
}
}}}
but it faills because Date is not a type.
I would like to assign a value in a class property dynamically (that is referring to it using a variable).
#Something like:
setPropValue($obj, $propName, $value);
Is there any possibility to copy variable by reference no matter if its int or class instance?
My goal is to have two lists of the same objects and when one changes, change is visible in second.
In other words i need pointers:/
How do I parameterize a query containing an IN clause with a variable number of arguments, like this one?
select * from Tags
where Name in ('ruby','rails','scruffy','rubyonrails')
order by Count desc
In this query, the number of arguments could be anywhere from 1 to 5.
I would prefer not to use a dedicated stored procedure for this (or XML), but if there is some fancy SQL Server 2008 specific way of doing it elegantly, I am open to that.
On my page.
i have one textbox and one button.
-- on the button click event. -- one function will be called.
Now,
How to get that value of textbox and store in php variable? this should be done in that function which we will call on button click.
I have HTML content stored in a variable. How do I extract data that is found between a set of common tags in the page? For example, I am interested in the data (represented by DATA kept between a set of tags which one line after the other:
...
<td class="jumlah">*DATA*</td>
<td class="ud"><a href="">*DATA*</a></td>
...
I know that in community server which means that you can't use Sessions, and few years ago i remember i was working on a website where we were not allowed to use sessions.
In my point of view sessions are a very helpful tool if we managed how to use the right way, but is using session variable in a website is something bad, when its bad and when its not?