Search Results

Search found 2451 results on 99 pages for 'alex chamberlain'.

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

  • Access Violation Exception when trying to perform WTSVirtualChannelRead

    - by Scott Chamberlain
    I am trying to write a hello world type program for using virtual channels in the windows terminal services client. public partial class Form1 : Form { public Form1() { InitializeComponent(); } IntPtr mHandle = IntPtr.Zero; private void Form1_Load(object sender, EventArgs e) { mHandle = NativeMethods.WTSVirtualChannelOpen(IntPtr.Zero, -1, "TSCRED"); } private void button1_Click(object sender, EventArgs e) { int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int bytesRead = 0; NativeMethods.WTSVirtualChannelRead(mHandle, 0, buffer, bufferSize, ref bytesRead); if (bytesRead != 0) { MessageBox.Show("Got no Data"); } else { MessageBox.Show("Got data: " + bytesRead); } } protected override void Dispose(bool disposing) { if (mHandle != System.IntPtr.Zero) { NativeMethods.WTSVirtualChannelClose(mHandle); } base.Dispose(disposing); } } internal static class NativeMethods { [DllImport("Wtsapi32.dll")] public static extern IntPtr WTSVirtualChannelOpen(IntPtr server, int sessionId, [MarshalAs(UnmanagedType.LPStr)] string virtualName); [DllImport("Wtsapi32.dll", SetLastError = true)] public static extern bool WTSVirtualChannelRead(IntPtr channelHandle, long timeout, byte[] buffer, int length, ref int bytesReaded); [DllImport("Wtsapi32.dll")] public static extern bool WTSVirtualChannelClose(IntPtr channelHandle); } On NativeMethods.WTSVirtualChannelRead(mHandle, 0, buffer, bufferSize, ref bytesRead); I get the following error every time. System.AccessViolationException was unhandled by user code Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=RemoteForm StackTrace: at RemoteForm.NativeMethods.WTSVirtualChannelRead(IntPtr channelHandle, Int64 timeout, Byte[] buffer, Int32 length, Int32& bytesReaded) at RemoteForm.Form1.button1_Click(Object sender, EventArgs e) in E:\Visual Studio 2010\Projects\RemoteForm\Form1.cs:line 31 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) InnerException: I am sending the data from the MSTSC COM object and ActiveX controll. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { rdp.Server = "schamberlainvm"; rdp.UserName = "TestAcct"; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = "asdf"; rdp.CreateVirtualChannels("TSCRED"); rdp.Connect(); } private void button1_Click(object sender, EventArgs e) { rdp.SendOnVirtualChannel("TSCRED", "This is a test"); } } //Designer code // // rdp // this.rdp.Enabled = true; this.rdp.Location = new System.Drawing.Point(12, 12); this.rdp.Name = "rdp"; this.rdp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("rdp.OcxState"))); this.rdp.Size = new System.Drawing.Size(1092, 580); this.rdp.TabIndex = 0; Any help on this would be greatly appreciated.

    Read the article

  • Cannot convert IAsyncResult to AsyncResult when using a service refrence

    - by Scott Chamberlain
    I have a WCF service running, I added a reference to the service by using Add Service Reference in the solution explorer, and I checked the box for create asynchronous operations. My call works fine, I have a two way channel that reports back some events from the server and I am receiving the events. However, when the asynchronous task finishes in my callback handeler I get the error Unable to cast object of type 'SendAsyncResult' to type 'System.Runtime.Remoting.Messaging.AsyncResult'. Code that calls the method. DatabaseManagement.DatabaseManagementClient d = new DatabaseManagement.DatabaseManagementClient(new InstanceContext(new DatabaseManagementCallback())); d.Open(); d.BeginCreateDatabase("", "PreConfSA", "_test", new AsyncCallback(BeginCreateDatabaseCallback), null); The Async callback static void BeginCreateDatabaseCallback(IAsyncResult ar) { AsyncResult result = (AsyncResult)ar; //Execption happens here DatabaseManagement.DatabaseManagementClient caller = (DatabaseManagement.DatabaseManagementClient)result.AsyncDelegate; Console.WriteLine(caller.EndCreateDatabase(ar)); //Do more stuff here } Execption Details System.InvalidCastException was unhandled by user code Message=Unable to cast object of type 'SendAsyncResult' to type 'System.Runtime.Remoting.Messaging.AsyncResult'. Source=Sandbox Console StackTrace: at Sandbox_Console.Program.BeginCreateDatabaseCallback(IAsyncResult ar) in E:\Visual Studio 2010\Projects\Sandbox Console\Program.cs:line 26 at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously) InnerException: I don't really need the result from the EndCreateDatabase but everywhere I read it says that you must call EndYouFunctionHere() or bad things happen. Any recomendations?

    Read the article

  • Template engine recommendations

    - by alex
    I'm looking for a template engine. Requirements: Runs on a JVM. Java is good; Jython, JRuby and the like, too... Can be used outside of servlets (unlike JSP) Is flexible wrt. to where the templates are stored (JSP and a lot of people require the templates to be stored in the FS). It should provide a template loading interface which one can implement or something like that Easy inclusion of parameterized templates- I really like JSP's tag fragments Good docs, nice code, etc., the usual suspects I've looked at JSP- it's nearly perfect except for the servlet and filesystem coupling, Stringtemplate- I love the template syntax, but it fails on the filesystem coupling, the documentation is lacking and template groups and stuff are confusing, GXP, TAL, etc. Ideas, thoughts? Alex

    Read the article

  • SQL Anywhere 11, JZ0C0: Connection is already closed

    - by Alex
    SLOVED see commend I develop am webservice based on apache tomcat 6.0.26, apache cxf 2.2.7, spring 3.0, hibernate 3.3 and sybase sqlanywhere 11. im using the latest JDBC Driver from SYBASE jconn.jar Version 6. The persistence layer is based on spring + hibernate dao, the connection is configured via a JNDI datasoure (META-INF directory). It seems that, during longer times of inactivity, the connection from the webservice to the database is closed. Exception: java.sql.SQLException: JZ0C0: Connection is already closed. Best regards, Alex

    Read the article

  • Regex pattern failing

    - by Scott Chamberlain
    I am trying a substring to find from the beginning of the string to the point that has the escape sequence "\r\n\r\n" my regex is Regex completeCall = new Regex(@"^.+?\r\n\r\n", RegexOptions.Compiled); it works great as long as you only have strings like 123\r\n\r\n however once you have the pattern 123\r\n 456\r\n\r\n the pattern no longer matches. Any advice on what I am doing wrong? Regex completeCall = new Regex(@"^.+?\r\n\r\n", RegexOptions.Compiled); Regex junkLine = new Regex(@"^\D", RegexOptions.Compiled); private void ClientThread() { StringBuilder stringBuffer = new StringBuilder(); (...) while(true) { (...) Match match = completeCall.Match(stringBuffer.ToString()); while (Match.Success) //once stringBuffer has somthing like "123\r\n 456\r\n\r\n" Match.Success always returns false. { if (junkLine.IsMatch(match.Value)) { (...) } else { (...) } stringBuffer.Remove(0, match.Length); // remove the processed string match = completeCall.Match(stringBuffer.ToString()); // check to see if more than 1 call happened while the thread was sleeping. } Thread.Sleep(1000); }

    Read the article

  • Regex pattern failing

    - by Scott Chamberlain
    I am trying to strip out all things that are in a string that are not a letter number or space so I created the regex private static Regex _NonAlphaChars = new Regex("[^[A-Za-z0-9 ]]", RegexOptions.Compiled); however When I call _NonAlphaChars.Replace("Scott,", ""); it returns "Scott," What am I doing wrong that it is not matching the ,?

    Read the article

  • Detecting (on the server side) when a Flex client disconnects from BlazeDS destination

    - by Alex Curtis
    Hi all, I'd like to know whether it's possible to easily detect (on the server side) when Flex clients disconnect from a BlazeDS destination please? My scenario is simply that I'd like to try and use this to figure out how long each of my clients are connected for each session. I need to be able to differentiate between clients as well (ie so not just counting the number of currently connected clients which I see in ds-console). Whilst I could program in a "I'm now logging out" process in my clients, I don't know whether this will fire if the client simply navigates away to another web page rather than going though said logout process. Can anyone suggest if there's an easy way to do this type of monitoring on the server side please. Many thanks, Alex

    Read the article

  • Classic ASP Request.Form removes spaces?

    - by alex
    I'm trying to figure this oddity out... in classic ASP i seem to be losing spaces in Request.Form values... ie, Request.Form("json") is {"project":{"...","administrator":"AlexGorbatchev", "anonymousViewUrl":null,"assets":[],"availableFrom":"6/10/20104:15PM"... However, CStr(Request.Form) is json={"project":{"__type":"...":"Alex Gorbatchev", "anonymousViewUrl":null,"assets":[],"availableFrom":"6/10/2010 4:15 PM"... Here's the entire code :) <%@ language="VBSCRIPT"%> <% Response.Write(CStr(Request.Form("json"))) Response.Write(CStr(Request.Form)) %> Somebody please tell me I haven't lost all my marbles...

    Read the article

  • Setting a value through reflection is not working.

    - by Scott Chamberlain
    I am trying to set a value through reflection. I created this little test program struct headerIndexes { public int AccountNum{ get; set; } public int other { get; set; } public int items { get; set; } } static void Main(string[] args) { headerIndexes headers = new headerIndexes(); headers.AccountNum = 1; Console.WriteLine("Old val: {0}", headers.AccountNum); foreach (var s in headers.GetType().GetProperties()) { if (s.Name == "AccountNum") s.SetValue(headers, 99, null); } Console.WriteLine("New val: {0}", headers.AccountNum); Console.ReadKey(); } Steping thorugh the program i see it correctly does the command s.SetValue(headers, 99, null); however the value of headers.AccountNum stays at 1 when setValue is run. Am I missing a obvious step?

    Read the article

  • Running Awk command on a cluster

    - by alex
    How do you execute a Unix shell command (awk script, a pipe etc) on a cluster in parallel (step 1) and collect the results back to a central node (step 2) Hadoop seems to be a huge overkill with its 600k LOC and its performance is terrible (takes minutes just to initialize the job) i don't need shared memory, or - something like MPI/openMP as i dont need to synchronize or share anything, don't need a distributed VM or anything as complex Google's SawZall seems to work only with Google proprietary MapReduce API some distributed shell packages i found failed to compile, but there must be a simple way to run a data-centric batch job on a cluster, something as close as possible to native OS, may be using unix RPC calls i liked rsync simplicity but it seem to update remote notes sequentially, and you cant use it for executing scripts as afar as i know switching to Plan 9 or some other network oriented OS looks like another overkill i'm looking for a simple, distributed way to run awk scripts or similar - as close as possible to data with a minimal initialization overhead, in a nothing-shared, nothing-synchronized fashion Thanks Alex

    Read the article

  • github url style

    - by Alex Le
    Hi all, I wanted to have users within my website to have their own URL like http://mysite.com/username (similar to GitHub, e.g. my account is http:// github. com/sr3d). This would help with SEO since every profile is under the same domain, as apposed to the sub-domain approach. My site is running on Rails and Nginx/Passenger. Currently I have a solution using a bunch of rewrite in the nginx.conf file, and hard-coded controller names (with namespace support as well). I can share include the nginx.conf here if you guys want to take a look. I wanted to know if there's a better way of making the URL pretty like that. (If you suggest a better place to post this question then please let me know) Cheers, Alex

    Read the article

  • Binding Source suspends itself when I don't want it to.

    - by Scott Chamberlain
    I have two data tables set up in a Master-Details configuration with a relation "Ticket_CallSegments" between them. I also have two Binding Sources and a Data Grid View configured like this (Init Code) // // dgvTickets // this.dgvTickets.AllowUserToAddRows = false; this.dgvTickets.AllowUserToDeleteRows = false; this.dgvTickets.AllowUserToResizeRows = false; this.dgvTickets.AutoGenerateColumns = false; this.dgvTickets.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvTickets.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.cREATEDATEDataGridViewTextBoxColumn, this.contactFullNameDataGridViewTextBoxColumn, this.pARTIALNOTEDataGridViewTextBoxColumn}); this.dgvTickets.DataSource = this.ticketsDataSetBindingSource; this.dgvTickets.Dock = System.Windows.Forms.DockStyle.Fill; this.dgvTickets.Location = new System.Drawing.Point(0, 0); this.dgvTickets.MultiSelect = false; this.dgvTickets.Name = "dgvTickets"; this.dgvTickets.ReadOnly = true; this.dgvTickets.RowHeadersVisible = false; this.dgvTickets.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvTickets.Size = new System.Drawing.Size(359, 600); this.dgvTickets.TabIndex = 0; // // ticketsDataSetBindingSource // this.ticketsDataSetBindingSource.DataMember = "Ticket"; this.ticketsDataSetBindingSource.DataSource = this.ticketsDataSet; this.ticketsDataSetBindingSource.CurrentChanged += new System.EventHandler(this.ticketsDataSetBindingSource_CurrentChanged); // // callSegementBindingSource // this.callSegementBindingSource.DataMember = "Ticket_CallSegments"; this.callSegementBindingSource.DataSource = this.ticketsDataSetBindingSource; this.callSegementBindingSource.Sort = "CreateDate"; //Function to update a rich text box. private void ticketsDataSetBindingSource_CurrentChanged(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); rtbTickets.Clear(); foreach (DataRowView drv in callSegementBindingSource) { TicketsDataSet.CallSegmentsRow row = (TicketsDataSet.CallSegmentsRow)drv.Row; sb.AppendLine("**********************************"); sb.AppendLine(String.Format("CreateDate: {1}, Created by: {0}", row.USERNAME, row.CREATEDATE)); sb.AppendLine("**********************************"); rtbTickets.SelectionFont = new Font("Arial", (float)11, FontStyle.Bold); rtbTickets.SelectedText = sb.ToString(); rtbTickets.SelectionFont = new Font("Arial", (float)11, FontStyle.Regular); rtbTickets.SelectedText = row.NOTES + "\n\n"; } } However when ticketsDataSetBindingSource_CurrentChanged gets called when I select a new row in my Data Grid View callSegementBindingSource.IsBindingSuspended is set to true and my text box does not update correctly (it seems to always pull from the same row in CallSegments). Can anyone see what I am doing wrong or tell me how to unsuspend the binding so it will pull the correct data?

    Read the article

  • Prevent deferred creation of controls.

    - by Scott Chamberlain
    Here is a test framework to show what I am doing, just create a new project add a tabbed control, on tab 1 put a button on tab 2 put a check box (default names) and paste this code for its code public partial class Form1 : Form { private List<bool> boolList = new List<bool>(); BindingSource bs = new BindingSource(); public Form1() { InitializeComponent(); boolList.Add(false); bs.DataSource = boolList; checkBox1.DataBindings.Add("Checked", bs, ""); } bool updating = false; private void button1_Click(object sender, EventArgs e) { updating = true; boolList[0] = true; bs.ResetBindings(false); Application.DoEvents(); updating = false; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (!updating) MessageBox.Show("CheckChanged fired outside of updating"); } } The issue is if you run the program and look at tab 2 then press the button on tab 1 the program works as expected, however if you press the button on tab 1 then look at tab 2 the event for the checkbox will not fire untill you look at tab 2. The reason for this is the controll on tab 2 is not in the "created" state, so its binding to change the checkbox from unchecked to checked does not happen until after the control has been "Created". checkbox1.CreateControl() does not do anything because according to MSDN CreateControl does not create a control handle if the control's Visible property is false. You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children. I tried getting the value of Handle(there is no CreateHandle for Button) but still the same result. Any suggestions other than have the program quickly flash all of my tabs that have data-bound check boxes when it first loads?

    Read the article

  • Bound checkbox does not update its datasource.

    - by Scott Chamberlain
    I have a checkbox who's checked value is bound to a binding source which is bound to a boolean data table column. When I click my save button to push my changes in my data table to my sql server the value in the data table is never changed. Designer code. this.cbxKeepWebInfinityChanges = new System.Windows.Forms.CheckBox(); this.preProductionBindingSource = new System.Windows.Forms.BindingSource(); // // cbxKeepWebInfinityChanges // this.cbxKeepWebInfinityChanges.AutoSize = true; this.cbxKeepWebInfinityChanges.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.preProductionBindingSource, "WEBINFINTY_CHANGES", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.cbxKeepWebInfinityChanges.Location = new System.Drawing.Point(6, 98); this.cbxKeepWebInfinityChanges.Name = "cbxKeepWebInfinityChanges"; this.cbxKeepWebInfinityChanges.Size = new System.Drawing.Size(152, 17); this.cbxKeepWebInfinityChanges.TabIndex = 30; this.cbxKeepWebInfinityChanges.Text = "Keep WebInfinity Changes"; this.cbxKeepWebInfinityChanges.UseVisualStyleBackColor = true; this.cbxKeepWebInfinityChanges.CheckedChanged += new System.EventHandler(this.CauseApplyChangesActivation); // // preProductionBindingSource // this.preProductionBindingSource.AllowNew = false; this.preProductionBindingSource.DataMember = "PreProduction"; this.preProductionBindingSource.DataSource = this.salesLogix; Save Code //the comments are the debugger values before the call in going from checked when loaded to unchecked when saved. private void btnApplyChanges_Click(object sender, EventArgs e) { (...) // non related saving logic for other controls preProductionBindingSource.EndEdit(); // checked = false, databinding = true, datatable = true preProductionTableAdapter.Update(salesLogix.PreProduction); // checked = false, databinding = true, datatable = true } After the saving code the box rechecks itself. The same things happens when going from unchecked to checked. does not save the change and reverts to the old value. Other items I have bound to the same data-binding source (I have two combo boxes) are updating correctly.

    Read the article

  • Saving a reference to a int.

    - by Scott Chamberlain
    Here is a much simplified version of what I am trying to do static void Main(string[] args) { int test = 0; int test2 = 0; Test A = new Test(ref test); Test B = new Test(ref test); Test C = new Test(ref test2); A.write(); //Writes 1 should write 1 B.write(); //Writes 1 should write 2 C.write(); //Writes 1 should write 1 Console.ReadLine(); } class Test { int _a; public Test(ref int a) { _a = a; //I loose the reference here } public void write() { var b = System.Threading.Interlocked.Increment(ref _a); Console.WriteLine(b); } } In my real code I have a int that will be incremented by many threads however where the threads a called it will not be easy to pass it the parameter that points it at the int(In the real code this is happening inside a IEnumerator). So a requirement is the reference must be made in the constructor. Also not all threads will be pointing at the same single base int so I can not use a global static int either. I know I can just box the int inside a class and pass the class around but I wanted to know if that is the correct way of doing something like this? What I think could be the correct way: static void Main(string[] args) { Holder holder = new Holder(0); Holder holder2 = new Holder(0); Test A = new Test(holder); Test B = new Test(holder); Test C = new Test(holder2); A.write(); //Writes 1 should write 1 B.write(); //Writes 2 should write 2 C.write(); //Writes 1 should write 1 Console.ReadLine(); } class Holder { public Holder(int i) { num = i; } public int num; } class Test { Holder _holder; public Test(Holder holder) { _holder = holder; } public void write() { var b = System.Threading.Interlocked.Increment(ref _holder.num); Console.WriteLine(b); } } Is there a better way than this?

    Read the article

  • How to determine Windows.Diagnostics.Process from ServiceController

    - by Alex
    This is my first post, so let me start by saying HELLO! I am writing a windows service to monitor the running state of a number of other windows services on the same server. I'd like to extend the application to also print some of the memory statistics of the services, but I'm having trouble working out how to map from a particular ServiceController object to its associated Diagnostics.Process object, which I think I need to determine the memory state. I found out how to map from a ServiceController to the original image name, but a number of the services I am monitoring are started from the same image, so this won't be enough to determine the Process. Does anyone know how to get a Process object from a given ServiceController? Perhaps by determining the PID of a service? Or else does anyone have another workaround for this problem? Many thanks, Alex

    Read the article

  • Modifying generator.yml views in Symfony

    - by Alex Ciminian
    Hey! I'm currently working on a web app written in Symfony. I'm supposed to add an "export to CSV" feature in the backend/administration part of the app for some modules. In the list view, there should be an "Export" button which should provide the user with a csv file of the elements that are displayed (considering filtering criteria). I've created a method in the actions class of the module that takes a comma separated list of ids and generates the CSV, but I'm not really sure how to add the link to it in the view. The problem is that the view doesn't exist anywhere, it's generated on the fly from the data in the generator.yml configuration file. I've posted the relevant part of the file below. list: display: [=name, indemn, _status, _participants, _approved_, created_at] title: Lista actiuni object_actions: _edit: ~ _delete: ~ filters: [name, county_id, _status_filter, activity_id] fields: name: name: Nume Actiune indemn: name: Îndemn la actiune description: name: Descriere approved_: name: Operatiune created_at: name: Creata la status: name: Status Actiune I'm new to Symfony, so any help would be appreciated :). Thanks, Alex

    Read the article

  • C# setup project output automatically start with administrative rights

    - by Alex
    Hi, i've created an setup project for a .net-application which works fine. The problem is, that the application begins to write log-files after startup and this requires administrative rights on windows vista and windows 7. I know there are some folders which i could use to write into without administrative rights. When i start the application as administrator, everything works fine. I asked myself, if it's possible to change the setup project in visual studio in a way that the installed application automatically owns administrative rights on the target system? Thanks for every help in advance! Alex

    Read the article

  • Looking for some thoughts on an image printing app

    - by Alex
    Hey All, Im looking for thoughts/advice. I have an upcoming project (all .net) that will require the following: pulls data once a day from an online service provider based on certain criteria. saves data locally for reference and reporting the data thats pulled will be used to create gift cards. So after the data is loaded, a process will run to generate "virtual cards" and send them to a network printer. Once printed, the system will updated the local data recording a successful or failed print. My initial thought was to create a windows service to pull the data...but then I couldnt decide how I was going to put a "virtual card" together and get it to print. Then I considered doing it as a WPF app. I figure that will give me access to the graphics and printing ability. Maybe neither of these are the right direction....Any ideas or thoughts would be greatly appreciated. Alex

    Read the article

  • Virtual channel tutorial for terminal services.

    - by Scott Chamberlain
    I am writing a program that will need to communicate to a server through a TS connection. Virtual Channels seems to be exactly what I need but Microsoft's documentation leaves very much to be desired. Does anyone know of good tutorials or just some examples I could use to help me. Preferred language is C# but C++ examples are fine too.

    Read the article

  • Utilizing Windows Handles without a forum.

    - by Scott Chamberlain
    I have a program that needs to sit in the background and when a user connects to a RDP session it will do some stuff then launch a program. when the program is closed it will do some housekeeping and logoff the session. The current way I am doing it is like this I have the terminal server launch this application. I have it set as a windows forms application and my code is this public static void Main() { //Do some setup work Process proc = new Process(); //setup the process proc.Start(); proc.WaitForExit(); //Do some housecleaning NativeMethods.ExitWindowsEx(0, 0); } I really like this because there is no item in the taskbar and there is nothing showing up in alt-tab. However to do this I gave up access to functions like void WndProc(ref Message m) So Now I can't listen to windows messages (Like WTS_REMOTE_DISCONNECT or WTS_SESSION_LOGOFF) and do not have a handle to use for for bool WTSRegisterSessionNotification(IntPtr hWnd, int dwFlags); I would like my code to be more robust so it will do the housecleaning if the user logs off or disconnects from the session before he closes the program. Any reccomendations on how I can have my cake and eat it too?

    Read the article

  • Setting refresh-policies in Ehcache

    - by Alex Ciminian
    Is there any to specify a data refresh policy in Ehcache? I am currently migrating an application from OSCache to Ehcache and I can't seem to find any way to specify when an element needs refreshing, besides setting timeToIdle and timeToLive. What I want is: on accessing an element from the cache, check with it's associated resource to see if it was updated later than the lastUpdateTime of the cache element. If yes, refresh the cache; else serve the content from the cache. In OSCache this was done by catching NeedsRefreshExceptions and setting custom refresh policies for the elements. I've been digging around in the docs for a while now, but I wasn't able to find any methods or examples of how I could accomplish this in Ehcache. Any help would be appreciated :). Alex

    Read the article

  • Calculating co-ordinate of a point on a path given a distance

    - by Alex
    I'm working on a project that surveys the condition of a road or highway using a calibrated trip computer connected to a rugged-PC. An operator keys in defect codes as they travel along a pre-defined route. I need to show an indicator on the map screen that shows the vehicles current position, taking into account the distance data from the trip computer. I know the exact lat lon co-ordinates at the starting point of each section of road, and the road is made up of a series of points. The question is: how can I calculate the lat lon co-ordinates of the vehicle assuming that it has continued on the route and traveled a certain distance (e.g. 1.4km). The co-ordinates would be 'locked onto' the road line, as shown in blue on the diagram below. Thanks, Alex

    Read the article

  • Vim OmniCppComplete on vectors of pointers

    - by Alex
    Hi, I might have done something wrong in the set up but is OmniCppComplete supposed to provide the members/functions of classes when doing this? vectorofpointers[0]-> At the moment all I get when trying that are things relating to the vector class itself, which obviously isn't very useful. I think it might have been working before I tagged /usr/include/ but I could be wrong. Also, is it possible to disable the preview window? I find it just clutters up my workspace. And since I enabled ShowPrototypeInAbbr I don't really need it. Thanks, Alex

    Read the article

  • Does the chunk of the System.Collections.Concurrent.Partitioner need to be thread safe?

    - by Scott Chamberlain
    I am working with the Parallel libraries in .net 4 and I am creating a Partitioner and the example shown in the MSDN only has a chunk size of 1 (every time a new result is retrieved it hits the data source instead of the local cache. The version I am writing will pull 10000 SQL rows at a time then feed the rows from the cache until it is empty then pull another batch. Each partition in the Partitioner has its own chunk. I know every time I call to the IEnumerator in from the SQL data-source that needs to be thread safe but for use in a Parallel.ForEach do I need to make every call to the cache for the chunking thread safe?

    Read the article

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