Salem 5,265 Posting Sage

If you want to know what windows is up to when you do something, then try using https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

Salem 5,265 Posting Sage

First, let's prepare two tar files using different compression schemes for demo purposes.

$ cat foo_1.txt 
This is file 1
$ cat foo_2.txt 
This is file 2
This is file two
This is file too

# Three tar files, two compressed and one uncompressed for reference
$ tar -j -c -f foo.tar.bz2 foo_1.txt foo_2.txt 
$ tar -z -c -f foo.tar.gz foo_1.txt foo_2.txt 
$ tar -c -f foo.tar foo_1.txt foo_2.txt

$ file foo.tar.bz2 foo.tar.gz foo.tar
foo.tar.bz2: bzip2 compressed data, block size = 900k
foo.tar.gz:  gzip compressed data, from Unix, original size modulo 2^32 10240
foo.tar: POSIX tar archive (GNU)

# tar understands the contents of all three formats
$ tar tf foo.tar.bz2
foo_1.txt
foo_2.txt
$ tar tf foo.tar.gz
foo_1.txt
foo_2.txt
$ tar tf foo.tar
foo_1.txt
foo_2.txt

# The file sizes; note how much larger the uncompressed tar file is.
$ ls -l foo.tar.gz foo.tar.bz2 foo.tar
-rw-rw-r-- 1 sc sc 181 Mar 23 08:06 foo.tar.bz2
-rw-rw-r-- 1 sc sc 170 Mar 23 08:07 foo.tar.gz
-rw-rw-r-- 1 sc sc 10240 Mar 23 08:26 foo.tar

The gzip python library only does decompression. It knows nothing of the structure of the file, and just gives you bytes.

>>> import gzip
>>> gz = gzip.open('foo.tar.gz','rb')
>>> bytes = gz.read()
>>> print(len(bytes))
10240
>>> print(str(bytes)[:80])
b'foo_1.txt\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\

Notice that the length of the data is the same as the uncompressed tar file.

with gzip.open('/var/backup/netbox_backups/netbox_2024-03-16.psql.gz', 'rb') as file:
    swift_conn.put_object(
        container,
        'object_netbox_2024-03-16.psql.gz',
        contents=file,
        content_type='application/gzip'
    )

So what you're actually presenting to the put_object will be a decompressed stream.
Is it …

Salem 5,265 Posting Sage

https://plus.google.com/u/2/101960720994009339267/posts/ENuEDDYfvKP?hl=en
http://en.wikipedia.org/wiki/Dennis_Ritchie
It is indeed a sad day when one of the true pioneers of the modern technological world passes away. C and Unix are such huge corner stones of everything around us (like the ability for me to write this, and you to read this), and have inspired so much that followed, that you have to wonder where any of us would be without them.

