Skip to content

A Function can return a value from itself. For example

Code:
Public Function Sum(ByVal a As Integer, _
ByVal b As Integer) As Integer
Return a + b
End Function
Then you can use this Function as follows

Dim result As Integer = Sum(2, 4)

On the other hand a Sub can not return a value from itself. It must use a
ByRef parameter to get a result. For example

Code:
Public Sub SumSub(ByVal a As Integer, _
ByVal b As Integer) As Integer)
Dim theSum As Integer = a + b
End Sub
This has no way of returning the result and using this like

Dim answer As Integer = SumSub(2, 4)

will generate a complile time error.

Abstract method

- no body, declaration ends with a semicolon

- implemented in the first concrete subclass in the inheritance tree

Casting

-Reference variable of type Object can’t be assigned to any other reference type without a cast

-A cast can be used to assign a reference variable of one type to reference variable of a subtype,

but at runtime the cast will fail if the object on the heap is NOT of a type compatible with the cast

Inheritance

- Multiple inheritance is not allowed in Java ==> Deadly Diamond of Death

Interface

- a pure abstract class

- A class can implement multiple interfaces

- All interface methods are implicitly public and abstract ==> a class that implements an interface must implement ALL the methods of the interface

Super

-invoke superclass version of a method from a subclass–> use super keyword

GUI

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

listener interface

- bridge between listener(you) and event source(button)

e.g. ItemListener interface for JCheckbox, void itemStateChanged(ItemEvent event)

KeyListener interface

Implementation of listeners

- 1. class needs to implement listener interface

e.g. public class abc implements ActionListener

- 2. register the listener to the component

e.g. button.addActionListner(this);

- 3. implements the details of event method

e.g. public void actionPerformed(ActionEvent event){…}

multiple listeners issue ==> inner class

call repaint() –> invoke paintComponent(Graphics g)

http://www.sqlservercurry.com/2011/08/sql-server-2008-move-data-to-different.html

function genRandomString() {
$length = 10;
$characters = ’0123456789abcdefghijklmnopqrstuvwxyz’;
$string = ”;
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}

http://www.aviransplace.com/2004/10/12/using-rsa-encryption-with-java/

http://www.coderanch.com/t/517065/java/java/anyone-help-me-solve-RSA

http://www.strongauth.com/forum/index.php?topic=58.0

http://www.javaeye.com/problems/55475

Sunk Costs

Sunk Costs are costs that were incurred in the past.  One basic principle of economics is that sunk costs are irrelevant to decision making.  Since economics is a social science and, as such, aimed at explaining what actually happens, it is argued that sunk costs don’t influence the “supply” or “demand” and so do not influence prices and quantities in the market.    From the point of view of managerial economics, the emphasis is on explaining to managers that it makes no sense to worry about sunk costs since it will not influence the profitability.

Think of the old sayings like “it’s water under the bridge,” or “let bygones be bygones.”  Sacrifices already made have already been made, and so what was sacrificed is irrelevant to deciding what to do now.

For example, suppose a business spent $10 million on a machine.  It will last 5 years and produce 1000 units per year.  Suppose materials and labor needed to produce each unit cost $3000.   If the cost of the machine is divided over the 5000 units of output it helps produce, that is a cost of $2000 per unit.  Given the cost of the materials and labor, that comes out to be $5000 per unit.  Naturally, one should consider this figure in pricing the product.  Right?  Wrong.  The $2000 per unit attributed to the cost of the machine is a sunk cost and irrelevant.   It is something to consider when deciding whether or not to purchase the machine.  And once the machine is purchased, it does influence the ability of the firm to produce output.  But the amount that was paid for the machine is a sunk cost and irrelevant to deciding how much to produce and how much to charge.

Another example regards purchasing stocks.  Suppose one purchased stock for $30,000.  Its price has fallen to $25,000.  It is a mistake to sell the stock because that would impose a loss of $5000.  Right?  Wrong.  The amount paid for the stock is irrelevant.  All that is relevant is the likely future changes in the price of the stock.  Holding onto the stock may be sensible if the price is going to rise.  Holding on to the stock if the price is likely to fall doesn’t make sense.

Opportunity Costs

Another way of making the point about sunk costs is that only opportunity costs matter.  When one is deciding to buy a machine, the $10 million must be given up and that involves the sacrifice of alternative purchases.  That is an opportunity cost and that matters.  After the $10 million has been spent, then that is no longer an opportunity cost.  It is a sunk cost.  An opportunity cost would be the resale value of the machine.  Suppose you could sell it for $4 million.  Then the cost of using the machine is $4 million, not the $10 million that had been paid.

Another interesting consideration regarding opportunity costs is that one should always consider the opportunity costs of inputs provided by owners.  Firms typically purchase inputs like labor and materials.  They also finance some of their capital purchases, and have interest costs as well as the depreciation of the capital goods.  These expenditures of funds are quite naturally described as costs.  But the owners of firms often provide some inputs themselves.  Almost always, some of the investment funds are provided in this manner–equity.   The amount that could have been earned by the owners in other employments is the opportunity cost of the funds.  For a sole proprietor, this might be possible to determine.  In the situations of corporations or partnerships, it becomes quite complex since different owners might have done different things with the funds.  Still, even in that situation, some interest rate should be applied to those funds to determine the opportunity cost and that amount needs to be added to all the explicit expenses to determine the total cost of production.

