Badges

Types

Formats

Show Only

Concat Rows in MSSQL
https://mreschke.com/138/concat-rows-in-mssql
How to return a comma separated list, in one column, from a field in multiple rows. If you have, for example, email addresses on multiple rows in a table but want to return them as one column, comma separated. Example: Database table ID | report_id | email | 1 | 1 | email1@email.com 2 | 1 | email2@email.com 3 | 1 | email3@email.com I want a return of report_id | email -| 1 | email1@emailcom,email2@email.com,email3@email.com To achieve this, you must create a user defined function which will conc...
|
post #138 by mreschke Mar 3rd 2009 (4077 views)
ArchLinux
https://mreschke.com/136/archlinux
Related Topics https:wiki.archlinux.org/index.php/Daemon If you use HAL, start dbus before hal, even though hal will start dbus and acpid, explicitly add dbus before hal anyway Do not background dbus Do not background anything you need immediately DAEMONS=(syslog-ng gensplash dbus hal network netfs @avahi-daemon @samba @crond @openntpd @cups @mpd) I like @syslog-ng network @netfs dbus @hal @crond kdm The default base install is syslog-ng network netfs crond Installation Guid at http:wiki.archli...
|
post #136 by mreschke Feb 23rd 2009 (5888 views)
Compiling the Linux Kernel
https://mreschke.com/135/compiling-the-linux-kernel
http:www.cyberciti.biz/tips/compiling-linux-kernel-26.html After building my first LFS system, I realized the LFS project has great kernel docs See http:www.linuxfromscratch.org/lfs/view/stable/chapter08/kernel.html which really points to this great doc http:www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt Note unless in a chroot like in LFS, just use make menuconfig instead of all the LANG stuff apt-get install build-essential libncurses5-dev Download and extract kernel...
|
post #135 by mreschke Feb 23rd 2009 (4173 views)
Linux Find Command
https://mreschke.com/132/linux-find-command
Ten usefull commands for FIND http:www.go2linux.org/usages-examples-of-find-command find ./ -name "*.mp3" this is casesensative find ./ -iname "*.mp3" this one is case-insensative find / -type d -print (to list only directories) find / -type l -print (to list only soft links) find / -type b -print (to list only bliock special files) find / -type f -print (to list only regular files)' find ./ -not -iname *.mp3 -not -iname *.jpg -not -iname *.jpeg like to find all junk thats not music or music re...
|
post #132 by mreschke Feb 17th 2009 (3155 views)
Virtualbox in Linux
https://mreschke.com/131/virtualbox-in-linux
See When you get say, Windows XP setup in your VirtualBox virtual machine, you can easily forward ports from the Host OS, to the Guest OS. An example, I want to use the windows Remote Desktop to remote into my virtual XP installation. I open port 3389 on my router to point to my ubuntu desktop, then I forward that port into my guest OS. List vms: VBoxManage list vms List Extra Data (port forwards): VBoxManage getextradata xpserver enumerate To forward to a machine http:ubuntuforums.org/showthre...
|
post #131 by mreschke Feb 11th 2009 (3443 views)
Linux Bootdisk
https://mreschke.com/130/linux-bootdisk
Would really like to learn more about embedded linux. Found an incredible website about Bootdisks and the boot process at http:www.tldp.org/HOWTO/Bootdisk-HOWTO which will be a good start. Later I will tackle Linux from Stratch at http:www.linuxfromscratch.org/lfs/view/stable/chapter01/how.html Also found some nice articles on a Tiny Busybox system written by the creator of BusyBox himself! Part 1 http:www.linuxjournal.com/article/4335 Part 2 http:www.linuxjournal.com/article/4395 BIOS calles s...
|
post #130 by mreschke Feb 10th 2009 (4930 views)
Kernel Virtual Machine (KVM)
https://mreschke.com/128/kernel-virtual-machine-kvm
Very nice, KVM on ubuntu instructions https:help.ubuntu.com/community/KVM Remember, theres also VirtualBox which I do have running, and there is vmware which I also have running. First attempt to virt vista Installing Windows Vista Ultimate on a KVM Virtual Machine running on Ubuntu Hardy Heron 8.04 Check if CPU can virtualize (can it returns any results) egrep '(vmx|svm)' --color=always /proc/cpuinfo Check if you have a 64 CPU (is if it returns any results) grep ' lm ' /proc/cpuinfo Check if y...
|
post #128 by mreschke Feb 9th 2009 (5726 views)
Batch File Snippets
https://mreschke.com/124/batch-file-snippets
@echo off FOR /F "TOKENS=1DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET h=%%d FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET m=%%e FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET s=%%f SET dateFilename=%yyyy%-%mm%-%dd%_%h%...
|
post #124 by mreschke Jan 16th 2009 (3175 views)
Solve SMTP Bogus Helo
https://mreschke.com/123/solve-smtp-bogus-helo
> Errors > Helo command rejected: need fully-qualified hostname > Host name xxx.com doesn't match IP address xxx.xxx.xxx.xxx See http:en.wikipedia.org/wiki/List_of_DNS_record_types Im not sure, but I believe along with correcting the reverse dns lookup (see below) you also need to set a fully qualified domain name (FQDN) for EasyMail SMTP Express. Usually, EasyMail will use the name of the server as the FQDN. An example, my server is dyna-web, so the error message is : Helo command rejected: ne...
|
post #123 by mreschke Jan 5th 2009 (9172 views)
BSD Help
https://mreschke.com/122/bsd-help
FYI, new install of FreeBSD 9.0-BETA3 with docs, src, ports,, (basic standard full install) ended up using 2.5g HD space. The new installer defaults entire drive to / slice, in fact the entire installer is quite different that previous versions, much easier it seems. portsnap fetch portsnap extract portsnap upgrade (after that just 'portsnap fetch update' to get latest ports) whereis portupgrade cd /usr/ports make quicksearch name=portupgrade cd /usr/ports/ports-mgmt/portupgrade; mak...
|
post #122 by mreschke Dec 31st 2008 (4933 views)
Multiboot with Grub
https://mreschke.com/121/multiboot-with-grub
Always leave the 3 primary partitions as large ones, to use for OS's that must be installed on primary Remeber, max 15 partitions (or is it 14, sda14?) If you have multiple drives, use only 1 swap to save partition numbers Pick 1 super small fast distro as your main distro which uses /boot. (or not? just grib-install to boot part?) Very Important (see Differences in partition formatting below) Format all drives and partition with the same OS, newer e2fs formatters are incompatible, grub won't b...
|
post #121 by mreschke Dec 22nd 2008 (5108 views)
Protect Apache Alias with htaccess
https://mreschke.com/115/protect-apache-alias-with-htaccess
How to password protect a apache alias Alias /seagate750/ "/mnt/seagate750/" AllowOverride All Options Indexes MultiViews Allow from all Note, must goto http:server/seagate750/ (Must have that last /) make /mnt/seagate750/.htaccess AuthType Basic AuthName "Password" AuthUserFile /mnt/seagate750/.htpasswd require valid-user make /mnt/seagate750/.htpasswd mreschke:blahblahblah replace that with the correct password, you can find a apache password generator online, just enter mreschke as the user M...
|
post #115 by mreschke Oct 21st 2008 (4402 views)
Xsel command line clipboard
https://mreschke.com/114/xsel-command-line-clipboard
Program that copies command output to the clipboard xsel is a linux GNU tool used to copy command line output or file output to your standard clip board for pasting. http:linuxtidbits.wordpress.com/2008/02/22/command-line-to-clipboard/ To copy a text to the middle mouse button clipboard: xsel < /etc/fstab To copy to the context-menu clipboard: xsel --clipboard < /etc/fstab Also Xsel can be piped to: echo “a-bit-of-text” | xsel -c cat /etc/make.conf | xsel -c Paste To output clipboard informa...
|
post #114 by mreschke Oct 14th 2008 (21494 views)
Loop Datagrid and get Forms
https://mreschke.com/112/loop-datagrid-and-get-forms
Say I have a datagrid with just one column, several rows, with a checkbox in each row. I want to build a save function that saves each checked item to the database. I also want to be able to click anywhere on the datagrid row and have that check/uncheck the box for me, which I will achieve with javascript and html events. First, the datagrid is named grdUserGroups I have one datagrid column, wich a TemplateColumn in it. That template column's item has 2 forms, a check box named chkUserGroup with...
|
post #112 by mreschke Oct 1st 2008 (3165 views)
Javascript Snippets
https://mreschke.com/110/javascript-snippets
Example, loops all checkboxes on page with certain name and alerts if they are checked Note: masterform is the name of my variable for (var i = 0; i < document.masterform.elements.length; i if (document.masterform.elements.type == 'checkbox') { if (document.masterform.elements.name.substring(0, 12) == 'chk_project_') { if (document.masterform.elements.checked) { alert('You Checked: ' } } } } A bit different than looping forms, this will loop all elements (like divs, spans, links...). function t...
|
post #110 by mreschke Sep 25th 2008 (4325 views)
MySQL Performance & Optimization
https://mreschke.com/108/mysql-performance-optimization
InnoDB provides MySQL with a transaction-safe (ACID compliant) storage engine that has commit, rollback, and crash recovery capabilities. However, it cannot do so if the underlying operating system or hardware does not work as advertised. Many operating systems or disk subsystems may delay or reorder write operations to improve performance. On some operating systems, the very system call that should wait until all unwritten data for a file has been flushed - fsync() - might actually return befo...
|
post #108 by mreschke Sep 23rd 2008 (6230 views)
SSH RSA Keys
https://mreschke.com/106/ssh-rsa-keys
For this to work the servers /etc/ssh/sshd_config must have RSAAuthentication yes PubkeyAuthentication yes On the local client, in a terminal, as the user you normally use to ssh with (like your normal username) ssh-keygen -t rsa This generates an RSA key for SSHv2 (v2 is the -t paramater) This creates 2 files in your /home/username/.ssh/ folder id_rsa, which is the private key id_rsa.pub which is the public key Now we have to get that public key file on to the server your are connecting to wit...
|
post #106 by mreschke Sep 14th 2008 (5089 views)
Remote Filesystem with SSHFS
https://mreschke.com/105/remote-filesystem-with-sshfs
Used for mounting a folder over SSH (Secure Shell File System). So I can map drives from a remote linux server. From http:www.linuxinsight.com/sshfs_secure_and_transparent_access_to_remote_filesystems.html apt-get install sshfs or yum install fuse-sshfs Finally, as sshfs is designed to be used by regular users (not under superuser privileges) you should add yourself (and possibly others) to the fuse system group. Something like this should do: usermod -a -G fuse You must logout and login again...
|
post #105 by mreschke Sep 14th 2008 (5385 views)
Manage Linux Users and Groups
https://mreschke.com/104/manage-linux-users-and-groups
A quick topic describing how to create and manage linux users and groups from the command line. This topic only describes what linux users and groups are and how to manage them. It does not explain security and permissions for those users. Please see for help on that topic. > Remember to use --help (example usermod --help to see a help list for that command Linux is a multi-user operating system. The linux user system uses users and groups to define a users role on the system. A user...
|
post #104 by mreschke Sep 13th 2008 (7336 views)
Partition Management in Linux
https://mreschke.com/101/partition-management-in-linux
Hard drive partition management in Linux Partition Drives Format Drives I don't have to tell you to be careful, everyone deletes a hard drive at some point, no doubt you have too. Make sure you get the right drive letter (sda or sdb or sdc...). I will substitute with x (sdx) This example will create a swap, a root partition for a linux install, and a large home partition. I am using a new seagate 750g SATAII HD. fdisk -l Note: this does not format the drive, just partitions it. fdisk /dev/sdx m...
|
post #101 by mreschke Aug 28th 2008 (5480 views)
Windows Remote Desktop
https://mreschke.com/99/windows-remote-desktop
While connect to a remote computer using windows remote desktop, the normal CTRLnot effect the remote machine, only your local computer. So these shortcuts give you control on the remote computer. Key combination Function Similar local keys CTRLCTRLALTALTALTCTRLCTRL http:sqlblogcasts.com/blogs/simons/archive/2006/02/06/CTRL-ALT-DEL-in-Terminal-Services.aspx First off, make sure the Remote Desktop Services service is started. In the Remote Desktop settings of my Windows 7 Professional 64bit insta...
|
post #99 by mreschke Aug 22nd 2008 (6200 views)
FreeNX Remote Desktop
https://mreschke.com/97/freenx-remote-desktop
FreeNX (http:freenx.berlios.de/) is a Terminal Server for Unix & Linux, similar to windows remote desktop or linux 2xTerminalServer. It is based off the non-free NX (http:www.nomachine.com/index.php). FreeNX client is only for linux, but NX has free clients for windows (http:www.nomachine.com/download.php) http:www.drtek.ca/freenx-server-ubuntu-hardy Note, uses SSH, so uses that port in /etc/ssh/sshd_config also, in sshd_config, if you have the AllowUsers set, then must add nx ex: AllowUsers nx...
|
post #97 by mreschke Aug 18th 2008 (3166 views)
Samba in Ubuntu
https://mreschke.com/94/samba-in-ubuntu
apt-get install samba Add the linux user, but disable linux box login useradd -d /home/username -s /bin/false -n username This will create a new user with same group name with (told by '-n'), but the user can't login and run any shell command (because you have specfic the login shell is /bin/false by the '-s' switch, if you want allow user to able to login to a shell, replace /bin/false with /bin/sh). Create a samba user (same as linux username created above) smbpasswd -a username '-a' switch t...
|
post #94 by mreschke Jul 26th 2008 (5749 views)
MSSQL Maintenance
https://mreschke.com/92/mssql-maintenance
SQL Server 2000 Maintenance > The database administrator works like a doctor, keeping databases healthy. Learn the routine maintenance tasks that can help your databases live a long and active life. SQL Server 2000 eliminates the need to run DBCC CHECKDB or DBCC CHECKALLOC. 99% of database failures and corruption with SQL Server 2000 happen due to hardware failures. It is still a good Idea to run DBCC CHECKDB to ensure the overall health of your database prior to backing it up. DBCC C...
|
post #92 by mreschke Jul 23rd 2008 (8835 views)
Javascript WZ_ToolTip
https://mreschke.com/91/javascript-wz-tooltip
Find most documentation online at http:www.walterzorn.de/en/tooltip/tooltip_e.htm Very awesome javascript tooltips, very advanced. One thing I did find is in IE7 (and maybe others, didn't test), the page loads very slowly with wz_tooltip in there. The fix was found at http:www.webdeveloper.com/forum/showthread.php?t=163644 I edited wz_tooltip tt_Err("There are HTML elements to be converted to tooltips.\nIf you" It defaultly says, true at the end. I am using an html element with all my tooltip d...
|
post #91 by mreschke Jul 23rd 2008 (6060 views)
Debian Apt-Get
https://mreschke.com/90/debian-apt-get
You can see a list of all packages installed by dpkg --get-selections, some packages will say "deinstall" next to them, this means that package has been uninstalled, but old data is still ramaining. You can purge these uninstalled packages by dpkg --purge the-nameof-the-package. If you wanted to write a loop to --purge all package with deinstall, do this for i in $(dpkg --get-selections|grep deinstall|awk '{print $1}'); do dpkg -P $i; done To Count installed packages dpkg --get-selections|grep i...
|
post #90 by mreschke Jul 22nd 2008 (2500 views)
ASP.NET DataSet or DataTable to Excel
https://mreschke.com/84/aspnet-dataset-or-datatable-to-excel
Export a dataset or datatable to excel .csv then stream (prompt for download) the file. This code uses a datatable, if you have a dataset, just convert to datatable like so Dim dt as new DataTable dt = ds.Tables(0) Dim sw As New System.IO.StreamWriter(Server.MapPath("~/data.csv"), false); Dim ds As New DataSet Dim dt As New DataTable ds = Session("trkDsResults") dt = ds.Tables(0) Dim iCol As Int16 = dt.Columns.Count Dim i As Int16 For i = 0 To iCol - 1 sw.Write(dt.Columns(i)) If i < iCol - 1 The...
|
post #84 by mreschke Jul 16th 2008 (3626 views)
ASP.NET Datagrid to HTML
https://mreschke.com/85/aspnet-datagrid-to-html
Export an ASP.NET datagrid to HTML Then you could stream the file to their browser with
|
post #85 by mreschke Jul 16th 2008 (3546 views)
Linux Network Configuration
https://mreschke.com/81/linux-network-configuration
Nice how2 on the /etc/network/interfaces http:www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/ Start the GUI network administration/configuration tool by typing redhat-config-network (Red Hat 9 and Enterprise 3.0) or system-config-network (Fedora) at a shell prompt. Make sure your network interface (typically eth0) is highlighted and click the Edit icon. Select the Automatically obtain IP address settings with dhcp radio button. Check the Automatically obtain DNS information from pr...
|
post #81 by mreschke Jul 12th 2008 (4830 views)
Linux SendEmail
https://mreschke.com/79/linux-sendemail
Not to be confused with linux sendmail. apt-get install sendEmail Create a bash script "sendemail" and run chmod 755 on it. #!/bin/sh export smtpemailfrom=zabbix@yourdomain.com export zabbixemailto=$1 export zabbixsubject=$2 export zabbixbody=$3 export smtpserver=yoursmtpserver.com export smtplogin=smtpuser export smtppass=smtppassword #Use this line if your SMTP server requires authentication /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:...
|
post #79 by mreschke Jun 30th 2008 (5238 views)
ASP.NET Alternate POST Method
https://mreschke.com/78/aspnet-alternate-post-method
When you click a button in ASP.NET, it POSTS to itself and calls the btnXXX_click function. One way to make it go to another .aspx page on click is to call Server.Transfer or Response.Redirect from within that btnXXX_click function, but no form variables will be passed along. I want to goto a btnXXX_Click function when the button is clicked, then do some stuff, then redirect to another page along with the form variables Doing a Server.Transfer or Response.Redirect will NOT transfer the form var...
|
post #78 by mreschke Jun 11th 2008 (3428 views)
MSSQL Natural Sort Workaround
https://mreschke.com/76/mssql-natural-sort-workaround
If you have a column that contains some alpha and some numeric data, SQL sees the entire column as alpha and sorts the data differently. Here is an example of an alpha column order by: 105k 10k 120k 20k Another Field Yet Another Field This is obvious since 5 (in 105k) is less than k (in 10k). This is the logical, correct way to sort alpha-numeric data. But I want the order to be 10k, 20k, 105k... In SQL, the column type is defined by the table you are pulling the data from, so if the table colu...
|
post #76 by mreschke Jun 11th 2008 (4617 views)
ASP.NET Datagrid Date Formatting with NULLS
https://mreschke.com/77/aspnet-datagrid-date-formatting-with-nulls
When displaying a formated date string in an ASP.NET datagrid, you get an error if the dataset field is NULL If closeDate is not NULL, this works fine, otherwise it errors. This works if closeDate is not NULL, otherwise it displays MM/dd/yyyy (in that format, not date format, does not display date) This works if closeDate is null (displays nothing), or contains a date. This is what you want to use.
|
post #77 by mreschke Jun 11th 2008 (3889 views)
.NET Directory to DataGrid
https://mreschke.com/74/net-directory-to-datagrid
Add a directory of files to a datagrid For greater control, you can , then bind the dataset to the datagrid.
|
post #74 by mreschke Jun 5th 2008 (3408 views)
SQL Divide by Zero Fix
https://mreschke.com/72/sql-divide-by-zero-fix
<p>There are three ways to avoid the "Division by zero encountered" error in your SELECT statement and these are as follows:</p> <ul> <li>CASE statement</li> <li>NULLIF/ISNULL functions</li> <li>SET ARITHABORT OFF and SET ANSI_WARNINGS OFF</li> </ul>
|
post #72 by mreschke May 30th 2008 (9166 views)
.NET Directory to Dataset
https://mreschke.com/71/net-directory-to-dataset
This article adds the files in a directory (with wildcards) into a datatable, then to a dataset. With slight modifications to this function you can return the file list as a dataset, datatable or string array. See Private Sub TabArchivesEvents() Dim archivePath As String Dim dirInfo As DirectoryInfo archivePath = System.Configuration.ConfigurationSettings.AppSettings("ExecutiveAnalysisArchivesFolder") & Me.DLR_ID & "\" If Directory.Exists(archivePath) Then dirInfo = New DirectoryInfo(archivePath...
|
post #71 by mreschke May 22nd 2008 (5623 views)
Linux Screen Command
https://mreschke.com/68/linux-screen-command
The following are some of the most used shortcuts that lets you navigate through your screen environment. Note that unless modified by your .screenrc, by default every screen shortcut is preceded by CtrlNote that these shortcuts are case-sensitive (so use shift A and K...) Dont forget to hit Ctrl 0 through 9 - Switches between windows CtrlBackspace - Switches to the previous available CtrlA - Changes window session name K - Kills a window session c - Creates a new window ' Default screens scree...
|
post #68 by mreschke May 21st 2008 (5578 views)
Linux NFS Remote Filesystem
https://mreschke.com/67/linux-nfs-remote-filesystem
Overview of the nfs server options I choose See man exportfs and http:www.troubleshooters.com/linux/nfs.htm for NFS server option details. Also CentOS docs are great for NFS client/serve details http:www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-nfs.html secure server must be started by root because it will use ports lower than 1024 rw enable read and write sync data must be fully synced to disk, this prevents corruption if a server crashes no_wdelay I use this because my nfs re...
|
post #67 by mreschke May 20th 2008 (4847 views)
Iptables Firewall
https://mreschke.com/66/iptables-firewall
<p>This document describes a small portion of iptables and how to setup a basic firewall using iptables. There are many huge books on iptables so I cannot go into any sort of detail here. If you want to create a more advanced firewall, then I suggest installing shorewall and reading the documentation <a class="urlLink" href="http://www.shorewall.net/Introduction.html" onclick="window.open(this.href, '_blank'); return false;">http://www.shorewall.net/Introduction.html</a> about setting it up. I generally use shorewall on my systems and configure them using <a class="urlLink" href="http://www.webmin.com/" onclick="window.open(this.href, '_blank'); return false;">http://www.webmin.com/</a>.</p>
|
post #66 by mreschke May 20th 2008 (5584 views)
IE7 Extensions
https://mreschke.com/61/ie7-extensions
How to turn Internet Explorers Extensions Off Pass the parameter -extoff to iexplorer.exe to disable add-ons You can create a shortcut with extension off by settings the target to "%PROGRAMFILES%\Internet Explorer\iexplore.exe" -extoff Start In would be: %HOMEDRIVE%%HOMEPATH% Note: Attached to this article is a ready made link, just rename it from ....ln_ to ....lnk Keywords > IE7 Internet Explorer Add-ons addons extension off disable
|
post #61 by mreschke May 14th 2008 (3059 views)
.NET Listbox
https://mreschke.com/62/net-listbox
For i = 0 To lstRecipients.Items.Count - 1 If lstRecipients.Items(i).Selected Then tmp = lstRecipients.Items(i).Value 'This is the selected users ID from tblLogin (not email) lstRecipients.Items(i).Selected = False End If Next
|
post #62 by mreschke May 16th 2008 (2433 views)
Food Health Information
https://mreschke.com/59/food-health-information
Item Amt. Carb Cal. Time Granola Bar .05 19g 90 8:30a http:www.essortment.com/lifestyle/dietarysuppleme_sluf.htm Do not add Vitamins A and D as supplements unless you now you are deficient. They are fat-soluble, meaning they are stored in the liver and adipose tissue and are not easily excreted. Taking too much of these vitamins is toxic. Vitamin A - Dark green and yellow fruits and vegies. Eggs. Vitamin D - Egg yolks, fatty fish (tuna, salmon, sardines, herring), fortified milk. 15 minutes, 3...
|
post #59 by mreschke May 8th 2008 (3476 views)
ProcessManager.vbs
https://mreschke.com/58/processmanagervbs
Very handy VBScript, watches a process during a certian time interval, if it's running good, if not start it unless it's beyond the time interval, then kill it. Good if you want a program to run between 1pm-5pm but not the rest of the time. Hook this up to a scheduled task and exec every 10 minutes to ensure app is running or app is dead. IF the process is down in the time frame, it will start it, and send out an email that it was down. See You must edit the script below. Must set the process t...
|
post #58 by mreschke May 6th 2008 (3315 views)
VBScript File List
https://mreschke.com/56/vbscript-file-list
<p>This script accepts a path (ex: c:\temp\*.* or c:\*.txt) and builds a 1 dimensional array of the files that match the directory/wildcard.</p>
|
post #56 by mreschke May 6th 2008 (3099 views)
VBScript Snippets
https://mreschke.com/55/vbscript-snippets
dim filesys set filesys=CreateObject("Scripting.FileSystemObject") If filesys.FileExists("c:\sourcefolder\anyfile.html") Then filesys.MoveFile "c:\sourcefolder\anyfile.html", "c:\destfolder\" End If Get the last modified date and time of a file Private Function FileDateTime(byVal pathname) Dim objFSO, objFile On Error Resume Next Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(pathname) If Err Then FileDateTime = Null Else FileDateTime = CDate( objFil...
|
post #55 by mreschke May 6th 2008 (3031 views)
Even Tabs in Pre Tag
https://mreschke.com/49/even-tabs-in-pre-tag
<p>Using the simple HTML <pre> tag with tabs often returns a bad result. The HTML parser will just convert those tab characters into spaces, an exact amount of spaces each time leaving you with uneven tabs.</p> <p><strong>Like this</strong><br /> <div class="code_outer"><span class="code_header">Code Snippet</span><pre class="code"><code>test one te two testing three </code></pre></div> </p>
|
post #49 by mreschke May 1st 2008 (2642 views)
MSSQL Date Functions
https://mreschke.com/48/mssql-date-functions
Date and time function tutorials and examples in MSSQL This topic contains a few of the MSSQL date functions and some useful snippets. Dates can get a little confusing in SQL but a good knowledge of their functions is critical for most data queries. Since the date manipulation queries are quite large, its best to set a @variable and reference that variable throughout the code. Remember that the SQL data type has hours, minutes, seconds and sometimes milliseconds also, so you must account for th...
|
post #48 by mreschke Apr 30th 2008 (26519 views)
VBScript Basics
https://mreschke.com/46/vbscript-basics
function test() dim a a = "Hi there" test = a 'This returns a end function Option Explicit 'Check a process, restart it and send email alert, or kill process depending on time window 'Original script created by NetRes 'Modified by mReschke 2008-04-28 (converted to functions, actions change by time, email enhancements, globals, generic process killer) 'If process is NOT running between start/endHour then restart it and send an email if sendEmail = true 'If process is running outside of start/end...
|
post #46 by mreschke Apr 29th 2008 (3149 views)
Send Email using VBScript
https://mreschke.com/45/send-email-using-vbscript
This is just a function snippet, sends an email with attachments, must manually edit function with email and attachment parameters. Used in and Sub SendLogEmail() Set pc = CreateObject("Wscript.Network") Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields Const schema = "http:schemas.microsoft.com/cdo/configuration/" dim emailBody Flds.Item(schema & "sendusing") = 2 Flds.Item(schema & "smtpserver") = "xxx.xxx.xxx.xxx" Flds.Item(schema & "...
|
post #45 by mreschke Apr 29th 2008 (6011 views)
Linux Paths
https://mreschke.com/43/linux-paths
Paths are the locations for executables which can be accessed from any location. echo $PATH PATH=$PATH:/dir/dir1 I downloaded UNace (an .ace acrhive extractor) I copied the unace folder to /usr/bin/ I added a path: PATH=$PATH:/usr/bin/unace now I can type unace anywhere, and it finds it from the path To edit a path for a user open $HOME/.bash_profile or to edit for all users edit /etc/profile In either file you will see: PATH=$PATH:$HOME/bin, just add paths to that, separate paths by a : PATH:$P...
|
post #43 by mreschke Apr 15th 2008 (2332 views)
Showing 51 to 100 of 116 results