Does anyone knows how the mongodb $bitsAllClear works?
I ready the document from https://docs.mongodb.com/manual/reference/operator/query/bitsAllClear/ i am trying to understand how can i create a BinData from a bitmask
For example the documentation says:
(the binary representation of BinData(0, "ID==") is 00010100.
How can i transform the 00010100 to binary to insert in the document? Is there any online converted to try?
(the binary representation of BinData(0, "ID==") is 00010100.
This example looks incorrect to me. BinData takes a base64 encoded string as its second argument, and the base64 encoding of 00010100 is FA==. Other examples on that same page look correct, so I suspect it's a typo.
In node, you can do the conversion from a binary string to base64 like so:
const hexString = parseInt('00010100', 2).toString(16);
Buffer.from(hexString, 'hex').toString("base64") // FA==
Online tool to test out encodings here -> https://cryptii.com/pipes/binary-to-base64
Related
I have a time string, which looks like this: 20170822T194135+00. This is called basic ISO:8601 format, if I understood correctly.
When I try to parse it using ZonedDateTime, it throws exception, complaining that it can't parse it.
SO, how do I convert this string to a valid Joda datetime object?
Do I need to build manual "format" to parse it (this would be silly, considering it's a standard format)?
Desperately, I've actually tried to implement custom format:
const time = ZonedDateTime.parse(timeString, DateTimeFormatter.ofPattern(`yyyyMMdd'T'HHmmssZ`));
But, it throws error on column 15. Looks like it fails to parse the timezone. Is my implementation correct? How do I make it work?
I could do it using the pattern x as described in the docs (this pattern accepts offsets like +00).
Then I parsed directly to a ZonedDateTime:
const formatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmssx");
const time = ZonedDateTime.parse("20170822T194135+00", formatter);
The resulting time variable has the value equivalent to 2017-08-22T19:41:35Z.
The built-in formatters (such as ISO_LOCAL_DATE_TIME) can't parse this format, so the only way seems to be creating a formatter.
I am just started mongodb and facing issue when saving XML in string field. it add '\u0000' with each character in xml file. like
"\u0000?\u0000x\u0000m\u0000l\u0000 \u0000v\u0000e\u0000r\u0000s\u0000i\u0000o\u0000n
I need to save this XML as it is without JSON 0r BSON conversion in string field.
Till the time, I found a query to get xml back in correct format.
db.Test.find({"data":"XYZ"}).forEach(function(doc){
var xml = doc.data.replace(/\u0000/g,"");
print(xml);
})
I get json string from server. Then I parser it using SBJSON library. But when I show parse results in my label I have symbols like that
!
(normally it's !).
So how can I convert my json string to normal string?
Use this: https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/NSString+HTML.m (specifically, the stringByDecodingHTMLEntities method).
From my XML file, I got a weird string (I think it's a blob data).
It looks like this:
0x244033242D212E430D21E2E3[.......]
It's a very very long string. My DB administrator told me that it comes from the database.
How to convert this string to a valid PDF file?
Thank you very much.
Regards,
Kael
A lot depends the database's manner of storing blob data, but if the format's not too exotic then the NSData and NSPropertyListSerialization classes should be able to convert it into something manageable.
How can I convert Base64 encode data into hex format.
I get following data in console.
/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAA4aADAAQAAAABAAAA4QAAAAD/2wBDAAEBAQEBAQEBAQEBAQECAgMCAgICAgQDAwIDBQQFBQUEBQUFBggGBQYHBgUFBwkHBwgICAkIBQYJCgkICggICAj/2wBDAQEBAQICAgQCAgQIBQUFCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAj/wAARCADhAOEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBC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9Y2pvD4z8Nj/AK5zea//AH7ir5Q+MnxjHjML4d8Om7g8PRSmR3f5XupPU0AeD+fZf8+bfnRWbRQAVPD1H1oooAWiiigAooooAKKKKACiiigCxB3qxRRQBXooooAKKKKACrFFFAFeiiigAooooAJ+1WKKKALFFFFAEF10s/rWNRRQAUUUUAf/2Q==
And I would like to convert into:
<4c61742c 34343039 3131302e 35302c4c 6f6e2c39 38343237 352e3934 2c482c32 37392e30 302c4b6e 6f74732c 302e3032 2c4e616d 652c504c 41594552 2c496e64 65782c30 2c4d756c 7469706c 61796572 4e756d62 65722c30 00>
format.
Try this SO question about base64 libraries on iOS.