Search Results

Search found 27 results on 2 pages for 'akaphenom'.

Page 1/2 | 1 2  | Next Page >

  • ControlTemplate Exception: "XamlParseException: Cannot find a Resource with the Name/Key"

    - by akaphenom
    If I move the application resources to a UserControl resources everythgin runs groovy. I still don't understand why. I noticed that my application object MyApp did more than inherit from Application it loaded an XAML for the main template and connected all the plumbing. So I decided to create a user control to remove the template from the applciation (thinking there may be an even order issue not allowing my resource to be found). namespace Module1 type Template() as this = //inherit UriUserControl("/FSSilverlightApp;component/template.xaml", "") inherit UriUserControl("/FSSilverlightApp;component/templateSimple.xaml", "") do Application.LoadComponent(this, base.uri) let siteTemplate : Grid = (this.Content :?> FrameworkElement) ? siteTemplate let nav : Frame = siteTemplate ? contentFrame let pages : UriUserControl array = [| new Module1.Page1() :> UriUserControl ; new Module1.Page2() :> UriUserControl ; new Module1.Page3() :> UriUserControl ; new Module1.Page4() :> UriUserControl ; new Module1.Page5() :> UriUserControl ; |] do nav.Navigate((pages.[0] :> INamedUriProvider).Uri) |> ignore type MyApp() as this = inherit Application() do Application.LoadComponent(this, new System.Uri("/FSSilverlightApp;component/App.xaml", System.UriKind.Relative)) do System.Windows.Browser.HtmlPage.Plugin.Focus() this.RootVisual <- new Template() ; // test code to check for the existance of the ControlTemplate - it exists let a = Application.Current.Resources.MergedDictionaries let b = a.[0] let c = b.Count let d : ControlTemplate = downcast c.["TransitioningFrame"] () "/FSSilverlightApp;component/templateSimple.xaml" <UserControl x:Class="Module1.Template" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid HorizontalAlignment="Center" Background="White" Name="siteTemplate"> <StackPanel Grid.Row="3" Grid.Column="2" Name="mainPanel"> <!--Template="{StaticResource TransitioningFrame}"--> <navigation:Frame Name="contentFrame" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Template="{StaticResource TransitioningFrame}"/> </StackPanel> </Grid> </UserControl> "/FSSilverlightApp;component/App.xaml" <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> "/FSSilverlightApp;component/TransitioningFrame.xaml" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="Olive" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary> Unfortunately that did not work. If I remove the template attribute from the navigationFrame element, the app loads and directs the content area to the first page in the pages array. Referencing that resource continues to throw a resource no found error. Original Post I have the following app.xaml (using Silverlight 3) <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> and content template: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary> The debugger says it the contentTemplate is loaded correctly by adding some minimal code: type MyApp() as this = inherit Application() do Application.LoadComponent(this, new System.Uri("/FSSilverlightApp;component/App.xaml", System.UriKind.Relative)) let cc = new ContentControl() let mainGrid : Grid = loadXaml("MainWindow.xaml") do this.Startup.Add(this.startup) let t = Application.Current.Resources.MergedDictionaries let t1 = t.[0] let t2 = t1.Count let t3: ControlTemplate = t1.["TransitioningFrame"] With this line in my main.xaml <navigation:Frame Name="contentFrame" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Template="{StaticResource TransitioningFrame}"/> Yields this exception Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E) Timestamp: Mon, 24 May 2010 23:10:15 UTC Message: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.Windows.Markup.XamlParseException: Cannot find a Resource with the Name/Key TransitioningFrame [Line: 86 Position: 115] at MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers, Boolean expandTemplatesDuringParse) at MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers) at System.Windows.Markup.XamlReader.Load(String xaml) at Globals.loadXaml[T](String xamlPath) at Module1.MyApp..ctor() Line: 54 Char: 13 Code: 0 URI: file:///C:/fsharp/FSSilverlightDemo/FSSilverlightApp/bin/Debug/SilverlightApplication2TestPage.html

    Read the article

  • Anybody have anyluck F# Silverlight vs2010?

    - by akaphenom
    Has anybody had any luck with the following combination F# 2.0 Silverlight v3 .NET Framework 4.0 VS 2010 I have been trying all night and I just can't seem to adopt any of the existing smaples out there to run... My goal is to have a silverlight application 100% backed by F#; the examples that are referenced as working are mostly C# silverlight apps calling F# Libraries. Which in practice should be fine - but I am really trying to impress my girlfriend :)

    Read the article

  • can you customize adobe acrobat reader "security warning"

    - by akaphenom
    We need to insert a web beacon (i know taboo) in to adobe PDFs to know when they are opened, as one of our clients is moving to a model of "giving" their documents away and following up repeat viewers for subscriptions. Its not enough to be able to provide a download, they want to attach the PDF to an email and "blast" to directed recipients (double-opt-in etc). Adding the javascript to the pdf is easy enough: (iText) and the "openAction" event. However the security box pops up and displays: "Security Warning" "Document is trying to connect to 'xxxx.yyy.com' if you trusty the site choose Allow. If do not trust the site choose Block" [help] [allow] [block] I don't think we need to completley overhaul the dialogue box, I just think we need to change the middle text to be more descriptive of why we are doing it. Of course our client would love us to remove this completely... Thank you in advance for any feed back you can provide, Todd

    Read the article

  • F# List of functions

    - by akaphenom
    I am trying to have a list of functions, but seem to be comming up empty handed. The basic code is something like this: let doSomething var = var let doSomething2 var = var let listOfStuff = [doSomething doSomething2] and I am getting the followiung exception: Error 2 Value restriction. The value 'listOfStuff' has been inferred to have generic type val queue : ('_a - '_a) list Either define 'queue' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation. C:\fsharp\SentimentFramework\TradeSignalProcessor\Program.fs 16 9 TradeSignalProcessor I tried addin the [] attribute but that didn't work...

    Read the article

  • F# DataContractJsonSerializer StackOverflowException

    - by akaphenom
    dataElementsList : TypesAndData.DataElement list is a list of 50,000 records (actually many more but lest start small). I am trying to serialize to JSON file: let ser = Json.DataContractJsonSerializer(typeof<TypesAndData.DataElement list>) use ofs = File.OpenWrite(fileName) let result = ser.WriteObject(ofs, dataElementsList) and am getting the infamous StackOverflowException. to be precise: An unhandled exception of type 'System.StackOverflowException' occurred in FSharp.Core.dll any advice?

    Read the article

  • Using Artificial Intelligence (AI) to predict Stock Prices

    - by akaphenom
    Given a set of datavery similar to the Motley Fool CAPS system, where individual users enter BUY and SELL recommendations on various equities. What I would like to do is show each recommendation and I guess some how rate (1-5) as to whether it was good predictor<5 (ie corellation coeffient = 1) of the future stock price (or eps or whatever) or a horrible predictor (ie corellation coeffient = -1) or somewhere inbetween. Each recommendation is tagged to a particular user, so that can be tracked over time. I can also track market direction (bullish / bearish) based off of something like sp500 price. The components I think that would make sense in the model would be: user direction (long/short) market direction sector of stock The thought is that some users are better in bull markets than bear (and vice versa), and some are better at shorts than longs- and then a cobination the above. I can automatically tag the market direction and sector (based off the market at the time and the equity being recommended). The thought is that I could present a series of screens and allow me to rank each individual recommendation by displaying available data absolute, market and sector out performance for a specfic time period out. I would follow a detailed list for ranking the stocks so that the ranking is as objective as possible. My assumtion is that a single user is right no more than 57% of the time - but who knows. I could load the system and say "Lets rank the recommendation as a predictor of stock value 90 days forward"; and that would represent a very explicit set of rankings. NOW here is the crux - I want to create some sort of machine learning algorithm that can identify patterns over a series of time so that as recommendations stream into the application we maintain a ranking of that stock (ie. similar to correlation coeeficient) as to the likelihood of that recommendation (in addition to the past series of recommendations ) will affect the price. Now here is the super crux. I have never taken an AI class / read an AI book / never mind specific to machine learning. So I cam looking for guidance - sample or description of a similar system I could adapt. Place to look for info or any general help. Or even push me in the right direction to get started... My hope is to implment this with F# and be able to impress my friends with a new skillset in F# with an implementation of machine learnign and potentially something (application / source) I can include in a tech portfolio or blog space; Thank you for any advice in advance.

    Read the article

  • Iterating through StaticResource loaded by ResourceDictionary

    - by akaphenom
    Given a resource dictionary loading some static resources into memory - is there any way to iterate through theResources loaded into memory? My silverlight application keeps telling me it cannot find a static resource. I wonder if I have a naming convention issue or somehting - was hoping iterating through the resources in memory would help diagnose any issue... I have the following app.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> and content template: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary>

    Read the article

  • F# Add Constructor to a Record?

    - by akaphenom
    Basically I want to have a single construct to deal with serializing to both JSON and formatted xml. Records workd nicley for serializing to/from json. However XmlSerializer requires a parameterless construtor. I don't really want to have to go through the exercise of building class objects for these constructs (principal only). I was hoping there could be some shortcut for getting a parameterless constructor onto a record (perhaps with a wioth statement or something). I can't get it to behave - has anybody in the community had any luck? module JSONExample open System open System.IO open System.Net open System.Text open System.Web open System.Xml open System.Security.Authentication open System.Runtime.Serialization //add assemnbly reference System.Runtime.Serialization System.Xml open System.Xml.Serialization open System.Collections.Generic [<DataContract>] type ChemicalElementRecord = { [<XmlAttribute("name")>] [<field: DataMember(Name="name") >] Name:string [<XmlAttribute("name")>] [<field: DataMember(Name="boiling_point") >] BoilingPoint:string [<XmlAttribute("atomic-mass")>] [<field: DataMember(Name="atomic_mass") >] AtomicMass:string } [<XmlRoot("freebase")>] [<DataContract>] type FreebaseResultRecord = { [<XmlAttribute("code")>] [<field: DataMember(Name="code") >] Code:string [<XmlArrayAttribute("results")>] [<XmlArrayItem(typeof<ChemicalElementRecord>, ElementName = "chemical-element")>] [<field: DataMember(Name="result") >] Result: ChemicalElementRecord array [<XmlElement("message")>] [<field: DataMember(Name="message") >] Message:string } let getJsonFromWeb() = let query = "[{'type':'/chemistry/chemical_element','name':null,'boiling_point':null,'atomic_mass':null}]" let query = query.Replace("'","\"") let queryUrl = sprintf "http://api.freebase.com/api/service/mqlread?query=%s" "{\"query\":"+query+"}" let request : HttpWebRequest = downcast WebRequest.Create(queryUrl) request.Method <- "GET" request.ContentType <- "application/x-www-form-urlencoded" let response = request.GetResponse() let result = try use reader = new StreamReader(response.GetResponseStream()) reader.ReadToEnd(); finally response.Close() let data = Encoding.Unicode.GetBytes(result); let stream = new MemoryStream() stream.Write(data, 0, data.Length); stream.Position <- 0L stream let test = // get some JSON from the web let stream = getJsonFromWeb() // convert the stream of JSON into an F# Record let JsonSerializer = Json.DataContractJsonSerializer(typeof<FreebaseResultRecord>) let result: FreebaseResultRecord = downcast JsonSerializer.ReadObject(stream) // save the Records to disk as JSON use fs = new FileStream(@"C:\temp\freebase.json", FileMode.Create) JsonSerializer.WriteObject(fs,result) fs.Close() // save the Records to disk as System Controlled XML let xmlSerializer = DataContractSerializer(typeof<FreebaseResultRecord>); use fs = new FileStream(@"C:\temp\freebase.xml", FileMode.Create) xmlSerializer.WriteObject(fs,result) fs.Close() use fs = new FileStream(@"C:\temp\freebase-pretty.xml", FileMode.Create) let xmlSerializer = XmlSerializer(typeof<FreebaseResultRecord>) xmlSerializer.Serialize(fs,result) fs.Close() ignore(test)

    Read the article

  • F# Optional Record Field

    - by akaphenom
    I have a F# record type and want one of the fields to be optional: type legComponents = { shares : int<share> ; price : float<dollar / share> ; totalInvestment : float<dollar> ; } type tradeLeg = { id : int ; tradeId : int ; legActivity : LegActivityType ; actedOn : DateTime ; estimates : legComponents ; ?actuals : legComponents ; } in the tradeLeg type I owuld like the the actuals field to be optional. I cant seem to figure it out nor can I seem to find a reliable example on the web. It seem like this sohuld be easy like let ?t : int = None but i realy can't seem to get this to work. Ugh - thank you T

    Read the article

  • How to determine if a ResourceDictionary is loaded correctly

    - by akaphenom
    How can I tell (through the debugger if my app resources are being loaded correctly). I have tried (in f#) type MyApp() as this = inherit Application() do Application.LoadComponent(this, new System.Uri("/FSSilverlightApp;component/App.xaml", System.UriKind.Relative)) let cc = new ContentControl() let mainGrid : Grid = loadXaml("MainWindow.xaml") let siteTemplate : Grid = mainGrid let txt : TextBlock = siteTemplate ? txt do this.Startup.Add(this.startup) let mutable s = "Items: " s <- s + this.Resources.Count.ToString() it is returning a count of zero. Though I am pretty sure the application is loading the resource because if I change the path within the App.xaml - I get exceptions at runtime. Other re,lavent snippets are: I have the following app.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> and content template: < ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary>

    Read the article

  • Character Encoding: â??

    - by akaphenom
    I am trying to piece together the mysterious string of characters â?? I am seeing quite a bit of in our database - I am fairly sure this is a result of conversion between character encodings, but I am not completely positive. The users are able to enter text (or cut and paste) into a Ext-Js rich text editor. The data is posted to a severlet which persists it to the database, and when I view it in the database i see those strange characters... is there any way to decode these back to their original meaning, if I was able to discover the correct encoding - or is there a loss of bits or bytes that has occured through the conversion process? Users are cutting and pasting from multiple versions of MS Word and PDF. Does the encoding follow where the user copied from? Thank you website is UTF-8 We are using ms sql server 2005; SELECT serverproperty('Collation') -- Server default collation. Latin1_General_CI_AS SELECT databasepropertyex('xxxx', 'Collation') -- Database default SQL_Latin1_General_CP1_CI_AS and the column: Column_name Type Computed Length Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation text varchar no -1 yes no yes SQL_Latin1_General_CP1_CI_AS The non-Unicode equivalents of the nchar, nvarchar, and ntext data types in SQL Server 2000 are listed below. When Unicode data is inserted into one of these non-Unicode data type columns through a command string (otherwise known as a "language event"), SQL Server converts the data to the data type using the code page associated with the collation of the column. When a character cannot be represented on a code page, it is replaced by a question mark (?), indicating the data has been lost. Appearance of unexpected characters or question marks in your data indicates your data has been converted from Unicode to non-Unicode at some layer, and this conversion resulted in lost characters. So this may be the root cause of the problem... and not an easy one to solve on our end.

    Read the article

  • F# Class with Generics : 'constructor deprecated' error

    - by akaphenom
    I am trying to create a a class that will store a time series of data - organized by groups, but I had some compile errors so I stripped down to the basics (just a simple instantiation) and still can't overcome the compile error. I was hoping some one may have seen this issue before. Clas is defined as: type TimeSeriesQueue<'V, 'K when 'K: comparison> = class val private m_daysInCache: int val private m_cache: Map<'K, 'V list ref > ref; val private m_getKey: ('V -> 'K) ; private new(getKey) = { m_cache = ref Map.empty m_daysInCache = 7 ; m_getKey = getKey ; } end So that looks OK to me (it may not be, but doesnt have any errors or warnings) - the instantiation gets the error: type tempRec = { someKey: string ; someVal1: int ; someVal2: int ; } let keyFunc r:tempRec = r.someKey // error occurs on the following line let q = new TimeSeriesQueue<tempRec, string> keyFunc This construct is deprecated: The use of the type syntax 'int C' and 'C ' is not permitted here. Consider adjusting this type to be written in the form 'C' NOTE This may be simple stupidity - I am just getting back from holiday and my brain is still on time zone lag...

    Read the article

  • F# Active Pattern List.filter or equivalent

    - by akaphenom
    I have a records of types type tradeLeg = { id : int ; tradeId : int ; legActivity : LegActivityType ; actedOn : DateTime ; estimates : legComponents ; entryType : ShareOrDollarBased ; confirmedPrice: DollarsPerShare option; actuals : legComponents option ; type trade = { id : int ; securityId : int ; ricCode : string ; tradeActivity : TradeType ; enteredOn : DateTime ; closedOn : DateTime ; tradeLegs : tradeLeg list ; } Obviously the tradeLegs are a type off of a trade. A leg may be settled or unsettled (or unsettled but price confirmed) - thus I have defined the active pattern: let (|LegIsSettled|LegIsConfirmed|LegIsUnsettled|) (l: tradeLeg) = if Helper.exists l.actuals then LegIsSettled elif Helper.exists l.confirmedPrice then LegIsConfirmed else LegIsUnsettled and then to determine if a trade is settled (based on all legs matching LegIsSettled pattern: let (|TradeIsSettled|TradeIsUnsettled|) (t: trade) = if List.exists ( fun l -> match l with | LegIsSettled -> false | _ -> true) t.tradeLegs then TradeIsSettled else TradeIsUnsettled I can see some advantages of this use of active patterns, however i would think there is a more efficient way to see if any item of a list either matches (or doesn't) an actie pattern without having to write a lambda expression specifically for it, and using List.exist. Question is two fold: is there a more concise way to express this? is there a way to abstract the functionality / expression (fun l - match l with | LegIsSettled - false | _ - true) Such that let itemMatchesPattern pattern item = match item with | pattern -> true | _ -> false such I could write (as I am reusing this design-pattern): let curriedItemMatchesPattern = itemMatchesPattern LegIsSettled if List.exists curriedItemMatchesPattern t.tradeLegs then TradeIsSettled else TradeIsUnsettled Thoughts?

    Read the article

  • F# equivalent to Eval

    - by akaphenom
    Is there an F# equivalent to eval? My intent is to have my app load a small code sample from a file and essentially let file = "c:\mysample" let sample = loadFromFile file let results = eval(sample) I am new to F# and trying to figure out some of the limitations before I apply it to a project. Thank you

    Read the article

  • Silverlight ControlTemplate and F#

    - by akaphenom
    Has anybody had any success incorporating a Silverlight ControlTemplate into an F# Silverlight application. I am trying to add transitions to the Navgiation.Frame element and following along on with a C# example: http://www.davidpoll.com/2009/07/19/silverlight-3-navigation-adding-transitions-to-the-frame-control The downloaded source uses the MSBUILD:Compile option on the template XAML and the file is included as a "Page"... ILDASM doesn't show any object created for the XAML; In my project I incldued it as a "Resource" (same as I have done for my pages) and referenced it in app.xaml: <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> the TransitioningFrame.xaml is as follows: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <toolkit:TransitioningContentControl Content="{TemplateBinding Content}" Cursor="{TemplateBinding Cursor}" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Transition="DefaultTransition" /> </Border> </ControlTemplate> </ResourceDictionary> My page objects all load their respective xaml with the follwoing code: type Page1() as this = inherit UriUserControl("/FSSilverlightApp;component/Page1.xaml") do Application.LoadComponent(this, base.uri) and somewhere in app startup: let p1 = new Page1() I donot have a comparable piece for the ControlTemplate - though I was hoping the application object and App.xaml would pull it in magically (as an aside, the reliance on this magic has made setting up a 100% f# silverlight application rather tricky - as nearly all the published articles I find are based around wizards and short cuts - very little on the acual plumbing - ugh). Any advice or thougts on the subject are appreciated.

    Read the article

  • Frame.Navigate to an embedded resource F#

    - by akaphenom
    I have a 100% silverlight 3.0 / f# 2.0 application I am wrapping my brain around. I have the base application loading correctly - and now I want to add the naigation controls to it. My page is stored as an embedded resource - but the Frame.Navigate takes a URI. I know what I have is wrong but here it is: let nav : Frame = mainGrid ? mainFrame let url = "/page1.xaml" let uri = new System.Uri(url, System.UriKind.Relative) ; nav.Navigate uri Any thoughts?

    Read the article

  • F# Silverlight 3.0 Custom Control Property throws: NullReferenceException

    - by akaphenom
    A new issue since my previous post. I am having some issues with the properties of the control in my Control Class I havse defined: static member ItemsProperty : DependencyProperty = DependencyProperty.Register( "Items", typeof<MyMenuItemCollection>, typeof<MyMenu>, null); member this.Items with get () : MyMenuItemCollection = this.GetValue(MyMenu.ItemsProperty) :?> MyMenuItemCollection and set (value: MyMenuItemCollection) = this.SetValue(MyMenu.ItemsProperty, value); The problem occurs on access: for menuItem in this.Items do let contentElement: FrameworkElement = menuItem.Content where I get a null referce exception on this.Items; 'Items' threw an exception of type 'System.NullReferenceException' Immediately after I initialized in the constructor: do this.Items <- new CoolMenuItemCollection()

    Read the article

  • Silverlight Custom Control in F# DefaultStyleKey

    - by akaphenom
    Wondering how to accomplish setting the Style xaml with the code in F#. Im a C# project the buld options allow you to mark it as a resource cusomt build command of: MSBuild:Compile I don't see it in the properties panel, so I tried to add it by hand to the project file myself... Any ideas? The application loads - the custom control has no output (but the code executes). Thanks

    Read the article

  • Silverlight Data Access - how to keep the gruntwork on the server

    - by akaphenom
    What technologies are used / recommended for HTTP Rpc Calls from Silverlight. My Server Side stack is JBoss (servlets / json_rpc [jabsorb]), and we have a ton of business logic (object creation, validation, persistence, server side events) in place that I still want to take advantage of. This is our first attempt at bringing an applet style ria to our product, and ideally we keep both HTML and Silverlight versions. For better or worse the powers that be have pushed us down the silverlight path, and while flex / java fx / silverlight is an interesting debate, that question is removed from the equation. We just have to find a way to get silverlight to behave with our classes. Should I be defining .NET Class representation of our JSON objects and the methodology to serialize / deserialize access to those objects? IE "blah.com/dispenseRpc?servlet=xxxx&p1=blah&p2=blahblah creating functions that invoke the web request and convert the incomming response string to objects? Another way would be to reverse engineer the .NET wcf(or whatever) communications and implement the handler on the Java side that invokes the correct server side code and returns what .NET expects back. But that sounds much trickier. T

    Read the article

  • Troubling starting new silverlight 4.0 project (in f#) from VS2010

    - by akaphenom
    I am trying to protoype a silverlight 4.0 project using F#, and am having issues getting it to install... the silverlight 4 tools for Visual Studio 2010 is barking at me: Installation Requirements: Visual Studio 2010 or Visual Web Developer Express 2010 or Visual Phone Developer Express 2010 that matches the language version of Silverlight Tools 4 must be installed before installation of Silverlight Tools can continue. Silverlight Tools is available in other languages at http://go.microsoft.com/fwlink/?LinkId=177432. VS INfo Microsoft Visual Studio 2010 Version 10.0.30128.1 RC1Rel Microsoft .NET Framework Version 4.0.30128 RC1Rel Installed Version: Professional Microsoft Visual F# 2010 01018-315-4422943-70575 Microsoft Visual F# 2010 Thank you in advance

    Read the article

  • F# Async workflow

    - by akaphenom
    Is there a way to look at the definition of the Async workflow? What goes under the hood that would make a line of code behave differently in there, than outside of it?

    Read the article

  • F#: Define an abstract class that inherits an infterface, but does not implement it

    - by akaphenom
    I owuld like to define an abstract class that inerhits from UserControl and my own Interface IUriProvider, but doesn't implement it. The goal is to be able to define pages (for silverlight) that implement UserControl but also provide their own Uri's (and then stick them in a list / array and deal with them as a set: type IUriProvider = interface abstract member uriString: String ; abstract member Uri : unit -> System.Uri ; end type UriUserControl() as this = inherit IUriProvider with abstract member uriString: String ; inherit UserControl() Also the Uri in the definition - I would like to implement as a property getter - and am having issues with that as well. this does not compile type IUriProvider = interface abstract member uriString: String with get; end Thank you...

    Read the article

  • From and Image to an ImageSource

    - by akaphenom
    I have an image (embedded resource) that i can get access to and form an Image object from. I actually can get the Image object or the Stream of bits the represent the image. However I want to sue that image programaticly to be a background image. So how do I set the ImageSource on the ImageBrush to an AcutalImage (PNG)?

    Read the article

1 2  | Next Page >