
penfold69
Avatar/Signature-
Posts
135 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by penfold69
-
http://www.sharpdevelop.com MonoDevelop forked from SharpDevelop some time ago - I still consider SharpDevelop to be the superior product. You can download and compile it under Mono to run on Linux, iirc. P.
-
Each user on the computer has their own "library", so I'm guessing that the ASPNET user's WMP library is empty. Try running your site as the user on the computer that has all the tracks in 'their' library - if this fixes the problem that you can either leave the site running as that user, or import all the music into the ASPNET user's music library (log on as the ASPNET user and 'scan computer' in WMP) B.
-
This information is generally known as EXIF information. A quick google turned up http://www.codeproject.com/vb/net/exif_reader.asp I've not used it personally, but it looks like it should do the job! B.
-
Just a thought - what user is the website running under, and are the tracks in *that* WMP library? B.
-
You can (should?) also look into the ICloneable interface, which forces you to implement a Clone() function to your class (the implementation is up to you) Public Class MyClass Implements ICloneable Public StringA as String Public StringB as String Public OtherClass as MyOtherClass Public Function Clone() as MyClass Implements ICloneable.Clone Dim newClass as MyClass newClass.StringA = StringA newClass.StringB = StringB newClass.OtherClass = OtherClass.Clone() ' this nested class needs to be cloned too return newClass End Function End Class
-
concept code, untested. Dim myDrive As System.IO.DriveInfo = Nothing For Each d As System.IO.DriveInfo In My.Computer.FileSystem.Drives If d.DriveType = IO.DriveType.CDRom Then Dim di As System.IO.DirectoryInfo = d.RootDirectory If di.GetFiles("MyUniqueFileName.txt").Length > 0 Then myDrive = d Exit For End If End If Next If myDrive IsNot Nothing Then ' Yay! I found the right CD drive, and it contains my CD DoSomeStuff() Else MsgBox("Please insert the application CD-ROM into one of your drives") End If
-
This method can fail if there are multiple CD drives in a machine. When would be a good idea is to scan each drive, and look for the presence of a particular file in the root of that drive. This should ensure that you can uniquely identify *your* CD. It also handles the fact that your user removed your CD and replaced it with "Goldie Looking Chain's Greatest Hit". P.
-
Re: Dispose and scope I did some testing with the garbage collector, (specifically with respect to using Excel automation, where I was doing something similar to: Dim objApp As Excel.Application objApp = CreateObject("Excel.Application") ' ... do some work ... objApp.Quit() I found that the COM resources were not being specifically released until I exited the program. In the case where I re-used this function, the resource usage would increase linearly. Task manager would also display an EXCEL.EXE running which would not actually terminate until I did so manually (even after my application was terminated) The solution to my problem was: System.Runtime.InteropServices.Marshal.ReleaseComObject(objApp) followed by a System.GC.Collect() The releasing of the COM object seems to trigger the equivalent of a .Dispose(). I forced the GC.Collect, (the discussion for whether this is appropriate or not has been made before) to ensure that the EXCEL.EXE application in the task manager was terminated immediately. P.
-
Re: Thanks! Glad I could help. I work for a manufacturing company and we've deployed touch-screen computers onto the shop floor, running monitoring software that has been developed in .NET We use this method for exactly the reasons above - the monkeys on the shop floor can't play around. They're limited to our software and nothing else. The technicians have access to the main explorer.exe from a set of password protected forms within the app. Its a lovely solution, and because it uses commodity hardware and software it's reasonably cheap, compared to embedded touchscreens running CE. P.
-
in: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon look for the key: "Shell" and change it to point to your application instead. This will run your application instead of explorer.exe when windows logs on. YMMV, and it may bork you rmachine ;) P.
-
I would agree with Denaes here - either Mono or SharpDevelop are likely contenders. Both are open source. P.
-
Print a crystal report with print options
penfold69 replied to Jelmer's topic in Database / XML / Reporting
Extracted from our system, so may not work completely as-is Dim pd As New PrintDialog pd.Document = New Printing.PrintDocument pd.AllowSelection = False If pd.ShowDialog = DialogResult.OK Then Me.Cursor = Cursors.WaitCursor Dim rpt As New rptProductionSchedule Reporting.SetDatabaseForReport(rpt) rpt.SetParameterValue(0, Prodate) rpt.SetParameterValue(1, Hours) rpt.PrintOptions.PrinterName = pd.PrinterSettings.PrinterName rpt.PrintToPrinter(pd.PrinterSettings.Copies, pd.PrinterSettings.Collate, pd.PrinterSettings.FromPage, pd.PrinterSettings.ToPage) rpt.Close() rpt.Dispose() End If pd.Close() pd.Dispose() -
Insert a CR "Group" that groups by Col1 Move everything from your "details" section into the header or footer of that group. P.
-
Retrieving images from SQL Server
penfold69 replied to VBAHole22's topic in Database / XML / Reporting
http://support.microsoft.com/default.aspx/kb/175261 is worth a read. Its in VB6, but the basic premise is there to convert. Also, a little testing by this guy gives some more info. P. -
Retrieving images from SQL Server
penfold69 replied to VBAHole22's topic in Database / XML / Reporting
The OLE Header is 78 bytes and, (from memory) it starts with a static string. The basic premise is to read the image data from the database, check for this static string at the beginning of it, and advance forward 78 bytes if it is present. Then decode the "remaining" bytes as an image. I have some code somewhere that does it in VB.Net. I'll see if I can grab it and post it. P. -
Make sure your variable is eclared as type Integer, not type Object
-
Check your firewall settings allow inbound access to port 80 (http)
-
Update First Row in Database [C#]
penfold69 replied to Shaitan00's topic in Database / XML / Reporting
use the LIMIT clause: UPDATE yourTable SET yourField="yourValue" LIMIT 1 -
How one form can tell another to perform an action [C#]
penfold69 replied to Shaitan00's topic in Windows Forms
Public Class frmHistory Protected mAppInstance as cApp = Nothing Public Sub New(Byref cAppInstance as cApp) MyBase.New() 'This call is required by the Windows Form Designer. IsLoading = True InitializeComponent() IsLoading = False mAppInstance = cAppInstance End Sub Private Sub frmHistory_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed If Not mAppInstance is Nothing Then mAppInstance.RefreshGUI() End If End Sub Now, instead of declaring your frmHistory using: Dim frm as New frmHistory() you use Dim frm as New frmHistory(reference-to-your-instance-of-cApp) HTH! Barry. -
Preferably, use the MySQL Connector/Net, which will provide you with: MySqlConnection, MySqlCommand, MySqlDataAdapter MySqlDataReader MySqlParameter then retest - it should work fine!
-
just made me chuckle...... B.
-
Kinda ripped from an application I'm developing at the moment - I've chopped some bits out so it probably won't work, but you shoul dget the general gist. B. Protected Overridable Sub BaseSave(Optional ByRef Conn As IDbConnection = Nothing, Optional ByRef Trans As IDbTransaction = Nothing) Dim lConn As IDbConnection Dim lTrans As IDbTransaction If Me.IsDeleted Then Dim Sql As String = "DELETE FROM " & mTable & " WHERE " & mIndexField & "=" & Me(mIndexField) DB.QueryDatabase(Sql) Return End If If mRow.RowState = DataRowState.Unchanged Then 'No need to save to row if its unchanged. Return End If If Conn Is Nothing Then lConn = DB.CreateConnection() lConn.Open() Else lConn = Conn End If If Trans Is Nothing Then lTrans = lConn.BeginTransaction() Else lTrans = Trans End If Dim sSql As New StringBuilder sSql.Append("SELECT * FROM ") sSql.Append(mTable) sSql.Append(" WHERE ") sSql.Append(mIndexField) sSql.Append(" = ") If mRow.IsNull(mIndexField) Then ' Autonumber fields are set to null on purpose sSql.Append("0") Else sSql.Append(mRow(mIndexField)) End If Dim comm As IDbCommand = DB.CreateCommand(sSql.ToString(), lConn) Dim rs As IDbDataAdapter = DB.CreateAdapter(comm) ' Hokey Cokey Smokey - make the CommandBuilder 'Last One Wins' Dim cb As DBCommandBuilder = db.CreateCommandBuilder() cb.DataAdapter = rs Dim changes As New DatabaseChangeCollection ' Ok.. The first part of our Optimistic locking scenario ' Firstly, Retrieve the TimeStamp field and compare If mRow.RowState = DataRowState.Modified Then Dim DataDT As DataTable = DB.RetrieveTable(sSql.ToString) If DataDT.Rows.Count > 0 Then Dim dataRow As dataRow = DataDT.Rows(0) If mRow("TIMESTAMP") <> dataRow("TIMESTAMP") Then ' Another user (or process) has modified the underlying ' database record. We must merge any changes and ' present the user with a conflict-resolution scenario For index As Integer = 0 To mRow.ItemArray.Length - 1 ' The process for merging records follows this scenario: ' 1. The original DB record is compared to the current DB record ' If these differ, then that field has been modified in the DB ' 2. In the case that they differ, the Current value of the field ' is compared to the Original value of the field. If they differ ' Then the record has also been modified locally, so we need to ' resolve the conflict manually. ' 3. If there is no change in the current value, then the current value ' is updated to reflect the current DB value, and is saved back to ' the Database Dim bChanged As Boolean = False If Convert.IsDBNull(mRow(index, DataRowVersion.Original)) Then bChanged = True End If If Convert.IsDBNull(dataRow(index)) Then bChanged = True End If If bChanged Or (Not bChanged AndAlso mRow(index, DataRowVersion.Original) <> dataRow(index)) Then ' DB has been updated Dim bIsNullOrig As Boolean = False Dim bIsNullNew As Boolean = False bIsNullOrig = Convert.IsDBNull(mRow(index, DataRowVersion.Original)) bIsNullNew = Convert.IsDBNull(mRow(index, DataRowVersion.Current)) If (bIsNullOrig <> bIsNullNew) _ Or (Not bIsNullOrig AndAlso Not bIsNullNew AndAlso _ (mRow(index, DataRowVersion.Original) <> mRow(index, DataRowVersion.Current))) Then If (mRow(index, DataRowVersion.Current) <> dataRow(index)) Then ' So has our local version Dim colName As String = mDT.Columns(index).ColumnName Dim c As New DatabaseChange(colName, mRow(index, DataRowVersion.Original), dataRow(index), mRow(index), index) changes.Add(c) End If Else ' Our local version is fine, overwrite with the current copy from ' the database mRow(index) = dataRow(index) End If End If Next ' Ok, we now need to present the user with a conflict resolution box. ' Once that has been completed, the row can be saved. If changes.Count > 0 Then Dim frm As New frmReconcileChanges(mRow, changes) frm.ShowDialog() For index As Integer = 0 To changes.Count - 1 Dim c As DatabaseChange = changes(index) mRow(CInt(c.ColumnIndex)) = c.AcceptedValue Next End If End If End If End If ' Must ensure that the Timestamp field resets itself mRow("TIMESTAMP") = DBNull.Value Try CType(rs, DbDataAdapter).Update(mDT) Catch ex As DBConcurrencyException MsgBox("The following exception occurred while processing a save." & Environment.NewLine & ex.ToString()) End Try comm.Dispose() If Trans Is Nothing Then lTrans.Commit() End If If Conn Is Nothing Then lConn.Close() End If If Conn Is Nothing Then lConn.Close() lConn.Dispose() End If End Sub
-
Current version of row: myDT.Rows(myIndex)("FIELD", DataRowVersion.Current) Original version of row: myDT.Rows(myIndex)("FIELD", DataRowVersion.Original)
-
As a brief background, it is because all numbers are stored in binary form. With integers, its not actually a problem, but when you start getting to decimals, representing them in binary becomes more and more difficult. A highly simplified example would be something like: 7.5 = 0111.1 (working in binary, the .1 = (1 * 2 ^ -1) = (1 / 2) = 0.5) So basically, as you move to the right after the decimal point, the digits represent: 1/2, 1/4, 1/8, 1/16 etc. etc. So, to create any decimal, you need it to be represented as a combination of fractions. The more binary significant digits that you use, the more accurate your answer will be, but for some numbers, it will NEVER be exact. Although the computer will actually approximate the correct answer in most cases, when you come to add/subtract/multiply or divide then this is where inconsistencies are likely to appear. See, I knew my college Comp Sci course (where I spent four weeks working with binary on paper.. ugh!) had a use! B.
-
I've actually written my own self-updater program. It's basically a very small program that queries an XML file on a web server for the "current" version of the program, and if it is newer than the currently installed version, will download the updated files and install them, before executing the newly updated file. Its not a trivial undertaking, but it's not rocket science! B.