Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 77/174 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • SqlDataAdapter Update is not working in C# wih Sql Server

    - by Ahmed
    I am trying to save data from C# form to Sql server Northwind Orders database, I am only using CustomerID, OrderDate and ShippedDate for data entry. Following is the code to Form load and save button: private void Form1_Load(object sender, EventArgs e) { SetComb(); connectionString = ConfigurationManager.AppSettings["connectionString"]; sqlConnection = new SqlConnection(connectionString); String sqlSelect = "Select OrderID, CustomerID, OrderDate, ShippedDate from Orders"; sqlDataMaster = new SqlDataAdapter(sqlSelect, sqlConnection); sqlConnection.Open(); //=============================================================================== //--- Set up the INSERT Command //=============================================================================== sInsProcName = "prInsert_Order"; insertcommand = new SqlCommand(sInsProcName, sqlConnection); insertcommand.CommandType = CommandType.StoredProcedure; insertcommand.Parameters.Add(new SqlParameter("@nNewID", SqlDbType.Int, 0, ParameterDirection.Output, false, 0, 0, "OrderID", DataRowVersion.Default, null)); insertcommand.UpdatedRowSource = UpdateRowSource.OutputParameters; insertcommand.Parameters.Add(new SqlParameter("@sCustomerID", SqlDbType.NChar, 5,"CustomerID")); insertcommand.Parameters["@sCustomerID"].Value = cmbCust.SelectedValue; insertcommand.Parameters.Add(new SqlParameter("@dtOrderDate", SqlDbType.DateTime, 8,"OrderDate")); insertcommand.Parameters["@dtOrderDate"].Value = dtOrdDt.Text; insertcommand.Parameters.Add(new SqlParameter("@dtShipDate", SqlDbType.DateTime, 8,"ShippedDate")); insertcommand.Parameters["@dtShipDate"].Value = dtShipDt.Text; sqlDataMaster.InsertCommand = insertcommand; //=============================================================================== //--- Set up the UPDATE Command //=============================================================================== sUpdProcName = "prUpdate_Order"; updatecommand = new SqlCommand(sUpdProcName, sqlConnection); updatecommand.CommandType = CommandType.StoredProcedure; updatecommand.Parameters.Add(new SqlParameter("@nOrderID", SqlDbType.Int, 4, "OrderID")); updatecommand.Parameters.Add(new SqlParameter("@dtOrderDate", SqlDbType.DateTime, 8, "OrderDate")); updatecommand.Parameters.Add(new SqlParameter("@dtShipDate", SqlDbType.DateTime, 8, "ShippedDate")); sqlDataMaster.UpdateCommand = updatecommand; //=============================================================================== //--- Set up the DELETE Command //=============================================================================== sDelProcName = "prDelete_Order"; deletecommand = new SqlCommand(sDelProcName, sqlConnection); deletecommand.CommandType = CommandType.StoredProcedure; deletecommand.Parameters.Add(new SqlParameter("@nOrderID", SqlDbType.Int, 4, "OrderID")); sqlDataMaster.DeleteCommand = deletecommand; dt = new DataTable(); sqlDataMaster.FillSchema(dt, SchemaType.Source); ds = new DataSet(); ds.Tables.Add(dt); bs = new BindingSource(); bs.DataSource = ds.Tables[0]; } public void SetComb() { cmbCust.DataSource = dm.GetData("Select * from Customers order by CompanyName"); cmbCust.DisplayMember = "CompanyName"; cmbCust.ValueMember = "CustomerId"; cmbCust.Text = ""; } private void btnSave_Click(object sender, EventArgs e) { sqlDataMaster.Update((DataTable) bs.DataSource); } and Stored Procedures for Insert/Update/Delete set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[prInsert_Order] -- ALTER PROCEDURE prInsert_Order @sCustomerID CHAR(5), @dtOrderDate DATETIME, @dtShipDate DATETIME, @nNewID INT OUTPUT AS SET NOCOUNT ON INSERT INTO Orders (CustomerID, OrderDate, ShippedDate) VALUES (@sCustomerID, @dtOrderDate, @dtShipDate) SELECT @nNewID = SCOPE_IDENTITY() set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[prUpdate_Order] -- ALTER PROCEDURE prUpdate_Order @nOrderID INT, @dtOrderDate DATETIME, @dtShipDate DATETIME AS UPDATE Orders SET OrderDate = @dtOrderDate, ShippedDate = @dtShipDate WHERE OrderID = @nOrderID set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[prDelete_Order] -- ALTER PROCEDURE prDelete_Order @nOrderID INT AS DELETE Orders WHERE OrderID = @nOrderID In the form CustomerID is selected via combobox which has Display property of CustomerName and Value property of CustomerID. But when clicking save button it shows no error, but it also don't save anything in Orders Table of Northwind....dm.GetData is the method of my Data Access Layer class to just get the info and populate CustomerID combobox. Any help with the code is highly appreciated... Thanks Ahmed

    Read the article

  • Set Thunderbird "from" address by incoming "to" address

    - by user293698
    I have configured my email server to cache all email to my mailbox. So [email protected] and [email protected] go to one mailbox. Every forum, registration, and guy get their own address for sending me emails so I can deliver it to /dev/null if anyone start spamming. That's the working setup. Now the problem: If I reply to a message, then Thunderbird always sets my default Identity as sender. I know I can add additional identities, but I don't want to add every address. How can I configure when a email is sent to [email protected], I answer with [email protected].

    Read the article

  • Empty mails received from Plesk-driven server

    - by goreSplatter
    From my Plesk managed server I keep receiving emails addressed to the configured administrator (me). Nothing special there. These mails are sent from an empty sender with no body, no subject nor any other relevant headers. I have changed the server administrator's e-mail address to an alternate one which is then the recipient. The mails are sent at irregular intervals. With variations in the timestamp I get an email every 30 minutes. Then there's a break and two and a half hours later I get the same email. I already have turned of crond for more than a day to see if this is the source of the problem. On that server there is no "foreign" software running which would cause that behavior. I have no more guesses as to why this is happening. Any suggestions?

    Read the article

  • Exchange 2007 dropping attachments

    - by Martin
    We have a strange situation that I am trying to resolve. One of our users is reporting that some emails that contain attachments are not coming through to them. After some investigation it appears that they do infact recieve the emails but the attachment is missing. I check the message tracking logs and what appears to be happening is that the server recieves an email, which is then forwarded to the correct mailbox. A couple of minutes later another email, from the same sender is recieved - but this is much larger so I'm assuming contains the attachment. This email has the same messageId as the previous email and as a result appears not to be delivered to the users mailbox, instead being marked with an EventID of DUPLICATEDELIVER. An example of the message tracking results: http://img8.imageshack.us/img8/1025/clipboard01cq.jpg Can anyone shed any light on the situation?

    Read the article

  • Postfix - searching emails (logstash, greylog or other solution)

    - by Yarik Dot
    We are currently having ~100 servers and all of them are using remote syslog, so we have aggregated all logs on one server. The most questioned problem from our support team is: Has an email from .... to ... been delivered? I'd like to give to our support team access to some logging tool and some guide for searching in logs. What would you have recommended me? Or, do you know any other alternatives to test? The problem of grepping logs is that there is not sender and recipient address on one line. So I supposed, there might by some aggregation by email id.

    Read the article

  • Switch to another CPanel server, restore mailbox, how to stop Outlook POP3 pull mail data again.

    - by Shiro
    Hi, We switch from a linux CPanel server to another CPanel server, all the setting and file is restore back to the new Linux CPanel server. E.g [email protected] , inside the server I got 100mails. It had been downloaded to my Outlook, my outlook also got 100 mails inside. After I switch to new server, the 100 mail in the old server had been transfer to new server. However, when I open my Outlook, it start to download the 100 mails again, that means I got 200 mails in my mailbox and it is duplicated. How can I stop Outlook to download. The time stamp, receiver and sender is exactly the same. We want to keep a backup in the server, because we don't have a physical server to keep the mail. That why we would like to transfer the mailbox to the new server. Anyone have solution to stop Outlook download again?

    Read the article

  • C# Object Problem - Can't Solve It

    - by user612041
    I'm getting the error 'Object reference not set to an instance of an object'. I've tried looking at similar problems but genuinely cannot see what the problem is with my program. The line of code that I am having an error with is: labelQuestion.Text = table.Rows[0]["Question"].ToString(); Here is my code in its entirety: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; using System.Data.Sql; using System.Data.SqlClient; namespace Quiz_Test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } String chosenAnswer, correctAnswer; DataTable table; private void Form1_Load(object sender, EventArgs e) { //declare connection string using windows security string cnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Hannah\\Desktop\\QuizQuestions.accdb"; //declare Connection, command and other related objects OleDbConnection conGet = new OleDbConnection(cnString); OleDbCommand cmdGet = new OleDbCommand(); //try //{ //open connection conGet.Open(); //String correctAnswer; cmdGet.CommandType = CommandType.Text; cmdGet.Connection = conGet; cmdGet.CommandText = "SELECT * FROM QuizQuestions ORDER BY rnd()"; OleDbDataReader reader = cmdGet.ExecuteReader(); reader.Read(); labelQuestion.Text = table.Rows[0]["Question"].ToString(); radioButton1.Text = table.Rows[0]["Answer 1"].ToString(); radioButton2.Text = table.Rows[0]["Answer 2"].ToString(); radioButton3.Text = table.Rows[0]["Answer 3"].ToString(); radioButton4.Text = table.Rows[0]["Answer 4"].ToString(); correctAnswer = table.Rows[0]["Correct Answer"].ToString(); ; conGet.Close(); } private void btnSelect_Click(object sender, EventArgs e) { String cnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Hannah\\Desktop\\QuizQuestions.accdb"; //declare Connection, command and other related objects OleDbConnection conGet = new OleDbConnection(cnString); OleDbCommand cmdGet = new OleDbCommand(); //try { //open connection conGet.Open(); cmdGet.CommandType = CommandType.Text; cmdGet.Connection = conGet; cmdGet.CommandText = "SELECT * FROM QuizQuestions ORDER BY rnd()"; // select all columns in all rows OleDbDataReader reader = cmdGet.ExecuteReader(); reader.Read(); if (radioButton1.Checked) { chosenAnswer = reader["Answer 1"].ToString(); } else if (radioButton2.Checked) { chosenAnswer = reader["Answer 2"].ToString(); } else if (radioButton3.Checked) { chosenAnswer = reader["Answer 3"].ToString(); } else { chosenAnswer = reader["Answer 4"].ToString(); } if (chosenAnswer == reader["Correct Answer"].ToString()) { //chosenCorrectly++; MessageBox.Show("You have got this answer correct"); //label2.Text = "You have got " + chosenCorrectly + " answers correct"; } else { MessageBox.Show("That is not the correct answer"); } } } } } I realise the problem isn't too big but I can't see how my declaration timings are wrong

    Read the article

  • Is there any way to do "mail server parking"?

    - by percyboy
    I am managing a mail server, which will be temporarily closed for three or four days due to the data center maintenance. I want to find a solution to (completely or partly) solve the lost mails during this unavailable period. Because the data volume is huge, it is very hard to migrate it to other data center. One approach I think out is to setup a temporary mail server in other data center, and when new mail received, the mail server automatically sends a return mail to tell the sender "We are temporarily closed for three or four days. Please send the mail later or contact in other means." I am wondering is this approach possible with existed mail server ? Or something better available ? (free solution is preferred for it is only for temporary)

    Read the article

  • Auto-response on a mail non universal group

    - by russ
    Four domain users are part of global security group [email protected] running on Windows Server 2008 Standard and Exchange 2007 as a mail non universal group. Our goal is to create an auto-responder rule, or template that fires at sender. I have created a mail-enabled public folder, with owner permissions for each group member. I have also set up a rule template (response) and I am a little unclear as to the send as permission set, or where to set that up. Can someone please tell me if I am on the right track? Will I have to do each Outlook client machine (whole group!) the same?

    Read the article

  • CoreData, transient atribute and EXC_BAD_ACCESS.

    - by Lukasz
    I'm trying to build simple file browser and i'm stuck. I defined classes, build window, add controllers, views.. Everything works but only ONE time. Selecting again Folder in NSTableView or trying to get data from Folder.files causing silent EXC_BAD_ACCESS (code=13, address0x0) from main. Info about files i keep outside of CoreData, in simple class, I don't want to save them: #import <Foundation/Foundation.h> @interface TPDrawersFileInfo : NSObject @property (nonatomic, retain) NSString * filename; @property (nonatomic, retain) NSString * extension; @property (nonatomic, retain) NSDate * creation; @property (nonatomic, retain) NSDate * modified; @property (nonatomic, retain) NSNumber * isFile; @property (nonatomic, retain) NSNumber * size; @property (nonatomic, retain) NSNumber * label; +(TPDrawersFileInfo *) initWithURL: (NSURL *) url; @end @implementation TPDrawersFileInfo +(TPDrawersFileInfo *) initWithURL: (NSURL *) url { TPDrawersFileInfo * new = [[TPDrawersFileInfo alloc] init]; if (new!=nil) { NSFileManager * fileManager = [NSFileManager defaultManager]; NSError * error; NSDictionary * infoDict = [fileManager attributesOfItemAtPath: [url path] error:&error]; id labelValue = nil; [url getResourceValue:&labelValue forKey:NSURLLabelNumberKey error:&error]; new.label = labelValue; new.size = [infoDict objectForKey: @"NSFileSize"]; new.modified = [infoDict objectForKey: @"NSFileModificationDate"]; new.creation = [infoDict objectForKey: @"NSFileCreationDate"]; new.isFile = [NSNumber numberWithBool:[[infoDict objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeRegular"]]; new.extension = [url pathExtension]; new.filename = [[url lastPathComponent] stringByDeletingPathExtension]; } return new; } Next I have class Folder, which is NSManagesObject subclass // Managed Object class to keep info about folder content @interface Folder : NSManagedObject { NSArray * _files; } @property (nonatomic, retain) NSArray * files; // Array with TPDrawersFileInfo objects @property (nonatomic, retain) NSString * url; // url of folder -(void) reload; //if url changed, load file info again. @end @implementation Folder @synthesize files = _files; @dynamic url; -(void)awakeFromInsert { [self addObserver:self forKeyPath:@"url" options:NSKeyValueObservingOptionNew context:@"url"]; } -(void)awakeFromFetch { [self addObserver:self forKeyPath:@"url" options:NSKeyValueObservingOptionNew context:@"url"]; } -(void)prepareForDeletion { [self removeObserver:self forKeyPath:@"url"]; } -(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context == @"url") { [self reload]; } } -(void) reload { NSMutableArray * result = [NSMutableArray array]; NSError * error = nil; NSFileManager * fileManager = [NSFileManager defaultManager]; NSString * percented = [self.url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSArray * listDir = [fileManager contentsOfDirectoryAtURL: [NSURL URLWithString: percented] includingPropertiesForKeys: [NSArray arrayWithObject: NSURLCreationDateKey ] options:NSDirectoryEnumerationSkipsHiddenFiles error:&error]; if (error!=nil) {NSLog(@"Error <%@> reading <%@> content", error, self.url);} for (id fileURL in listDir) { TPDrawersFileInfo * fi = [TPDrawersFileInfo initWithURL:fileURL]; [result addObject: fi]; } _files = [NSArray arrayWithArray:result]; } @end In app delegate i defined @interface TPAppDelegate : NSObject <NSApplicationDelegate> { IBOutlet NSArrayController * foldersController; Folder * currentFolder; } - (IBAction)chooseDirectory:(id)sender; // choose folder and - (Folder * ) getFolderObjectForPath: path { //gives Folder object if already exist or nil if not ..... } - (IBAction)chooseDirectory:(id)sender { //Opens panel, asking for url NSOpenPanel * panel = [NSOpenPanel openPanel]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:NO]; [panel setMessage:@"Choose folder to show:"]; NSURL * currentDirectory; if ([panel runModal] == NSOKButton) { currentDirectory = [[panel URLs] objectAtIndex:0]; } Folder * folderObject = [self getFolderObjectForPath:[currentDirectory path]]; if (folderObject) { //if exist: currentFolder = folderObject; } else { // create new one Folder * newFolder = [NSEntityDescription insertNewObjectForEntityForName:@"Folder" inManagedObjectContext:self.managedObjectContext]; [newFolder setValue:[currentDirectory path] forKey:@"url"]; [foldersController addObject:newFolder]; currentFolder = newFolder; } [foldersController setSelectedObjects:[NSArray arrayWithObject:currentFolder]]; } Please help ;)

    Read the article

  • Is there a way to get Postfix to both forward an e-mail *and* reject it via recipient_address_rejected

    - by Mac
    In postfix, I'd like a way to deal with e-mail accounts that are no longer active by having postfix send the standard "Recipient address rejected" type message, but still forwarding the e-mail to another user. Thus, if someone sends an e-mail to [email protected], it will bounce the message back to the sender for future reference, but the mail will still get forwarded to [email protected] to deal with. .vacation and / or .forward files let me down because they will either reply or forward, but not both. Any tips?

    Read the article

  • Calling popToRootViewControllerAnimated causing crash. How should I be doing this?

    - by Lewis42
    The app is for taking body measurements. The user can say I want to measure: legs, arms and neck, in the settings tab and in the main tab there is a view which loops round to take each measurement. This is achieved like so: i have tab controller the first tab has a navigation controller the first view controller on the storyboard and has one segue to itself the board loops round until it has all the measurements then it segues to a different controller the problem is: if the user changes which measurements they are taking in the settings tab, the first tab needs to completely reload, as if the app was just starting up, clearing down the whole nav stack etc. at the moment the tab controller calls popToRootViewControllerAnimated on the navigation controller in the measurements tab, but this is causing a crash. Each screen has a slider control and a call to titleForRow:forComponent: is being called on a deleted view causing it to crash. What am I doing wrong?! Here's the tab bar controller code // TabBarController.m // #import "TabBarController.h" #import "TodaysMeasurementObject.h" #import "AppDelegateProtocol.h" #import "AddMeasurementViewController.h" #import "ReadPerson.h" #import "AppDelegate.h" @interface TabBarController () <UITabBarControllerDelegate> @end @implementation TabBarController bool resetWizardView = false; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.delegate = self; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(measurementsSettingsUpdated:) name:@"MeasurementsSettingsUpdated" object:nil]; } - (void) measurementsSettingsUpdated:(NSNotification *) notification { // UINavigationController *navigationController = [self.viewControllers objectAtIndex:0]; // AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; // [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; resetWizardView = YES; } - (void) viewDidAppear:(BOOL)animated { if (![ReadPerson userHasRecords]) { [self setSelectedIndex:3]; } } - (void)orientationChanged:(NSNotification *)notification { // We must add a delay here, otherwise we'll swap in the new view // too quickly and we'll get an animation glitch [self performSelector:@selector(showGraphs) withObject:nil afterDelay:0]; } - (void)showGraphs { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (deviceOrientation == UIDeviceOrientationLandscapeLeft && !isShowingLandscapeView) { [self performSegueWithIdentifier: @"toGraph" sender: self]; isShowingLandscapeView = YES; } else if (deviceOrientation != UIDeviceOrientationLandscapeLeft && isShowingLandscapeView) { [self dismissModalViewControllerAnimated:YES]; isShowingLandscapeView = NO; } } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationLandscapeRight) { [self performSegueWithIdentifier: @"toGraph" sender: self]; } return false; } - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { int tbi = tabBarController.selectedIndex; if (tbi == 0) { [[viewController view] setNeedsDisplay]; if (resetWizardView) { [(UINavigationController*)[self.viewControllers objectAtIndex:0] popToRootViewControllerAnimated: NO]; // ******* POP CALLED HERE ****** resetWizardView = false; } } } - (TodaysMeasurementObject*) theAppDataObject { id<AppDelegateProtocol> theDelegate = (id<AppDelegateProtocol>) [UIApplication sharedApplication].delegate; TodaysMeasurementObject* theDataObject; theDataObject = (TodaysMeasurementObject*) theDelegate.theAppDataObject; return theDataObject; } - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } @end UPDATED - (void) measurementsSettingsUpdated:(NSNotification *) notification { NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray: self.viewControllers]; UINavigationController *navigationController = [viewControllers objectAtIndex:0]; AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; [viewControllers setObject:navigationController atIndexedSubscript:0]; self.viewControllers = viewControllers; } and removed the code from - tabBarController:didSelectViewController: but still the same error. I think the problem is that it's trying to get a value for the slide control after the view has been deleted. But some part of the view must still be alive...? Anyway to kill that off? Or leave it all alive??

    Read the article

  • Subscribing message sent from another application

    - by tonga
    I have two Java applications: AppOne and AppTwo. In AppOne, I used a JMS sender to publish a Topic. In both AppOne and AppTwo, I used a JMS MessageListener to subscribe to the message published by AppOne. I used ActiveMQ as my JMS broker and Spring JMS. However, I can only see the echoed message received by AppOne message listener. But I can't see the echoed message received by AppTwo listener. AppOne message listener is in the same application/project as the message publisher. But AppTwo message listener is in a different application/project. The AppOne listener class is: public class CustomerStatusListener implements MessageListener { public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("Subscriber 1 got you! The message is: " + ((TextMessage) message).getText()); } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException("Message must be of type TextMessage"); } } } It is invoked by a test calss JmsTest in AppOne: public class JmsTest { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("message-bean.xml"); CustomerStatusSender messageSender = (CustomerStatusSender) context.getBean("customerMessageSender"); messageSender.simpleSend(); context.close(); } } The AppTwo listener class is: public class CustomerStatusMessageListener implements MessageListener { public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("Subscriber 2 got you! The message is: " + ((TextMessage) message).getText()); } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException( "Message must be of type TextMessage"); } } } The bean definition file for AppTwo where the Subscriber 2 lives in is: <bean id="connectionFactoryBean" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> </bean> <!-- this is the Message Driven POJO (MDP) --> <bean id="customerStatusListener" class="com.mydomain.jms.CustomerStatusMessageListener" /> <!-- and this is the message listener container --> <bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactoryBean" /> <property name="destination" ref="topicBean" /> <property name="messageListener" ref="customerStatusListener" /> </bean> The bean id topicBean is the bean that is associated with the publisher. If both listener received the message sent from AppOne, I would have seen two echoed messages: Subscriber 1 got you! The message is: hello world Subscriber 2 got you! The message is: hello world But right now I only see the first line which means only the listener in AppOne got the message. So how to let the listener in AppTwo get the message? The first listener is in the same application as the sender, so it is easy to understand that it can get the message. But how about the second listener which is in a different application? What is the correct way to subscribe to a JMS Topic published in another application?

    Read the article

  • DKIM sign any outgoing mail as the same domain. is possibly?

    - by Felipe Alcacibar
    I have a website, and the users recommend via email to another persons, so the mail come from my site, but I need to appear the user as sender, but "via" mydomain. The logically and what lists management software and companies do is differ the "MAIL FROM" SMTP command and the "From" header (like mailchimp, for example). So I want to DKIM sign a mail with mydomain.com, even if the From header says another domain. is possibly this? I am using postfix with Debian GNU/Linux, and in this case using dkim-filter and dk-filter.

    Read the article

  • Serious problem with WCF, GridViews, Callbacks and ExecuteReaders exceptions.

    - by barjed
    Hi, I have this problem that is driving me insane. I have a project to deliver before Thursday. Basically an app consiting of three components that communicate with each other in WCF. I have one console app and one Windows Forms app. The console app is a server that's connected to the database. You can add records to it via the Windows Forms client that connectes with the server through the WCF. The code for the client: namespace BankAdministratorClient { [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Single, UseSynchronizationContext = false)] public partial class Form1 : Form, BankServverReference.BankServerCallback { private BankServverReference.BankServerClient server = null; private SynchronizationContext interfaceContext = null; public Form1() { InitializeComponent(); interfaceContext = SynchronizationContext.Current; server = new BankServverReference.BankServerClient(new InstanceContext(this), "TcpBinding"); server.Open(); server.Subscribe(); refreshGridView(""); } public void refreshClients(string s) { SendOrPostCallback callback = delegate(object state) { refreshGridView(s); }; interfaceContext.Post(callback, s); } public void refreshGridView(string s) { try { userGrid.DataSource = server.refreshDatabaseConnection().Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void buttonAdd_Click(object sender, EventArgs e) { server.addNewAccount(Int32.Parse(inputPIN.Text), Int32.Parse(inputBalance.Text)); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { server.Unsubscribe(); server.Close(); }catch{} } } } The code for the server: namespace SSRfinal_tcp { class Program { static void Main(string[] args) { Console.WriteLine(MessageHandler.dataStamp("The server is starting up")); using (ServiceHost server = new ServiceHost(typeof(BankServer))) { server.Open(); Console.WriteLine(MessageHandler.dataStamp("The server is running")); Console.ReadKey(); } } } [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerCall, IncludeExceptionDetailInFaults = true)] public class BankServer : IBankServerService { private static DatabaseLINQConnectionDataContext database = new DatabaseLINQConnectionDataContext(); private static List<IBankServerServiceCallback> subscribers = new List<IBankServerServiceCallback>(); public void Subscribe() { try { IBankServerServiceCallback callback = OperationContext.Current.GetCallbackChannel<IBankServerServiceCallback>(); if (!subscribers.Contains(callback)) subscribers.Add(callback); Console.WriteLine(MessageHandler.dataStamp("A new Bank Administrator has connected")); } catch { Console.WriteLine(MessageHandler.dataStamp("A Bank Administrator has failed to connect")); } } public void Unsubscribe() { try { IBankServerServiceCallback callback = OperationContext.Current.GetCallbackChannel<IBankServerServiceCallback>(); if (subscribers.Contains(callback)) subscribers.Remove(callback); Console.WriteLine(MessageHandler.dataStamp("A Bank Administrator has been signed out from the connection list")); } catch { Console.WriteLine(MessageHandler.dataStamp("A Bank Administrator has failed to sign out from the connection list")); } } public DataSet refreshDatabaseConnection() { var q = from a in database.GetTable<Account>() select a; DataTable dt = q.toTable(rec => new object[] { q }); DataSet data = new DataSet(); data.Tables.Add(dt); Console.WriteLine(MessageHandler.dataStamp("A Bank Administrator has requested a database data listing refresh")); return data; } public void addNewAccount(int pin, int balance) { Account acc = new Account() { PIN = pin, Balance = balance, IsApproved = false }; database.Accounts.InsertOnSubmit(acc); database.SubmitChanges(); database.addNewAccount(pin, balance, false); subscribers.ForEach(delegate(IBankServerServiceCallback callback) { callback.refreshClients("New operation is pending approval."); }); } } } This is really simple and it works for a single window. However, when you open multiple instances of the client window and try to add a new record, the windows that is performing the insert operation crashes with the ExecuteReader error and the " requires an open and available connection. the connection's current state is connecting" bla bla stuff. I have no idea what's going on. Please advise.

    Read the article

  • where is this SPF problem occuring

    - by Saif Khan
    Hi, Inbound mail to a specific user is been forwarded to his external mailbox at another domain. Add mails are routed correctly with the exception of one domain. When mail are sent to users of my domain, including that user, the mails are delivered to everyone except him...as the mail admin I am getting the message The following recipient(s) cannot be reached: usermailbox on 1/10/2011 1:27 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. email.speedimpex.com #5.5.0 smtp;587 [email protected] sender domain does not match SPF records I am sure this has nothing to do with my mail server, however, can someone confirm?

    Read the article

  • How does a frame retrieve the recipient's MAC address?

    - by Sarmen B.
    I am studying a Network+ book named All-in-one CompTia Network+ by Mike Meyers. In chapter 2 he talks about frames and how he represents them as canisters and the data within the frame contains the recipients mac address, senders mac address, data, and sequence number. What I don't understand is if the sender is sending a file via the network to the recipient, and this frame contains this data, how does the frame know what the recipients MAC address is before sending it? In regards to TCP/IP when it contains the recipients IP address, that's understandable how it retrieves that value. But I don't understand how it can retrieve the MAC address, because if that frame comes from the senders computer, goes into the router and copies itself to each and every computer that exists on the network, how did it have the MAC address to know where to go? Let me know if I'm not making sense.

    Read the article

  • CSS + jQuery - Unable to perform .toggle() and repeated jQueryTemplate Item [I must warn you this is a bit overwhelming]

    - by user1027620
    Okay here we go: Stream.html (Template file) <div class="streamItem clearfix"> <input type="button" /> <div class="clientStrip"> <img src="" alt="${Sender}" /> </div> <div class="clientView"> <a href="#" class="clientName">${Sender}</a> <p>${Value}</p> <p>${DateTime}</p> <div class="itemGadgets"> <ul> <li class="toggleInput">Value</li> <li></li> </ul> </div> <div class="inputContainer"> <input type="text" value="" /> </div> </div> </div> <div class="spacer" /> Default.aspx (jQuery) $('.toggleInput').live('click', function () { $(this).parent().parent() .find('.inputContainer').toggle(); $(this).parent().parent().find('.inputContainer') .find('input[type=text]').focus(); }); Update: The above has been changed to: $('.toggleInput').live('click', function () { $(this).closest(".clientView").find(".inputContainer").toggle() $(this).closest(".clientView").find(".inputContainer") .find('input[type=text]').focus(); }); Issues with jQuery: I have comments that belong to each .streamItem. My previous solution was to use ListView control as follows: <ItemTemplate> <asp:Panel ID="StreamItem" CssClass="StreamItem" runat="server"> ... <!-- Insert another nested ListView control here to load the comments for the parent stream. --> So as you can see, this is not a solution since I started using jQuery Templates and I am fetching the data using the following jQuery $.ajax method: $.ajax({ type: 'POST', url: 'Services.asmx/GetStream', data: "{}", contentType: 'application/json', success: function (Stream) { $.get('Templates/Stream.html', function (template) { $.tmpl(template, Stream.d).appendTo("#Stream"); }); } }); How can I resolve this without using the old ListView solution but by using jQuery Templates to load the comments whenever I am getting data for a specific stream? I am using a simple WebMethod to return my data as follows: [WebMethod] public List<Stream> GetStream() { List<Stream> Streams = Stream.GetRange(X, X, HttpContext.Current.User.Identity.Name); return Streams; } I am looking for a way to handle the .toggleInput click event. I need check if .Comments (a main container for the (to be comments container <div>)) has children (or more than one .commentItem). If so, then I need to show that .inputContainer and hide all the other .inputContainer divs with .Comments size() == 0 if they're visible. Please see the image below: Default.aspx (Partial CSS) div.streamItem div.clientView { float : left; width : 542px; } div.streamItem div.clientView p { margin : 5px 0 0 0; font-size : 10pt; } div.streamItem div.clientView div.inputContainer { display : none; /* Doesn't hide .inputContainer */ padding : 2px; background-color : #f1f1f1; } Issues with CSS: On page load, display: none; has no effect. That's it! If you're reading this I'd like to thank you for your time and thoughts! :)

    Read the article

  • listview not updating,inserting

    - by raging_boner
    Data entered in textboxes is not getting updated in database. In debug mode I see that textbox1 and textbox2 in ItemUpdating event contain the same values as they had before calling ItemUpdating. Here's my listview control: <asp:ListView ID="ListView1" runat="server" onitemediting="ListView1_ItemEditing" onitemupdating="ListView1_ItemUpdating" oniteminserting="ListView1_ItemInserting"> //LayoutTemplate removed <ItemTemplate> <td align="center" valign="top"> <asp:Label ID="Label2" runat="server" Text='<%#Eval("id")%>'></asp:Label><br /> <asp:Label ID="Label3" runat="server" Text='<%#Eval("text1")%>'></asp:Label> </td> <td> <asp:LinkButton ID="LinkButton2" CommandName="Edit" runat="server">Edit</asp:LinkButton> <asp:LinkButton ID="LinkButton4" CommandName="Delete" runat="server">Delete</asp:LinkButton> </td> </ItemTemplate> <EditItemTemplate> <td align="center" valign="top"> <asp:Label ID="Label1" runat="server" Text='<%#Eval("id")%>'></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Text='<%#Eval("text1")%>' TextMode="MultiLine" /> <asp:TextBox ID="TextBox2" runat="server" Text='<%#Eval("text2")%>' Height="100" TextMode="MultiLine" /> <asp:LinkButton ID="LinkButton1" CommandName="Update" CommandArgument='<%# Eval("id")%>' runat="server">Update</asp:LinkButton> <asp:LinkButton ID="LinkButton5" CommandName="Cancel" runat="server">Cancel</asp:LinkButton> </td> </EditItemTemplate> <InsertItemTemplate> <td align="center" valign="top"> <asp:TextBox ID="TextBox3" runat="server" TextMode="MultiLine" Height="100"></asp:TextBox> <asp:TextBox ID="TextBox4" runat="server" Height="100" TextMode="MultiLine"></asp:TextBox><br/> <asp:LinkButton ID="LinkButton3" runat="server">Insert</asp:LinkButton> </td> </InsertItemTemplate> </asp:ListView> Codebehind file: protected void ListView1_ItemEditing(object sender, ListViewEditEventArgs e) { ListView1.EditIndex = e.NewEditIndex; BindList(); } protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ListViewItem myItem = ListView1.Items[ListView1.EditIndex]; Label id = (Label)myItem.FindControl("Label1"); int dbid = int.Parse(id.Text); TextBox text1 = (TextBox)myItem.FindControl("Textbox1"); TextBox text2 = (TextBox)myItem.FindControl("Textbox2"); //tried to work withNewValues below, but they don't work, "null reference" error is being thrown //text1.Text = e.NewValues["text1"].ToString(); //text2.Text = e.NewValues["text2"].ToString(); //odbc connection routine removed. //i know that there should be odbc parameteres: comm = new OdbcCommand("UPDATE table SET text1 = '" + text1.Text + "', text2 = '" + text2.Text + "' WHERE id = '" + dbid + "'", connection); comm.ExecuteNonQuery(); conn.Close(); ListView1.EditIndex = -1; //here I databind ListView1 } What's wrong with updating of text1.Text, text2.Text in ItemUpdating event? Should I use e.NewValues property? If so, how to use it? Thanks in advance for any help.

    Read the article

  • Unable to get my master & details gridview to work.

    - by Javier
    I'm unable to get this to work. I'm very new at programming and would appreciate any help on this. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { } protected void DataGridSqlDataSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="DataGrid2SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:JobPostings1ConnectionString %>" SelectCommand="SELECT [Jobs_PK], [Position_Title], [Educ_Level], [Grade], [JP_Description], [Job_Status], [Position_ID] FROM [Jobs]" FilterExpression="Jobs_PK='@Jobs_PK'"> <filterparameters> <asp:ControlParameter Name="Jobs_PK" ControlId="GridView1" PropertyName="SelectedValue" /> </filterparameters> </asp:SqlDataSource> <asp:SqlDataSource ID="DataGridSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:JobPostings1ConnectionString %>" SelectCommand="SELECT [Position_Title], [Jobs_PK] FROM [Jobs]" onselecting="DataGridSqlDataSource_Selecting"> </asp:SqlDataSource> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Jobs_PK" DataSourceID="DataGridSqlDataSource" AllowPaging="True" AutoGenerateSelectButton="True" SelectedIndex="0" Width="100px"> <Columns> <asp:BoundField DataField="Position_Title" HeaderText="Position_Title" SortExpression="Position_Title" /> <asp:BoundField DataField="Jobs_PK" HeaderText="Jobs_PK" InsertVisible="False" ReadOnly="True" SortExpression="Jobs_PK" /> </Columns> </asp:GridView> <br /> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Jobs_PK" DataSourceID="DataGrid2SqlDataSource" Height="50px" Width="125px"> <Fields> <asp:BoundField DataField="Jobs_PK" HeaderText="Jobs_PK" InsertVisible="False" ReadOnly="True" SortExpression="Jobs_PK" /> <asp:BoundField DataField="Position_Title" HeaderText="Position_Title" SortExpression="Position_Title" /> <asp:BoundField DataField="Educ_Level" HeaderText="Educ_Level" SortExpression="Educ_Level" /> <asp:BoundField DataField="Grade" HeaderText="Grade" SortExpression="Grade" /> <asp:BoundField DataField="JP_Description" HeaderText="JP_Description" SortExpression="JP_Description" /> <asp:BoundField DataField="Job_Status" HeaderText="Job_Status" SortExpression="Job_Status" /> <asp:BoundField DataField="Position_ID" HeaderText="Position_ID" SortExpression="Position_ID" /> </Fields> </asp:DetailsView> </div> </form> </body> error message: Cannot perform '=' operation on System.Int32 and System.String. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.EvaluateException: Cannot perform '=' operation on System.Int32 and System.String.

    Read the article

  • why is my intent not useful?

    - by user1634887
    This is my first to ask here. I write the code for a Broadcast A start another Broadcast B. But the Broadcast B didn't get the intent's value. Broadcast A:get the sms contain message and start B public void onReceive(Context context, Intent intent) { Object[] pdus=(Object[])intent.getExtras().get("pdus"); for(Object pdu:pdus) { byte[] date=(byte[])pdu; SmsMessage message=SmsMessage.createFromPdu(date); String sender=message.getOriginatingAddress(); String body=message.getMessageBody(); if(sender.equals(AppUtil.herPhone)&&body.regionMatches(0, AppUtil.herSmsText, 0, 18)) { Toast.makeText(context, body, Toast.LENGTH_LONG).show(); String [] bodyArray=body.split(" "); String longitude=bodyArray[1]; String latitude=bodyArray[2]; **Intent uiIntent=new Intent(); Bundle bundle=new Bundle(); bundle.putString("longitude", longitude); bundle.putString("latitude", latitude); uiIntent.putExtras(bundle); uiIntent.setAction("android.janmac.location"); context.sendBroadcast(uiIntent);** abortBroadcast(); } } } Boardcast B: it nest in an Activity. register: button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AppUtil.SendMessage(MainActivity.this); uiReceiver=new UIReceiver(); IntentFilter filter=new IntentFilter(); filter.addAction("android.janmac.location"); registerReceiver(uiReceiver, filter); } }); extend: private class UIReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.v("location","uireceiver????!"); **Bundle bundle=new Bundle(); bundle=intent.getExtras(); herLongitude=Double.valueOf(bundle.getString("longitude")); herLatitude=Double.valueOf(bundle.getString("latitude"));** } } but the bundle couldn't get any values. here is log: 08-30 11:17:40.494: D/AndroidRuntime(2359): Shutting down VM 08-30 11:17:40.514: W/dalvikvm(2359): threadid=1: thread exiting with uncaught exception (group=0x40018560) 08-30 11:17:40.544: E/AndroidRuntime(2359): FATAL EXCEPTION: main 08-30 11:17:40.544: E/AndroidRuntime(2359): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.janmac.location (has extras) } in com.example.locationclient.MainActivity$UIReceiver@40513690 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722) 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.os.Handler.handleCallback(Handler.java:587) 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.os.Handler.dispatchMessage(Handler.java:92) 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.os.Looper.loop(Looper.java:130) 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.app.ActivityThread.main(ActivityThread.java:3835) 08-30 11:17:40.544: E/AndroidRuntime(2359): at java.lang.reflect.Method.invokeNative(Native Method) 08-30 11:17:40.544: E/AndroidRuntime(2359): at java.lang.reflect.Method.invoke(Method.java:507) 08-30 11:17:40.544: E/AndroidRuntime(2359): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) 08-30 11:17:40.544: E/AndroidRuntime(2359): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) 08-30 11:17:40.544: E/AndroidRuntime(2359): at dalvik.system.NativeStart.main(Native Method) 08-30 11:17:40.544: E/AndroidRuntime(2359): Caused by: java.lang.NumberFormatException 08-30 11:17:40.544: E/AndroidRuntime(2359): at org.apache.harmony.luni.util.FloatingPointParser.parseDblImpl(Native Method) 08-30 11:17:40.544: E/AndroidRuntime(2359): at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:283) 08-30 11:17:40.544: E/AndroidRuntime(2359): at java.lang.Double.parseDouble(Double.java:318) 08-30 11:17:40.544: E/AndroidRuntime(2359): at java.lang.Double.valueOf(Double.java:356) 08-30 11:17:40.544: E/AndroidRuntime(2359): at com.example.locationclient.MainActivity$UIReceiver.onReceive(MainActivity.java:231) 08-30 11:17:40.544: E/AndroidRuntime(2359): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709) 08-30 11:17:40.544: E/AndroidRuntime(2359): ... 9 more enter code here

    Read the article

  • MVVM for Dummies

    - by Martin Hinshelwood
    I think that I have found one of the best articles on MVVM that I have ever read: http://jmorrill.hjtcentral.com/Home/tabid/428/EntryId/432/MVVM-for-Tarded-Folks-Like-Me-or-MVVM-and-What-it-Means-to-Me.aspx This article sums up what is in MVVM and what is outside of MVVM. Note, when I and most other people say MVVM, they really mean MVVM, Commanding, Dependency Injection + any other Patterns you need to create your application. In WPF a lot of use is made of the Decorator and Behaviour pattern as well. The goal of all of this is to have pure separation of concerns. This is what every code behind file of every Control / Window / Page  should look like if you are engineering your WPF and Silverlight correctly: C# – Ideal public partial class IdealView : UserControl { public IdealView() { InitializeComponent(); } } Figure: This is the ideal code behind for a Control / Window / Page when using MVVM. C# – Compromise, but works public partial class IdealView : UserControl { public IdealView() { InitializeComponent(); this.DataContext = new IdealViewModel(); } } Figure: This is a compromise, but the best you can do without Dependency Injection VB.NET – Ideal Partial Public Class ServerExplorerConnectView End Class Figure: This is the ideal code behind for a Control / Window / Page when using MVVM. VB.NET – Compromise, but works Partial Public Class ServerExplorerConnectView Private Sub ServerExplorerConnectView_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded Me.DataContext = New ServerExplorerConnectViewModel End Sub End Class Figure: This is a compromise, but the best you can do without Dependency Injection Technorati Tags: MVVM,.NET,WPF,Silverlight

    Read the article

  • Adding a hyperlink in a client report definition file (RDLC)

    - by rajbk
    This post shows you how to add a hyperlink to your RDLC report. In a previous post, I showed you how to create an RDLC report. We have been given the requirement to the report we created earlier, the Northwind Product report, to add a column that will contain hyperlinks which are unique per row.  The URLs will be RESTful with the ProductID at the end. Clicking on the URL will take them to a website like so: http://localhost/products/3  where 3 is the primary key of the product row clicked on. To start off, open the RDLC and add a new column to the product table.   Add text to the header (Details) and row (Product Website). Right click on the row (not header) and select “TextBox properties” Select Action – Go to URL. You could hard code a URL here but what we need is a URL that changes based on the ProductID.   Click on the expression button (fx) The expression builder gives you access to several functions and constants including the fields in your dataset. See this reference for more details: Common Expressions for ReportViewer Reports. Add the following expression: = "http://localhost/products/" & Fields!ProductID.Value Click OK to exit the Expression Builder. The report will not render because hyperlinks are disabled by default in the ReportViewer control. To enable it, add the following in your page load event (where rvProducts is the ID of your ReportViewerControl): protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rvProducts.LocalReport.EnableHyperlinks = true; } } We want our links to open in a new window so set the HyperLinkTarget property of the ReportViewer control to “_blank”   We are done adding hyperlinks to our report. Clicking on the links for each product pops open a new windows. The URL has the ProductID added at the end. Enjoy!

    Read the article

  • WinRT WebView and Cookies

    - by javarg
    Turns out that WebView Control in WinRT is much more limited than it’s counterpart in WPF/Silverlight. There are some great articles out there in how to extend the control in order for it to support navigation events and some other features. For a personal project I'm working on, I needed to grab cookies a Web Site generated for the user. Basically, after a user authenticated to a Web Site I needed to get the authentication cookies and generate some extra requests on her behalf. In order to do so, I’ve found this great article about a similar case using SharePoint and Azure ACS. The secret is to use a p/invoke to native InternetGetCookieEx to get cookies for the current URL displayed in the WebView control.   void WebView_LoadCompleted(object sender, NavigationEventArgs e) { var urlPattern = "http://someserver.com/somefolder"; if (e.Uri.ToString().StartsWith(urlPattern)) { var cookies = InternetGetCookieEx(e.Uri.ToString()); // Do something with the cookies } } static string InternetGetCookieEx(string url) { uint sizeInBytes = 0; // Gets capacity length first InternetGetCookieEx(url, null, null, ref sizeInBytes, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero); uint bufferCapacityInChars = (uint)Encoding.Unicode.GetMaxCharCount((int)sizeInBytes); // Now get cookie data var cookieData = new StringBuilder((int)bufferCapacityInChars); InternetGetCookieEx(url, null, cookieData, ref bufferCapacityInChars, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero); return cookieData.ToString(); }   Function import using p/invoke follows: const int INTERNET_COOKIE_HTTPONLY = 0x00002000; [DllImport("wininet.dll", CharSet = CharSet.Unicode, SetLastError = true)] static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved); Enjoy!

    Read the article

  • Enum.HasFlag method in C# 4.0

    - by Jalpesh P. Vadgama
    Enums in dot net programming is a great facility and we all used it to increase code readability. In earlier version of .NET framework we don’t have any method anything that will check whether a value is assigned to it or not. In C# 4.0 we have new static method called HasFlag which will check that particular value is assigned or not. Let’s take an example for that. First I have created a enum called PaymentType which could have two values Credit Card or Debit Card. Just like following. public enum PaymentType { DebitCard=1, CreditCard=2 } Now We are going to assigned one of the value to this enum instance and then with the help of HasFlag method we are going to check whether particular value is assigned to enum or not like following. protected void Page_Load(object sender, EventArgs e) { PaymentType paymentType = PaymentType.CreditCard; if (paymentType.HasFlag(PaymentType.DebitCard)) { Response.Write("Process Debit Card"); } if (paymentType.HasFlag(PaymentType.CreditCard)) { Response.Write("Process Credit Card"); } } Now Let’s check out in browser as following. As expected it will print process Credit Card as we have assigned that value to enum. That’s it It’s so simple and cool. Stay tuned for more.. Happy Programming.. Technorati Tags: Enum,C#4.0,ASP.NET 4.0

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >