Just started coding in AS3 with FlashDevelop and coming from a C# background, I would like to know if there's something equivalent to the #region directive in AS3?
In my last question I asked about parsing the links out of an HTML page. Since I haven't found a solution yet I thought I tried something else in the meantime: search for every <a href= and copy whatever is there until I hit a </a>.
Now, my C is a bit rusty but I do remember i can use strstr() to get the first instance of that string, but how do I get the rest?
Any help is appreciated.
PS: No. This is not homework on school or something like that. Just so you know.
I have a following string - "AACCGGTTT" (alphabet is ["A","G","C","T"]). I would like to generate all strings that differ from the original in any two positions i.e.
GAGCGGTTT
^ ^
TATCGGTTT
^ ^
How can I do it in Python?
I have only brute force solution (it is working):
generate all strings on a given alphabet with the same length
append strings that have 2 mismatches with a given string
However, could you suggest more efficient way to do so?
Say that I have a system service, and I want to offer a low-level maintenance access to it.
For that purpose, I'd like to create a standalone, console application that somehow connects to server process and lets user type in commands, allow it to use auto-completion and auto-suggestion on single/double TAB press (just like linux bash shell, mysql cli, cmd.exe, and countless others), allow command line editing capabilities (history, cursor keys to move around text..), etc.
Now, it's not that much of a problem to create something like that by rolling my own from scratch, handling user input, scanning pressed keys, and doing correct actions. But, why reinvent the wheel? Is there some library/framework that helps with this kind of problems, just like readline library that offers improved command-line editing capabilities under linux?
Of course, this new "shell" would respond only to valid, domain-specific commands, and would suggest valid arguments, options, switches...
Any ideas? Thanks!
What debugging tools are available for directshow filters? Presently, I have a project that compiles and registers a video source filter that I then setup a graph in GraphEdit. I am using c++ in visual studio 2008. Is it possible to get a debugger attached to the filter in any way where I could set break points, inspect variables, etc? Barring that is there a way to log diagnostic information somewhere that I can view in real time?
Hey guys, this is more of a question out of curiosity, but is it possible to get somebody's Facebook page after they have visited your site?
Was thinking maybe a chain of lookup stuff could be used starting with an IP to eventually perhaps get a name and thus that person's Facebook page. I have also heard you can read somebody's web history, is this true?
I have completed and reproduced Core Data tutorials using a tableview to display contents. However, I want to access an Entity through a fetch on a view without a tableview. I used the following fetch code, but the count returned is always 0. The data exists when the database is opened using SQLite tools.
NSManagedObject *entryObj;
XYZDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *managedObjectContext = appDelegate.managedObjectContext;
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Quote" inManagedObjectContext:managedObjectContext];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"id" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
[request setEntity: entity];
NSArray *results = [managedObjectContext executeFetchRequest:request error:nil];
if (results == nil) {
NSLog(@"No results found");
entryObj = nil;
}else {
NSLog(@"results %d", [results count]);
}
[request release];
[sortDescriptors release];
count returned is always 0; it should be 5.
Can anyone point me to a reference or tutorial regarding creating a controller not to be used with a tableview.
I tried to look here:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i3253
And I understand that I have to provide string length for the column, I'm just not able to find out how many bytes oracle uses when storing a character. My limit is 500 characters, so if its 1 byte / character, I can create the column with 500, if its 2 byte / character then 1000, etc.
Anyone have a link to the documentation or know for certain?
In case it matters, the SQL is being called from PHP, so these are PHP strings I'm inserting into the database.
Thanks.
Answers to a recent post (Any chances to imitate times() Ruby method in C#?) use the = operator in the usage examples. What does this operator do? I can't locate it in my C# book, and it is hard to search for symbols like this online. (I couldn't find it.)
Is it considered a bad practice to pass around a large string or object (lets say from an ajax response) between functions? Would it be beneficial in any way save the response in a variable and keep reusing that variable?
So in the code it would be something like this:
var response;
$.post(url, function(resp){
response = resp;
})
function doSomething() {
// do something with the response here
}
vs
$.post(url, function(resp){
doSomething(resp);
})
function doSomething(resp) {
// do something with the resp here
}
Assume resp is a large object or string and it can be passed around between multiple functions.
When performing many inserts into a database I would usually have code like this:
using (var connection = new SqlConnection(connStr))
{
connection.Open();
foreach (var item in items)
{
var cmd = new SqlCommand("INSERT ...")
cmd.ExecuteNonQuery();
}
}
I now want to shard the database and therefore need to choose the connection string based on the item being inserted. This would make my code run more like this
foreach (var item in items)
{
connStr = GetConnectionString(item);
using (var connection = new SqlConnection(connStr))
{
connection.Open();
var cmd = new SqlCommand("INSERT ...")
cmd.ExecuteNonQuery();
}
}
Which basically means it's creating a new connection to the database for each item. Will this work or will recreating connections for each insert cause terrible overhead?
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name contains [cd] %@", passdTextToSearchFor];
I have two entries in name: "Test One" and "Test Two." If I search for "test," I get 0 results. But if I search for "test one" or "test two" I get the proper result. The search is ignoring the space.
In reality I want both results if the user searches for "test." Any ideas?
I tried contain and like.
All examples I find on shuffling arrays are for NSMutableArrays. Copying an NSArray to an NSMutable array, shuffling, then copying back always crashes the application. Is it even possible to shuffle an NSArray?
Anything in objective-c similar to Collections.shuffle() (Java)?
In PHP, there is a special method named __call($calledMethodName, $arguments), which allows class to catch calls to non-existing methods, and do something about it.
Since most of classic languages are strongly typed, compiler won't allow calling a method that does not exist, I'm clear with that part.
What I want to accomplish (and I figured this is how I would do it in PHP, but C# is something else) is to proxy calls to a class methods and log each of these calls.
Right now, I have code similar to this:
class ProxyClass {
static logger;
public AnotherClass inner { get; private set; }
public ProxyClass() { inner = new AnotherClass(); }
}
class AnotherClass {
public void A() {}
public void B() {}
public void C() {}
// ...
}
// meanwhile, in happyCodeLandia...
ProxyClass pc = new ProxyClass();
pc.inner.A();
pc.inner.B();
// ...
So, how can I proxy calls to an object instance in extensible way? Extensible, meaning that I don't have to modify ProxyClass whenever AnotherClass changes.
In my case, AnotherClass can have any number of methods, so it wouldn't be appropriate to overload or wrap all methods to add logging.
I am aware that this might not be the best approach for this kind of problem, so if anyone has idea what approach to use, shoot.
Thanks!
I am interested in a way how to read GPU temperature (graphics processing unit, main chip of graphic card), by using some video card driver API?
Everyone knows that there two different chip manufacturers (popular ones, at least) - ATI and nVIDIA - so there are two different kinds of drivers to read temperature from. I'm interested in learning how to do it for each different card driver.
Language in question is irrelevant - it could be C/C++, .NET platform, Java, but let's say that .NET is preferred.
Anyone been doing this before?
public class DocFilter extends FileFilter {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = Utils.getExtension(f);
if (extension != null) {
if (extension.equals(Utils.doc) ||
extension.equals(Utils.docx) )
{
return true;
} else {
return false;
}
}
return false;
}
//The description of this filter
public String getDescription() { return "Just Document Files"; }
}
Netbeans compiler warned with the error, "No interface expected here" for above code
Anyone has idea what was the problem?? I tried changing the 'extends' to 'implements', however, it didn't seem to work that way.
and when I changed to implements, the following code cannot work,
chooser.addChoosableFileFilter(new DocFilter());
and with this error,
"method addChoosableFileFilter in class javax.swing.JFileChooser cannot be applied to given types required: javax.swing.filechooser.FileFilter"
Can anyone help on this? Thanks..
When looking at the log of a folder in Tortoise SVN, you can filter out files which aren't in the folder.
The checkbox says: "Hide unrelated changed paths".
How can I accomplish the same with svn log? I want the verbose output of the tool to not display file paths that aren't inside the current target.
Thanks
Are you an iPhone/iPad/Android programmer with a designer soul? If so we would like to hear from you.
Drop us your best work/portfolio and than we talk.
[email protected]
Cheers
T
Here's the problem: my input is XML file that looks something like:
<BaseEntityClassInfo>
<item>
<key>BaseEntityClassInfo.SomeField</key>
<value>valueData1</value>
</item>
<item>
<key>BaseEntityClassInfo.AdditionalDataClass.SomeOtherField</key>
<value>valueData2</value>
</item>
<item>
<key>BaseEntityClassInfo.AdditionalDataClass.AnotherClassInfo.DisplayedText</key>
<value>valueData3</value>
</item>
...
...
</BaseEntityClassInfo>
The <key> element somehow describes entity classes fields and relationships (used in some other app that I don't have access to) and the <value> stores the actual data that I need.
My goal is to programatically generate a typed Dataset from this XML that could then be used for creating reports. I thought of building some XSD schema from input XML file first and then use this schema to generate Dataset but I'm not sure how to do that. The problem is that I don't want all data in one table, I need several tables with relationships based on the <key> value so I guess I need to infer relational structure from XML <key> data in some way.
So what do you think? How could this be done and what would be the best approach?
Any advice, ideas, suggestions would be appreciated!
if ([tempArray containsObject: [sectionInfo indexTitle]])
{
return nil;
}else
{
[tempArray addObject: [sectionInfo indexTitle]];
return [sectionInfo indexTitle];
}
return [sectionInfo indexTitle];
The code above groups the cells in alphabetical order but displays a blank header instead of the appropriate title. Could this possibly be because I did not specify the number of headers? This would naturally be a single header for every letter in the alphabet.
Hello!
I'm trying to modify and set alert templates on a SP (working on a copy of alerttemplates.xml), but I'd like to deploy them just on some specific sites, not the whole farm. Is this possible? I'm using SharePoint 2010 RTM.
Thanks
Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this:
[last: 0s][/my/dir]$ sleep 10
[last: 10s][/my/dir]$
Background
I often run long data-crunching jobs and it's useful to know how long they've taken so I can estimate how long it will take for future jobs. For very regular tasks, I go ahead and record this information rigorously using appropriate logging techniques. For less-formal tasks, I'll just prepend the command with time.
It would be nice to automatically "time" every single interactive command and have the timing information printed in a few characters rather than 3 lines.
I've come across odd behavior when comparing strings. First assert passes, but I don't think it should.. Second assert fails, as expected...
[Fact]
public void StringTest()
{
string testString_1 = "My name is Erl. I am a program\0";
string testString_2 = "My name is Erl. I am a program";
Assert.Equal<string>(testString_1, testString_2);
Assert.True(testString_1.Equals(testString_2));
}
Any ideas?