Jump to content


Member Since 26 Aug 2009
Offline Last Active Dec 13 2016 03:58 PM

Topics I've Started

memory management examples?

08 May 2013 - 09:18 PM

Hi, never bothered much with memory management in C++ except when it was already in the code. I simply write my variables array etc without worrying about all that deallocating allocating stuff. I'm having a little bit of an issue understanding when it is necessary and when it is not. Now supposedly smart pointers are supposed to a handy blanket solution to C++ memory issues so that you don't have worry about anything else besides them right? Can somebody point me to some easy to understand samples of smart pointers specifically aimed toward someone who's trying to understand when they're necessary?

arbitrary sort function

05 April 2013 - 06:11 PM

Hi, does anyone know of a C++ sort algorithm or library that can take input of a bunch of rows and sort rows by an arbitrary defined order of such as


ie sort rows by first column in this order (boba bobc bobe bobx) etc?

awk in perl

04 April 2013 - 05:15 PM

Hi, I ran across this line in a perl file


system ("awk \'\$1 == \"$label\" && \$3 <= $apex && \$4 >= $apex\{print\}\' $reference >temp_marker_$name") ==0 or die "$0 failed to awk";

Does anyone have an idea of what its doing? It seems to be printing out if some comparisons are met is as far as I figure.


Also what is with a variable name like temp_marker_$name? Aren't scalar variables supposed to start with $ and not have them in the middle? What is the purpose of the slashes in the awk command?

problem with perl input

18 March 2013 - 01:04 AM

hi, I'm having trouble running a perl script in both windows 7 and ubuntu

in windows when I try to run it it states the input file is specified twice

in ubuntu it claims it can't find the input file to open even though its in the same directory as the pl file I'm running.

here is the code up to the error point which occurs around the system function.


use strict;

use warnings;

use File::Spec;

my $inputFile = $ARGV[0];

my $backgroudFile = $ARGV[1];

#get name of the tester file and set it as the current working directory

my ($inputFileVolume,$inputFileDir,$name) = File::Spec->splitpath($inputFile);

my @workingDirArr = ($inputFileVolume,$inputFileDir);

my $workingDir = File::Spec->catdir(@workingDirArr);

chdir $workingDir or die "$0 failed to chdir to working dir $workingDir";

system ("sort -k 1,1 -k 4n -T $workingDir $name >tempLoc_$name")==0 or die "$0 failed to sort $name";

open (NAM, "tempLoc_$name") or die "$0 failed to open file tempLoc_$name";

perl file function

04 March 2013 - 05:47 PM

my ($bumpFileVolume,$bumpFileDir,$name) = File::Spec->splitpath($bumpFile);
my @workDirArr = ($bumpFileVolume,$bumpFileDir);
my $workDir = File::Spec->catdir(@workDirArr);
chdir $workDir or die "$0 failed to chdir to working dir $workDir";

system ("sort -k 1,1 -k 4n -T $workDir $name >tempLoc_$name")==0 or die "$0 failed to sort $name";
open (BRK, "tempLoc_$name") or die "$0 failed to open file tempLoc_$name";
open (OUTTWO, ">loc_analyze_$name") or die "$0 failed to open file loc_analyze_$name";



I'm a little confused as to whats happening here. What does it mean to create the variable $name attach it to the file I assume is $bumpfile and then use in as the part of loc_analyze_$name? Are they creating a new file or simply opening up an old one?