Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 06-17-2012, 09:36 PM   #4051
lolcat
 
kerowo's Avatar
 
Join Date: Nov 2005
Posts: 20,763
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by tyler_cracker View Post
the answer to this question is almost always "no... and yes."
Zen mother****er right there.
kerowo is offline   Reply With Quote
Old 06-17-2012, 09:40 PM   #4052
Carpal \'Tunnel
 
jukofyork's Avatar
 
Join Date: Sep 2004
Posts: 10,213
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by jjshabado View Post
I think its suppose to represent a mailbox with the little flag thing up - so new email or something?

Edit: Or maybe you have an unread/unlistened to email,text,voicemail?
Yeah, that's what I thought to start with but managed to test and see what the unread text and voicemail symbols looked like and they were different.

Pretty sure it is a unlocked padlock now (just the icon was so small on this that it was unreadable) and it should hopefully go away when I enter a good signal area.

Juk
jukofyork is offline   Reply With Quote
Old 06-18-2012, 12:03 AM   #4053
Carpal \'Tunnel
 
Ryanb9's Avatar
 
Join Date: Aug 2006
Location: NEVA!
Posts: 6,371
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

In C# I have a main class (Main) that everything is in and another class that is a virtual base class (Base). Assume that in Main I make one instance of each of the four classes that are derived from the aforementioned base class (DerivedN).
Base has an event that Main subscribes to. So each time Derived1 or 2 etc does x Main handles that event. But at the same time, any time Derived1 does the thing that makes it fire the Base event, Derived 4 needs to do something. And anytime Derived2 does the event Derived 3 needs to do something.
I'm wondering if I should go from Derived1 strait to Derived4 or from Derived1 to Main to Derived4.
Ryanb9 is offline   Reply With Quote
Old 06-18-2012, 12:28 AM   #4054
old hand
 
sdturner02's Avatar
 
Join Date: Jul 2010
Posts: 1,211
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Another angle. It looks kinda different here, like the blue spot in the center of the yellow isn't just a blue spot?

sdturner02 is offline   Reply With Quote
Old 06-18-2012, 02:20 AM   #4055
S.A.G.E. Master
 
daveT's Avatar
 
Join Date: Jun 2005
Location: Why didn't I use Clojure instead?
Posts: 16,827
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I work with a whole crapload of Chinese. They can tell me what that image means. Or if they can't, then there's something fishy going on.
daveT is offline   Reply With Quote
Old 06-18-2012, 02:27 AM   #4056
Carpal \'Tunnel
 
gaming_mouse's Avatar
 
Join Date: Oct 2004
Location: taking notes on u (see profile)
Posts: 11,950
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by sdturner02 View Post
Another angle. It looks kinda different here, like the blue spot in the center of the yellow isn't just a blue spot?

looks kind of like a radio icon....
gaming_mouse is offline   Reply With Quote
Old 06-18-2012, 03:28 AM   #4057
Pooh-Bah
 
skier_5's Avatar
 
Join Date: Jan 2006
Location: London
Posts: 5,293
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Chips Ahoy View Post
No. Static libraries don't contain the other static libraries they depend on. To verify: put a unique string in libC and grep for it in libA and libB with strings http://technet.microsoft.com/en-us/s.../bb897439.aspx

It won't appear in A or B, and only once in the binary.

The linker starts with a list of object files. For each object file it looks at the symbols the file provides, and the symbols the file needs. After it checks them all, there will be some symbols that are needed but not provided within the binary.

So the linker starts searching libraries for each unknown symbol. As soon as it finds a library that provides the symbol, it quits searching. That library is added to the binary if it wasn't already, and its symbols get added to both the provides and needs lists. If it's a dll, the linker just creates import table entries to let the loader finish the job.

If your object files don't use any symbols from a library, it doesn't ever get added to the binary.

So you see there's only one libC. When the linker is working on libA, it pulls in libC to satisfy A. Then when the linker works on libB, the needed symbols are already there.


bolded should be A and B, yes?


hmmm. If you really want an exact set of things packaged together, the best way is to package them yourself. Build a dll with a matched set of libraries. I'm not sure this is what you really want. You can use linker tricks to get a similar result.

Consider a symbol in C that automatically changes during the build process and depends on the version number. Now have A and B reference that symbol. They will only link with the exact version of C they were tested against.



You already have the problem you are hoping to avoid because of this:



You only get one libC linked in, but A and B could be tested against different versions of libC. Whichever libC is in the search path / library list first comes in and has to satisfy both A and B.



