Compile YouCompleteMe again with extra flag: ./install.sh --clang-completer
.
2017/7/20
Compile YouCompleteMe again with extra flag: ./install.sh --clang-completer
.
2017/7/20
After some modification on hdajackretask
, which previously worked but disabled my audio card after reboot(in both dual of windows 10 and ubuntu).
Ubuntu will reports an error of codecs not found
and windows will return an error of device moved
.
In my case, this problem is solved through editing /etc/modprobe.d/alsa-base.conf
in that the desired audio card is marked with index=-2
.
By changing the index of the desired interface to ‘1’,(in my case, the one with intel
in it because I am using snd-hda-intel
) and adding options snd-hda-intel model=auto
, the problem is resolved after reboot.
2017/7/11
While using this function, there’s a lot that’s mentioned in the manual but hard to find.
From manual:
#define _XOPEN_SOURCE /* See feature_test_macros(7) */ #includechar *crypt(const char *key, const char *salt); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include char *crypt_r(const char *key, const char *salt, struct crypt_data *data); Link with -lcrypt.
However:
The return value points to static data whose content is overwritten by each call.This means a strdup or similar operation is necessary to copy it if one want to preserve the value and use the previous after another crypt. Also, it is not in the manual that using an encrypted string as salt means using the same salt that encrypts the string is used to encrypt the new one. The reason is that the string output will have its own salt at its beginning. The manual mentions nothing about how the check works but it works at here. So I looked for the source code in c posix library(From here:https://code.woboq.org/userspace/glibc/crypt/crypt-entry.c.html#crypt):
157 char * 158 crypt (const char *key, const char *salt) 159 { 160 #ifdef _LIBC 161 /* Try to find out whether we have to use MD5 encryption replacement. */ 162 if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0 163 /* Let __crypt_r deal with the error code if FIPS is enabled. */ 164 && !fips_enabled_p ()) 165 return __md5_crypt (key, salt); 166 167 /* Try to find out whether we have to use SHA256 encryption replacement. */ 168 if (strncmp (sha256_salt_prefix, salt, sizeof (sha256_salt_prefix) - 1) == 0) 169 return __sha256_crypt (key, salt); 170 171 /* Try to find out whether we have to use SHA512 encryption replacement. */ 172 if (strncmp (sha512_salt_prefix, salt, sizeof (sha512_salt_prefix) - 1) == 0) 173 return __sha512_crypt (key, salt); 174 #endif 175 176 return __crypt_r (key, salt, &_ufc_foobar); 177 }
It seems to be smarter than I excepted and can even determine which way to encrypt according to the salt….
2017/6/13
When 2 .h
files are trying to use classes in each other, an error will occur if no special treatment is applied:
syntax error : identifier "class_name"It seems like the compiler identify the class as an identifier. I tried to use macro commands like the following
#ifndef PACKAGE #include "Package.h" #define PACKAGE #endif==But failed.== With the help of this [passage](http://www.bijishequ.com/detail/149692?p=), I found a way to solve it. A class in C++ can be first declared and then defined like this:
class class_name;//this is a declaration. class class_name{ Content contents; };//this is a definition
So by putting only the declaration of classes in the header files or by putting another declaration of the class before use, it is made possible for this problem to be solved.
Recently, I formed a strong interest on machine learning in that it provides a new way to view the relationship between how programs view the world and how we view the world. Even if digging the detail requires a strong math knowledge, which I don’t have yet, by reading basic concepts, I can have a grasp of the idea. I believe it might be the future of computers.
Leave out how this subject is powerful since I am just beginning my first contact with it, let’s look at how much has been done through it. For example, it allows programs to learn from the past and form new knowledge. I went through a paper called “Major Life Event Extraction from Twitter based on Congratulations/Condolences Speech Acts” and I found that a lot more could be done with appropriate machine learning strategies. It is almost unimaginable before for a program to identify intents inside texts used by humans and now it’s made possible by machine learning. That’s cool.
The char* crypt(char*salt, char* str);
function is used for one-way encryption with salt. However, the buffer it returns is always the same piece of memory so it may appear to be returning duplicated results.
Solution: Use strcp()
or strdup()
to make a copy of the result every-time after invokes. Also, remember to free the memory after use.
Example:
char a = crypt(“string1”,”this_is_salt”);
char b = crypt(“string2”,”this_is_salt”);
printf(“%s”, strcmp(a,b));
char a = strdup(crypt(“string1”,”this_is_salt”));
char b = strdup(crypt(“string2”,”this_is_salt”));
printf(“%s”, strcmp(a,b));
free(a);free(b);
2017/5/25
I just found the vivaldi browser, which based on chromium, works really good for me. Thus I need to find a way to migrate. Here we go:
Find a config file of chrome, usually located under ~/.config/google-chrome
|~~/.config/google-chrome-beta
|~/.config/chromium
or similar places.
Create a soft link of the folder called default
with ln -s
or whatever method preferred.
Run vivaldi once and close it to generate proper configuration files.
Locate the vivaldi config file, usually located under ~/.config/vivaldi
.
Delete the default
folder under ~/.config/vivaldi
.
Copy the softlink just created here and name it default
.
Till now, we got everything but stored password in the browser migrated successfully. If preferred, copy the whole default
folder from chrome and override the one for vivaldi will do the same trick but prevent sharing config files.
Also, copy all the content under~/.config/google-chrome
|~~/.config/google-chrome-beta
|~/.config/chromium
into~/.config/vivaldi
litereally
==For now, no automatic way to make importing password possible. However, one can manually do so….==
2017/5/12
Thanks for the ide tool, the environment is controlled to provide faster problem locationg function.
As I quote from msdn:
* 0xcccccccc : Used by Microsoft's C++ debugging runtime library to mark uninitialised stack memory = (char)'烫'
* 0xcdcdcdcd : Used by Microsoft's C++ debugging runtime library to mark uninitialised heap memory = (char)'屯'
* 0xfeeefeee : Used by Microsoft's HeapFree() to mark freed heap memory
* 0xabababab : Used by Microsoft's HeapAlloc() to mark "no man's land" guard bytes after allocated heap memory
* 0xabadcafe : A startup to this value to initialize all free memory to catch errant pointers
* 0xbaadf00d : Used by Microsoft's LocalAlloc(LMEM_FIXED) to mark uninitialised allocated heap memory
* 0xbadcab1e : Error Code returned to the Microsoft eVC debugger when connection is severed to the debugger
* 0xbeefcace : Used by Microsoft .NET as a magic number in resource files
These will be useful for bebugging!
2017/5/11
Pack: tar cjf - {file}/ |split -b 1m - {file}.tar.bz2.
Unpack: cat {file}.tar.bz2.a* | tar xj
2017/4/27 19:38
I just found that the school’s SMS system, which contains all the sensitive and private information of almost every students and personnel in our school, including accounts that can directly change the students’ scores, is highly vulnerable.
First of all, no ssl certificates are used. That means all the password and content are delivered directly without any encryption. That means…Well, this is what I got on my account:
Any time if our traffic are sniffered in any of the routers it routes through, all the passwords and contents in the pages will be leaked.
Second of all, the side does not limit attempts to enter wrong passwords. That means, with a little amount of time and it will be possible to try out passwords of teachers with a small script.
Here is a small example:wget http://sms.██s.com/login --post-data='username=p1234&password=123456' -r
This is a shell command for an attempt to recursively download all the contents owned by a student’s account. It can be easily planted into a program to try all possible combinations until success. Once the password is correct, all the private information will leak. Also, if the account is for a teacher, students will be able to change their scores themselves.
==Plus, most of the teachers are using default passwords today…which are██..==
In conclusion, the school platform need to be refined so that it is made safer!
2017/4/25