Search Results

Search found 663 results on 27 pages for 'graham lee'.

Page 12/27 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How to get the output of an XslCompiledTransform into an XmlReader?

    - by Graham Clark
    I have an XslCompiledTransform object, and I want the output in an XmlReader object, as I need to pass it through a second stylesheet. I'm getting a bit confused - I can successfully transform some XML and read it using either a StreamReader or an XmlDocument, but when I try an XmlReader, I get nothing. In the example below, stylesheet is my XslCompiledTransform object. The first two Console.WriteLine calls output the correct transformed XML, but the third call gives no XML. I'm guessing it might be that the XmlTextReader is expecting text, so maybe I need to wrap this in a StreamReader..? What am I doing wrong? MemoryStream transformed = new MemoryStream(); stylesheet.Transform(input, args, transformed); transformed.Position = 0; StreamReader s = new StreamReader(transformed); Console.WriteLine("s = " + s.ReadToEnd()); // writes XML transformed.Position = 0; XmlDocument doc = new XmlDocument(); doc.Load(transformed); Console.WriteLine("doc = " + doc.OuterXml); // writes XML transformed.Position = 0; XmlReader reader = new XmlTextReader(transformed); Console.WriteLine("reader = " + reader.ReadOuterXml()); // no XML written

    Read the article

  • DataReader Behaviour With SQL Server Locking

    - by Graham
    We are having some issues with our data layer when large datasets are returned from a SQL server query via a DataReader. As we use the DataReader to populate business objects and serialize them back to the client, the fetch can take several minutes (we are showing progress to the user :-)), but we've found that there's some pretty hard-core locking going on on the affected tables which is causing other updates to be blocked. So I guess my slightly naive question is, at what point are the locks which are taken out as a result of executing the query actually relinquished? We seem to be finding that the locks are remaining until the last row of the DataReader has been processed and the DataReader is actually closed - does that seem correct? A quick 101 on how the DataReader works behind the scenes would be great as I've struggled to find any decent information on it. I should say that I realise the locking issues are the main concern but I'm just concerned with the behaviour of the DataReader here.

    Read the article

  • Convert void* representation of a dword to wstring

    - by graham.reeds
    I am having dumb monday so my apologies for posting such a newbie-like question. I am using CRegKey.QueryValue to return a dword value from the registry. QueryValue writes the value into void* pData and the length into ULONG* pnBytes. Now there is a way of getting it from pData into a wstring probably via stringstream. The closest I came was getting the result as a hex string. I was about to work on converting the hex representation to a dword and then from there to a wstring when I decided that was just dumb and ask on here instead of wasting another hour of my life on the problem.

    Read the article

  • Different execution plan for similar queries

    - by Graham Clements
    I am running two very similar update queries but for a reason unknown to me they are using completely different execution plans. Normally this wouldn't be a problem but they are both updating exactly the same amount of rows but one is using an execution plan that is far inferior to the other, 4 secs vs 2 mins, when scaled up this is causing me a massive problem. The only difference between the two queries is one is using the column CLI and the other DLI. These columns are exactly the same datatype, and are both indexed exactly the same, but for the DLI query execution plan, the index is not used. Any help as to why this is happening is much appreciated. -- Query 1 UPDATE a SET DestKey = ( SELECT TOP 1 b.PrefixKey FROM refPrefixDetail AS b WHERE a.DLI LIKE b.Prefix + '%' ORDER BY len(b.Prefix) DESC ) FROM CallData AS a -- Query 2 UPDATE a SET DestKey = ( SELECT TOP 1 b.PrefixKey FROM refPrefixDetail b WHERE a.CLI LIKE b.Prefix + '%' ORDER BY len(b.Prefix) DESC ) FROM CallData AS a

    Read the article

  • HTML Submit button vs AJAX based Post (ASP.NET MVC)

    - by Graham
    I'm after some design advice. I'm working on an application with a fellow developer. I'm from the Webforms world and he's done a lot with jQuery and AJAX stuff. We're collaborating on a new ASP.MVC 1.0 app. He's done some pretty amazing stuff that I'm just getting my head around, and used some 3rd party tools etc. for datagrids etc. but... He rarely uses Submit buttons whereas I use them most of the time. He uses a button but then attaches Javascript to it that calls an MVC action which returns a JSON object. He then parses the object to update the datagrid. I'm not sure how he deals with server-side validation - I think he adds a message property to the JSON object. A sample scenario would be to "Save" a new record that then gets added to the gridview. The user doesn't see a postback as such, so he uses jQuery to disable the UI whilst the controller action is running. TBH, it looks pretty cool. However, the way I'd do it would be to use a Submit button to postback, let the ModelBinder populate a typed model class, parse that in my controller Action method, update the model (and apply any validation against the model), update it with the new record, then send it back to be rendered by the View. Unlike him, I don't return a JSON object, I let the View (and datagrid) bind to the new model data. Both solutions "work" but we're obviously taking the application down different paths so one of us has to re-work our code... and we don't mind whose has to be done. What I'd prefer though is that we adopt the "industry-standard" way of doing this. I'm unsure as to whether my WebForms background is influencing the fact that his way just "doesn't feel right", in that a "submit" is meant to submit data to the server. Any advice at all please - many thanks.

    Read the article

  • How to save bytes to an image and access it from Bottle

    - by Graham Smith
    I'm working on an API wrapper for Snapchat using Python and Bottle, but in order to return the file (retrieved by the Python script) I have to save the bytes (returned by Snapchat) to a .jpg file. I'm not quite sure how I will do this and still be able to access the file so that it can be returned. Here's what I have so far, but it returns a 404. @route('/image') def image(): username = request.query.username token = request.query.auth_token img_id = request.query.id return get_blob(username, token, img_id) def get_blob(usr, token, img_id): # Form URL and download encrypted "blob" blob_url = "https://feelinsonice.appspot.com/ph/blob?id={}".format(img_id) blob_url += "&username=" + usr + "&timestamp=" + str(timestamp()) + "&req_token=" + req_token(token) enc_blob = requests.get(blob_url).content # Save decrypted image FileUpload.save('/images/' + img_id + '.jpg') img = open('images/' + img_id + '.jpg', 'wb') img.write(decrypt(enc_blob)) img.close() return static_file(img_id + '.jpg', root='/images/')

    Read the article

  • DataColumn.Expression Power

    - by Graham
    the following code Dim dc = New DataColumn(name, GetType(Double), "[col1] ^ [col2]") produces the following error: The expression contains unsupported operator '^'. Is this right, is the power operand not support in datacolumn expressions??? Anyone have an idea how i'd write this?

    Read the article

  • How to display a PostScript file in a Python GUI application.

    - by Mike Graham
    I would like to build a cross-platform GUI application in Python that displays PostScript files I generate, among some other stuff. What is the best way to accomplish this? Ideally I would be able to do things like zoom and pan the displayed graphic. Do any/some/all of the GUI toolkits have something I can drop in to do this, and if so what are they called and how do they work? If necessary, I can convert the postscript file to PDF or a raster format behind the scenes, but I'd rather not do the latter.

    Read the article

  • Javscript filter vs map problem

    - by graham.reeds
    As a continuation of my min/max across an array of objects I was wondering about the performance comparisons of filter vs map. So I put together a test on the values in my code as was going to look at the results in FireBug. This is the code: var _vec = this.vec; min_x = Math.min.apply(Math, _vec.filter(function(el){ return el["x"]; })); min_y = Math.min.apply(Math, _vec.map(function(el){ return el["x"]; })); The mapped version returns the correct result. However the filtered version returns NaN. Breaking it out, stepping through and finally inspecting the results, it would appear that the inner function returns the x property of _vec but the actual array returned from filter is the unfiltered _vec. I believe my usage of filter is correct - can anyone else see my problem?

    Read the article

  • Any way to access the type of a Scala Option declaration at runtime using reflection?

    - by Graham Lea
    So, I have a Scala class that looks like this: class TestClass { var value: Option[Int] = None } and I'm tackling a problem where I have a String value and I want to coerce it into that Option[Int] at runtime using reflection. To do so, I need to know that the field is an Option and that the type parameter of the Option is Int. What are my options for figuring out that the type of 'value' is Option[Int] at runtime (i.e. using reflection)? I have seen similar problems solved by annotating the field, e.g. @OptionType(Int.class). I'd prefer a solution that didn't require annotations on the reflection target if possible.

    Read the article

  • Matab - Trace contour line between two different points

    - by Graham
    Hi, I have a set of points represented as a 2 row by n column matrix. These points make up a connected boundary or edge. I require a function that traces this contour from a start point P1 and stop at an end point P2. It also needs to be able trace the contour in a clockwise or anti-clockwise direction. I was wondering if this can be achieved by using some of matlabs functions. I have tried to write my own function but this was riddled with bugs and I have also tried using bwtraceboundary and indexing however this has problematic results as the points within the matrix are not in the order that create the contour. Thank you in advance for any help. Btw, I have included a link to a plot of the set of points. It is half the outline of a hand. The function would ideally trace the contour from ether the red star to the green triangle. Returning the points in order of traversal.

    Read the article

  • Parsing a simple file

    - by Mike Graham
    I have a file consisting of lines of the form Foo="Some information" Bar="More" Starting with such a string, what is the best way to extract "Some information" and "More" as strings? Foo and Bar are always exactly those names.

    Read the article

  • Drag Drop copy file

    - by Graham Warrender
    I've perhaps done something marginally stupid, but can't see what it is!! string pegasusKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Pegasus\"; string opera2ServerPath = @"Server VFP\"; string opera3ServerPath = @"O3 Client VFP\"; string opera2InstallationPath = null; string opera3InstallationPath = null; //Gets the opera Installtion paths and reads to the string opera*InstallationPath opera2InstallationPath = (string)Registry.GetValue(pegasusKey + opera2ServerPath + "System", "PathToServerDynamic", null); opera3InstallationPath = (string)Registry.GetValue(pegasusKey + opera3ServerPath + "System", "PathToServerDynamic", null); string Filesource = null; string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string File in FileList) Filesource = File; label.Text = Filesource; if (System.IO.Directory.Exists(opera3InstallationPath)) { System.IO.File.Copy(Filesource, opera3InstallationPath); MessageBox.Show("File Copied from" + Filesource + "\n to" + opera3InstallationPath); } else { MessageBox.Show("Directory Doesn't Exist"); } The user drags the file onto the window, I then get the installation path of an application which is then used as the destination for the source file.. When the application is runs, it throws the error directory not found. But surely if the directory doesn't exists is should step into the else statement? a simple application that is becoming a headache!!

    Read the article

  • Entity Framework insert error ("The Version field is required.")

    - by Graham
    I am using Silverlight 4 and RIA services. When I try to insert into my database, I get the following error: "Submit operation failed validation. Please inspect Entity.ValidationErrors for each entity in EntitiesInError for more information." Upon inspecting the ValidationErrors, I see: "The Version field is required." Isn't the Version field updated and maintained by the framework? If so, why is it null? If not, how am I supposed to set it?

    Read the article

  • Define the base class or base functionality of a dynamic proxy (e.g. Castle, LinFu)

    - by Graham
    Hi, I've asked this in the NHibernate forumns but I think this is more of a general question. NHibernate uses proxy generators (e.g. Castle) to create its proxy. What I'd like to do is to extend the proxy generated so that it implements some of my own custom behaviour (i.e. a comparer). I need this because the following standard .NET behaviour fails to produce the correct results: //object AC is a concrete class collection.Contains(AC) = true //object AP is a proxy with the SAME id and therefore represents the same instance as concrete AC collection.Contains(AP) = false If my comparer was implemented by AP (i.e. do id's match) then collection.Contains(AP) would return true, as I'd expect if proxies were implicit. (NB: For those who say NH inherits from your base class, then yes it does, but NH can also inherit from an interface - which is what we're doing) I'm not at all sure this is possible or where to start. Is this something that can be done in any of the common proxy generators that NH uses?

    Read the article

  • Matlab GUI - How to get the previous value entered from a callback function?

    - by Graham
    Hi, I know that this is probably a simple problem but I am new to Matlab GUI's and basically want to get the old value which used to be stored in the text box to replace the value which has just been entered. E.g. Text box contains a valid string, User enters invalid string, Callback func, validates input and realises new input is an error and reverts to the old previous value. How should this be implemented or done? Atm I am just using the get and set property values. Below is some sample code: function sampledist_Callback(hObject, eventdata, handles) % hObject handle to sampledist (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of sampledist as text % str2double(get(hObject,'String')) returns contents of sampledist as a double input = str2double(get(hObject,'String')); if(input < 0 || input > 500) errordlg('Sampled Dist. must be > 0 and < 500','Sample Dist - Input Error'); set(handles.sampledist,'String',['10']); %<--- I would like this value 10 to be the previous entry! guidata(hObject,handles); else set(handles.sampledist,'String',['',input]); guidata(hObject,handles); end

    Read the article

  • Visual Studio C++ Solution in Maven2

    - by graham.reeds
    A new project is coming up that will require interaction between Java and C++. It's been decided that the project will be built via Maven2. Unfortunately I don't know anything about Maven and the Java guys don't know anything about C++. They have their build chain all set up with various reports being emitted for each part related to CheckStyle, Findbugs, Corbortura(?) etc. and they want the same to be done with the C++ side. Currently we have 4 apps that need building: 2 services, a tray app and a simple dialog based application. I've been told I need to have a pom for each and configure each to output to a target directory, have the tool chain produce the reports - the most particular being the code coverage which the client wants 100%. I have sourced the tools - Bullseye and QA-C++ and requested eval copies - but I am dismayed to find there is very little information on C++ & Maven, and what little there is seems to be horror stories. Does anyone on SO have a good story about it (or have link to blog post)? Is there a simple explanation anywhere for configuring a Visual Studio solution (preferably C++) to be Mavenized? I am expecting pain but I am getting increasingly wary of this venture - but unfortunately the project manager is Java side and seems hell-bent on Mavenizing it.

    Read the article

  • Dangers when deploying Flash/Flex UI test automation hooks to production?

    - by Merlyn Morgan-Graham
    I am interested in doing automated testing against a Flex based UI. I have found out that my best options for UI automation (due to being C# controllable, good licensing conditions, etc) all seem to require that I compile test hooks into my application. Because of this, I am thinking of recommending that these hooks be compiled into our build. I have found a few places on the net that recommend not deploying bits with this instrumentation enabled, and I'd like to know why. Is it a performance drain, or a security risk? If it is a security risk, can you explain how the attack surface is increased? I am not a Flash or Flex developer, though I have some experience with threat modeling. For reference, here's the tools I'm specifically considering: QTP Selenium-Flex API I am having problems finding all the warnings/suggestions I found last night, but here's an example that I can find: http://www.riatest.com/products/getting-started.html Warning! Automation enabled applications expose all properties of all GUI components. This makes them vulnerable to malicious use. Never make automation enabled application publicly available. Always restrict access to such applications and to RIATest Loader to trusted users only. Related question (how to do conditional compilation to insert/remove those hooks): Conditionally including Flex libraries (SWCs) in mxmlc/compc ant tasks

    Read the article

  • OOP design issue: Polymorphism

    - by Graham Phillips
    I'm trying to solve a design issue using inheritance based polymorphism and dynamic binding. I have an abstract superclass and two subclasses. The superclass contains common behaviour. SubClassA and SubClassB define some different methods: SubClassA defines a method performTransform(), but SubClassB does not. So the following example 1 var v:SuperClass; 2 var b:SubClassB = new SubClassB(); 3 v = b; 4 v.performTransform(); would cause a compile error on line 4 as performTransform() is not defined in the superclass. We can get it to compile by casting... (v as SubClassA).performTransform(); however, this will cause a runtime exception to be thrown as v is actually an instance of SubClassB, which also does not define performTransform() So we can get around that by testing the type of an object before casting it: if( typeof v == SubClassA) { (cast v to SubClassA).performTransform(); } That will ensure that we only call performTransform() on v's that are instances of SubClassA. That's a pretty inelegant solution to my eyes, but at least its safe. I have used interface based polymorphism (interface meaning a type that can't be instantiated and defines the API of classes that implement it) in the past, but that also feels clunky. For the above case, if SubClassA and SubClassB implemented ISuperClass that defined performTransform, then they would both have to implement performTransform(). If SubClassB had no real need for a performTransform() you would have to implement an empty function. There must be a design pattern out there that addresses the issue.

    Read the article

  • Jquery code breaks page Javascript

    - by Graham
    I required a function to remove URLs from <a> divs found within <div class="rj_insertcode">. Not being familiar with with direction to tackle this, I eventually mustered up the following Jquery code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('div.rj_insertcode a').each(function() { $(this).replaceWith($(this).html()); }); }); </script> </head> My site uses Joomla CMS and I was able to add the above script to the bottom of the template index.php. It works quite well and removes the links generated between the defined tags. My problem: Pages that also include JavaScript do not operate correctly. JavaScript appears to be disabled or not functioning. What can I change to ensure JavaScript still operates correctly, or is there another method I could adopt?

    Read the article

  • mod_rewrite with anchor link

    - by Graham
    Hi, thanks for looking. I know you can't redirect anchor URLs to another page, but is it possible to redirect a URL to only a single anchor? So http://www.example.com/video/{title} always gets sent to http://www.example.com/video.php?title={title}#player The only thing that changes is the title, anchor is always the same... I need to redirect to a certain slide on a coda slider

    Read the article

  • Calling a Add-in function from Excel's VBA

    - by graham
    I am using an Excel Add-in for an Erlangs: http://abstractmicro.com/erlang/helppages/ref-erlbblockage.htm I try to call the Erlang-B function within the Add-in from within VBA thus: Function Erl(Erlangs As Double, Capacity As Double) Erl = Application.WorksheetFunction.ErlbBlockage(Capacity, Erlangs) End Function ...but it doesn't work. I get #VALUE! returned in the Excel cell. I think it is because the function is not part of standard Excel (it is in the Add-in). So how do I call it?

    Read the article

  • Locked visible cells Excel problem

    - by graham.reeds
    I have a problem with an Excel Template in Excel 2007. I need to remove a row from a summary report but the developer who created this report has somehow managed to set it so that only certain number of rows & columns are visible (in case you are interested it is A1:G30) - no headers, no grid, just blue nothingness. Deleting the offending line just peels back the white-ness. I want to change the resolution of the visible grid to A1:G29. I would ask on google but I haven't the foggiest what the tool would be called to do this (if I did I probably wouldn't be asking). Giving generic terms gives very generic results. I've been through every ribbon and came up blank. Help me out my misery - please!

    Read the article

  • jQuery UI Draggable 'stop' event called too many times?

    - by Graham
    I have a feeling I'm either misunderstanding the 'stop' event or not doing it right, but it seems to be called several times while the element is bound to is being dragged. makeAllDragable = function () { $(".test-table").draggable({ start: function (event, ui) { $(this).click(); }, stop: function (event, ui) { foo() } }).click(function () { selectTable($(this)); }); } foo = function () { alert("test"); } In this example foo is called about 30 times, shouldn't is just be when I release the draggable? The jQuery docs don't actually say one where or another though.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >