~80% of the code I write is in C#. The other ~20% is in C++. Whenever I have to switch from C# to C++, it takes me quite a while to mentally "shift gears" to thinking in C++. I make simple mistakes using pointers and memory allocation that I would not have made when I was in university.
Is this normal? Does anyone else experience something similar and if so, what do you do to cut down on the time this wastes?
How can I return a java.util.concurrent.Future object with a Receipt object and only use the @javax.ejb.Asynchronous annotation?
And do I need any extra configuration to let Spring handle ejb annotations?
I don't want to write any concurrency logic myself.
Here's my attempt that doesn't work:
@Asynchronous
public Future<Receipt> execute(Job job) {
Receipt receipt = timeConsumingWork(job);
return receipt;
}
Hello, everybody!
I have a file in which a matrix is stored. This file has a RandomAccessFile type. This matrix is stored by columns. I mean that in an i-th row of this matrix an i-th column (of a real matrix) is stored. There is an example:
i-th row: 1 2 3 4 (in the file). That means that the real matrix has an i-th column: (1 2 3 4)(transpose).
I need to save this matrix in natural way (by rows) in a new file, which I will then open with FileReader and display with TestArea.
DO you know, how to do that? If so, please help =)
forgive me, but I don't know the technical term to know what to search for.
I am trying to find a way to keep track of changes in my code during the development of my program. something that would allow me to go back to a section of code that I deleted. I am not talking about "undo". But rather a way that would let me keep track or be able to retrieve a section of my code that I deleted but now want it back.
Is there such a way. If there is, then what is this whole system/procedure called? Is there something that integrates with visual studio 2010?
Many thanks for your help.
I am interested in implementing an architecture that has two databases one for read operations and the other for writes. I have never implemented something like this and have always built single database, highly normalised systems so I am not quite sure where to begin. I have a few parts to this question.
1. What would be a good resource to find out more about this achitecture?
2. Is it just a question of replicating between two identical schemas, or would your schemas differ depending on the operations, would normalisation vary too?
3. How do you insure that data written to one database is immediately available for reading from the second?
Any further help, tips, resources would be appreciated. Thanks.
So I am required to write a fairly basic Windows service and have never done so before. Of C#, C++ (the Visual Studio suite), what is the best language to develop in? I am a student, and am most familiar with OO languages such as Java.
Additionally, if anyone can recommend any books, articles, or google searches that would be relevant to the project I would greatly appreciate it.
Thanks!
badPanda
Hey,
My background has been generally new technology demonstrators, which, well... demonstrate the latest technology and how it can be of use to a clients company. They use it for internal demos etc.
Now my career has shiffed course a bit more into actual products, in particular software which runs in locations like museums as interactive pieces.
Clearly, although the technology demonstrators had to be well coded etc, there wasn't as much emphasis as there is on my current work, which has to work, be highly configurable, probably multi-ligual and run constantly, without restarts.
So my question is, now that I'm trying to up my coding quality and write more commercial applications, are there any books which discuss issues surrounding high quality commercial software?
I currently have a copy of Code Complete 2nd Edition, which is excellent, but just wondering if there's any better, possibly more focused titles out there?
Thanks a lot!
Andy.
Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
I am just starting to explore this area and wonder what are the best practices when it comes to production of clean, well-structured and maintainable CSSes.
There seems to be few different approaches to structuring CSS rules.
One of the most commonly encountered ones I saw was throwing everything together in one rule, i.e. margins, borders, typefaces, backgrounds, something like this:
.my-class {
border-top:1px solid #c9d7f1;
font-size:1px;
font-weight:normal;
height:0;
position:absolute;
top:24px;
width:100%;
}
Another approach I noticed employed grouping of properties, say text-related properties like font-size, typeface, emphasis etc goes into one rule, backgrounds go into other, borders/margins go into yet another one:
.my-class {
border-top:1px solid #c9d7f1;
}
.my-class {
font-size:1px;
font-weight:normal;
}
.my-class {
height:0;
top:24px;
width:100%;
position:absolute;
}
I guess I am looking for a silver bullet here which I know I am not going to get, bet nevertheless - what are the best practices in this space?
Check client side that any 2 out of three fields have been completed before allowing submision of a form
Show/hide data capture fields based on the value of a check box (all client side)?
However, what if one of my processes needs to continuously write to the pipe while the other pipe needs to read?
This example seems to work only for one write and one read. I need multi read and write
void executarComandoURJTAG(int newSock) {
int input[2], output[2], estado, d;
pid_t pid;
char buffer[256];
char linha[1024];
pipe(input);
pipe(output);
pid = fork();
if (pid == 0) {// child
close(0);
close(1);
close(2);
dup2(input[0], 0);
dup2(output[1], 1);
dup2(output[1], 2);
close(input[1]);
close(output[0]);
execlp("jtag", "jtag", NULL);
}
else { // parent
close(input[0]);
close(output[1]);
do {
read(newSock, linha, 1024);
/* Escreve o buffer no pipe */
write(input[1], linha, strlen(linha));
close(input[1]);
while ((d = read(output[0], buffer, 255))) {
//buffer[d] = '\0';
write(newSock, buffer, strlen(buffer));
puts(buffer);
}
write(newSock, "END", 4);
} while (strcmp(linha, "quit") != 0);
}
}
These days, generally when someone references BASIC they are asking about a Microsoft implementation - either VB.NET or VB6. Are there any dialects/versions of BASIC still actively used outside of the Microsoft implementations?
On Tiger, I used a custom python installation to evaluate newer versions and I did not have any problems with that*. Now Snow Leopard is a little more up-to-date and by default ships with
$ ls /System/Library/Frameworks/Python.framework/Versions/
2.3 2.5 2.6 @Current
What could be considered best practice? Using the python shipped with Mac OS X or a custom compiled version in, say $HOME.
Are there any advantages/disadvantages using the one option over the other?
My setup was fairly simple so far and looked like this: Custom compiled Python in $HOME and a $PATH that would look into $HOME/bin first, and subsequently would use my private Python version. Also $PYTHONPATH pointed to this local installation. This way, I did not need to sudo–install packages - virtualenv took care of the rest.
Hi, couldn't find it exactly from earlier questions, but I am probably repeating an earlier question, so apologies upfront ;-)
I am looking for a simple code to embed a QR 2D code generator on a website I am building. I assume their should be some free open source code for that but I could only find paid software.
Can anyone point me in the right direction? would be mostly appreciated!
best regards,
Robbert
I launch script.sh and inside it i want to know what is his name
Is there a standard procedure to know the scripts name ? the idea is to be able to extract the name from teh full path + name contained in $0
Thanks
In Adobe Flash, I have a movie clip that is added to the stage when the keyboard is pressed. I want it to travel across the screen and disappear once it reaches the edge of the stage. At the moment I use this but the image appears and then stops. Here is my code:
addEventListener(Event.ADDED_TO_STAGE,runtime);
var c = 0
function runtime(){
while(this.x<800){
this.x += 12;
}
removeChild(this);
}
Thanks
Is it allowed by the Boost License to just add the source code of the stuff I need to my project (accompanied by the license of course?). I couldn't find any "descriptive" confirmation. I would have seperate Include/boost and Source/boost directories for easy access.
PS: Seeing as boost::filesystem is going into C++0x TR2, and lambda's are already in c++0x TR1, I don't see any reason to be juggling with C functions like realpath, getcwd and the like. They don't work well anyways...
I want to define a handful of (ADO.NET) appenders in my library, but allow users of my library to configure the use of those appenders. Something like this seems to be what I want:
XmlConfigurator.Configure(appenderStream1);
XmlConfigurator.Configure(appenderStream2);
XmlConfigurator.Configure();
But that doesn't seem work, in spite of the debug output containing messages like this:
Configuration update mode [Merge].
What is the right way to do this? Or, is there an alternative to asking users to duplicate large chunks of XML configuration?
I want to do some funky things with controlling MIDI streams, and I'd like to be able to pipe MIDI input into an application like Ableton or Reason. Presumably this involves some sort of driver level work?
Ultimately I'd like to write my application in Python, so if there is some Python-based solution, I'd consider it. I'm perfectly fine with using C/C++, though, so that's not a problem.
What if the user wanted to enter his/her grades in the following way:
Will 23, 34, 45, 45 how would i get
rid of the commas
public class StudentAverage
{
public static void main(String[] args)
{
int markSum = 0;
double average = 0;
Scanner input1 = new Scanner(System.in);
System.out.print("Enter student record : ");
String name = input1.next();
Scanner input2 = new Scanner(input1.nextLine());
int countTotal = 0;
while (input2.hasNextInt())
{
countTotal++;
markSum += input2.nextInt();
}
average = markSum / countTotal; // to calculate the total average
System.out.print( name + " " + average );
}
}
This sounds like a issue a beginner like me would only have...this is my code...
private void saveAvatar(Bitmap avatar) {
String strAvatarFilename = Id + ".jpg";
try {
avatar.compress(CompressFormat.JPEG, 100, openFileOutput(strAvatarFilename, MODE_PRIVATE));
} catch (Exception e) {
Log.e(DEBUG_TAG, "Avatar compression and save failed.", e);
}
Uri imageUriToSaveCameraImageTo = Uri.fromFile(new File(PhotoActivity.this.getFilesDir(), strAvatarFilename));
Editor editor = Preferences.edit();
editor.putString(PREFERENCES_AVATAR, imageUriToSaveCameraImageTo.getPath());
editor.commit();
ImageButton avatarButton = (ImageButton) findViewById(R.id.ImageButton_Avatar);
String strAvatarUri = Preferences.getString(PREFERENCES_AVATAR, "");
Uri imageUri = Uri.parse(strAvatarUri);
avatarButton.setImageURI(null);
avatarButton.setImageURI(imageUri);
}
This does save the image but when i go to look at the image on the sd card ti is called imag001 etc not the ID i am labelling it. How do i save the image with a name i want to call it? regards
http://www.tiddlywiki.com/
The above site provide a wiki tool which essentially is just a .html file,but it can save files via javascript,anyone knows how is it implemented?
So I'm saving small images to core data which take a really short amount of time to save, like .2 seconds but I'm doing it while the user is flipping through a scroll view so in order to improve responsiveness I'm moving the saving to a thread. This works great, everything gets saved and the app is responsive. However, there is one thing in the core-data + multithreading doco that worries me:
"In Cocoa, only the main thread is not-detached. If you need to save on other threads, you must write additional code such that the main thread prevents the application from quitting until all the save operation is complete."
Ok, how do you do that? It only needs to last ~ .2 seconds and its rarely going to happen since the chance of the app quitting as something is saving is very low. How do I run something on the main thread that'll prevent the app from quitting AND not block the gui?
Thanks
I'm working on a python program for homework and the problem asks me to develop a program that encrypts a message using a caesar cipher. I need to be able to have the user input a number to shift the encryption by, such as 4: e.g. 'A' to 'E'. The user also needs to input the string to be translated. The book says to use a zip() to do the problem. I am confused on how I would do this though.
I have this but it doesn't do anything
>>>def ceasarCipher(string, shift):
strings = ['abc', 'def']
shifts = [2,3]
for string, shift in zip(strings, shifts):
print ceasarCipher(string,shift)
>>>string = 'hello world'
>>>shift = 1