Search Results

Search found 520 results on 21 pages for 'francis young'.

Page 7/21 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Handling duplicate insertion

    - by Francis
    So I've got this piece of code which, logically should work but Entity Framework is behaving unexpectedly. Here: foreach (SomeClass someobject in allObjects) { Supplier supplier = new Supplier(); supplier.primary_key = someobject.id; supplier.name = someobject.displayname; try { sm.Add(supplier); ro.Created++; } catch (Exception ex) { ro.Error++; } } Here's what I have in sm.Add() public Supplier Add(Supplier supplier) { try { _ctx.AddToSupplier(supplier); _ctx.SaveChanges(); return supplier; } catch (Exception ex) { throw; } } I can have records in allObjects that have the same id. My piece of code needs to support this and just move on to the next and try to insert it, which I think should work. If this happens, an exception is throw, saying that records with dupe PKs cannot be inserted (of course). The exception mentions the value of the PK, for example 1000. All is well, a new supplier is passed to sm.Add() containing a PK that's never been used before. (1001) Weirdly though, when doing SaveChanges(), EF will whine about not being able to insert records with dupe PKs. The exception still mentions 1000 even though supplier contains 10001 in primary_key. I feel this is me not using _ctx properly. Do I need to call something else to sync it ?

    Read the article

  • Remote XP -> Win98 WMI Connection

    - by Logan Young
    I've asked this on Technet, but because Win98 is no longer supported, I can't get any decent information, I was hoping there might be some "old school" developers here who might be able to help me. There is an application that we use a lot at work. This application should run 8am-5pm with as little interruption as possible. Most of the computers where this application runs are using Win98, and we have no way to upgrade them because we can't buy new hardware at the moment. My computer is running WinXP, so I thought of a way to make sure that this application runs all the time: The idea I had was to develop a Windows Service that executes a VBScript file that contains a WMI query to get a list of processes from each computer. Each list is then examined, and, depending on whether or not the target application is running, it will either do nothing, or it will execute another VBScript file that contains a WMI query that will be used to start the target application remotely. I later found a way to do this all with 1 VBScript file (see code below) My problem is in the remote connection to the target computers. I've installed WMI Core 1.5 on them, but every time I try the remote connection, I get the following: The remote server is unavailable or does not exist: 'GetObject' VBScript runtime error 800A01CE I've done some research, and all I've found is info about DCOM Config and Windows Firewall, but Win98 doesn't have either of these. ' #### Variables and constants #### Const HIDDEN_WINDOW = 12 Dim T ' #### End Variables and constants #### Main() Sub Main() ' #### Get Process information from WMI Computer = "." Set WMI = GetObject("winmgmts:" & _ "{ImpersonationLevel=Impersonate}!\\" & Computer & "\root\cimv2") Set Settings = WMI.ExecQuery("SELECT * FROM Win32_Process") For Each Process In Settings ' #### If the application is found to be running, set a value to indicate this If Process.Name = "NOTEPAD.EXE" Then T = True End If Next ' #### T will only have a value if the application is not running. We therefore ' #### evaluate it to determine if it has a value or not. If not, start the application If Not T Then 'MsgBox("Application not found.") Set Startup = WMI.Get("Win32_ProcessStartup") Set Config = Startup.SpawnInstance_ Config.ShowWindow = HIDDEN_WINDOW Set Process = GetObject("winmgmts:root\cimv2:Win32_Process") errReturn = Process.Create(_ "C:\Windows\notepad.exe", null, Config, intProcessID) End If End Sub This uses WMI to get the list of processes from the local computer and, if the target application is running, it'll do nothing, otherwise it'll forcefully start the target application. The problem is that this works only if I specify the local comuter, if I target another computer, I get the error mentioned above. Does anyone have any ideas? Thanks in advance for the help!

    Read the article

  • How is it that i am getting two different open ids for the same site for the same user

    - by Salvin Francis
    I was under the impression that the open id for a user remains constant. I am allowing users to setup open id with my site with 2 different screens in my app... I was under the impression that the open id for a user is constant and will not change and I was planning to save it to my database for a given user, However, to my suprise, I found different ids for the same user using the same google account in the two different screens. How does open id actually work ?

    Read the article

  • HTTP request stream not readable outside of request handler

    - by Jason Young
    I'm writing a fairly complicated multi-node proxy, and at one point I need to handle an HTTP request, but read from that request outside of the "http.Server" callback (I need to read from the request data and line it up with a different response at a different time). The problem is, the stream is no longer readable. Below is some simple code to reproduce the issue. Is this normal, or a bug? function startServer() { http.Server(function (req, res) { req.pause(); checkRequestReadable(req); setTimeout(function() { checkRequestReadable(req); }, 1000); setTimeout(function() { res.end(); }, 1100); }).listen(1337); console.log('Server running on port 1337'); } function checkRequestReadable(req) { //The request is not readable here! console.log('Request writable? ' + req.readable); } startServer();

    Read the article

  • Resolve HTTP 304 - not modified in AJAX call made via GWT

    - by Salvin Francis
    We are using an application made in GWT with the server as tomcat. The project runs fine normally, however there are situations where the server is restarted. At such point of time, the ajax call made by the code below returns blank text with the status code as 304 RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, URL.encode(serverUrl)); //-- serverUrl is the url to which this call is posted to. requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded"); requestBuilder.setHeader("Expires","0"); requestBuilder.sendRequest( postData, new RequestCallback() { public void onError(Request request, Throwable exception) { //Do nothing } public void onResponseReceived(Request request, Response response) { //sometimes when the server is restarted, I get response.getStatusCode() = 304 and the response.getText() as blank } } ); normally we get back some data from the server inside this response text. How do we now get the data when the response itself is blank ?

    Read the article

  • Find value within a range in lookup table

    - by francis
    I have the simplest problem to implement, but so far I have not been able to get my head around a solution in Python. I have built a table that looks similar to this one: 501 - ASIA 1262 - EUROPE 3389 - LATAM 5409 - US I will test a certain value to see if it falls within these ranges, 389 -> ASIA, 1300 -> LATAM, 5400 -> US. A value greater than 5409 should not return a lookup value. I normally have a one to one match, and would implement a dictionary for the lookup. But in this case I have to consider these ranges, and I am not seeing my way out of the problem. Maybe without providing the whole solution, could you provide some comments that would help me look in the right direction? It is very similar to a vlookup in a spreadsheet. I would describe my Python knowledge as somewhere in between basic to intermediate. Many thanks in advance.

    Read the article

  • Is vbscripting that difficult?

    - by eric young
    I need to write some vbscripts in my new project. I was told by other people that vbscripting is easy, but seems to me, it is not. For example, in the following example (provided by microsoft), these functions: CreateObject, CreateShortcut, as well as these property names: TargetPath, WindowStyle, Hotkey, etc, are used, but I just cannot find the corresponding API documentation about how to use them. In other words, how do you know you need to call these functions in your vbscripts? Visual Studio 2008/2010 do not have templates for vbscript either. Could anybody tell me what I am missing, and what the best way is to do vbscripting? set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop _ & "\MyExcel.lnk") oShellLink.TargetPath = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+F" oShellLink.IconLocation = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE, 0" oShellLink.Description = "My Excel Shortcut" oShellLink.WorkingDirectory = strDesktop oShellLink.Save

    Read the article

  • How to Prevent an Applet from Unloading across web pages?

    - by Francis Shanahan
    I have a large applet that takes some 40 seconds to initialize (cabs are cached so ignore download time for this question). The issue is, if the user goes to Page A which launches the applet (single window) and then navigates to page B, the applet is unloaded. If the user goes back to Page A, they incur the 40 seconds init time once again. I'd like to be able to launch the applet, incurring the 40 seconds init time once and only once. The applet needs to reside inside a single browser window (the same window as my web application). In other words, I cannot launch the applet in a popup. Does anyone have any creative ideas around how to prevent the applet unloading?

    Read the article

  • Are there any C# collections where modification does not invalidate iterators?

    - by young-phillip
    Are there any data structures in the C# Collections library where modification of the structure does not invalidate iterators? Consider the following: List<int> myList = new List<int>(); myList.Add( 1 ); myList.Add( 2 ); List<int>.Enumerator myIter = myList.GetEnumerator(); myIter.MoveNext(); // myIter.Current == 1 myList.Add( 3 ); myIter.MoveNext(); // throws InvalidOperationException

    Read the article

  • How can I improve my select query for storing large versioned data sets?

    - by Jason Francis
    At work, we build large multi-page web applications, consisting mostly of radio and check boxes. The primary purpose of each application is to gather data, but as users return to a page they have previously visited, we report back to them their previous responses. Worst-case scenario, we might have up to 900 distinct variables and around 1.5 million users. For several reasons, it makes sense to use an insert-only approach to storing the data (as opposed to update-in-place) so that we can capture historical data about repeated interactions with variables. The net result is that we might have several responses per user per variable. Our table to collect the responses looks something like this: CREATE TABLE [dbo].[results]( [id] [bigint] IDENTITY(1,1) NOT NULL, [userid] [int] NULL, [variable] [varchar](8) NULL, [value] [tinyint] NULL, [submitted] [smalldatetime] NULL) Where id serves as the primary key. Virtually every request results in a series of insert statements (one per variable submitted), and then we run a select to produce previous responses for the next page (something like this): SELECT t.id, t.variable, t.value FROM results t WITH (NOLOCK) WHERE t.userid = '2111846' AND (t.variable='internat' OR t.variable='veteran' OR t.variable='athlete') AND t.id IN (SELECT MAX(id) AS id FROM results WITH (NOLOCK) WHERE userid = '2111846' AND (t.variable='internat' OR t.variable='veteran' OR t.variable='athlete') GROUP BY variable) Which, in this case, would return the most recent responses for the variables "internat", "veteran", and "athlete" for user 2111846. We have followed the advice of the database tuning tools in indexing the tables, and against our data, this is the best-performing version of the select query that we have been able to come up with. Even so, there seems to be significant performance degradation as the table approaches 1 million records (and we might have about 150x that). We have a fairly-elegant solution in place for sharding the data across multiple tables which has been working quite well, but I am open for any advice about how I might construct a better version of the select query. We use this structure frequently for storing lots of independent data points, and we like the benefits it provides. So the question is, how can I improve the performance of the select query? I assume the nested select statement is a bad idea, but I have yet to find an alternative that performs as well. Thanks in advance. NB: Since we emphasize creating over reading in this case, and since we never update in place, there doesn't seem to be any penalty (and some advantage) for using the NOLOCK directive in this case.

    Read the article

  • ASP.NET: How to "reset" validation after calling Page_ClientValidate

    - by Josh Young
    I have an ASP.NET page with a jQuery dialog that is displayed to change some data. I am setting up the jQuery dialog so that when the user clicks the OK button it calls ASP.NET's Page_ClientValidate('validationGroup') via javascript, finds all the invalid controls and changes their CSS class. So here's the scenario: the user opens the dialog, keys in some invalid data, clicks OK (receiving the validation messages), and then clicks Cancel. Now the dialog is closed, but the validation messages are still there, so that when they open the dialog again, the data goes back to the way it was initially, but the form is still in the invalid state (the validation messages are still displaying). What I need is a "reset" function of sorts to call after calling Page_ClientValidate('validationGroup'). Does this exist?

    Read the article

  • Is there a Silverlight week picker control?

    - by Jason Young
    We have a report that compares data between weeks, and it seems like this is the exception and not the rule in the reporting world. I'm looking for an elegant way of selecting "a week" in a Silverlight control. I'd prefer not to spend the time building it ourselves, so it would be nice if I could buy a well polished control that does this. Sure, I could use a drop down list, but I would like a way to easily navigate through potentially years worth of weeks. Any existing controls out there? Any clever ways of using basic controls to achieve our goal? Thank you!

    Read the article

  • Zend_Form: Is this really the way we should be doing things?

    - by Francis Daigle
    OK. I understand how to use Zend_Form and it's implementation of the decorator pattern. My question is, is this the best way to be going about creating forms? Shouldn't a documents forms be left to to the front-end rather than generating forms programmatically? Doesn't this kinda violate the whole idea of keeping things separate? I mean, really, even providing that you have a good understanding of the methodology being employed, does it really save one that much time? I guess what I'm looking for is some guidance as to what might be considered 'best practice'. I'm not saying that Zend_Form doesn't have it's place, I'm just wondering if it should be used in all cases (or not). And this has nothing to do with validation. I'm just thinking that something more akin to using the 'ViewScript' approach might be more appropriate in most cases. Your thoughts?

    Read the article

  • Who owes who money optimisation problem

    - by Francis
    Say you have n people, each who owe each other money. In general it should be possible to reduce the amount of transactions that need to take place. i.e. if X owes Y £4 and Y owes X £8, then Y only needs to pay X £4 (1 transaction instead of 2). This becomes harder when X owes Y, but Y owes Z who owes X as well. I can see that you can easily calculate one particular cycle. It helps for me when I think of it as a fully connected graph, with the nodes being the amount each person owes. Problem seems to be NP-complete, but what kind of optimisation algorithm could I make, nevertheless, to reduce the total amount of transactions? Doesn't have to be that efficient, as N is quite small for me.

    Read the article

  • Accessing HttpApplication.Application variables from a class

    - by Young Ninja
    I set up various global parameters in Global.asax, as such: Application["PagePolicies"] = "~/Lab/Policies.aspx"; Application["PageShare"] = "/Share.aspx"; Application["FileSearchQueries"] = Server.MapPath("~/Resources/SearchQueries.xml"); ... I have no problem accessing these variables form .ascx.cs or .aspx.cs file -- ie. files that are part of the Web content. However, I can't seem to access 'Application' from basic class objects (ie. standalone .cs files). I read somewhere to use a slight variations in .cs files, as follows, but it always comes throws an exception when in use: String file = (String)System.Web.HttpContext.Current.Application["FileSearchQueries"];

    Read the article

  • Data confusion - Selecting data in one DataGridView based on selection in another

    - by Logan Young
    This probably isn't the best way to do what I want, but I can't think of anything else to try... NB: I'm using Visual Basic.NET My form has 2 DataGridView controls. One of these is bound to a DataSet, the other isn't visible - at least not until the user selects a uniqueidentifier cell in the 1st grid. When the user makes this selection, the 2nd grid will become visible and display the row from another with the same id as the one selected in the 1st grid. So, basically, I want to dynamically display data in one grid based on user selection in another grid. My code looks like this so far... Private Sub RulesGrid_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles RulesGrid.CellClick Try FlagsGrid.Visible = True ''// MsgBox(RulesGrid.CurrentCell.Value.ToString()) Dim sql As String = "SELECT * FROM ctblMKA_Status_Flags " + _ "WHERE intStatusID = '" & RulesGrid.CurrentCell.Value & "'" DSFlags = GetDS(sql) DSFlags.DataSetName = "FlagsDataSet" FlagsGrid.DataSource = DSFlags ProgressBar.Visible = False Catch ex As Exception MsgBox(ex.ToString) End Try End Sub I feel like I'm missing something here... Any ideas anyone?

    Read the article

  • Hiding result sets from multiple selects in a stored procedure

    - by Josh Young
    I have a stored procedure that retrieves SQL queries as text and executes the statements using sp_executesql. Each of the dynamic queries is a count query in that it only returns the number of records found (select COUNT(id) from...). I am looping through a set of SQL queries stored as text and building a table variable out of the results. At the end, I am selecting all the results from the table variable as the result set that I want returned from the stored procedure. However, when I execute the stored procedure, I am naturally getting multiple result sets (one for each of the dynamic queries and one for the final select.) Is there any way I can suppress the results of a select statement executed through sp_executesql? I have found answers that reference storing the results in a temp table, but I don't have control of the query text that I am running so I can't change it to select into anything. Please help. Thank you for your time.

    Read the article

  • I need a simple slideshow for images of different sizes

    - by Darryl Young
    I'm looking for a very basic slideshow which displays images of various sizes. For example, the first image could be a standard 800x600 but the next might be a taller portrait image and so on. The slideshow doesn't need to have any controls. The specification just states that the page will be black and in the centre there'll be the area where images will display. As far as I know, it will be very simple like this - www.jeffcutter.net. I'm limited on time here so I'm not able to look into writing a custom one or anything like that. I just need to get some images displaying like in the example. Thanks in advance, it's much appreciated. Have a great weekend! Regards.

    Read the article

  • Getting SharePoint absolute site url

    - by Francis
    I need to get the current absolute url of my site from inside an aspx page (no codebehind). I tried $SPUrl, but it get's converted into a relative url. <asp:Literal runat="server" text="<% $SPUrl:~Site/mypage.aspx %>" /> results in "/mypage.aspx". It's important that I get the full absolute url starting with "http://". <asp:Literal runat="server" text="<% $SPUrl:~SiteCollection/mypage.aspx %>" /> does the same. The goal is to get this url: "http://myspweb.com/mypage.aspx" as result.

    Read the article

  • How do I programmatically add a widget to a container created from GtkBuilder?

    - by Warner Young
    I've created a window that has some containers and widgets in it, and I want to add a new widget dynamically at run-time to one of the Vboxes in this window. So I have this code, which brings up the window: gtk_builder_add_from_file( g_builder, "window.xml", NULL ); mainwindow = GTK_WIDGET( gtk_builder_get_object( g_builder, "window" )); gtk_widget_show( mainwindow ); Then I create a new label, for example, and add it to one of the existing Vboxes, called "vbox_mid", like this: label = gtk_label_new( "Test label" ); vbox = GTK_WIDGET( gtk_builder_get_object( g_builder, "vbox_mid" )); gtk_box_pack_end( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); But this doesn't seem to work. I don't see a new label in the vbox. I have a feeling I'm missing something here, but I can't see what it is. I thought perhaps there was a special GtkBuilder call to add a widget dynamically, but I don't see anything that looks like that. I would really appreciate any help on this.

    Read the article

  • Font sizes in Telerik controls

    - by Young Ninja
    What's the easiest way to set the font sizes for ALL telerik control to a single value? I believe you can control fonts by modifying the CC of a specific control, but that's a pain because I am using many different control types...

    Read the article

  • Pre-loading external files (CSS, JavaScript) for other pages

    - by Jason Young
    I'm curious if there is an efficient way to wait for the front page of a site to load, and then pre-load CSS and script files that I know will likely be needed for the other pages on the site. I want the front page of the site to be as fast as possible (lean and mean). It's likely that the user will not immediately click on a link. Since there will likely be some idle time, this seems like an opportune time to pre-load some of the external assets. Pre-loading should cause them to become cached. When the user does click on another page, the only request needed will be for the content and possibly some images, etc. Has anyone done this? Is it a bad idea? Is there an elegant way to implement it?

    Read the article

  • Creating many native GUI frontends for a cross-platform application

    - by Hugh Young
    I've been away from GUI programming for quite some time so please pardon my ignorance. I would like to attempt the following: Write a Mac OSX app but still be able to port to Win/Linux (i.e. C++ core with Obj-C GUI) Avoid Qt/other toolkits on OSX (i.e. talk to Cocoa directly - I feel that many Qt apps I use stick out like sore thumbs compared to the rest of my system) Not as important, but it would be nice to avoid Visual Studio if it means I can have the freedom to use newer C++ features even on Windows if they help create better code. I believe this configuration might get me what I'm looking for: Core C++ Static Library OSX GUI (Cocoa) Windows GUI (Qt+MinGW?) OR (no new C++ features, Visual Studio + ManagedC++/C#/????) Linux GUI (Qt) Once again, sorry for my ignorance but is this possible? Is this sane? Are there any real-world open source examples accomplish something like this?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >