Really simple question, how do I combine echo and cat in the shell, I'm trying to write the contents of a file into another file with a prepended string?
If /tmp/file looks like this:
this is a test
I want to run this:
echo "PREPENDED STRING"
cat /tmp/file | sed 's/test/test2/g' > /tmp/result
so that /tmp/result looks like this:
…
I have to write a method that returns a linked list with all the nodes that are common to two linked lists using recursion, without loops.
For example,
first list is 2 - 5 - 7 - 10
second list is 2 - 4 - 8 - 10
the list that would be returned is 2 - 10
I am getting nowhere with this.. What I have been think of was to check each value…
I am using Doctrine and trying to implement an infinite scroll on a collection of notes displayed on the user's browser.
The application is very dynamic, therefore when the user submits a new note, the note is added to the top of the collection straightaway, besides being sent (and stored) to the server.
Which is why I can't use a…
Spring-data-rest does a great job exposing entities via their primary key for GET, PUT and DELETE etc. operations.
/myentityies/123
It also exposes search operations.
/myentities/search/byMyOtherKey?myOtherKey=123
In my case the entities have a number of alternate keys. The systems calling us, will know the objects by these…
I use a dynamic table:
<html>
<body>
<button id="button">Build table</button>
<div id="container">
<script type="text/javascript">
window.onload=function(){
var table = null;
var row = "<tr><td>111111111111111111111111111111111111111111111111111111</td>" +
…
PEP 8 says that Python package and module names should be short, since some file systems will truncate long names. And I'm trying to follow Python conventions in a new project. But I really like long, descriptive names. So I'm wondering, how short do names need to be to comply with PEP 8. And does anyone really worry about…
Hi everyone,
Basically I'm trying to pass a javaScript function to a Java method to act as a callback to the script.
I can do it - sort of - but the object I receive is a sun.org.mozilla.javascript.internal.InterpretedFunction and I don't see a way to invoke it.
Any ideas?
Here's what I have so far:
var someNumber =…
Hi,
I'm trying to use the header() function to create a redirect. I would like to display an error message. Currently I'm sending the message as a parameter through the URL, however this makes it look quite ugly.
Is there a way to pass this value as a post variable instead?
Any advice appreciated.
Thanks.
I'm making a call to PayPal's credit card processor, and after a successful/unsuccessful transaction it returns me a string that looks like this:
DoDirectPayment failed: Array ( [TIMESTAMP] = 2010%2d05%2d02T23%3a33%3a28Z [CORRELATIONID] = 8c503f5c6c861 [ACK] = Failure [VERSION] = 51%2e0 [BUILD] = 1268624 [L_ERRORCODE0] =…
I am using Rails 2.1 to output tables from a database. But the output includes lots of extra lines and tabs. I am using a while loop with lots of nested if statements. I am also wrapping all of my non-output lines in <%- code -%. Any idea what might be happening and a solution? Thanks,
ex:
<tr>
…
I'm using a the confirmit java script function to redirect to a new url with a positive response. It doesn't do exactly what I want - and maybe I can't have exactly what I want.
Here's what it does - onunload, with a positive response it opens the new url in a new window, which can be blocked by a pop-up blocker…
I'm finding that Char fields are being padded.
Is there any way to stop this happening.
I've tried using the property
SET PROPERTY "sql.enforce_strict_size" FALSE
but doesn't seem to help.
I have my menu button bringing up a Settings option, which brings up numerous ListPreferences such as weight and various sizes for glasses (it's a BAC calculator app). I'll pick one example... weight will work.
Depending on how much you weigh it will affect your BAC. I have a int for Weight, set at 180. I would…
I have my menu button bringing up a Settings option, which brings up numerous ListPreferences such as weight and various sizes for glasses (it's a BAC calculator app). I'll pick one example... weight will work.
Depending on how much you weigh it will affect your BAC. I have a int for Weight, set at 180. I would…
I'm struggling with understanding Entity Framework and POCO objects. Here's what I'm trying to achieve.
1) Separate the DAL from the Business Layer by having my business layer use an interface to my DAL. Maybe use Unity to create my context.
2) Use Entity Framework inside my DAL.
I have a Domain model with…
My application is multithreaded with intensive String processing. We are experiencing excessive memory consumption and profiling has demonstrated that this is due to String data. I think that memory consumption would benefit greatly from using some kind of flyweight pattern implementation or even cache (I know…
I really want to learn how to program. A friend suggested I buy vs 2005 or a newer version if I'm serious about it. Is there a cheaper route? I would like to start with c#.
We have a situation at work where developers working on a legacy (core) system are being pressured into using GOTO statements when adding new features into existing code that is already infected with spagetti code.
Now, I understand there may be arguments for using 'just one little GOTO' instead of spending…
I have two different data models that map to the same Car entity. I needed to create a second entity called ParkedCar, which is identical to Car (and therefore inherits from it) in order to stop nhibernate complaining that two mappings exists for the same entity.
public class Car
{
protected Car()
…
I would like to mix several sound (wave) streams into one.
Each stream might have a different format (bits/sample, channel count, etc.), so conversion is needed also.
I am looking for a library to do this, which I can link into my VS C++ project, before jumping in and implementing my own.
I have a JQuery dialog box on a page that calls something like this:
$.post("/MyController/MyAction", { myKey: key} //...
And this successfully gets here:
[HttpPost]
public ActionResult MyAction(int myKey)
{
//do some stuff
return RedirectToAction("AnotherAction");
}
The problem is that…
In FitNesse, can variables be defined in terms of other variables?
I want to do the equivalent of:
int a=3;
int b=a;
To make this concrete, I have a variable defining the date:
!define clock.date {2/2/2009}
I then want to define some other variable ${other.date} based on it, something…