VBA ≅ javascript on a webpage (Singletons)

Let’s focus on the typical use cases —

* A typical javascript app Operates on a DOM tree of the enclosing webpage.
* A typical VBA app operates on the EOM tree (Excel object model) of an attached workbook.

—-} In both scenarios, the programmer’s Main job is manipulation of the objects in the *OM. The *OM tree is essentially a big family of singletons. I’d say most GUI apps rely heavily on singletons even if you don’t like singletons.

Usually the VBA app is tailor made for that particular workbook. Tight coupling between the workbook and the VBA module. Javascript is similar.

Advertisements

simple VBA – copy sheets from Workbook A to B

Sub Btn_Click()
    Dim ws As Worksheet
    Dim targetWB, sourceWB As Workbook
    Set targetWB = ActiveWorkbook
 
    Workbooks.Open Filename:=Range(“B1”).Text, ReadOnly:=True
    Set sourceWB = ActiveWorkbook
 
    For Each ws In Worksheets
        ws.Copy After:=targetWB.Sheets(targetWB.Sheets.Count)
    Next ws
 
    sourceWB.Close SaveChanges:=False
    targetWB.Activate
End Sub

c# IV questions found online

I want to see some knowledge of things like the GAC, CLR and JIT. Here are some sample C#-specific questions: 
– Where are the framework assemblies stored? How is this useful? 
– Explain the abstract keyword and what is an example of its use? 
– Can you prevent a class from being inherited by another class? If so, how? 
Easy questions:
    * Is System.String a class or a struct (or reference or value type if you prefer).
    * Explain IDisposable and the 'using' statement.
    * Explain public, protected, private, and internal.
Intermediate questions:
    * What's the difference between Hashtable and Dictionary?
    * What does int? mean? Explain the relationship with Nullable.
Hard questions:
    * Explain the following snippet of code: 'from x in collection select new { x.Foo }'. What is the compiler doing? What is the CLR executing?
    * Explain the “yield” keyword. What is the compiler doing internally?
——
# What are Generics ? How do they affect performance.
# How would you define an Anonymous Functions? What is the difference between Anonymous Methods and Lambda Expressions?
# How does an Enumerator (IEnumerable & IEnumerator) work ? How does an Iterator work in C# 2.0 ?
# What is Garbage Collection ? How does it work ? What are generations in GC ?
# What is the role of an Extension Method ? When would you use it ?
# What is a Lambda Expression ? Where would you use it ?
# How would you define a new custom event ?
# How would you choose between a pure abstract base class and an interface.
# What is MVC how does it differ from MVP ?
# What is Dependency Injection / Inversion of Control ?
———
Everyone who writes code
    * Describe the difference between a Thread and a Process?
    * What is a Windows Service and how does its lifecycle differ from a “standard” EXE?
    * What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
    * What is the difference between an EXE and a DLL?
    * What is strong-typing versus weak-typing? Which is preferred? Why?
    * Corillian's product is a “Component Container.” Name at least 3 component containers that ship now with the Windows Server Family.
    * What is a PID? How is it useful when troubleshooting a system?
    * How many processes can listen on a single TCP/IP port?
    * What is the GAC? What problem does it solve?
Mid-Level .NET Developer
    * Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
    * Describe what an Interface is and how it’s different from a Class.
    * What is Reflection?
    * What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
    * Are the type system represented by XmlSchema and the CLS isomorphic?
    * Conceptually, what is the difference between early-binding and late-binding?
    * Is using Assembly.Load a static reference or dynamic reference?
    * When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
    * What is an Asssembly Qualified Name? Is it a filename? How is it different?
    * Is this valid? Assembly.Load(“foo.dll”);
    * How is a strongly-named assembly different from one that isn’t strongly-named?
    * Can DateTimes be null?
    * What is the JIT? What is NGEN? What are limitations and benefits of each?
    * How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
    * What is the difference between Finalize() and Dispose()?
    * How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
    * What does this useful command line do? tasklist /m “mscor*”
    * What is the difference between in-proc and out-of-proc?
    * What technology enables out-of-proc communication in .NET?
    * When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Senior Developers/Architects
    * What’s wrong with a line like this? DateTime.Parse(myString);
    * What are PDBs? Where must they be located for debugging to work?
    * What is cyclomatic complexity and why is it important?
    * Write a standard lock() plus “double check” to create a critical section around a variable access.
    * What is FullTrust? Do GAC’ed assemblies have FullTrust?
    * What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
    * What does this do? gacutil /l | find /i “Corillian”
    * What does this do? sn -t foo.dll
    * What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
    * Contrast OOP and SOA. What are tenets of each?
    * How does the XmlSerializer work? What ACL permissions does a process using it require?
    * Why is catch(Exception) almost always a bad idea?
    * What is the difference between Debug.Write and Trace.Write? When should each be used?
    * What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
    * Does JITting occur per-assembly or per-method? How does this affect the working set?
    * Contrast the use of an abstract base class against an interface?
    * What is the difference between a.Equals(b) and a == b?
    * In the context of a comparison, what is object identity versus object equivalence?
    * How would one do a deep copy in .NET?
    * Explain current thinking around IClonable.
    * What is boxing?
    * Is string a value type or a reference type?
    * What is the significance of the “PropertySpecified” pattern used by the XmlSerializer? What problem does it attempt to solve?
    * Why are out parameters a bad idea in .NET? Are they?
    * Can attributes be placed on specific parameters to a method? Why is this useful?
