Search Results

Search found 5671 results on 227 pages for 'sub tuts'.

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

  • .NET Programmatically invoke screenclick doesn't work?

    - by ropstah
    I'm trying to programmatically invoke an onclick event however the click is not received/handled. Am I missing something, or is security preventing the click to be executed? I have a forms application which is invisible. Basically I would like to say: DoDoubleClick(wait, x, y) This should raise two click (mousedown+mouseup) events on screen with the specified wait interval. However the click isn't received in a Flash application in Firefox (which is running at that moment). Here's my code: Form: Public Class Form1 Private WithEvents gmh As GlobalMouseHook Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gmh = New GlobalMouseHook() Me.Visible = false gmh.DoDoubleClick(50, 800, 600) End Sub Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed gmh.Dispose() End Sub Private Sub gmh_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseDown End Sub Private Sub gmh_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseMove End Sub Private Sub gmh_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseUp End Sub End Class GlobalMouseHook class: Friend Class GlobalMouseHook Implements IDisposable Private hhk As IntPtr = IntPtr.Zero Private disposedValue As Boolean = False Public Event MouseDown As MouseEventHandler Public Event MouseUp As MouseEventHandler Public Event MouseMove As MouseEventHandler Public Sub New() Hook() End Sub Private Sub Hook() Dim hInstance As IntPtr = LoadLibrary("User32") hhk = SetWindowsHookEx(WH_MOUSE_LL, AddressOf Me.HookProc, hInstance, 0) End Sub Private Sub Unhook() UnhookWindowsHookEx(hhk) End Sub Public Sub DoDoubleClick(ByVal wait As Integer, ByVal x As Integer, ByVal y As Integer) RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 1, x, y, 0)) RaiseEvent MouseUp(Me, Nothing) System.Threading.Thread.Sleep(wait) RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 1, x, y, 0)) RaiseEvent MouseUp(Me, Nothing) End Sub Private Function HookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer If nCode >= 0 Then Select Case wParam Case WM_LBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_RBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Right, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_MBUTTONDOWN RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Middle, 0, lParam.pt.x, lParam.pt.y, 0)) Case WM_LBUTTONUP, WM_RBUTTONUP, WM_MBUTTONUP RaiseEvent MouseUp(Nothing, Nothing) Case WM_MOUSEMOVE RaiseEvent MouseMove(Nothing, Nothing) Case WM_MOUSEWHEEL, WM_MOUSEHWHEEL Case Else Console.WriteLine(wParam) End Select End If Return CallNextHookEx(hhk, nCode, wParam, lParam) End Function Private Structure API_POINT Public x As Integer Public y As Integer End Structure Private Structure MSLLHOOKSTRUCT Public pt As API_POINT Public mouseData As UInteger Public flags As UInteger Public time As UInteger Public dwExtraInfo As IntPtr End Structure Private Const WM_MOUSEWHEEL As UInteger = &H20A Private Const WM_MOUSEHWHEEL As UInteger = &H20E Private Const WM_MOUSEMOVE As UInteger = &H200 Private Const WM_LBUTTONDOWN As UInteger = &H201 Private Const WM_LBUTTONUP As UInteger = &H202 Private Const WM_MBUTTONDOWN As UInteger = &H207 Private Const WM_MBUTTONUP As UInteger = &H208 Private Const WM_RBUTTONDOWN As UInteger = &H204 Private Const WM_RBUTTONUP As UInteger = &H205 Private Const WH_MOUSE_LL As Integer = 14 Private Delegate Function LowLevelMouseHookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer Private Declare Auto Function LoadLibrary Lib "kernel32" (ByVal lpFileName As String) As IntPtr Private Declare Auto Function SetWindowsHookEx Lib "user32.dll" (ByVal idHook As Integer, ByVal lpfn As LowLevelMouseHookProc, ByVal hInstance As IntPtr, ByVal dwThreadId As UInteger) As IntPtr Private Declare Function CallNextHookEx Lib "user32" (ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hhk As IntPtr) As Boolean ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not Me.disposedValue Then If disposing Then ' TODO: free other state (managed objects). End If Unhook() End If Me.disposedValue = True End Sub ' This code added by Visual Basic to correctly implement the disposablepattern. Public Sub Dispose() Implements IDisposable.Dispose ' Do not change this code. Put cleanup code in Dispose(ByValdisposing As Boolean) above. Dispose(True) GC.SuppressFinalize(Me) End Sub End Class

    Read the article

  • Filter sub-categories like in layered navigation

    - by russjman
    I created a new template file catalog/category/list.phtml. This is to display all sub categories of the current category. I have layered navigation which is displaying sub-categories as one of the filters, but I want this new template to work with these filters as well. Right now when i click the subcategory filter, it filters all products on the page, but still displays all categories of the parent category. $_filters is how i am trying to access these filters, but i get nothing. Is there something i am not initializing correctly to have access to these filters from the layered navigation. <?php $_helper = $this->helper('catalog/output'); $_filters = $this->getActiveFilters(); echo $_filters; if (!Mage::registry('current_category')) return ?> <?php $_categories=$this->getCurrentChildCategories() ?> <?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?> <?php if($_count): ?> <?php foreach ($_categories as $_category): ?> <?php if($_category->getIsActive()): ?> <?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); $layer = Mage::getSingleton('catalog/layer'); $layer->setCurrentCategory($cur_category); $_imgHtml = ''; if ($_imgUrl = $this->getCurrentCategory()->getImageUrl()) { $_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" class="category-image" />'; $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); } echo $_category->getImageUrl(); ?> <div class="category-image-box"> <div class="category-description clearfix" > <div class="category-description-textbox" > <h2><span><?php echo $this->htmlEscape($_category->getName()) ?></span></h2> <p><?php echo $this->getCurrentCategory()->getDescription() ?></p> </div> <a href="<?php echo $this->getCategoryUrl($_category) ?>" class="collection-link<?php if ($this->isCategoryActive($_category)): ?> active<?php endif ?>" >See Entire Collection</a> <a href="<?php echo $this->getCategoryUrl($_category) ?>"><?php if($_imgUrl): ?><?php echo $_imgHtml ?><?php else: ?><img src="/store/skin/frontend/default/patio_theme/images/category-photo.jpg" class="category-image" alt="collection" /><?php endif; ?></a> </div> <?php echo '<pre>'.print_r($_category->getData()).'</pre>';?> </div> <?php endif; ?> <?php endforeach ?> <?php endif; ?>

    Read the article

  • Using VBA / Macro to highlight changes in excel

    - by Zaj
    I have a spread sheet that I send out to various locations to have information on it updated and then sent back to me. However, I had to put validation and lock the cells to force users to input accurate information. Then I can to use VBA to disable the work around of cut copy and paste functions. And additionally I inserted a VBA function to force users to open the excel file in Macros. Now I'm trying to track the changes so that I know what was updated when I recieve the sheet back. However everytime i do this I get an error when someone savesthe document and randomly it will lock me out of the document completely. I have my code pasted below, can some one help me create code in the VBA forum to highlight changes instead of through excel's share/track changes option? ThisWorkbook (Code): Option Explicit Const WelcomePage = "Macros" Private Sub Workbook_BeforeClose(Cancel As Boolean) Call ToggleCutCopyAndPaste(True) 'Turn off events to prevent unwanted loops Application.EnableEvents = False 'Evaluate if workbook is saved and emulate default propmts With ThisWorkbook If Not .Saved Then Select Case MsgBox("Do you want to save the changes you made to '" & .Name & "'?", _ vbYesNoCancel + vbExclamation) Case Is = vbYes 'Call customized save routine Call CustomSave Case Is = vbNo 'Do not save Case Is = vbCancel 'Set up procedure to cancel close Cancel = True End Select End If 'If Cancel was clicked, turn events back on and cancel close, 'otherwise close the workbook without saving further changes If Not Cancel = True Then .Saved = True Application.EnableEvents = True .Close savechanges:=False Else Application.EnableEvents = True End If End With End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 'Turn off events to prevent unwanted loops Application.EnableEvents = False 'Call customized save routine and set workbook's saved property to true '(To cancel regular saving) Call CustomSave(SaveAsUI) Cancel = True 'Turn events back on an set saved property to true Application.EnableEvents = True ThisWorkbook.Saved = True End Sub Private Sub Workbook_Open() Call ToggleCutCopyAndPaste(False) 'Unhide all worksheets Application.ScreenUpdating = False Call ShowAllSheets Application.ScreenUpdating = True End Sub Private Sub CustomSave(Optional SaveAs As Boolean) Dim ws As Worksheet, aWs As Worksheet, newFname As String 'Turn off screen flashing Application.ScreenUpdating = False 'Record active worksheet Set aWs = ActiveSheet 'Hide all sheets Call HideAllSheets 'Save workbook directly or prompt for saveas filename If SaveAs = True Then newFname = Application.GetSaveAsFilename( _ fileFilter:="Excel Files (*.xls), *.xls") If Not newFname = "False" Then ThisWorkbook.SaveAs newFname Else ThisWorkbook.Save End If 'Restore file to where user was Call ShowAllSheets aWs.Activate 'Restore screen updates Application.ScreenUpdating = True End Sub Private Sub HideAllSheets() 'Hide all worksheets except the macro welcome page Dim ws As Worksheet Worksheets(WelcomePage).Visible = xlSheetVisible For Each ws In ThisWorkbook.Worksheets If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVeryHidden Next ws Worksheets(WelcomePage).Activate End Sub Private Sub ShowAllSheets() 'Show all worksheets except the macro welcome page Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If Not ws.Name = WelcomePage Then ws.Visible = xlSheetVisible Next ws Worksheets(WelcomePage).Visible = xlSheetVeryHidden End Sub Private Sub Workbook_Activate() Call ToggleCutCopyAndPaste(False) End Sub Private Sub Workbook_Deactivate() Call ToggleCutCopyAndPaste(True) End Sub This is in my ModuleCode: Option Explicit Sub ToggleCutCopyAndPaste(Allow As Boolean) 'Activate/deactivate cut, copy, paste and pastespecial menu items Call EnableMenuItem(21, Allow) ' cut Call EnableMenuItem(19, Allow) ' copy Call EnableMenuItem(22, Allow) ' paste Call EnableMenuItem(755, Allow) ' pastespecial 'Activate/deactivate drag and drop ability Application.CellDragAndDrop = Allow 'Activate/deactivate cut, copy, paste and pastespecial shortcut keys With Application Select Case Allow Case Is = False .OnKey "^c", "CutCopyPasteDisabled" .OnKey "^v", "CutCopyPasteDisabled" .OnKey "^x", "CutCopyPasteDisabled" .OnKey "+{DEL}", "CutCopyPasteDisabled" .OnKey "^{INSERT}", "CutCopyPasteDisabled" Case Is = True .OnKey "^c" .OnKey "^v" .OnKey "^x" .OnKey "+{DEL}" .OnKey "^{INSERT}" End Select End With End Sub Sub EnableMenuItem(ctlId As Integer, Enabled As Boolean) 'Activate/Deactivate specific menu item Dim cBar As CommandBar Dim cBarCtrl As CommandBarControl For Each cBar In Application.CommandBars If cBar.Name <> "Clipboard" Then Set cBarCtrl = cBar.FindControl(ID:=ctlId, recursive:=True) If Not cBarCtrl Is Nothing Then cBarCtrl.Enabled = Enabled End If Next End Sub Sub CutCopyPasteDisabled() 'Inform user that the functions have been disabled MsgBox " Cutting, copying and pasting have been disabled in this workbook. Please hard key in data. " End Sub

    Read the article

  • Windows Azure Service Bus Splitter and Aggregator

    - by Alan Smith
    This article will cover basic implementations of the Splitter and Aggregator patterns using the Windows Azure Service Bus. The content will be included in the next release of the “Windows Azure Service Bus Developer Guide”, along with some other patterns I am working on. I’ve taken the pattern descriptions from the book “Enterprise Integration Patterns” by Gregor Hohpe. I bought a copy of the book in 2004, and recently dusted it off when I started to look at implementing the patterns on the Windows Azure Service Bus. Gregor has also presented an session in 2011 “Enterprise Integration Patterns: Past, Present and Future” which is well worth a look. I’ll be covering more patterns in the coming weeks, I’m currently working on Wire-Tap and Scatter-Gather. There will no doubt be a section on implementing these patterns in my “SOA, Connectivity and Integration using the Windows Azure Service Bus” course. There are a number of scenarios where a message needs to be divided into a number of sub messages, and also where a number of sub messages need to be combined to form one message. The splitter and aggregator patterns provide a definition of how this can be achieved. This section will focus on the implementation of basic splitter and aggregator patens using the Windows Azure Service Bus direct programming model. In BizTalk Server receive pipelines are typically used to implement the splitter patterns, with sequential convoy orchestrations often used to aggregate messages. In the current release of the Service Bus, there is no functionality in the direct programming model that implements these patterns, so it is up to the developer to implement them in the applications that send and receive messages. Splitter A message splitter takes a message and spits the message into a number of sub messages. As there are different scenarios for how a message can be split into sub messages, message splitters are implemented using different algorithms. The Enterprise Integration Patterns book describes the splatter pattern as follows: How can we process a message if it contains multiple elements, each of which may have to be processed in a different way? Use a Splitter to break out the composite message into a series of individual messages, each containing data related to one item. The Enterprise Integration Patterns website provides a description of the Splitter pattern here. In some scenarios a batch message could be split into the sub messages that are contained in the batch. The splitting of a message could be based on the message type of sub-message, or the trading partner that the sub message is to be sent to. Aggregator An aggregator takes a stream or related messages and combines them together to form one message. The Enterprise Integration Patterns book describes the aggregator pattern as follows: How do we combine the results of individual, but related messages so that they can be processed as a whole? Use a stateful filter, an Aggregator, to collect and store individual messages until a complete set of related messages has been received. Then, the Aggregator publishes a single message distilled from the individual messages. The Enterprise Integration Patterns website provides a description of the Aggregator pattern here. A common example of the need for an aggregator is in scenarios where a stream of messages needs to be combined into a daily batch to be sent to a legacy line-of-business application. The BizTalk Server EDI functionality provides support for batching messages in this way using a sequential convoy orchestration. Scenario The scenario for this implementation of the splitter and aggregator patterns is the sending and receiving of large messages using a Service Bus queue. In the current release, the Windows Azure Service Bus currently supports a maximum message size of 256 KB, with a maximum header size of 64 KB. This leaves a safe maximum body size of 192 KB. The BrokeredMessage class will support messages larger than 256 KB; in fact the Size property is of type long, implying that very large messages may be supported at some point in the future. The 256 KB size restriction is set in the service bus components that are deployed in the Windows Azure data centers. One of the ways of working around this size restriction is to split large messages into a sequence of smaller sub messages in the sending application, send them via a queue, and then reassemble them in the receiving application. This scenario will be used to demonstrate the pattern implementations. Implementation The splitter and aggregator will be used to provide functionality to send and receive large messages over the Windows Azure Service Bus. In order to make the implementations generic and reusable they will be implemented as a class library. The splitter will be implemented in the LargeMessageSender class and the aggregator in the LargeMessageReceiver class. A class diagram showing the two classes is shown below. Implementing the Splitter The splitter will take a large brokered message, and split the messages into a sequence of smaller sub-messages that can be transmitted over the service bus messaging entities. The LargeMessageSender class provides a Send method that takes a large brokered message as a parameter. The implementation of the class is shown below; console output has been added to provide details of the splitting operation. public class LargeMessageSender {     private static int SubMessageBodySize = 192 * 1024;     private QueueClient m_QueueClient;       public LargeMessageSender(QueueClient queueClient)     {         m_QueueClient = queueClient;     }       public void Send(BrokeredMessage message)     {         // Calculate the number of sub messages required.         long messageBodySize = message.Size;         int nrSubMessages = (int)(messageBodySize / SubMessageBodySize);         if (messageBodySize % SubMessageBodySize != 0)         {             nrSubMessages++;         }           // Create a unique session Id.         string sessionId = Guid.NewGuid().ToString();         Console.WriteLine("Message session Id: " + sessionId);         Console.Write("Sending {0} sub-messages", nrSubMessages);           Stream bodyStream = message.GetBody<Stream>();         for (int streamOffest = 0; streamOffest < messageBodySize;             streamOffest += SubMessageBodySize)         {                                     // Get the stream chunk from the large message             long arraySize = (messageBodySize - streamOffest) > SubMessageBodySize                 ? SubMessageBodySize : messageBodySize - streamOffest;             byte[] subMessageBytes = new byte[arraySize];             int result = bodyStream.Read(subMessageBytes, 0, (int)arraySize);             MemoryStream subMessageStream = new MemoryStream(subMessageBytes);               // Create a new message             BrokeredMessage subMessage = new BrokeredMessage(subMessageStream, true);             subMessage.SessionId = sessionId;               // Send the message             m_QueueClient.Send(subMessage);             Console.Write(".");         }         Console.WriteLine("Done!");     }} The LargeMessageSender class is initialized with a QueueClient that is created by the sending application. When the large message is sent, the number of sub messages is calculated based on the size of the body of the large message. A unique session Id is created to allow the sub messages to be sent as a message session, this session Id will be used for correlation in the aggregator. A for loop in then used to create the sequence of sub messages by creating chunks of data from the stream of the large message. The sub messages are then sent to the queue using the QueueClient. As sessions are used to correlate the messages, the queue used for message exchange must be created with the RequiresSession property set to true. Implementing the Aggregator The aggregator will receive the sub messages in the message session that was created by the splitter, and combine them to form a single, large message. The aggregator is implemented in the LargeMessageReceiver class, with a Receive method that returns a BrokeredMessage. The implementation of the class is shown below; console output has been added to provide details of the splitting operation.   public class LargeMessageReceiver {     private QueueClient m_QueueClient;       public LargeMessageReceiver(QueueClient queueClient)     {         m_QueueClient = queueClient;     }       public BrokeredMessage Receive()     {         // Create a memory stream to store the large message body.         MemoryStream largeMessageStream = new MemoryStream();           // Accept a message session from the queue.         MessageSession session = m_QueueClient.AcceptMessageSession();         Console.WriteLine("Message session Id: " + session.SessionId);         Console.Write("Receiving sub messages");           while (true)         {             // Receive a sub message             BrokeredMessage subMessage = session.Receive(TimeSpan.FromSeconds(5));               if (subMessage != null)             {                 // Copy the sub message body to the large message stream.                 Stream subMessageStream = subMessage.GetBody<Stream>();                 subMessageStream.CopyTo(largeMessageStream);                   // Mark the message as complete.                 subMessage.Complete();                 Console.Write(".");             }             else             {                 // The last message in the sequence is our completeness criteria.                 Console.WriteLine("Done!");                 break;             }         }                     // Create an aggregated message from the large message stream.         BrokeredMessage largeMessage = new BrokeredMessage(largeMessageStream, true);         return largeMessage;     } }   The LargeMessageReceiver initialized using a QueueClient that is created by the receiving application. The receive method creates a memory stream that will be used to aggregate the large message body. The AcceptMessageSession method on the QueueClient is then called, which will wait for the first message in a message session to become available on the queue. As the AcceptMessageSession can throw a timeout exception if no message is available on the queue after 60 seconds, a real-world implementation should handle this accordingly. Once the message session as accepted, the sub messages in the session are received, and their message body streams copied to the memory stream. Once all the messages have been received, the memory stream is used to create a large message, that is then returned to the receiving application. Testing the Implementation The splitter and aggregator are tested by creating a message sender and message receiver application. The payload for the large message will be one of the webcast video files from http://www.cloudcasts.net/, the file size is 9,697 KB, well over the 256 KB threshold imposed by the Service Bus. As the splitter and aggregator are implemented in a separate class library, the code used in the sender and receiver console is fairly basic. The implementation of the main method of the sending application is shown below.   static void Main(string[] args) {     // Create a token provider with the relevant credentials.     TokenProvider credentials =         TokenProvider.CreateSharedSecretTokenProvider         (AccountDetails.Name, AccountDetails.Key);       // Create a URI for the serivce bus.     Uri serviceBusUri = ServiceBusEnvironment.CreateServiceUri         ("sb", AccountDetails.Namespace, string.Empty);       // Create the MessagingFactory     MessagingFactory factory = MessagingFactory.Create(serviceBusUri, credentials);       // Use the MessagingFactory to create a queue client     QueueClient queueClient = factory.CreateQueueClient(AccountDetails.QueueName);       // Open the input file.     FileStream fileStream = new FileStream(AccountDetails.TestFile, FileMode.Open);       // Create a BrokeredMessage for the file.     BrokeredMessage largeMessage = new BrokeredMessage(fileStream, true);       Console.WriteLine("Sending: " + AccountDetails.TestFile);     Console.WriteLine("Message body size: " + largeMessage.Size);     Console.WriteLine();         // Send the message with a LargeMessageSender     LargeMessageSender sender = new LargeMessageSender(queueClient);     sender.Send(largeMessage);       // Close the messaging facory.     factory.Close();  } The implementation of the main method of the receiving application is shown below. static void Main(string[] args) {       // Create a token provider with the relevant credentials.     TokenProvider credentials =         TokenProvider.CreateSharedSecretTokenProvider         (AccountDetails.Name, AccountDetails.Key);       // Create a URI for the serivce bus.     Uri serviceBusUri = ServiceBusEnvironment.CreateServiceUri         ("sb", AccountDetails.Namespace, string.Empty);       // Create the MessagingFactory     MessagingFactory factory = MessagingFactory.Create(serviceBusUri, credentials);       // Use the MessagingFactory to create a queue client     QueueClient queueClient = factory.CreateQueueClient(AccountDetails.QueueName);       // Create a LargeMessageReceiver and receive the message.     LargeMessageReceiver receiver = new LargeMessageReceiver(queueClient);     BrokeredMessage largeMessage = receiver.Receive();       Console.WriteLine("Received message");     Console.WriteLine("Message body size: " + largeMessage.Size);       string testFile = AccountDetails.TestFile.Replace(@"\In\", @"\Out\");     Console.WriteLine("Saving file: " + testFile);       // Save the message body as a file.     Stream largeMessageStream = largeMessage.GetBody<Stream>();     largeMessageStream.Seek(0, SeekOrigin.Begin);     FileStream fileOut = new FileStream(testFile, FileMode.Create);     largeMessageStream.CopyTo(fileOut);     fileOut.Close();       Console.WriteLine("Done!"); } In order to test the application, the sending application is executed, which will use the LargeMessageSender class to split the message and place it on the queue. The output of the sender console is shown below. The console shows that the body size of the large message was 9,929,365 bytes, and the message was sent as a sequence of 51 sub messages. When the receiving application is executed the results are shown below. The console application shows that the aggregator has received the 51 messages from the message sequence that was creating in the sending application. The messages have been aggregated to form a massage with a body of 9,929,365 bytes, which is the same as the original large message. The message body is then saved as a file. Improvements to the Implementation The splitter and aggregator patterns in this implementation were created in order to show the usage of the patterns in a demo, which they do quite well. When implementing these patterns in a real-world scenario there are a number of improvements that could be made to the design. Copying Message Header Properties When sending a large message using these classes, it would be great if the message header properties in the message that was received were copied from the message that was sent. The sending application may well add information to the message context that will be required in the receiving application. When the sub messages are created in the splitter, the header properties in the first message could be set to the values in the original large message. The aggregator could then used the values from this first sub message to set the properties in the message header of the large message during the aggregation process. Using Asynchronous Methods The current implementation uses the synchronous send and receive methods of the QueueClient class. It would be much more performant to use the asynchronous methods, however doing so may well affect the sequence in which the sub messages are enqueued, which would require the implementation of a resequencer in the aggregator to restore the correct message sequence. Handling Exceptions In order to keep the code readable no exception handling was added to the implementations. In a real-world scenario exceptions should be handled accordingly.

    Read the article

  • MySQL Query Select using sub-select takes too long

    - by True Soft
    I noticed something strange while executing a select from 2 tables: SELECT * FROM table_1 WHERE id IN ( SELECT id_element FROM table_2 WHERE column_2=3103); This query took approximatively 242 seconds. But when I executed the subquery SELECT id_element FROM table_2 WHERE column_2=3103 it took less than 0.002s (and resulted 2 rows). Then, when I did SELECT * FROM table_1 WHERE id IN (/* prev.result */) it was the same: 0.002s. I was wondering why MySQL is doing the first query like that, taking much more time than the last 2 queries separately? Is it an optimal solution for selecting something based from the results of a sub-query? Other details: table_1 has approx. 9000 rows, and table_2 has 90000 rows. After I added an index on column_2 from table_2, the first query took 0.15s.

    Read the article

  • MVVM && IOC && Sub-ViewModels

    - by Lee Treveil
    I have a ViewModel, it takes two parameters in the constructor that are of the same type: public class CustomerComparerViewModel { public CustomerComparerViewModel(CustomerViewModel customerViewModel1, CustomerViewModel customerViewModel2) { } } public class CustomerViewModel { public string FirstName { get; set; } public string LastName { get; set; } } If I wasn't using IOC I could just new up the viewmodel and pass the sub-viewmodels in. I could package the two viewmodels into one class and pass that into the constructor but if I had another viewmodel that only needed one CustomerViewModel I would need to pass in something that the viewmodel does not need. How do I go about dealing with this using IOC? I'm using Ninject btw. Thanks

    Read the article

  • How do I create sub-applications in Django?

    - by jamida
    I'm a Django newbie, but fairly experienced at programming. I have a set of related applications that I'd like to group into a sub-application but can not figure out how to get manage.py to do this for me. Ideally I'll end up with a structure like: project/ app/ subapp1/ subapp2/ I've tried: manage.py startapp app.subapp1 manage.py startapp app/subapp1 but this tells me that / and . are invalid characters for app names I've tried changing into the app directory and running ../manage.py subapp1 but that makes supapp1 at the top level. NOTE, I'm not trying to directly make a stand-alone application. I'm trying to do all this from within a project.

    Read the article

  • Create a sub menu in existing menu in Excel Shared Add-in

    - by Sathish
    Hi I am developing a Excel shared Add-in which has the menu called Custom which is created using Excel Macros. Now i want to create a submenu under the Custom menu using Csharp Shared Add -in. Iam using the below code for doing this but no help oStandardBar = oCommandBars["Custom"]; oCmdBarCtrl = oStandardBar.Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, Type.Missing, true); oCmdBarCtrl.Visible = false; oCmdBarCtrl.Caption = "Sub Menu1"; But it does not create a submenu, where as if i give "Help" in place of Custom i get the menu created. any work around for this?

    Read the article

  • Mysql Sub Select Query Optimization

    - by Matt
    I'm running a query daily to compile stats - but it seems really inefficient. This is the Query: SELECT a.id, tstamp, label_id, (SELECT author_id FROM b WHERE b.tid = a.id ORDER BY b.tstamp DESC LIMIT 1) AS author_id FROM a, b WHERE (status = '2' OR status = '3') AND category != 6 AND a.id = b.tid AND (b.type = 'C' OR b.type = 'R') AND a.tstamp1 BETWEEN {$timestamp_start} AND {$timestamp_end} ORDER BY b.tstamp DESC LIMIT 500 This query seems to run really slow. Apologies for the crap naming - I've been asked to not reveal the actual table names. The reason there is a sub select is because the outer select gets one row from the table a and it gets a row from table b. But also need to know the latest author_id from table b as well, so I run a subselect to return that one. I don't want to run another select inside a php loop - as that is also inefficient. It works correctly - I just need to find a much faster way of getting this data set.

    Read the article

  • How to eliminate a sub-directory level from all URLs in Website

    - by frank13
    I have a website and I just setup an os shopping cart (ie., Magento) I installed the cart in a sub-directory off the document root as /magento/ per the installation guidelines. So my web site cart's URL is http://mydomain.com/magento/ I have no public pages off the document root and I actually want my cart to be my home page -- in other words, I want http://mydomain.com/magento/ to resolve as http://mydomain.com/ Is it possible? Can I use mod-rewrite to make it happen? If so, can you suggest what the mod-rewrite directives would look like? Or is it simply a permanent redirect like: redirect 301 /magento http://mydomain.com/ Thanks.

    Read the article

  • NServiceBus persisting subscriptions in Pub/Sub sample

    - by Bogdan Nedelcu
    I want to figure out how I to set up the Pub/Sub sample from NServiceBus to work in the case of publisher malfunction. When I start the samples and accidentaly close the Subscribers, if I restart everything works fine. If however I kill the publisher and the subscriptions continue to work, if I restart the publisher, then it doesn't seem to know it has subscribers and doesn't post any messages. I added the config entry <MsmqSubscriptionStorageConfig Queue="subscriptions"/> but it seems to not function... I miss something. I googled about MsmqSubscriptionStorageConfig and DbSubscriptionStorageConfig but i didn't find a solution. Could someone point me in the right direction ?

    Read the article

  • What does sub error code 568 mean for Ldap Error 49 with Active Directory

    - by Dean Povey
    I am writing some Java code that authenticates to Active Directory using SASL GSSAPI. Mostly this code is working fine but for one user I am getting the response: javax.naming.AuthenticationException: [LDAP: error code 49 - 8 0090304: LdapErr: DSID-0C0904D1, comment: AcceptSecurityContext error, data 568, v1772 ] I know that 49 means this is an authentication failure, and that the relevant sub code is 568, but I am only aware of the following meanings for that data: 525 - user not found 52e - invalid credentials 530 - not permitted to logon at this time 532 - password expired 533 - account disabled 701 - account expired 773 - user must reset password So far I am unable to find an authorative source of these error codes from Microsoft (this list is pieced together from forum posts) and I can't find anything for that 568 error. Does anyone know what it means?

    Read the article

  • Sub-classing templated class without implementing pure virtual method

    - by LeopardSkinPillBoxHat
    I have the following class definition: template<typename QueueItemT> class QueueBC { protected: QueueBC() {}; virtual ~QueueBC() {}; private: virtual IItemBuf* constructItem(const QueueItemT& item) = 0; } I created the following sub-class: class MyQueue : public QueueBC<MyItemT> { public: MyQueue(); virtual ~MyQueue(); }; This compiles fine under VS2005, yet I haven't implemented constructItem() in the MyQueue class. Any idea why?

    Read the article

  • How to create sub category on Magento APi

    - by demonchand
    I am currently using Magento ver. 1.5.0.1. Can anyone tell me how do i create a sub category using soapv2. Here my code format category_data = { "name" => "LIGHTING", "is_active" => 1 } soap.call('catalogCategoryCreate',session,4,category_data,1, "include_in_menu") I got some errors when i run this code. : Attribute "include_in_menu" is required. (SOAP::FaultError) Is that any solution for this problem. Thanks.

    Read the article

  • Python re.sub MULTILINE caret match

    - by cdleary
    The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string... So what's going on when I get the following unexpected result? >>> import re >>> s = """// The quick brown fox. ... // Jumped over the lazy dog.""" >>> re.sub('^//', '', s, re.MULTILINE) ' The quick brown fox.\n// Jumped over the lazy dog.'

    Read the article

  • Elmah on MVC website with WordPress/php sub directory

    - by creativeincode
    I have created a website using ASP.NET MVC and use ELMAH for error handling, this works perfectly. After setting up a virtual directory on my website under /blog and adding the necessary WordPress php files and mysql db, I get the below error come up. Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified. I think this has something to do with the fact that ELMAH is applying itself to all sub-directories. Is there a way that I can tell ELMAH to ignore everything under /blog? Or is there a way to get around this? Thanks in advance.

    Read the article

  • Using sub filters/queries in Google App Engine

    - by fredrik
    Hi, I'm trying to use figure out how to sub query a query that uses a filter. From what I've figured out so far while using .filter() it changes the original query, that leads to a second .filter() would also have to match the first filter. I would like to make something like this: modules = data.Modules.all().filter('page = ', page.key()) modules.filter('name = ', 'Test') modules.filter('name = ', 'Test2') I can't get the "Test2" filter to work. The only solution I have at the moment is to make all new queries. data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test").get() data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test2").get() Or write the same as an GQL. But for me it seams quite stupid way to go. I've looked at using ancestors, but I don't quite understand it and honestly don't know if that's the way to go. Any ideas? ..fredrik

    Read the article

  • Show different sub-sets in edit view

    - by Martin R-L
    In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario: Let's assume an entity Product that have an association to ProductType. In a product edit view; how do I implement that only a sub-set of the product's properties are shown in an elegant and DRY way? Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)? Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned? Use one model, but implement different web controls (view strategies) (can it be done DRY?)? Something else entirely?

    Read the article

  • How to move sub-headings to under other headings in emacs org-mode

    - by Mittenchops
    My list looks like this: * TODAY ** TODO Item 1 ** TODO Item 2 * TOMORROW ** TODO Item 3 ** TODO Item 4 ...as a single list, based on some advice I received here. I'd like to move TODO Item 2 from under TODAY to under TOMORROW. The manual says: M-up M-down Move the item including subitems up/down (swap with previous/next item of same indentation). If the list is ordered, renumbering is automatic. But while I can change the places of Item 1 and Item 2, I cannot move Item 2 outside of the Today heading---I cannot move it down under TOMORROW to proceed Item 3. The buffer tells me: cannot move past superior level or buffer limit org mode What is the keystroke that lets me move sub-items "past superior level" to under new headings?

    Read the article

  • Sub-process /usr/bin/dpkg returned an error code (1)

    - by Delirium tremens
    I'm trying to find a parental control for Ubuntu that turns adult site words into *. I have tried webcontentcontrol (doesn't even ask me to set a password), mobicip (doesn't even get listed in package names). My family can see my adult bookmark names and that's really embarrassing. I tried sudo apt-get remove webcontentcontrol sudo apt-get -f install sudo apt-get upgrade sudo pkill webcontentcontrol sudo apt-get remove webcontentcontrol but still can't uninstall it. Googling for that error message resulted in a solution that is first said dangerous, later said wrong. After sudo apt-get remove webcontentcontrol, I always get the error message "Sub-process /usr/bin/dpkg returned an error code (1)". What should I do? The full error message is in brazilian portuguese. Should I post it anyway? I have just installed nanny, but while webcontentcontrol is installed, it doesn't load.

    Read the article

  • Show different sub-sets of a view model's properties in an edit view

    - by Martin R-L
    In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario: Let's assume an entity Product that have an association to ProductType. In a product edit view; how do I implement that only a sub-set of the product's properties are shown based on the ProductType association in an elegant and DRY way? I.e., different properties shall be shown for different values of a property of the ProductType. Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)? Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned? Use one model, but implement different web controls (view strategies) (can it be done DRY?)? Something else entirely?

    Read the article

  • Serelization of a class and its sub-class....

    - by Amit
    There is a main class having 2 subClasses(each represent separate entity) and all classes needs to be serialized.. how should I proceed ? My requirement is when I serelize MainClass, I should get the xml for each sub class and main class as well. Thanks in advance... and if my approach is incorrect... correct that as well.. Ex given below... class MainClass { SubClass1 objSubclass1 = null; SubClass2 objSubclass2 = null; public MainClass() { objSubclass1 = new SubClass1(); objSubclass2 = new SubClass2(); } [XmlElement("SubClass1")] public SubClass1 SubClass1 {get {return objSubclass1;} } [XmlElement("SubClass2")] public SubClass2 SubClass2 {get {return objSubclass2;} } } Class SubClass1 { Some properties here... } Class SubClass2 { Some properties here... }

    Read the article

  • Flex Import Class from a Module within a sub directory

    - by Tom
    I put some modules in a module folder. How do I import classes with the import statement when I'm in a sub folder? This won't work, not like classes which are in packages. modules/SomeModule.mxml <?xml version="1.0"?> <mx:Module> <mx:Script> <![CDATA[ import Fruit.Apple; ]]> </mx:Script> </mx:Module> Directory: . |-- Fruit |-- Apple.as |-- Modules |-- SomeModule.mxml `-- application.mxml

    Read the article

  • Diff tool that can compare sub-sections of files

    - by EvilPuppetMaster
    I'm looking for a diff tool that will allow me to compare just a sub-section of a file with a section of another file, or even of itself. Preferably eclipse based but will take all suggestions. Yes I know I can copy out the two sections into different files and compare those, but that is very tedious when you are trying to do a large amount of refactoring. Basically I'm trying to remove as much duplicated code as possible from a code base that is suffering from a great deal of ctrl-V 'inheritance' ;-) However the pasted parts have evolved apart a little over time.

    Read the article

  • How can i pass Twig sub parameter?

    - by aliocee
    hi, Help i cant pass my hash key to twig subroutine. here: foreach my $word (sort { $keywords{$a} <=> $keywords{$b} } keys (%keywords)) { my $t = XML::Twig->new( twig_roots => { 'Id' => \&insert($keywords{$word}) } ); $t->parse($docsums); sub insert { my($t, $id, $k)= @_; my $p = $id->text; my $query = "insert into pres (id, wid, p) values(DEFAULT, '$k', '$p')"; my $sql = $connect->prepare($query); $sql->execute( ); } } Thanks.

    Read the article

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