valac generating bad C code on DBus program - dbus

Can someone spot the problem with this code?
It is compiling with valac but I get an error when gcc tries to compile the C code generated by valac, here's the gcc output:
(...) Weather.c: En la función ‘__lambda3_’:
(...) Weather.c:696:9: aviso: la asignación descarta el calificador ‘const’ del tipo del destino del puntero [activado por defecto]
(...) Weather.c: En la función ‘address_proxy_get_address’:
(...) Weather.c:1535:228: error: ‘error’ no se declaró aquí (primer uso en esta función)
(...) Weather.c:1535:228: nota: cada identificador sin declarar se reporta sólo una vez para cada función en el que aparece
Here's the DBus interface declaration:
[DBus (name="org.freedesktop.Geoclue.Address")]
interface Address : Object {
public abstract void get_address (out int32 timestamp, out HashTable<string,string> address, out Accuracy acc);
public signal void address_changed (int32 timestamp, HashTable<string,string> address, Accuracy acc);
}
struct Accuracy {
int32 int1;
double double1;
double double2;
}

Methods for D-Bus proxies need to throw an exception:
public abstract void get_address (out int32 timestamp, out HashTable<string,string> address, out Accuracy acc) throws GLib.IOError;

Related

React.js : net::ERR_FILE_NOT_FOUND

I receive this error in any project I've worked,I don't understand what happened, all of the code is correct but it still displays this error, please help me
about:client:1 GET
chrome-extension://adlpodnneegcnbophopdmhedicjbcgco/content/styles.css
net::ERR_FILE_NOT_FOUND Échec du chargement de la carte source par les
Outils de développement : Impossible de charger le contenu de
chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/intercom-link-expand-loader.js.map :
Erreur HTTP : code d'état 404, net::ERR_UNKNOWN_URL_SCHEME Échec du
chargement de la carte source par les Outils de développement :
Impossible de charger le contenu de
chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/content.js.map :
Erreur HTTP : code d'état 404, net::ERR_UNKNOWN_URL_SCHEME Échec du
chargement de la carte source par les Outils de développement :
Impossible de charger le contenu de
chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/companion-bubble.js.map :
Erreur HTTP : code d'état 404, net::ERR_UNKNOWN_URL_SCHEME Échec du
chargement de la carte source par les Outils de développement :
Impossible de charger le contenu de
chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/js/intercom-link-expand-loader.js.map :
Erreur HTTP : code d'état 404, net::ERR_UNKNOWN_URL_SCHEME
I think this will be to do with a Chrome extension, rather than a react issue.
I just had the same issue and turning off the "Loom – Free Screen and Cam Recorder" chrome extension fixed it for me - no more errors!
precede the static files with process.env.PUBLIC_URL if you are looking for them in the PUBLIC folder
for example
<link rel="stylesheet" href='/assets/css/style.css'/>
in
<link rel="stylesheet" href={process.env.PUBLIC_URL+ '/assets/css/style.css'} />

Call of CheckTokenMembership Always Fail (return value always False) - Call from SCADA (WinCC)

I would like to write a function to check if a given user is member of a group, in C language (it is based on a code which I found on stackoverflow How to programmatically figure out if a user account is a member of a particular group in Windows?). I've developped this function within the WinCC Software, which is a scada system.
Here's my code :
//Insert the header starting here
#include "WinApi.h"
#include "GlobalDefinitions.h"
BOOL CheckGroupMembership(char* UserName, char* Password, char* Domain, char* Group)
{
HRESULT result;
SID_NAME_USE SIDType;
WCHAR szDomain[256];
DWORD dwSidSize=0;
DWORD dwSize;
HANDLE user;
BOOL b=FALSE,returnval;
SID* pSid;
WCHAR szGroup[50];
// Convertit le nom du groupe en wide string
result=MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,Group,strlen(Group),szGroup,50);
printf("Nom du groupe : %ls\r\n",szGroup);
//recupere SID groupe
//premier appel de lookup pour allouer la bonne taille de SID (remis à jour dans dwSidSize);
LookupAccountNameW(NULL,szGroup,NULL,&dwSidSize,szDomain,&dwSize,&SIDType);
if (dwSidSize)
{
pSid=(SID*)malloc(dwSidSize);
//note : pas besoin de lui fournir un domaine si la machine est déjà intégrée dedans
LookupAccountNameW(NULL,szGroup,pSid,&dwSidSize,szDomain,&dwSize,&SIDType);
printf("dwSidSize %d \r\n",dwSidSize);
printf("Infos SID : %x , %x, %x - %d \r\n", pSid->Revision,pSid->SubAuthorityCount,pSid->IdentifierAuthority,SIDType);
// Récupère le handle de l'utilisateur
returnval=LogonUserA(UserName,Domain,Password,2,0,&user);
printf("User %d - %x \r\n",user,returnval);
returnval=CheckTokenMembership(user,pSid,&b);
}
printf("returnval %d - b : %d - %d\r\n",returnval,b,GetLastError());
free(pSid);
return b;
}
Whatever I do, the returnvalue outside CheckGroupMemberShip is false.
I think LookupAccountNameW works well, if i put a valid group i've got some valid informations within the SID structure. If i put a group that doesn't exist, it just gives me zeros.
I think also LogonUserA works pretty well, as if i give valid informations the returnval is true, otherwise it is false.
Only checkGroupMembership doesn't seem to answer me.
There are some things I don't understand well though :
Why is there a list of SIDs for one requested group and not only one ?
Is there a place where I can compare the values within the SID structure and the SID corresponding to an existing group ?
Whatever I give (group or user name) him it seems that the SIDType, is always the same at the output of LookupAccountNameW, Why ?
Finally, GetLastError doesn't seem to help me. It always gives me 0, why ?
To be noticed : the "WinApi.h" is custom made, because I only wanted to import what was strictely neededd within my application. If you think that could be the problem, I could post it.
Thanks in advance for your answers,
Julien