:(

~s.o.s~ commented: We have lost a hero indeed. RIP Dennis :`( +0
Salem 5,265 Posting Sage

> I found a solution, but sadly in C++
Yeah, there's a lot of "finding" going on.
http://www.daniweb.com/software-development/cpp/threads/374401/1611050

People who go around "finding" code don't seem to be that interested in learning anything. Only in (ab)using the generosity of online forums just to get some free coding done.

Try http://www.vworker.com/ if you're not interested in actually learning, but just interested in getting something done in exchange for money.

Salem 5,265 Posting Sage

> but I'm saying that there is this IO waiting time, in which although CPU does other useful work.
Yes, other useful work, incrementing the clock() for the other processes which are having useful work done.

If you want sub-second precision, then the OP needs to state which OS/Compiler is being used.

gettimeofday() has microsecond precision, but the accuracy can vary from one machine to another. For example, the usec field could be stuck at zero, and the sec field increments once a second, and it would be within spec (although not so useful). Do NOT expect that the usec field will always tick once per microsecond.

Even queryperformancecounter, or the "raw" RDTSC instruction is not without issues.
http://en.wikipedia.org/wiki/Time_Stamp_Counter

Salem 5,265 Posting Sage

How about you post YOUR attempt, then we suggest where you might have gone wrong.

As opposed to expecting us to do all the work for you.

Salem 5,265 Posting Sage

So apart from adding "using namespace std;", have you done anything else to the code?

That is, apart from simply doing copy and paste from here
http://www.scribd.com/doc/51963645/bank-cpp

> I am not sharp in programmin
No, and unless you actually buckle down and start writing YOUR OWN PROGRAMS, you never will be.

Salem 5,265 Posting Sage

Meanwhile, progress over here -> http://forums.devshed.com/c-programming-42/errors-converting-c-to-c-835932.html

If you're going to cross post (not that it is recommended), at least have the courtesy to include reference to other help so we don't go over all the basics AGAIN!.

Salem 5,265 Posting Sage

http://lmgtfy.com/?q=circular+linked+list
Even that little bit took more effort than your useless topic title and brief text.

http://www.catb.org/~esr/faqs/smart-questions.html#bespecific

Salem 5,265 Posting Sage

%c ALWAYS takes the next character, including things like space and newline.

Try say
scanf(" %c",&var)

Salem 5,265 Posting Sage

http://www.google.co.uk/search?q=thesis+title+help
See, the problem here, is that DW is the #1 link at the moment.

So in they come "feeling lucky", only to get a face-full of wet fish.

But the self-reinforcing meme has been planted, with YET ANOTHER post with the magic search engine keywords to ensure that more of them will come, with more of the same posts, leading to better and better ranking in search engines, which (well, you get the picture).

The forum needs to be PURGED of all these lame-assed 1-posters who cannot think for themselves, then the problem would attend to itself, because no more would be smart enough to get here under their own initiative.

Salem 5,265 Posting Sage

Or perhaps "Learn C++ in 24 hours from a thread that is 5 YEARS OLD".

It's remarkable how many threads on DW get dug up on the anniversary of their original post date. I'm convinced the search here doesn't care about years, but latches onto the month and day like some blood-starved leech.

And no, you can't learn C++ in 24 hours, or 21 days, or some other ridiculous time frame. In 24 hours, you'll be able to tell the difference between a C++ program and a hole in the ground, but that's about all. You certainly won't be a competent programmer of anything more substantial than "hello world".

Read this -> http://norvig.com/21-days.html

Salem 5,265 Posting Sage

Sure, write out 2,-6,5 in binary.

> int p:3;
Then take the right-most n-1 bits as the value, and the n'th as the sign bit.
The valid range of p for example is -4 to +3

Salem 5,265 Posting Sage

%d = decimal
%o = octal
%x = hex
Seemed as plausible as anything to me.

dotancohen commented: Thank you! +2
Salem 5,265 Posting Sage

Here's an idea Dani (and no, not EVERY forum has such a problem as this one seems to have). But then again, not every forum has an internet marketing(scam) forum which is the big honey pot for those kinds of twits.

Here, visit this -> http://www.stopforumspam.com/
Better yet
- sign up
- install whatever plugin is necessary to STOP people joining who have been black-listed already
- install whatever plugin is necessary so that when someone is banned for spamming, they get blacklisted in a whole load of other places as well.

Salem 5,265 Posting Sage

Perhaps something like this?

printf("Enter a number between 10 and 50: ");
if ( scanf("%d", &myint) == 1 && myint >= 10 && myint <= 50 ) {
  // do stuff
}

But if you wanted to really make it bomb-proof, you would need to use fgets() to read a line of input into a buffer, and use strtol/strtoul to convert the string to an integer, and check the return results of both functions.

Note: scanf conversions do NOT detect overflow/underflow, which the strto.. functions will.

Salem 5,265 Posting Sage

> we're actually required to fulfill antispam regulations to keep information about every user who registers with us on record.
You mean this?
http://business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business
I'm curious about this para

Honor opt-out requests promptly. Any opt-out mechanism you offer must be able to process opt-out requests for at least 30 days after you send your message. You must honor a recipient’s opt-out request within 10 business days. You can’t charge a fee, require the recipient to give you any personally identifying information beyond an email address, or make the recipient take any step other than sending a reply email or visiting a single page on an Internet website as a condition for honoring an opt-out request. Once people have told you they don’t want to receive more messages from you, you can’t sell or transfer their email addresses, even in the form of a mailing list. The only exception is that you may transfer the addresses to a company you’ve hired to help you comply with the CAN-SPAM Act.

How is having two databases (the members AND the ex-members) any safer than having just one list (the members)?

I mean, all it will take is just ONE screwup (either through incompetence or malice) and you're bent over a legal barrel and the system is gonna screw you for everything they can get out of you.

The only reason for having two lists is if you buy in other peoples lists', and you have to cross-check …

jingda commented: Confuse look +0
Salem 5,265 Posting Sage

Anyone with anything genuinely intelligent to add to an old thread would also be smart enough to either PM a mod to suggest the fact, or start a new thread with a backlink, and possibly suggest that threads be merged.

Salem 5,265 Posting Sage

@sergent
http://sourceforge.net/apps/mediawiki/cpwiki/index.php?title=Indentation
I'll comment further when I can stomach reading your code.

> How about something less tricky.
Like for example using a function instead of some hacky multi-line macro.

sergent commented: Thanks lol, I am self-taught programmer so my code doesn't always look pretty. My whole program is much bigger so I just quickly cut & paste small portion of it. +4
Salem 5,265 Posting Sage

And what do you suppose they might learn from that spoon-fed answer on a plate?

Don't give away code!
http://www.daniweb.com/software-development/cpp/threads/78223

All that's going to happen is they'll hand this in without having much of a clue, so that when next week's homework comes around (say sorting numbers), they're totally screwed (and back asking for more homework).

WaltP commented: Yep... +16
kvprajapati commented: Yes +15
Salem 5,265 Posting Sage

Get someone to read these numbers to you, and you try to remember what the highest and lowest numbers you hear.

31
47
85
64
95
48
45
86
26
61
47
76
98
80
62
19
4
12
10
78

Salem 5,265 Posting Sage

I'm getting rather fed up with seeing activity in the geeks lounge, only to find out it's only the terminally bored time-wasters in posting games sub-forum.

If it's not going to be deleted (as per suggestions in other threads), can it at least be made opt-in/opt-out, so that those who don't give a toss what goes on in there don't have to be annoyed by it.

It'll all be over soon...

Salem 5,265 Posting Sage

http://www.dreamincode.net/forums/topic/240357-question-cinema-seating-system-for-project/
How about spending time working on the problem, as opposed to working out where else on the internet you can spam your homework.

Salem 5,265 Posting Sage

I'd say such questions belong here -> http://www.daniweb.com/software-development/legacy-and-other-languages/42

Though TBH, you'd be better off finding a forum with an actual specialisation in Objective-C, rather than just relying on a couple of people who might know a couple of things.

Salem 5,265 Posting Sage

I wouldn't mind so much if there were some balance between "good" posts and "bad" posts on the end of dead threads.

But as it stands, the ratio is around 1:999 in favour of bad posts.

Bad posts we see repeatedly on a daily basis.
Good posts - well when was the last time you saw one?

jingda commented: Today:) +0
Salem 5,265 Posting Sage

> Signatures don't show up unless you're logged in.
You know that, I know that.

It's the drive-by idiots who sign up, create a profile, post 10 lines of pith in 10 randomly selected posts and then sod off who NEED TO KNOW IT AS WELL.

Is it mentioned anywhere in the signup - I didn't see anything.
A nice "If you were thinking of creating a profile containing sig-links, posting a few times and then leaving, then DON'T BOTHER joining. Spam is deleted and sig-links do not show up in search engines".

I seem to have reported about half a dozen of them just today (just today mind, I've no plan to keep going with this).

Salem 5,265 Posting Sage

This is my three room adventure game

You add more rooms by editing the enum, and adding an extra row in the room array, and changing a few doors in existing rooms to get to the new room.

You might then consider adding say

struct room {
    char    *name;
    int      next[4];   // N,S,W,E from this location
    object  *objects;   // List of things in this room
}

If this is NULL, there is nothing here.

But perhaps you have

struct object {
  struct object *next;
  enum objType;  // objLamp, objAxe, objKey, ...
  char *name;  // "lamp", "axe", "key"
};

Your player struct also has a list of objects collected, which is displayed when you type "inventory". Picking up and putting down is simply moving from the player object list to the room object list.

When you come to open a door, you can check whether the key exists in the player inventory, IF the door happens to be in the locked state.

And so on...

Salem 5,265 Posting Sage

> and ignore the crazy code-formatting problems:
Sorry, that just gets your post ignored.

Nobody here can be bothered to wade through more than a page full of code that was indented by a dancing parrot.

Good indentation will tell you a lot about where it is going wrong without having to read the detail.

Salem 5,265 Posting Sage

> when you could just create a unique namespace and not worry about it?
But don't all namespace names occupy the same namespace?

No doubt there is more than one package out there which uses say the 'graphics' namespace. Trying to use two packages with badly chosen generic names could be a challenge.

How do you ensure uniqueness, without a central (cumbersome) registry?

For a small price, I suppose using a namespace derived from a domain name would suffice.

Using UUID's may be unique (and free), but it's cumbersome to write using namespace NS_5798323769944ad3b9c7ca3f5079704b; or NS_5798323769944ad3b9c7ca3f5079704b::myFunction();

Salem 5,265 Posting Sage

http://www.virtualhelp.me/linux/164-dos2unix-missing-ubuntu-1004
Depending on your distro, find and download something called 'dos2unix'

Salem 5,265 Posting Sage

Well it would help if you could post code with a decent approach to indentation

It also helps to remove all the commented out code you accumulated, at least for the purposes of posting it on a forum.

Something like this.

#include <iostream>
#include <fstream>
#include <string>
#include <nurbsS.h>
#include <nurbsSub.h>
#include <math.h>

using namespace std;

int i, j, l, k, x, nU, nV;
float b;
float Bt[10000], Btc[10000];
float M[10000][3];
float Mc[10000][2];
string T[10000];
string TC[100000];

int main()
{
  using namespace PLib;

  std::ifstream file("visage.txt");
  std::string word;
  i = 0;
  while (file >> word) {
    T[i] = word;
    i = i + 1;
  }

  for (j = 0; j < i; j++) {
    Bt[j] = atof(T[j].c_str());
  }

  l = 0;
  k = 0;
  x = i / 3;
  cout << "i=   " << i << endl;
  cout << "x=   " << x << endl;
  for (j = 0; j < x; j++) {
    M[j][k] = Bt[l];
    M[j][k + 1] = Bt[l + 1];
    M[j][k + 2] = Bt[l + 1];
    k = 0;
    l = l + 3;
  }

  Matrix < Point_nD < float, 3 > > Pts(x, 3);
  for (j = 0; j < x; ++j) {
    Pts(j, 0) = M[j][0];
    Pts(j, 1) = M[j][1];
    Pts(j, 2) = M[j][2];
  }
  cout << "point   " << "j  =" << j << Pts(0, 0) << endl;

  std::ifstream fileuv("a1.txt");
  std::string worduv;
  i = 0;
  while (fileuv >> worduv) {
    TC[i] = worduv;
    i = i + 1; …
Salem 5,265 Posting Sage

> And if you could be very specific.
Kinda ironic, given that your post is about as vague as it is possible to get, and still remain comprehensible English.

How about posting some actual code you TRIED?

FWIW, my first thought is you've screwed up over ANSI/UNICODE and your indiscriminate casting to make the compiler STFU has resulted in you trying to manipulate UNICODE strings (where every alternate byte is \0), as an ANSI/ASCII array of bytes, where all those UNICODE \0's make for some very short strings.

Salem 5,265 Posting Sage

> Getting Error after installing Turbo C.... how to rectify this problem.
Well you could complain to your school, and get them to spend THEIR time and money on supporting obsolete tech (you paid them, one way or another, make them earn it).

Whilst some of us know how to solve your problem, few of us care enough to bother helping with this issue.

Consider it a form of passive resistance. If your school gets to feel the full impact of every student complaining about this old crap, then they might just do something about it. If we continue to help with TurboC issues, it just enables your school to do nothing.

Or you could just install a modern compiler - read my sig links for why.
http://www.microsoft.com/express/Downloads/
http://www.smorgasbordet.com/pellesc/
http://www.codeblocks.org/

Salem 5,265 Posting Sage

Sure, why not.
It's as good an approach as any other, and you'll learn some things doing it.

In fact, solving the SAME problem in several different ways is also a good way to learn how to answer "what is the best way to solve this problem" questions for yourself.

sknake commented: i would have just said english +0
Salem 5,265 Posting Sage

n printf is a fuction in header file <iostream.h> to print some output on console.....it considers from right to left while printing..(helpful to know when u r using more than one increment/decrement operator within a single printf statement))

ALL of this is BS.

First, printf isn't in iostream.h, it is in stdio.h (or cstdio if you're using c++)

As for expression evaluation order, go and read this:
http://www.daniweb.com/software-development/c/threads/210533
It's a list of WILDLY different results from running the SAME code on DIFFERENT compilers, all caused by writing broken code which has undefined and unspecified behaviours.

Salem 5,265 Posting Sage

Perhaps you should start with the language(s) you know.

Any complete language will in principle do the job. Mostly, it will depend on YOUR skill with a particular language.

Salem 5,265 Posting Sage

What were YOUR answers?
Then we can correct your mistakes and fill in the blanks.

Whereas at the moment, it looks like begging for some spoon-feeding.

Salem 5,265 Posting Sage

Are we supposed to guess what OS you're using, or what _write is supposed to do?

http://linux.die.net/man/2/write
If it's this "write", then the second parameter needs to be a POINTER to some memory, not the munged result of your calculation.
No wonder it crashes.

Salem 5,265 Posting Sage

> Turbo c++ problem!
Pressing ALT-F4 might be a better option, followed by

- delete fossil compiler from system
- install one (or more) of these fine modern compilers.
http://www.microsoft.com/express/Downloads/
http://www.smorgasbordet.com/pellesc/
http://www.codeblocks.org/

kvprajapati commented: They don't want to change their toolset. +15
Salem 5,265 Posting Sage

OK, so this morning I see that the folder icon in the forum list is yellow, meaning there is something unread since my last visit.

In I go, and there is a big fat "You can only see threads that you have started"

I haven't started anything there, so why is it telling me there is something unread?

jonsca commented: You must not have your Little Orphan Annie decoder ring from Ovaltine +0
Salem 5,265 Posting Sage

Looks like this and this, with a new username.

Show us what you managed to figure out so far, so we only have to fill in the gaps (as opposed to giving you everything, which simply won't happen).

kvprajapati commented: +1 +15
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

http://en.wikipedia.org/wiki/The_Blind_Watchmaker
Plus other books by Richard Dawkins are good reading for explaining evolution.

ddanbe commented: dawkins is very good! +0
Salem 5,265 Posting Sage

Or perhaps it's metrics like this which make google think there are a lot of content-free threads.

Posting Games; Threads=162 Posts=56,143

Salem 5,265 Posting Sage

> The main thing is to contribute good quality postings, ask interesting and relevant questions and answer threads where you know the answer.
Perhaps you should just delete the entire http://www.daniweb.com/internet-marketing/25 tree, which seems to consist mostly of low quality link spam to dubious MLM marketers and other related scams.

jingda commented: Agreed +0
Nick Evan commented: Yes! +0
Salem 5,265 Posting Sage

http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

Your post reads something like "I put bread in the toaster, left it for a while and it came out charcoal - I suspect the line voltage".

Try posting some actual code, or maybe even just try to debug your code.

Using a debugger is a good approach, but you could get serviceable answers by repeatedly placing in the code things like printf("Got to the start of the foo() function with parameters %d %d %s\n",a,b,c); A good place to start with prints is about half-way between the database query and the display. Then use http://en.wikipedia.org/wiki/Divide_and_conquer_algorithm to decide which half of the code has the problem.

Salem 5,265 Posting Sage

> ptrdiff_t diff = (void*)p - (void*)q;
I thought any kind of arithmetic on void* pointers was undefined.

$ gcc -W -Wall -ansi -pedantic foo.c
foo.c: In function ‘main’:
foo.c:10: warning: pointer of type ‘void *’ used in subtraction

If you want the number of bytes, then ptrdiff_t diff = (p - q)*sizeof(*p); might be a better choice.

Aia commented: Always undefined! +14
kvprajapati commented: +1 +14
Salem 5,265 Posting Sage

> Is it sad I played Pong for 3 hours?
Not as sad as
Creating a thread on a forum about it
which in turn is not as sad as
Replying to such a thread

Salem 5,265 Posting Sage

> I have a new found respect for programmers and programming in general.
LOL - and you want someone to do your homework after that little speech.

No, stop, my sides are splitting, I can't stop LAUGHING!!!!!!!

Thanks kid, that's the best funny I've seen in a long while.

Good luck with the homework, feel free to come back when you've made an actual EFFORT.

Salem 5,265 Posting Sage

It's a function of your OS and compiler.

If you're using a protected OS and your compiler is compatible with your OS (say Linux+gcc or Windows+visual studio), then you're dealing with logical addresses. You can invent whatever address you like, but if you choose badly, the OS will just serve up your ass on a plate with a segmentation fault.

If you're using a protected OS and your compiler is NOT compatible with your OS (say Windows+TurboCrap), then you're dealing with physical addresses in a virtual machine. You can invent whatever address you like, but the VM will either allow it or give you some fake answer (which is mostly in keeping with what the real machine would do).

If you're using a real mode OS (eg. DOS), or no OS at all, then you're using real addresses, and you can do whatever the hell you like. This includes destroying your hardware if you choose badly. There is no safety net, you're on your own.