How about putting a binary boundary around anything that can change independently -- the end products? So if libA and libB are things people consume, make them into dllA and dllB. Static link all of their dependencies into them. You say you want to ship them as complete packages, a single dll without dependencies is a complete package.

It is known that compiler settings need to be pretty uniform when working with static libraries to prevent the multiple / conflicting crt problem. That relaxes a bit when you go to dlls as long as you don't alloc/free across boundaries. Less requirements on the users of A/B is a good thing.

This is all from old memories, so please do sanity check what I say.
Thanks for the response! I actually got sidetracked and have been working on something that hasn't made me confront all this yet, but this has cleared a lot up for me. If I understand correctly, while my static libraries are not including the libraries they depend on, they do include any symbols that they use? So, if I link against my libC first then any symbols that libC uses from libA will be pulled from the libC binary and not from libA?

I'm going to look into the DLL solution and will certainly be exploring this in further depth soon. I already had some issues. I have some classes that are simply referenced in a couple of my libraries and I was getting some very odd behaviour (the program seemed to be skipping a function that was called) using these classes even though the libraries were compiled minutes apart and used the same version of the code. Rearranging the linking order fixed it
skier_5 is offline   Reply With Quote
Old 06-18-2012, 03:32 AM   #4058
Pooh-Bah
 
skier_5's Avatar
 
Join Date: Jan 2006
Location: London
Posts: 5,293
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Ryanb9 View Post
In C# I have a main class (Main) that everything is in and another class that is a virtual base class (Base). Assume that in Main I make one instance of each of the four classes that are derived from the aforementioned base class (DerivedN).
Base has an event that Main subscribes to. So each time Derived1 or 2 etc does x Main handles that event. But at the same time, any time Derived1 does the thing that makes it fire the Base event, Derived 4 needs to do something. And anytime Derived2 does the event Derived 3 needs to do something.
I'm wondering if I should go from Derived1 strait to Derived4 or from Derived1 to Main to Derived4.
That sounds like it's going to get messy real quick. Allow your event class to have multiple listeners and then use multiple inheritance to make any of your derived classes that need to receive an event conform to the listener interface.
skier_5 is offline   Reply With Quote
Old 06-18-2012, 04:30 AM   #4059
S.A.G.E. Master
 
daveT's Avatar
 
Join Date: Jun 2005
Location: Why didn't I use Clojure instead?
Posts: 16,827
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Since we're all in OO land for today, I have a question:

Given this fun piece of Lisp (Scheme) code:

Code:
(define (append! x y)
  (set-cdr! (last-pair x) y)
  x)

(define (last-pair x)
  (if (null? (cdr x))
      x
      (last-pair (cdr x))))

(define x (list 'a 'b))
(define y (list 'c 'd))
Here's the commented version for those who want to give this one a shot:

Code:
;; Append takes two cons cells (sorta like lists/arrays, 
;;but not really, but lists
;; which are used here allow you to do 
;;cons-cell stuff to it by default)
;; takes the pairs of x and y (pair is really n-items)
;; and appends x to y, 
;;thus ('a 'b 'c) & ('e 'f 'g) => ('a 'b 'c 'd 'e 'f)

;; now create append! which takes two cons x y
;; and appends them together, thus ('a 'b 'c) & ('e 'f 'g) => ('a 'b 'c 'd 'e 'f)
(define (append! x y)
  (set-cdr! (last-pair x) y)
  x)

;; last pair is a helper function to append! 
;;(append is a tail-recursive function)
;; which uses tail recursion to create a single list. 
;; look back up to (append!) and notice 
;;(set-cdr!(....)), which is a procedure
;; that takes the list (in this case) 
;;of x and creates a mutated list.
(define (last-pair x)
  (if (null? (cdr x))
      x
      (last-pair (cdr x))))

;; This of course creates two global variables x and y
(define x (list 'a 'b))
(define y (list 'c 'd))
The output is as follows:

Code:
> (car x)
'a
> (cdr x)
(mcons 'b '())
> (car y)
'c
> (cdr y)
(mcons 'd '())
which all makes sense, and now for plain-ol' append:

