How to make a .bmp file (some hex data) display as a qr-code - encoding

I am a college student dealing with some file problems.
I have saved a .bmp file which I knew it should be a qr-code.
Instead, it displayed as a meaningless picture.
Example meaningless picture
I'm wondering what's might be happening and what can I do ?
Thanks.

Huh. First, welcome to SO.
Second, your question needs clarification. How do you get this file (maybe it's auto-generated or something)? Can you ask for another one and see if it's meaningless too?
File definetely looks corrupted, but I'm not sure if it's due to creation error or some kind of saving/network/whatever malfunction.
Also, your question is possibly off-topic and you ought to address it to https://superuser.com/ instead.

Related

Is It Possible To Set An Ics/iCal File So That The File Name Can't Be Modified? Or Even to Read Only?

This may be a foolish question but I would appreciate any pointers: I'm generating year-long .Ics files that contain unique information people are actually purchasing - Moon phases, tides, etc.
The files work fine but I would like to try and 'lock' them so that the usual suspects cannot simply, download,rename and distribute the unique content to their advantage.
Does anyone know if anything like this exists? I've tried locking the file as text and but it doesn't stick once it's resaved as ics.

Is there any way, any way at all, a Word document could become a PNG? (Probable case of cheating)

I think a student of mine renamed a PNG a Word document and intentionally submitted a corrupted file to buy more time (or something) on an assignment. The student denies everything and claims it was a computer malfunction. Before I submit an honor code violation I want to be sure that there's no explanation that does not involve cheating that I'm somehow overlooking.
Basically, I'm a TA and a student submitted a paper, let's say it was Smith.docx. When I was working on grading and went to open Smith.docx Word wouldn't open it and said that it was corrupted. I eventually had the idea of opening it in a text editor and there it was a massive jumbled file of all sorts of odd characters (total file size: 180kb for what was supposed to be a 5 page paper).
I noticed, though, that the first few characters of the file were:
‰PNG
I renamed the file Smith.png and it opened. Bizarrely, it was an image of the first page of a Word document. More specifically, it looks like a screenshot of a Word doc cropped so as to show just the page. What makes it seem like a screenshot is that the cursor thingy (the vertical bar marking where you're typing) shows up next to the title.
An additional interesting bit of data is that if I scroll further down in the file (opened in notepad) I come to this:
XML:com.adobe.xmp <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.4.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<exif:PixelXDimension>996</exif:PixelXDimension>
<exif:PixelYDimension>1286</exif:PixelYDimension>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
I'm not sure what all that means but 1286x996 are the dimensions of the png image. The rest suggests to me that the file was created in some Adobe program but I'm not sure if that's right and how to figure out more about that.
So, my actual question: Is there any conceivable explanation of any kind for how I would come to have a file called Smith.docx that is a perfectly functioning png of what sure looks like a screenshot of the first page of a Word document other than that the student did it on purpose? The student claimed that their computer was "corrupting" files and that they had to take it into the Apple for service. I find this incredibly implausible (student has also not provided the receipt for this, which I requested).
Additionally, other than the case I laid out here, is there any positive evidence for my theory (that it was a straightforward case of cheating) that I can present to strengthen my case? eg, is the data from the file that I posted above a smoking gun that it was created in an Adobe program or is there any conceivable way that could come out of a Word document or other sort of corrupted file?
Also, is there anything else I can look for in the PNG file that would be a smoking gun?
Thanks in advance for any help you might be able to offer!
just rename the file with .png at the end instead of .docx and if it was a png then it should open just fine as a png
The key is that you see the cursor in the screenshot, there is no way Word would export (somehow) a docx file as a png AND draw the cursor for typing. Also, any tool that could do that would save the file as png not docx, only the user could deliberately change the file extension.
Also, does the screenshot show an empty document? or it looks like the final document your student delivered at the end?
Short answer:
The student is lying and is in fact a cheater (in my opinion).
Also, even if they were telling the truth, it is still their responsibility to have their work done, ready, and fully functional on time. Your computer is corrupting your files? Tough cookies. No one cares. You should have done your work on another computer. In the real world, excuses don't get you anywhere and they shouldn't get you anywhere in school either.
Lastly, it is very easy to re-name an extension of another file type and claim it's corrupt and very unlikely that a computer is just creating corrupted files. If their computer would otherwise create corrupted files, I would imagine it would be nearly impossible to get the computer to boot. In other words, they probably wouldn't have been able to turn on their "corrupted" computer to create "corrupted" files in the first place.

VB to download torrent, deflate gzipped section selectively

Apologies if this is a basic question, i'm a very casual programmer.
I'm writing a program which will search for torrents, grab them based on certain criteria (one being that they are indicated as freeware, you'll be pleased to hear) and then throw them over to utorrent. I'm getting stuck downloading the .torrent file, because, I believe, of the encoding.
I've worked out thus far that the bulk of the top of the file can be gzip deflated on the fly using HTTPrequest - but it seems that half-way through the file, something changes - and looking in a hex editor at a .torrent i've grabbed from a site directly versus the one I download here, everything is identical up to a point, then all is totally different.
If i'm being vague i'm afraid it's because i'm making this all up as I go along! Is it likely that the encoding / compression in a torrent file would change part way through, and how could I catch this in VB to avoid corrupting the latter half?
Thanks very much in advance,
Dan

Saving, reading, exchanging own file format?

any recommendations for saving four strings into an own file format that is read by the application and can be shared?
In my app, you will be able to enter some text in some boxes and the app shows a view with an background image and those strings. Now, I am already able to save this as a picture, but I actually want to save it to an own file format so that you can save different files that can be modified afterwards as well or even exchanged via email and opened from another iphone with the app.
Now, I wrote the code for accessing the documents folder of the app, as well as saving and deleting. Thing is, i dont know how to store those strings in a file (perhaps in a xml?) and read them easily afterwards from my application.
For the exchanging part, I found that link which would be a nice feature indeed: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
Parsing xml seems not that difficult (never done it before): http://ipad.about.com/od/iPad-App-Dev/a/How-To-Parse-Xml-Files-In-Xcode-Objective-C.htm
If it's only a small bit of infomation then the easiest way to store your data in a file would be using a plist - there's a good tutorial here - http://www.icodeblog.com/2009/02/14/loading-data-from-plist-files/
In addition to the plist, you could also do the following approaches:
1) simplest - open a file in your documents directory, write the 4 strings (using whatever delimiter/end of string marker is useful - carriage return?) and overwrite them each time through. (i.e. it's your file, you can format it how you like)
2) mildly harder - use Apple's NSArchive to pack and unpack the strings.
3) possible overkill - store them directly in a SQLite database
4) major overkill - store them in CoreData.
Of course, the "overkill" options also provide you with extra features which may be of use if your app functionality extends beyond what you've outlined.
By sharing, I would think that simple copy and paste might be enough, but there's also sending it via email, or tripping another app's URL scheme to make it open it and sending the strings as part of the URL. You'd have to know that the other app would be able to interpret your strings as part of the URL, so you might have to write it yourself.
Okay guys I found that very nice method in the NSString documentation:
–writeToFile:atomically:encoding:error:
I think I am gonna separate my strings by /n and save them to a .txt. When I am gonna read the file afterwards, i am getting the string, divide it to substrings. That will do it, I guess.
One last question: Is it possible to replace the content of my file so that I won't need to create a new file every time i want to change something?
Thanks!

How does one add custom metadata tags to an image on the iPhone?

I tried adding custom entries in the exif dictionaries I received from an image. This didn't work. I'm assuming this is due to the fact exif is a standard that is already defined.
Basically I am trying to create a metadata tag that can be placed in jpegs that will have no character limit.
I read that XMP metadata tags do not have character limits. Is this true? If so how would I create these on the iPhone?
Thank you.
I'm not sure what you've all tried code wise, but Caffeinated Cocoa has a pretty good blog entry on Image Metadata that I've used in an application for a client a while ago that might help you.
Also, the SO post Problem setting exif data for an image looks like it references the Caffeinated Cocoa. Although this question is a little over a year old, it still might help.
Try giving these a shot.