behavior

Behavior of an expression: Defined or Undefined?

I have the following code int m[4]={1,2,3,4}, *y; y=m; *y = f(y++); // Expression A My friend told me that Expression A has a well defined behavior but I am not sure whether he is correct. According to him function f() introduces a sequence point in between and hence the behavior is well defined. Someone please clarify. P.S: ...

Strange behavior while modifying array that is being iterated

This is a stupid example, but shows exactly what is my problem. In some situations the array is sucessufully modified and anothers it is not, why? Values are given to foreach by value? And the output is also screwed, some lines seems to have '\r\n' others do not. $arr = file('text.txt'); echo '<pre>'; foreach( $arr as $x => $line)...

WPF: Attached behavior is registered but never called?

Hello all, trying my first attached behavior: I want to bind the TextSelection of the RichTextBox to my ViewModel`s property: public TextSelection SelectedRichText {get;set;} That way I bind it: <RichTextBox behavior:RichTextBoxSelectionBehavior.RichTextBoxSelection="{Binding SelectedRichText}" /> Thats my code and I have 2 quest...

RESTful Rails & encapsulating behaviour

Background - I have a model, say Door, that has a state of open or closed. I encapsulate the behaviour of opening the door in a method #open on each instance (And I also have a #close equivalent). But what's the best way to expose this in a RESTful way? What should my route be? It is an UPDATE to Door instance, but what should I UPDATE...

WPF Trigger command

Hi, I know in Silverlight there is a concept of behaviours. In WPF we have Triggers, What I am trying to achieve is that when a user has his mouse over a button, I want a command to be fired. I have a RepeatButton that has its Command Property set, but I want that command (or preferable another command to fire) when the mouse is ove...

Settings dependent Behavior on Cake

I have a Behavior attached to a Model that should behave differently depending on some property of the model. Example: class Airplane extends AppModel { var $actsAs = array('Flying'); } class FlyingBehavior extends ModelBehavior { function flightTime(&$Model, $distance) { return $distance / $this->speed; } } Initi...

Validation (CSS 2.1): 'behavior' is not a known CSS property name.

hello, i am using whatever:hover (http://www.xs4all.nl/~peterned/csshover.html) script to mimic the :hover selector in IE6. the suggested use it to attach it to the body element as IE6 behavior. but all my pages use XHTML 1.1, so CSS validation in VS2008 fails when I try to publish my site, so publishing fails. are there good ways to f...

ScenarioNotFoundException when trying to run jBehave scenario

I've been Google-ing around for a while trying to figure out a fix for this with no real luck. I'm getting this when trying to run a jBehave test - org.jbehave.scenario.errors.ScenarioNotFoundException: Path '$Path_to_jBehave_Directory' could not be found by classloader sun.misc.Launcher$AppClassLoader@f4a24a ... My textual scenari...

How to insert a string in SQLite database without conversion ?

The table: CREATE TABLE configuration(Key STRING, Value STRING, PRIMARY KEY (Key) ); Here is what I tried: insert into configuration(Key,Value) values(42,cast('0042' as text)); Here is the dump: INSERT INTO "configuration" VALUES(42,42); What I wanted: INSERT INTO "configuration" VALUES(42,'0042'); ...

strange behavior with 'IN' clause works

i found this site: here its very well described why it works and why not. but my question is a little different. select 'true' from dual where 'test' not in ('test2',''); why does this query not returing a row? is '' handled like null? thx for your help ...

Design-time problem with custom behaviors and triggers in Silverlight

I have implemented a few custom behaviors and triggers and added them via XAML. They work fine at run time but prevent the Cider designer view from loading at design time, and presumably will cause a problem in Blend too, though I haven't confirmed that. Here is an overview of what I've implemented for one of the behaviors; hopefully so...

Change default scrollbar behavior

Quick question... Is there any way to change the default behavior of a scrollbar from moving one pixel at a time (continuous motion), to jumping say 100px at a time (less continuous more discrete jumps). I have an animation that jumps between pictures and I want to use the scrollbar to show one picture at a time. Whenever I try chan...

Android OnLongClickListener strange / unreliable behaviour

Hi there :) I'm currently fighting against the OnLongClickListener on Android Api Lvl 8. Take this code: this.webView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { System.out.println("long click"); return true; } }); It works perfectly. I can press anywh...

Why does Enum.Parse create undefined entries?

class Program { static void Main(string[] args) { string value = "12345"; Type enumType = typeof(Fruits); Fruits fruit = Fruits.Apple; try { fruit = (Fruits) Enum.Parse(enumType, value); } catch (ArgumentException) { Console.WriteLine(String.F...

html5 iphone preventDefault() doesnt stop from "copy" to appear upon a touch

I have this code, which shows the coordinates of the touch as the user drags his finger across the screen. The issue is that is I touch the screen for too long, it selects the entire canvas and displays the "copy" bubble, which is the default behaviour. How do I get rid of that? <html> <head> <script type="application/javascript"> fu...

Flash TextField -- make it act like a label?

How can i disable the text selection abilities and such of flash TextFields (so they act like labels)? ...

Restrict Silverlight/WPF Behavior visibility

In Silverlight (and probably WPF), when I define a System.Windows.Interactivity.Behavior<T> for e.g. an ItemsControl, like public class SomeAwesomaticBehavior : Behavior<ItemsControl> { } it will appear in Visual Studio's XAML editor (and probably in the Designer too) even for ordinary, non-Items-Controls and throw nasty runtime excep...

Reset TranslateZoomRotateBehavior? (WPF/Blend behavior)

I have attached a TranslateZoomRotateBehavior to a Grid: <Grid> <!--all sorts of content--> <Button Content="Cancel" Click="CancelButton_Click Width="25" Height="20"/> <i:Interaction.Behaviors> <ei:TranslateZoomRotateBehavior ConstrainToParentBounds="True" SupportedGestures="Translate"/> </i:Interaction.Behaviors...

Doctrine 1.2: Overriding Doctrine_Record::__get() from a template

I have a model class (obviously, it extends Doctrine_Record) that "acts as" a custom template. I want to get values like this: "echo $record->virtual_field". Is there a way to override the getter method in my custom template to provide a custom response, then either pass on the request to the parent class or not? In other words, is th...

PEX: How would you test an equality method in pex?

So i'm here playing with PEX, it seems like a great idea. However I am having a few problems, such as I have no way to test an equals method using parameter unit tests. Maybe there is no way, maybe its a technique i haven't figured out yet. Someone must have a decent idea. If i was doing this in moq for instance, I would ensure that...