Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

T Smooth

@T Smooth
About
Posts
19
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Powerpoint Automation, process won't end after Quit()
    T T Smooth

    I'm trying to do some Powerpoint automation from an ASP.NET page and generate/modify a slide. That piece of the code works fine but when it's all done running and even after I call the Quit() method on the powerpoint application object, POWERPOINT.EXE remains running and eventually this is causing problems. I've googled this extensively and nothing I've found has seemed to help. I really need this to work properly. Here's my relevant code. I don't believe i'm using any Global references and I've even removed the COM reference from my website to use Late Binding instead in hopes that it would solve my problems as mentioned in this MSDN Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;319832 Code: Public Function GenerateDrillDown(ByVal strFileName As String) As Boolean Dim App As Object = Nothing Dim pres As Object = Nothing Dim slide As Object = Nothing Try App = CreateObject("PowerPoint.Application") App.Visible = -1 ' For debugging. Comment this out or set to 0 to keep the application from being visible. pres = App.Presentations.Open("C:\DevProjects\Docs\DrillDown.ppt", 0, -1, -1) slide = pres.Slides(1) ' There's only one slide in this ppt i'm using as the template. slide.Shapes.Item("Text Box 8").TextFrame.TextRange.Text = DecisionTitle ' These are all string variables slide.Shapes.Item("Text Box 13").TextFrame.TextRange.Text = Narrative slide.Shapes.Item("Text Box 14").TextFrame.TextRange.Text = Issues slide.Shapes.Item("Text Box 19").TextFrame.TextRange.Text = Scope If TopicType = 1 Then slide.Shapes.Item("Autoshape 9").TextFrame.TextRange.Text = IDNumber.ToString() slide.Shapes.Item("Autoshape 9").Visible = -1 slide.Shapes.Item("Autoshape 56").Visible = 0 ElseIf TopicType = 2 Then slide.Shapes.Item("Autoshape 56").TextFrame.TextRange.Text = "ST" & IDNumber.ToString() slide.Shapes.Item("Autoshape 56").Visible = -1 slide.Shapes.Item("Autoshape 9").Visible = 0 End If pres.SaveAs(strFilename, 1, 0) Catch ex As Exception Return False Finally ' Most of this is coming from another article I found online to help combat the problem of open references with office automation. GC.Collect() GC.WaitForPendingFinalizers() GC.Collect() ' Intentionally repeated GC.WaitForPendingFinalizers() If Not slide Is Nothing Then Marshal.FinalReleaseComObject(slide) slide = Nothing End If If Not pres Is N

    Visual Basic help csharp asp-net wpf wcf

  • Powerpoint Automation, process won't quit
    T T Smooth

    I'm trying to do some Powerpoint automation from an ASP.NET page and generate/modify a slide. That piece of the code works fine but when it's all done running and even after I call the Quit() method on the powerpoint application object, POWERPOINT.EXE remains running and eventually this is causing problems. I've googled this extensively and nothing I've found has seemed to help. I really need this to work properly. Here's my relevant code. I don't believe i'm using any Global references and I've even removed the COM reference from my website to use Late Binding instead in hopes that it would solve my problems as mentioned in this MSDN Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;319832 Code: Public Function GenerateDrillDown(ByVal strFileName As String) As Boolean Dim App As Object = Nothing Dim pres As Object = Nothing Dim slide As Object = Nothing Try App = CreateObject("PowerPoint.Application") App.Visible = -1 ' For debugging. Comment this out or set to 0 to keep the application from being visible. pres = App.Presentations.Open("C:\DevProjects\Docs\DrillDown.ppt", 0, -1, -1) slide = pres.Slides(1) ' There's only one slide in this ppt i'm using as the template. slide.Shapes.Item("Text Box 8").TextFrame.TextRange.Text = DecisionTitle ' These are all string variables slide.Shapes.Item("Text Box 13").TextFrame.TextRange.Text = Narrative slide.Shapes.Item("Text Box 14").TextFrame.TextRange.Text = Issues slide.Shapes.Item("Text Box 19").TextFrame.TextRange.Text = Scope If TopicType = 1 Then slide.Shapes.Item("Autoshape 9").TextFrame.TextRange.Text = IDNumber.ToString() slide.Shapes.Item("Autoshape 9").Visible = -1 slide.Shapes.Item("Autoshape 56").Visible = 0 ElseIf TopicType = 2 Then slide.Shapes.Item("Autoshape 56").TextFrame.TextRange.Text = "ST" & IDNumber.ToString() slide.Shapes.Item("Autoshape 56").Visible = -1 slide.Shapes.Item("Autoshape 9").Visible = 0 End If pres.SaveAs(strFilename, 1, 0) Catch ex As Exception Return False Finally ' Most of this is coming from another article I found online to help combat the problem of open references with office automation. GC.Collect() GC.WaitForPendingFinalizers() GC.Collect() ' Intentionally repeated GC.WaitForPendingFinalizers() If Not slide Is Nothing Then Marshal.FinalReleaseComObject(slide) slide = Nothing End If If Not pres Is Nothin

    COM help csharp asp-net wpf wcf

  • VML Issue in IE6 Strict Mode
    T T Smooth

    I am having some issues that I don't understand with VML in IE 6 (also in IE7). I've searched the net for problems between VML and strict mode but haven't been able to come up with anything. The page, listed below, has a div element set to be 800px wide with a border so you can see it and a height of auto. The page SHOULD render a blue Diamond in roughly the center of the div . When the page is rendered in quirks mode (Just add an html comment above the doctype) it works as I expect. When the page is rendered in strict mode (remove any comments from before the doctype), the div collapses and the shape disappears. In some cases of me playing around with the numbers, the shape would fall to 0,0 px and be outside of both the div and group container objects. What am I doing wrong or does VML not work properly in strict mode? The page (as is it will render in quirks mode, delete the html comment before the DOCTYPE to render it in strict mode): Untitled Page

    Web Development html docker help question

  • Modifying onclick event at runtime, problem.
    T T Smooth

    I came up with the following solution: On the main page I have a function that takes a string and then executes that string as code using the eval function: function execCode(codestring) { eval(codestring); } Then on the popup page I do the following to change the onclick event's code: window.opener.execCode("window.document.getElementById('event2_2372').onclick = function() { alert('Modified event code!'); };"); This allows the "function()" assignment to take place in the address space of the main page thus giving it a valid entry point to the function. If anyone has any tweaks or a better way to do this, please let me know. Thanks!

    Web Development help javascript tools tutorial question

  • Modifying onclick event at runtime, problem.
    T T Smooth

    This only works if that element is on the same page as the function. My element and function that I want to be used for the element's onclick event, reside on the main page but I need to modify that function's code from the popup page.

    Web Development help javascript tools tutorial question

  • Modifying onclick event at runtime, problem.
    T T Smooth

    I have since been able to get the second approach to work by putting the function test() on the main page and then setting the onclick event = to window.opener.test. This still leaves me with the underlying problem though which is that I need to change what test() does during runtime which I'm not sure how to do.

    Web Development help javascript tools tutorial question

  • Modifying onclick event at runtime, problem.
    T T Smooth

    I have two web pages. The main page contains several VML rectangles that have their "onclick" events set to javascript code. The second page is opened by the first page when a particular link is clicked. What I want to do is change the onclick event of a element on the main page from the 2nd page. So far I am able to retrieve the reference to the object and view it's initial onclick event: // this code is in the 2nd page that was opened by the main page var rectelem = window.opener.document.getElementById('event2_2372'); alert(rectelem.onclick); // this works and shows me what it is initially set to. rectelem.onclick = 'alert(\'This is the new onclick event!\');' ; alert(rectelem.onclick); // shows that the change was made. When I switch back to the main page and click on the object though, the initial onclick behavior is gone but the new behavior does not take place. Nothing happens and I get no script error to look at. I've tried moving the new onclick behavior to a function and then setting the object's onclick to the address of that function: rectelem.onclick = test; function test() { alert('This is the test function!'); } This approach has had the same result so far :( Any ideas on what I'm doing wrong or how to change this events behavior at runtime?

    Web Development help javascript tools tutorial question

  • Grouping events that fall within x days of other events?
    T T Smooth

    I'm having trouble coming up with a query in SQL Server 2000. Trying my best to sum it up in one sentence; I need a result set that for every EventID/StartDate that exists in tblEvents, I need all StartDates within x days to have a minimum sequential, unique number starting at 1. Now I'll go into some more detail and possibly confuse everyone. What I have is a table of events that to simplify this question include only an EventID and an StartDate field. What I need to do is for each event, find the other events that occur within x days after the event in question. I then need to number the events starting at 1 so that each eventB that occurs within x days of EventA has the minimum number different from any events from the past x days. I know I just sucked at putting it in words so I'll give an example. Here is what my idea of the end result table should like if x=2. The source table is basically the same thing minus the Num column. tblEvents ------------ EventID Date Num 1 10/1/06 1 3 10/2/06 2 7 10/1/06 3 4 10/4/06 1 6 10/10/06 1 2 10/20/06 1 5 10/21/06 2 Here's a quick diagram I made (I know it's ugly and not to scale) which hopefully helps you understand what I need better. Basically, I will be drawing a timeline using vml and each item is going to have text next to it so I need items to be staggered if they are on the same day or close to each other so that things don't overlap. I also need to minimize the vertical space it takes up which is why num needs to get back to 1 as soon as it can instead of just putting each event on its own line. The "num" column will tell me what row to put the item in. http://i10.tinypic.com/43pxycj.gif The following query gets me closer I think but it has a few problems and could be the wrong approach completely. I need this to work in SQL Server 2000 and I know that Row_Number and also Over() I think are both SQL Server 2005 only which is one problem with what I've come up with so far. Also, the partition I use has a separate value for the mirror of items (eg. EventID 7 should not be on row 1). Any tips or thoughts would be appreciated. SELECT E1.EventID AS E1_EventID, E1.StartDate AS E1_StartDate, E2.EventID AS E2_EventID, E2.StartDate AS E2_StartDate, DATEDIFF(day, E2.StartDate, E1.StartDate) As Diff, ROW_NUMBER() OVER(PARTITION BY E1.EventID ORDER B

    Database database question sql-server com graphics

  • Finding recurring dates.
    T T Smooth

    This only gets me the 2nd sunday of each month, not necessarily every 2 weeks from a certain start date.

    Database database sql-server sysadmin tutorial question

  • Finding recurring dates.
    T T Smooth

    I generated the calendar using scripts taken from this FAQ. Search the pdf for "calendar table" and it should take you to the right FAQ question. There are scripts to add in all of the holidays as well. You first need to create a numbers table with a sufficient amount of numbers in there as well. http://www.aspfaq.com/downloads/ASPFAQ-2006-04-18.pdf[^] Here's the scripts if you don't want to look at the pdf. It will give you a table consisting of 30 years starting with 01/01/2000: CREATE TABLE dbo.Numbers ( Number INT IDENTITY(1,1) PRIMARY KEY CLUSTERED ) WHILE COALESCE(SCOPE_IDENTITY(), 0) <= 20000 BEGIN INSERT dbo.Numbers DEFAULT VALUES END GO CREATE TABLE dbo.Calendar ( dt SMALLDATETIME NOT NULL PRIMARY KEY CLUSTERED, isWeekday BIT, isHoliday BIT, Y SMALLINT, FY SMALLINT, Q TINYINT, M TINYINT, D TINYINT, DW TINYINT, monthname VARCHAR(9), dayname VARCHAR(9), W TINYINT ) GO INSERT Calendar(dt) SELECT DATEADD(DAY, Number, '20000101') FROM dbo.Numbers WHERE Number <= 10957 ORDER BY Number GO UPDATE dbo.Calendar SET isWeekday = CASE WHEN DATEPART(DW, dt) IN (1,7) THEN 0 ELSE 1 END, isHoliday = 0, Y = YEAR(dt), FY = YEAR(dt), /* -- if our fiscal year -- starts on May 1st: FY = CASE WHEN MONTH(dt) < 5 THEN YEAR(dt)-1 ELSE YEAR(dt) END, */ Q = CASE WHEN MONTH(dt) <= 3 THEN 1 WHEN MONTH(dt) <= 6 THEN 2 WHEN MONTH(dt) <= 9 THEN 3 ELSE 4 END, M = MONTH(dt), D = DAY(dt), DW = DATEPART(DW, dt), monthname = DATENAME(MONTH, dt), dayname = DATENAME(DW, dt), W = DATEPART(WK, dt) GO ALTER TABLE dbo.Calendar ADD UTCOffset TINYINT NULL GO SET NOCOUNT ON DECLARE @dt SMALLDATETIME DECLARE @offset TINYINT SET @offset = 5 DECLARE c CURSOR LOCAL STATIC READ_ONLY FOR SELECT dt FROM dbo.Calendar ORDER BY dt OPEN c FETCH NEXT FROM c INTO @dt WHILE @@FETCH_STATUS = 0 BEGIN IF DATENAME(dw, @dt)='Sunday' AND DATEPART(DAY, @dt) <= 7 AND DATENAME(MONTH, @dt) = 'April' SET @offset = 4 IF DATENAME(dw, @dt)='Sunday' AND DATEPART(DAY, @dt) >= 25 AND DATENAME(MONTH, @dt) = 'October' SET @offset = 5 UPDATE dbo.Calendar SET UTCOffset = @offset WHERE dt = @dt FETCH NEXT FROM c INTO @dt END CLOSE c DEALLOCATE c GO CREATE FUNCTION dbo.ISOWeek ( @dt SMALLDATETIME ) RETURNS TINYINT AS BEGIN DECLARE @ISOweek TINYINT SET @ISOweek = DATEPART(WEEK,@dt)+1 -DATEPART(WE

    Database database sql-server sysadmin tutorial question

  • Finding recurring dates.
    T T Smooth

    Using SQL Server 2000 here and I have a table named "Calendar" that is an auxillary table created using scripts found on the web. Basically, the calendar contains an entry for every day for the next several years that has a datetime field, fields for the day of the month, month of the year, the year, the week of the year, etc. I'm trying to write a query or set of queries to return the recurring dates if the user of a web app decides to schedule something on a recurring basis much like recurring appointments in Outlook Calendar. The following query is what I am using to attempt to return the every 3rd Sunday starting on 01/01/08. SELECT c.dt, c.dayname, c.monthname, c.M, c.D, c.Y, c.W FROM dbo.Calendar c WHERE c.dayname IN ('Sunday') AND c.dt >= '01/01/08' AND c.Y IN (2008, 2009) AND 0 = ((SELECT COUNT(*) FROM dbo.Calendar c2 WHERE c.dt >= c2.dt AND c.dayname = c2.dayname) % 3) ORDER BY c.dt GO The query is returning every 3 sunday's but it's starting with Jan. 13th (the 2nd sunday) instead of Jan. 20th (the 3rd Sunday). After that, it is returning every 3rd Sunday but it is off by 1 week because of where it's starting. What am I doing wrong? Also, what kind of modifications might I need to make to this to support the other recurring event patterns that can be found in Outlook? I've searched the web a lot for recurring events and all I can seem to find is how to create the auxillary calendar table that I created but no info on how to retrieve the dates that a recurring event should fall on.

    Database database sql-server sysadmin tutorial question

  • Hierarchical Rollup Help (SQL Server 2005)
    T T Smooth

    I have a table consisting of 3 columns: Parent varchar(50), Child varchar(50), Pop int. The table is setup as follows: Parent Child Pop ---------------------------------- Europe France 0 France Paris 1 New York New York City 10 North America United States 0 North America Canada 0 United States New York 0 United States Washington 0 Washington Redmond 200 Washington Seattle 100 World Europe 0 World North America 0 This is just some sample data modified a tiny bit from an example of a hierachical print out sample that is a stored procedure that allows me to pass any place and see all of that place's children/grandchildren. I need to figure out how to write a query to show me cumulative sums (ROLLUP?) of the whole tree. So the output should basically be something like this (it can include parent and child columns too): World Null 311 World Europe 1 Europe France 1 France Paris 1 World North America 310 North America United States 310 North America Canada 0 United States New York 10 United States Washington 300 New York New York City 10 Washington Redmond 200 Washington Seattle 100 Hopefully you understand what i'm looking for. I've tried using WITH ROLLUP and I also tried using an Inner Join but I'm not really sure what I need to do to pull this off. I seem to only be able to get it to work 1-2 levels deep but not through the whole tree. Any help/ideas would be appreciated! Thank you.

    Database database tutorial sql-server sysadmin data-structures

  • Cumalative Sum and Supply/Demand Delay
    T T Smooth

    Hi, I have a table consisting of the following columns of relevance: Day - Integer ranging from 1-9 Demand_Qty - Double value specifying the demand for that particular day. Demand_Filled - Doulbe value specifying how much of the item was recieved that day. What I need to find out is how many days it takes before each demand is filled. For example: Day Demand_Qty Demand_Filled Days_to_Fill 1 10 0 2 2 10 0 2 3 20 10 1 4 5 30 1 5 10 10 -1 The first 3 columns are provided and the Days_to_Fill column is what I need to calculate. A -1 in the Days_To_Fill means the demand was never met. As you can see, the Demand for Day 1 is 10, which is not filled until Day 3. If further clarification is needed, pls inquire. I'm not sure exactly where to begin so any tips/ideas/solutions would be greatly appreciated. One thing that I believe could get me closer to a solution would be acquiring a cumalative sum of Demand_Qty and Demand_Filled for each day, but I don't know how to do this in SQL... anyone know how? What I mean is a sum that would look like this based on the above sample: Day SumDemand SumFilled 1 10 0 2 20 0 3 40 10 4 45 40 5 55 50 Thank you for any help in advance, hoping I can get a solution figured out soon for my Project Manager. -Tom

    Database tutorial database help question

  • sending sms
    T T Smooth

    If your objective is to send text messages to peoples cellphones, most cellphone companies assign an email address to the phone which will send any emails sent to the address as text messages to the phone. For eg. 5555551234@vtext.com would be one for verizon customers. In this case you could simply have your website/webservice send an email to the address containing your SMS message.

    ASP.NET csharp asp-net tutorial

  • Access Hyperlink Field
    T T Smooth

    I have an access table that has a column called "ItemLink" and is of the type "Hyperlink." When I query this table and select this field, I get the display text of the hyperlink and not the url. How do I get the URL from this field in a query?

    Database question database

  • Good programming - memory allocation
    T T Smooth

    I realize you don't have to set an object reference to nothing. That wasn't my point. The point was you can't call .Dispose() on an NullReference. So if for some reason the object never gets assigned a reference (say there is a memory allocation problem for some reason) then in the finally clause the program would crash if there is a object.dispose() statement.

    Visual Basic csharp database performance question discussion

  • Good programming - memory allocation
    T T Smooth

    Does Dispose() work if the variable is never initialized? Example: Dim MyObject As Object MyObject.Dispose() I suppose I could test it quick but does that throw an exception because of a null object reference? Edit: Ok tested with following code Dim oObject As New Object oObject = Nothing oObject.Dispose() Which threw a NullReferenceException. This is why I was wondering if it was safe to just put cn.Dispose() in the finally clause instead of enclosing it in If Not cn Is Nothing Then block. That way you are covered if for some reason it never got initialized. Unless I'm missing something.

    Visual Basic csharp database performance question discussion

  • Good programming - memory allocation
    T T Smooth

    I'm not sure which way is necessarily better but in both of your finally clauses, if cn fails to be allocated or open for some reason and is nothing then you will get an exception when you do cn.Close(). I've made this same mistake a few times and usually i just fix it like this: If Not cn Is Nothing Then cn.Close() - Tom

    Visual Basic csharp database performance question discussion

  • How to draw lines then undo ???
    T T Smooth

    I think what you are looking for is the GraphicsPath object from GDI+. I just recently had to use this and read up on it but I am by no means an expert with it. I did however throw together a quick example in a couple min. to show you how you can use this to draw lines, select them, and then get rid of them. A quick disclaimer first: Being that i did this quick at work, the collection of GraphicsPath objects continously grows... the current implementation never gets rid of the objects, just resets their points to basically have them draw nothing. This should definitely be changed. For additional information, read up on GraphicsPath on MSDN. Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown Dim oGP As GraphicsPath ' Loop through the collection of lines to see if we clicked on one. For Each oGP In LineCollection ' The following IF returns true if the line was clicked on, the trigonometry is done for you :) If oGP.IsOutlineVisible(e.X, e.Y, New Pen(Color.Black)) Then oGP.Reset() ' Should remove the line from the collection or do something different here! Me.Invalidate() Exit Sub End If Next Drawing = True GP = New GraphicsPath ' Create a new GP object to hold the line. pt1 = New Point(e.X, e.Y) ' Set the start point of the line. LineCollection.Add(GP) ' Add this graphics path object to the collection End Sub Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp Drawing = False ' Not drawing a line anymore End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If Drawing = True Then GP.Reset() ' Clear the current graphics path object. GP.AddLine(pt1.X, pt1.Y, e.X, e.Y) ' Add the line Me.Invalidate() ' Force paint End If End Sub You'll have to make sure you declare LineCollection As a New System.Collections.ArrayList somewhere as well as GP as a GraphicsPath and pt1 as a Point. Hope this helps. Should let you draw lines on the form and then to "erase" them, just click on them.

    Visual Basic winforms graphics debugging tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups