Вувузелло!
А тем временем, оказывается, для MythTV выпустили патчег, который оное жужжание вырезает нах. Жаль, руки не дойдут наложить.
Еще можно тонко настроить эквалайзер, устроив вполне себе режэкторный фильтр.
Правда, я футбол не очень смотрю.
А тем временем, оказывается, для MythTV выпустили патчег, который оное жужжание вырезает нах. Жаль, руки не дойдут наложить.
Еще можно тонко настроить эквалайзер, устроив вполне себе режэкторный фильтр.
Правда, я футбол не очень смотрю.
Зоценил сегодня IПрокладку.
Прикольно.
Правда, нафиг оно нужно – не понял. Но прикольно.
In the software development, the pattern when one object has send a message to another object, where the object that has to be called is given to the first class somehow (usually in constructor), is quite common. In C#, the delegates serve exactly this purpose, but in C++ it is a different story.
The most common way of implementing the class-to-class callback in C++ is to define an interface, which the class that receives the event must implement:
class IInterface
{
public:
virtual void CallbackMethod() = 0;
}
class MyClass:
public IInterface
{
public:
virtual void CallbackMethod()
{
// do something useful
}
class Publisher
{
private:
IInterface* m_pCallee;
public:
Publisher(IInterface* pCallee):
m_pCallee(pCallee)
{
}
private:
void SomeMethod()
{
m_pCallee->CallbackMethod();
}
}
}
It isn’t exactly rocket science, but this method has some downsides, and some of them are quite nasty and not obvious at all. Those are:
The last one could make you wish you never become a software programmer. The architecture, which seemed so beautiful just moments before, starts to fall into pieces once you find yourself in situation when you realize that your class-subscriber needs to receive same callbacks from different sources and act differently depending on who the caller is.
Let me explain it on the example. Imagine you have a class that implements that callback interface. You also have a lot of providers that take that interface to inform the subscribers, for example, about quote changes. But in your class, you need to track changes on, say, 10 quotes, and depending on which of those 10 changes, take different actions. So, what ’s your options?
Of course, you could just add an additional parameter to callback method that specifies the sender, but it is not pretty at all, as the subscriber class now faces a new challenge of keeping track of all publishers it is subscribed too. Not mentioning the mess in the callback method needed to get all stuff to work!
Ideally, you want each of those providers to call different methods of your subscriber class, but in a general case it would mean 10 different interfaces and changes in all publishers, which may not be possible and I don’t even want to talk about it. The other option would be to write the proxy, which implements the basic callback interface, subscribes to the only provider and then re-routes the call to certain method on your class.
Thankfully, there is the far better option. boost::bind and boost::function are here to help.
class Publisher{
public:
typedef boost::function<void (int)> typeCallbackType;
void Subscribe(typeCallbackType cb)
{
m_cb = cb;
}
private:
typeCallbackType m_cb;
void SomeDataProcessingMethod()
{
// ....
m_cb(currentPrice);
}
}
And here is a good thing: your subscriber class does not have to implement any custom interface anymore:
class MySubscriber
{
public:
void CalledWhenPriceChanges(int newPrice)
{
// make profit here
}
}
to establish a subscription, simply use boost::bind:
Publisher* pPublisher = GetPublisherFor("someTicker");
MySubscriber Subscriber;
pPublisher->Subscribe(boost::bind(&MySubscriber::CalledWhenPriceChanges, &Subscriber, _1));
That’s all, folks!
Now, once the pPublisher has a new data, a CalledWhenPriceChanged() method of Subscriber instance of a class MySubscriber will be called. It is easy to see how additional publisher could be added if you want to monitor two tickers.
It would not only help solving the problem of multiple publishers-one subscriber. This approach will also do a great job saving you time from not having to define numbers of callback interfaces for different types of data that needs to be passed from publisher to subscriber.
Интересно, что в C# настоятельно не рекомендуется вызывать виртуальные методы из конструкторов. По той же, в общем-то, причине, что и в C++.
Технологии технологиями, но фундаментальные вещи пропадать никуда не собираются.
Сидел играл в HL2. Жоска укачало. Удивился – в свое время Descent проходил. Не прошел, правда, но по другой причине. Пришлось HL2 прекратить.
От нечего делать пошел посмотреть, что это за ЙаПад такой. Стошнило нафиг.
Кто-нибудь, расскажите мне, нафига оно такое нужно? А то единственное пришедшее мне на ум применение этой таблЭтке – не подходит. Ввиду наличия отсутствия уеб-камеры.
Задача: есть кухня. Нужно обеспечить освещение столешницы.
Собственно говоря, прикрутить галогенки с трансформатором под шкафчики проблемы не составляет. Проблема возникает дальше, когда нужно организовать разумное управление всем этим фестивалем.
В идеале хотелось бы, чтобы управлять всем светом на кухне можно было с одного основного выключателя. Который, легко догадаться, на данный момент включать что-то отличное от лампочки под потолком не обучен.
И вот тут начинаются интересные расчеты. Вызвать электрика, чтобы протянул дополнительный провод от выключателя куда надо – 400 баксов. Как минимум. Это если стенобитная машина не понадобится, вероятность чего в моем случае составляет чуть более 100%.
Можно трансформатор от галогенок просто по-пролетарски засунуть в шкафчик над вытяжкой и воткнуть в розетку там же. Протягивание проводов от выключателя заменить покупкой набора для автоматизации на основе X10 (Z-Wave в Австралии стоит совершенно неразумных deneg, в отличие от X10, за который тоже хотят неразумных денег, но их им уже никто не дает). Инвестиции в это составят 100-150 долларов плюс еще 40 за радиоконтролер на стенку. Контролер этот зело похож на выключатель и его можно будет просто наклеить на стенку поверх дырки от старого выключателя.
Плюсы второго варианта – в стартовый набор входит достаточно ништяков, чтобы приделать дистанционное управление каждой лампочке на кухне и половине лампочек в гостиной впридачу. Минус в том, что аппетит приходит во время йеды и вскоре может захотеться управлять с дивана в гостиной светом в ванной или заставить компьютер включать/выключать свет по хитровытраханным алгоритмам.
Подытоживая вышеизлитое, хотелось бы спросить у уважаемых френдов – стоит ли вообще связываться с X10?
Тесла открыли свой первый магазин в Европе. В Мюнхене.
Симптоматично, что магазин находится на Blumenstrasse.
Про цветок в окне пока ничего не сообщается.
Джеймс Мэй чертовски похож на Брайана.

