I would like to know if my .Net code can write into Windows log--Application part of the Event Viewer on Windows 2008 server and Windows 7 if I am a Non-administrator user.
hi all,
is it possible to write database methods in properties file, like some database queries and can be accessed using servlets which may reduce the code?
please any body help
Hello all, I have been trying to post blogs to Blogger via the API provided for posting but the problem I have is how to write the ruby code for the http post that will be able to carry the texts and make the post. In the API, it is stated that one has to First, create an XML representation of the post to publish.
Please can someone help me with a suggestion. This is the API that was provided: "http://www.blogger.com/feeds/blogID/posts/default"
I'm totally rookie as to PHP. I want to write a PHP script in which it can access a remote cgi via http to get some data. I know that PHP is able to fopen any remote URL and fetch file content, but I concern about the result returned by cgi script, not the script itself.
Hi all, I'm trying to write a bit of jquery which finds all h2 tags inside a div (.content), then appends each one into another div (.intro).
So far I have this:
var h2 = $(".content").find("h2");
$(h2).each(function() {
$(this).append(".intro");
});
But it's not working.. if someone could help me out, that'd be great :)
More of a general question - I don't understand the workings of NSURLSession when using it in "background session mode". I will supply some simple contrived example code.
I have a database which holds objects - such that portions of this data can be uploaded to a remote server. It is important to know which data/objects were uploaded in order to accurately display information to the user. It is also important to be able to upload to the server in a background task because the app can be killed at any point.
for instance a simple profile picture object:
@interface ProfilePicture : NSObject
@property int userId;
@property UIImage *profilePicture;
@property BOOL successfullyUploaded; // we want to know if the image was uploaded to out server - this could also be a property that is queryable but lets assume this is attached to this object
@end
Now Lets say I want to upload the profile picture to a remote server - I could do something like:
@implementation ProfilePictureUploader
-(void)uploadProfilePicture:(ProfilePicture *)profilePicture completion:(void(^)(BOOL successInUploading))completion
{
NSUrlSession *uploadImageSession = ..... // code to setup uploading the image - and calling the completion handler;
[uploadImageSession resume];
}
@end
Now somewhere else in my code I want to upload the profile picture - and if it was successful update the UI and the database that this action happened:
ProfilePicture *aNewProfilePicture = ...;
aNewProfilePicture.profilePicture = aImage;
aNewProfilePicture.userId = 123;
aNewProfilePicture.successfullyUploaded = NO;
// write the change to disk
[MyDatabase write:aNewProfilePicture];
// upload the image to the server
ProfilePictureUploader *uploader = [ProfilePictureUploader ....];
[uploader uploadProfilePicture:aNewProfilePicture completion:^(BOOL successInUploading) {
if (successInUploading) {
// persist the change to my db.
aNewProfilePicture.successfullyUploaded = YES;
[Mydase update:aNewProfilePicture]; // persist the change
}
}];
Now obviously if my app is running then this "ProfilePicture" object is successfully uploaded and all is well - the database object has its own internal workings with data structures/caches and what not. All callbacks that may exist are maintained and the app state is straightforward.
But I'm not clear what happens if the app "dies" at some point during the upload. It seems that any callbacks/notifications are dead. According to the API documentation- the uploading is handled by a separate process. Therefor the upload will continue and my app will be awakened at some point in the future to handle completion. But the object "aNewProfilePicture" is non existant at that point and all callbacks/objects are gone. I don't understand what context exists at this point. How am I supposed to ensure consistency in my DB and UI (For instance update the "successfullyUploaded" property for that user)? Do I need to re-work everything touching the DB or UI to correspond with the new API and work in a context free environment?
I have to register two users and simulate interaction between them (for example, a conversation).
I can do the following: register the first user, then register the second, sign in using first user's data, write message to the second user and sign out. Then sign in using the second user's data, answer to the message and sign out.
Is it possible to implement users' conversation without signing out if the system requires enabled cookies for users?
I am running SQL Server 2005 and I want to dump some dummy data into a large table with about 50 columns (I did not design it :P) - anyone know a tool to do this automatically? I want the rows to have all sorts of different data, and I would rather not write a script if there is already a tool out there - thanks.
I've been trying to jump on the TDD bandwagon for some time now, and it's been going well except for one crucial thing, normally what I end up doing is Test After Development.
I need a mental shift and am wondering how did you force yourself to write tests first?
On Linux, normally I use ptrace function to trace all syscall, and kill the process if the it tries to do anything harmful to my machine, such as system("shutdown -s -t 00") or so.
Is there a way for me to do this on Windows?
EDIT: I want to write Sandbox program to limit time and memory usage of its child that can work on both Windows and Linux, and now it can only run on Linux via ptrace
I frequently see python code similar to
for line in open(filename):
do_something(line)
When does filename get closed with this code?
Would it be better to write
with open(filename) as f:
for line in f.readlines():
do_something(line)
I have 2 dimensional table in file, which look like this:
11, 12, 13, 14, 15
21, 22, 23, 24, 25
I want it to be imported in 2 dimensional array. I wrote this code:
INTEGER :: SMALL(10)
DO I = 1, 3
READ(UNIT=10, FMT='(5I4)') SMALL
WRITE(UNIT=*, FMT='(6X,5I4)') SMALL
ENDDO
But it imports everything in one dimensional array.
This will sound naive (but then I am a junior programmer), but if I write a web service say in Python (standard WSDL web service), I then need to host it so it is reachable from an end point.
This will give a URI for the service and then from another language, say Java or VB.NET (any), I can add a web service (this one) and then call the web service's object model, correct?
Thanks
I'd like to be able to just write a class and get a table generated in my DB along with all the properties of that class. In EJB it's possible to let the container handle the data and "sync" with the DB. I'd like something like this in VS2008 with C# .NET and ASP.NET.
Is there anything remotely like this on the market?
I've heard many things about performance in C; casting is slow compared to normal assignments, functional call is slow, binary operation are much faster than normal operations, et cetera...
I'm sure some of those things are specific to the architecture, and compiler optimization might make a huge difference, but I would like to see a chart to get a general idea what I should do and what I should avoid to write high-performance programs. Is there such a chart (or a website, a book, anything) ?
I am experimenting with Less Css, and I am using Visual Studio 2010.
It would be nice if the editor provided support for syntax highlighting and Intellisense for Less, for instance coloring and suggesting variables. What are my options to get that to work ? Do I need to write a plugin for it, or how would one go about adding this to VS ? Does anything exist for this already ?
hello everyone
i have a series of PDF byte arrays in a arraylist files that i wish to concatenate into one file,
currently when the PDF application trys to open the file is it corrupted:
foreach (byte[] array in files)
{
using (Stream s = new MemoryStream(downloadbytes))
{
s.Write(array, 0, array.Length);
}
}
downloadbytes is the resultant concatenated array of bytes below is another implementation which also failed
foreach (byte[] array in files)
{
System.Buffer.BlockCopy(array, 0, downloadbytes, offset, array.Length);
offset += array.Length;
}
any pointers?
I need to divide a scene in to two layers. So that I can write same methods for two layers.
So I may get two functionalities. But can I make that ? Is there a possibility in cocos2d?
Thank You
I could write myself a helper class that does this when given a functor, but I was wondering if there's a better approach, or if there's something already in the standard library (seems like there should be).
Answers I've found on StackOverflow are all for C# which doesn't help me.
Thanks
Hi,
I have a Perl script running in mod_perl that needs to write a large amount of data to the client, possibly over a long period. The behavior that I observe is that once I print and flush something, the buffer memory is not reclaimed even though I rflush (I know this can't be reclaimed back by the OS).
Is that how mod_perl operates and is there a way that I can force it to periodically free the buffer memory, so that I can use that for new buffers instead of taking more from the OS?
Hello,
I have a slow mySQL query in my application that I need to re-write. The problem is, it's only slow on my production server and only when it's not cached. The first time I run it, it will take 12 seconds, then anytime after that it'll be 500 milliseconds.
Is there an easy way to test this query without it hitting the query cache so I can see the results of my refactoring?
Thanks!
I need to make a questionary(test) from users then write their answers in a database, I want to make a test on a web page. Please, if somebody know please help me.
Hi
I want to write a simple client that downloads a file from a server using only bsd sockets.
I searched the web but couldn't find anything helpful. Can you give me a direction?
Thanks
Alex
I am attempting to write a LaTeX package which leverages the minted package's \inputminted command. My \mycommand command takes two parameters, the first being a path to a file, and I want to pass the file's extension to the \inputminted command:
\newcommand\mycommand[2]{
\inputminted{#1}{...}
}
Note that the above won't work since the full path is passed to \inputminted.
Example:
\mycommand{/path/to/Test.java}{blah}
should invoke
\inputminted{java}{...}