Badges

Types

Formats

Show Only

SOAP and PHP
https://mreschke.com/278/soap-and-php
<p>Learn how to connect to an an PHP/SOAP or ASP.NET/SOAP web service with PHP and how to create a PHP SOAP web service (server)</p>
|
post #278 by mreschke Nov 16th 2011 (6977 views)
Windows Powershell
https://mreschke.com/259/windows-powershell
> Amazing script, this is for converting VHD's but it is an amazing reference, even build a GUI: http:www.ms4u.info/2012/06/create-sysprep-vhd-and-vhdx-for-windows.html (actual script http:gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f) How to even create and run a script file http:technet.microsoft.com/en-us/library/ee176949.aspx Basically enable local script execution with Set-ExecutionPolicy RemoteSigned Always run scripts with either their full path c:\test\scri...
|
post #259 by mreschke Jul 13th 2011 (3473 views)
EmailLogs.vbs
https://mreschke.com/213/emaillogsvbs
This script will email a log file (or any file specified) only if the file is under a certain size. If the file is over that size limit, it will still email, but no log will be attached. See Script does not use parameters, everything is hard coded, so just call the .vbs. Great in a scheduled task to email you a daily log file. Can easily be modified with parameters for various purposes. Option Explicit Dim iMsg, iConf, Flds, pc 'Email vars Dim logFile, maxLogSize 'Log vars Dim FSO, File, strSiz...
|
post #213 by mreschke Nov 10th 2010 (2809 views)
StartStopProc.vbs
https://mreschke.com/212/startstopprocvbs
This script will start or stop a process by process name. If the process is already running with a start is called, it will not start a duplicate. The benefit is that it will NOT start the script twice. So if you want to ensure an application is running all the time, just setup a scheduled task to run this script every 10 minutes, if the .exe dies it will start it, if the .exe is still running, it won't start a duplication. REM Example Script.bat (note I path to the .exe dir so it runs in its l...
|
post #212 by mreschke Nov 10th 2010 (2588 views)
DeleteOldFiles.vbs
https://mreschke.com/211/deleteoldfilesvbs
This script will recursively delete all files in every subfolder older than X days. Will not delete any folders, just files. I create a batch file and call the vbs script for any directory I need purged. rem Use this script to clean up any old files automatically. rem This .bat will be called weekly from a scheduled task, and will rem call the d:\production\batch\generic\DeleteOldFiles.vbs with directory/day parameters rem the commands will not run simultaneously (unless they begin with start)...
|
post #211 by mreschke Nov 10th 2010 (5056 views)
Python Tutorial
https://mreschke.com/195/python-tutorial
django installation on ubuntu server using WSGI http:blog.stannard.net.au/2010/12/11/installing-django-with-apache-and-mod_wsgi-on-ubuntu-10-04/ works great! Great Tutorials http:code.google.com/edu/ and http:code.google.com/edu/languages/google-python-class/set-up.html #!/usr/bin/env python Tuples (like lists but immutable) mytuple = (1, 2, 'three') print len(mytuple) print mytuple #tuple = 'hi' #error, immutable def Foo(): tuple = ('one', 'two') return tuple test = Foo() print test (one, two)...
|
post #195 by mreschke Jul 9th 2010 (5429 views)
Outlook Resources
https://mreschke.com/185/outlook-resources
A user of OWA (outlook web access) cannot create an event on a public shared calendar and invite attendees, the invite button is grayed out. This is by Microsoft design (google it). In order to allow an OWA user to create a calendar event with his calendar, other users calendar, and a public calendar, the public calendar must be assigned an email address and the OWA user must create the event from his own personal calendar, then click invite, then search for the public calendar as an attendee....
|
post #185 by mreschke Mar 11th 2010 (3821 views)
SMTP from MSSQL Procedure
https://mreschke.com/167/smtp-from-mssql-procedure
Ability to send an email from a MSSQL Stored Procedure http:www.sqldev.net/xp/xpsmtp.htm Download the attached .zip and extract Copy the xpsmtp80.dll to C:\Program Files\Microsoft SQL Server\MSSQL\Binn Run this procedure on the servers master database _ exec sp_addextendedproc 'xp_smtp_sendmail', 'xpsmtp80.dll' Use this syntax for a simple email _ DECLARE @rc INT EXEC @rc = master.dbo.xp_smtp_sendmail @FROM = N'from@email.com', @FROM_NAME = N'fromname', @replyto = N'replyto@email.com', @TO = N'...
|
post #167 by mreschke Dec 23rd 2009 (6767 views)
Recursive File Search or List in .NET
https://mreschke.com/153/recursive-file-search-or-list-in-net
I am sure you all have your functions for a recursive directory/file listing, or file searching by wildcard function for .net, but here is another one, works great. I use it to get a list of all *.aspx pages in a project like this. Dim baseDirectory As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(“c:\projects\SSO\”) Dim x As New DSF.SSO.Other.FileSearch(baseDirectory, "*.aspx") Dim pageName As String = "" x.Search(, "*.aspx") lblMessage.Text = "" For Each f As System.IO.FileInfo In...
|
post #153 by mreschke Sep 10th 2009 (3067 views)
Concat Strings and Variables in ASPX Page
https://mreschke.com/150/concat-strings-and-variables-in-aspx-page
Lets say you have a datagrid with a hyperlink on each row that points to somewhere.com?id=xxxx, where the ID is part of the dataset. Usually what I would do is add in the hyperlink NavigationURL in the .vb codebehind in the grid_ItemDataBound function like 'Tracker Copies Grid Protected Sub grdCopies_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdCopies.ItemDataBound Select Case e.Item.ItemType Case ListItemType.AlternatingItem, ListI...
|
post #150 by mreschke Jul 7th 2009 (7249 views)
Display Table Sizes in MSSQL
https://mreschke.com/147/display-table-sizes-in-mssql
This query will display a list of all tables along with disk sizes and index sizes -- Get all tables rows count, sizes, index size in MB -- mReschke 2012-10-16 SET NOCOUNT ON DECLARE @cmdstr VARCHAR(100) CREATE TABLE #TempTable ( VARCHAR(150), ROW_COUNT INT, Table_Size VARCHAR(150), Data_Space_Used VARCHAR(150), Index_Space_Used VARCHAR(150), Unused_Space VARCHAR(150)) CREATE TABLE #TempTable2 (TableName VARCHAR(150), INT, DataMB INT, IndexMB INT, TotalMB INT, UnusedMB INT) SELECT @cmdstr = 'sp_...
|
post #147 by mreschke Jun 5th 2009 (3207 views)
DevExpress ASPxGridView
https://mreschke.com/145/devexpress-aspxgridview
DevExpress ASPxGridView In this example, the GridView has 4 columns, a column with a checkbox, and 3 columns of data. I want to loop through all grid columns and get which checkboxes are selected. (Note the same column with the checkbox also has a hiddel ASPxLabel called lblID that holds the OPC_ID of the database row to be deleted). And in the GetCurrentPageRowValues("Confirm"), confirm is the header name (not caption, but name=) of a column in the grid (column display headers are 'Confirm,Op...
|
post #145 by mreschke May 18th 2009 (9775 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 (3171 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 (9163 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 (3158 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 (6193 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 (8826 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 (3619 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 (3537 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 (3419 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 (4611 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 (3881 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 (3404 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 (9160 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 (5614 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 (3055 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 (2426 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 (3307 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 (3093 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 (3024 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 (26511 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 (3143 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 (6004 views)
Impersonation in ASP.NET
https://mreschke.com/29/impersonation-in-aspnet
<p>Impersonation is the concept whereby an application executes under the context of the identity of the client that is accessing the application. This is achieved by using the access token provided by IIS.</p> <p>Can impersonate entire website by editing the web.config or impersonate chunks of code in the codebehind.<br /> <strong>Very usefull when accessing folders on a remote server that has no domain</strong></p>
|
post #29 by mreschke Feb 29th 2008 (3384 views)
MSSQL Shared Servers
https://mreschke.com/27/mssql-shared-servers
<ol> <li>Goto Administration Tools -> Component Services<ol> <li>Under Services (local), start the 'Distributed Transaction Coordinator'</li> <li>Goto properties on 'Distributed Transaction Coordinator', Log On tab, make sure account is NetworkServices</li> </ol></li> <li>Under Component Services, expand to My Computer, goto properties on My Computer<ol> <li>MSDTC tab, then click Security Configuration</li> <li>Check 'Network DTC Access'</li> <li>Check 'Allow Remote Administration'</li> <li>Check 'Allow Inbound'</li> <li>Check 'Allow Outbound'</li> <li>Check 'No Authentication Required'</li> <li>Check 'Enable Transaction Internet Protocol (TIP) Transactions'</li> <li>Check 'Enable XA TRansactions'</li> <li>The Acount should be NetworkServices here also</li> </ol></li> <li>Open MSSQL Enterprise Manager, expand to localhost<ol> <li>Open Security</li> <li>Right Click Linked Servers, click New Linked Server...</li> <li>Enter each servers information, on each server</li> </ol></li> </ol>
|
post #27 by mreschke Feb 18th 2008 (2836 views)
SQL Temporary Tables
https://mreschke.com/20/sql-temporary-tables
CREATE TABLE #month0to6 (vin nvarchar(20)) DECLARE @startDate as nvarchar(10), SCF as nvarchar SET @startDate = '10/31/2007' --Insert 0 to 6 month data INSERT INTO #month0to6 (vin) SELECT DISTINCT tblVehicles.VEH_vin FROM tblROTotal --INNER JOIN tblApplications ON tblROTotal.ROH_DLR_APP_ID = tblApplications.APP_ID INNER JOIN tblVehicles ON tblROTotal.ROH_VEH_ID = tblVehicles.VEH_ID INNER JOIN tblMakeModel ON tblVehicles.VEH_MM_ID = tblMakeModel.MM_ID INNER JOIN tblCustomer ON tblCustomer.Cust_I...
|
post #20 by mreschke Jan 25th 2008 (2309 views)
SQL Cursor Examples
https://mreschke.com/6/sql-cursor-examples
DECLARE @server as nvarchar(50), @sql as nvarchar(4000) DECLARE SharedServers CURSOR FORWARD_ONLY FOR SELECT server FROM .ebis_prod.dbo.SharedServerList OPEN SharedServers FETCH NEXT FROM SharedServers INTO @server BEGIN TRANSACTION SET @sql = '' WHILE FETCH_STATUS = 0 BEGIN IF (@server) '' BEGIN --One itteration of SQL goes HERE SET @sql = @sql INSERT INTO .dyna.dbo.TestTable (val1, val2) VALUES (''mReschke'', ''hi'') ' END FETCH NEXT FROM SharedServers INTO @server END exec sp_executesql @sql...
|
post #6 by mreschke Nov 13th 2007 (2740 views)
Showing 1 to 37 of 37 results