Не одному мне так кажется, но они вроде ни разу не родственники. По крайней мере, никто не признается, но как-то подозрительно все это.
Но дело не в этом. Оказывается, в перерывах между Топ Гирами он отгрохал себе дом из Лего.
Самый шик тут в том, что собственно строительство Лего и собственно сами кубики ему достались нахаляву. “James would also like you to bring any unwanted lego with you..”.
В свое время говорили “не покупай наркотики. Стань рок-звездой и получишь их нахаляву”. Кажется, с тех пор в мире что-то изменилось.
В моей софтверной империи программист, своими изменениями в коде сломавший юнит-тест, и, вместо исправления теста, тупо закоментивший его перед коммитом, будет приговариваться к двум неделям расстрела незрелыми арбузами без права условно-досрочного освобождения с последующим разжалованием в мойщики унитазов без права на эвтаназию.
Some time ago I built myself home media center on MythBuntu 8.04. It works exceptionally well… well, with one exception, if I may be excused. I could not watch my absolutely legally purchased DVDs at all – playback was choppy and jumpy, making watching movies anything but enjoyable.
If you found this post on google, you, probably, are about to give up. I was too. But I found a solution that worked for me. So, if you, like me, have seen zillions of webpages discussing the problem but none of solutions worked for you, keep reading (and please comment if this post helps you to solve your problem).
So the problem was that CD or DVD driver has no DMA enabled and hdparm would report an error:
HDIO_SET_DMA failed: Operation not permitted
when trying to enable DMA.
I have Intel-based HP desktop with SATA HDD and IDE DVD combo drive. No problem with HDD, but DVD got stuck in PIO mode and hdparm is no help anymore. I have modules ata_piix and libata loaded.
After scanning though many discussions and FAQs, I finally found the most accurate description of the problem that offered a way to fix it. So I did exactly what they told:
# echo options libata atapi_enabled=1>/etc/modprobe.d/atapienable # update-initramfs -u
and added
combined_mode=libata
option to kernel line in grub’s menu.lst
After reboot DVD drive was finally in UDMA mode!