2011-12-27

Is user given filename valid?

...and try & catch comes to help.

Code in pastebin - http://pastebin.com/HCsDFtUv

Shortly - the function tries to write file and if success, then it deletes it and returns True. Otherwise it returns False. The function could be extended by trying the writing in specified temporary folder.

Such method allows to avoid from using specific and complex regular expressions.

2011-12-22

dummy csv/xyz writer for latvians

Software (written in Visual Basic 2010, dependent of .NET framework)
http://failiem.lv/down.php?i=ntpoppd&n=xyzCreator.exe


the class code (in VB2010) -
http://pastebin.com/fDL3WUSY

Different countries has their own different regional settings. Sometimes it is very inconvenient when in spreadsheet function the decimal separator is comma (as in Latvia) but for programs you need dot as the decimal separator.
In this simple tool just copy columns, choose settings and save somewhere the file.

2011-12-07

Local max,min and slope count in python list.

Simple function written in python - local maximum and minimum count and slope count in the given 1D array (list). M-shaped function has two maximums (or better say - two ascending/upward numbers in row) and minimums (two descending/downward numbers in row), but Λ shaped- one for both. Sometimes it is needed to know exact count of such maximums or minimums, or both.