JasonHippy 739 Practically a Master Poster

There is no need to convert it to C. It is already C code. But it uses conio.h, which is a non-standard C extension that is not supported by all compilers.

Remove the include for conio and remove the call to getch at the end and you're left with standard, portable C code.

JasonHippy 739 Practically a Master Poster

Of course, you need to restart bash after modifying ~/.bashrc.

Actually you don't have to restart bash at all. You can re-load/re-source any of the changed config files in the running shell using the dot command ('.') which is a built-in. So after changing .bashrc, you can re-load it by using the following command:

. ~/.bashrc

This will reload and execute the config file, any changes that were made to the .bashrc file will then affect the running shell. No need to shut down bash and open a new instance. Just use the dot command in all open terminals to re-load the latest config!

As it is a built-in, there is no man page, but the help command will show you more information about it:

help .
Gribouillis commented: good point +14
JasonHippy 739 Practically a Master Poster

I'm not at all familiar with the nosetests package, I've never used it.
And from taking a look at its man-page online, I can't see anything that mentions a --html-file option.

However, I do know shell scripting. So here's a quick, simple shell-script to execute all .py files in the current directory, which renames the results.html file to filename.py.html - where filename.py is the name of the python file being tested.
runtests.sh

#!/bin/bash

#default html file output by nosetests
OUTFILE=results.html 

