Search Results

Search found 200 results on 8 pages for 'tomas nilsson'.

Page 6/8 | < Previous Page | 2 3 4 5 6 7 8  | Next Page >

  • XSL transformation and special XML entities escaping

    - by Tomas R
    I have an XML file which is transformed with XSL. Some elements have to be changed, some have to be left as is - specifically, text with entities &quot;, &amp;, &apos;, &lt;, &gt; should be left as is, and in my case &quot; and &apos; are changed to " and ' accordingly. Test XML: <?xml version="1.0" encoding="UTF-8" ?> <root> <element> &quot; &amp; &apos; &lt; &gt; </element> </root> transformation file: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no" /> <xsl:template match="element"> <xsl:copy> <xsl:value-of disable-output-escaping="no" select="." /> </xsl:copy> </xsl:template> </xsl:stylesheet> result: <?xml version="1.0" encoding="UTF-8"?> <element> " &amp; ' &lt; &gt; </element> desired result: <?xml version="1.0" encoding="UTF-8"?> <element> &quot; &amp; &apos; &lt; &gt; </element> I have 2 questions: why does some of those entities are transformed and other not? how can I get a desired result?

    Read the article

  • Can I "inherit" a delegate? Looking for ways to combine Moq and MSpec without conflicts around It...

    - by Tomas Lycken
    I have started to use MSpec for BDD, and since long ago I use Moq as my mocking framework. However, they both define It, which means I can't have using Moq and using Machine.Specifications in the same code file without having to specify the namespace explicitly each time I use It. Anyone who's used MSpec knows this isn't really an option. I googled for solutions to this problem, and this blogger mentions having forked MSpec for himself, and implemented paralell support for Given, When, Then. I'd like to do this, but I can't figure out how to declare for example Given without having to go through the entire framework looking for references to Establish, and changing code there to match that I want either to be OK. For reference, the Establish, Because and It are declared in the following way: public delegate void Establish(); public delegate void Because(); public delegate void It(); What I need is to somehow declare Given, so that everywhere the code looks for an Establish, Given is also OK.

    Read the article

  • Domain without hosting - possible to redirect with DNS?

    - by Tomas
    Hi, I have a domain (A) without webhosting and I have different domain with hosting (B). I have no experience with that but I guess it should be possible to redirect DNS with A directly to B. In domain administration there is a possibility to change AAAA DNS or ctname and some other settings. Thank you for your help

    Read the article

  • Color scaling function

    - by Tomas Pajonk
    I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas ?

    Read the article

  • Fade animation UITableViewCell

    - by Tomas
    Hi everyone, I have a UITableViewController that populates a UITableView with some data that I pull off the net. The data for each cell consists also of an image used as background, which I'm downloading in a separated NSOperation added to a NSOperationQueue with a MaxConcurrentOperationCount set to 4. As long as the image is not downloaded I'm showing a generic placeholder which I would like to replace (fading out/fading in) with the downloaded image once it's being successfully downloaded. I'm using the following code placed inside the cellForRowAtIndexPath of the UITableViewController. [UIView beginAnimations:@"fade" context:nil]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:3.0]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; cell.placeholderUIImage.alpha = 0.0; cell.backgroundUIImage.alpha = 1.0; [UIView commitAnimations]; This is unfortunately just working randomly for a couple of rows, since for the most the background image is set instantly, as if the animation started on one cell would have been "overwritten" by the next call of beginAnimations.

    Read the article

  • How to "check for overwide node(s)." in graphviz dot file

    - by Tomas Forsman
    I'm trying to generate a large graph using graphviz. I have a generated text file with nodes defined in the dot format. When I try to generate a PNG file from the file using dot -Tpng:cairo graph.txt graph.png I get the error message: Error: Edge length 136228 larger than maximum 65535 allowed. Check for overwide node(s). How do I actually "check for overwide node(s)" ?

    Read the article

  • ASP.Net MVC Ajax form with jQuery validation

    - by Tomas Lycken
    I have an MVC view with a form built with the Ajax.BeginForm() helper method, and I'm trying to validate user input with the jQuery Validation plugin. I get the plugin to highlight the inputs with invalid input data, but despite the invalid input the form is posted to the server. How do I stop this, and make sure that the data is only posted when the form validates? My code The form: <fieldset> <legend>leave a message</legend> <% using (Ajax.BeginForm("Post", new AjaxOptions { UpdateTargetId = "GBPostList", InsertionMode = InsertionMode.InsertBefore, OnSuccess = "getGbPostSuccess", OnFailure = "showFaliure" })) { %> <div class="column" style="width: 230px;"> <p> <label for="Post.Header"> Rubrik</label> <%= Html.TextBox("Post.Header", null, new { @style = "width: 200px;", @class="text required" }) %></p> <p> <label for="Post.Post"> Meddelande</label> <%= Html.TextArea("Post.Post", new { @style = "width: 230px; height: 120px;" }) %></p> </div> <p> <input type="submit" value="OK!" /></p> </fieldset> The JavaScript validation: $(document).ready(function() { // for highlight var elements = $("input[type!='submit'], textarea, select"); elements.focus(function() { $(this).parents('p').addClass('highlight'); }); elements.blur(function() { $(this).parents('p').removeClass('highlight'); }); // for validation $("form").validate(); }); EDIT: As I was getting downvotes for publishing follow-up problems and their solutions in answers, here is also the working validate method... function ajaxValidate() { return $('form').validate({ rules: { "Post.Header": { required: true }, "Post.Post": { required: true, minlength: 3 } }, messages: { "Post.Header": "Please enter a header", "Post.Post": { required: "Please enter a message", minlength: "Your message must be 3 characters long" } } }).form(); }

    Read the article

  • Django Include Aggregate Sums of Zero

    - by tomas
    I'm working on a Django timesheet application and am having trouble figuring out how to include aggregate sums that equal zero. If I do something like: entries = TimeEntry.objects.all().values("user__username").annotate(Sum("hours")) I get all users that have time entries and their sums. [{'username': u'bob' 'hours__sum':49}, {'username': u'jane' 'hours__sum':10}] When I filter that by a given day: filtered_entries = entries.filter(date="2010-05-17") Anyone who didn't enter time for that day is excluded. Is there a way to include those users who's sums are 0? Thanks

    Read the article

  • OpenGL Shader Compile Error

    - by Tomas Cokis
    I'm having a bit of a problem with my code for compiling shaders, namely they both register as failed compiles and no log is received. This is the shader compiling code: /* Make the shader */ Uint size; GLchar* file; loadFileRaw(filePath, file, &size); const char * pFile = file; const GLint pSize = size; newCashe.shader = glCreateShader(shaderType); glShaderSource(newCashe.shader, 1, &pFile, &pSize); glCompileShader(newCashe.shader); GLint shaderCompiled; glGetShaderiv(newCashe.shader, GL_COMPILE_STATUS, &shaderCompiled); if(shaderCompiled == GL_FALSE) { ReportFiler->makeReport("ShaderCasher.cpp", "loadShader()", "Shader did not compile", "The shader " + filePath + " failed to compile, reporting the error - " + OpenGLServices::getShaderLog(newCashe.shader)); } And these are the support functions: bool loadFileRaw(string fileName, char* data, Uint* size) { if (fileName != "") { FILE *file = fopen(fileName.c_str(), "rt"); if (file != NULL) { fseek(file, 0, SEEK_END); *size = ftell(file); rewind(file); if (*size > 0) { data = (char*)malloc(sizeof(char) * (*size + 1)); *size = fread(data, sizeof(char), *size, file); data[*size] = '\0'; } fclose(file); } } return data; } string OpenGLServices::getShaderLog(GLuint obj) { int infologLength = 0; int charsWritten = 0; char *infoLog; glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength); if (infologLength > 0) { infoLog = (char *)malloc(infologLength); glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog); string log = infoLog; free(infoLog); return log; } return "<Blank Log>"; } and the shaders I'm loading: void main(void) { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); } void main(void) { gl_Position = ftransform(); } In short I get From: ShaderCasher.cpp, In: loadShader(), Subject: Shader did not compile Message: The shader Data/Shaders/Standard/standard.vs failed to compile, reporting the error - <Blank Log> for every shader I compile I've tried replacing the file reading with just a hard coded string but I get the same error so there must be something wrong with how I'm compiling them. I have run and compiled example programs with shaders, so I doubt my drivers are the issue, but in any case I'm on a Nvidia 8600m GT. Can anyone help?

    Read the article

  • C++ vtable resolving with virtual inheritance

    - by Tomas Cokis
    I was curious about C++ and virtual inheritance - in particular, the way that vtable conflicts are resolved between bass and child classes. I won't pretend to understand the specifics on how they work, but what I've gleamed so far is that their is a small delay caused by using virtual functions due to that resolution. My question then is if the base class is blank - ie, its virtual functions are defined as: virtual void doStuff() = 0; Does this mean that the resolution is not necessary, because there's only one set of functions to pick from? Forgive me if this is an stupid question - as I said, I don't understand how vtables work so I don't really know any better.

    Read the article

  • jQuery MVC architecture

    - by Tomas Barbak
    Hi, what is the best way to create MVC architecture in jQuery? Should I use jQuery.extend()? jQuery.extend({ View: function(){} }); ...or jQuery Plugin? (function($) { $.fn.model = function() { return this; }; })(jQuery); ...or just objects in JavaScript? var model = {} var view = {} var controller = {} Thank you!

    Read the article

  • K-nearest neighbour with closed-loop dimensions

    - by Tomas
    Hi, I've got a K-nearest neighbour problem where some of the dimensions are closed loops. For example one is 'time of day' and I'm matching for similarity so 'very early morning' is close to 'late evening', you can't just make it a linear scale from 'very early morning' at one end to 'late evening' at the other. How can I represent this in the data model? Is there an established way to handle this or a way to work around it?

    Read the article

  • NSTableView don't display data

    - by Tomas Svoboda
    HI, I have data in NSMutableArray and I want to display it in NSTableView, but only the number of cols has changed. This use of NSTableView is based on tutorial: http://www.youtube.com/watch?v=5teN5pMf-rs FinalImageBrowser is IBOutlet to NSTableView @implementation AppController NSMutableArray *listData; - (void)awakeFromNib { [FinalImageBrowser setDataSource:self]; } - (IBAction)StartReconstruction:(id)sender { NSMutableArray *ArrayOfFinals = [[NSMutableArray alloc] init]; //Array of list with final images NSString *FinalPicture; NSString *PicNum; int FromLine = [TextFieldFrom intValue]; //read number of start line int ToLine = [TextFieldTo intValue]; //read number of finish line int RecLine; for (RecLine = FromLine; RecLine < ToLine; RecLine++) //reconstruct from line to line { Start(RecLine); //start reconstruction //Create path of final image FinalPicture = @"FIN/final"; PicNum = [NSString stringWithFormat: @"%d", RecLine]; FinalPicture = [FinalPicture stringByAppendingString:PicNum]; FinalPicture = [FinalPicture stringByAppendingString:@".bmp"]; [ArrayOfFinals addObject:FinalPicture]; // add path to array } listData = [[NSMutableArray alloc] init]; [listData autorelease]; [listData addObjectsFromArray:ArrayOfFinals]; [FinalImageBrowser reloadData]; NSBeep(); //make some noise NSImage *fin = [[NSImage alloc] initWithContentsOfFile:FinalPicture]; [FinalImage setImage:fin]; } - (int)numberOfRowsInTableView:(NSTableView *)tv { return [listData count]; } - (id)tableView:(NSTableView *)tv objectValueFromTableColumn:(NSTableColumn *)tableColumn row:(int)row { return (NSString *)[listData objectAtIndex:row]; } @end when the StartReconstruction end the number of cols have changed right, but they're empty. When I debug app, items in listData is rigth. Thanks

    Read the article

  • Should HTTP POST be discouraged?

    - by Tomas Sedovic
    Quoting from the CouchDB documentation: It is recommended that you avoid POST when possible, because proxies and other network intermediaries will occasionally resend POST requests, which can result in duplicate document creation. To my understanding, this should not be happening on the protocol level (a confused user armed with a doubleclick is a completely different story). What is the best course of action, then? Should we really try to avoid POST requests and replace them by PUT? I don't like that as they convey a different meaning. Should we anticipate this and protect the requests by unique IDs where we want to avoid accidental duplication? I don't like that either: it complicates the code and prevents situations where multiple identical posts may be desired.

    Read the article

  • Specifying the range of supported Rails versions in a project

    - by Tomas Sedovic
    The config/environment.rb of my rails project contains this line: RAILS_GEM_VERSION = '>= 2.3.2' unless defined? RAILS_GEM_VERSION Which makes sure that only Rails of version 2.3.2 or greater will be used to run this app. Is there a way of specifying both the lower and the upper boundary at the same time? So that it would run, say, only on versions higher than 2.3.1 and lower than 2.3.6?

    Read the article

  • C++ IO with Hard Drive

    - by Tomas Cokis
    I was wondering if there was any kind of portable (Mac&Windows) method of reading and writing to the hard drive which goes beyond iostream.h, in particular features like getting a list of all the files in a folder, moving files around, ect. I was hoping that there would be something like SDL around, but so far I havn't been able to find much. Any ideas??

    Read the article

  • Is it really wrong to version documents using CouchDB's behaviour?

    - by Tomas Sedovic
    This is one of those "I know I shouldn't do this but it's oh so convenient." questions. Sorry about that. I plan to use CouchDB for storing a bunch of documents and keeping their entire revision history. CouchDB does the versioning automatically, but it is strongly discouraged for programmer's use: "You cannot rely on document revisions for any other purpose than concurrency control." From what I've found on the CouchDB wiki, the versions can get deleted either during compaction or during replication. As far as I can tell, Compaction must always be triggered manually and Replication occurs only when there's more than one database server. The question is: if I won't run compaction and will use only single database instance for my documents, can I just use CouchDB's document versioning and expect it to work? What other problems I might run into? E.g. does not running compaction hurt the performance or consume significantly more disk space (than if I did handle the versioning manually)?

    Read the article

  • Which option controls the color of this text?

    - by Tomas Lycken
    I have applied a color theme called Vibrant Ink (or some modification of it), and since I installed Visual Studio 2010 Pro Power Tools all my statement completion boxes are undreadable. What setting changes the colors of these boxes? Preferrably, I'd like to change the background color to something darker, but if that's not possible at least I want to change the text color.

    Read the article

  • Why does this threading approach not work?

    - by Tomas Lycken
    I have a wierd problem with threading in an ASP.NET application. For some reason, when I run the code in the request thread, everything works as expected. But when I run it in a separate thread, nothing happens. This is verified by calling the below handler with the three flags "on", "off" and "larma" respectively - in the two first cases everything works, but in the latter nothing happens. What am I doing wrong here? In the web project I have a generic handler with the following code: If task = "on" Then Alarm.StartaLarm(personId) context.Response.Write("Larmet är PÅ") ElseIf task = "off" Then Alarm.StoppaLarm(personId) context.Response.Write("Larmet är AV") ElseIf task = "larma" Then Alarm.Larma(personId) context.Response.Write("Larmar... (stängs av automagiskt)") Else context.Response.Write("inget hände - task: " & task) End If The Alarm class has the following methods: Private Shared Sub Larma_Thread(ByVal personId As Integer) StartaLarm(personId) Thread.Sleep(1000 * 30) StoppaLarm(personId) End Sub Public Shared Sub StartaLarm(ByVal personId As Integer) SandSMS(True, personId) End Sub Public Shared Sub StoppaLarm(ByVal personId As Integer) SandSMS(False, personId) End Sub Public Shared Sub SandSMS(ByVal setOn As Boolean, ByVal personId As Integer) ... End Sub

    Read the article

  • Why does this ActionFilterAttribute not import data to the ViewModel?

    - by Tomas Lycken
    I have the following attribute public class ImportStatusAttribute : ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { var model = (IHasStatus)filterContext.Controller.ViewData.Model; model.Status = (StatusMessageViewModel)filterContext.Controller.TempData["status"]; filterContext.Controller.ViewData.Model = model; } } which I test with the following test method (the first of several I'll write when this one passes...) [TestMethod] public void OnActionExecuted_ImportsStatusFromTempDataToModel() { // Arrange Expect(new { Status = new StatusMessageViewModel() { Subject = "The test", Predicate = "has been tested" }, Key = "status" }); var filterContext = new Mock<ActionExecutedContext>(); var model = new Mock<IHasStatus>(); var tempData = new TempDataDictionary(); var viewData = new ViewDataDictionary(model.Object); var controller = new FakeController() { ViewData = viewData, TempData = tempData }; tempData.Add(expected.Key, expected.Status); filterContext.Setup(c => c.Controller).Returns(controller); var attribute = new ImportStatusAttribute(); // Act attribute.OnActionExecuted(filterContext.Object); // Assert Assert.IsNotNull(model.Object.Status, "The status was not exported"); Assert.AreEqual(model.Object.Status.ToString(), ((StatusMessageViewModel)expected.Status).ToString(), "The status was not the expected"); } (Expect() is a method that saves some expectations in the expected object...) When I run the test, it fails on the first assertion, and I can't get my head around why. Debugging, I can see that model is populated correctly, and that (StatusMessageViewModel)filterContext.Controller.TempData["status"] has the correct data. But after model.Status = (StatusMessageViewModel)filterContext.Controller.TempData["status"]; model.Status is still null in my watch window. Why can't I do this?

    Read the article

  • Grails UnitTest

    - by Tomáš
    Hi (it is propably stupid question) how can acquire Domain class from database in test? class PollServiceTests extends GrailsUnitTestCase { Integer id = 1 void testSomething() { Teacher teacher1 = Teacher.get(id) assert teacher1 != null } } I always get null or No signature of method: cz.jak.Teacher.get() is applicable for argument types: (java.lang.Integer) values: [1] thanks a lot Tom

    Read the article

  • How can you databind a single object in .NET ?

    - by Tomas Pajonk
    I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ? The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the question though.

    Read the article

< Previous Page | 2 3 4 5 6 7 8  | Next Page >