C# Component Developers
    * Juxtapose the use of override with new. What is shadowing?
    * Explain the use of virtual, sealed, override, and abstract.
    * Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
    * Explain the differences between public, protected, private and internal.
    * What benefit do you get from using a Primary Interop Assembly (PIA)?
    * By what mechanism does NUnit know what methods to test?
    * What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
    * What is the difference between typeof(foo) and myFoo.GetType()?
    * Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
    * What is this? Can this be used within a static method?

pitfalls with NTFS junction point

http://www.techrepublic.com/article/manually-creating-junction-points-in-windows-xp/5388706 and
http://en.wikipedia.org/wiki/NTFS_junction_point warn —

^^Junction point target must be a local file system directory. Target can’t be a file.
^^Most delete operations are junction-unfriendly. Can damage the target i.e. the real files !
^^DOS command dir can report odd free-space statistics on drives that contain folders acting as junction points.
^^Junction points can cause havoc with certain backup programs, that aren’t junction-point aware.
^^if a target folder C:\a\b\T contains some kind of link (symlink? hard link? shortcut?) then I find it troublesome to move the folder content somewhere and replace C:\a\b\T with a junction point

^^Junction points do not work at boot, so it’s impossible to “redirect” i.e. substitute a hardlink for e.g.:
\Windows
\Windows\System32
\Windows\Config

Nevertheless, it is possible to redirect:
\Users
\Documents and Settings
\Program Files
\Program Files (x86)

RiskReversal negative bid / positive ask

Refer to the one-way RR quote in http://bigblog.tanbin.com/2012/06/fx-vol-quoting-convention.html.

Q1: What if 25Delta risk reversal bid/ask quotes are both positive?

As in the above example, dealer (say UBS) gives an RR Ask quote of 3.521%. Let’s say we have some hacker/insider friend to peek at UBS database, and we find the call’s Ask implied-vol is 9.521% and the put’s Bid implied-vol is 6%. In other words, dealer is willing to Write the 25Delta call at an annualized implied-vol of 9% and simultaneously Buy the Put @i-vol of 6%.

Now we ask the same dealer for a bid price. Dealer is bidding 2.8%. Our friend reveals that dealer is secretly willing to Buy the call @i-vol=8.9% (Lower quote) and simultaneously Write the put @i-vol=6.1% (Higher quote).

If you compare the bid vs ask on the call, as market maker the dealer is putting out 2-way quotes to buy low sell high.

If you compare the bid vs ask on the put, as market maker the dealer is putting out 2-way quotes to buy low sell high.

In this scenario, RR bid is below RR ask but both positive.

Q2: Could an RR bid be negative while the ask positive?

Ok We are serious about Selling an RR. To get a better bid price, we ask Dealer2 (SCB) for a Bid quote. Dealer is bidding -0.2%. Our insider tells us this dealer is willing to Buy the call @i-vol=5.9% and simultaneously Write the put @i-vol=6.1%

Between these dealers, Dealer1 would be the best (highest) bid. Now Dealer1 withdraws its quote. Dealer2 is the only bid. Market best RR bid is now negative.

Q2b: When would be RR bid and ask have opposite signs?
A: I guess when the 2 currencies are almost equal in terms of downside/upside

Q3: what if best RR bid and best RR ask are both negative? I think this is the norm in some currency pairs. Suppose market is bearish on the commodity currency (1st) and bullish on the quote currency (2nd). Treating commodity currency as an asset, Sink insurance costs more than surge insurance. Put premium exceeds Call premium. RR would be negative in both bid and ask.

mortgage is like a callable bond, briefly

The mortgage you take on can be, for educational purpose, compared to a personally issued bond (you as issuer) with a predefined monthly repayment and a fixed interest rate. (The floating interest mortgage is comparable to a floating-interest bond.)

When you refinance at a lower interest, it's similar to a callable-bond issuer exercising the call option and then refinance.

The call option is embedded in the “bond”. The call option allows the issuer/borrower to “buy” back the bond from the lender, thereby ending the contract.