Language:
switch to room list switch to menu My folders
Go to page: First ... 56 57 58 59 [60] 61 62 63 64 ... Last
[#] Mon May 17 2010 14:59:04 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]



I think it boils down to a question of the grammar's associativity. "*" is left-associative.

[#] Mon May 17 2010 15:06:47 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Or is that right-associative? Anyway, you read it starting at the pointer and looking left.

[#] Mon May 17 2010 15:14:34 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


There are a whole class of readability issues in C that can be mitigated with typedefs. This is one of them.


typedef char_ptr char *;
const char_ptr foo; // same as "char * const*" ;)

It gets worse with function pointers, and typedefs are even more helpful there.

I can see the advantage in languages that declare functions as:

(ArgTypes) -> ReturnType (such as Scala, Haskell, C# closures, etc..)

Functions return pointers to functions are simplified:

(Arg<Type) -> (ArgType) -> ReturnType


In C this would look like:

(ReturnType (*)(ArgType)) foo (ArgType)

Which is pretty darn ugly, and wants a typedef just for clarity.

[#] Mon May 17 2010 16:14:04 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I also like strongly typed languages, and I'm usually in favor of things that help. I do mostly like the way generics work in java (especially since e eclipse does all the extra typing for me) but they really overloaded the word const too much.
you can have const that means the value doesn't change, you can have const that means the pointed to value doesn't change, you can have const that means as ls pointed out and I forgot that the function doesn't change anything, and I vaguely recall there's a few more. I haven't written real C++ in years so I'm getting rusty quickly, but if they had used other keywords for these varoius things it might have made it easier to follow.

[#] Mon May 17 2010 16:15:05 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I still think REXX scores highest for lax typing...

print hi

hi


hi = 42

print hi

42

[#] Mon May 17 2010 17:46:04 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


ford, what's going on in the first line of that example?

Does it implicitly declare a variable named "hi" and set the value (also implicitly) to "hi", or is hi not a variable, but a string literal, until it's assigned?

Either way: forgiving like INTERCAL.

[#] Tue May 18 2010 07:52:48 EDT from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

did some experimenting with clang and clang++; had to compile from source since theres no clang++ .deb, but I realy like the error messages and warnings it generates.

Thats the way it should have been in the first place.



[#] Tue May 18 2010 10:38:59 EDT from Spell Binder @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Re: REXX and variables.

If I remember correctly (and it's been a while), the first line in Ford's example will create a variable named "hi" and initialize it with the variable's name as its value.

The Wikipedia article about REXX agrees:

http://en.wikipedia.org/wiki/Rexx

I should dig out my old REXX book and bring it in to see how many formers IBMers I can trap. Muahahahahahaha!
REXX Binder

[#] Tue May 18 2010 10:49:20 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Does it implicitly declare a variable named "hi" and set the value
(also implicitly) to "hi", or is hi not a variable, but a string
literal, until it's assigned?

No, simpler than that. If a string of text doesn't resolve as a variable it is treated as a string literal, it doesn't implicitly make it one, although the effect is the same.

[#] Tue May 18 2010 10:50:42 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I stand corrected, I remembered that it just used it as the string literal without creating the variable.

[#] Tue May 18 2010 10:51:41 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

did some experimenting with clang and clang++; had to compile from

"Such a horrid clang"

And what value does clang++ bring to the table that g++ does not?

[#] Tue May 18 2010 11:15:23 EDT from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

a searchterm next to ungooglabe like oracle proC or LaTeX ;-)

its working as frontend to the LLVM backend; Its not yet able to do full boost magic, but getting there.

here are some of its warning (the ^ gets a little out of bearing through the html, but its all in place in an xterm.

 

clang -g -O2 -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes -D_REENTRANT -pthread -I ./include/ -I. -I ./include/ -DHAVE_CONFIG_H -c utillib/citadel_ipc.c -o utillib/citadel_ipc.o
utillib/citadel_ipc.c:2098:2: warning: expression result unused [-Wunused-value]
BIO_set_close(ipc->ssl->rbio, BIO_NOCLOSE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from utillib/citadel_ipc.c:51:
In file included from ./include/citadel_ipc.h:16:
In file included from /usr/include/openssl/ssl.h:179:
/usr/include/openssl/bio.h:510:28: note: instantiated from:
#define BIO_set_close(b,c)      (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
utillib/citadel_ipc.c:3248:40: warning: format string is not a string literal (potentially insecure)
[-Wformat-security]
snprintf(sockpath, sizeof sockpath, file_citadel_socket);
^~~~~~~~~~~~~~~~~~~
2 warnings generated.

clang -g -O2 -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes -D_REENTRANT -pthread -I ./include/ -I. -I ./include/ -DHAVE_CONFIG_H -c textclient/screen.c -o textclient/screen.o
textclient/screen.c:92:3: warning: expression result unused [-Wunused-value]
mvwinch(statuswindow, 0, screenwidth - 2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from textclient/screen.c:29:
In file included from textclient/screen.h:7:
/usr/include/ncurses.h:1211:52: note: instantiated from:
#define mvwinch(win,y,x)                (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
^
/usr/include/ncurses.h:196:34: note: instantiated from:
#define NCURSES_CAST(type,value) (type)(value)
^     ~~~~~~~
textclient/screen.c:288:5: warning: expression result unused [-Wunused-value]
mvwinch(statuswindow, 0, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from textclient/screen.c:29:
In file included from textclient/screen.h:7:
/usr/include/ncurses.h:1211:52: note: instantiated from:
#define mvwinch(win,y,x)                (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
^
/usr/include/ncurses.h:196:34: note: instantiated from:
#define NCURSES_CAST(type,value) (type)(value)
^     ~~~~~~~
textclient/screen.c:320:5: warning: expression result unused [-Wunused-value]
mvwinch(statuswindow, 0, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from textclient/screen.c:29:
In file included from textclient/screen.h:7:
/usr/include/ncurses.h:1211:52: note: instantiated from:
#define mvwinch(win,y,x)                (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
^
/usr/include/ncurses.h:196:34: note: instantiated from:
#define NCURSES_CAST(type,value) (type)(value)
^     ~~~~~~~
3 warnings generated.
clang -g -O2 -Wall -Wcast-qual -Wcast-align -Wstrict-prototypes -D_REENTRANT -pthread -I ./include/ -I. -I ./include/ -DHAVE_CONFIG_H -c utillib/citadel_dirs.c -o utillib/citadel_dirs.o
utillib/citadel_dirs.c:124:48: warning: format string is not a string literal (potentially insecure)
[-Wformat-security]
snprintf(ctdl_sbin_dir, sizeof ctdl_sbin_dir, ctdldir);
^~~~~~~
utillib/citadel_dirs.c:125:46: warning: format string is not a string literal (potentially insecure)
[-Wformat-security]
snprintf(ctdl_bin_dir, sizeof ctdl_bin_dir, ctdldir);
^~~~~~~
2 warnings generated.



[#] Tue May 18 2010 18:57:33 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Yeah, that REXX example should definitely win some sort of perversity award.

[#] Fri May 21 2010 07:30:19 EDT from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

so we've got a new kid in town:

http://blog.llvm.org/2010/05/clang-builds-boost.html

as egcs showed way back open source monopolies aren't good either.



[#] Sat May 22 2010 10:42:40 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


ooops, looks like you "can't apply generic programming" in C++ ;)



http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm

[#] Wed May 26 2010 10:44:47 EDT from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

so... multipart mime chunked http replies have to have the mime headers at the start of a chunk.

a little easier to find out with bash & netcat instead of real c-coding...



[#] Wed May 26 2010 10:54:07 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

really? chunking is a lower level protocol thing, it is unaware of mime-ness.
That doesn't sound right.

[#] Wed May 26 2010 15:33:47 EDT from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

no. I took the wrong conclusion.

it was the java crap xml parser that didn't like linebreaks in the soap xml part.



[#] Wed Jun 09 2010 07:51:54 EDT from the8088er @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I seek the gentle guidance of someone with SQL fu.

I'm trying to write a script, which I'll pastebin if someone tells me it will help, but yeah... Part of the script gets data from the URL as text I think ( I wrote it but that doesn't mean I understand how it works!) for the purpose of putting it into an sql query

URL can be
http://localhost/script.php?product=42, 53, 84, 100 (just like that with the spaces) and that turns the query into this

SELECT * from catalog_product_entity_media_gallery where entity_id in (42, 53, 84, 100)

That works perfectly for my purposes and it's method is naturl to the person who's going to be actually calling the script.

My problem is that later we drop all the rows that match this query and we need to recreate them. Specifically we need to create three rows for each entity_id and assign a different value to each, the value coming off of another URL arguement. The value will have arbitrary info added to it that should look like this (Say ?product=100&img=coffee)

100 coffee.jpg
100 coffee_.jpg
100 coffee_t.jpg

I have to do this in another table as well but I just used UPDATE because in that table, there's an attribute_id that's different for each of the three records, and the records are guaranteed to exist in that table. In the catalog_product_entity_media_gallery table the records may or may not exist, so my logic was to delete existing records then make new ones.


Hopefully this makes some sense to someone out there :)

Go to page: First ... 56 57 58 59 [60] 61 62 63 64 ... Last