</Style>
I want to bind the textbox text to the Textbox's property such as text or something.
but you know what I think above dose't work.
can you help me ,thank you very much
A question from Math Battle.
This particular question was also asked to me in one of my job interviews.
" A monkey has two coconuts. It is fooling around by throwing coconut down from the balconies
of M-storey building. The monkey wants to know the lowest floor when coconut is broken.
What is the minimal number of attempts needed to establish that fact? "
Conditions: if a coconut is broken, you cannot reuse the same. You are left with only with the other coconut
Possible approaches/strategies I can think of are
Binary break ups & once you find the floor on which the coconut breaks use upcounting from the last found Binary break up lower index.
Window/Slices of smaller sets of floors & use binary break up within the Window/Slice
(but on the down side this would require a Slicing algorithm of it's own.)
Wondering if there are any other way to do this.
What is the main difference between these following two ways to give a method some fake implementation?
I was using the second way fine in one test but in another test the behaviour can not be achieved unless I go with the first way.
These are set up via:
IMembershipService service = test.Stub<IMembershipService>();
so (the first),
using (test.Record()) //test is MockRepository instance
{
service.GetUser("dummyName");
LastCall.Return(new LoginUser());
}
vs (the second).
service.Stub(r => r.GetUser("dummyName")).Return(new LoginUser());
Edit
The problem is that the second technique returns null in the test, when I expect it to return a new LoginUser. The first technique behaves as expected by returning a new LoginUser. All other test code used in both cases is identical.
Hi,
On the MSDN, I have found following:
public event EventHandler<MyEventArgs> SampleEvent;
public void DemoEvent(string val)
{
// Copy to a temporary variable to be thread-safe.
EventHandler<MyEventArgs> temp = SampleEvent;
if (temp != null)
temp(this, new MyEventArgs(val));
}
I do not understand, "copy to temporary variable", isnt it reference type?
Here's my situation. I have a Microsoft Reporting Services report that as a parameter takes a salesperson's name and shows them their sales across their territories blah blah blah.
But, salesperson A should not be able to choose and view salesperson B's data. So, my thought was to get the currently logged in user from Reporting Services, and then use that to populate the "salesperson" parameter.
Is there a way to get the currently logged in user through some hidden RS interface, or is there some other way of accomplishing my goal that I'm just not seeing? Any help would be GREAT, as the higher ups aren't too happen with my (apparent) lack of security right now.
Could you tell me what is wrong with my class constructor?
Code:
CVector::CVector (int size_)
{
if (size_ > 0)
{
this->size = size_;
this->data = new double[size];
for (int i = 0; i < size; i++)
{
(*this)(i) = i;
}
}
cout << "constructor end" << endl;
return;
}
Usage example:
tvector = CVector(6);
I get an access violation after "constructor end" output.
I have a table with 5 string columns, all can be NULLs. After I read the data from this table, I want to convert any null values into empty strings. The reason is that I need to compare these columns with columns in another table of the same schema (using conditional split), and null values would cause the comparison to evaluate to NULL.
Is there any functionality in SSIS that allows me to convert NULL's to empty strings, or just not having to deal with NULL's at all?
Hi all,
I have an extended userprofile with AUTH_PROFILE_MODULE (ref: http://tinyurl.com/yhracqq)
I would like to set a user.is_guru() method similar to user.is_active(). This would results for al views (or rather templates) to e.g. disable/enable certain user messages, displaying of widgets, etc. The boolean is stored in the extended user profile model, but I want to avoid hitting the DB for every view.
So the questions is .. Do I use a context_processor, a template tag, session_dict or what have you to, possible cached, store this info for the duration of the users visit.
Note: I dont have performance issues, so it's definitely filed under premature optimization. I just want to avoid generating extra work in the future :).
Any pointers are very welcome.
Thanx and greetz!
Gerard.
I am using the scripts from here http://www.quirksmode.org/js/cookies.html and have successfully created a cookie.. but am having trouble doing anything with it. I would like to have a style defined if a cookie is present. The function for the readCookie is
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
I am trying to use it on page load with something like this
window.onload=function(){
var x = readCookie('myCookieValue');
if (x) {
document.getElementById('div').innerHTML = "<style type=\"text/css\">.form {display:none}</style>";
}
}
What would be the correct way of writing this?
Hi all, i created a Wrapper for a C++ dll. While reading the documentation
i reached to a point using this function strcpy(StructName.strPropGetter, "A STRING");
I'm not kinda C++ guy, i can't figure how to transfer this code in C#.
My wrapper gave me this property without a setter.
Any light would be nice. Thank you
Using Linq to SQL:
if(!parentlist.childlist.Contains(row1))
parentlist.childlist.Add(row1);
else
How do I update the required childlist row with row1? Each row of the child list has a unique id.
parentlist implements IEnumerable and childlist is IList.
Hey, I am working on an iPhone Web App using HTML & CSS. I have currently got the JavaScript/HTML5 Geolocation picking up my current location and showing me it on a Google Map using Lat & Long values.
I also want to add these Lat & Long Values into the 'address' text field on the page so I can submit the details.
Here is the link: http://m.belfi.co.uk/form.html
When I click 'find me' I would like the lat and long to be added to the 'address' input field. Have no idea how to do this though :(
I have SEF urls like /sitename/section/12-news-title and number 12 is id of the news. I need to get that number 12 in my php code, is there any out of the box method in PHP for this?
My question is comparable to this one, but not quite the same.
I have a database with a huge amount of books, with different editions of some of the same book titles. I'm looking for an SQL statement giving me the highest edition number of each of the titles I'm selecting with a WHERE clause (to find specific book series). Here's what the table looks like:
|id|title |edition|year|
|--|-------------------------|-------|----|
|01|Serie One Title One |1 |2007|
|02|Serie One Title One |2 |2008|
|03|Serie One Title One |3 |2009|
|04|Serie One Title Two |1 |2001|
|05|Serie One Title Three |1 |2008|
|06|Serie One Title Three |2 |2009|
|07|Serie One Title Three |3 |2010|
|08|Serie One Title Three |4 |2011|
|--|-------------------------|-------|----|
The result I'm looking for is this:
|id|title |edition|year|
|--|-------------------------|-------|----|
|03|Serie One Title One |3 |2009|
|04|Serie One Title Two |1 |2001|
|08|Serie One Title Three |4 |2011|
|--|-------------------------|-------|----|
The closest I got was using this statement:
select id, title, max(edition), max(year) from books where title like "serie one%" group by name;
but it returns the highest edition and year and includes the first id it finds:
|--|-----------------------|-------|----|
|01|Serie One Title One |3 |2009|
|04|Serie One Title Two |1 |2001|
|05|Serie One Title Three |4 |2011|
|--|-----------------------|-------|----|
This fancy join also comes close, but doesn't give the right result:
select b.id, b.title, b.edition, b.year from books b inner join (select name, max(edition) as maxedition from books group by title) g on b.edition = g.maxedition where b.title like "serie one%" group by title;
Using this I'm getting unique titles, but mostly old editions.
I wish to change the primary key of a table, and also change the foreign key of the tables that reference it.
for example table employee has PK idEmployee = 1
table payroll has FK idEmployee = 1
I want to update employee to idEmployee = 2 and let the table payroll change FK idEmployee automatically.
is this posible in mysql?
thanks.
I have the following entity
public class Employee
{
public virtual int Id {get;set;}
public virtual ISet<Hour> XboxBreakHours{get;set}
public virtual ISet<Hour> CoffeeBreakHours {get;set}
}
public class Hour
{
public DateTime Time {get;set;}
}
(What I want to do here is store information that employee A plays Xbox everyday let's say at 9:00 13:30 and has a coffee break everyday at 7:00 12:30 18:00) - I am not sure if my approach is valid at all here.
The question is how should my (ideally fluent) mappings look like here? It is not necessary (from my point of view) for Hour class to have Id or be accessible from some kind of repository.
i am calling the data from xml in table view. after the the first row of data in tableview, my second row is empty in tableview, and from third row data is available. but my last data for row is missing from tableview, because of the second row.
how can i fill that second row.
so i have a list where i need to add new values constantly but when i do i need to increment it and insert it in between two values.
List<int> initializers = new List <int>();
initializers.Add(1);
initializers.Add(3);
so initializers would have 1, 3 values.
i would then process a new set of numbers. the initializers will need to have the values.
1, 5, 3, 7
and if i process another set of numbers it should become
1, 9, 5, 13, 3, 11, 7, 15
i know how to properly generate the new values inserted, i just need some help on inserting it in between the existing values of the initializers without having to add 2 or 3 more loops to move the values' positions.
while (curr_data[1] != (unsigned int)NULL &&
((curr_ptr = (void*)curr_data[1]) || 1))
Two part question.
What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?
Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I'd be really nice if I could leave it there, but if it's so egregious that it makes everyone's eyeballs burst into flames, I'll change it.
Hi everyone ,
i want to acces an Element of an XML. But somehow. i get null as the Result and that does not make any sense to me.
Can you find the mistake ?
Hi,
I am developing my first iPhone application.I need store some values in a place where the values will not get lost if the app is deleted .I need this to get the number of days the user actually used the app.Is this possible to do ?
Thanks in advance
I have this working code:
class Server
def handle(&block)
@block = block
end
def do
@block.call
end
end
class Client
def initialize
@server = Server.new
@server.handle { action }
end
def action
puts "some"
end
def call_server
@server.do
end
end
client = Client.new
client.call_server
My Server will handle more then one action so I want to change code such way:
class Server
def handle(options)
@block = options[:on_filter]
end
def do
@block.call
end
end
class Client
def initialize
@server = Server.new
my_hash = { :on_filter => action }
@server.handle(my_hash)
end
def action
puts "some"
end
def call_server
@server.do
end
end
client = Client.new
client.call_server
It is incorrect code because action() method calls on create my_hash, but if I try to modify code to:
my_hash = { :on_filter => { action } }
i get error message.
Is it possible to create hash with methods as hash values ?