When using formal aspects to create some code is there a generic method of determining a loop invariant or will it be completely different depending on the problem?
Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like:
"(?P<start>some_pattern)(?P<replace>foo)(?P<end>end)"
And then concatenate the start group with the new data for replace and then the end group.
Is there a better method for this?
What are your most useful, most practical methods that extends built-in JavaScript objects like String, Array, Date, Boolean, Math, etc.?
String
format
trim
padding
replaceAll & replaceAll
Array
indexOf
Date
toMidnight
Note : Please post one extended method per answer.
Hi all, I have created a basic chart in VB.NET (VS 2008) and it is working good, but I would like to label the axies of the chart. The method "AxisLabel" is not what I am looking for. I want to put the word "Dollars" vertically on the far left hand side of my chart (just left of the numbers labeling the "y" axis) and the word "Months" horizontally at the bottom of the chart but above the legend (just below the numbers labeling the "x" axis). Check the picture out...
Project I'm working on uses jQuery.
I have a series of Ajax calls being made that load() other HTML fragments which in turn load() other fragments. The whole thing is confusing. I didn't write the code.
Is there any tool which will allow me to walk the callstack so I can figure what is calling a method? any browser tools that would help me figure this out?
I am using a dataset to pull data from a DB. One of the fields in a row is NULL. I know this. However, the following vb.net code throws a StrongTypingException (in the autogenerated get_SomeField() method in the dataset designer):
If Not IsDBNull(aRow.SomeField) Then
'do something
End If
According to documentation and this question it should be fine.
edit: If aRow.SomeField is DBNull.Value Then also returns the same error. Argh.
I need to connect to a password protected MS Access 2003 DB using the JDBC-ODBC bridge. I can't find out how to specify the password in the connect string, or even if that is the correct method of connecting.
Any thoughts?
How can I write a test to assert that the action new is rendered?
def method
...
render :action => :new
end
I'm looking for something like:
assert_equal layout, @response.layout
assert_equal format, @request.format
I know I can't do @response.action
Thanks in advance!
Deb
Im new to testing with cucumber and have a question regarding the size of a 'Feature'.
Assume you can add a collection of items to a list and do the usual CRUD , is it preferred to create one feature for this complete set of CRUD actions or a feature for each?
What is the preferred/accepted method ?
At what point does an action become a feature itself ?
Everytime the IWpfTextView's TextBuffer changes I am trying to get the history's redostack and undostack and simply checking the count. When doing this I am encountering a "Method not supported exception" when trying to access the two stacks.
Am I retrieving the history incorrectly or does VS not want me seeing/editing the contents of the stacks?
I can post the code if necessary...
Thanks,
Nick
im trying to change href with each method,
here is demo, inspect a, you'll see there is no change
html:
<a href="#/news">News</a>
<a href="#/news/detail">Detail</a>
<a href="#/sport">Sport</a>
<a href="#/sport/football">Football</a>????????????
jQuery:
$('a').each(function() {
$(this).attr('href').replace('#/',''); //tried to erase #/ from all hrefs
});
In the document for the method notifyDataSetChanged of class BaseAdapter noted that "Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself. "
Supposed I changed the 3rd element in my string array (array data for the listview), what "any View reflecting the data set should refresh itself" means ? Does the 3rd view item in my list view be notified ?
Also, how is notifyDataSetChanged() and getView() concerned ?
Thanks in advance
Let's say I have two dynamic objects like this:
var objA = new { test = "test", blah = "blah" };
var objB = new { foo = "foo", bar = "bar" };
I want to combine them to get:
new { test = "test", blah = "blah", foo = "foo", bar = "bar" };
I won't know what the properties are for both objA and objB at compile time.
I want this to be like jquery's extend method.
Anybody know of a library or a .net framework class that can help me do this?
Hi,
While replacing or inserting into an nsmutable array, I am getting exception as
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'
[list replaceObjectAtIndex:indexRow withObject:editcontacts];
//or
[list insertObject:editcontacts atIndex:indexRow];
please help me.
Madan,
Thank You.
Hi,
could you tell me please - which object and which method can i use to fetch information about installed applications on OSX with objective c or macruby?
Ok SO, I have a user table and want to define groups of users together. The best solution I have for this is to create three database tables as follows:
UserTable
user_id
user_name
UserGroupLink
group_id
member_id
GroupInfo
group_id
group_name
This method keeps the member and group information separate. This is just my way of thinking. Is there a better way to do this? Also, what is a good naming convention for tables that link two other tables?
Hi all,
i have a little question ,i have a NSString object
(\n "1 Infinite Loop",\n "Cupertino, CA 95014",\n USA\n)
and i want the Cupertino from this string
Till now i have used stringByReplacingOccurrencesOfString: and able to get "1InfiniteLoop""CupertinoCA95014"USA
But still not able get Cupertino.
Do any other method able to solve this problem?
I've been doing some searching on the internet, but I can't seem to find the awnser. What exceptions can a DataContext throw? Or to be more specific, what exceptions does the DataContext.SubmitChanges() method throw?
In our application I use Left and right button on navigation bar.
I want a image on back (left)button.If i use segment for that then
necessary to define a action for back button.
Please advice me for any method.
I am simply trying to allow a user access to a method if they are authenticated, but nothing I am doing seems to work. Is there a way to just check if the user has been authenticated? The following still denies the user even when authenticated... Is there a built in role for an authenticated user?
@RequestMapping("/secure")
@PreAuthorize("hasRole('IS_AUTHENTICATED_FULLY')")
public String secure(ModelMap map){
return("secure");
}
I am using $.validator.addMethod
How can I print the validation message in a control. I have a div id="err" where I want to print the message
Here is what my method looks like
$.validator.addMethod('something', function(value, element) {
return false;
}, 'I want to display this message in a Div with ID=error')
How can we divide the substring from the string
Like I have string
String mainString="///Trade Time///Trade Number///Amount Rs.///";
Now I have other string
String subString="Amount"
Then I want to extract the substring Amount Rs. with the help of second string named subString not by any other method But it should be extracted through two parameters like first is I have index no of Amount string and second is until the next string ///.
Hi,
I have several files about 15k each of CSV data I need to import into SQL Server 2005.
What would be the simplest way to import the csv data into sql server? Ideally, the tool or method would create the table as well, since there are about 180 fields in it, this would simplify things.
I got an access_token using facebook Graph API. https://graph.facebook.com/me?access_token=...
I want infinite session key is there any method to get infinite session key?.
Hello all.
It became High-Resolution Screen Support from iOS4.
I make the custom button with UIButton.
It is prolonged in 640x960 and it is displayed.
With this, it is not significant.
Isn't there method that makes 640x960 a standard and displays?