Confusion in C program
Is the given program well defined? #include <stdio.h> int main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; *f1+=*f1+=a+=2.5; printf("\n%d %d %d\n",a,*f1,*f2); return 0; } ...
Is the given program well defined? #include <stdio.h> int main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; *f1+=*f1+=a+=2.5; printf("\n%d %d %d\n",a,*f1,*f2); return 0; } ...
In C bitwise left shift operation invokes Undefined Behaviour when the left side operand has negative value. Relevant quote from ISO C99 (6.5.7/4) The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1× 2E2, reduced modulo on...
This is a very general programming question that I just want to put out there and see if anyone has any thoughts on it. It shows up time and time again: I have a function somefunction() which is called a lot, but the very first time its called I want it to behave just a bit differently. Here's an example: first_time = true; somefunction...
Hi. Does anyone know how to display DirectShow video in HTML container (e.h. DIV) instead of separate pop-up-like window. Already I did all the things needed to run custom Rendering Behavior, it includes all interfaces and events handling, but cannot find anything related with my problem neither in the Internet nor in books I have. An...
A citation from "The art of unit testing" book: In Rhino Mocks, strict mocks are created by calling the StrictMock method. Unexpected method call exceptions will always be thrown, even if your test contains a global try-catch clause, which you’d think would catch such an exception thrown from the isolation framework. So how e...
I have an audio player toolbar activity that has a corresponding layout file. I need this player to show up at the bottom of another activity. I use a ViewStub and inflate the audio toolbar's layout file in the stub. How do I access the buttons, etc on this inflated view and how do I set their behavior? The docs on ViewStub did not me...
Hi, I have a users list page where the result can be modified by using gender, city and country selects (dropdowns), and it's working perfectly fine. As we have a lot of users I need to put a pagination as well, and here comes the "weird" part (I am sure it's not weird but I just cannot figure out where the problem comes from): when I se...
Hello. I'm somewhat new to web development. I was following some web services tutorials and everything went good, from writing the web services to displaying their results after you clicked on a button on a html page. So I tried to run the service via javascript when the page loads, like this: <html> <head> <SCRIPT language="JavaSc...
Hi, As I see there are lots of bright people here, I'll ask away. I don't know if this question has been asked before - most probably it has been. Duplicate this if so. For anyone who does not know what "the zone" for programmers is, it is when you are at your most productive and it feels like you are not coding but the code is writin...
In a Doctrine Record object, I can add the following method to validate data: protected function validate() { if (empty($this->first_name) && empty($this->last_name) && empty($this->company)) { $this->getErrorStack()->add('company', 'You must fill in at least one of the following: First Name, Last Name, Company'); } } ...
Does anyone have a working WPF4 version of the DataStateSwitchBehavior? This was part of the Expression Blend Samples for Siverlight at: http://expressionblend.codeplex.com/wikipage?title=Behaviors%20and%20Effects&referringTitle=Documentation Thanks! ...
I'm trying to build a behavior that disables the button and changes the text to follow the common pattern of disabling a button to stop a user from double clicking. I need the behavior changes to take effect before the commmand. Can I use a behavior this way? view: (set the DataContext in the loaded event of the code behind) <Grid...
Hi, I'm having problems attaching an uncheck command to a checkbox. Or more correct, I do not know how to code it. Here's my code for the check command, how should it look to get uncheck also working? View: <CheckBox commands:Checked.Command="{Binding CheckCommand}" IsChecked="False"></CheckBox> ViewModel: Private _CheckCommand As D...
Hello everyone, what I want to achieve is a pretty common thing, but I want to use the Silverlight advantage to keep the UI-Behaviour in XAML. I want a Textbox which has an 'empty' state like this: [ Name ] (Name in gray font), and when the Textbox receives Focus, the Fontcolor is supposed to change to black and the Textbox is suppose...
I am using an afterFind function to modify data from a find function. It works fine. If I move the afterFind function into a behavior (in a plugin) it still works, but only when the model of interest is the primary model, i.e. it isn't called when the model belongsTo another model. Is there any way round this? I'm using cake 1.3.4. This ...
I have the following lines : for (int i=0;i<3;i++) System.out.print("\nA : "+i); // System.out.println(""); // for (int i=0;i<3;i++) System.out.println("B : "+i); The output is : A : 0 A : 1 A : 2A : 2 Why ? I expected this : A : 0 A : 1 A : 2 But if I uncomment the 2nd and 3rd lines [ together or one at a time ], it b...