Hello all,
I have a simple form with several checkboxes. Now I need to prevent users to proceed with this form if more then 3 checkboxes are selected. How should this be done?
Hello all,
How do I remove numbers from a string using Javascript?
I am not very good with regex at all but I think I can use with replace to achieve the above?
It would actually be great if there was something JQuery offered already to do this?
//Something Like this??
var string = 'All23';
string.replace('REGEX', '');
I appreciate any help on this.
In my Android app, I want to use a single variable for the log name in multiple files. At the moment, I'm specifying it separately in each file, e.g.
public final String LOG_NAME = "LogName";
Log.d(LOG_NAME, "Logged output);
I've tried this:
public final String LOG_NAME = (String) getText(R.string.app_name_nospaces);
And while this works in generally most of my files, Eclipse complains about one of them:
The method getText(int) is undefined
for the type DatabaseManager
I've made sure I'm definitely importing android.content.Context in that file. If I tell it exactly where to find getText:
Multiple markers at this line
- Cannot make a static reference to the non-static method getText(int)
from the type Context
- The method getText(int) is undefined for the type DatabaseManager
I'm sure I've committed a glaringly obvious n00b error, but I just can't see it! Thanks for all help: if any other code snippets would help, let me know.
How can i concate this string in mysql
desc=desc+$desct
what i want is each time i insert a variable from PHP that the string is added to the string which was already in db and seperated with ||
the field desc should look like this
desc
10||30||90||710
say i want to add the value 20
desc
10||30||90||710||20
then the desc field should look like this
How can i implement this?
I have 1 function that I want to return the address of an assigned string to the main function and assign an new string pointer with the same address so that the new string will have the contents of the old string.
For example:
unknown_datatype function()
{
char *old = "THE STRING";
return old;
}
int main()
{
char *snew = "";
snew = function();
return 0;
}
*unknown_datatype means I don't know that to put there...
*How can I approach this without changing anything in the main() method
Hey all,
I want to use \ in a string, like
string str="abc\xyz";
But this is giving me error.
I have also tried
string str="abc\\xyz";
But still it isnt working.
Can anyone help me out?
Let's say I have the following array (which is the returned value of a database query):
Array ( [0] => PHP [1] => Webdesign [2] => Wordpress [3] => Drupal [4])
And the following string:
Working With Wordpress Shortcodes
How can I compare the array with the string to see if the string contains any word stored in the array? (hopefully that made sense to you :d )
When he finds a match (eg: Wordpress) it should create a hashtag like so:
Working With #Wordpress Shortcodes
My code tries to replace "," with "/" in a string. Should I escape "," in the regex string? Both of the two code snippets generated the same results, so I am confused.
Code snippet 1:
String test = "a,bc,def";
System.out.println(test.replaceAll("\\,", "/"));
Code snippet 2:
String test = "a,bc,def";
System.out.println(test.replaceAll(",", "/"));
Should I use "," or "\,"? Which is safer?
Thanks.
OK, I've got the code to allow me to index through the string resources. Now, how do I get the value of a specific resource item without knowing its name?
Here's the index loop:
Field[] fLst = R.string.class.getFields();
for(Field f : fLst){
Log.i(dbgTag, "Field Entry: R.string." + f.getName());
}
Thanks for your efforts ...
Hello,
I'll begin this question with the claim that I have read the java networking guide before asking you.
I do not understand how to READ the socket and get all the info summed up into a string.
the socket might contains more than 1 line [trying to make a chat].
Please do no refer me to any other site unless it clearly states "this exact line does this.."
because I failed to understand what this code part does
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
Please, I just want to make a loop that will receive information from a socket, get all the content together into one string [I also want it to know where to add another line].
Thanks allot for anyone who helps, I have been trying to get an answer from tuts for hours and just failed to understand!
I have a string which is ultimately the id of a CheckBox.
What I need to be able to do is to access the CheckBox's properties from the string
var myCheckBox:Object;
var myString:String;
myString = "checkbox_1"
myCheckBox = Object(myString); ?!?!
... and then I'd need to get to myCheckBox.selected, and myCheckBox.label etc
During investigation of some problem I found that the reason was unexpected different conversion to string[] of seemingly same input data. Namely, in the code below two commands both return the same two items File1.txt and File2.txt. But conversion to string[] gives different results, see the comments.
Any ideas why is it? This might be a bug. If anybody also thinks so, I’ll submit it. But it would nice to understand what’s going on and avoid traps like that.
# *** WARNING
# *** Make sure you do not have anything in C:\TEMP\Test
# *** The code creates C:\TEMP\Test with File1.txt, File2.txt
# Make C:\TEMP\Test and two test files
$null = mkdir C:\TEMP\Test -Force
1 | Set-Content C:\TEMP\Test\File1.txt
1 | Set-Content C:\TEMP\Test\File2.txt
# This gets just file names
[string[]](Get-ChildItem C:\TEMP\Test)
# This gets full file paths
[string[]](Get-ChildItem C:\TEMP\Test -Include *)
# Output:
# File1.txt
# File2.txt
# C:\TEMP\Test\File1.txt
# C:\TEMP\Test\File2.txt
I am new to Programming languages. I have a requirement where I have to return a record based on a search string.
For e.g. I am having the following 3 records and my search string is 'Cal'
1)University of California
2)Pascal Institute
3)California University
If I try string.Contains, all 3 are returned. If I try string.starts-with, I get only 3 but my requirement is I need #1 and #3 in the result.
Thank you for your help.
-Joel
Is there a way to remove the period and everything after it using jQuery? The numbers following the period vary in length, so it's not as simple as finding the length.
For example:
<span class="changethis">505.234</span> <span class="changethis">23.93</span>
Thanks for your help!
P.S. (bonus) If there is a way to round up if it's x.5 or higher that would be awesome. Not essential though.
Say I only need to find out whether a line read from a file contains a word from a finite set of words.
One way of doing this is to use a regex like this:
.*\y(good|better|best)\y.*
Another way of accomplishing this is using a pseudo code like this:
if ( (readLine.find("good") != string::npos) ||
(readLine.find("better") != string::npos) ||
(readLine.find("best") != string::npos) )
{
// line contains a word from a finite set of words.
}
Which way will have better performance? (i.e. speed and CPU utilization)
Please, could you answer my question.
How to remove digits from the end of the string using SQL?
For example, the string '2Ga4la2009' must be converted to 2Ga4la. The problem is that we can't trim them because we don't know how many digits are in the end of the string.
Best regards, Galina.
Hello everyone
I hope to to drag a text string and its hyperlink from an HTML page to a TEdit.
For example
displays aaa
actual string is aaa
I try to use drag&drop vcl, but founf that it only can catch aaa itself rather than the string and its hyper link.
Welcome any comment
Thanks
interdev
I want to find a string from some file in subdirectory.
Like
we are in bundle/.
and in bundle/ there are multiple subdirectories and multiple txt files
I want to do something like
find . -type f -exec grep "\<F8\>" {} \;
want to get the file where it contain string < F8
this command does work, find the string, but never return filename
I hope anyone can give me a better solution to this, like display filename along with the line containing that string
I want to write a 'Date' class that behaves like a Value Type.
for example, Instead of writing a Clone method for setting properties safely, make the Date class to pass by value:
public Date Birthday
{
get { return this.birthday; }
set
{
this.birthday = value.Clone();
} //I want to write this.birthday = value;
//without changing external value when this.Birthday changes
}
I know this is possible because System.String is a class and behaves like a value. for example:
String s1 = "Hello";
String s2 = "Hi";
s1 = s2;
s2="Hello";
Console.WriteLine(s1); //Prints 'Hi'
First I thought writers of this class override '=' operator, but now I know that the '=' operator can not be overridden. so how they write String class?
I have function to convert string to a Unicode string:
private string UnicodeString(string text)
{
return Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(text));
}
But when I am calling this function the output result is wrong. It looks like my function is not working.
Console.WriteLine(UnicodeString("????? ?????")) printing on console just questions like that: ????? ????
Is there any way to say to console to display it correct?
UPDATE
Looks like the problem not in Unicode, I think may be it is displaying question marks because i am not having correct locale in the system (Windows 7)?
Is there any way to make it work without changing locale?
For every string, I need to print # each 6 characters.
For example:
example_string = "this is an example string. ok ????"
myfunction(example_string)
"this i#s an e#ample #string#. ok ?#???"
What is the most efficient way to do that ?