structure

User uploads folder structure

拟墨画扇 提交于 2019-12-04 09:14:11
Can the folder structure for user uploads have any impact on performance as the site grows? For instance, I considered this structure for storing photos/albums: Public folder - Uploads -- Users --- User ID ---- Album ID - contains all photos in the album Thanks in advance! Can the folder structure for user uploads have any impact on performance as the site grows? Yes it can. If you store too many files in single directory it may slow down operations. Posted structure is very good. Edit Maybe I was to fast with above answer and there's missing some explanations, so below I extend it: If you

How can I create database tables using structures

廉价感情. 提交于 2019-12-04 06:55:23
问题 I am trying to create and store databases using c interface. I have a structure table that contains some variables and datatypes. How would I convert them into database tables. The details are mentioned below. In, database.c file, I initialized createTable function and Folder_table structure that contains the constraints and data types and I have a function to connect to the database in firebird. Once I read this structure, I would like to know how can I convert this structure into table and

why use malloc with structure?

…衆ロ難τιáo~ 提交于 2019-12-04 06:16:43
Why would I use malloc when same job can be done by without malloc as below.. #include <stdio.h> #include <conio.h> struct node { int data; struct node *l; struct node *r; }; int main(){ //Case 1 struct node n1; n1.data = 99; printf("n1 data is %d\n", n1.data); //Case 2 struct node *n2 = (struct node *) malloc (sizeof(struct node)); n2 -> data = 4444; printf("n2 data is:%d\n",n2 -> data); free(n2); return (0); } I am having hard time to understand how n1 which is not initialized to memory location is able to store data (99) . when to use case 1 and when to use case 2. Why would I use malloc

C - byte array to structure (dns query)

ぐ巨炮叔叔 提交于 2019-12-04 05:10:43
问题 I have these structures: typedef struct dnsQuery { char header[12]; struct TdnsQuerySection *querySection; } TdnsQuery; typedef struct dnsQuerySection { unsigned char *name; struct TdnsQueryQuestion *question; } TdnsQuerySection; typedef struct dnsQueryQuestion { unsigned short qtype; unsigned short qclass; } TdnsQueryQuestion; and I have dns query in byte array from recvfrom . I am trying to get structure from byte array like this: TdnsQuery* dnsQuery = (TdnsQuery*)buf; printf("%u", dnsQuery

JsTree with custom json data

六月ゝ 毕业季﹏ 提交于 2019-12-04 04:50:43
I have this structure in json I can not be modified by request. { "Object": [ { "url": "http://www.google.com" } ], "id": 1, "name": "Redirection Rule", "Object": { "frequency": 1, "trigger": 1 }, "Object": { "http": "Redirect Url", "response": 301 } } I need to use this structure to populate a jstree . I just need to use the "id" fields and "name", how do I set jstree to use "name" instead of "text" as a node name ? Either: 1) use the jQuery dataFilter option (this means defining a function for dataFilter in your core.data jsTree config), or 2) set core.data itself to a function, manually

C structure initialization with variable

好久不见. 提交于 2019-12-04 04:42:06
问题 I've run into a problem that seems to not be addressed by any of the C Standards after C89 save for the mention that structures initialization limits had been lifted. However, I've run into an error using the Open Watcom IDE (for debugging) where the compiler states that the initializer must be a constant expression. Here's the gist of what's going on. typedef struct{ short x; short y; } POINT; void foo( short x, short y ) { POINT here = { x, y }; /* <-- This is generating the error for the

Julia: Structuring code with many different but related algorithm choices

自闭症网瘾萝莉.ら 提交于 2019-12-04 04:35:12
问题 I am looking for an elegant way to re-arrange my code. For developing solvers, what happens is you can have a lot of different options which have the same setup. For example, at a high level the code looks something like this: function solver() # Start by assigning a bunch of variables, preprocessing, etc. ... # Choose and execute solve if alg==1 doAlgorithm1() elseif alg==2 doAlgorithm2() elseif alg==3 doAlgorithm3() end # Postprocess and return ... end Previously when I quickly prototypes I

What is the internal structure of a Windows shortcut?

断了今生、忘了曾经 提交于 2019-12-04 04:27:46
问题 3 HDD in one computer: 2 with Windows XP, 1 with Windows 7, sequentially load the operating system from each of them. I discover that some working shortcuts (not all) which created in first XP don't work in second XP and Windows 7 (not available for viewing the object for the shortcut). To understand why it's don't work I create the same shortcut in windows 7 and open both files of these shorcuts in hex editor. I discover that it's structures is diffrent but I do not know how to compare it.

Anonymous Structures in C found in Unix Kernel

倖福魔咒の 提交于 2019-12-04 03:06:44
I have started reading the Lions Commentary on Unix v6. I came across these snippets, which I have never seen used in the C language. The author does provide some sort of an explanation, but could someone explain to me what is happening here? params.h : SW 0177570 ...... struct { int integ; }; and this used in unix/prf.c if(SW->integ == 0) Explanation by the author SW is defined previously as the value 0177570. This is the kernel address of a read only processor register which stores the setting of the console switch register. The meaning of the statement is clear: get the contents at location

Xcode files and folders clean structure and organization

空扰寡人 提交于 2019-12-04 02:13:12
After four years in development with Xcode I started to ask myself (well, yes, I know, a little too late but when you are deep in coding you don't see other things) what kind of structure and organization of files and folders can be a good one to follow some sort of guidelines. I saw Google coding guidelines and I wonder if there's any similar doc around for the subject of this question. I can see that if you create a new project in Xcode (I'm using the latest version) you have one folder with the same name of the app, then inside "supporting files", then frameworks and product. The last two