- the script filename has to be matched the pattern (see below).
- this script has to be located within directory tree of free nestion but one of directories of the tree has to be macthed the same pattern.
Wednesday, 19 August 2009
Substring extraction by CMD
Once i needed to solve the next task. I have a batch script with name corresponding to the following conditions:
Wednesday, 5 August 2009
Monday, 27 July 2009
URL parsing in Javascript
There is very simple way to parse URL in Javascript. Just define new method in the prototype of the
String. Of course, it has own shortcomings but in the most cases it covers the wide range of URLs and protocols (http(s), ftp, mailto, etc; the mandatory part of URL, host is considered as domain names, IPs, and localhost separately), and moreover it considers the more complex URLs like jdbc:oracle://localhost:1521.
Ярлыки:
algorithms,
javascript
Thursday, 9 July 2009
JS2BAT converter 2
Earlier to embed javascript codes into batch files the
JS2BAT tool has ben implemented with batch features only. In this topic the same tool has been implemented in pure javascript. As opposed to the previous version the present one is the more functional and has optional parmeters.
Previously the js2bat.js script has been implemented in javascript. After that it has been converted to the js2bat.bat batch script by itself with the following command:
cscript js2bat.js js2bat.js
Tuesday, 7 July 2009
JS2BAT converter
This script allows you to embed Javascript codes into the batch-script immediately. So you can stop to worry about creating of an additional batch-wrapper or lost of some specific parameters. Perl distribution has the same functional script
pl2bat but for wrapping of perl-scripts with batch-scripts. I am not author of this idea, i just implemented this feature as the standalone tool.
The main feature is to write the prolog code that is valid both in a batch and javascript. When launching the batch it runs as batch and calls the javascript interpreter with the same file as javascript file. But the second one skips this prolog as valid javascript comments.
Friday, 3 July 2009
Finest code syntax highlighter
Quotation from the Code Syntax Highlighter, the homepage of the project, allowing to embed colorizing of text and fully written on Javascript.
I decided to use it in my blog and found that it works fine. Unfortunately there is no brushes for
SyntaxHighlighter is a fully functional self-contained code syntax highlighter developed in JavaScript.It is really true! It is very useful, very flexible and easy to customize. The main idea is to use so-named brushes to colorize codes within
<pre /> tags (it is defined by default and customizable too!). Colorizing is simple. You have to link scripts and styles to your pages and add brush via class attribute (like this class="brush:js" for colorizing of Javascript codes). I decided to use it in my blog and found that it works fine. Unfortunately there is no brushes for
cmd/bat scripts and i have implemented this embedding to the blog's layout the code from below.
Ярлыки:
cmd-bat,
javascript
HOWTO turn a character case via CMD/BAT
Introduction
This example is amazing that fact that it can be extended by non-Latins with no pain. Just add your owned translation table at the end of script in the formatUPPER lower. For example, the translation table for Cyrillic characters is following:
А а Б б ... Ю ю Я яJust remember that the capitals have to be the first with following lowercase letters.
Examples of usage
Capitalize all characters. Results toQWERTY.
CAPS qwerty /uThe first character is capital, and others are in lower case. Results to
Qwerty.
CAPS qwerty /ufInvert the result of the previous example. Both result to
qWERTY.
CAPS qwerty /uf /l CAPS qwerty /lf
Ярлыки:
cmd-bat,
feel-sorry-for-throw-out,
windows
Sunday, 28 June 2009
Monday, 22 June 2009
Monday, 15 June 2009
WC: Emulation of the unix command
This is curious, joke. It is attempt to emulate the unix-commad wc. Do not consider this as fully featured application. It has essential shortcomings - slower than analogs and it gives great mistakes when counting the number of words. This is related with features of processing of special characters when passing them as arguments.
Ярлыки:
cmd-bat,
feel-sorry-for-throw-out,
shell,
unix,
unix-to-nt,
unix-to-win,
windows
Validate number arguments within CMD/BAT
@echo off
if "%~1" == "" (
echo EMPTY
goto :EOF
)
if "%~1" == "0" (
echo ZERO
goto :EOF
)
set /a number_var=%~1 2>nul
if errorlevel 2 (
echo ILLEGAL
goto :EOF
)
if %~1 neq %number_var% (
echo ERROR
goto :EOF
)
set number_var
goto :EOF
Ярлыки:
algorithms,
cmd-bat,
windows
Saturday, 13 June 2009
Complex numbers with Javascript
Однажды решили попрактиковаться в реализации комплексных чисел средствами Javascript. Вот что из этого получилось. Особенностью модуля является вычисление всех частей (вещественной, мнимой, модуля и аргумента) комплексного числа на момент его создания. Это ни прибавляет, ни отнимает скорости вычислений, но оптимизирует некоторые вычисления (например, при вычислениях в алгебраической или полярной формах). Описаны арифметические операции, основные функции над комплексными числами (возведение в степень, логарифм, степенная функция, экспонента, квадратный корень и вычисление всех корней). Арифметические операции расширены для операций над несколькими числами.
Ярлыки:
algorithms,
feel-sorry-for-throw-out,
javascript
Tuesday, 26 May 2009
О влиянии волосяного покрова из спагетти на вкусовые качества сарделек
Профессор кулинарии Некстлессон сообщил о необычном кулинарном эксперименте по разведению волосатых сосисок. Нами был повторен данный эксперимент.
Saturday, 23 May 2009
Wednesday, 8 April 2009
How to secure your PC from autostart/autorun viruses on flash
Introduction
This article has been inspired after reading of the another article devoted to mounted disks within Windows XP. To know details follow the link. Here i will briefly explain essentials from that article and will demonstrate how this feature can be applied for the subject. Of course, do not need to accept these instructions with high seriousness.Sunday, 5 April 2009
Prepare a request from an assoc.array
I am continuing (with sorry about this) to free from unused codes in my box. Meet next code - it allows to convert an assoc.array to an URL request and backward.
Ярлыки:
feel-sorry-for-throw-out,
php
Create hex-dump of string
Однажды я упражнялся в алгоритмизации простой задачи на PHP. Вот результат (с небольшими доработками перед отправкой сюда).
Ярлыки:
feel-sorry-for-throw-out,
php
Bit collection from integer value
The next example of code that was appeared once without any historical bounds of it's appearance. Look. It collects all bits from an integer value into an array.
Ярлыки:
feel-sorry-for-throw-out,
php
Saturday, 4 April 2009
Extended floor and ceil functions
I do not remember why i done this. Maybe this was used somewhere. Maybe i had practised in algorithms simply. Do not remember.
There are two functions allowing round fractions down/up accordingly divider.
Ярлыки:
feel-sorry-for-throw-out,
php
Subscribe to:
Posts (Atom)