what things are #include’d – c++, java, python

Not just utility functions, but also

* global variables like cin.
** think of them as fully initialized OBJECTS (or services), usable out of the box

* classes – as cookie cutters, very different from cookies the OBJECTS above
** and Families of classes

Java (and c#?), in contrast, only put TYPES in included libraries. To include (and then use) utility _OBJECTS_, they have to be presented as public static fields like System.out. These static member objects get created when the TYPE is loaded by the class loader. In contrast, c++ library objects (like cout) are typically part of a  namespace.

Why the difference? I think reason is the so-called “free(standing)” variable outside any type. Java forbids it. Any language permitting it can package it along with types and free functions into a “unit” (package, module, namespace…) to be #included.

Python (and perl) is more like c++.

How do you identify high workload? #letter to XR

Q: Do you need to record how you allocate time to assignments in blocks of 2 hours, 4 hours or 8 hours?
Q: Do you need to everyday describe, verbally, what you did in the previous day?
Q: When neck, back, or eyes feel tired, do you always feel free to get away from computers for a while?Q: Do regular developers feel relaxed enough to write documentation in wiki or Word document for other people?
Q: Do you get time to make 30-minute chitchats with friends on office phone during office hours?
Q: Do you feel pressure to return to work after 45 minutes at lunch with a friend (assuming no official policy about how long lunch break is).
Q: do you feel relaxed enough to read department newsletter? Exclude brief light periods after a project.
Q: do you feel relaxed enough to read technology newsletter? Exclude brief light periods after a project.
Q: Do you think twice about going out for lunch once a week?
Q: Do you ever work out (briefly) before leaving office?
Q: Suppose you are stuck waiting for an answer or for a build to finish, do you feel you can just stop working for 15 minutes? What if you get such “waiting periods” everyday? Does your manager make it a rule that you should take up some of the numerous other tasks during such a short wait?

Q: As a developer, during office hours do you feel relaxed enough to read business publication related to work? I believe (even lead) developers never have to read such things to do a decent job. Required business knowledge is highly site-specific and accrue during projects. Knowledge about industry is never a must.

market^limit order — market-taker^maker

To some extent, we can say

market maker –uses– limit orders
market taker –uses– market orders

If you have an open position to close[1], you often have a choice to submit a limit order or market order. In a typical security’s market, at any time there are just 2 important quotes i.e. best bid/ask.
$ market makers execute at the “better” of the 2 prices
$ market takers execute at the “worse” of the 2 prices

Market takers “suffer” the inferior price to get immediate execution.

[1] Now, even if you have square position, you still have the 2 basic choices, but situation is less intense.

SoapHttpClientProtocol – capture inbound xml

    /// Decorates the generated SoapHttpClientProtocol subclass with inbound snooper
///
/// Based on http://orbinary.com/blog/2010/01/getting-the-raw-soap-xml-sent-via-soaphttpclientprotocol/
public class ServiceDecoratorI : ServiceDecoratorO
{
private ExposedHttpWebResponse _lastResponseNonNull = new ExposedHttpWebResponse();
protected override WebResponse GetWebResponse(WebRequest request)
{
_lastResponseNonNull = new ExposedHttpWebResponse(request);
return _lastResponseNonNull;
}
public string InBoundXml
{
get
{
return XDocument.Parse(_lastResponseNonNull.Content).ToString();
}
}
}

class ExposedHttpWebResponse : WebResponse
{
private readonly HttpWebResponse _response;
public override Stream GetResponseStream()
{
var readData = new byte[1024];
int readBytes;

Stream contentStream = _response.GetResponseStream();
var result = new MemoryStream();

do
{
readBytes = contentStream.Read(readData, 0, 1024);
result.Write(readData, 0, readBytes);
} while (readBytes > 0);

contentStream.Close();
_response.Close();

var reader = new StreamReader(result);
result.Seek(0, SeekOrigin.Begin);
Content = reader.ReadToEnd();
result.Seek(0, SeekOrigin.Begin);
return result;
}
internal ExposedHttpWebResponse() { Content = ""; }
internal ExposedHttpWebResponse(WebRequest request) { _response = (HttpWebResponse)request.GetResponse(); }
public string Content { get; private set; }
public override long ContentLength { get { return _response.ContentLength; } }
public override WebHeaderCollection Headers { get { return _response.Headers; } }
public override string ContentType { get { return _response.ContentType; } }
public override Uri ResponseUri { get { return _response.ResponseUri; } }
}

SoapHttpClientProtocol – capture outbound xml

<![CDATA[ // Decorates the generated SoapHttpClientProtocol subclass with outbound snooper public class ServiceDecoratorO : MainRequestResponse__HTTP { private XmlWriterSpy _writer; public string OutBoundXml { get { return (_writer == null ? null : _writer.Xml); } } protected override XmlWriter GetWriterForMessage(SoapClientMessage message, int bufferSize) { _writer = new XmlWriterSpyE(base.GetWriterForMessage(message, bufferSize)); return _writer; } } ///

/// This class has special behavior when writing end-elements ///

class XmlWriterSpyE : XmlWriterSpy { public XmlWriterSpyE(XmlWriter implementation) : base(implementation) { } public override void WriteEndDocument() { _me.WriteEndDocument(); _bu.WriteEndDocument(); return; } public override void WriteEndElement() { _me.WriteEndElement(); _bu.WriteEndElement(); var xmlStr = _sw.ToString(); //if (xmlStr.Contains(BBGviaSOA.ticker.id)) // Log1.log(xmlStr); } } /// Wrapper class for XmlWriter that “spies” on the Xml being written /// and later makes that Xml available as a string to anyone who wants /// to inspect it. See also my blog description of this class: /// http://orbinary.com/blog/2010/01/getting-the-raw-soap-xml-sent-via-soaphttpclientprotocol/ public class XmlWriterSpy : XmlWriter { protected XmlWriter _me; protected XmlTextWriter _bu; protected StringWriter _sw; public XmlWriterSpy(XmlWriter implementation) { _me = implementation; _sw = new StringWriter(); _bu = new XmlTextWriter(_sw); _bu.Formatting = Formatting.Indented; } public override void Flush() { _me.Flush(); _bu.Flush(); _sw.Flush(); } public string Xml { get { return (_sw == null ? null : _sw.ToString()); } } public override void Close() { _me.Close(); _bu.Close(); } public override string LookupPrefix(string ns) { return _me.LookupPrefix(ns); } public override void WriteBase64(byte[] buffer, int index, int count) { _me.WriteBase64(buffer, index, count); _bu.WriteBase64(buffer, index, count); } public override void WriteCData(string text) { _me.WriteCData(text); _bu.WriteCData(text); } public override void WriteCharEntity(char ch) { _me.WriteCharEntity(ch); _bu.WriteCharEntity(ch); } public override void WriteChars(char[] buffer, int index, int count) { _me.WriteChars(buffer, index, count); _bu.WriteChars(buffer, index, count); } public override void WriteComment(string text) { _me.WriteComment(text); _bu.WriteComment(text); } public override void WriteDocType(string name, string pubid, string sysid, string subset) { _me.WriteDocType(name, pubid, sysid, subset); _bu.WriteDocType(name, pubid, sysid, subset); } public override void WriteEndAttribute() { _me.WriteEndAttribute(); _bu.WriteEndAttribute(); } public override void WriteEndDocument() { _me.WriteEndDocument(); _bu.WriteEndDocument(); } public override void WriteEndElement() { _me.WriteEndElement(); _bu.WriteEndElement(); } public override void WriteEntityRef(string name) { _me.WriteEntityRef(name); _bu.WriteEntityRef(name); } public override void WriteFullEndElement() { _me.WriteFullEndElement(); _bu.WriteFullEndElement(); } public override void WriteProcessingInstruction(string name, string text) { _me.WriteProcessingInstruction(name, text); _bu.WriteProcessingInstruction(name, text); } public override void WriteRaw(string data) { _me.WriteRaw(data); _bu.WriteRaw(data); } public override void WriteRaw(char[] buffer, int index, int count) { _me.WriteRaw(buffer, index, count); _bu.WriteRaw(buffer, index, count); } public override void WriteStartAttribute(string prefix, string localName, string ns) { _me.WriteStartAttribute(prefix, localName, ns); _bu.WriteStartAttribute(prefix, localName, ns); } public override void WriteStartDocument(bool standalone) { _me.WriteStartDocument(standalone); _bu.WriteStartDocument(standalone); } public override void WriteStartDocument() { _me.WriteStartDocument(); _bu.WriteStartDocument(); } public override void WriteStartElement(string prefix, string localName, string ns) { _me.WriteStartElement(prefix, localName, ns); _bu.WriteStartElement(prefix, localName, ns); } public override WriteState WriteState { get { return _me.WriteState; } } public override void WriteString(string text) { _me.WriteString(text); _bu.WriteString(text); } public override void WriteSurrogateCharEntity(char lowChar, char highChar) { _me.WriteSurrogateCharEntity(lowChar, highChar); _bu.WriteSurrogateCharEntity(lowChar, highChar); } public override void WriteWhitespace(string ws) { _me.WriteWhitespace(ws); _bu.WriteWhitespace(ws); } } ]]>

trade commission exists in any security market

Many authorities claim that “unlike stock market, this … market has no trade commission”. Those authorities often say you just pay for the bid/ask spread and the dealer just earns that spread.

In reality, any transaction (even if just buyer/seller without middleman) can involve commission or transaction fee. The bigger player or Whoever with more power can more or less “arbitrarily” impose a transaction fee to cover her expenses, whatever they are.

#1essential classificationS@variables]each language: java/c++/c#

In java, a variable is exactly one of 2 — reference var or primitive var. Therefore, a thingy/entity (more precisely an”allocation”) is either an OBJECT or a primitive. Clean and simple.

C++ doesn’t differentiate between primitives and composite objects. However, it does differentiate between allocation locations. In C++, an entity either lives on heap, on stack or global area, with important differences. The word “object” has no special meaning.

See also http://bigblog.tanbin.com/2009/06/primitive-vs-object-dichotomy-not-in-c.html
See also http://bigblog.tanbin.com/2011/04/pbref-pbclone-in-any-language.html

In C#, avoid the word “object” if possible. The real, deep and precise (less clean than java) dichotomy is value-type vs reference type.
* a reference type variable occupies 32 bits on a 32-bit machine. The pointee is always on heap, and could be 99 Bytes.
* a value type variable is like a nonref in c++ and occupies 99B. Unlike reference type variables, there’s no separate storage for the variable.
* See http://bigblog.tanbin.com/2011/10/rooted-vs-reseat-able-variables-c-c.html

– assignment to a reference type var copies the RHS 32 bit address and reseats the LHS pointer. Same as java.
– assignment to a value type var bulldozes the LHS and clones the 99B into it.
**Java only clones primitives, up to 64 bits.
**C++ can clone any variable if you pass-by-value.