Programming :: Php And Variable Class Names?
Sep 30, 2010
How can I handle the situation below so that the "Fatal Error" message is not shown. It would be ideal if I could supply a default class to be used. I'd prefer to not use: ini_set() to supress the errors but actually be able to "handle" the error.
Code:
<?php
class MyClass
[code]....
View 2 Replies
ADVERTISEMENT
May 23, 2011
I'll try to be clear but I think I'm in a mess with my code right now, so it may appear here too
Here is a function. The part I want you to see is the 'eval' sentence.
This works.
It evaluates ${SourceTxt} (which is $1), takes away a part of it and uses it as an array to put data in.
That's alright.
Code:
Now, later, I NEED to count the number of elements in the array(s).
So, I try to do something like....
Which gives me the evaluated name ('#txtFields_email_customers[@]' e.g)
Or
Which gives me nothing....
I was wondering if I was reaching the limits of bash in this kind of capabilities, or if there is a.... bash-like solution. I.e. a good solution
View 7 Replies
View Related
Jul 13, 2011
I am bad with bash programming and I need some help how I can make variable names out of a string.I will need some help start doing that. And I think the first would be to get part of the filenames strings into variables.
View 7 Replies
View Related
Apr 7, 2011
In my script, and I would like to concatenate 2 variables names, to give me the true variable.I've 3 variables X1, X2 and X3, and I invoked them inside a for loop.
Code:
#!/bin/bash
X1=HELLO
[code]....
View 4 Replies
View Related
Mar 27, 2010
I want to have an environment variable name (not value) containing ':', such as X:X=PQR. There seems to be no reason in principle why not. According to this:[URL].. the only printable character you can't have is '='. And indeed I can set and get such variables with a C program:
#include <stdio.h>
main()
{
setenv("X:X", "PQR", 1);
printf("%s
", getenv("X:X"));
[Code]..
and I can't find a quoting mechanism to make this work. Is there a unix guru out there who knows how to do this in bash, or any other linux shell?
View 5 Replies
View Related
Aug 21, 2009
I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.
For example:
Code:
Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).
View 6 Replies
View Related
Apr 7, 2010
my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.
i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't
foo=+12.40
bar=${foo#+}
View 4 Replies
View Related
Apr 25, 2011
how I can search within a variable and assign the results to a new variable. I'll use the following as an example -
cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`
with the echo command I get the following output assigned to list -
A
C
C
What I'd like to get for output is -
Audi
Cadillac
Chevy
how I could do this regardless of upper/lower case letters?
View 5 Replies
View Related
Apr 28, 2010
included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?
View 8 Replies
View Related
Feb 12, 2011
im trying to build a simple program for my C programming class, this is the source code
#include <stdio.h>
int main()
{
int length, width, length, height, area, perimeter;
perimeter = width + length + height;
area = width * length + heigth;
[Code]...
i dont see any error (you might)but every time i run it it runs but after it asks me to input for the width i do it but it doesn't take me to the length, it just stays blank until i input another value in the same place for the width, it asks me for 4 inputs in total i don;t know why, and after i run it different times it gives me different values for the perimeter and are. how can I fix this?
View 5 Replies
View Related
Mar 12, 2010
I have a problem with compiling vdrift-2009-06-15 using scons. As the source that i obtained only supports scons i cannot use make. the error that i get when i try to compile it in GNOME Terminal is: scons: Reading SConscript files ... scons: warning: The Options class is deprecated; use the Variables class instead.
File "/home/mohit/Download/vdrift-2009-06-15/SConstruct", line 9, in <module>
scons: warning: The BoolOption() function is deprecated; use the BoolVariable() function instead.
File "/home/mohit/Download/vdrift-2009-06-15/SConstruct", line 13, in <module>
Checking for C++ header file asio.hpp... (cached) yes
Checking for C++ header file boost/bind.hpp... (cached) yes
Checking for C++ header file GL/gl.h... (cached) yes
Checking for C++ header file GL/glu.h... (cached) yes
Checking for C++ header file SDL/SDL.h... (cached) yes
[Code]........
View 4 Replies
View Related
Mar 17, 2011
This loop is part of a bash script which takes multiple arguments.
Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))
[code]...
View 3 Replies
View Related
May 18, 2010
I'm struggling with the issue of passing a vector of a class to itself, here's what state its in now... (tried many variations, but without direction).
Code:
#include <iostream>
#include <string>
[code]...
View 2 Replies
View Related
Apr 9, 2010
I am trying to make a periodic boundary condition type function, using an existing class given to me in lecture notes, but am having some trouble! Effectively, I am trying to make an array such that, for a point in any row of a 2D matrix ("Matrix(i,j)"), the command "next_i[i]" will return "(i+1)%L", where L is the number of data points in the row. This will enable me to select a point to the right of any point in the matrix: "Matrix(next[i],j)"
[Code]....
View 1 Replies
View Related
Apr 8, 2011
Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:
Code:
struct my_struct {
unsigned count;
std::string msg;
[code]....
View 3 Replies
View Related
Mar 15, 2011
My new guy has created several functioning webpages on his machine with TOMCAT 6 with Sun JDK, yet our machines use TOMCAT 5.5 with Open JDK, which his webpages don't show. Do you have any idea how to make them work? The error showing in a browser:
Code:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception org.apache.jasper.JasperException: Unable to compile class for JSP:
[Code]...
View 2 Replies
View Related
May 10, 2011
I've had to do some code in java, a language I'm very much unfamiliarly with so please excuse my incorrect use of terms. The basic outline of my problem is I create a class object as a local within a swing button function it works fine. If I create it as a global ( with I think I need to do ) within main, then prototype it with the other swing objects at the bottom of the file when it is called it causes a host of problems. I think the easiest way is to show it.
View 2 Replies
View Related
Mar 10, 2010
Okay so I'm working on a program here as I'm learning java,I have an array that is initialized with 5 objects that are hard coded. I have made a GUI that takes the input needed and creates an object with those values.I need to add that object to the ArrayList that I have previously made.Okay, so I have three classes, guiclass.java, main.java and gladiator.java Objects are made and defined in "gladiator".Main contains my public static void main section, launches my gui, creates my five hard coded objects, creates my ArrayList and adds my five hard coded objects to the ArrayList.Now, I need to add the object that I generated in the guiSection [action Listener]to the ArrayList that I created in my main class's public static void main string... section. Problem is my arraylist "cannot be resolved" from guiclass.
View 13 Replies
View Related
Sep 18, 2010
I am looking to write a function to return an MD5 hash in Java but I don't want to us the MessageDigest class as I am using the J2ME framework which doesn't include it.
View 3 Replies
View Related
Feb 24, 2009
I have a application in C++, and now I have two class. MyDialog is the class that main function launch. In MyDialog class there are four elements and when I click over theese elements, there is a MousePressEvent that launch other class, Touchpad class. So, in some moments, I have loaded two class. My question is, how can pass a value from Touchpad class to MyDialog class, when I close (destroy) Touchpad class. In a few words, is it possible to communicate values between class?
View 5 Replies
View Related
Sep 3, 2010
i need to implement a Set class(like in stl) using a vector.Here is my code that doesnt work corectly:
Code:
#include <iostream>
#include <vector>
template<class T>
class Set
{
[Code]....
View 2 Replies
View Related
Oct 19, 2010
How can I implement c_str() for a string class?
View 2 Replies
View Related
Mar 23, 2010
Is it not possible to declare a vector inside a C++ class ? Have a look at the following code:
Code:
#include <stdio.h>
#include <iostream>
#include <malloc.h> // malloc
#include <strings.h> // bzero
[code]....
View 2 Replies
View Related
May 9, 2011
This is a really specific question, but maybe someone can help. I'm debugging someone else's code, and they call a UDPWriter and specify an IP address and port, and I'm trying to make sure this multicast traffic goes over a certain port. How can I determine which port the UDP defaults to and change it?
It's confusing to me because I'm not familiar with all the layers the OS sends traffic through before it goes through the interface. Is there maybe some simpler way to tell the OS to send multicast traffic over both interfaces?
View 2 Replies
View Related
May 23, 2010
i'm a bit stuck playing with the following class setup for glut. The actual issue is with the function pointers.Basically the following code is the opengl redbook cube example slightly modified.
View 2 Replies
View Related
Apr 27, 2011
I'm writing a binary search tree class to insert records and I'm stuck on the following error:
Code:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Here is the code for my class:
[Code]...
I really don't know how to approach this, I thought that everything was working fine but I have no idea what is wrong. Also, for clarification, main() is in a different .cpp file that #includes "tree.h"
View 13 Replies
View Related
Jan 5, 2011
I have a JApplet class I have copied to both a windows and a linux server. When I open up a webpage with the applet in it in my browser from both servers (http://server1/....) I can only get it to work from the Windows server. The Java console on my PC pops up complaining it cannot find the class file on the Linux server. Has anyone experienced anything like this before and how have you solved the problem?
View 1 Replies
View Related
Mar 11, 2011
I'm trying to teach myself python (from Learn Python the hardway e-book) but am struggling to grasp the concepts of Classes etc. Part of exercise 43 is to rewrite the game / create a new game with classes for each room etc. So I'll show you my code so far and explain at the bottom my problem
Code:
#ex43a.py
from sys import exit
[code]....
View 2 Replies
View Related
May 12, 2011
I found out how to save an object using Serializable in JAVA, the standard however how can I set up my MainVariableList to have a function/method saveobject so it saves the object within it's own class, the below code compiles, however when I run it reports an error on startup but works, basically what do I use for the red line, how do I tell it what object is passed to the class?
View 1 Replies
View Related
Jun 27, 2010
how to overload the subscript operator ([]) for a list class?
Code:
template <typename T>
class list
{
public:
struct node
[Code]...
View 1 Replies
View Related