Code:
> (define z (append x y))
> z
(mcons 'a (mcons 'b (mcons 'c (mcons 'd '()))))
> (car x)
'a
> (cdr x)
(mcons 'b '())
> (car y)
'c
> (cdr y)
(mcons 'd '())
>
and then append!:

Code:
> (define w (append! x y))
> w
(mcons 'a (mcons 'b (mcons 'c (mcons 'd '()))))
> (car x)
'a
> (cdr x)
(mcons 'b (mcons 'c (mcons 'd '())))
> (car y)
'c
> (cdr y)
(mcons 'd '())
Hopefully you caught the anomaly of (cdr x)

While I understand why this happened (Pen and Paper ftw!), I don't understand why something like this would be needed. Okay, mutable data is obvious, but is there any real-world use where:

-- Create an object
-- Define a new variable w which already has a mutable object x
-- Mutate the object x and store it in w
-- Let mutable and mutated object x hang around freely

I take it the lesson is supposed to be "be wary of mutable data because you may have strange side-effects," but I wonder if there is ever a need to create multiple lines of mutation in a program, or is this strictly a warning to not do this sort of stuff?

One part of the OO programs I have been going through already store the object in the object. For example, one may make create a bank account and have:

(account ('my-account 'withdraw 100))
>> whatever is left provided sufficient funds
and so on and so forth to create further accounts.

But this would be like me asking what the internal x is of procedure account and it telling me that it holds some specified value I can further mutate and this affects all accounts, which isn't supposed to happen. Now that I think of it, this is similar to what I was asking about: account essentially takes a list and creates a mutable cons cell?

Ugh, I feel like this is so close, but there's something there I can't quite explain to myself or articulate, thus I can't really ask the question, but that free-floating mutated and mutable object is bothering me.

note: Part of the stated lesson here is to demonstrate that visually same is not the same as computer same.
daveT is offline   Reply With Quote
Old 06-18-2012, 04:57 AM   #4060
help me help you
 
Chips Ahoy's Avatar
 
Join Date: Apr 2007
Location: up-at-dawn, pride-swallowing siege
Posts: 21,357
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by skier_5 View Post
If I understand correctly, while my static libraries are not including the libraries they depend on, they do include any symbols that they use? So, if I link against my libC first then any symbols that libC uses from libA will be pulled from the libC binary and not from libA?
not quite. Each obj gives two lists to the linker: symbols provided, and symbols needed. In the first pass the linker collects both lists for all objs. In the second pass the linker fixes the addresses needed in each obj with the first provider of that symbol (libA is the provider in your example).

Use /Verbose when linking to see what's happening.

Possibly Useful:

1. Add a GetVersion() function to libA
2. Compile libB and libC against libAs that return different values.
3. Link an exe with both libB and libC.
4. call GetVersion from within each lib.
5. See what results you get.

My prediction is both GetVersion() calls return the same value. Which would be a problem. libB.dll & libC.dll is my solution.
Chips Ahoy is offline   Reply With Quote
Old 06-18-2012, 06:25 AM   #4061
Carpal \'Tunnel
 
jukofyork's Avatar
 
Join Date: Sep 2004
Posts: 10,213
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by gaming_mouse View Post
looks kind of like a radio icon....
Yeah could be - Also somebody suggested it looks like a camera too

Quote:
Originally Posted by daveT View Post
I work with a whole crapload of Chinese. They can tell me what that image means. Or if they can't, then there's something fishy going on.
Please ask!

Juk
jukofyork is offline   Reply With Quote
Old 06-18-2012, 03:09 PM   #4062
banned
 
Join Date: May 2012
Posts: 163
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

thanks for help guys i finish my first web scraper now i have a 1500 game database. this program is super ugly looking i had some really ugly solutions to problems but got this big project done!
unluckyboy is offline   Reply With Quote
Old 06-18-2012, 07:51 PM   #4063
veteran
 
MrWooster's Avatar
 
Join Date: Mar 2007
Location: Shoving AK
Posts: 2,839
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by unluckyboy View Post
thanks for help guys i finish my first web scraper now i have a 1500 game database. this program is super ugly looking i had some really ugly solutions to problems but got this big project done!
I have yet to see a scraper that is not ugly... its in their nature.

Congrats
MrWooster is offline   Reply With Quote
Old 06-18-2012, 08:43 PM   #4064
journeyman
 
n00b590's Avatar
 
Join Date: Jun 2010
Location: TRYING TO MAKE MY WAY IN THE WORLD
Posts: 257
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by unluckyboy View Post
got this big project done!
lol
n00b590 is offline   Reply With Quote
Old 06-18-2012, 09:51 PM   #4065
banned
 
Join Date: May 2012
Posts: 163
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

why are you laughing at me?
unluckyboy is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 11:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive