Search Results

Search found 661 results on 27 pages for 'steven smethurst'.

Page 19/27 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Me As Child Type In General Function

    - by Steven
    I have a MustInherit Parent class with two Child classes which Inherit from the Parent. How can I use (or Cast) Me in a Parent function as the the child type of that instance? EDIT: My actual goal is to be able to serialize (BinaryFormatter.Serialize(Stream, Object)) either of my child classes. However, "repeating the code" in each child "seems" wrong. EDIT2: This is my Serialize function. Where should I implement this function? Copying and pasting to each child doesn't seem right, but casting the parent to a child doesn't seem right either. Public Function Serialize() As Byte() Dim bFmt As New BinaryFormatter() Dim mStr As New MemoryStream() bFmt.Serialize(mStr, Me) Return mStr.ToArray() End Function

    Read the article

  • How to handle Win+Shift+LEft/Right on Win7 with custom WM_GETMINMAXINFO logic?

    - by Steven Robbins
    I have a custom windows implementation in a WPF app that hooks WM_GETMINMAXINFO as follows: private void MaximiseWithTaskbar(System.IntPtr hwnd, System.IntPtr lParam) { MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO)); System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); if (monitor != System.IntPtr.Zero) { MONITORINFO monitorInfo = new MONITORINFO(); GetMonitorInfo(monitor, monitorInfo); RECT rcWorkArea = monitorInfo.rcWork; RECT rcMonitorArea = monitorInfo.rcMonitor; mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left); mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top); mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left); mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top); mmi.ptMinTrackSize.x = Convert.ToInt16(this.MinWidth * (desktopDpiX / 96)); mmi.ptMinTrackSize.y = Convert.ToInt16(this.MinHeight * (desktopDpiY / 96)); } Marshal.StructureToPtr(mmi, lParam, true); } It all works a treat and it allows me to have a borderless window maximized without having it sit on to of the task bar, which is great, but it really doesn't like being moved between monitors with the new Win7 keyboard shortcuts. Whenever the app is moved with Win+Shift+Left/Right the WM_GETMINMAXINFO message is received, as I'd expect, but MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST) returns the monitor the application has just been moved FROM, rather than the monitor it is moving TO, so if the monitors are of differing resolutions the window end up the wrong size. I'm not sure if there's something else I can call, other then MonitorFromWindow, or whether there's a "moving monitors" message I can hook prior to WM_GETMINMAXINFO. I'm assuming there is a way to do it because "normal" windows work just fine.

    Read the article

  • What's a good way to parameterize "static" content (e.g. CSS) in a Tomcat webapp?

    - by Steven Huwig
    Some of our CSS files contain parameters that can vary based on the deployment location (dev, QA, prod). For example: background: url(#DOJO_PATH#/dijit/themes...) to avoid hardcoding a path to a particular CDN or locally-hosted Dojo installation. These values are textually substituted with the real values by a deployment script, when it copies the contents of the webapp into the Tomcat webapps directory. That way the same deployment archive file (WAR + TAR file containing other configuration) can be deployed to dev, QA, and prod, with the varying parameters provided by environment-specific configuration files. However, I'd like to make the contents of the WAR (including the templatized CSS files) independent of this in-house deployment script. Since we don't really have control over the deployment script, all I can think to do is configure Tomcat with #DOJO_PATH# etc. as environment variables in the application's context.xml, and use Tomcat to insert those parameters into the CSS at runtime. I could make the CSS files into generated JSPs, but it seems a little ugly to me. Moreover, the substitution only needs to be done once per application deployment, so repeatedly dynamically generating the stylesheets using JSP will be rather wasteful. Does anyone have any alternative ideas or tools to use for this? We're committed to Tomcat and to substituting these parameters at deployment or at runtime (that is, not at build time).

    Read the article

  • Are their any good way to genrate XML file through C# in .net

    - by steven spielberg
    i wanto make a xml file like <?xml version="1.0" encoding="Windows-1252" ?> <settings> <typeofsetting> <wordname="add" /> </typeofsettings> </settings> the wordname can be depend on what user need. how i can make a application that user can generate the XML file of thing they want. are their any good way to do this. the wordname not user defined it's come from database the application have inbuilt. are their any good practice to do this in c# win-forms.

    Read the article

  • Is there a "fancy" Ruby way to check whether a local variable is both defined and evaluates to true without using ands and ors?

    - by Steven Xu
    This is quite a quick question. I currently use do_this if (testvar ||= false) Which works just fine. But this approach unnerves me because while fast, it does not short-circuit like defined?(testvar) && testvar does, and it instantiates and assigns a value to a local variable that is subsequently never used, which seems inefficient. I enjoy the very reasonable fact that instance variables are nil before assignment, but I'd like for the situation to be just as easy for local variables.

    Read the article

  • What is the meaning of method class in the class definition in Ruby?

    - by Steven Xu
    I'm familiar with function definitions and variable declarations being in class definitions: public class MyClass { public int myvar; public void doSomething() { } } But what does it "mean" in Ruby when a method is actually called in the class definition? This happens amply in Rails, for instance: class User < ActiveRecord::Base has_many :posts end What exactly does this do (at a lower level than "it adds some methods to the class")? How would I implement such a function (e.g., one that mixes in some additional methods)?

    Read the article

  • Ms Access DB used by website

    - by Steven
    Hi Guys, I have been asked to update a legacy website. I was originally build in asp using a MS Access DB to store some user details. However I am aware that the DB can be downloaded if you use the correct url. What is the best way to stop this without stopping the website having access to the DB? Thanks Sp

    Read the article

  • How to create a level with curved lines with cocos2d + Box2d on the iphone?

    - by Steven
    I'd like to create a game that has levels such as this: http://img169.imageshack.us/img169/7294/picdq.png The Player moves "flies" through the level and mustn't collide with the walls. How can I create such levels? I found that piece of software: http://www.sapusmedia.com/levelsvg/ It's not that cheap, so I wonder whether there is another way to create such a level as shown in the picture above...?

    Read the article

  • drupal display submenu when parent has been selected

    - by Steven Cheng
    I've have a menu structure that has a depth of 3 levels on a drupal 6 CMS. When I click on a level 1 that has children, the level 2 menu items display fine. If the level 2 has children, it is not showing the level 3. If I check the expanded box the level 3 is displayed however, it displays all the time irrespective of the level 2 that has been selected. It seems to display whenever it's parent level 1 is selected. For further information, the menu items are a mixture of custom links & content links. i.e. Links I've enetered manually when creating the menu and others generated by when creating a node or view display. All I want is to show the children if there are any for the selected parent. Am I missing something fundamental here? Thanks Steve

    Read the article

  • Using WCF to expose underlying process

    - by Steven
    I have a server application that spins up and monitors about 8 separate processes that gather data from different systems. The server app then runs some calculations over the aggregated data and stores it in a db. Simple stuff. I now have a requirement to modify the process so that it no longer saves data to the db but rather exposes it directly to clients via WCF. That's cool, I've used WCF a fair bit but I'm struggling a little with it for some reason. Basically my plan is to HOST the WCF service in my application and have calls redirect into the internals of my existing application but I can figure out how to do that without getting the WCF class to encapsulate the existing app. I want the service to inside my current app, not become it. Any suggestions?

    Read the article

  • HttpWebRequest possibly slowing website

    - by Steven Smith
    Using Visual studio 2012, C#.net 4.5 , SQL Server 2008, Feefo, Nopcommerce Hey guys I have Recently implemented a new review service into a current site we have. When the change went live the first day all worked fine. Since then though the sending of sales to Feefo hasnt been working, There are no logs either of anything going wrong. In the OrderProcessingService.cs in Nop Commerce's Service, i call a HttpWebrequest when an order has been confirmed as completed. Here is the code. var email = HttpUtility.UrlEncode(order.Customer.Email.ToString()); var name = HttpUtility.UrlEncode(order.Customer.GetFullName().ToString()); var description = HttpUtility.UrlEncode(productVariant.ProductVariant.Product.MetaDescription != null ? productVariant.ProductVariant.Product.MetaDescription.ToString() : "product"); var orderRef = HttpUtility.UrlEncode(order.Id.ToString()); var productLink = HttpUtility.UrlEncode(string.Format("myurl/p/{0}/{1}", productVariant.ProductVariant.ProductId, productVariant.ProductVariant.Name.Replace(" ", "-"))); string itemRef = ""; try { itemRef = HttpUtility.UrlEncode(productVariant.ProductVariant.ProductId.ToString()); } catch { itemRef = "0"; } var url = string.Format("feefo Url", login, password,email,name,description,orderRef,productLink,itemRef); var request = (HttpWebRequest)WebRequest.Create(url); request.KeepAlive = false; request.Timeout = 5000; request.Proxy = null; using (var response = (HttpWebResponse)request.GetResponse()) { if (response.StatusDescription == "OK") { var stream = response.GetResponseStream(); if(stream != null) { using (var reader = new StreamReader(stream)) { var content = reader.ReadToEnd(); } } } } So as you can see its a simple webrequest that is processed on an order, and all product variants are sent to feefo. Now: this hasnt been happening all week since the 15th (day of the implementation) the site has been grinding to a halt recently. The stream and reader in the the var content is there for debugging. Im wondering does the code redflag anything to you that could relate to the process of website? Also note i have run some SQL statements to see if there is any deadlocks or large escalations, so far seems fine, Logs have also been fine just the usual logging of Bots. Any help would be much appreciated! EDIT: also note that this code is in a method that is called and wrapped in A try catch UPDATE: well forget about the "not sending", thats because i was just told my code was rolled back last week

    Read the article

  • Cannot Generate ParameterSetMetadata While Programmatically Creating A Parameter Block

    - by Steven Murawski
    I'm trying to programmatically create a parameter block for a function ( along the lines of this blog post ). I'm starting with a CommandMetadata object (from an existing function). I can create the ParameterMetadata object and set things like the ParameterType, the name, as well as some attributes. The problem I'm running into is that when I use the GetParamBlock method of the ProxyCommand class, none of my attributes that I set in the Attributes collection of the ParameterMetadata are generated. The problem this causes is that when the GetParamBlock is called, the new parameter is not annotated with the appropriate Parameter attribute. Example: function test { [CmdletBinding()] param ( [Parameter()] $InitialParameter) Write-Host "I don't matter." } $MetaData = New-Object System.Management.Automation.CommandMetaData (get-command test) $NewParameter = New-Object System.Management.Automation.ParameterMetadata 'NewParameter' $NewParameter.ParameterType = [string[]] $Attribute = New-Object System.Management.Automation.ParameterAttribute $Attribute.Position = 1 $Attribute.Mandatory = $true $Attribute.ValueFromPipeline = $true $NewParameter.Attributes.Add($Attribute) $MetaData.Parameters.Add('NewParameter', $NewParameter) [System.Management.Automation.ProxyCommand]::GetParamBlock($MetaData)

    Read the article

  • Inconsistent Behavior From Declared DLL Function

    - by Steven
    Why might my GetRawData declared function return a correct value when called from my VB.NET application, but return zero when called from my ASP.NET page? The code is exactly the same except for class type difference (Form / Page) and calling event handler (Form1_Load, Page_Load). Note: In the actual code, #DLL# and #RAWDATAFILE# are both absolute filenames to my DLL and raw data file respectively. Note: The DLL file was not created by Visual Studio. Form1.vb Public Class Form1 Declare Auto Function GetRawData Lib "#DLL#" (ByVal filename() As Byte, _ ByVal byteArray() As Byte, _ ByVal length As Int32) As Int32 Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim buffer(10485760) As Byte Dim msg As String, length As Integer = 10485760 Dim filename As String = "#RAWDATAFILE#" length = GetRawData(Encoding.Default.GetBytes(filename), buffer, length) Default.aspx.vb Partial Public Class _Default Inherits System.Web.UI.Page Declare Auto Function GetRawData Lib "#DLL#" (ByVal filename() As Byte, _ ByVal byteArray() As Byte, _ ByVal length As Int32) As Int32 Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load Dim buffer(10485760) As Byte Dim msg As String, length As Integer = 10485760 Dim filename As String = "#RAWDATAFILE#" length = GetRawData(Encoding.Default.GetBytes(filename), buffer, length)

    Read the article

  • Multithreading with STL container

    - by Steven
    I have an unordered map which stores a pointer of objects. I am not sure whether I am doing the correct thing to maintain the thread safety. typedef std::unordered_map<string, classA*>MAP1; MAP1 map1; pthread_mutex_lock(&mutexA) if(map1.find(id) != map1.end()) { pthread_mutex_unlock(&mutexA); //already exist, not adding items } else { classA* obj1 = new classA; map1[id] = obj1; obj1->obtainMutex(); //Should I create a mutex for each object so that I could obtain mutex when I am going to update fields for obj1? pthread_mutex_unlock(&mutexA); //release mutex for unordered_map so that other threads could access other object obj1->field1 = 1; performOperation(obj1); //takes some time obj1->releaseMutex(); //release mutex after updating obj1 }

    Read the article

  • URL-Encoded post parameters don't Bind to model

    - by Steven Klein
    I have the following Model namespace ClientAPI.Models { public class Internal { public class ReportRequest { public DateTime StartTime; public DateTime EndTime; public string FileName; public string UserName; public string Password; } } } with the following method: [HttpPost] public HttpResponseMessage GetQuickbooksOFXService(Internal.ReportRequest Request){ return GetQuickbooksOFXService(Request.UserName, Request.Password, Request.StartTime, Request.EndTime, Request.FileName); } My webform looks like this: <form method="POST" action="http://localhost:56772/Internal/GetQuickbooksOFXService" target="_blank"> <input type="text" name="StartTime" value="2013-04-03T00:00:00"> <input type="text" name="EndTime" value="2013-05-04T00:00:00"> <input type="text" name="FileName" value="Export_2013-04-03_to_2013-05-03.qbo"> <input type="text" name="UserName" value="UserName"> <input type="text" name="Password" value="*****"> <input type="submit" value="Submit"></form> My question is: I get into the GetQuickbooksOFXService function but my model has all nulls in it instead something useful. Am I doing something wrong?

    Read the article

  • How to add project

    - by Steven
    hi, i am using eclipse.In eclipse for a class how can i invoke the build path property and go to the configure build path property and add a project in the project tab.I want to write code for that.Is it possible?Help

    Read the article

  • How to make multiple windows using Win32 API

    - by Steven Lu
    I see plenty of tutorials and articles showing me how to make a simple windows program, which is great but none of them show me how to make multiple windows. Right now I have working code that creates and draws a layered window and I can blit stuff using GDI to draw anything I want on it, drag it around, even make it transparent, etc. But I wanted a second rectangular area that I can draw to, drag around, etc. In other words, a second window. Probably want it to be a child window. Question is, how do I make it? Also, if anybody knows any good resources (online preferably) like articles or tutorials for window management in the Windows API, please share.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >