If a variable will always be a number, is there a performace loss by putting it in inverted commas?
for example
"SELECT prod.product_name FROM prod WHERE prod.id = '$id'";
Say you have a variable n1 which will be the value of three digits entered
how can i then without knowing what exactly will be input split n1 into 3 seperate integers to do futher calculations with?
I'm using curl to send POST request to web service http ://localhost 2325//Service
How can I desirialize body of the POST request into a variable which I could then access within my POST method ?
Can someone give me an example?
This is my method
[WebInvoke(RequestFormat = WebMessageFormat.Json, UriTemplate = "/user", Method = "POST")] public void Create(User us)
Class User contains user_id and user_name.
Can anyone please help?
All I need is an example how to formulate POST request in curl
Thanks
After reading a question on @private I understand how that works. However, since all variables default to @protected and you cannot really access a variable without defining an accessor, what exactly does @public do? When would you use it?
Google didn't turn up anything that seemed relevant.
I have a bunch of existing, working C++ code, and I'd like to use python to crawl through it and figure out relationships between classes, etc.
EDIT: Just wanted to point out: I don't think I need or want to parse every bit of C++; I just need something smart enough to pick up on class, function and member variable declarations, and to skip over function definitions.
Hi,
I have this code that works just fine on the development server but
when I deploy the application, the session isn't created.
What am I doing wrong?
HttpSession session = req.getSession(true);
session.setAttribute("loggedIn", new String("true"));
Edit:
The sessions are enabled.
What I realized now is that the _ah_SESSION variable is not being
created, not even on the development server (although it works).
I have two fields:
string date1 = "04/26/10";
string date2 = "04/25/10";
How can I compare these two fields like so?:
if (date2 <= date1)
{
// perform some code here
}
Can this be done without first converting the fields to a separate date-type variable?
As the title states, I need to relace all occurrences of the $ sign in a string variable with an underscore.
I have tried:
str.replace(new RegExp('$', 'g'), '_');
But this doesn't work for me and nothing gets replaced.
Probably a stupid question, but I can't find any documentation anywhere for it. Is there a way to do an if in prolog, e.g. if a variable is 0, then to do some actions (write text to the terminal). An else isn't even needed, but I can't find any implementation of if.
What is the "computer science" term for the practice of assigning a special meaning to one of a type's values. For example a numeric variable called "amount_to_transfer" where the special value "0" means "entire account balance" or a date value "spouse_date_of_birth" where "1/1/1800" means "unmarried".
I happen to feel that this is quite a bad "smell", but I'd like to have a name for it, and if possible, some blog post or article about why it's bad and how to fix it.
How can I write the output of this line of code to a float variable instead of piping it to a file? The output of this line is a floating number.
FILE *child = _popen("java -jar c:\\simmetrics.jar c:\\chtml.txt c:\\thtml.txt", "r");
With a cURL request I load a complete website into a variable: $buffer.
In the source of the site there are two labels in between which my relevant content is placed.
****** bunch of code *******
<!-- InstanceBeginEditable name="Kopij" -->
this part I want to store in a match
<!-- InstanceEndEditable -->
****** bunch of code *******
I've been messing around with preg_match and its regexp. Can someone try to help me?
Thanx in advance.
Hi,
I'm creating a used cars website (written in PHP), and I'm stuck on sending advanced search options from form. I have more than 30 of them and I wonder if it's possible, and how, to send them in one variable (for example &options=1,2,3,5,6,10 or some other way..). Also I've heard that this is possible with "bitwise" but I don't have a clue how to do that. Or if someone have a better idea, please let me know.
Thanx
I have a class where I'm using __set. Because I don't want it to set just anything, I have an array of approved variables that it checks before it will actually set a class property.
However, on construct, I want the __construct method to set several class properties, some of which are not in the approved list. So when construct happens, and I do $this->var = $value, I of course get my exception that I'm not allowed to set that variable.
Can I get around this somehow?
I'm iterating through a variable called content, it contains several HTMLLIElement objects.
How can i use jQuery's or JavaScript's functions with this object?, what I'm trying to do is the kind of validation written in the commented code.
$.each(content, function(index, value){
//if(!value.is(':hidden')){
console.log(index + ' : ' + value);
//}
});
What I'm getting is
Uncaught TypeError: Object # has no method 'is'
If I do value.getAttribute('style'); I get 'display: none;'
Is there a static code analyzer for PHP files? The binary itself can check for syntax errors, but I'm looking for something that does more, like unused variable assignments, arrays that are assigned into without being initialized first, and possibly code style warnings. Open-source programs would be preferred, but we might convince the company to pay for something if it's highly recommended.
Since html do not have the attribute 'name',I am looking for a way to accept the value of , which I populated in views, in the controller and assign it a variable name for another use.
I am trying to obtain an instance of my live wallpaper engine in another class,
here is my code...
In the other class:
WallpaperEngine wpe = (WallpaperEngine) LiveWallpaperService.onCreateEngine();
In LiveWallpaperService:
@Override
public Engine onCreateEngine() {
// TODO Auto-generated method stub
return new WallpaperEngine();
}
But when I refer to an object in my engine (i.e, "wpe.variable"), I get a NullPointerException and the wallpaper force closes.
I find this syntax astoundingly annoying. Every time I rename my class, I have to change this call for no apparent reason. Isn't there some __class__ magic variable or something I can use at least? Interested in answers for Python 2.5, but it doesn't hurt to know if later versions fixed this.
defined variable:
LinkedList list1=new LinkedList();
Object get() in list1 obtains a node of list1
Object remove() in list1 deletes a node of list1
count() is length of list1
for(int i=1;i<list1.count();i++){
if(list1.get(i).startsWith('"',0)) //Error here
list1.remove(i);
}
Error: cannot find symbol
symbol: method charAt(int)
location: class Object
how to fix this problem?
I would like to delete the node in list1 which starts with (").
I am trying to figure out what is needed for the CONTACTS_IMPORT_CALLBACK variable in django-friends or django-contacts-import applications (contact import is built from friends). I have tried view models, etc.. but everything throws errors. Neither application has documentation so I am just grasping at straws for what is needed. Can anyone point me in the right direction?
hi,
what does this construct mean in PHP ? It is storing a variable called "function" with his String value in an array ?
array('function' => 'theme_select_as_checkboxes')
thanks
Hello,
I am trying to redirect from:
domain.com/uploads/$
to
domain.com/download.php?file=$
$ being the variable.
I have tried many different ways but do not seem to be redirecting, I've tried, R=301,L,QSA and in various different orders.
Anyone help? Thanks!