I'm making my first attempt to install Arch Linux and using the installation guide to work off. The steps I have taken are: 1) run the arch linux DVD and select the option to run live.
json2bson.c
#include<bson.h> |
#include<json.h> |
#include<stdio.h> |
#include<unistd.h> |
#include<glib.h> |
static bson *json_to_bson (struct json_object *json); |
staticvoid |
json_key_to_bson_key (bson *b, void *val, |
const gchar *key) |
{ |
switch (json_object_get_type (val)) |
{ |
case json_type_boolean: |
bson_append_boolean (b, key, json_object_get_boolean (val)); |
break; |
case json_type_double: |
bson_append_double (b, key, json_object_get_double (val)); |
break; |
case json_type_int: |
bson_append_int32 (b, key, json_object_get_int (val)); |
break; |
case json_type_object: |
{ |
bson *sub; |
sub = json_to_bson (val); |
bson_append_document (b, key, sub); |
bson_free (sub); |
break; |
} |
case json_type_array: |
{ |
gint pos; |
bson *sub; |
sub = bson_new (); |
for (pos = 0; pos < json_object_array_length (val); pos++) |
{ |
gchar *nk = g_strdup_printf ('%d', pos); |
json_key_to_bson_key (sub, json_object_array_get_idx (val, pos), |
nk); |
g_free (nk); |
} |
bson_finish (sub); |
bson_append_array (b, key, sub); |
bson_free (sub); |
break; |
} |
case json_type_string: |
bson_append_string (b, key, json_object_get_string (val), -1); |
break; |
default: |
break; |
} |
} |
static bson * |
json_to_bson (struct json_object *json) |
{ |
bson *b; |
b = bson_new (); |
{ |
json_object_object_foreach (json, key, val) |
{ |
json_key_to_bson_key (b, val, key); |
} |
} |
bson_finish (b); |
return b; |
} |
int |
main (int argc, char **argv) |
{ |
GIOChannel *input; |
GString *json_str; |
GError *error = NULL; |
struct json_tokener *tokener; |
input = g_io_channel_unix_new (0); |
json_str = g_string_new (NULL); |
tokener = json_tokener_new (); |
while (g_io_channel_read_line_string (input, json_str, |
NULL, &error) G_IO_STATUS_NORMAL) |
{ |
struct json_object *json; |
bson *bson; |
json_tokener_reset (tokener); |
json = json_tokener_parse_ex (tokener, json_str->str, json_str->len); |
if (!json) |
{ |
fprintf (stderr, 'Error parsing json: %sn', json_str->str); |
break; |
} |
if (json_object_get_type (json) != json_type_object) |
{ |
fprintf (stderr, |
'Error: json's top-level object is not object: %sn', |
json_str->str); |
json_object_put (json); |
break; |
} |
bson = json_to_bson (json); |
json_object_put (json); |
write (1, bson_data (bson), bson_size (bson)); |
bson_free (bson); |
} |
return0; |
} |
Makefile
all: json2bson |
clean: |
rm -f json2bson |
json2bson: json2bson.c |
${CC}$(shell pkg-config --cflags json libmongo-client glib-2.0) -Wall -O0 -ggdb3 -std=c99 ${CFLAGS} |
$(shell pkg-config --libs json libmongo-client glib-2.0) -o $@$^ |
check: all |
./json2bson <test.json >test.bson |
bsondump test.bson | head -n -1 >out.json |
cmp test.json out.json |
.PHONY: all clean check |
test.json
{ 'foo' : 'bar' } |
{ 'str' : 'string', 'int32' : 42, 'double' : 3.14, 'array' : [ 1, 2, 4.2, 'foo', { 'embedded' : true }, [ 0, 1 ] ], 'doc' : { 'nested' : { 'deep' : 'yes' } } } |
commented May 28, 2016
improved Makefile : |
commented May 28, 2016
![Arch Arch](/uploads/1/2/6/1/126124429/721609114.jpg)
Also, your make check fails, because there are extra whitespace in your provided test.json .Fix: jq -rc . test.json | sponge test.json |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Intel® Core™ i7-4790K 4.0Ghz
2x8GB DDR3 1866 PC3-14900
GeForce GTX 970/PCIe/SSE2
MSI Z97 Gaming 5
- Download the iso from the Archlinux Oficial Download Page.
- Make sure the checksum of the downloaded iso is the same that the previous download page says:
- Make a bootable USB with the downloaded iso.
- Check the BIOS is properly configured and boot with the USB:
- Make sure you have a valid internet connection
ping -c 3 google.com
. If you don't have one, you can connect via wifi: - Erase everything in the disk you will be installing arch in, and perform a secure wipe of the generated free space, so it's later indistinguishable from data written by dm-crypt.
- Create partitions (if enough space, create separate partitions for root/home instead, as explained here)
- Setup LVM on LUKS file system
- Install ArchLinuxIn order to get the best out of it, here’s everything you need to know about how to use turbo in GTA V.Turbo is something you add to vehicles in GTA Online, but it’s not entirely clear how it works. Gta 5 auto tuning turbo. So that you can win more often, you’ll want to make use of the turbo feature. With the popularity of only growing since the game released more than five years ago, races have become a key part of it.
- Configure ArchLinux
- Create boot loder
- Customize it and make it user friendly
Json-c Dev Arch Windows
Check out cool terminal themes:
Option to personalize highlighting of key color in browser: A new preference option in the 'Browser' tab of the preferences allows you to customize the way, matching keys will be highlighted in the key column of the browser. How exactly the keys are highlighted can be personalized in a preference setting. Dn-s1200 traktor pro 2.
Json-c Dev Arch 1
![Arch Arch](/uploads/1/2/6/1/126124429/920737022.png)
Json-c Dev Architect
Usefull programs/GNOME extensions: