|
-
Socket Programming
Date: 02/09/11
(C Sharp) Keywords: asp, web, microsoft
Hi,
I have created a socket connection as described on MDSN web site: client: http://msdn.microsoft.com/en-us/library/bew39x2a(v=VS.85).aspx server: http://msdn.microsoft.com/en-us/library/fx6588te(v=VS.85).aspx
It works fine. Events here are: 1) Client sends request 2) Server receives it 3) Server sends response 4) Server shutdown the socket 5) Client receives response
Then, I know, that between 2) an 3) might be a time gap. I want to send few interim responses like: 2a) Server sends response: Still working on your request. The problem here is that I cannot send a response without shutting down the socket, but as I shout it down I am not able to send neither 3) nor another 2a)
Is it possible for client to get response without closing the socket connection? Something like .flush()?
corresponding piece of code:
...
public class MathTask {
public string inputData;
public int MaxTryCount;
public int DelayBetweenNotificationsSec;
public bool complete = false;
public MathTask(string _data, int _maxTry, int _delayBetweenNotifications) {
inputData = _data;
MaxTryCount = _maxTry;
DelayBetweenNotificationsSec = _delayBetweenNotifications;
complete = false;
}
}
...
...
private static void Send(Socket handler, MathTask taskData)
{
// Convert the string data to byte data using ASCII encoding.
byte[] byteData = Encoding.ASCII.GetBytes(taskData.inputData);
if (taskData.complete || (taskData.MaxTryCount <= 0))
{ // final sending
// Begin sending the data to the remote device.
IAsyncResult res = handler.BeginSend(byteData, 0, byteData.Length, 0,
new AsyncCallback(SendCallback), handler);
}
else
{ // interim (notification) sending
// Begin sending the data to the remote device.
StateObject so = new StateObject();
so.workSocket = handler;
so.sb.Append(taskData.inputData);
IAsyncResult res = handler.BeginSend(byteData, 0, byteData.Length, 0,
new AsyncCallback(SendInterimCallback), so);
}
}
// after sending notification (task is running)
private static void SendInterimCallback(IAsyncResult ar)
{
try
{
// Retrieve the socket from the state object.
StateObject so = (StateObject)ar.AsyncState;
int bytesSent = so.workSocket.EndSend(ar);
Console.WriteLine("Sent {0} bytes to client.", bytesSent);
// client receives response ONLY AFTER this statement
so.workSocket.Shutdown(SocketShutdown.Both);
so.workSocket.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
...
Thanks for response, the problem solved.
That was not the server, but the client. Take a look at ReceiveCallback:
private static void ReceiveCallback( IAsyncResult ar ) {
try {
// Retrieve the state object and the client socket
// from the asynchronous state object.
StateObject state = (StateObject) ar.AsyncState;
Socket client = state.workSocket;
// Read data from the remote device.
int bytesRead = client.EndReceive(ar);
if (bytesRead > 0) {
// There might be more data, so store the data received so far.
state.sb.Append(Encoding.ASCII.GetString(state.buffer,0,bytesRead));
// Get the rest of the data.
client.BeginReceive(state.buffer,0,StateObject.BufferSize,0,
new AsyncCallback(ReceiveCallback), state);
} else {
// All the data has arrived; put it in response.
if (state.sb.Length > 1) {
response = state.sb.ToString();
}
// Signal that all bytes have been received.
receiveDone.Set();
}
} catch (Exception e) {
Console.WriteLine(e.ToString());
}
}
If client reads any bytesRead more than 0, it will store it in buffer and keep waiting for more data to come. Only when 0 bytes read it calls receiveDone.Set(); which finalize the receive process. Now I understand why it was working only after socket became closed.
Source: https://csharp.livejournal.com/107817.html
-
Help with Error Module
Date: 07/07/10
(C Sharp) Keywords: html, asp, web
I posted my question here originally last night but I figured I might as well reach out to the LJ crowd to see if anyone here has answers.
I implemented an error handling httpmodule similar to the one described here:
http://wiki.asp.net/page.aspx/917/neater-handling-of-exceptions/
If I run the application locally through the Visual Studio Development Server everything works as expected. If I run it through IIS with a wildcard mapping set up in the ISAPI extensions to go to the dotnet dll, and I have the checkbox to "Verify that the file exists" turned off - it works as expected for .aspx files but not for anything else.
In my web.config I have the following:
And under IIS errors I have it set up so that 404 errors go to the same 404 URL in web.config.
The behavior I am expecting is that if I go to appliationname.com/xyz.html and the page does not exist, it is kicked into the error handling code. The error handling module is set up to log the event and I should get an email. And even failing that the 404 page should still load in IIS settings.
The error handling code does kick in if I go to appliationname.com/xyz.aspx - a page which does not exist. But for any other file extension the 404 processing is handled by IIS. So any error logging I am doing in the HTTPModule is not getting called.
When I run an HTML page it does get processed to some extent. The code I have in Application_BeginRequest in global.asax does get called. But at the end of that block it stops processing.
The application I am working on is a migration of older code. I want to be alerted to every 404 that comes through the application so that I can see if we missed anything. I could potentially get this sort of information from the IIS logs or I could try to move the error logging to the code behind of the error pages instead of the HTTPModule. But I shouldn't have to should I? Why won't it process HTML? And why does it work when when running the application through Visual Studio but bot when I run it through IIS?
Any help would be appreciated.
Source: https://csharp.livejournal.com/106895.html
-
Application stops owing to callback from unmanaged DLL
Date: 09/16/09
(C Sharp) Keywords: asp, microsoft
Why does my c# application stop after receiving a callback from unmanaged DLL?
I've just encountered this very strange problem. And wonder why it could happen.
The similar situation is described by someone on MSDN-site. http://social.msdn.microsoft.com/Forums/en-US/clr/thread/25bd7c1d-373f-4ef7-a64b-a101897b6b9a/
But nobody there brought a clear explanation of that yet.
This little article described how to deal with callbacks from unmanaged code. http://www.codeproject.com/KB/cs/win32_to_net.aspx I think I did everything properly so that the program works well. But it doesn't. If necessary, I could share snippets of my code.
Thank you.
Source: https://csharp.livejournal.com/105163.html
-
SQL Job Administrators - SQL 2008 R2
Date: 02/04/13
(SQL Server) Keywords: asp, sql, microsoft
I'm thinking about doing this because our number of ad-hoc requests to run jobs has increased to an annoying level. Does anyone out there have experience putting this into practice?
How to: Configure a User to Create and Manage SQL Server Agent Jobs (SQL Server Management Studio)http://msdn.microsoft.com/en-us/library/ms187901%28v=sql.105%29.aspx
Source: https://sqlserver.livejournal.com/77287.html
-
Production SQL DBA Opening in North Texas
Date: 06/02/11
(SQL Server) Keywords: database, asp, sql, security, microsoft
Passing this along for a friend...If you know anyone looking, please let me know. Pay terms seem to be a little higher than normal for that many years of experience. Responsibilities: - Installation, configuration, customization, maintenance and performance tuning of SQL Server 2005 & 2008 including SSIS, SSAS and SSRS.
- SQL version migration, patching and security management.
- Monitor database server capacity/performance and make infrastructure and architecture recommendations to management for necessary changes/updates.
- Perform database optimization, administration and maintenance (partitioning tables, partitioning indexes, indexing, normalization, synchronization, job monitoring, etc).
- Manage all aspects of database operations including implementation of database monitoring tools, event monitoring, diagnostic analysis, performance optimization routines and top-tier support for resolving support issues.
- Work with internal IT operations teams to troubleshoot network and server issues and optimize the database environment.
- Establish and enforce database change management standards including pushes from development to QA, on to production, etc;
- Proactively stay current with latest technologies and industry best practices associated to the position and responsibilities.
- Provide development and production support to troubleshoot day-to-day database or related application issues.
- Develop, implement and verify processes for system monitoring, storage management, backup and recovery.
- Develop, implement and verify database backup and disaster recovery strategies.
- Design and implement all database security to ensure integrity and consistency among the various database regions
- Develop and maintain documentation of the production environment.
- Manage SLAs and strict adherence to production controls - Sarbanes-Oxley (SOX) monitored via external audits
Necessary Qualifications:- Must have experience on SQL Server 2005.
- Good exposure on Installation, Configuration of database Clusters, Replication, Log shipping and Mirroring
- Expertise in Troubleshooting and performance monitoring SQL Server Database server (Query Tuning, Server Tuning, Disk Performance Monitoring, Memory Pressure, CPU bottleneck etc.)
- Expertise in T-SQL and writing efficient and highly performing SQL Statements.
- Expertise in SQL Server Internals, wait events, profiler, windows events etc
- Must have understanding of key infrastructure technologies such as Clustering, SAN Storage, Virtualization, Cloud services etc.
Other nice to have experience:- System administration fundamentals including Installation, Configuration & Security setups.
- Experience with SQL 2008 a plus.
- Experienced in architecting high availability, business resumption and disaster recovery solutions
- Microsoft SQL Server DBA Certification
- Experience with SCOM/SCCM/SCSM is a plus
- Extremely self motivated and ability to work within a globally dispersed team.
Desired Skills:- Data Warehouse experience
- VLDB experience highly desired
- Experience with databases > 5 TB, processing 2 million + rows of data daily
- MS SQL Server 2005 Transact-SQL (T-SQL)
- Stored Procedure Development Communication Skills, work well with the team, and within team processes
- Database and file size and space forecasting ability
- Ability to manage a complex database system and assist the client with Database Integration for Future Business Intelligence efforts
- Confio Ignite Performance
Education & Work Experience:- Bachelor's degree in Computer Science, Business Administration or other
- 10+ years experience as a Database Administrator
Source: https://sqlserver.livejournal.com/75423.html
-
SQL Server 2005 - Implement account or IP validation using LOGON TRIGGER
Date: 11/18/09
(SQL Server) Keywords: asp, sql, security, web, microsoft
http://technet.microsoft.com/en-us/sqlserver/dd353197.aspx
Has anyone implemented security using the LOGON TRIGGER that came out with SQL Server 2005 SP2?
I'm just curious if anyone has setup this feature to protect their SQL Server from attack through their web servers.
Source: https://sqlserver.livejournal.com/71849.html
-
1st Call for Papers: SIGAI Workshop on Emerging Research Trends in AI (ERTAI-2010)
Date: 01/09/10
(Algorithms) Keywords: php, asp, java, web, spam
The Special Interest Group on AI (SIGAI) of Computer Society of India (CSI) announces a *workshop* on "Emerging Research Trends in AI". The workshop will be organised and hosted by CDAC Navi Mumbai, India and is meant to encourage quality research in various aspects of AI, among the Indian academia/industry. For details, refer the first call for papers below (in the LJ Cut), and visit http://sigai.cdacmumbai.in and http://sigai.cdacmumbai.in/index.php/ertai-2010
[Cross-posted at mumbai , ai_research and _scientists_ ]
SIGAI Workshop on Emerging Research Trends in Artificial Intelligence (ERTAI - 2010) 17th April, 2010, C-DAC, Navi Mumbai, India Supported by Computer Society of India (CSI)
Background
Artificial Intelligence (AI) has always been a research-rich field with a number of challenging and practically significant problems spanning many areas. These include language processing, multi-agent systems, web mining, information retrieval, semantic web, e-learning, optimization problems, pattern recognition, etc. AI, hence, can offer a wide range of challenging problems matching the palate of every academic or professional. However, most colleges and universities do not have experienced AI researchers to work in these areas.
We also observe an increasing interest among the Indian academia to pursue research, usually aimed at PhD. However, lack of guides with rich research experience often makes it hard for new and aspiring research scholars to identify relevant and useful research topics and to get guidance on their approach and direction. A forum where those pursuing research can exchange ideas and seek guidance, and those seeking to get into research can get a feel of current research would be valuable for both groups.
This is the backdrop driving SIGAI to organize a workshop of this nature.
Proposed Structure of Workshop
It will be a one day programme consisting of,
* Invited talks covering current trends, specific challenges, etc. in Artificial Intelligence * Invited talks on mentoring research scholars on publication, research methodology, etc. * Presentations by those currently pursuing research in AI area.
We will have a panel of experienced researchers to evaluate and mentor the research presentations.
Call For Papers
For the research presentations, we are now inviting brief research papers of 5-6 pages, outlining the problem being addressed, approach followed vis a vis existing approaches, current status / results, and future plans. A subset will be short-listed for presentation, based on a formal review process. Papers must have significant AI content to be considered for presentation. Relevant topics include (but are not limited to):
Knowledge Representation Reasoning
Model-Based Learning Expert Systems
Data Mining State Space Search
Cognitive Systems Vision & Perception
Intelligent User Interfaces Reactive AI
Ambient Intelligence Artificial Life
Evolutionary Computing Fuzzy Systems
Uncertainty in AI Machine Learning
Constraint Satisfaction Ontologies
Natural Language Processing Pattern Recognition
Intelligent Agents Soft Computing
Planning & Scheduling Neural Networks
Case-Based Reasoning
Target Audience
Target audience will be primarily:
* Faculty members pursuing research involving AI as the base or as a tool for an application. * Faculty members interested in pursuing research and exploring areas / options. * Research scholars working for a post graduate degree. * Students seriously interested in research, specifically on AI.
Important Dates
* Last date for paper submission: 10th March, 2010 * Acceptance intimation: 25th March, 2010 * Camera ready copy due: 5th April, 2010 * Registration details announcement: 1st February, 2010
Instructions
* Presentations must report original work carried out by the authors. * Presenters would be given a maximum of 30 minutes for their presentation. * All participants must register for the workshop. * Presentation may be submitted via: csi.sigai@gmail.com This e- mail address is being protected from spambots. You need JavaScript enabled to view it
ERTAI Secretariat Centre for Development of Advanced Computing (Formerly NCST) Raintree Marg, Near Bharati Vidyapeeth, Sector 7, CBD Belapur Opp. Kharghar Railway Station, Navi Mumbai 400 614, Maharashtra, INDIA
Telephone: +91-22-27565303 Fax: +91-22-27565004 (on request)
Email: csi.sigai@gmail.com Web: http://sigai.cdacmumbai.in/
Source: https://algorithms.livejournal.com/103407.html
-
Drag and Drop Listbox
Date: 02/17/09
(Asp Dot Net) Keywords: database, asp, sql, web
Hi, What I am trying to do this time is create an asp.net listbox from an SQL Server 2005 result set (done) which then users can sort the records to form the running order within the same Listbox and then submit all the records including the new running order back into the database. Each record has already been automatically assigned a running order number based on their position in the old website.
I am looking for suggestions on the quickest and *easist* way to do this, examples would be much appreciated. My web application is asp.net written in C#.
Any help is appreciated.
Source: https://aspdotnet.livejournal.com/103147.html
-
Separator lines in asp:menu control
Date: 01/05/09
(Asp Dot Net) Keywords: asp
I need separator lines in the dynamic menu section of an asp:menu control.
However, I only want separator lines between certain menu items - not all of them.
Is that possible ?
Source: https://aspdotnet.livejournal.com/102432.html
-
C# CheckBoxes!
Date: 10/16/08
(Asp Dot Net) Keywords: asp, web
Okay, I am writing a small webapp in asp.net C# 2.0 after a few years since I last done .net (which was vb.net by the way). I have a GridView which is filtered by a dropdown, the gridview is listed below. I can't remember for the life of me how to catch the checkboxes posted back from the form? and I can't find any simple examples online. Help?
Source: https://aspdotnet.livejournal.com/101836.html
-
Email Message Id
Date: 08/19/08
(Asp Dot Net) Keywords: asp, web
Hello everybody, Is there a way here to get email message Id right after you send it with the SMPT client? I am creating a web application on ASP.NET 2.0 and it uses mail server EXIM to send emails.
Message Id I mean that unique identifier, which is being set when you send an email. Using telnet:
$ telnet yourmailhost.whatever.com 25 << 220 yourmailhost.whatever.com blah blah >> HELO yourclientname << 250 yourmailhost.whatever.com Hello [ip address] >> mail from:someaddress@hotmail.com << 250 2.1.0 yourmailhost.whatever.com ...Sender OK >> rcpt to:someaddress@yourmailhost.whatever.com << 250 2.1.5 someaddress@yourmailhost.whatever.com >> data << 354 Please start mail input. >> Subject: Test message >> >> This is a test... >> Testing 1-2-3 >> . << 250 Mail queued for delivery. MessageId<K5SHTQ-0004Q0-0E> >> quit
Source: https://aspdotnet.livejournal.com/100129.html
-
uuugh.... database issues
Date: 07/13/08
(Asp Dot Net) Keywords: database, asp
I'm trying to set up a database connection with ASP.NET in Dreamweaver MX 2004 (yeah, a little older...), and everything in the site has a check mark that needs to before you add a connection, and I add the database file, and even hit test and it registers fine. Then when I go to add a new record set, I select the database, but it says "***No table found". So apparently it's ok with the file path, it just can't read the database tables.
I've made sure the .net framework was all good to go, and I downloaded the MDAC 2.7 files and got those all set. Is there something I'm missing? I'm trying to work with Access and asp.net because that's what a position I'm trying to move into uses, so, I don't really have other options.
Also, I'm thinking maybe there's an issue with drivers because even when I try to hand code it with examples from http://www.w3schools.com/ASPNET/aspnet_repeater.asp, when I call it up in either IE or Firefox, it just displays the code.... any ideas?
Source: https://aspdotnet.livejournal.com/99757.html
-
Multiple web.config files ?
Date: 03/31/08
(Asp Dot Net) Keywords: asp, security, web
I have content that I only want authorized users to see and then content that I want joe public to be able to view.
I found this article that suggests having two web.config files. So the authorized user content would be in a separate folder with its own web.config file: http://www.asp.net/learn/security/tutorial-07-vb.aspx
Is that how you would do it ? (There's no date on the article so I didnt know if this was the latest thinking)
Thanks :)
Source: https://aspdotnet.livejournal.com/97434.html
-
ComboBoxes in two pages.
Date: 03/12/08
(Asp Dot Net) Keywords: programming, asp, web
Hi. I'm newbie both in ASP.NET and in web programming, so my question may be dumb. Sorry if so. I have two pages in my project and each page contains combo box. Comboboxes bind to one data source. I need to solve following task: if user select combo box item in one page, the same item must be selected in another page automatically. Is there any ways to do this or it's impossible?
Source: https://aspdotnet.livejournal.com/97019.html
-
Reading Page Content of remote web page
Date: 02/15/08
(Asp Dot Net) Keywords: asp, web
Hi there, For my project I need to read an external web page and then parse the content. What I have found on the internet is for asp: <% url = "http://www.espn.com/main.html" set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "GET", url, false xmlhttp.send "" Response.write xmlhttp.responseText set xmlhttp = nothing %> And I need the same for ASP.NET 2.0 Can anybody show me how to do that? Thank you.
Source: https://aspdotnet.livejournal.com/96005.html
-
Sending an email
Date: 02/04/08
(Asp Dot Net) Keywords: asp
I need to send an email in asp.net 2.0 and cant seem to get it working.
Whenever I run the code below I get a "Failure sending mail." error from the Catch.
I know the email settings are correct but I just cant send an email through code.
Can anyone see anything wrong with my code ?
try {
string RecipientEmailAddress = Membership.GetUser("nathan").Email;
//create the mail message MailMessage mail = new MailMessage();
//set the addresses mail.From = new MailAddress("test@phalkensystems"); mail.To.Add("nathan.rimmer@gmail.com");
//set the content mail.Subject = "This is an email"; mail.Body = "this is the body content of the email.";
//send the message SmtpClient smtp = new SmtpClient();
smtp.Host = "smtpout.secureserver.net"; smtp.Port = 70;
//to authenticate we set the username and password properites on the SmtpClient smtp.Credentials = new System.Net.NetworkCredential("test@phalkensystems", "xxxxxxx"); smtp.Send(mail);
}
catch (Exception ex) { Label1.Text = ex.Message.ToString(); }
Source: https://aspdotnet.livejournal.com/95284.html
-
Welcome coderlarry to php_elite
Date: 01/26/05
(Elite PHP Development) Keywords: php, asp
Hows it going? so the ranks of php_elite are steadily growing :) 3! oh yeah, were pimpin it now. Hopefully you will be a contributing member, i s'pose everyone else who joined just joined because php_elite sounds "kewl man". maybe you will post something interesting on the topic of php. All discussions of coding are very welcome, however maybe something in an area, such as socket coding, or possibly using the gd library as a graphics engine for a game, things of that nature are what i would like. i have wanted to start a post on one of those subjects, but i have been very busy preparing for my move to chicago that time has been to short of late to write out the entire technical aspect of my project. im working on it though so expect to see it up here in the near future :). meanwhile someone, anyone please post your ideas or what not on coding to this community. -=Levi=- -=Ro0t=- http:\\www.dehaanent.com\
Source: https://php-elite.livejournal.com/1029.html
-
Photo Gallery wanted
Date: 02/11/09
(Javascript Community) Keywords: php, css, html, asp, java, web
Hi there! I'm looking for help and I hope the JavaScript savvies can help me here. I can't write JS myself, but I am good enough to be able to read most of the code I copy&paste and know where to change the variables :-)
I am trying to set up a photo gallery using simple java script.
The requirements are relatively easy:
- I want a placeholder at the top where the images appear. Like 800x800 or something. - I want thumbnails (or links) underneath and when you click one of them, the big image appears in the placeholder atop. - I need the placeholder to adjust to landscape and portrait format. Most of my images have different aspect ratios. - I need it to be pure JavaScript in one html page. No php or anything because my server does not allow it. CSS is ok, though. - I want to be able to add an image once in a while without changing multiple html pages, so album generators which generate several pages from a set or images is out. I use that for vacation pics, but not for the purpose I have in mind now.
I found this page: Image Gallery and it's almost all I need, except that the creator is of the strange opinion that all pictures should have an aspect ratio of 1:1.
Any help, or pointing me to a website that can help is greatly appreciated!
Thanks so much!
Source: https://javascript.livejournal.com/165211.html
-
Problem
Date: 02/11/09
(Javascript Community) Keywords: asp, java
Hello.
I'll start off by saying I suck at Javascript.
I have a classic ASP page which has a basic 2D table. The rows of text boxes are dynamically created and have names like txtItem1, txtItem2, txtQuantity1, txtQuantity2, etc. There are 10, but of the 10, they will rarely all be used. If the user needs more than 10, they can create another ten rows by pressing a button and submitting the form, so potentially the controls can be numbered up to 20 and up to 20 used.
I need to multiply 2 columns (txtItem and txtQuantity) of user inputted data and put the value in a 3rd column (txtTotal - appended with whatever row number it happens to be in as the rest of the controls are named). There may or may not be data in these fields, even if there is other data in the row, the user wants the option to just type in the value of the total "manually" as that is how the business works.
I need to do this on the fly, the user does not want to post back, so I have to use client side scripting.
Additionally, of these txtTotal fields, I need a subtotal at the bottom of the column.
Then I need to calculate a percentage, show it, and add it to the total for a grand total.
I'm a little overwhelmed.
If I could get some help with any of the three or so tasks I have:
1. Multiplying field one by field two giving field three... only if there is data to calculate. 2. Adding a column of fields of a variable number (ignore fields that are not populated) to give a grand total. 3. Calculate a percentage of the grand total, and total that again for a final total.
I would be forever in your debt, eternally grateful, and blissfully happy. Thank you in advance, a thousand times.
I've searched and found a few scripts that don't seem to do exactly what I want, so I'm begging.
Source: https://javascript.livejournal.com/164951.html
|