What's the best way to do some lengthy initialization when a Windows service starts up (or resumes from being paused) without blocking the Service Control Manager?
I've removed all hyperlinks but SO will not let me post a question! It says:
We're sorry, but as a spam prevention mechanism, new users can only post a maximum of one hyperlink. Earn 10 reputation to post more hyperlinks.
If I were to build a newsletter emailing system, I will need to be able to generate reports on how many emails bounced, flagged as spam, unsubscribed, read vs. unread, click through rates etc....
So how do you keep track of user activity after the email has been sent? Am I right in assuming that you CAN NOT embed javascript code into emails to monitor user activity? How else do I gather data for my reports?
I am amazed by the architectural design of node.js and was wondering if C# is capable of such design:
Aasynchronous, event based / event loop, non-blocking IO without multithreading.
I kept getting this message from the website:
"
Oops! Your question couldn't be submitted because:
we're sorry, but as a spam prevention mechanism, new users aren't allowed to post images. Earn 10 reputation to post images.
"
Hello,
I'm having memory woes.
I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal
Visitor Pattern to allow you to add new functionality to their classes.
I've finally figured out how it works, and I've got a Visitor that just
returns the properties from one of the objects. (since I don't know how
they're allocated).
so.
My little code does this:
VisitorResult AGLContextVisitor::visit( Channel* channel )
{
// Search through Nodes, Pipes until we get to the right window.
// Add some code to make sure we find the right one?
// Not executing the following code as C++ in gdb?
eq::Window* w = channel->getWindow();
OSWindow* osw = w->getOSWindow();
AGLWindow* aw = (AGLWindow *)osw;
AGLContext agl_ctx = aw->getAGLContext();
this->setContext(agl_ctx);
return TRAVERSE_PRUNE;
}
So here's the problem.
eq::Window* w = channel->getWindow();
(gdb) print w
0x0
BUT If I do this:
(gdb) set objc-non-blocking-mode off
(gdb) print w=channel->getWindow()
0x300effb9
// an honest memory location, and sets w as verified in the Debugger window
of XCode.
It does the same thing for osw.
I don't get it. Why would something work in (gdb) but not in the code?
The file is completely a cpp file, but it seems to be running in objc++,
since I need to turn blocking off.
Help!? I feel like I'm missing some memory-management basic thing here,
either with C++ or Obj-C.
[edit]
channel-getWindow() is supposed to do this:
/** @return the parent window. @version 1.0 */
Window* getWindow() { return _window; }
The code also executes fine if I run it from a C++-only application.
[edit]
No... I tried creating a simple stand-alone program since I was tired of running it as a plugin. Messy to debug.
And no, it doesn't run in the C++ program either. So I'm really at a loss as to what I'm doing wrong.
Thanks,
--
Stephen Furlani
I'm still very new to codeigniter. The issue i'm having is that the file uploads fine and it writes to the database without issue but it just doesn't return me to the upload form. Instead it stays in the do_upload and doesn't display anything. Even more bizarrely there is some source code behind the scenes. Can someone tell my what it is i'm doing wrong because I want to be returning to my upload form after submission. Thanks in advance. Below is my code:
Controller:
function do_upload()
{
if($this->Upload_model->do_upload())
{
$this->load->view('home/upload_form');
}else{
$this->load->view('home/upload_success', $error);
}
}
Model:
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2000';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
return $error;
}
else
{
$data = $this->upload->data();
$full_path = 'uploads/' . $data['file_name'];
$spam = array(
'image_url' => $full_path,
'url' => $this->input->post('url')
);
$id = $this->input->post('id');
$this->db->where('id', $id);
$this->db->update('NavItemData', $spam);
return true;
}
}
View (called upload_form):
<html>
<head>
<title>Upload Form</title>
</head>
<body>
<?php if(isset($buttons)) : foreach($buttons as $row) : ?>
<h2><?php echo $row->image_url; ?></h2>
<p><?php echo $row->url; ?></p>
<p><?php echo $row->name; ?></p>
<p><?php echo anchor("upload/update_nav/$row->id", 'edit'); ?></p>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>
Is there a way to use jQuery (or generic javascript) to disable CSS inheritance on a block level? For example, if I am pulling in an external resource via javascript, say pastie.org, they will have their own CSS that my CSS overrides. I would like to place the embed code into its own container that has CSS inheritance disabled.
This is not my own CSS structure, so I can't rename IDs Classes or inline anything to make it work, the holy grail of inheritance blocking is my last resort.
I've Got a program that uploads/downloads files into an online server,Has a callback to report progress and log it into a textfile, The program is built with the following structure:
public void Upload(string source, string destination)
{
//Object containing Source and destination to pass to the threaded function
KeyValuePair<string, string> file = new KeyValuePair<string, string>(source, destination);
//Threading to make sure no blocking happens after calling upload Function
Thread t = new Thread(new ParameterizedThreadStart(amazonHandler.TUpload));
t.Start(file);
}
private void TUpload(object fileInfo)
{
KeyValuePair<string, string> file = (KeyValuePair<string, string>)fileInfo;
/*
Some Magic goes here,Checking The file and Authorizing Upload
*/
var ftiObject = new FtiObject ()
{ FileNameOnHDD = file.Key,
DestinationPath = file.Value,
//Has more data used for calculations.
};
//Threading to make sure progress gets callback gets called.
Thread t = new Thread(new ParameterizedThreadStart(amazonHandler.UploadOP));
t.Start(ftiObject);
//Signal used to stop progress untill uploadCompleted is called.
uploadChunkDoneSignal.WaitOne();
/*
Some Extra Code
*/
}
private void UploadOP(object ftiSentObject)
{
FtiObject ftiObject = (FtiObject)ftiSentObject;
/*
Some useless code to create the uri and prepare the ftiObject.
*/
// webClient.UploadFileAsync will open a thread that
// will upload the file and report
// progress/complete using registered callback functions.
webClient.UploadFileAsync(uri, "PUT", ftiObject.FileNameOnHDD, ftiObject);
}
I got a callback that is registered to the Webclient's UploadProgressChanged event , however it is getting called twice per sent request.
void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
FtiObject ftiObject = (FtiObject )e.UserState;
Logger.log(ftiObject.FileNameOnHDD, (double)e.BytesSent ,e.TotalBytesToSend);
}
Log Output:
Filename: C:\Text1.txt Uploaded:1024 TotalFileSize: 665241
Filename: C:\Text1.txt Uploaded:1024 TotalFileSize: 665241
Filename: C:\Text1.txt Uploaded:2048 TotalFileSize: 665241
Filename: C:\Text1.txt Uploaded:2048 TotalFileSize: 665241
Filename: C:\Text1.txt Uploaded:3072 TotalFileSize: 665241
Filename: C:\Text1.txt Uploaded:3072 TotalFileSize: 665241
Etc...
I am watching the Network Traffic using a watcher, and only 1 request is being sent.
Some how i cant Figure out why the callback is being called twice, my doubt was that the callback is getting fired by each thread opened(the main Upload , and TUpload), however i dont know how to test if thats the cause.
Note: The reason behind the many /**/ Comments is to indicate that the functions do more than just opening threads, and threading is being used to make sure no blocking occurs (there a couple of "Signal.WaitOne()" around the code for synchronization)
Hi,
I have design problem regarding async calls to method.
I'd like to know best/good pattern to call async method, which calls another async method, which calls another async method :)
In other words, I have WCF service reference created with async methods and I want to call them from another async method which is called by other async method.
All this for non blocking GUI.
Thanks!
I am amazed by the architectural design of node.js and was wondering if C# is capable of such design:
Asynchronous, event based / event loop, non-blocking IO without multithreading.
Hi,
I am making modifications to elements on UI. There is no (extra) thread or any async. calls. However I want to give a slow motion effect, so wait specific time at each step in a for loop. How can I achieve this without blocking the UI?
Let's say I want to "pause" a thread so that other threads can run more efficiently. What is the minimum sleeping period before blocking becomes pointless (or almost pointless)?
Using PHP: How can I create an image to display an email address (to help reduce spam)?
Meaning, if I want to display "[email protected]" on my web page, since crawlers can easily find that text - I want to display the email address as an image that says "[email protected]".
How do I do that? I want the font to be:
color: #20c
font: 11px normal tahoma
The mail() function is bad, because it is so permissive with headers that you pretty much can't use it with any user input without subjecting yourself or others to spam. So what is the simplest substitute that can still ensure that it's use is secure?
Ideally something that can be included in an external file.
I am using a database to persist the state of a search form. I am using the onPause method to persist the data and the onResume method to restore it. My opinion is that restoring and persisting state should be a blocking operation so I plan to perform the database operations on the UI thread. I know this is generally discouraged but the operations should be quick and I think if they were done asynchronously they could lead to inconsistent UI behaviour.
Any advice
Python
params = urllib.parse.urlencode({'spam': '1', 'eggs': '2', 'bacon': '3'})
binary_data = params.encode('utf-8')
reg = urllib.request.Request("http://www.abc.com/abc/smart/ap/request/",binary_data)
reg.add_header('Content-Type','application/x-www-form-urlencoded')
f = urllib.request.urlopen(reg)
print(f.read())
PHP
if($_SERVER['REQUEST_METHOD'] == 'POST') {
//parse_str($_SERVER['QUERY_STRING']);
var_dump($_SERVER['QUERY_STRING']);
}
When i try print binary_data , it does show the parameter but by the time it reaches the PHP , i see nothing.
Any idea?
Does asynchronous call always create a new thread?
Example:
If Javascript is single threaded then how can it do an async postback? Is it actually blocking until it gets a callback? If so, is this really an async call?
Hi folks,
I would like to use Twisted non-blocking getPage method within a webapp, but it feels quite complicated to use such function compared to urlopen.
This is an example of what I'm trying to achive:
def web_request(request):
response = urllib.urlopen('http://www.example.org')
return HttpResponse(len(response.read()))
Is it so hard to have something similar with getPage?
I don't have multiple threads or anything like that, and I thought select() was non-blocking, however, as I add more items to an array used as the IO object, and using select(), after about 1000~ items in the array (with some interaction on them).. the whole script exits with a deadlock / fatal error...
Hope any1 could help
Thank you so much!
I've just signed up for the Google group entitled Test Driven Development but it's only had 3 posts in 2010 and seems to be littered with spam.
Does anyone know of a good TDD focussed place to ask those general perhaps 'subjective' questions which might not be welcomed on SO?
I've used coldfusion for sending text emails for years. I'm not interested in learning how to send those pretty emails you see from companies like Mint.
Anyone know of a good Coldfusion tutorial to teach me how to make this work and not get hit by bugs or spam filters?
Thxs
In Mac OS, Fire fox Version 3.6.3 is blocking XMLHttp Object in one machine but it didn't block in same set of OS and browser versions in other machine. Is there any way to enable or disable xmlhttp from browser?
I want to put an unique image (1x1) on an e-mail marketing (not spam) of my client. Just like www.spypig.com, I'd like to use it to know how many people have actually read the e-mail. I guess I'll have to check how many times this unique image has been accessed, but I can't figure out how to do it.
So my question is: Is there a way to check how many times an image file was accessed using ASP.NET/C#?
Thank you
To make a long story short: Same client-server configuration, same network topology, same device (Bold 9900) - works perfectly well on OS 7.0 but doesn't work as expected on OS 7.1 and the secured tls connection is being closed by the server after a very short time.
My application opens a secured tls connection to a server. The connection is kept alive by a application layer keep-alive mechanism and remains open until the client closes it. Attached is a simplified version of the actual code that opens connection and reads from the socket. The code works perfectly on OS 5.0-7.0 but doesn't work as expected on OS 7.1.
When running on OS 7.1, the blocking read() returns with -1 (end of the stream has been reached) after very short time (10-45 seconds). For OS 5.0-7.0 the call to read() remains blocking until next data arrives and the connection is never closed by the server.
Connection connection = Connector.open(connectionString);
connInputStream = connection.openInputStream();
while (true) {
try {
retVal = connInputStream.read();
if (-1 == retVal) {
break; // end of stream has been reached
}
} catch (Exception e ) {
// do error handling
}
// data read from stream is handled here
}
UPDATE 1:
Apparently, the problem appears only when I use secured tls connection (either using mobile network or WiFi) on OS 7.1. Everything works as expected when opening a non secured connection on OS 7.1.
For tls on mobile networks I use the following connection string:
connectionString = "tls://someipaddress:443;deviceside=false;ConnectionType=mds-public;EndToEndDesired";
For tls on Wifi I use the following connection string:
connectionString = "tls://someipaddress:443;deviceside=true;interface=wifi;EndToEndRequired"
UPDATE 2:
The connection is never idle. I am constantly receiving and sending data on it. The issue appears both when using mobile connection and WiFi. The issue appears both on real OS 7.1 devices and simulators. I am starting to suspect that it is somehow related either to the connection string I am using or to the tls handshake.
UPDATE 3:
According to Wireshark's captures that I made with the OS 7.1 simulator, the secured tls connection is being closed by the server (client receives FIN). For the moment I don't have the server's private key therefore I unable to debug the tls handshake.