for FILE in ./*.py;
do
    nosetests $FILE --with-html-out # run test
    if [ -f $OUTFILE ]; then     # if results.txt exists
        mv $OUTFILE $FILE.html   # rename it to testfile.py.html
    fi
done

The above script would have to be in the same directory as the python files you are testing. Make sure you set the execute permissions-bit on the script (chmod +x ./runtests.sh), then you can use ./runtests.sh to run the tests.

After running the script, you should see a bunch of html files alongside your python files, containing the results of the tests.

That is just a simple script that I knocked together quickly. If you want to make it more useful - it would be trivial to modify the script to take a path to a directory as a parameter. That way you could move the script into /home/yourusername/bin/ and you could use it as a general tool to run tests on ANY directory containing python files.

You could modify it further to use something like …

JasonHippy 739 Practically a Master Poster

I'm not really familiar with volatility, but at a guess, I'd say that it wants you to specify a dump directory using the --dump-dir command line option.
So I'd guess you'd need to add --dump-dir /path/to/dump/dir/ or --dump-dir=/path/to/dump/dir/ to your volatility procdump command (depending on how it takes parameters to the --dump-dir option).

NOTE: /path/to/dump/dir/ should be a valid path to a directory which already exists somewhere on your machine.

Once you have specified a directory to use as the dump-dir, I guess it will use that directory to write additional files to.

JasonHippy 739 Practically a Master Poster

The easiest way would be to install a python game/media library like pygame, pyglet or pySFML and use that to play your mp3. There are plenty of other media libraries with python language bindings.

Search your Linux distros package lists for one of the above python modules, or you could install pip (the python2.x package manager) or pip3 (for python3) and use that to install the appropriate library instead.

The exact installation instructions will depend on which Linux distribution you have installed.

There are some examples using various python media libraries here:
http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html

pyglet looks like it will require the least code!

JasonHippy 739 Practically a Master Poster

Nice find. Never heard of that one before! Will check it out at some point. Not done a lot of ruby programming. Would be a great excuse to give it another go!

JasonHippy 739 Practically a Master Poster

Also there is pyQT - The python bindings for the QT GUI library.

JasonHippy 739 Practically a Master Poster

Take a look at this. Should tell you all you need to know know:
http://cinnamon.linuxmint.com/?p=144

As for the clock, I have no idea. Could it be conky, with a custom theme? Can you post a link to the image you saw it in? Might yield more clues!

JasonHippy 739 Practically a Master Poster

If you want an example of creating a boot-loader, you might want to take a look at MikeOS - a simple, open source 16 bit OS for x86 based systems, written in assembly.

The site has a great tutorial here, which shows you how to create your own bootloader using assembly and how to turn it into a bootable image that you can put onto a floppy or a USB drive. Also you can download and examine the source code for MikeOS and refer to the developer guides on the website.

OK, it's only 16 bit, but it's a start isn't it?!

JasonHippy 739 Practically a Master Poster

It's so your server can serve pages over http and https/ssl.

Port 80 is the default port for http traffic (in your case, you've redirected http to port 8080 on your server, which is fair enough). And port 443 is the default port for https.

Typically on a dedicated web server, you wouldn't have Skype installed. So normally this isn't an issue. But your server must be running on a desktop or laptop PC that you use for general day to day usage.

To stop the problem, you have disabled the use of port 443 in skype.
The other option would be to use a different port for https on your server (442?), just like you did with port 8080 for http.

If ssl/https is not required, I imagine it should also be possible to disable it. That said, I haven't done any serious web development for a number of years, so I've had no need for a server. Consequently, I haven't really messed around with setting up and running an Apache web-server for a looong time. So I can't really offer any detailed info. But I'm sure that someone else here will be able to help!

JasonHippy 739 Practically a Master Poster

Your set-top-box must either be using a different implementation or a much older version of find that doesn't have the execdir option. It was added to GNU find as a safer alternative to exec. But exec will do the trick if execdir is not available.

From looking at the man page for find, there is also the -delete option, which I've never noticed before. As you have no need for the maxdepth option, that would leave you with this:

find ./ -type l -delete

Which is even more concise and requires a little less typing. (If your set-top-boxes version of find supports it that is!)

Also, for the sake of completeness:
Depending on the age of the tools that are installed on your set-top-box, some of the commands might not be able to handle file-names containing spaces very well. So the examples I've posted so far could be problematic if any of your files contain spaces in their names.
If files with spaces in their names are a problem to remove, another alternative would be to pipe the list of files output by find to the rm command using xargs:

find ./ -type l -print0 | xargs -0 rm

Finds print0 option will print the full path of each file found, with a null character appended at the end (as opposed to a newline). And then in xargs, the -0 parameter (or --null) will cause xargs to read all characters up to the null character as …

JasonHippy 739 Practically a Master Poster

Or from the command-line you should simply be able to do this:

find ./ -type l -execdir rm {} \;

NOTE: The above will recursively find all sym-links in the current directory (and all sub-directories of the current dir) and remove them with rm. If you only want to find to search the current directory, without going into any subdirectories, you can use the -maxdepth option like this:

find ./ -maxdepth 1 -type l -execdir rm {} \;

Or you could put it into a shellscript:

#!/bin/sh

find /path/to/folder/ -maxdepth 1 -type l -execdir rm {} \;

etc...

EDIT:
For extra safety, you might also want to consider using the -i switch/option with the rm command. This will prompt whether you want to delete each individual file.
e.g.

find ./ -maxdepth 1 -type l -execdir rm -i {} \;

I wouldn't want you to accidentally hose your system using any of my suggestions! ;)

JasonHippy 739 Practically a Master Poster

It's almost certainly because you are using a mixture of cin >> and std::getline to get input from the user.

You might want to consider changing line 17 to use getline because cin >> will only take everything up to the first newline or whitespace character. So if the user enters a multiple word college name; because of the spaces, only the first word will be written to the variable. The rest of the characters (and the newline) will remain in the input stream and will end up being consumed by a subsequent call to cin or getline.

Also, in your main menu; after you prompt the user to enter their preferred option and get the value via cin, you might want to consider using cin.ignore afterwards with some appropriate parameters to allow it to disregard any remaining characters/newlines in the buffer.

To discard extraneous characters from the input buffer after a call to cin, many people tend to use things like: cin.ignore(std::numeric_limits<int>::max(), '\n');

Personally, I side-step this issue in my command-line programs by getting all user input as a string via std::getline. Then I parse and validate the user input before converting it to the required type and range-checking it... Might seem a bit overkill and a PITA, but that's just me. All user input should be considered guilty until proven innocent, heh heh!

WRT your program displaying all colleges in the list, try setting up a boolean sentinel flag/variable just before your for loop at line 31 and …

JasonHippy 739 Practically a Master Poster

Mathematics is the least of your worries if you are planning on using no libraries whatsoever. Especially where graphics is concerned!

In C++ there is nothing in the standard library that can deal with graphics, so you would literally have to write everything yourself. You'd need to do a lot of low-level programming, interfacing directly with the hardware or its drivers in order to do anything graphical. And if you know nothing about C or C++, then that will only compound matters!

I'd say that you are definitely going to need to use some 3rd party libraries. At the very least, you'll need OpenGL. It's pretty much a de-facto standard nowadays for graphical apps - especially if you want to develop cross-platform programs.

To develop your own low-level graphics library to replace OpenGL would take an extremely long time unless you are some kind of brilliant programming prodigy! (Not to say that you aren't, merely pointing out that this would not be a trivial thing to implement!)

But there is nothing to stop you from building your own engine on top of GL.
For example:
All cross-platform game engines (at least all of the ones I am aware of) use openGL for all of the low-level graphics stuff. But they create their own APIs to abstract things away in their engine; making it easier for programmers use their library to work on games/applications at a higher level of abstraction than with GL.

WRT compiling for multiple operating systems, …

JasonHippy 739 Practically a Master Poster

The OPs questions are in the comments in the code.

@OP:
How you would populate the vector of records would depend entirely on how the data has been stored in the input file. You need to read the data from the file and convert that to records that you can store in the vector.
But without knowing the exact format of the data in the input file, nobody can tell you exactly how to do it. It will be down to you to work out that part.

I recommend having a go at this yourself. If you have any problems, please post an updated version of your code, with a description of the problems you are having and an sample of the data in the input file. Not the whole file BTW, just a sample of maybe two or three records, exactly as they appear in the file and somebody here will help you out!

In answer to your second question RE: your switch statement; You have defined a set of functions which all take a reference to a vector of records as a parameter. But in your calls to the functions in your switch statement, you aren't passing any parameters at all. So your compiler is giving you a whole bunch of error messages!

So you need to call the functions like this:
ListAllTheWetDays(records);

JasonHippy 739 Practically a Master Poster

That looks a lot like Python code to me. I think the OP has misposted in the C section.

To compound things, he seems to have a load of line numbers included in the code he posted. I've just cleaned it up.
Here's the OPs original python code:

"""
withdraw_money()
a.  prompt user for a money amount in US Dollars (no cents, i.e. no
    fractional part allowed)
b.  print a preamble which says that user will see the breakdown of the
    money in banknotes
c.  print maximum number of $100 bills that can be given for the amount
    given by user
d.  print maximum number of $50 bills that can be given for the amount left
    over from previous step
e.  print maximum number of $20 bills that can be given for the amount left
    over from previous step
f.  print maximum number of $10 bills that can be given for the amount left
    over from previous step
g.  print maximum number of $5 bills that can be given for the amount left
    over from previous step
h.  print maximum number of $2 bills that can be given for the amount
    left over from previous step
i.  print maximum number of $1 bills that can be given for the amount left
    over from previous step
"""
import math
import string

def withdraw_money():
    withdraw = 0
    hundreds = 0
    fifty = 0
    twenty = 0
    ten = 0
    five = 0
    two = 0
    one = 0
    withdraw = …
JasonHippy 739 Practically a Master Poster

EDIT: Nevermind Moschops got there first! :)

JasonHippy 739 Practically a Master Poster

I've never really messed with vi/vim scripts, other than making a few minor modifications to my .vimrc startup file.

Using vim, you could sort the file using the command :sort.
That will sort the file in exactly the manner you have described. It's only a simple alphabetic sort, so there is no need to pass any parameters.
So you start with this:

JOHN:Morgan:90:24
MIKE:Smith:95:11
JAYSON:Ty:99:9
TYLER:Edward:89:5

Running the :sort command will give you this:

JAYSON:Ty:99:9
JOHN:Morgan:90:24
MIKE:Smith:95:11
TYLER:Edward:89:5

Which is what you wanted isn't it?

From the terminal or a shell-script, you could use the sort utility:
e.g. Sort the file and write the sorted output to a different file:
sort ./file.txt -o ./sorted.txt

But offhand, I'm not sure how you'd go about calling the sort function in a vi/vim script. I really should look into scripting vim though. I currently have a few macros set up in vim to automate various repetetive tasks. But it would be good to be able to write scripts for some of them!

JasonHippy 739 Practically a Master Poster

No worries, glad to have helped. Mark as solved??

JasonHippy 739 Practically a Master Poster

It is almost certain that the kernel module/driver for the sound-card is in use. If Alsa is running, that would also be using the kernel module for the sound card. So something (either the driver or ALSA) is claiming ownership of the sound device and this is most likely stopping libusb from being able to access it - Giving you the 'device busy' error message. (BTW: I'm not sure ownership is the right term, but you get what I mean!)

Why are you using libusb to get data from your sound card? Why not go through another API like ALSA or JACK?
This article might be of some help to you:
http://www.linuxdevcenter.com/pub/a/linux/2007/08/02/an-introduction-to-linux-audio.html

JasonHippy 739 Practically a Master Poster

Tinstaafl is correct. You need to remove the cin.ignore() at line 29. That does not need to be there.

But wherever you use cin to get input from the user (i.e. using cin >>), you need to use a call to cin.ignore() immediately afterwards. But it's not necessary to use ignore after using std::getline.

So put a call to cin.ignore() between lines 36 and 37, 40 and 41, 46 and 47 etc...

JasonHippy 739 Practically a Master Poster

See that semicolon at the end of line 70?
That's your problem!
Thanks to the semicolon, you've effectively set up an infinite loop at line 70.

JasonHippy 739 Practically a Master Poster

Actually, Sanchit is incorrect. You need to be using sudo to move the file. root is the owner of /usr/lib/, so in order to move the red52 folder to /usr/lib/, you will need to be root.
So try this instead:
sudo mv red52/ /usr/lib/
That should work!

JasonHippy 739 Practically a Master Poster

Or as you want to go up a level from the current path, perhaps use find_last_of:

#include <iostream>
#include <string>

int main () {
    std::string src, dst;
    src = "C:\\Windows\\subfolder";
    dst = src.substr (0, src.find_last_of ("\\") + 1);
    std::cout << "Original: " << src << std::endl;
    std::cout << "Modified: " << dst << std::endl;
    return 0;
}
kal_crazy commented: Works perfectly. Thanks +4
JasonHippy 739 Practically a Master Poster

You are using the wrong operator in your if statements. You need to be using the == operator in your if statements, not the = operator!

= is the assignment operator, used to assign a value to a variable.
Whereas == is the test for equality.

EDIT:
In fact, the == operator is incorrect. After looking at your code again, you need to be using the >= (greater than or equal to) operator:
e.g.

if (num >= 400 && num <=424)
    cout<< “ Violet “;
else if (num >= 425 && num <= 491)
    cout<< “ Blue “;
else if (num >= 492 && num <= 575)
    cout<< “ Green “;
else if (num >= 576 && num <= 585)
    cout<< “ Yellow “;
else if (num >= 586 && num <= 647)
    cout<< “ Orange “;
else if ( num >= 648 && num <= 700)
    cout<< “ Red “;
else
    cout<< “ Wavelength outside visual range “;
JasonHippy 739 Practically a Master Poster

Personally, I like a mixture of the two.

At home I like good old-fashioned paper books. I have my own little geek library, which I use for reference/general study and entertainment... Yes, that's right. I said entertainment! There is some fiction in there, it's not all technical manuals! Heh heh!

I also have a library of ebooks backed-up on one of my removable HDs at home. I have a USB stick loaded with the ebooks I use most often, giving me quick and easy access to them on any PC I use (work, home, friends etc).

And then there's my trusty old Sony e-reader - which I love when I am on the move. With it I can carry an entire library. All of the information, but absolutely none of the weight! Great for travelling/holidays. Also great to keep in my laptop-case when out and about for work too. If I need to refer to something quickly, without having to fire up my laptop; I can whip out my e-reader and quickly check out whatever I need to!

However, there are some things that annoy me about ebooks.
One thing (on e-readers and PCs) is the render time when changing pages. You press/click a button, or scroll down and sometimes you have to wait for what seems like an eternity for the content to display.
That can waste a fair bit of time sometimes, especially if you are trying to skip several pages at a time! (I've noticed …

JasonHippy 739 Practically a Master Poster

According to MSDN GetPixel returns the error value 0xFFFFFFFF / CLR_INVALID under 3 very specific conditions.

  1. The pixel is outside the boundaries of the current clipping area
  2. The device does not support GetPixel
  3. There is no bitmap selected within the device context

Best bet is to take a look at the MSDN page and see whether any of those conditions apply to your application and update it accordingly.

Also, a community comment on the page states that GetPixel is not thread-safe. So if your program is threaded, that could also be part of the problem!

If nothing there helps, then I don't know what else to suggest offhand!

JasonHippy 739 Practically a Master Poster

I didn't mean that boost was bad. Far from it! The boost libraries are great!
It's a portable, mature, stable, well-tested set of C++ libraries that are extremely useful.

My comment refers to the fact that some people don't like making their programs rely on an external library for something trivial like this. If you compare the two examples in my post; the 2nd example is extremely simple and understandable and doesn't require a 3rd party library.

At the end of the day, boost::assign::map_list_of is little more than syntactic sugar. It provides an alternate means of initialising a std::list.

Some people (including myself) would consider it overkill to add the boost library as a dependency for just map_list_of! (The only reason I mentioned map_list_of was because it allows you to use similar syntax to your original code)

But the boost library is a great library. I heartily recommend taking a look at it. There are some extremely useful classes available in there.

If you want to use boost, by all means do so!
Personally, I'll only use the syntactic sugar provided by boost::assign if I'm already using other, more significant boost components elsewhere in my program (boost::bind, boost::signals2, boost::filesystem, boost::graph etc). In for a penny, in for a pound and all that! Heh heh! :)

JasonHippy 739 Practically a Master Poster

I don't think you can initialise a std::map like that.

You can initialise std::map in a similar way using map_list_of in the boost::assign library.
Which would allow you to do something like this (if memory serves):

void ArcherArmor::ArcherArmor_shop(){
    soldier_armor = boost::assign::map_list_of<int, Armor> 
        (1, Armor("Meito Ichimonji", 4, 150, 1)) 
        (2, Armor("Shusui", 10, 230, 2))
        // ....Rest of your map declarations
        (6, Armor("Soul Calibur", 60, 900, 8));
}

But if you don't want to add boost as a dependency to your program, your best bet would probably be to do something like this:

void ArcherArmor::ArcherArmor_shop(){
    soldier_armor[1] = Armor("Meito Ichimonji", 4, 150, 1);
    soldier_armor[2] = Armor("Shusui".......
    //and so on....
}
JasonHippy 739 Practically a Master Poster

C++ is case sensitive. Change line 5 of your header file from class salaried to class Salaried (Note the uppercase S) and that problem should go away!

Effectively you have declared a class called salaried in your header, yet your cpp file contains definitions for Salaried. So the compiler is complaining that it doesn't know what 'salaried' is.

Also FYI: It looks as if you have the private and public members of your class the wrong way around. Shouldn't the member functions be public? and the data members private? You might want to review that! :)

JasonHippy 739 Practically a Master Poster

What about:
cp*[24680].enc or cp*[24680].* ?

So if the files are all in the current directory and you want to copy the even numbered ones to a sub-directory called "even" you could do the following:
Using cp (or mv):
cp ./cp*[24680].enc ./even/
or
cp ./cp*[24680].* ./even/

or using the find command:
find ./ -type f -iname "cp*[24680].*" -execdir cp {} ./even/ \;

EDIT:
Note: Unless you specify a maxdepth for find, it will look for files recursively in any sub-directories, which you might not want it to do.
To make it only search in the current directory you can do this:
find ./ -maxdepth 1 -type f -iname "cp*[24680].*" -execdir cp {} ./even/ \;

JasonHippy 739 Practically a Master Poster

Wow, coming back to it with a fresh set of eyes, I see what you mean Mike.

I'm not sure how I missed seeing all of those new's last night, they actually stick out like a sore thumb don't they?! :/

In my defense, I did write that post at stupid O'clock in the morning after a very long day. It was one of the last posts I made before bed yesterday (or this morning) So I was pretty frazzled!

When I scanned through the code, I'll admit, I didn't read every line. I just very quickly (and lazily) scrolled through, the structure of the code generally looked OK. And I'm guessing I must have scrolled past some of those blocks containing lots of new statements, because ordinarily there's no way I would have missed something like that! :/ Shocking!

JasonHippy 739 Practically a Master Poster

Basically, as far as I understand it, there are two types of string in Python3: Byte-strings and Unicode-strings.

The sockets in Python3 aren't aware of the different string encodings, so they only use raw byte-strings. So when passing a unicode string via a socket, you need to convert it to a byte-string using .encode().

Likewise, when receiving a byte-string from a socket to put into a string variable, you need to convert it to a unicode string using .decode()

Not sure why you're having problems there. Both programs work fine for me! I ran the server and the client, typed a couple of messages and then broke out of both programs with ctrl-c.
Here's the output I get from the server:

$ ./server.py
waiting for connection...
...connected from: ('127.0.0.1', 45060)
waiting for connection...
^CTraceback (most recent call last):
  File "./server.py", line 17, in <module>
    tcpCliSock, addr = tcpSerSock.accept()
  File "/usr/lib/python3.2/socket.py", line 132, in accept
    fd, addr = self._accept()
KeyboardInterrupt

And here's what was in the terminal running the client:

$ ./client.py 
> hello
[b'Fri Jan 17 00:57:36 2014'] hello
> This seems to work!
[b'Fri Jan 17 00:57:51 2014'] This seems to work!
> ^CTraceback (most recent call last):
  File "./client.py", line 14, in <module>
    data = input('> ')
KeyboardInterrupt

So the client correctly sends data to the server and the server responds by sending a string back to the client.

JasonHippy 739 Practically a Master Poster

I recommend running a debug build of your program from your IDE.
There should be an option somewhere to Debug, or start debugging, or some-such. I haven't used Dev-c++ for at least 8 years, so I really can't remember a lot about it.

Anyway, switch your build profile to a debug build, which will include additional information in your executable that will aid your debugging session. Then build your program in debug mode and start running/debugging your program.
When your program eventually crashes, you should get the option to break out at the line where the program crashes.

If the debugger breaks out at a line of code in your program, then congratulations, you have found where your crash is occurring. Now you need to work out why that line of code is failing. So stick a few breakpoints somewhere near that line of code and run another debug build. Every time a breakpoint is hit, you'll be taken back to your IDE at the appropriate line and you can step through the code and examine the state of any variables that are in scope. And you can check other things like the current call-stack etc. With a bit of time and persistence, you should be able to work out what the problem is.

If the debugger breaks you out to a disassembled version of a system file/library, you need to take a look at your call-stack window and track back through the call-stack to the first line …

JasonHippy 739 Practically a Master Poster

In answer to your questions:
1: I think the first socket in socket.socket is the package name and the second one refers to the socket class which resides in that package.

2: I don't know, but it does! Heh heh!
No, seriously... It is possible for Python functions to return more than one value. I think it's a Tuple that gets returned.

3: Reasons the client's not working? Hmmm.... You did make sure you started running the server before running the client didn't you? :P

Actually, I just tried running your client without the server on my *nix laptop and got a completely different error to the one you are seeing. So I don't think that is your problem.
Running the server and then running the client worked for me, without any errors.

'Network is unreachable' Sounds like the connection to localhost cannot be established. Is it possible that something like a firewall rule on your machine is preventing the client from connecting? Or have you accidentally disabled networking in the network manager applet? IDK. Could be any number of things!

Your client program works for me, right up until I send some data to the server. Then the client bombs out with an error:
TypeError: str does not support buffer interface

As this is python3, at line 17 of client.py, you need to encode the data to convert it to bytes:
tcpCliSock.send(data.encode())
You also need to decode the data when it is received by …

JasonHippy 739 Practically a Master Poster

Seeing as you haven't posted the actual error message, I'm guessing you're getting an error or a warning about the call to scanf_s at line 6.

Basically you don't need the & operator before name.
scanf_s expects a char * to be passed in as the 2nd parameter. And in C, arrays are implicitly pointers. So passing name will suffice, no need for the & operator. Using the & operator there converts the pointer to an incompatible type! char (*)[30]

EDIT: Not too sure I've explained the above paragraph particularly accurately...Sorry, had a few brewskies this evening! :)

JasonHippy 739 Practically a Master Poster

After you've deleted a record and pressed 'y' to go back to the menu, what happens if you select option "b) List Employee Records"?
Does the list still contain the record you just deleted? (Your screenshot does not show this information)

If so, then you are correct, you have a problem somewhere in your code. :)

Because you haven't posted any code, the only useful advice I can give at the moment is:
1. Run a debug build of your program through a debugger (All IDE's should have some kind of debugger support and if you aren't using an IDE, then you'll need to use something like gdb on the command line)
2. Set a breakpoint in the code which is supposed to deal with deleting a record.
3. When your program hits the breakpoint - step through the code and check the values of all variables and see if you can spot the problem.

Otherwise as Nathan has said; you're going to have to post some source code for your program in order for somebody here to help you further!

JasonHippy 739 Practically a Master Poster

OK, After a bit of searching online and reading various man pages (RTFM FTW!) I've come up with this:

#!/bin/bash

ls ~/Pictures/Screenshot*png > /dev/null 2> /dev/null

if [ $? -eq 0 ]
then 
    find ~/Pictures/ -name "Screenshot*png" -type f -print0 | ( 
        while read -r -d "" FILENAME 
        do 
            FILENAMES=("${FILENAMES[@]}" "$FILENAME")
        done

        for FILE in "${FILENAMES[@]}"
        do
            mv "$FILE" ~/Pictures/Screenshots/
        done 
    )
fi

Like your original script, it uses the result of the initial ls command to check whether there are any files to move. If there are files to move, we use the find command to get the names/paths of the files to be moved, using the -print0 option to null terminate each result rather than appending a newline to each.

As far as I understand it, doing this puts all of the results from find into one long line of text and each filename in the resultant string ends with a null.

Next we pipe the output of find to the rest of the script.

The next part of the script uses the read utility in a while loop to tokenise the string output by find into each separate filename (including any whitespace characters or other special/escaped characters). Using "" as a delimiter in the call to read makes the read utility read up to the first null it finds, so any special characters are kept intact in each file-name.

Each filename is read into a variable called FILENAME, which in turn is copied into an array …

JasonHippy 739 Practically a Master Poster

Hang on, {slaps forehead} I think you've probably got spaces in your filenames, that would cause the errors you're seeing! Not sure what to suggest offhand.... Brain has gone completely blank!

For filenames where there are spaces, the shell will incorrectly interpret the results from the ls command in the for i in statement. So each part of the filename that is separated by a space will be seen as a separate result.

From what you've posted, I'm guessing you have a file in your Pictures directory called Screenshot 2013-07-02 21:14:58.png. In which case in the results from the ls command the shell will see the ~/Pictures/Screenshot, the 2013-07-02 and the 21:14:58.png parts of the filename as three separate results.

I don't usually put spaces in my filenames, so I've never had to get around this problem.. Rubberman might have some ideas! I'll have a bit of a play when I can and will see what I can come up with!

JasonHippy 739 Practically a Master Poster

Really?? How odd! :/
Are you using a different shell like zsh or csh or something?

I'm using the default Bourne Again/bash shell on my Kubuntu 12.04 install, and I normally use Terminator rather than Konsole for my terminal emulator. But this script works for me without any errors on both:

#!/bin/bash

ls ~/Pictures/Screenshot*png > /dev/null 2> /dev/null

if [ $? -eq 0 ]
then
    for i in `ls ~/Pictures/Screenshot*png`
        do
                mv $i ~/Pictures/ScreenShots/
        done
fi

I use a few similar scripts to yours on my machine and the above syntax has never steered me wrong!

JasonHippy 739 Practically a Master Poster

Oh yeah, sorry. I forgot to mention about losing the curly braces around the i variable in your mv command too! oops :/
mv $i /home/garrett/Pictures/ScreenShots/
That should clear that problem up!

JasonHippy 739 Practically a Master Poster

You need to put single backquotes around your ls command:

for i in `ls Screenshot*png`

The backquote character is the character used in the markdown language here on DW to enclose inline code. It is usually on the key at the far left of the top line of numbers (under the F keys). On a UK keyboard it's on the ¬ key. On a US keyboard, it's on the ~ key.

JasonHippy 739 Practically a Master Poster

In which case: Mark as solved? ;)

JasonHippy 739 Practically a Master Poster

I was just going to say, rather than writing an over-complicated script, would it be simpler to just use a one liner e.g.:
mv ~/Pictures/*.png ~/Pictures/ScreenShots

Or if the files all contain a particular structure to the name. e.g.
ScreenShot-dd-mm-yyyy.png
You could use:
mv ~/Pictures/ScreenShot*.png ~/Pictures/ScreenShots

But it sounds like your instructor has ruled both of those out. I'm not sure what he meant by globbing issues. If you are moving all .png files into the ScreenShots directory, then there isn't really a problem AFAICT. :/

So I guess off the top of my head, you want something like this?:

for files in `ls ~/Pictures/ScreenShot*.png`
do
    mv $files ~/Pictures/ScreenShots/
done

Or perhaps:

for files in `ls ~/Pictures/ | grep "ScreenShot" | grep ".png"`
do
    mv $files ~/Pictures/ScreenShots
done

If there is a particular, set-pattern to the filenames; rather than using two greps like above, you could construct a single regular expression in a call to grep to ensure the entire filename matches the pattern.

I'm not sure either of those examples with the for loop are essentially any different to the one liners I posted above though! :/

JasonHippy 739 Practically a Master Poster

Although, if you use a typedef instead of a macro your original code would work:

#include<stdio.h>

typedef char* CH;
int main()
{
    CH a,b;
    printf("%d %d\n",sizeof(a),sizeof(b));
    return 0;
}

Now we've defined a new type called CH, which is a char*, so now a and b are both of type char*.
Which might be what you were originally aiming for!
Personally, I try to avoid using typedefs as they tend to obfuscate code, making it harder to understand what is going on. But there are certain situations when you might want to use them!

ddanbe commented: Nice +14
JasonHippy 739 Practically a Master Poster

This works, but I wouldn't recommend it! :
#define E MyClass::E
Which would cause the pre-processor to expand any instance of E in the cpp file to MyClass::E.
So you could use:
E(1,2,3) in your code and the pre-processor will expand the macro to MyClass::E(1,2,3)

But the downside is, if you have any instances where the function is called like this:
MyClass::E(1,2,3)
The pre-processor will expand the line to:
MyClass::MyClass::E(1,2,3)

Personally I'd stick to using MyClass::E to call your function, but that's just me! I think using a macro for this is a bad idea!

JasonHippy 739 Practically a Master Poster

The reason you aren't getting what you want out of the command is because you are redirecting the error output from the wc command into time.out. NOT the error output from the time command.
What you need to do is this:

time (wc filename >wc.out) 2> time.out

That will redirect the output from the wc command into a file called wc.out and will redirect the standard error output of the time command to a file called time.out

JasonHippy 739 Practically a Master Poster

I think Gallium refers to this:
https://en.wikipedia.org/wiki/Gallium3D

Perhaps the system information is reporting the driver in use rather than the model name of the card! I don't know if there are any proprietary drivers available for that particular card in Linux (probably not if you can't find any), but the free/open source drivers currently in use on your machine should fully support it.

Personally I don't think there's a problem. Your new card should be able to handle any 3D CAD/CAM type software you throw at it! If you want to be sure, you could perhaps try finding some benchmarking software to test the card in Fedora. Or just install whatever program you want it to run and see how it performs. I think it'll be fine!

JasonHippy 739 Practically a Master Poster

@OP: Thanks and sorry, I've been unable to get online for a few days. Having a manic time at work and at home. Didn't manage to check back after my previous post!
@Mike: Thanks for picking up my slack! Heh heh! :)

Getting back on topic:
Pydoc is used to generate help files from python source code. I don't think its a critical thing to have installed, it shouldn't affect Haizea too much. I guess Haizea's install script must use pydoc to create and install some help files/documentation. Sounds like you don't have pydoc installed, hence the error messages. If you want (or require) the documentation for Haizea, then you'll have to install pydoc and try running Haizea's install script again to allow it to build/install the documentation.

Off the top of my head; To install pydoc in Ubuntu, I think the packages you need to install are called:
python-epydoc
epydoc-doc

The python-epydoc package contains the actual pydoc module for python and epydoc-doc is its documentation package.

In case I haven't remembered the package names correctly, you might want to try running apt-cache search --names-only pydoc to verify their names before installing them with them with sudo apt-get install. Sorry, I haven't got my Linux laptop with me at work today so can't double check for you! :/

Once you've installed pydoc, you can run haizea's install script again and it should build and install the Haizea documentation for you.

Hopefully you can mark this as …

JasonHippy 739 Practically a Master Poster

Oops. I've just realised, in my previous post I was slightly wrong regarding the build errors from your Python compilation.

The errors ARE from when gcc is trying to compile the Python extensions, but they aren't because of missing files in the source-tree, it's more likely that you are missing some of the dependencies required to build the extensions. So you are missing several C/C++ dev packages (header files and libraries) required to build Python.

To solve this problem and to allow Python to build, the following command should do the trick:
sudo apt-get build-dep python
That should download and install all of the dependencies required to build Python 2.7 from the source-code you downloaded and should allow Python to build successfully if that's really what you want to do.

But yet again, I must stress that you absolutely don't need to manually build and install Python at all, it is already installed on your system. The rest of my previous post explains what you should need to do to get Haizea up and running!

To save any confusion, here are the steps again....

1: Install all of the pre-requisite requirements for Haizea:

  • Python (required): You already have Python installed!
  • mxDateTime (required): Use "sudo apt-get install python-egenix-mxdatetime python-egenix-mxdatetime-doc" to install from the Ubuntu repos.
  • Mako support (optional): Use "sudo apt-get install python-mako python-mako-doc" if you want to add mako support
  • Psyco (Optional): Download and manually build/install psyco if you want to use it (see 1st link in previous post)