?

Log in

No account? Create an account
Alexander Dolgin Below are the 4 most recent journal entries recorded in the "Alexander Dolgin" journal:
November 11th, 2012
09:31 pm

[Link]

скрипт для вытаскивания историчесих данных с яху файненс
Простой скриптик на Groovy. Для каждого из символов из файла _symbols вытаскивает дневные бары за 2011 год.

processSymbol = {
	String symbol = it;
	print("Processing " + it + " ...\t\t");
	String url = "http://ichart.finance.yahoo.com/table.csv?s="+symbol+"&d=11&e=31&f=2011&g=d&a=0&b=1&c=2011&ignore=.csv"
	def out = new BufferedOutputStream(new FileOutputStream("output\\" + symbol+".csv"))
	try{
		out << new URL(url).openStream()
	} catch (IOException e){
		println("Error")
		return
	}
	finally{
		out.close()
	}
	println("Done")
}

File symbols = new File("_symbols")
symbols.eachLine(processSymbol)

(1 comment | Leave a comment)

January 26th, 2009
08:33 am

[Link]

Правдивая история о трех поросятах

(4 comments | Leave a comment)

June 22nd, 2008
11:56 pm

[Link]

Этот момент, лично мне, кажется, мягко говоря, спорным.

As of release 1.5, there is a third approach to implementing singletons. Simply
make an enum type with one element:
// Enum singleton - the preferred approach
public enum Elvis {
   INSTANCE;
   public void leaveTheBuilding() { ... }
}

This approach is functionally equivalent to the public field approach, except that it
is more concise, provides the serialization machinery for free, and provides an
ironclad guarantee against multiple instantiation, even in the face of sophisticated
serialization or reflection attacks. While this approach has yet to be widely
adopted, a single-element enum type is the best way to implement a singleton.


Я бы скорее сделал, хотя бы, что-то такое:
public interface IElvis
{
...
}

public class DefaultElvis implements IElvis
{
   private static IElvis Instance_ = new DefaultElvis();
   ...
   public static IElvis getInstance() {return Instance_;}
}

Tags:

(7 comments | Leave a comment)

October 9th, 2005
10:31 pm

[Link]

bat файлы - сила
поменять расширение у всех файлов с m1 на mp3
@for /r d:\music %%a in ("*.m1") do @move "%%a" "%%~dpna.mp3"

Tags:

(4 comments | Leave a comment)

Powered by LiveJournal.com