I've been working through a small tutorial on how to build a basic packet sniffer for Linux. I got everything working, and I now want to add IP-to-host mapping.
Everything was working before I added this function:
void IPtoHostname(char *ipaddress, char *hostname){
struct hostent *host;
in_addr_t ip = inet_addr(ipaddress);
...
I'm developing an embedded application in C99, and the project contains some integer constants defined like:
#define LEVEL1 0x0000
#define LEVEL2 (LEVEL1 + 1)
It has since become useful to keep track of these values for logging purposes, so I would like to use a macro to create a string literal from the evaluated versions of t...
I'm looking to write an efficient n-order Markov chain method to generate random text strings given a set of example text. I currently have a Java implementation that uses several layers of Maps, but it's clunky. A suffix array would be perfect for my needs, but I'm not clear if that can be efficiently implemented in Java.
In C I mig...
I have a model which looks like this:
class Search (db.Model) :
word = db.StringProperty()
an example "word" can look like word = "thisisaword"
I want to search all entities in Search for substrings like "this" "isa" etc.
How can i do this in App engine using python?
Update:
The words here will be domain names. So there is some...
Hi I'm Looking For a tool that help me to extract all strings of my code files to Resource File. I Used Coderush and Microsoft add on(resourcerefactoring.codeplex.com) for working with Resource files. but i had to extract strings to resources one by one.
Is there any better option?
...
I don't know if the title explains it very well, so here's what I'm trying to achieve.
With this script people can change the value of configuration variables on the fly like so:
Config::write('General.load', array('plugin1','plugin2'), true);
In that example, it changes the General.load config variable to an array, and sets the 3rd p...
Hi all,
I want to see the values of the created string objects in the system. To do so, I override the String.class by using Xbootclasspath option. In my new overriding class I modified constructors of String.class by adding the line System.out.println(value) to each, such that
public String() {
this.offset = 0;
this.count = 0;
this...
If a string contains *SUBJECT123 how to determine that the string has subject in it in python
...
Ok, so I know this question has been asked in different forms several times, but I am having trouble with specific syntax. I have a large string which contains html snippets. I need to find every link tag that does not already have a target= attribute (so that I can add one as needed).
^((?!target).)* will give me text leading up to 't...
I'm looking at the code for basic_string (that is bundled with g++ 4.2.1). The copy constructor makes use of a grab() function to "grab" a copy of a string (increment its reference-count):
_CharT* _M_grab( const _Alloc& __alloc1, const _Alloc& __alloc2 ) {
return (!_M_is_leaked() && __alloc1 == __alloc2) ? _M_refcopy() : _M_clone(__a...
Hi everyone,
I have an ordered list (a dictionary - 100K words) and many words to seach on this list frequently. So performance is an issue. I know that a HashSet.contains(theWord) or Collections.binarySearch(sortedList, theWord) are very fast. But I am actually not looking for the whole word.
What I want is let's say searching for "s...
Hi, this question may seem a bit too specific, but I figure I'd give it a shot here since I've found some great programming answers here in the past.
I am modifying the open-source program TinyCad for a project I'm working on. I've visited the TinyCad message board and posted, but I didn't get the answer I'm looking for. I'm having trou...
Im trying to remove the first char of the string and keep the remainder, my current code doesnt compile and im confused on how to fix it.
My code:
char * newStr (char * charBuffer)
{
int len = strlen(charBuffer);
int i = 1;
char v;
if(charBuffer[0] == 'A' || charBuffer[0] == 'Q'){
for(i=1;i<len;i++)
...
I have a NSArray of Foo objects.
@interface Foo : NSObject
{
}
- (NSString *) name;
@end
I want to be able to join all these [Foo name] results into one NSString.
In C# I would get a array of these by using LINQ, creating a Array of it, and feeding it to String.Join():
List<Foo> foo = [..];
String.Join(",", foo.select(F => ...
Hi,
I'm using Google App Engine and I need to put a multiline string in the datastore. Unfortunately, GAE does not allow that. I need this string to be multiline, so is there any way to convert a multiline string to a single line string and store it?
...
How do I get the byte size of a multibyte-character string in Visual C? Is there a function or do I have to count the characters myself?
Or, more general, how do I get the right byte size of a TCHAR string?
Solution:
_tcslen(_T("TCHAR string")) * sizeof(TCHAR)
EDIT:
I was talking about null-terminated strings only.
...
Hello,
I want to compare a string with multiple string.For ex
if([var isEqualToString:@"Box"]||[var isEqualToString:@"Ball"]|[varisEqualToString:@"Bat"])
{
some function
}else{
some fuction
}
In my case i have to compare with 15 string, so i have to check for 15 times.Is there any other better way to compare it.Is there any small sim...
hi.
i have 26/01/10 09:20:20 MAL BIN BIN275 TSTCB U8L5 O/CR ..N UCOS Operated in string
i want to extract column 36 into 60 that is
BIN275 TSTCB U8L5 O/CR
the last output i want to include
O/CR
is there any simple solution to settle this? already make this but not work.
#include <iostream>
#include <string.h>
#include <fstr...
Hi,
We have this field in our database indicating a true/false flag for each day of the week that looks like this : '1111110'
I need to convert this value to an array of booleans.
For that I have written the following code :
char[] freqs = weekdayFrequency.ToCharArray();
bool[] weekdaysEnabled = new bool[]{
Convert.ToBoolean(int....
Hi,
I am trying to format a URL but am getting a bug out of it. My code is below.
NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%20score%20is:%i%20and%20CharsPerMin%20is:%@", currentScore, charPerMin.text];
When calling the method it doesn't do a thing. I think the issue is with %20. %20 is being u...