This fragment is about to be reported (you'll remain on this page):

You can enter a comment to clarify the mistake if you would like to:

Недавние записи RSS20

Downloading list of URLs with wget

This is just a quick tip on how you can set up a batch download of any number of URLs with wget. Long story short:

urls.txt is a plain text file with each line representing an URL (blank lines are ignored). -b option makes wget run in background like shwget & but unlike it the output will be redirected to wget-log in the current directory.

wget-log might grow huge because it’s essentially a redirected output stream but unlike when on screen progress bar lines (100K .......... 0% 1.63M 33s) are appended on each iteration – so when downloading large files there will be thousands of such lines.

See also my other post – Recursively downloading an FTP directory.

Отзывов пока нет | Показать эту запись »

Serving static language-dependent pages with nginx

A few days ago I have already written about Content negotiation in Apache – language-dependent pages. Now I needed to set up my production server (that uses nginx instead of Apache) to handle Accept-Language and serve page.en.html, path/index.ru.html, etc. appropriately. Here’s how it’s done.

First we’ll need to recompile nginx with this 3rd party module (source on GitHub). I have tested it with nginx/1.0.12 and the module still works. If you’re on Linux with yum the following will do the trick for you:

The configure string is taken from CentOS, yours might be different – find it with shnginx -V. Also, make sure to replace shwget .../nginx-1.0.12.tar.gz with your version/URL (see nginx -v for version number).

pcre-devel is required unless you already have it installed (non-devel pcre won’t do and if you’ve initially installed nginx with yum pcre-devel won’t be preinstalled).

«…»

Отзывов пока нет | Читать полностью »

Content negotiation in Apache – language-dependent pages

Sometimes you have a set of static pages (or data), all of which is the same but meant for different languages. For example, you can have a static resource with index.en.html, index.ru.html, index.fr.html and so on – and you want to let the client choose which one he wants based on his language preferences (Accept-Language).

Apache has a useful module called mod_negotiation that does that and even more. «Content negotiation» is a process of guessing the best appropriate content based on client preferences when several resources match the requested URI.

It won’t affect normal requests for which a resource is determined unambiguously (i.e. if its canonical URI matches the request one-to-one). In other words, if you request /path/some-page and there are some-page.en.html, etc. then it’s the job for mod_negotiation; however, if you request /path/some-page.en.html exactly then it’s returned regardless of what headers does your browser send.

In Apache this is done with MultiViews – an Option that enables processing of requests that don’t match any exact local resource (e.g. /path/some-page ). Once such a request is received Apache will see if any file starts with given URI and if it does it will check its extension and try to determine which of those matched files can be served.

«…»

Отзывов пока нет | Читать полностью »

Секрет блендера

Для тех, кто никак не может сделать зелёный коктейль или у кого нет желания использовать воду.

После 8-дневного голодания месяц назад у меня в картине мира что-то поменялось. На самом деле, как я писал позже, много что в ней изменилось, но кроме прочего – моё отношение к блендеру и соковыжималке развернулось на 180° и теперь я прекрасно понимаю, почему они пользуются спросом (в основном блендеры).

Тем не менее меня по-прежнему смущает требование добавлять стакан воды во всех рецептах, которые я читал. Если мы делаем коктейль из, скажем, яблок или груш, или даже просто банана – зачем там вода? Разбавлять превосходную природную воду, которой выделяется с лихвой из самих фруктов?

Однако всё было не так просто – хотя, как оказалось, всё было просто, но я заходит не с той стороны. Когда я пытался сделать зелёный коктейль, то поступал самым простым образом: брал ворох зелени, бросал туда бананы и жал на кнопку… и оно не работало. Зелень скапливалась внизу стакана, нож вращался, но до неё не доставал – она была либо на стенках, либо над ним. А о бананах или других фруктах и речи не шло, они просто не пробивались до низу.

«Вот оно зачем говорят, что нужна вода,» – думал я. Самое интересное, что о такой проблеме вообще никто не пишет – можно подумать я один хочу избежать воды. Однако воды мне принципиально не хотелось. На деле проблема актуальна для мощных стационарных блендеров типа VitaMix. С погружными проще, но в них зелень запутывается и сложнее сделать «гомогенную» массу.

«…»

Отзывов пока нет | Читать полностью »

The PHP dualism – self and static

Explains the difference between two keywords and probably the only case when self versus static still wins.

The PHP dualism – self and static

Version 5.2 introduced a (yet another) funny situation in PHP: static methods were possible and they could be overriden like in a proper OOP language but… well, they couldn’t be overriden «entirely».

The deal was that in 5.2 you couldn’t get class name of the object which static method is being called from within that method (it was possible for instance methods with PHPget_class($this);). PHP used self to refer to such object from within its own static method but it would always result in PHP__CLASS__ – that is, the name of class where this method implementation is defined. Basically, it was the same as copying class’ name from PHPclass Name { ... }.

Interestingly you couldn’t even use debug_backtrace as, naturally, PHP wouldn’t and couldn’t show you the proper name there.

But this, of course, was not satisfactory and programmers raged and demanded «real OOP» – even if only for static methods. Overall it looked like a quick fix to get 5.2 out.

«…»

Отзывов пока нет | Читать полностью »

WUXG-изм

Вот уже пятый день, как я делаю тест-драйв относительно недавно вышедшей модели ноутбука Sony Vaio SVS1511S3RB (изготовлен в июле 2012) с WUXGA Full HD-экраном 1920×1080. Это этакий телевизор с диагональю 15,4". Retina, конечно, ещё больший беспридел, но и тут есть чему подивиться.

Однако на деле мелкое зерно оказалось не такой уж большой проблемой. В самом деле, в Windows 7 можно поменять DPI на более крупный, если текст мелковат, и в отличии от XP эта настройка работает более адекватно (хотя даже в XP с ней серьёзных проблем нет). Картинка смотрится чётко, пикселей, естественно, не видно даже вблизи.

Однако вот что интересно: несмотря на стабильную тенденцию к увеличению разрешения экранов вот уже который год (а теперь не только за счёт габаритов, но и размеров зерна) производители ПО всё с большим усердием «чистят» окна своих программ от «лишнего мусора». Довольно забавно видеть такие картинки:

Моё обычное разрешение, за которым я работал последние 4 года – 1600×1200, но даже на нём я не разворачиваю окна на весь экран (к примеру, браузер у меня держится где-то на 1/2-1/3 ширины экрана). Но сколько пользователей я видел, да и читал об этом – большинство из них первым делом распахивают любое окно от края до края, причём это касается как Проводника, так и браузера.

Так чтоболее логичным мне кажется не сокрытие элементов под новыми кнопками или меню, а замена «горизонтальной» парадигмы на вертикальную – вместо тулбаров и меню использовать боковые панели, как в графических редакторах вроде Photoshop и Paint. Тем более 90% экранов сегодня широкоформатные и место по краям всё равно девать некуда – две страницы, как в Word, в браузере открывать обычно нет смысла, а читать тексты при такой широченной колонке вообще трудно.

Отзывов пока нет | Показать эту запись »

Intel HM77 – SATA AHCI driver for Windows XP

Intel HM77 – SATA AHCI driver for Windows XP

Many laptops with i5-i7 CPUs these days use powerful Intel’s HM77 chipset. Examples are Lenovo and Sony Vaio. Even though some hardware is tweaked by each manufacturer it doesn’t seem to affect low-level SATA.

Some download centers like Lenovo’s will provide you with a driver for old good Windows XP while some others, like Sony’s – won’t, even though they use the same drivers found on the Intel’s site and on Lenovo’s site too.

If you’re struggling to get XP installed on such a laptop here’s how to embed the AHCI driver into XP install CD (assuming you have switched from Legacy to AHCI in BIOS – if there’s no such option your model just always uses AHCI).

  1. Get the archive. Intel calls this Rapid Storage Technology (RST) and these drivers in particular – F6 setup drivers (as they’re read by by XP/2003 from a floppy by pressing F6 during setup initialization). HM77 uses Intel® 7 Series/C216 Chipset Family SATA AHCI Controller – you can determine this by examining Storage section of AIDA64.
  2. Get nLite and either install or extract it somewhere
  3. Get your XP image or CD, copy it to local disk, run nLine and point it to that folder
  4. Click Next, skip loading last session (if prompted), check Integrate – Drivers and Create – Bootable ISO
  5. Click Next, then click Insert in the lower part of the window, Multiple driver folder
  6. In the browse dialog locate the extracted archive with F6 drivers, click OK
    1. nLite might ask you to choose folders to integrate (that’s a window with just one list and some text) – if it did check all with your mouse (press and drag from the first list item to the last); click OK
    2. nLite will prompt you which driver(s) to embed; check Textmode driver and in the list below highlight corresponding line – in case of HM77 it’s Intel(R) 7 Series/C216 Chipset Family SATA AHCI Controller but if you’re in doubt you can select others too
    3. Click OK – you’ll be back in the main window where you should now see new entries added to the list of integrated drivers
  7. Click Next, then Yes to start integration
  8. When done you’ll see the page where you can burn this image to a CD or create bootable ISO. Either way will you get the same XP CD you’ve copied but with integrated SATA drivers. You can now delete the local folder

«…»

Отзывов пока нет | Читать полностью »

External display resolution problem in Windows 7

External display resolution problem in Windows 7

It’s become a trend to attach to notebooks at least one external high-resolution screen like plasma TV or just a quality display. So it’s the case with me. I do various design work in Photoshop and Illustrator and even besides that I just like the deep and realistic colors TNs cannot provide. For these reasons I’m using Nec 2090UXi as my primary monitor.

Attaching a display via any kind of bus – VGA, DVI, HDMI, etc. – is no problem when you only have one. However, it’s not as obvious when you have multiple.

In particular, with Windows 7 and Server 2008 R2 (which is nearly the same) when you connect another screen via VGA cable you will likely only get 1024×768 resolution at most. Moreover, this display will be identified as Generic non-PnP Monitor.

I have googled for this and couldn’t find any solution besides advices to (re)install the driver, plug the cable in/out and so on. I have already tried Upgrading the «generic» monitor with my own driver and it actually did show properly in the Device Manager – but that was all. In Screen Resolution applet it was still displayed as a «monitor over VGA» or something similar.

«…»

Отзывов пока нет | Читать полностью »
  1. 1
  2. 3
  3. 4
  4. 5
  5. 6
  6. 11
  7. 16
  8. 21
  9. 26
  10. 30
  11. 31

PHP Laravel по-русски - фреймворк, framework, CodeIgniter, FuelPHP, пакеты, сборки, документация, форум.