how to configure webpack2?

I added this variable in my package:
json file : "prod": "npm run clean && NODE_ENV=production webpack -p"
finally i had this error:
'NODE_ENV' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.

Undefined reference to...function returning pointer

Making a header to connect to PostgreSQL database I'm encapsulating libpq functions into functions of my own but, in one of them, which supposedly returns a pointer of type PGconn I get an error of the type...
ConexionPostgres.c:32:6: aviso: la asignación crea un puntero desde un entero sin una conversión [activado por defecto]
/tmp/ccCeaewL.o: In functionmain':
ConexionPostgres.c:(.text+0x86): undefined reference tosetBD'
I thought it was because of the prototype so I changed the proto and put the definition directly before main but nothing...Could someone tell what's going on?
I'm checking Postgres libpq documentation and libpq-fe.h directly to see the proto's so I'm not missing anything but I've confused. Here's my code:
PGconn *setDB(char *conninfo)
{
PGconn *db;
db = PQconnectdb(conninfo);
if(!db)
printf("Error en conexion a la BD");
if(PQstatus(db) != CONNECTION_OK)
{
printf( "%s\n", PQerrorMessage(db));
}
else
{
return db;
}
}
int main()
{
const char *conninfo = "dbname='database' host='somehost' user='me' password='somepass'";
//char *query = "INSERT INTO productos VALUES ('1','5','235')";
PGconn *con;
con = setBD(conninfo); /* --> Here's apparently the problem */
PQfinish(con);
exit(0);
}
Typo. You call the function setBD(), whereas the function defined is called setDB().

Write in a file with Python 3 & unicode

Here is my code:
import codecs
filename = "worst.txt"
file = open(filename, "r",encoding='utf-8')
lines = file.readlines()
texte = ""
for line in lines:
print(line)
texte += line
file.close()
print(texte)
texte = texte.split(";")
print(texte)
filename = "oudean.html"
file = open(filename, "w",encoding='utf-8')
file.write("<html><body>\r\n")
for t in texte :
print(t)
file.write("""<img src="ouedan.jpg"><br>\r\n""")
file.write("""Une déclaration à faire ?<br>Besoin d'encouragements?<br>Notre brigade d'élite beat agent est là pour vous aider.<br>Faites appel à nous en appelant le 06 et nous accourrons vous encourager dans l'instant.<br>N hésitez pas.<br>Et pour vous aider durant cette soirée, voilà une accroche a tester, succès garanti :<br>%s<br><br><br><br><br><br><br><br>"""%t)
file.write("</body></html>\r\n")
file.close()
But I gives me:
Une déclaration à faire ? Besoin d'encouragements? Notre brigade
d'élite beat agent est là pour vous aider. Faites appel à nous en
appelant le 06 et nous accourrons vous encourager dans l'instant. N
hésitez pas. Et pour vous aider durant cette soirée, voilà une
accroche a tester, succès garanti :
So how to write in a file with unicode string?
Your symptoms look like regular a "UTF-8 as latin-1" problem.
Have you checked what encoding is used on the software that you are using to view that file? I'd say that the problem is not necessarily in your python code but in the viewer.
If you create a file with your example text Une déclaration à faire... using UTF-8 encoding and then read that file interpreting the contents using encoding ISO-8859-1 or windows-1252, then the result is shown as the output you described: Une déclaration à faire....
Also, in python 3 the default source encoding is UTF-8. http://www.python.org/dev/peps/pep-3120/
It seems python does not understand what encoding your source is in. You have to tell it, either by using byte-order mark (preferred) or via declaring the type with special comment in first or second line. So:
tell your editor to store byte-order-mark in the source, or, if it can't do that
put a comment at the beginning containing (IIRC) encoding: utf-8.

Resources