I am using this code to connect to my exchange server.
I am trying to retrieve an inbox of basically emails that have not been read
however, i am just getting a bunch of gibberish and its reading an email.
can you help me modify my code to just read the most recent messages.
Try
tcpClient.Connect(hostName, 110)
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Dim sendBytes As Byte()
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
sendBytes = Encoding.ASCII.GetBytes("User " + userName + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
sTemp = networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
sendBytes = Encoding.ASCII.GetBytes("Pass " + userPassword + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
sTemp = networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
sendBytes = Encoding.ASCII.GetBytes("STAT" + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
sTemp = networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
sendBytes = Encoding.ASCII.GetBytes("RETR " + messageNumber + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
returnMessage = Encoding.ASCII.GetString(bytes)
EmailContent.Text = returnMessage
sendBytes = Encoding.ASCII.GetBytes("QUIT" + vbCrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
tcpClient.Close()
Catch ex As Exception
EmailContent.Text = "Could not retrieve email or your inbox is empty"
End Try
Hi,
I am interested in writing unit tests for the SharePoint development work I am doing. Can anyone suggest practical approachs to implementing unit tests in MOSS?
Note that any third party tools have to be free (but not necessarily open-source); the company I work for will not pay for additional tooling. In particular, any alternatives to the Typemock Isolator for SharePoint would be appreciated.
Thanks, MagicAndi.
The catch is you have no SNMP access, not even public.
The end vision is locate a PC in building easily even if PC's are moved around.
The MAC address of the PC is known and the software would run as client on each desktop, reporting back which port the PC was plugged into.
I'm using AJAX_POSTUP. When i make a request it sends a file to a bowser [offers to download] (the files content are params of the action methods). Does anyone know whats going on and how i can avoid this problem???
i'm not aware of other plugins such as AJAX_POSTUP
Hello,
I'm having a problem with some reports in the application I'm doing manutention
I've a button that does a postback to the server and do some information and then get back to the cliente and open a popup to download the report.
private void grid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
...
ClientScript.RegisterClientScriptBlock(this.GetType(), "xxx", "<script>javascript:window.location('xx.aspx?m=x','xxx','width=750,height=350,directories=no,location=no,menubar=no,scrollbars,status=no,toolbar=no,resizable=yes,left=50,top=50');</script>");
}
Then in xxx.aspx I've the code:
Response.ClearContent();
Response.ClearHeaders();
Response.TransmitFile(tempFileName);
Response.Flush();
Response.Close();
File.Delete(tempFileName);
Response.End();
This works fine if IE option Automatic prompting for file downloads is enabled. But by default this is disabled and I need to force the download box to be prompting.
Can I do anything without change a lot of code?
Thanks.
Hi,
I am working on VS 2008 and 3.5 framework.
I had three windows services.
I placed all three in a single solution, created installer individually for each of them.
Then created a setup project.
When I build it says build failed .
But I checked on the errorlist, (i enabled the diagnostics in options menu), but there was no error at all.
I went ahead and installed. There were no issues, But there was no service showed up in the services.msc.
I installed each service individually , using installutil command, it showed up.
But my requirement is to bundle these services and deploy to the client.
The client should install it.
Where am I going wrong.
Any inputs will be highly appreciated.
Regards
cmrhema
Hi Guys,
I have a label inside an update panel which I wouldl ike to use as a status bar.
Basically the user clicks a button which executes a main fucntion that performs a series of tasks. I'd like to inform the user as to the state of the function as it progresses e.g.:
Stage 1: Retrieving data...
Stage 2: Calculating values...
Stage 3: Printing values...
Stage 4: Done!
I've tried updating the updatepanel directly from the function but it only updates the panel at the end of function (stage 4) and shows "Done!" (which I understand is how it should work).
I've been looking into timers and threads to try and update the panel seperate to the main function but I thought I'd post here incase anyone has any better ideas?
Thanks for any help in advance!
John
bourkeyo is offline Reply With Quote
I have a web app that is using the 3.5 framework. I wanted to know how can I detect what webhost is rendering the page.
If the server is localhost, then send email notification to [email protected]
If the server is QA, then send email to [email protected]
Thanks
When compiling this code:
public class WindsorControllerFactory : IControllerFactory
{
private readonly WindsorContainer _container;
public WindsorControllerFactory(WindsorContainer container)
{
_container = container;
}
public IController CreateController(RequestContext requestContext,
string controllerName)
{
return (IController)_container.Resolve(controllerName);
}
public void ReleaseController(IController controller)
{
_container.Release(controller);
}
}
I am getting this error:
'WindsorControllerFactory' does not
implement interface member
'System.Web.Mvc.IControllerFactory.CreateController(System.Web.Routing.RequestContext,
string)'
Well, it obviously implements this member. Has anyone encountered this problem?
Hi, I have a AdvWebGrid where the 7th coloumn is DynEdit where user will enter the value.Now I have to take the enetered value and insert into the Sql tablel. For example i have 7 records in the grid the user will enter some comments for the first three record and save.Now i have to insert/update the first three comments in the table.
I want to access all the files in a folder to add to a listbox and show to the user.
I know I can access a folder when it's a windows application. But in web application, is this possible? If yes, how?
Something like FolderBrowserDialog??
I have a third party tool that creates an img tag through code using HtmlTextWriter's RenderBeginTag, RenderEndTag & AddAttribute methods. I want to get the resulting HTML into a string.
I tried the reflection method mentioned here but I get a error "Unable to cast object of type 'System.Web.HttpWriter' to type 'System.IO.StringWriter". The InnerWriter type of the HtmlTextWriter is of type HttpWriter.
Any ideas on how to copy the output html into a string?
How do i achieve simple sql query like
delete from Users where userCity='Munich'
with DataTables ?
p.s. without using Linq or something like that simply because i do not use it though project.
Alright, so what i have, is a large string i need to parse, and what i need to happen, is find all the instances of extract"(me,i-have lots. of]punctuation, and store them to a list.
So say this piece of string was in the beginning and middle of the larger string, both of them would be found, and their index's would be added to the List. and the List would contain 0 and the other index whatever it would be.
Ive been playing around, and the string.IndexOf does almost what i'm looking for, and ive written some code. But i cant seem to get it to work:
List<int> inst = new List<int>();
int index = 0;
while (index < source.LastIndexOf("extract\"(me,i-have lots. of]punctuation", 0) + 39)
{
int src = source.IndexOf("extract\"(me,i-have lots. of]punctuation", index);
inst.Add(src);
index = src + 40;
}
inst = The list
source = The large string
Any better ideas?
I am using the session object to store success/error messages based on user actions.
On each postback, the message is set on ItemCommend and retrieved on the Page_Load of the master page. Once retrieved, the message is deleted from the session.
The problem is that the master page's Page_Load gets called before the ItemCommand gets called so the message does not show up until the next refresh or postback.
How is this situation normally handled? Is there some other event we can code against?
Hi folks,
I'm playing around with some unit tests and mocking. I'm trying to verify that some code, in my method, has been called. I don't think I understand the Verify part of mocking right, because I can only ever Verify main method .. which is silly because that is what I Act upon anyways.
I'm trying to test that my logic is working - so I thought I use Verify to see that certain steps in the method have been reached and enacted upon.
Lets use this example to highlight what I am doing wrong.
public interface IAuthenticationService
{
bool Authenticate(string username, string password);
SignOut();
}
public class FormsAuthenticationService : IAuthenticationService
{
public bool Authenticate(string username, string password)
{
var user = _userService.FindSingle(x => x.UserName == username);
if (user == null) return false;
// Hash their password.
var hashedPassword = EncodePassword(password, user.PasswordSalt);
if (!hashedPassword.Equals(password, StringComparison.InvariantCulture))
return false;
FormsAuthentication.SetAuthCookie(userName, true);
return true;
}
}
So now, I wish to verify that
EncodePassword was called.
FormsAuthentication.SetAuthCookie(..) was called.
Now, I don't care about the implimentations of both of those. And more importantly, I do not want to test those methods. That has to be handled elsewhere. What I though I should do is Verify that those methods were called and .. if possible ... an expected result was returned.
Is this the correct understanding of what 'Verify' means with mocking?
If so, can someone show me how I can do this. Preferable with moq but i'm happy with anything.
Cheers :)
Hello.
I have to serialize & desserialize json data.
if the data type was XSD, I am able to create class by using XSDObjectGen.exe
But ,
the data type I have to serialize is 'JSON'.
Is there any good way to generate class for serialize & deserialize ?
Hi I have a jqgrid which is embedded in a Div. I am deleting records from the grid and reloading the grid using grid.Trigger('reload').
The width of the grid is considerably high so it has a scroll bar. Now I scrolled through the end of the grid horizontally before deleting records. Each time I delete the records and reload the grid, the column headers and their values are slightly misaligned. When I move the scroll bar back to original position or just move the scroll bar slightly they are aligned properly.
So I thought its better to move the scroll bar to its inital position when the grid reloads. How can a scroll bar be programatically moved using javascript. Or is there any other way to solve my problem?
I need to display data values in US currency format. Meaning 190.8 should display as $190.80. For some reason I cant figure out how to do this. Any advice?
I need to store code in a string so that if a value is true, it is in the code line if not true its not in the code line. When I populate summarytextbox if consulting amount is "" then dont use this code if is does have an amount include the code. Is this possible? Other wise I would have to do a bunch if then statements. When I do the following below it cant convert to double.
Dim ConsultingFee As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("ConsultingFeeAmount") = "" Then
Else
'Store the following line in a string????
ConsultingFee = +Environment.NewLine + Session("ConsultingFee") + " Amount: " + Session("ConsultingFeeAmount")
End If
SummaryTextBox.Text = Session("TeachingHospital") + Environment.NewLine + Session("HospitalAddress") + Environment.NewLine + Session("HospitalCity") + Environment.NewLine + Session("HospitalState") + Environment.NewLine + Session("HospitalZip") + Environment.NewLine + Session("HospitalTIN") + ConsultingFee
End Sub
If I have the following structure:
Public Class UserData
Public ID As String
Public Name As String
End Class
How can I select it in a conditional like this?
Dim myUsers As New List(Of UserData)
If myUsers.Contains(.ID = "1") = True Then
...
I know that myUsers.Contains(.ID = "1") is totally wrong, but I am curious how to do something like that? Is it possible? Is this a job for LINQ?
Hi,
Very new to JQuery and MVC and webdevelopment over all.
I'm now trying to accomplish this and is asking for a bit of advise:
I'm basically trying to build a filter with 4 input elements, and 1 output.
I have 4 select (drop down) elements in my page. As soon as one of them is changed, I need to build a href and get the partial view with the return values.
My questionis now if I should try to build the href in the select element or if I can do it once in jquery, and don't have to have duplicated code. How would I accomplish this?