Is there a way to get zlib to output the decompression settings used? Ive deflated correctly and the image comes out but when i re compress its not the same as before i decompressed.
and ive tryed almost every configuration of zlib.compressobj to try to get it to replicate the compression method and nothing is working. I figured if i can see what setting its using for decompression i could apply those when i compress and it should work..
Out of curiosity: why do you want to decompress and recompress something and want to end up with exactly the same thing? And how different are the two results? zlib possibly includes a timestamp so you might not get the exact same result if compressing twice (independently) a few seconds apart
@Death_Dealer wouldn't that be: "take compressed result -> decompress it -> compare with original" rather than "take decompressed original -> compress it -> compare with compressed whatever"?
what I'm trying to say is that this sounds like an XY problem
its a games image that is held in a .ddx file. it has multiple dds images in them and ive decompressed them correctly with zlib but recompression never produces a working ddx, the entire header is correct. Just the compressed chunk is not the same.
your saying take the decompressed image and compare it to the compressed version?
well, naively I'd think that checking a compression method should be done by decompressing the compressed result with a known-working implementation and see if you recover the original
Also, googling "zlib .ddx" suggests that this is about reverse engineering a proprietary file format, in which case any issues you find might be due to invalid assumptions/missing information
but yes, I guess it's possible that you just have to find the right switches to zlib (assuming there are switches) to end up with a "valid" .ddx file
Yes its an undocumented file type. I was just thinking if zlib can decompress it, it should be able to recompress. i guess i dont understand what its doing fully, might trim off extra data that it needs to load. im not sure.
> zlib’s functions have many options and often need to be used in a particular order. This documentation doesn’t attempt to cover all of the permutations; consult the zlib manual at zlib.net/manual.html for authoritative information.
yeah, I can't say the story has improved from 2016 to 2017
@wim auto submit is cool!
@Unihedron I was thinking about you when I was teaching my sons about tetrahedrons, octahedrons, and hexahedrons. We'll cover all the platonic solids and more. I'll wait on explaining what a unihedron is though.
I will teach them that they will be bored in school but they have to endure it. We can have more geeky fun when they get home. If they end up enjoying school, all the better
@cᴏʟᴅsᴘᴇᴇᴅ (-: Our pediatrician made sure to tell us to let them have unstructured play time because she assumed we were constantly drilling them. We hardly ever ask them questions unsolicited. They crave it.
they say they want to be scientist and do experiments. So I want to make sure they understand that it is about figuring out how the world works. Observer, Hypothesize, Experiment, Conclude.
Anyone worked with AES encryption before? For some reason my code is giving different results every time I run it. Might be some small overlook but can't figure it out.
Ideally, if I don't change my key and don't change my data, output should be the same every time, but it's not. I am guessing it's a *major* bug in the library I'm using, or I really don't have a clue of what I'm doing.
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from base64 import b64encode, b64decode
key = '/I02fMuSSvnouuu+/vyyD7NuSEVDB/0gte/z50dM0b4='
data = """hellow"""
cipher = AES.new(b64decode(key), AES.MODE_CBC)
padded_data = pad(data.encode(), cipher.block_size)
print(b64encode(padded_data))
ciphertext = cipher.encrypt(padded_data)
print(b64encode(ciphertext))
Now I can't say for sure, but I think the problem is probably that you're re-using the same cipher instance in CBC mode. I can't find any info in the docs if it's safe to call encrypt multiple times...
To top all of it, I am actually trying to replicate a sample PHP code to Python, the PHP code gives the same output and my Python code gives different outputs, none of which match the PHP one :(
@Rawing I think that might be the clue I was looking for, thanks. For some reason I couldn't install pycrypto original and try things out with it.
Alright, problem solved. Now I can devote myself to upgrading my old code to pycryptodome (please tell me this is backwards-compatible with pycrypto :( )
I heard that my friend (who got into top 10 for both parts of the stars that day) read the code and guessed the values (getting the right one after two incorrect guesses)
"The possibilities of quantum computing are endless" - The last time I checked, only a small number of problems could be solved more efficiently with quantum computing. Did something change?
@ArneRecknagel the possibilities of classial computing are also endless, despite that fact that we only have a finite amount of existing algorithms
there are a few flagship problems that are infamously difficult classically and tractable with quantum computing, but this doesn't mean that there aren't other uses for quantum computing, nor that further problems won't be discovered
that being said, you shouldn't focus too much on marketing BS like that :P
"Nuclear winter, viral pandemic, antibiotic-resistant bacterial pandemic, thawed ancient germ pandemic, climate cataclysm...AIs should stand in line" :P
yeah, that's the thing that isn't present anywhere
currently we have def goal_to_maximize(profit,human_lives,global_happiness,not_ending_the_world): return profit
we have AIs that select ads, we have AIs that preserve your information bubble so that you keep consuming, we have AIs that comment and chat on their own, and none of them are taught any ethics
Probably because ethics is a very high level criterion, and all those AI are very narrow. You can't have a unified ethics defintion for all of those, so it's up to the provider to define it
@ArneRecknagel they aren't even trying. People don't program these AIs to be nice and maybe not share that new gif where someone was killed very graphically.
The only motivator for the bulk of these programs is to generate revenue. As long as any kind of human value doesn't enter the equation for the revenue, it will be ignored
I never said AIs are wrong or that AIs will kill us. I only said that the current evolution of AIs does nothing to prevent that scenario.
and your toaster will probably never try to kill you, the problem is when an all too advanced AI gets access to an all too powerful resource to cause something problematic that nobody had foreseen
Prominent people including Elon Musk and Stephen Hawking agree. But neither of them has proposed anything tangible except regulations that will be very hard to enforce
One could say that "sure, don't give AlphaGo access to the nuclear launch codes". But on the other hand we know "what could possibly go wrong?" all too well, and it's probably not that far-fetched for a near-future AI to accidentally wreak havoc in a digital monetary system. You don't even need anything close to sentience, just crappy code.
anyway, we could go on about this forever with no real conclusion, so I'll just stop :P
My gripe with that is that it is very easy to say "powerful AI" and have it sound like something that is Not Hard, when it is currently still debated whether we will ever actually reach beyond narrow AI. I guess I'll stop too, before this whole convo get's hammered
Faulty cost accounting - the destruction of Earth's regenerative systems to bolster a bottom line will doom us faster than AI - in fact, AI may recognize this pattern and top us from self destructing... or not!
Then it's like in engineering, really. You can try and debug, plan, and tune, or just accept that there is always a good chance things go wrong, and have backups instead. The answer to the AI-apocalypse is to colonize mars!
It's currently -12 (with windchill -18) where I'm at, this morning when I left work it was -14 (with windchill -22). when the sun set and I'm having dinner it will be -16 (with windchill -24). I'm okie with the cold.
so -20 isn't too bad... -30 is when I should wear a hat or something to keep my head warmer.
I see it as in the cold you can put more on to stay warm. in the heat, you can strip down to your bare skin and still be hot :(
then again Perl does not seem that terribly, humongously different from Python either.
Just stay away from ASM if you want something distantly related to Python
It's seems you are interested in C# and Java. My advice: Try both, do some tutorials. You can use an online ide to test them and see if you like them. If you don't try some others.
Programming rule #1: Learn a programming language you like.
@Permian that's a actually a quite bad question... the easiest language is that language that is so much like Python that it didn't survive because it is too close to Python but not Python.
I.e. I wouldn't know it.
I know that there was a language called Boo
@Permian here is a boo language program for you:
def fib():
a, b = 0L, 1L # The 'L's make the numbers double word length (typically 64 bits)
while true:
yield b
a, b = b, a + b
# Print the first 5 numbers in the series:
for index as int, element in zip(range(5), fib()):
print("${index+1}: ${element}")
def fib():
a, b = 0, 1
while true:
yield b
a, b = b, a + b
# Print the first 5 numbers in the series:
for index, element in zip(range(5), fib()):
print(f"{index+1}: {element}")
@MooingRawr Thanks, you are correct I am asking that. But that read didnt really tell me too much. Other than it looks like I have to wait 6 months to ask another question? I have only ask 12 bloody questions on the site and worked hard to get some rep under my belt and I get banned.
I am not an admin/mod of this site. I have no powers to help you other than point you in the direction of information. Good luck getting unbanned though...
Yeah I see that now... Hard thing is being a lower level programmer it is hard to find questions that I can confidently answer. Because I dont want to put an answer that is wrong and get down voted. I will go through and try to edit any old posts. But they are from the college days and are no longer project. And based on the recommended steps I shouldnt delete them and I dont know what to edit them to.
I can go and upvote good questions I guess. Just is really hard to use the site when lower level accounts get banned all the time.
"ewswrapper.lafiel.net has been reported as containing malicious software. You can report a detection problem or ignore the risk and go to this unsafe site."
@Simon I think Zack is asking what it should be editted too. If you just silly willy edit it and bump it to the front page, it will receive more down votes.
If I was in your shoes, I would try to improve the questions based on what I was trying to do, include code if you have it from the past projects. If you can't edit the questions to improve it just focus on reviewing other questions and answers and contribute by just upvoting good answers /questions for now
I see that makes sense. I cant really do to much of that without the original code from the old questions but I can go through and try to improve some of the newer ones.
For most of anyone's life, their problems has been fixed by their parents, they are used to being spoon fed information. So when they get into coding, and see there's a site where people fix other's issues. It seems like a perfect realignment of that childhood ideas. The site clearly state that you should think about your question before asking a question, but temptation for someone to fix your issue is too strong for most user.
Very well put. I have had that mentality in the past as you can see on some of the questions asked. But I thought I had gotten better. I found a few questions I could help answer.
Almost every questions about any programming question has been asked and answer. knowing that, it's still possible to ask a question, just have to be specific, to the point, and demonstrate you've spent time thinking about your question. Cause generally when I find when dealing with new coders is that they know the answer. But they don't know they know the answer. Most of them needs some follow up questions for them to be guided to the answer.... and that's what the site is trying to make you do
I have been trying to do that on my newer questions but as MooingRawr mentioned. Is it worth me editing those bad questions only to have them go back to the top and get more down votes.
Completely understand and am very thankful for the help from you guys. I just am scared if I do end up editing them I will get more down votes and get a permanent ban.
Each time you go through the loop you are resetting the Dictionary to {} or empty thus it clears it out until the last time on exit. Move well_runtime = {} outside of the loop.
@ZackTarr That's hard to say without knowing the details about the automatic question ban. It's certainly not worth doing if you only make minor improvements though. Don't go looking for small details to improve. Do a complete rewrite of the question(s).
@Simon Not sure if well_runtime = {} really should have been outside in a code block or not. But I will keep that in mind next time. I was try to not write the code for him but rather just answer.
Quick question: how do I add a certificate to the OpenSSL certificate store? I've added it to the OS store, but OpenSSL still isn't registering it.....
@Simon Yeah that would be very bad. I wouldnt make that mistake. But Im not sure what kind of screen shots would really help me explain moving an item from listbox A to B. I mean I can take a screen shot of the gui but really that was more of a code issue right?
@ZackTarr this: "If you run the program below you will see it load a Example item into the bottom list. I then try to move the list to the top and back to the bottom while keeping the data element inside but it is getting lost in the process. Any help would be amazing!"
don't assume people want to run your code.
I don't. Most of the time I just want to read the Q and solve it in my head.
if I needed to actually copy-paste some code somewhere and gasp run it... I'd usually reach for that arrow down...
I see. That helps clarify. And honestly makes sense, if I could solve the question in my head I would also not want to touch the code. Now if only I could solve other peoples questions.
Antti. Im over here asking about how to do simple things so I tend to stay away from questions that look over my head. Or if they have lots of views I know I probably wont have an answer.
Now that I am cured of my bad posting habits from 4 years ago yes. But I am honestly surprised that this account was not kicked due to some of the old questions.
But on a side note. If a user posts bad questions gets a permanent ban where are the suppose to go if they cant create a new account? Do that just give up on stack for good?
Okay so let me correct my comment there. Do they just give up coding that project for 6 months? Sometimes you can get banned but still have questions in the future where you have done the research before. And then when you do get a shot at it again if you make another mistake your out for another 6 months? Seems a bit hard to get out of the ban once your in it.
While were still on the topic of asking questions can someone tell me what is wrong with one of my earlier questions? stackoverflow.com/questions/45804397/…
@ZackTarr ah, I see. I guess that's life :P Besides, if someone has a new well-researched and on-topic question, nobody will actually be suspecting ban evasion if they post with a new account...