{"id":4389,"date":"2014-03-30T10:27:09","date_gmt":"2014-03-30T10:27:09","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-data-conversion-collection-of-common-programming-errors\/"},"modified":"2014-03-30T10:27:09","modified_gmt":"2014-03-30T10:27:09","slug":"problem-about-data-conversion-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-data-conversion-collection-of-common-programming-errors\/","title":{"rendered":"problem about data-conversion-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1441ecbd73b6ff15d258a453385cd382?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGerald Trost<br \/>\nc# encoding utf-8 binary data-conversion<br \/>\nIn c# I can encode binary data by Encoding.UTF8.GetString() and later convert it back by binary = Encoding.UTF8.GetBytes().I expect that the result should be my original binary data in any case &#8211; no exception.But is it true in any case?Or does it depend on the specific behaviour of the UTF8 character set?Or should I better use Encoding.ASCII.GetString() and Encoding.ASCII.GetBytes()?If anybody knows what Encoding exactly does (how it treats special characters or special bytes) then, please, giv<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7359dff10c6fb9d05965c8887363fd6e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMichal Kulinski<br \/>\nsql orm data-conversion object-relational-model application-framework<br \/>\nAssume that I have existing database with existing data.Is there any framework \/ ORM that generates data conversion SQL scripts when I need change column datatype? Of course there is problem with conversions like float to int string to int, but I would like to have such default functionality that automatically converts data fromint to float int to string.Do I have always to write data SQL data conversion scripts in both cases?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d21d33ac8f67242d2c1dd61c8696d358?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nschnaader<br \/>\nc++ audio data-conversion<br \/>\nFor my MFC application, I need to convert .wav data in an array into ogg vorbis format.I compiled both libogg and libvorbis as static libraries. I created &#8220;bin&#8221; directory in my project folder and placed there libvorbis_static.lib and libvorbisfile_static.lib. Also, I created in the bin directory libvorbis folder, and an include folder in it, and placed there vorbis (with codec.h, vorbisfile.h, vorbisenc.h) and ogg (with os_types.h and ogg.h) folders. I added libvorbis_static.lib to additional de<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5cb59abb7842c534650c51169a09a355?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ninfensus<br \/>\njavascript arrays object data-conversion<br \/>\nJSFiddle: http:\/\/jsfiddle.net\/3WdzL\/1\/I need to convert locale JS object files to flattened versions and back again:Orig locale object:var localeObj = {toolbar: {link: {back: &#8216;Back&#8217;,menu: &#8216;Menu&#8217;,},flatTest: &#8216;something&#8217;},countries: [[&#8220;AF&#8221;, &#8220;Afghanistan&#8221;],[&#8220;AX&#8221;, &#8220;\u00c5land Islands&#8221;],[&#8216;nested&#8217;, [1, 2, 3, 4]],[&#8220;AL&#8221;, &#8220;Albania&#8221;]] };Using the following function:function flattenObj(obj) {var flattenedObj = {};var walk = function(obj, stringMap) {for(k in obj) {var computedKey = stringMap + (stringMap ? &#8216;.&#8217;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/01647fd568f49ef5f1b17203a51aa92c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTom<br \/>\nc++ ieee-754 data-conversion<br \/>\nI have a unsigned long integer value which represents a float using IEEE-754 format. What is the quickest way of printing it out as a float in C++?I know one way, but am wondering if there is a convenient utility in C++ that would be better.Example of the way that I know is:union {unsigned long ul;float f; } u;u.ul = 1084227584; \/\/ in HEX, this is 0x40A00000cout &lt;&lt; &#8220;float value is: &#8221; &lt;&lt; u.f &lt;&lt; endl;(This prints out &#8220;float value is: 5&#8221; )<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e5c7e713b6f536d3fa0c9e1fbbdfb9c1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMPelletier<br \/>\nc++ class object data-conversion<br \/>\nI have run into this situation I find really tricky. I have 2 classes: time12 and time24 which maintain time on a 12 hr and 24 hr basis respectively. Both of them are supposed to have individual conversion functions to handle conversions to the other type. But if I declare time 12 first, then the &#8220;time24&#8221; in the prototype of the conversion function will be undefined as the time24 class will be declared later. So what do I do now? I can&#8217;t even only declare it inside and define it after the 2nd cl<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gerald Trost c# encoding utf-8 binary data-conversion In c# I can encode binary data by Encoding.UTF8.GetString() and later convert it back by binary = Encoding.UTF8.GetBytes().I expect that the result should be my original binary data in any case &#8211; no exception.But is it true in any case?Or does it depend on the specific behaviour of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4389","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4389"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4389\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}