Search Results

Search found 12222 results on 489 pages for 'initial context'.

Page 24/489 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Context dependent validation

    - by Ole Lynge
    I would like to be able to validate an object in different contexts using DataAnnotations in .NET 4. For example: If I have a class with these annotated properties [Required] public string Name { get; set; } [Required] public string PhoneNumber { get; set; } [Required] public string Address { get; set; } I would like to be able to do something like bool namePhoneValid = Validator.TryValidateObject(entity, contextNamePhone, results1); bool allValid = Validator.TryValidateObject(entity, contextAll, results2); where contextNamePhone only validates Name and Phone, and contextAll validates all properties (Name, Phone and Address in this case). Is this possible? How should the validation context be constructed? Are there other/smarter ways to do this?

    Read the article

  • How to change FPU context in signal handler (C++/Linux)

    - by Henry Fané
    I wrote a signal handler to catch FPE errors. I need to continue execution even if this happens. I receive a ucontext_t as parameter, I can change the bad operand from 0 to another value but the FPU context is still bad and I run into an infinite loop ? Does someone already manupulate the ucontext_t structure on Linux ? I finally found a way to handle these situations by clearing the status flag of ucontext_t like this: ... const long int cFPUStatusFlag = 0x3F; aContext->uc_mcontext.fpregs->sw &= ~cFPUStatusFlag; ... 0x3F is negated to put 0 in the 6 bits of the status register of the FPU (x87). Doing this implies to check for FPE exceptions after calculation.

    Read the article

  • Unexpected key-value behavior in a Core Data Context

    - by ????
    If I create an array of strings (via key-value coding) containing the names of a Managed Object entity's attributes which are stored in the App Delegate the first time, I get an array of NSStrings without any problems. If I subsequently make the same call later from the same entry point in code, that same collection becomes an array of NULL objects- even though nothing in the Core Data Context has changed. One unappealing work-around involves re-creating the string array every time, but I'm wondering if anyone has a guess as to what's happening behind the scenes. // Return an array of strings with the names of attributes the Activity entity - (NSArray *)activityAttributeNames { #pragma mark ALWAYS REFRESH THE ENTITY NAMES? //if (activityAttributeNames == nil) { // Create an entity pointer for Activity NSEntityDescription *entity = [NSEntityDescription entityForName:@"Activity" inManagedObjectContext:managedObjectContext]; NSArray *entityAttributeArray = [[NSArray alloc] initWithArray:[[entity attributesByName] allValues]]; // Extract the names of the attributes with Key-Value Coding activityAttributeNames = [entityAttributeArray valueForKeyPath:@"name"]; [entityAttributeArray release]; //} return activityAttributeNames; }

    Read the article

  • non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context

    - by bigbluedragon
    hey i have problem with JDialogForm. I have created it using netbeans 6.8. That JDialogForm have textfield and button below it. and here is some code... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String sciezka = jTextField1.getText(); if (sciezka.length() > 0) { Zmienne_pomocnicze.setPrzechowaj(sciezka); } } Now i want to copy that string "sciezka" to my main window but if I do it like this public class Zmienne_pomocnicze { public String n; public void setPrzechowaj (String neew) { n = neew; } public String getPrzechowaj () { return n; } } i get error in jButton1: non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context any ideas?

    Read the article

  • C++ context menu image at left side showing partially, no fully

    - by Samir
    In C++ #define BITMAP_MAIN 201 //in resource.h BITMAP_MAIN BITMAP "main.bmp" // in .rc file // showing icon in menu... HBITMAP imgMain = LoadBitmap( aHinstance, MAKEINTRESOURCE(BITMAP_MAIN) ); SetMenuItemBitmaps ( hSubmenu, uMenuIndex, MF_BYPOSITION, imgMain, imgMain); The problem is in non-English XP OS the main.bmp is showing partially in the context menu. In Vista, Window7 main.bmp is showing just fine. Also in English XP its ok. But why the image is not showing fully in non-English XP? How would I use .ico file here instead of .bmp? This is to make the image transparent.

    Read the article

  • Creating new context in JSF

    - by Krishna
    HI, We are navigating to for example page A to C. When we are in page C, user clicks the back button of the browser and goes back to the previous application which is used for invoking the page A. Again, when user trying to invoke the page A, he directly navigating to the page C, not page A. Here what I felt the problem was, may the JSF context is taking to the current page. How we can solve this problem. When every user clicks to enter page A, he should be able to see the page A. Anyone has the solution for my problem.

    Read the article

  • Context Menu event with QGraphicsWidget

    - by onurozcelik
    In my application I subclass QGraphicsWidget In paint I am drawing a line with pen width 4. I reimplemented boundingRect() and shape(). But I can't catch context menu event every time I click right mouse button. What is the problem.(Pen Width ? ) //Sample code for boundingRect() and shape() QRectF boundingRect() const { qreal rectLeft = x1 < x2 ? x1 : x2; qreal rectTop = y1 < y2 ? y1 : y2; qreal rectWidth = (x1 - x2) != 0 ? abs(x1-x2) : 4; qreal rectHeight = (y1 - y2) != 0 ? abs(y1 -y2) : 4; return QRectF(rectLeft,rectTop,rectWidth,rectHeigt); } QPainterPath shape() { QPainterPath path; path.addRect(boundingRect()); return path; }

    Read the article

  • Context Menu SourceControl Error

    - by developer
    Hi All, I am trying to use contextmenu in my textbox control and I want to bind the textbox value to the value selected in context menu,below is my code <Window.CommandBindings> <CommandBinding Command="local:MyPanel.ChangeTextboxValue" Executed="ChangeTextboxValue_Executed"/> </Window.CommandBindings> CODE-BEHIND public static RoutedUICommand ChangeTextboxValue = new RoutedUICommand ("ChangeTextboxValue", "ChangeTextboxValue", typeof(MyPanel)); private void ChangeTextboxValue_Executed(object sender, ExecutedRoutedEventArgs e) { string oldvalue = Convert.ToString(e.Parameter); (((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox).Text = oldvalue; } oldvalue is the value I want the textbox controls value to change to. I am trying to use above code but it gives me the error, 'Object reference not set to an instance of object'. I tried to debug the app and I get ContextMenu as null.. .Any ideas why??

    Read the article

  • Windows7 explorer context strip hook?

    - by aceman
    Hy everybody, I'm wondering if it's possible to add a new button via C++ or C# to windows 7 explorer "context strip"(don't know if this is correct name) - like on picture below. My reason for this is because a lot of times I'm switching on&off "Show hidden files, folders and drives" functionality under Tools-Folder option-View. Therefore i want to simplify this process with a click of a button. I was looking into ShellExecteEx function, but I am not sure I can do that. Can Anybody direct me in right direction? thanks, regards

    Read the article

  • how to call context menu

    - by gdonald
    I open my context menu like this: private OnClickListener optionsClickListener = new OnClickListener() { public void onClick( View v ) { registerForContextMenu( v ); openContextMenu( v ); } }; How can I call registerForContextMenu( v ); openContextMenu( v ); from inside my regular menu handler here: public boolean onOptionsItemSelected( MenuItem item ) { switch( item.getItemId() ) { case OPTIONS: registerForContextMenu( v ); openContextMenu( v ); return true; where I have no View to pass?

    Read the article

  • LINQ Queries And Context

    - by Soo
    Hello SO, I have a slight issue with some code I'm writing if(parameter == 1) { var linq = from a in db.table select a; } else { var linq = from a in db.table where a.id = 1 select a; } foreach(var b in linq) { ... } So basically what's going on is that the variable "linq" is different depending on the value of "parameter". When I try to loop through "linq" with my foreach loop, I get an error about how linq doesn't exist in the current context. What is the best way to work around this type of issue?

    Read the article

  • Deterministic random number generator with context?

    - by user653133
    I am looking for a seeded random number generator that creates a pool of numbers as a context. It doesn't have to be too good. It is used for a game, but it is important, that each instance of the Game Engine has it's own pool of numbers, so that different game instances or even other parts of the game that use random numbers don't break the deterministic character of the generated numbers. Currently I am using rand() which obviously doesn't have this feature. Are there any c or objective-c generators that are capable of doing what I want? Best regards, Michael

    Read the article

  • func_get_args detect context

    - by Steve
    I have a script where it accepts a varying number of arguments. I want to use func_get_args to perform operations on said arguments. If I have one function like this: function Something() { foreach(func_get_args($this) as $functions) { // Do something } // Return.. } I want to be able to call this function in, for example, another function to add/save entries. The add/save function would have arguments 'title', 'description' etc.. I basically want to know if there is a way to detect the context of a function call. Can I pass something to func_get_args that will let it know that its called in a certain function? So if I do: function Save($title, $desc) { $vars = $this->Something(); } I want $vars to contain $title and $desc after modifying them.

    Read the article

  • UDK "Error, Accessing a member of _'s within class through a context expression requires explicit 'O

    - by Ricket
    I get the following error in the UDK Frontend when I try to make my project: C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZInteraction.uc(58) : Error, Accessing a member of GameUISceneClient's within class through a context expression requires explicit 'Outer' The class ZInteraction extends Interaction. Line 58 is: GetSceneClient().ConsoleCommand("KEYNAME"@Key); What is the problem here? I am still investigating and I will update as I find out more. edit: Tried fixing the line up as class'UIRoot'.static.GetSceneClient().ConsoleCommand("KEYNAME"@Key); - no change.

    Read the article

  • an error within context

    - by helloWorld
    can somebody please explain my mistake, I have this class: class Account{ private: string strLastName; string strFirstName; int nID; int nLines; double lastBill; public: Account(string firstName, string lastName, int id); friend string printAccount(string firstName, string lastName, int id, int lines, double lastBill); } but when I call it: string reportAccounts() const { string report(printAccountsHeader()); for(list<Account>::const_iterator i = listOfAccounts.begin(); i != listOfAccounts.end(); ++i){ report += printAccount(i->strFirstName, i->strLastName, i->nID, i->nLines, i->lastBill);; } return report; } I receive error within context, can somebody explain why? thanks in advance

    Read the article

  • c# error: Use of unassigned local variable (context visual studio T4 ENGINE)

    - by user310291
    In C# (within the context of T4 template see http://www.olegsych.com/2008/03/how-to-generate-multiple-outputs-from-single-t4-template/) I want to do this <# String myTemplateVar; #> <# if (string.IsNullOrEmpty(myTemplateVar)) { myTemplateVar= "name"; }; #> I want to give a value to myTemplateVar if myTemplateVar has not already been setup by an external call from T4 engine in another template which would have this instruction: CallContext.SetData("myTemplate.myTemplateVar", ExternalTemplateVar); But I cannot even compile in C# why ? How to fix this ?

    Read the article

  • Exception Security Context token in WCF

    - by Alhambra Eidos
    Hi all I'm using Service WCF, and I get the following error: "The security context token is expired or is not valid. The message was not processed." Client config <endpoint address="http://probiz:49610/GestionOrganizacion.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOrganizacion" contract="CarWin.ServiceContracts.Interfaces.IOrganizacion" behaviorConfiguration="NewBehavior" name="PRO_WSHttpBinding_IOrganizacion"> <identity> <dns value="localhost" /> </identity> <binding name="WSHttpBinding_IOrganizacion" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" /> </security> </binding> more config <endpointBehaviors> <behavior name="NewBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> </endpointBehaviors> Thanks in advanced, greetings

    Read the article

  • {PHP} Fatal error: Using $this when not in object context (Joomla)

    - by Asher
    Hi all, i don't really know php and have hit a brick wall. The problem is that my site is showing the following error... Fatal error: Using $this when not in object context in /hermes/web07/b2350/pow.thefoodie/htdocs/index.php on line 11 This is the begining of my index.php file... // no direct access define( 'YOURBASEPATH', dirname(FILE) ); ? language; ?" lang="language; ?" main_body ul li { behavior: url(baseurl; ?/templates/template ?/css/iepngfix.htc) } baseurl; ?/templates/template ?/js/pngfix.js" baseurl; ?/templates/template ?/css/template_css.css" rel="stylesheet" type="text/css" media="all" / baseurl; ?/templates/template ?/js/fx_styles.js" baseurl; ?/templates/template ?/js/accordion.js" // *************************** // // Template Parameters // // *************************** $h1 = $this-params-get("logo"); $linked_h1 = ($this-params-get("logoLinked", 1) == 0)?"false":"true"; $h1_title = $this-params-get("logoTitle"); $h2_motto = $this-params-get("logoMotto"); // Please do NOT change this unless you know what you doing. $template_path = $this-baseurl.'/templates/'.$this-template; // template path $default_font = "default"; // **************************** ? Any help would be great as i am completely lost.

    Read the article

  • "The name 'WithTable' does not exist in the current context" using Fluent NHibernate

    - by Byron Sommardahl
    Might be a really easy problem to fix, but it the solution is eluding me! I'm using Fluent NHibernate 1.0 RTM (and using NHibernate bins that ships with it). I'm trying to map my entities and cannot use the WithTable() method. It's not available in Intelligence and VS doesn't suggest any namespaces to reference. Here's my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using GeoCodeThe.Net.Domain.Entities; using FluentNHibernate.Mapping; namespace GeoCodeThe.Net.Domain.Mappings { class CategoryMap: ClassMap<ICategory> { public CategoryMap() { WithTable("Categories"); // <----- Compile error: The name 'WithTable' does not exist in the current context Id(x => x.Id); Map(x => x.Name); Map(x => x.Tags); } } My bin folder has: Antlr3.Runtime.dll Castle.Core.dll Castle.DynamicProxy2.dll FluentNHibernate.dll Iesi.Collections.dll log4net.dll NHibernate.ByteCode.Castle.dll NHibernate.dll FluentNHibernate.pdb Castle.Core.xml Castle.DynamicProxy2.xml FluentNHibernate.xml Iesi.Collections.xml log4net.xml NHibernate.ByteCode.Castle.xml NHibernate.xml Any clue what I'm missing? Let me know if you need any more clarification.

    Read the article

  • Perl unpack in list context

    - by drewk
    A common 'Perlism' is generating a list as something to loop over in this form: for($str=~/./g) { print "the next character from \"$str\"=$_\n"; } In this case the global match regex returns a list that is one character in turn from the string $str, and assigns that value to $_ Instead of a regex, split can be used in the same way or 'a'..'z', map, etc. I am investigating unpack to generate a field by field interpretation of a string. I have always found unpack to be less straightforward to the way my brain works, and I have never really dug that deeply into it. As a simple case, I want to generate a list that is one character in each element from a string using unpack (yes -- I know I can do it with split(//,$str) and /./g but I really want to see if unpack can be used this way...) Obviously, I can use a field list for unpack that is unpack("A1" x length($str), $str) but is there some other way that kinda looks like globbing? ie, can I call unpack(some_format,$str) either in list context or in a loop such that unpack will return the next group of character in the format group until $str is exausted? I have read The Perl 5.12 Pack pod and the Perl 5.12 pack tutorial and the Perkmonks tutorial Here is the sample code: #!/usr/bin/perl use warnings; use strict; my $str=join('',('a'..'z', 'A'..'Z')); #the alphabet... $str=~s/(.{1,3})/$1 /g; #...in groups of three print "str=$str\n\n"; for ($str=~/./g) { print "regex: = $_\n"; } for(split(//,$str)) { print "split: \$_=$_\n"; } for(unpack("A1" x length($str), $str)) { print "unpack: \$_=$_\n"; }

    Read the article

  • SQL Exception: "Impersonate Session Security Context" cannot be called in this batch because a simul

    - by kasey
    When opening a connection to SQL Server 2005 from our web app, we occasionally see this error: "Impersonate Session Security Context" cannot be called in this batch because a simultaneous batch has called it. We use MARS and connection pooling. The exception originates from the following piece of code: protected SqlConnection Open() { SqlConnection connection = new SqlConnection(); connection.ConnectionString = m_ConnectionString; if (connection != null) { try { connection.Open(); if (m_ExecuteAsUserName != null) { string sql = Format("EXECUTE AS LOGIN = {0};", m_ExecuteAsUserName); ExecuteCommand(connection, sql); } } catch (Exception exception) { connection.Close(); connection = null; } } return connection; } I found an MS Connect article which suggests that the error is caused when a previous command has not yet terminated before the EXECUTE AS LOGIN command is sent. Yet how can this be if the connection has only just been opened? Could this be something to do with connection pooling interacting strangely with MARS? UPDATE: For the short-term we have implemented a workaround by clearing out the connection pool whenever this happens, to get rid of the bad connection, as it otherwise keeps getting handed back to various users. (Not too bad as this only happens a couple of times a day.) But if anyone has any further ideas, we are still looking out for a real solution...

    Read the article

  • "Permission denied to access property 'href' from a non-chrome context" in JavaScript and OpenLayers

    - by Mark Iliffe
    This is really two questions one leading into the other. Firstly what does 'Permission denied to access property 'href' from a non-chrome context' actually mean? Secondly I am using overlays in OpenLayers and wish to change the opacity of said layers, this is where this error is being thrown the code of which is here... <input id='opacity' value="1.0" onChange="changeOpacity()"> Of which changeOpacity() is the following function... function changeOpacity() { var newOpacity = parseFloat(OpenLayers.Util.getElement('opacity').value); newOpacity = Math.min(1.0, Math.max(0.1, newOpacity)); OpenLayers.Util.getElement('opacity').value = newOpacity; for (var i=0; i<images.length; i++) { layers[images[i]].setOpacity(newOpacity); } } which throws the error at "var href = originalElement.href;" here... function mD(e) { //what is originalElement/srcElement/originalTarget? var originalElement = e.srcElement || e.originalTarget; var href = originalElement.href; if (originalElement.nodeName == "A" && href.match("http://www.openstreetmap.org/browse/")) { href = href.replace('http://www.openstreetmap.org/browse/','http://www.openstreetmap.org/api/0.6/'); if (gml) { map.removeLayer(gml); } //$("status").innerHTML = 'loading'; } gml = new OpenLayers.Layer.GML("OSM", href, {format: OpenLayers.Format.OSM}); map.addLayer(gml); gml.preFeatureInsert = style_osm_feature; var sf = new OpenLayers.Control.SelectFeature(gml, {'onSelect': on_feature_hover}); map.addControl(sf); sf.activate(); return false; } } Any help/ideas is great appreciated! I am using firefox 3.5.9 and firebug 1.5.4

    Read the article

  • AutoMapper How To Map Object A To Object B Differently Depending On Context

    - by IanT8
    Calling all AutoMapper gurus! I'd like to be able to map object A to object B differently depending on context at runtime. In particular, I'd like to ignore certain properties in one mapping case, and have all properties mapped in another case. What I'm experiencing is that Mapper.CreateMap can be called successfully in the different mapping cases however, once CreateMap is called, the map for a particular pair of types is set and is not subsequently changed by succeeding CreateMap calls which might describe the mapping differently. I found a blog post which advocates Mapper.Reset() to get round the problem, however, the static nature of the Mapper class means that it is only a matter of time before a collision and crash occur. Is there a way to do this? What I think I need is to call Mapper.CreateMap once per appdomain, and later, be able to call Mapper.Map with hints about which properties should be included / excluded. Right now, I'm thinking about changing the source code by writing a non-static mapping class that holds the mapping config instance based. Poor performance, but thread safe. What are my options. What can be done? Automapper seems so promising.

    Read the article

  • MSTest Test Context Exception Handling

    - by Flip
    Is there a way that I can get to the exception that was handled by the MSTest framework using the TestContext or some other method on a base test class? If an unhandled exception occurs in one of my tests, I'd like to spin through all the items in the exception.Data dictionary and display them to the test result to help me figure out why the test failed (we usually add data to the exception to help us debug in the production env, so I'd like to do the same for testing). Note: I am not testing that an exception was SUPPOSED TO HAPPEN (I have other tests for that), I am testing a valid case, I just need to see the exception data. Here is a code example of what I'm talking about. [TestMethod] public void IsFinanceDeadlineDateValid() { var target = new BusinessObject(); SetupBusinessObject(target); //How can I capture this in the text context so I can display all the data //in the exception in the test result... var expected = 100; try { Assert.AreEqual(expected, target.PerformSomeCalculationThatMayDivideByZero()); } catch (Exception ex) { ex.Data.Add("SomethingImportant", "I want to see this in the test result, as its important"); ex.Data.Add("Expected", expected); throw ex; } } I understand there are issues around why I probably shouldn't have such an encapsulating method, but we also have sub tests to test all the functionality of PerformSomeCalculation... However, if the test fails, 99% of the time, I rerun it passes, so I can't debug anything without this information. I would also like to do this on a GLOBAL level, so that if any test fails, I get the information in the test results, as opposed to doing it for each individual test. Here is the code that would put the exception info in the test results. public void AddDataFromExceptionToResults(Exception ex) { StringBuilder whereAmI = new StringBuilder(); var holdException = ex; while (holdException != null) { Console.WriteLine(whereAmI.ToString() + "--" + holdException.Message); foreach (var item in holdException.Data.Keys) { Console.WriteLine(whereAmI.ToString() + "--Data--" + item + ":" + holdException.Data[item]); } holdException = holdException.InnerException; } }

    Read the article

  • Context menu event handling error - CS1061

    - by MrTemp
    I am still new to c# and wpf This program is a clock with different view and I would like to use the context menu to change between view, but the error says that there is no definition or extension method for the events. Right now I have the event I'm working on popping up a MessageBox just so I know it has run, but I cannot get it to compile. public partial class MainWindow : NavigationWindow { public MainWindow() { //InitializeComponent(); } public void AnalogMenu_Click(object sender, RoutedEventArgs e) { /*AnalogClock analog = new AnalogClock(); this.NavigationService.Navigate(analog);*/ } public void DigitalMenu_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Digital Clicked"); /*DigitalClock digital = new DigitalClock(); this.NavigationService.Navigate(digital);*/ } public void BinaryMenu_Click(object sender, RoutedEventArgs e) { /*BinaryClock binary = new BinaryClock(); this.NavigationService.Navigate(binary);*/ } } and the xaml call if you want it <NavigationWindow.ContextMenu> <ContextMenu Name="ClockMenu" > <MenuItem Name="ToAnalog" Header="To Analog" ToolTip="Changes to an analog clock"/> <MenuItem Name="ToDigital" Header="To Digital" ToolTip="Changes to a digital clock" Click="DigitalMenu_Click" /> <MenuItem Name="ToBinary" Header="To Binary" ToolTip="Changes to a binary clock"/> </ContextMenu> </NavigationWindow.ContextMenu>

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >