My terminal is 160 characters wide.
I use VIM.
Is there a way to tell vim:
when you see "//", autoindent it to start @ width 80?
(And haave it also affected when I highlight a region and hit =)
Thanks!
Git is notorious by its encouraged length limit for commit message titles: first line should not be more than 72 characters long (to fit an e-mail header).
That reminds me of... well, is there a hook that automatically posts commit messages to twitter as soon as they're pushed to the server?
Hi,
I am migrating my db from Interbase to Firebird, and the 1st hiccup we hit comes from our stored proc names.
We have a handful of stored procedures with names greater than 31 characters (which appears to be the max in FB 2.1.3)
Is there a way to increase this limitation? It will be a far easier solution than modifying our software.
Thanks!
I have regex as /^[a-zA-Z ]+$/ now I need to add support for unicode characters and so am using \p{L} like '/^[a-zA-Z ]+$\p{L}/'.
This is not working for me and I am not sure that this is correct way of using it. I am new to regex and would appreciate any guidance.
Thanks.
I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, otherwise stop where it ends). Would that be a good idea, or is it a bad one?
I am doing this in Java, but I wouldn't imagine that would make much of a difference.
I need to ensure that a given field does not have more than one space (not concerned about all white space, just space) between characters.
So
'single spaces only'
Needs to turn into
'single spaces only'
The below will not work
select replace('single spaces only',' ',' ')
as it would result in
'single spaces only'
I would really prefer to stick with native TSQL rather than a CLR based solution.
Thoughts?
Hello i want to show the number of lines, words and characters of all configuration files
"/ Etc / * conf" (command "wc"). How can i modify the command to not view the messages
error.
Suppose I have a list of strings where each string is
exactly 4 characters long and
unique within the list.
For each of these strings I want to identify the position of the characters within the string that make the string unique.
So for a list of three strings
abcd
abcc
bbcb
For the first string I want to identify the character in 4th position d since d does not appear in the 4th position in any other string.
For the second string I want to identify the character in 4th position c.
For the third string it I want to identify the character in 1st position b AND the character in 4th position, also b.
This could be concisely represented as
abcd -> ...d
abcc -> ...c
bbcb -> b..b
If you consider the same problem but with a list of binary numbers
0101
0011
1111
Then the result I want would be
0101 -> ..0.
0011 -> .0..
1111 -> 1...
Staying with the binary theme I can use XOR to identify which bits are unique within two binary numbers since
0101 ^ 0011 = 0110
which I can interpret as meaning that in this case the 2nd and 3rd bits (reading left to right) are unique between these two binary numbers. This technique might be a red herring unless somehow it can be extended to the larger list.
A brute-force approach would be to look at each string in turn, and for each string to iterate through vertical slices of the remainder of the strings in the list.
So for the list
abcd
abcc
bbcb
I would start with
abcd
and iterate through vertical slices of
abcc
bbcb
where these vertical slices would be
a | b | c | c
b | b | c | b
or in list form, "ab", "bb", "cc", "cb".
This would result in four comparisons
a : ab -> . (a is not unique)
b : bb -> . (b is not unique)
c : cc -> . (c is not unique)
d : cb -> d (d is unique)
or concisely
abcd -> ...d
Maybe it's wishful thinking, but I have a feeling that there should be an elegant and general solution that would apply to an arbitrarily large list of strings (or binary numbers). But if there is I haven't yet been able to see it.
I hope to use this algorithm to to derive minimal signatures from a collection of unique images (bitmaps) in order to efficiently identify those images at a future time. If future efficiency wasn't a concern I would use a simple hash of each image.
Can you improve on brute force?
Can somebody please provide some sample code to strip diacritical marks (i.e., replace characters having accents, umlauts, etc., with their unaccented, unumlauted, etc., character equivalents, e.g., every accented é would become a plain ASCII e) from a UnicodeString using the ICU library in C++? E.g.:
UnicodeString strip_diacritics( UnicodeString const &s ) {
UnicodeString result;
// ...
return result;
}
Assume that s has already been normalized. Thanks.
In python I can construct a HTML string without worrying about escaping special characters like < or " by simply enclosing the string in triple quotes like:
html_string = """
<html>
<body>
<p>My text with "quotes" and whatnot!<p>
</body>
</html>
"""
Is there a similar way to do this in Java?
I have a long int variable that I need to convert to a signed 32bit hexadecimal string (8 characters) (char array) without the "0x" at the start?
How would I go about doing this?
Thanks.
Hello - I have been stuck on this all weekend and failed miserably!
Please help me to claw back my sanity!!
Your challenge
For my first Silverlight application I thought it would be fun to use the World of Warcraft armoury to list the characters in my guild. This involves making an asyncronous from Silverlight (duh!) to the WoW armoury which is XML based. SIMPLE EH?
Take a look at this link and open the source. You'll see what I mean:
http://eu.wowarmory.com/guild-info.xml?r=Eonar&n=Gifted and Talented
Below is code for getting the XML (the call to ShowGuildies will cope with the returned XML - I have tested this locally and I know it works).
I have not managed to get the expected returned XML at all.
Notes:
If the browser is capable of transforming the XML it will do so, otherwise HTML will be provided. I think it examines the UserAgent
I am a seasoned asp.net web developer C# so go easy if you start talking about native to Windows Forms / WPF
I can't seem to set the UserAgent setting in .net 4.0 - doesn't seem to be a property off the HttpWebRequest object for some reason - i think it used to be available.
Silverlight 4.0 (created as 3.0 originally before I updated my installation of Silverlight to 4.0)
Created using C# 4.0
Please explain as if you talking to a web developer and not a proper programming lol!
Below is the code - it should return the XML from the wow armoury.
private void button7_Click(object sender, RoutedEventArgs e)
{
// URL for armoury lookup
string url = @"http://eu.wowarmory.com/guild-info.xml?r=Eonar&n=Gifted and Talented";
// Create the web request
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
// Set the user agent so we are returned XML and not HTML
//httpWebRequest.Headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)";
// Not sure about this dispatcher thing - it's late so i have started to guess.
Dispatcher.BeginInvoke(delegate()
{
// Call asyncronously
IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(ReqCallback, httpWebRequest);
// End the response and use the result
using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.EndGetResponse(asyncResult))
{
// Load an XML document from a stream
XDocument x = XDocument.Load(httpWebResponse.GetResponseStream());
// Basic function that will use LINQ to XML to get the list of characters.
ShowGuildies(x);
}
});
}
private void ReqCallback(IAsyncResult asynchronousResult)
{
// Not sure what to do here - maybe update the interface?
}
Really hope someone out there can help me!
Thanks mucho!
Dan.
PS Yes, I have noticed the irony in the name of the guild :)
I have a SQL Mobile database with one table. It has several columns with useful, often queried data and one column that stores a relatively large string per record (1000+ characters) that is not queried often.
Imagine this fake schema, the "lifeStory" field is the large one.
table1
String firstName
String lastName
String address
String lifeStory
A representative query would be
SELECT firstName, lastName, address FROM table1 WHERE firstName = :p1
Does anyone know of any performance concerns leaving that large, infrequently queried column in this table?
I'm trying to write a script in Greasemonkey that will replace a link's target with something else, but with my limited Javascript knowledge I don't really know how to do this.
Basically I'm trying to find all links containing a certain string of characters (ex: //a[contains(@href, 'xx')] ), and either replace them with another link, or append something to them (replacing 'abc123.com' with 'zyx987.com' or 'abc123.com' with 'abc123.com/folder').
If you could point me on the right path I'd greatly appreciate it.
Hey everybody,
I am a novice TCL programmer.Here I go My 1st post with stackoverflow forum. I would like to write a regular expression that matches any & only the strings starts with character A and ends with B. Whatever the characters coming inbetween should be displayed. For instance AXIOMB as an input from the user which starts with A & end with character B. Here is my try regexp { (^A([C-Z]+)B$)} Thank you
Hi,
i'm doing a image processing programme using VB.
i need to read a characters from my image and display in my programme.
can anyone please tell me what type of method can i use??
I need to pass a single variable in a querystring from one application (in PHP) to another (in ASP.NET). It's a one way transfer...That is I need to encrypt it in PHP and decrypt it in ASP.NET (c#).
I'm barely a newbie on PHP and I'd like not to have to do more than add a tag to the page that needs to do the passing.
The data will be anywhere from 5 - 15 characters..only letters and numbers.
Thanks!
I 'm implementing my version of "ShareThis" in my webpage.
How can i get the client's browser displayed address with Asp.NET?
I am little confused with this one since the url to share...
1) is created with URL rewriting
2) contains Greek characters.
P.S. The client url is like example.com/e??????a/ß?ß??a
I need to produce my own DecoderFallback and DecoderFallbackBuffer classes to implement some custom stream decoding.
I have found that the stream reader making use of it is calling GetNextChar() repeatedly even when my specilizaed DecoderFallbackBuffer.Remaining property returns 0 to indicate that there no more characters to return.
The end result is that the stream reader gets into an infinite loop.
Why is this happening?
Hello,
I am trying to create a regular expression in C# that allows only alphanumeric characters and spaces. Currently, I am trying the following:
string pattern = @"^\w+$";
Regex regex = new Regex(pattern);
if (regex.IsMatch(value) == false)
{
// Display error
}
What am I doing wrong?
Thank you!
I just "finished" expanding my Palindrome Tester, made in C#. To allow for phrases I added a simple regex match for all non-alphanumeric characters. At the end of the program it states " is(n't) a palindrome." But now with the regex it prints the no spaces/punctuation version of it.
I would like to be able to print the original user input. How do I do that?
Here is my program: http://gist.github.com/384565
I know how to replace text in a string. But that's using keyboard (ASCII) characters. In Objective C, how do I indicate a degree symbol? Also, how do I get the ASCII code for a character?
I always get confused using regular expressions. Can anyone please suggest me a tutorial?
I need help with checking for a string which,
cannot contain any wild characters except colon, comma, full stop.
It will be better to replace these if found.
Any help?
Thanks.