Salem 5,265 Posting Sage

Why don't skeletons go to parties?

Because they have nobody to go with.

Salem 5,265 Posting Sage

The first question is, who is your "enemy" here?
What you need to do to protect yourself from the average consumer is far different than what you need to do if some "Three Letter Agency" is involved.

Any attempt to wipe a disk with a Windows OS still in residence is doomed to fail.

Any in-place s/w has to deal with a multitude of

  • swap file
  • hibernation file
  • the registry
  • untold number of "cache" folders and backup files
  • NTFS slack space

The next problem is with the media itself. Pretty much everything nowadays has the ability to remap bad sectors.
If by some small chance your 'secret' ends up in a bad sector, no software scrubbing will be able to touch it, but the manufacturer / TLA could still get at it.

Does your current HD contain a recovery partition?
Do you intend to sell it as "working with a registered copy of windows installed"?

Windows no longer comes with a little holographic sticker containing the product key.
https://support.microsoft.com/en-us/windows/find-your-windows-product-key-aaa2bf69-7b2b-9f13-f581-a806abf0a886
You need to make a note of this before wiping the OS (if that's the route you want to take).

A fairly secure approach would be to use DBAN to wipe the installation partition, then reboot to the recovery partition to install a fresh copy of windows onto a clean partition.

If it's an old laptop, just go on ebay/amazon/newegg and find out the price for a brand new / certified reconditioned HD of the same capacity. …

Salem 5,265 Posting Sage

You can do this with xargs

find . -name "*.c" | xargs -d'\n' grep -w "main"

Or if you know you want to search the same set of files many times.

find . -name "*.c" > tmp.txt
xargs --arg-file=tmp.txt grep -w "main"
xargs --arg-file=tmp.txt grep -w "void"
Lihui Zhang commented: Thank you for your improvement plan. Using xargs avoids repeatedly loading grep and running it, thus improving efficiency. +0
Salem 5,265 Posting Sage

The past, present and future walk into a bar.

It was a tense moment.

MasoodDidThat commented: Good one !! +0
Salem 5,265 Posting Sage

There are 10 kinds of people in the world.

Those that know binary, and those that don't.

Salem 5,265 Posting Sage

I've responded to your email address (FYI, gmail ignores dots).
You should edit your posts to remove your personal info.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Why is Form1.h over 1000 lines long?

Why are you using C-style strncpy all over the place, and not std::string (since this is C++).

Does Form1.cpp include Form1.h?
The lack of error messages when you compile Form1.cpp suggests not.

I tried to send a PM to you, but it's disabled.

Salem 5,265 Posting Sage

Your app always needs to "phone home" to query the actual member status with your server.

Otherwise, someone could log in twice, delete their account in one session and merrily carry on using their 'account' in the other session.

Sure, you could use the cached version if the user is just browsing, but as soon as they attempt some 'membership required' step, you need to verify membership at that point.

Salem 5,265 Posting Sage

It's hard to visualise what you're doing wrong.

You started with
'unsigned short MyprojectName::m_hservice' (?m_hservice@MyprojectName@@$$Q3GA) Already defined in home.obj
meaning you have more than one instance of m_hservice.

You now have
error LNK2020: unresolved token (0A0000DF) "unsigned short MyprojectName::m_hservice"
meaning you have zero instances of m_hservice.

You claim to have moved a few things into Form1.cpp, but did you add that to the project?

In your IDE, do the following 2 steps.

  1. Build->Clean
  2. Build->Rebuild all

Then paste the output of the build log.
You can censor your windows username if it appears in any file paths it prints if you want.
The important bit will be the list of files it compiles, and the resulting error message(s).

Salem 5,265 Posting Sage

How big is each record?

If it's like say a customer record with maybe a dozen fields and taking up several hundred bytes of space, adding a single 32-bit timestamp isn't going to impact you.

https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model
Draw one of these for your database schema then consider which of the perimeter tables would benefit from a timestamp.

cored0mp commented: Thanks you are right again, Salem! I answered below. +2
Salem 5,265 Posting Sage

error LNK2020: unresolved token (0A0000DF) "unsigned short MyprojectName::m_hservice"

Did you add Form1.cpp to the project?

Mr.M commented: How? +8
Salem 5,265 Posting Sage

Well you still need to include Form1.h in Form1.cpp

Also, Form1.h will need changing as follows

extern DWORD m_dwRVersion;
extern HRESULT m_hr;
extern WFSVERSION m_version;
extern HSERVICE m_hservice;
extern HWND m_handleWind;
extern LPWFSRESULT m_result;
Salem 5,265 Posting Sage

It seems to me you need to put the definitions in form1.h into a form1.cpp file.

Header files contain declarations.

Source files contain definitions.

If you put definitions in a header file, and include that file twice, you end up with something defined twice.

then I get LNK2005 'unsigned short MyprojectName::m_hservice' (?m_hservice@MyprojectName@@$$Q3GA) Already defined in home.obj

This is what the "Already defined" error message means.

Salem 5,265 Posting Sage

Anyone who knows how I can solve this problem?

The short answer is don't put code in header files.

Declarations go in header files, definitions go in source files.

You get away with it in small projects where you only have one source file, and each header is included exactly once.

But as soon as it gets a bit more complicated, the idea falls apart.

Salem 5,265 Posting Sage

hladysz said
please fix the condition:

Please explain why you think this is the wrong condition.

hladysz commented: Try with "9876543210" +0
Salem 5,265 Posting Sage

If the drives are dropping out during normal operation, check the OS log files to see if any particular reason is reported.

For all the drives, gather the SMART statistics.

Salem 5,265 Posting Sage

A couple of things stand out.

First, mysql-connector-python is listed at 8.0.15 on both systems.
Looking on https://pypi.org/project/mysql-connector-python/#history that version was released beginning of 2019 (over 5 years ago!)
The latest release version is 9.0.0

Second, your old system has pyOpenSSL, but there isn't an obvious 'ssl' library on your new system. Maybe the underlying error is that there is no SSL library to use (which it fails to handle), then it complains about not being able to find what it was looking for.

TBH, I'd start with pip --upgrade to get everything up to date (but see below first).
I didn't check how crusty the rest of your modules were.

Do you know about Python virtual envs?
https://docs.python.org/3/library/venv.html
You can create mini environments tuned to your application, without having to worry about whether installing/removing particular packages will trash your whole machine.

Instead of shipping a VM, consider Docker
https://www.freecodecamp.org/news/docker-vs-vm-key-differences-you-should-know/

cored0mp commented: Thanks again! Replied below! +0
Salem 5,265 Posting Sage

I would suggest you do pip list in your working and non-working environments.

It seems that wrap_socket is deprecated (and insecure)
https://github.com/eventlet/eventlet/issues/795

I would have thought your mysql would have depended on the right version to begin with.

cored0mp commented: Replied below, thanks! +1
Salem 5,265 Posting Sage

Which of the following things have you tried?

  1. Cleared the cache and deleted all cookies in your browser
  2. Tried with another browser
  3. Tried with a browser running in "safe" mode - ie, without a bunch of plugins potentially messing with things they shouldn't
  4. Tried with another computer

Are you using a proxy or VPN which presents a different IP address every time you try to connect? If your connection seems to come from random points around the world, that's a big red flag.

Do you have anything like 2-factor authentication, phone number, recovery email address etc to help secure your account?

Are you logged in multiple times (say your computer and your phone)?
When you've managed to log in, check how many other sessions you have.
https://support.google.com/mail/answer/45938?hl=en#zippy=
Revoke them all except the current one.
If there are any you don't recognise, then follow the rest of the advice on that page about securing your account.

momentum2024 commented: thank you so much for replying. ive tried most of that except the latter parts. will give that a crack +0
Salem 5,265 Posting Sage

If your batch size is say 1K, and your user decides to spam you with say 10K+ records, what does it matter to you?

  • flush your existing batch queue
  • loop through the large request 1K at a time and immediately commit to the database using some batch update
  • add the remainder of the request to your batch queue.
Salem 5,265 Posting Sage
  1. Get something working in Python if that's your comfort zone.
  2. Profile it to find out where the bottlenecks are (do not make guesses, find evidence)

For example, if the program is spending a lot of time waiting for I/O (aka the disk), then writing chunks of code in C isn't going to buy much (it will just wait more efficiently).

If it's spending a lot of time talking MySQL, then research alternative methods of driving MySQL. Driving the same methods in C won't fix anything.

How much faster could it be?
Say for example all the input conversion was zero cost. Time how long it takes to dump say 10K records into the MySQL database.
If that time is only marginally faster than doing all the work, nothing will be gained by rewriting chunks in C.

How much faster could you make it?
Turning 1 hour into 55 minutes isn't going to change the way you use the program. You're still going to run it and then go to lunch.
You need an order of magnitude improvement (like hours into minutes) to make it worth doing. Shaving off a few % might be academically interesting, but if your time is someone's $, then think carefully.

Next, what's the payback period?
Say you spend a month (say 150 hours) carefully crafting, debugging and testing the best C version ever.
If you made it 10 minutes faster, you need to run it 1000 times before you see a return on …

cored0mp commented: Thank you, I realize that I must now profile my system. +1
Salem 5,265 Posting Sage

It doesn't require any 3rd party software.

For example, I use Firefox profiles to separate my bank from my shops.
https://support.mozilla.org/en-US/kb/profile-manager-create-remove-switch-firefox-profiles

Coupled with quick-launch icons on the desktop, I find it to be a very easy to use solution.

ClaudiaJesse commented: Thank you for the tips, I'll check for it ! +0
Salem 5,265 Posting Sage

How did you open the file to save the download?
Did you use 'wb' mode in the open?

file_gz_content = f.read()

Verify that the length of this is the whole file.

swift_conn.put_object

https://docs.openstack.org/python-swiftclient/latest/swiftclient.html#swiftclient.client.put_object
One of the parameters is response_dict. It would be an idea to use this to see if anything unusual is happening with the upload.

In general, go through the API in detail and wherever extra status/error information can be returned, you should be at least retrieving this information to help you with debugging.

gzip: sanbox_nb01_netbox_2024-06-16.psql.gz: not in gzip format

Use a hex editor or hex dump to see what the byte stream actually looks like (and compare it with a known good .gz file).
How badly damaged does it look?
For example, if you forgot the 'wb' mode when writing the file, I'd expect it to be "mostly" OK with some bad characters.

Maybe something tried to be 'helpful' by automatically decompressing it for you when you downloaded it, so what you're seeing is an already decompressed file.

Salem 5,265 Posting Sage

Passing familiarity with a search engine would be high on the list of skills.

https://duckduckgo.com/?q=cyber+security+training&t=newext&atb=v296-1&ia=web

Salem 5,265 Posting Sage
  1. Run the program in the debugger.
  2. Put a breakpoint on con.Open();
  3. Run the backup part of the program.
  4. Print the contents of the cmd string, after it's made all the runtime substitutions.

Is that string what you were expecting?

The spaces around your double-back-slash seem out of place.

Salem 5,265 Posting Sage

If you're sufficiently curious to study how the data arrives at your browser, and can wrangle some Javascript, then perhaps https://www.tampermonkey.net/

You can post-process the data to be whatever shape you want it to be.

Salem 5,265 Posting Sage

I thought this was going to turn into some kind of crypto nonsense on how to make money mining bitcoin or something.

Salem 5,265 Posting Sage

Well you can either:

STFW with https://duckduckgo.com/?q=employee+retention+credit

Wait for your sock-puppet to show up with their "recommendation".

Salem 5,265 Posting Sage

Or you just learn how to use the tools.

If you want only reddit, then type this into your search:
c programming language site:reddit.com

If you want everything but reddit, then type this into your search:
c programming language -site:reddit.com

Salem 5,265 Posting Sage

I suppose the first thing to answer would be whether the bottleneck is client or server side.

Salem 5,265 Posting Sage

stereotype -> similar

Salem 5,265 Posting Sage

Yeah, there are sub-reddits for most languages and programming in general.

I'm spending way too much time in https://www.reddit.com/r/C_Programming/ for example.

There's the usual collection of helpful people, pedants, trolls and idiots - but that's true anywhere. The mods seem to be keeping it ticking over nicely.

Salem 5,265 Posting Sage

category -> pigeonhole

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

movies -> genre

Salem 5,265 Posting Sage

moles -> subterranean

Salem 5,265 Posting Sage

react -> chemistry

Salem 5,265 Posting Sage

I don't understand why you need to extract all the files from the compressed tar.bz2 just to upload to a backup.

Also, line 69 is now meaningless having just posted only a snippet of the code.

Before the error, what was the last logger.info message?

Salem 5,265 Posting Sage

Tower-> Babel

Salem 5,265 Posting Sage

princess -> castle

Salem 5,265 Posting Sage

Yeah - I remembered that little detail after the fact when I saw +0.

Salem 5,265 Posting Sage

I'm a long-time moderator on cprogramming.com, but it's getting awfully quiet on many of the old forums.

DiC was a loss, as was devshed.

I seem to be most active now on reddit.

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

I regret that I have to inform you that Adak passed away suddenly after an illness (thanks to the_cultie from the OC forum for the notice).

For folding details, please see here.
http://www.overclockers.com/forums/showthread.php?t=744019

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

If n is a power of 2, look at the value in binary.
Then look at the binary representation of n-1

Salem 5,265 Posting Sage

Further, what does
if(iNum%2==0)
have to do with iNum1, iNum2 or iNum3 (the 3 values you read in).

Are you allowed to use arrays for this problem?

Salem 5,265 Posting Sage

You don't decrypt passwords, you hash them.
http://en.wikipedia.org/wiki/Cryptographic_hash_function

User types in the password, you hash it, and you compare it with the previously hashed result in the password file.

If they match, there is an exceedingly high probability that the user entered the correct password.

Salem 5,265 Posting Sage

So google "C# tutorials" and do some reading for a while.

I mean, it wouldn't take long to figure out how to write say "hello world", or how to declare/call a function, or write a for loop, or perform a bit of string handling.