Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 175/1413 | < Previous Page | 171 172 173 174 175 176 177 178 179 180 181 182  | Next Page >

  • Instantiating class by string using PHP 5.3 namespaces

    - by Kevin
    I can't get around an issue instantiating a new class by using a string variable and PHP 5.3. namespaces. For example, this works; $class = 'Reflection'; $object = new $class(); However, this does not; $class = '\Application\Log\MyClass'; $object = new $class(); A fatal error gets thrown stating the class cannot be found. However it obviously can be instantiated if using the FQN i.e.; $object = new \Application\Log\MyClass; I've found this to be aparrent on PHP 5.3.2-1 but not not in later versions. Is there a work around for this?

    Read the article

  • Ensure User has entered string in correct format?

    - by Daniel Granger
    Hi, Whats the best way to ensure the user has entered a valid time string such as: 5:24 5.4 102:30 102.5 It will be entered into a UITextField therefore will be in a NSString. I want to allow the user to enter the time in either hours and minutes (hh:mm) or hours and decimal minutes (hh.m). In the hours minutes example they should be able to enter as many hours as the like but only between 0 - 59 minutes. With the hours decimal minutes I want them to only be able to enter again as many hours as the like but decimal minutes can only be 0 - 9. Many Thanks

    Read the article

  • How to handle carriage return with windows batch script?

    - by eric2323223
    Hi, I want to use bat to automate some of my work. It should first look up the value of a certain registry key, and then copy some files to the directory that included in the registry key value. I used reg query command to look up registry, such as: REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE The result seems contains carriage return and I need to remove it, I've tried some solutions but all failed. Could anyone help me?

    Read the article

  • Regex to match a Java method signature

    - by nitesh
    I am having this particular requirement where a method has to be identified by different regular expressions for different components. For example, there need to be a regex for return parameter, one for method name, one for argument type and one for argument name. I was able to come up with an expression till this step as follows - ([^,]+) ([^,]+)\((([^,]+) ([^,]+))\) It works well for a method signature like - ReturnType foo(Arg parameter) The regular expression identifies ReturnType, foo, Arg and parameter separately. Now the problem is that a method can have no/one/multiple arguments separated by commas. I am not able to get a repeating expression for this. Help will be appreciated.

    Read the article

  • Parsing a string to date gives 01/01/0001 00:00:00

    - by kawtousse
    String dateimput=request.getParameter("datepicker"); System.out.printl("datepicker:" +dateimput); DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date dt = null; try { dt = df.parse(dateimput); System.out.println("date imput is:" +dt); } catch (ParseException e) { e.printStackTrace(); } *datepicker:04/29/2010 (value I currently selected from datepicker). *the field in database is typed date. 1-date imput is:Thu Apr 29 00:00:00 CEST 2010 and in database level it is inserted like that 01/01/0001 00:00:00

    Read the article

  • Removing first two elements of a string array in C

    - by sandeep p
    How can I remove first two elements of a string array? I have a code which is something like this. char *x[10]; .............. .............. .............. char *event[20]; event[0]=strtok(x[i]," "); event[1]=strtok(NULL," "); event[2]=strtok(NULL," "); event[3]=strtok(NULL," "); event[4]=strtok(NULL," "); event[5]=strtok(NULL," "); for(i=2;i<length;i++) { strcpy(event[i-2],event[i]); } I observed that only event[0] has proper values. I printed the contents of event[][] before for loop and it displays correctly. Could you please tell me why this is wrong? and a possible solution?

    Read the article

  • Strings, regexp and files

    - by A Moose
    <?php $iprange = array( "^12\.34\.", "^12\.35\.", ); foreach($iprange as $var) { if (preg_match($var, $_SERVER['REMOTE_ADDR'])) { I'm looking to have a list that will constitute each of the values inside the array. Let's call it iprange.txt, from which I would extract the variable $iprange. I would also be updating the file with new ranges, but I also want to convert those strings to regexp if that's something that's needed in php, as it is in the above example. If you could help me with the two following issues: I understand that somehow I would be using an array include, but I'm not sure how to implement it. I would like to run a cron that would update the text file and turn it into a regexp acceptable for use in the above example, if you think regexp is a good idea and there isn't another option. I know how to apply a cron in a directadmin gui, but I don't know what the cronned file would look like.

    Read the article

  • Excel VBA : Changing string in cells

    - by user1265125
    I have cells with data like these: ABCD123XYZ MPOP345MLU . . . . What I want to do is, to remove the 3rd and 4th character from all these cells, hence giving AB123XYZ MP345MLU How do I do this in VBA? I have no idea about this language, and if someone can guide me in the right direction, it'd be great :) I understand I have to: 1. Declare 2 string variables st1 and st2 2. Store data from cell A1 into the variable st1 3. Copy all but the 2nd and 3rd char into str2 4. Output Str2 into B1 5. Move to A2

    Read the article

  • Java - Optimize finding a string in a list

    - by Mark
    I have an ArrayList of objects where each object contains a string 'word' and a date. I need to check to see if the date has passed for a list of 500 words. The ArrayList could contain up to a million words and dates. The dates I store as integers, so the problem I have is attempting to find the word I am looking for in the ArrayList. Is there a way to make this faster? In python I have a dict and mWords['foo'] is a simple lookup without looping through the whole 1 million items in the mWords array. Is there something like this in java? for (int i = 0; i < mWords.size(); i++) { if ( word == mWords.get(i).word ) { mLastFindIndex = i; return mWords.get(i); } }

    Read the article

  • Is there a way to get the expression in a string in vb.net

    - by Jim Thio
    LogEvents(System.Text.Encoding.UTF8.GetString(queryPlaces.ToBson)) I want to be able to output not just the content of System.Text.Encoding.UTF8.GetString(queryPlaces.ToBson) but also the actual string of System.Text.Encoding.UTF8.GetString(queryPlaces.ToBson) itself, perhaps with line numbers and file names. I know that I can do this easily with objective-c. How can I do that with .net? I've heard that that's what reflextion is for. But how? There is no macro in vb.net right?

    Read the article

  • Virtual String Tree - Display subnode when parent node is hidden

    - by daemon_x
    Is there a way to show subnode if the parent node is hidden in the Virtual String Tree ? I have some tasks in the tree structure and I wish to display only tasks which belongs to the current user as the list, but from all levels. What I've done is the function to display a list, which hides tree buttons, tree lines, sets the fixed indent and enable toShowHiddenNodes option. Then in this function I iterate through the whole tree (all levels) and hide nodes which doesn't belong to the current user IsVisible[Node] := False and show those which belongs him IsVisible[Node] := True, but the subnodes which should be displayed are invisible when their parent is hidden. VT.TreeOptions.PaintOptions - toShowButtons - toShowTreeLines + toFixedIndent + toShowHiddenNodes

    Read the article

  • How to kill a quoted string at point in emacs?

    - by user1350992
    I would like to kill a quoted string in a source file without having to mark the beginning of the string and kill-region, but just by placing the point anywhere inside the quoted string and pressing a shortcut. I tried to write a function in elisp for this, but I figured out that the file would need to be parsed from the beginning up to point to determine whether the point is inside quoted string, and to find the bounds of the quoted string(also handle the \")... But the file is already parsed by font-lock. So now I can find out if I'm inside quoted string: (defun inside-quoted-string? () (interactive) (print (find 'font-lock-doc-face (text-properties-at (point))))) But how do I get the bounds of the string? font-lock knows it, since it nicely highlights it in blue, but how do I get it?

    Read the article

  • Remove duplicates in a String [] list f#

    - by Jose Maria de la Torre
    I need some noob help... I have a String[] list (a list that each element is a Array of strings) I wish to remove all duplicates in the list. But to see if they are duplicates I need to see the fist element in the array. what I have tried is let NotDuplicated = Duplicated.[0] |> Seq.distinct let NotDuplicated = Duplicated |> Seq.distinctBy id but nothing is working... can you guys please help me.. thanks!!

    Read the article

  • Convert a number from string to integer without using inbuilt function

    - by Raja
    I am trying this technique but error is coming. Please help me to convert a number from string to integer. #include<iostream> using namespace std; int main() { char *buffer[80]; int a; cout<<"enter the number"; cin.get(buffer,79); char *ptr[80] = &buffer; while(*ptr!='\0') { a=(a*10)+(*ptr-48); } cout<<"the value"<<a; delete ptr[]; return 0; } Errors are: error C2440: 'initializing' : cannot convert from 'char ()[80]' to 'char *[80]' error C2440: '=' : cannot convert from 'char *' to 'int'

    Read the article

  • Add a + sign to a +ve number in PHP

    - by user318466
    I need to design a function to return -ve numbers unchanged but should add a + sign at the start of the number if its alreay no present. Example: Input Output ---------------- +1 +1 1 +1 -1 -1 It will get only numeric input. function formatNum($num) { # something here..perhaps a regex? } This function is going to be called several times in echo/print so the quicker the better.

    Read the article

  • Working by group by for grouping data into string format

    - by Shantanu Gupta
    I have a table that contains some data given below. It uses a tree like structure i.e. Department SubD1, SubD2 ..... PreSubD1, PreSubD1... PreSubD2, PreSubD2... pk_map_id preferences ImmediateParent Department_Id -------------------- -------------------- -------------------- -------------------- 20 14 5 1 21 15 5 1 22 16 6 1 23 9 4 2 24 4 3 2 25 24 20 2 26 25 20 2 27 23 13 2 I want to group my records on behalf of department then immediate parent then preferences each seperated by ',' i.e. department Immediate Parent preferences 1 5,6 14,15,16 2 4,3,20,13 9,4,24,25,23 and this table also Immediate parent preferences 5 14,15 6 16 4 9 3 4 20 24,25 13 13 In actual scenario all these are my ids which are to be replaced by their string fields. I am using sql server 2k5

    Read the article

  • fill a buffer successively

    - by mkind
    i intend to fill a char-pointer array successively in a for-loop. the content to fill in is a integer so i need to cast. but i didn't get the result i want to.. for (i=0;i<max0;i++){ sprintf(buf, "%d", content[i]); } sprintf replaces the hole buf, but i want to append. for (i=0;i<max0;i++){ buf[i]=(char) contint[i] } but this isn't working too. it seems to me, i get ascii-code of the content[i].

    Read the article

  • remove a varchar2 string from the middle of table data values

    - by Michelle Daniel
    Data in the file_name field of the generation table should be an assigned number, then _01, _02, or _03, etc. and then .ldf (example 82617_01.pdf). Somewhere, the program is putting a state name and sometimes a date/time stamp, between the assigned number and the 01, 02, etc. (82617_ALABAMA_01.pdf or 19998_MAINE_07-31-2010_11-05-59_AM.pdf or 5485325_OREGON_01.pdf for example). We would like to develop an SQL statement to find the bad file names and fix them. In theory it seems rather simple to find file_names that include a varchar2 data type and remove it, but putting the statement together is beyond me. Any help or suggestions apprecuiated. Something like ........... UPDATE GENERATION SET FILE_NAME (?) WHERE FILE_NAME (?...LIKE '%STRING%');?

    Read the article

  • Beginner C++ Question

    - by Donal Rafferty
    I have followed the code example here toupper c++ example And implemented it in my own code as follows void CharString::MakeUpper() { char* str[strlen(m_pString)]; int i=0; str[strlen(m_pString)]=m_pString; char* c; while (str[i]) { c=str[i]; putchar (toupper(c)); i++; } } But this gives me the following compiler error CharString.cpp: In member function 'void CharString::MakeUpper()': CharString.cpp:276: error: invalid conversion from 'char*' to 'int' CharString.cpp:276: error: initializing argument 1of 'int toupper(int)' CharString.cpp: In member function 'void CharString::MakeLower()': This is line 276 putchar (toupper(c)); I understand that toupper is looking for int as a parameter and returns an int also, is that the problem? If so how does the example work?

    Read the article

  • Using ASP.NET Redirect without string URL?

    - by David Dietrich
    For instance, what I have right now is the following: Page.Response.Redirect("Default.aspx", false); Needing to hardcode the string just seems odd to me. The Default.aspx page is already in my project. So is there a way to do the redirect something like the following: Page.Response.Redirect(Default.aspx, false); Where Default.aspx is just the web form. I'd think that this way it would be obvious if there was a problem such as you deleted the web form but didn't update the redirects. Is this possible? Or is there another way entirely I should be looking at this? I suppose I could do something with a static property on the class, but I am wondering if there is a built in thing for this?

    Read the article

  • What's the best way to parse an Address field using t-sql or SSIS?

    - by dtaylo04
    I have a data set that I import into a SQL table every night. One field is 'Address_3' and contains the City, State, Zip and Country fields. However, this data isn't standardized. How can I best parse the data that is currently going into 1 field into individual fields. Here are some examples of the data I might receive: 'INDIANAPOLIS, IN 46268 US' 'INDIANAPOLIS, IN 46268-1234 US' 'INDIANAPOLIS, IN 46268-1234' 'INDIANAPOLIS, IN 46268' Thanks in advance! David

    Read the article

< Previous Page | 171 172 173 174 175 176 177 178 179 180 181 182  | Next Page >