In some small firms, especially in the past, the owner would contribute labor to production without paying himself or herself a salary.  It is probably best to pay a salary based on the opportunity cost of the owner’s labor.  But if that isn’t done, the opportunity cost of the owner’s labor should be counted as part of the cost of producing the product.

marginal product or marginal physical product is the extra output produced by one more unit of an input (for instance, the difference in output when a firm’s labour is increased from five to six units).

Assuming that no other inputs to production change, the marginal product of a given input X can be expressed as

\mathrm{MP} =  \frac{\Delta \mathrm{Y}}{\Delta \mathrm{X}}

where ΔX is the change in a firm’s production inputs and ΔY is the change in quantity of production output.

分散式阻斷服務攻擊,亦稱作洪水攻擊,通常簡稱為DDoSDoS(即英語「Distributed Denial of Service」 的縮寫)。顧名思義,即是利用網路上已被攻陷的電腦作為「喪屍」,向某一特定的目標電腦發動密集式的「拒絕服務」要求,藉以把目標電腦的網路資源及系統資 源耗盡,使之無法向真正正常請求的使用者提供服務。駭客透過將一個個「喪屍」或者稱為「肉雞」組成喪屍網路(即Botnet),就可以發動大規模DDoS 或SYN洪水網路攻擊,或者將「喪屍」們組到一起進行帶有利益的刷網站流量、Email垃圾郵件群發,癱瘓預定標的受雇攻擊競爭對手等商業活動。

DDoS攻擊透過大量合法的請求佔用大量網路資源,以達到癱瘓網路的目的。 這種攻擊方式可分為以下幾種:

  • 透過使網路過載來干擾甚至阻斷正常的網路通訊。
  • 透過向伺服器送出大量請求,使伺服器超負荷。
  • 阻斷某一使用者存取伺服器
  • 阻斷某服務與特定系統或個人的通訊
SYN flood
SYN flood是一種駭客透過向伺服端發送虛假的包以欺騙伺服器的做法。具體說,就是將包中的原IP位址設定為不存在或不合法的值。伺服器一旦接受到該包便會 返回接受請求包,但實際上這個包永遠返回不到來源處的電腦。這種做法使伺服器必需開啟自己的監聽埠不斷等待,也就浪費了系統各方面的資源。
LAND attack
這種攻擊方式與SYN floods類似,不過在LAND attack攻擊包中的原位址和標的位址都是攻擊物件的IP。這種攻擊會導致被攻擊的機器無窮迴圈,最終耗盡資源而當機。
ICMP floods
ICMP floods是透過向未良好設定的路由器發送廣播資訊佔用系統資源的做法。
Application level floods
與前面敘說的攻擊方式不同,Application level floods主要是針對應用軟體層的,也就是高於OSI的。它同樣是以大量消耗系統資源為目的,透過向IIS這樣的網路服務程式提出無節制的資源申請來迫害正常的網路服務。

VirtualBox 兩三事: 複製vdi 及 修改 uuid 時常用 VirtualBox 來測試系統,然而最麻煩的是 VirtualBox 是用各 vdi 檔的 uuid 來管控,所以不得用同樣的 uuid,這使得沒有辦法用同一份印象檔來多重複製系統。 因此,如果要複製一份 vdi檔,最好是複製的同時可以對新的印象檔重新產生新的 uuid。 VBoxManage clonevdi Orig.vdi New.vdi 如果不幸複製完後才發現,還是有指令可以補救。 VBoxManage internalcommands setvdiuuid New.vdi 如此就可以針對 New.vdi 亂數再產生新的 uuid。

「匯率」:簡單來說,就是不同貨幣之間的兌換,顯示不同貨幣間的交換比
例。例如:歐元兌美金EUR/USD = 1.3048,即表示以一單位
的歐元(EUR)可以兌換1.3048單位的美金(USD)。

「升值與貶值」: 當一單位A國貨幣可兌換B國貨幣金額增加,即表示A國
貨幣升值、B國貨幣貶值。例如:歐元兌美金匯率由
1.3048上漲為1.3055,即表示歐元升值、美金貶值,亦
可說歐元走強、美元走弱。

「匯差」:外匯可作為兩國貿易時的交易媒介,而持有外匯的主要獲利來
源有二,一是該貨幣的利息,另一則是匯差(即投資外匯所賺得
的匯率價差)。因此在投資外匯時,要注意匯率變動對投資報酬
的影響。若我們推估某種貨幣將走強而購買它,如果該外幣果
然如預期般大幅升值,那麼除了利息收入之外, 還可以賺到匯
差;相反的,當該外幣走眨時,就要承擔匯率損失。

Free Web Hosting