variables

Dynamic vs non-dynamic class members

In C++, ff I have a class that needs to hold a member which could be dynamically allocated and used as a pointer, or not, like this: class A { type a; }; or class A { A(); ~A(); type* a; }; and in the constructor: A::A { a = new type(); } and destructor: A::~A { delete a; } are there any advantages or ...

Static Variable Pointer?

Is this illegal/dangerous? int* static_nonew() { static int n = 5; return &n; } The compiler doesn't seem to have a problem with it, but is the pointer location itself protected from being overwritten when someone else needs memory? EDIT: A little bit more of an explanation of why I asked this question. Note: I'm programming ...

declare global variable in nsobject class (objective C)

Hi, I declare a variable and some methods in the global nsobject class like @interface classGlobal : NSObject { NSString *myGuid; } @property(nonatomic,assign)NSString *myGuid; and i synthesize in the .m class. but when i try to access the myGuid variable in the same class (classGlobal.m) then it shows the error "instance variab...

Possible to redefine the SessionID in a ColdFusion session?

I'm trying to redefine the SessionID of a ColdFusion session, is this possible? ...

Increment a value in XSLT

I'm reasonably new to xlst and am confused as to whether there is any way to store a value and change it later, for example incrementing a variable in a loop. I'm a bit baffled by not being able to change the value of a after it's set doesn't make sense to me, making it more of a constant. For example I want to do something like this...

Invoke With Two Parameters Of Different Variable Types?

How can I write an invoke method with two parameters of differing variable types? public void InsertStockPrice(double Value, string Company) { if (InvokeRequired) { Invoke(new Action<double>(InsertStockPrice), Value); // <- Not sure what to do here } else { //Do stu...

How to use zval in PHP?

Hello, Could you any practical example showing how to make use zval containers? The only related function I know is debug_zval_dump, but I never really used it. Edit: I suppose, tracking zval containers I could see how to optimize the code, see how the memory is used by references. It seems it could be useful tool in some cases. There...

Passing a url as a variable into thumbalizr php

I am using the Thumbalizr API for capturing website screenshots. I am trying to pass a url from a variable into the script below where it currently says "www.google.com". When I try and do $url = "www.google.com"; and pass that to $image->request($url); it seems to fail and retrieves a screenshot but one that suggests the url was unrea...

Python - PHP Shared MySQL server connection info?

I have some MySQL database server information that needs to be shared between a Python backend and a PHP frontend. What is the best way to go about storing the information in a manner wherein it can be read easily by Python and PHP? I can always brute force it with a bunch of str.replace() calls in Python and hope it works if nobody ha...

Java constructor final variable assignment

public class User { private final String _first_name; private final String _last_name; private final String _org_ID; private final TimeZone _time_zone; private final InternetAddress _email; private final Date _last_login; private final Date _creation_date; public User( final String org_I...

PHP Session Variables - At Wit's End

I'm just getting in to MySQL and PHP--and I'm just trying to create a simple login system for a project we're testing. I've connected and created the login logic just fine, but now I can't for the life of me get the session variables to carry over to the new pages. Could someone please show me the correct way to do this? Here is my lo...

Iterating variables to change its features in Python

I assigned values with setattr() function in a loop: for i in range(30): for j in range(6): setattr(self, "e"+str(i)+str(j), Entry(self.top)) , then I want to apply .grid() func. to all these variables with a loop. For example, self.e00.grid(row= 0, column= 0) How can I do that? ...

Python - Assign global variable to function return requires function to be global?

So, I'm confused. I have a module containing some function that I use in another module. Imported like so: from <module> import * Inside my module, there exist functions whose purpose is to set global variables in the main program. Some of the global variables need to be assigned to the output of another function in that same module....

How do I submit a value by url in php

Hi. I tried this in my php site <a href=?command=value>hell yeah</a> And this to get the value : if(isset($_POST['command'])){ $command=strip_tags($_GET['command']); Does not seem to work.. Ps. The url have one this value also: ?lang=en_US ...

How can I access a member variable of the current running Activity in Android?

I have an Android activity running with a custom view in it. When something happens within that custom view, I want to tell the currently running activity by changing one of the Activity member variables. Is there a way to access the current running activity member variables from within a custom view class besides passing the activity ...

jQuery: Selector inconsistencies, can someone please explain what i'm doing wrong here

Why does this work: $("div.cat_rollout").mouseover(function(){ $(this ).removeClass().addClass("cat_rollover"); $(this).animate({ fontSize: "22px" }, 'fast' ); }).mouseout(function(){ $(this).removeClass().addClass("cat_rollout"); $(this).animate({ fontSize: "10px" }, 'fast' ); }); But this does not: $('.vp...

Best way to test for existence of a variable in Python

I am reading a million plus files to scrape out some data. The files are generally pretty uniform but there are occasional problems where something that I expected to find is not present. For example, I expect some sgml code to identify a value I need for data_line in temp #temp is a list of lines from a file if <VARIABLENAME> in...

jquery and passing global variables

I have the following: window.linkFrom; $(document).ready(function(){ $("a.linker").click(function(event){ window.linkFrom = $(this).closest("div").attr("id"); alert(window.linkFrom); }); }); and want to pass the var linkFrom to a different script on a second page: window.linkFrom; (doc...

Sounds stupid but... I need help setting a variable in PHP

I have a config class which gets used throughout my code. One variable within this class is the website URL. Recently, I added SSL to my server and now I need to check for this and assign either 'http' or 'https' as the protocol. The code I tried is: <?php class Test { public static $blah = (1 == 1) ? 'this' : 'or this'; } echo Te...

Need an input field not select PHP HELP

Hello All, Just hoping someone can help me out I've spent hours trying to figure this one out... I need to edit the following PHP so I can have the user enter an amount rather then having to select from a drop down list. <? include("includes.php"); session_start(); /**************************************************************...