Search Results

Search found 7391 results on 296 pages for 'record locking'.

Page 143/296 | < Previous Page | 139 140 141 142 143 144 145 146 147 148 149 150  | Next Page >

  • Convert UTC DateTime to another Time Zone

    - by Mark Richman
    I have a UTC DateTime value coming from a database record. I also have a user-specified time zone (an instance of TimeZoneInfo). How do I convert that UTC DateTime to the user's local time zone? Also, how do I determine if the user-specified time zone is currently observing DST? I'm using .NET 3.5. Thanks, Mark

    Read the article

  • programming logic and design pleas friends i need a flowcharts or pseudocode

    - by alex
    ***the midvile park maintains records containing info about players on it's soccer teams . each record contain a players first name,last name,and team number . the team are team number team name 1 goal getters 2 the force 3 top gun 4 shooting stars 5 midfield monsters design a proggram that accept player data and creates a report that lists each** player a long with his or her team number and team name**

    Read the article

  • performance problem looping through table rows

    - by Sridhar
    Hi, I am using jquery to loop through table rows and save the data. If the table has 200 rows it is performing slow. I am getting the javascript message "Stop Running this script" in IE when I call this method. Following is the code I am using to loop through table rows. Can you please let me know if there is a better way to do this. function SaveData() { var $table = $('#' + gridid); var rows = $table.find('tbody > tr').get(); var transactions = []; var $row, empno, newTransaction, $rowChildren; $.each(rows, function(index, row) { $row = $(row); $rowChildren = $row.children("td"); if ($rowChildren.find("input[id*=hRV]").val() === '1') { empno = $rowChildren.find("input[id*=tEmpno]").val(); newTransaction = new Array(); newTransaction[0] = company; newTransaction[1] = $rowChildren.find("input[id*=tEmpno]").val(); newTransaction[2] = $rowChildren.find("input[id*=tPC]").val(); newTransaction[3] = $rowChildren.find("input[id*=hQty]").val(); newTransaction[4] = $rowChildren.find("input[id*=hPR]").val(); newTransaction[5] = $rowChildren.find("input[id*=tJC]").val(); newTransaction[6] = $rowChildren.find("input[id*=tL1]").val(); newTransaction[7] = $rowChildren.find("input[id*=tL2]").val(); newTransaction[8] = $rowChildren.find("input[id*=tL3]").val(); newTransaction[9] = $rowChildren.find("input[id*=tL4]").val(); newTransaction[10] = $rowChildren.find("input[id*=tL5]").val(); newTransaction[11] = $rowChildren.find("input[id*=tL6]").val(); newTransaction[12] = $rowChildren.find("input[id*=tL7]").val(); newTransaction[13] = $rowChildren.find("input[id*=tL8]").val(); newTransaction[14] = $rowChildren.find("input[id*=tL9]").val(); newTransaction[15] = $rowChildren.find("input[id*=tL10]").val(); newTransaction[16] = $rowChildren.find("input[id*=tSF]").val(); newTransaction[17] = $rowChildren.find("input[id*=tCG]").val(); newTransaction[18] = $rowChildren.find("input[id*=tTF]").val(); newTransaction[19] = $rowChildren.find("input[id*=tWK]").val(); newTransaction[20] = $rowChildren.find("input[id*=tAI]").val(); newTransaction[21] = $rowChildren.find("input[id*=tWC]").val(); newTransaction[22] = $rowChildren.find("input[id*=tPI]").val(); newTransaction[23] = "E"; var record = newTransaction.join(';'); transactions.push(record); } }); if (transactions.length > 0) { var strTransactions = transactions.join('|'); //send data to server //here ajax function is called to save data. } }

    Read the article

  • FaceBook Graph API

    - by LingAi
    Hi All, When I use FaceBook API for retrieving posts information, I found that the returned information are changing all the time. for e.g., when I retrieved information 2 times with 1mins interval, one record appears in the 1st time, and disapeared in the 2nd time. https://graph.facebook.com/search?q=baby&type=post&limit=100&since=2010-05-19&until=2010-05-21 Does anyone know what happen? Cheers, LingChen

    Read the article

  • jqGrid highlight the new added row

    - by Smallville
    Is that possible to highlight the new added row in jqGrid. The highlight effect is something like this http://docs.jquery.com/UI/Effects/Highlight So, when the new row is added, the row will be highlighted, that will make clear for user which record is the new one. Many thanks!

    Read the article

  • devexpress gridview's loading panel problem

    - by subash
    i have a div which contains devexpress grid ondeleting a record in the grid it shows a loading panel and the diaplys the updated grid. The problem is that the loading panel appears in the left top corner of the browser and not in the center of the grid where it should be? can any one guide me in that

    Read the article

  • Determine the length of an audio recording?

    - by MikeN
    How do I determine the length of an audio recording I am recording programaticaly? My current solution is to just time the start/stop recording events on the User Interface (literally the time the user hits record, then hits stop recording.) Given a .aac audio file, is there some library call in Objective-C or Python to determine its length?

    Read the article

  • best method to update the SQL table data from c# .NET 2005

    - by Jebli
    Hi , I have a dataset with some 30 records in it. I want to update it to the database tables. which is the best method to update the table. I am unable to use dataadapter.update() since i am using a procedure to populate the dataset. is there any efficient way to update other than iterating through EACH record and updating it Please help. Thanks.

    Read the article

  • XMLSpy in Eclipse

    - by blackbox
    Hi, I need to test XMLSpy functionality in Eclipse. After I switch Eclipse to XMLSpy Perspective and QTP is runnig (record or run mode), it does not work. Could you help me? Thanks.

    Read the article

  • Sound File editing in Objective C

    - by Biranchi
    Hi All, I am able to record and create audio files using AudioFileCreateWithURL in the AudioToolbox Framework. I want to figure out if there is any way to edit the .caf sound files. I want to insert another recoreded audio inside the main audio file. Any thoughts or suggestions how to proceed ?? Thanks.

    Read the article

  • Opening SSL URLs with Python

    - by RadiantHex
    Hi folks, I'm using mechanize to navigate pages, it works pretty well. Unfortunately I have a random error come up, by random I mean it occasionally appears. URLError at /test/ urlopen error [Errno 1] _ssl.c:1325: error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac I really need help on this one :) any ideas?

    Read the article

  • TSQL Conditionally Select Specific Value

    - by Dzejms
    This is a follow-up to #1644748 where I successfully answered my own question, but Quassnoi helped me to realize that it was the wrong question. He gave me a solution that worked for my sample data, but I couldn't plug it back into the parent stored procedure because I fail at SQL 2005 syntax. So here is an attempt to paint the broader picture and ask what I actually need. This is part of a stored procedure that returns a list of items in a bug tracking application I've inherited. There are are over 100 fields and 26 joins so I'm pulling out only the mostly relevant bits. SELECT tickets.ticketid, tickets.tickettype, tickets_tickettype_lu.tickettypedesc, tickets.stage, tickets.position, tickets.sponsor, tickets.dev, tickets.qa, DATEDIFF(DAY, ticket_history_assignment.savedate, GETDATE()) as 'daysinqueue' FROM dbo.tickets WITH (NOLOCK) LEFT OUTER JOIN dbo.tickets_tickettype_lu WITH (NOLOCK) ON tickets.tickettype = tickets_tickettype_lu.tickettypeid LEFT OUTER JOIN dbo.tickets_history_assignment WITH (NOLOCK) ON tickets_history_assignment.ticketid = tickets.ticketid AND tickets_history_assignment.historyid = ( SELECT MAX(historyid) FROM dbo.tickets_history_assignment WITH (NOLOCK) WHERE tickets_history_assignment.ticketid = tickets.ticketid GROUP BY tickets_history_assignment.ticketid ) WHERE tickets.sponsor = @sponsor The area of interest is the daysinqueue subquery mess. The tickets_history_assignment table looks roughly as follows declare @tickets_history_assignment table ( historyid int, ticketid int, sponsor int, dev int, qa int, savedate datetime ) insert into @tickets_history_assignment values (1521402, 92774,20,14, 20, '2009-10-27 09:17:59.527') insert into @tickets_history_assignment values (1521399, 92774,20,14, 42, '2009-08-31 12:07:52.917') insert into @tickets_history_assignment values (1521311, 92774,100,14, 42, '2008-12-08 16:15:49.887') insert into @tickets_history_assignment values (1521336, 92774,100,14, 42, '2009-01-16 14:27:43.577') Whenever a ticket is saved, the current values for sponsor, dev and qa are stored in the tickets_history_assignment table with the ticketid and a timestamp. So it is possible for someone to change the value for qa, but leave sponsor alone. What I want to know, based on all of these conditions, is the historyid of the record in the tickets_history_assignment table where the sponsor value was last changed so that I can calculate the value for daysinqueue. If a record is inserted into the history table, and only the qa value has changed, I don't want that record. So simply relying on MAX(historyid) won't work for me. Quassnoi came up with the following which seemed to work with my sample data, but I can't plug it into the larger query, SQL Manager bitches about the WITH statement. ;WITH rows AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY ticketid ORDER BY savedate DESC) AS rn FROM @Table ) SELECT rl.sponsor, ro.savedate FROM rows rl CROSS APPLY ( SELECT TOP 1 rc.savedate FROM rows rc JOIN rows rn ON rn.ticketid = rc.ticketid AND rn.rn = rc.rn + 1 AND rn.sponsor <> rc.sponsor WHERE rc.ticketid = rl.ticketid ORDER BY rc.rn ) ro WHERE rl.rn = 1 I played with it yesterday afternoon and got nowhere because I don't fundamentally understand what is going on here and how it should fit into the larger context. So, any takers? UPDATE Ok, here's the whole thing. I've been switching some of the table and column names in an attempt to simplify things so here's the full unedited mess. snip - old bad code Here are the errors: Msg 102, Level 15, State 1, Procedure usp_GetProjectRecordsByAssignment, Line 159 Incorrect syntax near ';'. Msg 102, Level 15, State 1, Procedure usp_GetProjectRecordsByAssignment, Line 179 Incorrect syntax near ')'. Line numbers are of course not correct but refer to ;WITH rows AS And the ')' char after the WHERE rl.rn = 1 ) Respectively Is there a tag for extra super long question? UPDATE #2 Here is the finished query for anyone who may need this: CREATE PROCEDURE [dbo].[usp_GetProjectRecordsByAssignment] ( @assigned numeric(18,0), @assignedtype numeric(18,0) ) AS SET NOCOUNT ON WITH rows AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY recordid ORDER BY savedate DESC) AS rn FROM projects_history_assignment ) SELECT projects_records.recordid, projects_records.recordtype, projects_recordtype_lu.recordtypedesc, projects_records.stage, projects_stage_lu.stagedesc, projects_records.position, projects_position_lu.positiondesc, CASE projects_records.clientrequested WHEN '1' THEN 'Yes' WHEN '0' THEN 'No' END AS clientrequested, projects_records.reportingmethod, projects_reportingmethod_lu.reportingmethoddesc, projects_records.clientaccess, projects_clientaccess_lu.clientaccessdesc, projects_records.clientnumber, projects_records.project, projects_lu.projectdesc, projects_records.version, projects_version_lu.versiondesc, projects_records.projectedversion, projects_version_lu_projected.versiondesc AS projectedversiondesc, projects_records.sitetype, projects_sitetype_lu.sitetypedesc, projects_records.title, projects_records.module, projects_module_lu.moduledesc, projects_records.component, projects_component_lu.componentdesc, projects_records.loginusername, projects_records.loginpassword, projects_records.assistedusername, projects_records.browsername, projects_browsername_lu.browsernamedesc, projects_records.browserversion, projects_records.osname, projects_osname_lu.osnamedesc, projects_records.osversion, projects_records.errortype, projects_errortype_lu.errortypedesc, projects_records.gsipriority, projects_gsipriority_lu.gsiprioritydesc, projects_records.clientpriority, projects_clientpriority_lu.clientprioritydesc, projects_records.scheduledstartdate, projects_records.scheduledcompletiondate, projects_records.projectedhours, projects_records.actualstartdate, projects_records.actualcompletiondate, projects_records.actualhours, CASE projects_records.billclient WHEN '1' THEN 'Yes' WHEN '0' THEN 'No' END AS billclient, projects_records.billamount, projects_records.status, projects_status_lu.statusdesc, CASE CAST(projects_records.assigned AS VARCHAR(5)) WHEN '0' THEN 'N/A' WHEN '10000' THEN 'Unassigned' WHEN '20000' THEN 'Client' WHEN '30000' THEN 'Tech Support' WHEN '40000' THEN 'LMI Tech Support' WHEN '50000' THEN 'Upload' WHEN '60000' THEN 'Spider' WHEN '70000' THEN 'DB Admin' ELSE rtrim(users_assigned.nickname) + ' ' + rtrim(users_assigned.lastname) END AS assigned, CASE CAST(projects_records.assigneddev AS VARCHAR(5)) WHEN '0' THEN 'N/A' WHEN '10000' THEN 'Unassigned' ELSE rtrim(users_assigneddev.nickname) + ' ' + rtrim(users_assigneddev.lastname) END AS assigneddev, CASE CAST(projects_records.assignedqa AS VARCHAR(5)) WHEN '0' THEN 'N/A' WHEN '10000' THEN 'Unassigned' ELSE rtrim(users_assignedqa.nickname) + ' ' + rtrim(users_assignedqa.lastname) END AS assignedqa, CASE CAST(projects_records.assignedsponsor AS VARCHAR(5)) WHEN '0' THEN 'N/A' WHEN '10000' THEN 'Unassigned' ELSE rtrim(users_assignedsponsor.nickname) + ' ' + rtrim(users_assignedsponsor.lastname) END AS assignedsponsor, projects_records.clientcreated, CASE projects_records.clientcreated WHEN '1' THEN 'Yes' WHEN '0' THEN 'No' END AS clientcreateddesc, CASE projects_records.clientcreated WHEN '1' THEN rtrim(clientusers_createuser.firstname) + ' ' + rtrim(clientusers_createuser.lastname) + ' (Client)' ELSE rtrim(users_createuser.nickname) + ' ' + rtrim(users_createuser.lastname) END AS createuser, projects_records.createdate, projects_records.savedate, projects_resolution.sitesaffected, projects_sitesaffected_lu.sitesaffecteddesc, DATEDIFF(DAY, projects_history_assignment.savedate, GETDATE()) as 'daysinqueue', projects_records.iOnHitList, projects_records.changetype FROM dbo.projects_records WITH (NOLOCK) LEFT OUTER JOIN dbo.projects_recordtype_lu WITH (NOLOCK) ON projects_records.recordtype = projects_recordtype_lu.recordtypeid LEFT OUTER JOIN dbo.projects_stage_lu WITH (NOLOCK) ON projects_records.stage = projects_stage_lu.stageid LEFT OUTER JOIN dbo.projects_position_lu WITH (NOLOCK) ON projects_records.position = projects_position_lu.positionid LEFT OUTER JOIN dbo.projects_reportingmethod_lu WITH (NOLOCK) ON projects_records.reportingmethod = projects_reportingmethod_lu.reportingmethodid LEFT OUTER JOIN dbo.projects_lu WITH (NOLOCK) ON projects_records.project = projects_lu.projectid LEFT OUTER JOIN dbo.projects_version_lu WITH (NOLOCK) ON projects_records.version = projects_version_lu.versionid LEFT OUTER JOIN dbo.projects_version_lu projects_version_lu_projected WITH (NOLOCK) ON projects_records.projectedversion = projects_version_lu_projected.versionid LEFT OUTER JOIN dbo.projects_sitetype_lu WITH (NOLOCK) ON projects_records.sitetype = projects_sitetype_lu.sitetypeid LEFT OUTER JOIN dbo.projects_module_lu WITH (NOLOCK) ON projects_records.module = projects_module_lu.moduleid LEFT OUTER JOIN dbo.projects_component_lu WITH (NOLOCK) ON projects_records.component = projects_component_lu.componentid LEFT OUTER JOIN dbo.projects_browsername_lu WITH (NOLOCK) ON projects_records.browsername = projects_browsername_lu.browsernameid LEFT OUTER JOIN dbo.projects_osname_lu WITH (NOLOCK) ON projects_records.osname = projects_osname_lu.osnameid LEFT OUTER JOIN dbo.projects_errortype_lu WITH (NOLOCK) ON projects_records.errortype = projects_errortype_lu.errortypeid LEFT OUTER JOIN dbo.projects_resolution WITH (NOLOCK) ON projects_records.recordid = projects_resolution.recordid LEFT OUTER JOIN dbo.projects_sitesaffected_lu WITH (NOLOCK) ON projects_resolution.sitesaffected = projects_sitesaffected_lu.sitesaffectedid LEFT OUTER JOIN dbo.projects_gsipriority_lu WITH (NOLOCK) ON projects_records.gsipriority = projects_gsipriority_lu.gsipriorityid LEFT OUTER JOIN dbo.projects_clientpriority_lu WITH (NOLOCK) ON projects_records.clientpriority = projects_clientpriority_lu.clientpriorityid LEFT OUTER JOIN dbo.projects_status_lu WITH (NOLOCK) ON projects_records.status = projects_status_lu.statusid LEFT OUTER JOIN dbo.projects_clientaccess_lu WITH (NOLOCK) ON projects_records.clientaccess = projects_clientaccess_lu.clientaccessid LEFT OUTER JOIN dbo.users users_assigned WITH (NOLOCK) ON projects_records.assigned = users_assigned.userid LEFT OUTER JOIN dbo.users users_assigneddev WITH (NOLOCK) ON projects_records.assigneddev = users_assigneddev.userid LEFT OUTER JOIN dbo.users users_assignedqa WITH (NOLOCK) ON projects_records.assignedqa = users_assignedqa.userid LEFT OUTER JOIN dbo.users users_assignedsponsor WITH (NOLOCK) ON projects_records.assignedsponsor = users_assignedsponsor.userid LEFT OUTER JOIN dbo.users users_createuser WITH (NOLOCK) ON projects_records.createuser = users_createuser.userid LEFT OUTER JOIN dbo.clientusers clientusers_createuser WITH (NOLOCK) ON projects_records.createuser = clientusers_createuser.userid LEFT OUTER JOIN dbo.projects_history_assignment WITH (NOLOCK) ON projects_history_assignment.recordid = projects_records.recordid AND projects_history_assignment.historyid = ( SELECT ro.historyid FROM rows rl CROSS APPLY ( SELECT TOP 1 rc.historyid FROM rows rc JOIN rows rn ON rn.recordid = rc.recordid AND rn.rn = rc.rn + 1 AND rn.assigned <> rc.assigned WHERE rc.recordid = rl.recordid ORDER BY rc.rn ) ro WHERE rl.rn = 1 AND rl.recordid = projects_records.recordid ) WHERE (@assignedtype='0' and projects_records.assigned = @assigned) OR (@assignedtype='1' and projects_records.assigneddev = @assigned) OR (@assignedtype='2' and projects_records.assignedqa = @assigned) OR (@assignedtype='3' and projects_records.assignedsponsor = @assigned) OR (@assignedtype='4' and projects_records.createuser = @assigned)

    Read the article

  • Count warnings in Python 2.4

    - by l0b0
    I've got some tests that need to count the number of warnings raised by a function. In Python 2.6 this is simple, using with warnings.catch_warnings(record=True) as warn: ... self.assertEquals(len(warn), 2) Unfortunately, with is not available in Python 2.4, so what else could I use? I can't simply check if there's been a single warning (using warning filter with action='error' and try/catch), because the number of warnings is significant.

    Read the article

  • Creating meaningful routes in wizard style ASP.NET MVC form

    - by R0MANARMY
    I apologize in advance for a long question, figured better have a bit more information than not enough. I'm working on an application with a fairly complex form (~100 fields on it). In order to make the UI a little more presentable the fields are organized into regions and split across multiple (~10) tabs (not unlike this, but each tab does a submit/redirect to next tab). This large input form can also be in one of 3 views (read only, editable, print friendly). The form represents a large domain object (let's call it Foo). I have a controller for said domain object (FooController). It makes sense to me to have the controller be responsible for all the CRUD related operations. Here are the problems I'm having trouble figuring out. Goals: I'd like to keep to conventions so that Foo/Create creates a new record Foo/Delete deletes a record Foo/Edit/{foo_id} takes you to the first tab of the form ...etc I'd like to be able to not repeat the data access code such that I can have Foo/Edit/{foo_id}/tab1 Foo/View/{foo_id}/tab1 Foo/Print/{foo_id}tab1 ...etc use the same data access code to get the data and just specify which view to use to render it. My current implementation has a massive FooController with Create, Delete, Tab1, Tab2, etc actions. Tab actions are split out into separate files for organization (using partial classes, which may or may not be abuse of partial classes). Problem I'm running into is how to organize my controller(s) and routes to make that happen. I have the default route {controller}/{action}/{id} Which handles goal 1 properly but doesn't quite play nice with goal 2. I tried to address goal 2 by defining extra routes like so: routes.MapRoute( "FooEdit", "Foo/Edit/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Edit", id = (string)null } ); routes.MapRoute( "FooView", "Foo/View/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "View", id = (string)null } ); routes.MapRoute( "FooPrint", "Foo/Print/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Print", id = (string)null } ); However defining these extra routes causes the Url.Action to generate routs like Foo/Edit/Create instead of Foo/Create. That leads me to believe I designed something very very wrong, but this is my first attempt an asp.net mvc project and I don't know any better. Any advice with this particular situation would be awesome, but feedback on design in similar projects is welcome.

    Read the article

  • Flex: How to most effectively tavere a table column

    - by Maik
    I have a table "template" which is used in various "instances". All instances have checkboxes in the second column (for record-delete). What would be the most effective way of traversing the table and check if at least one checkbox is selected (to enable a "delete" button)? Thanks! Maik

    Read the article

  • stored procedure vs UDF

    - by TheObserver
    I have a select statement and in a couple of the fields, I want to check if an entry for the record exists in another table and if it does, output 1 value and if it doesn't, provide another value. What would be the best way to do it? When would you use a stored procedure and when would you use a UDF?

    Read the article

  • Like operator in sql server

    - by Geetha
    Hi All, i want to get all the record from the database which contain atleast one word from the input string. Ex: input=Stack over flow select * from sample where name like '%stack%' or name like '%over% or name like '%flow%' Geetha.

    Read the article

  • Release Process Improvements

    - by wallismark
    The process of creating a new build and releasing it to production is a critical step in the SDLC but it is often left as an afterthought and varies greatly from one company to the next. I'm hoping people will share improvements they have made to this process in their organisation so we can all takes steps to 'reduce the pain'. So the question is, specify one painful/time consuming part of your release process and what did you do to improve it? My example: at a previous employer all developers made database changes on one common development database. Then when it came to release time, we used Redgate's SQL Compare to generate a huge script from the differences between the Dev and QA databases. This works reasonably well but the problems with this approach are:- ALL changes in the Dev database are included, some of which may still be 'works in progress'. Sometimes developers made conflicting changes (that were not noticed until the release was in production) It was a time consuming and manual process to create and validate the script (by validate I mean, try to weed out issues like problem 1 and 2). When there were problems with the script (eg the order in which things were run such as creating a record which relies on a foreign key record which is in the script but not yet run) it took time to 'tweak' it so it ran smoothly. It's not an ideal scenario for Continuous Integration. So the solution was:- Enforce a policy of all changes to the database must be scripted. A naming convention was important for ensuring the correct running order of the scripts. Create/Use a tool to run the scripts at release time. Developers had their own copy of the database do develop against (so there was no more 'stepping on each others toes') The next release after we started this process was much faster with fewer problems, indeed the only problems found were due to people 'breaking the rules', eg not creating a script. Once the issues with releasing to QA were fixed, when it came time to release to production it was very smooth. We applied a few other changes (like introducing CI) but this was the most significant, overall we reduced release time from around 3 hours down to a max of 10-15 minutes.

    Read the article

  • Evaluation of CTEs in SQL Server 2005

    - by Jammer
    I have a question about how MS SQL evaluates functions inside CTEs. A couple of searches didn't turn up any results related to this issue, but I apologize if this is common knowledge and I'm just behind the curve. It wouldn't be the first time :-) This query is a simplified (and obviously less dynamic) version of what I'm actually doing, but it does exhibit the problem I'm experiencing. It looks like this: CREATE TABLE #EmployeePool(EmployeeID int, EmployeeRank int); INSERT INTO #EmployeePool(EmployeeID, EmployeeRank) SELECT 42, 1 UNION ALL SELECT 43, 2; DECLARE @NumEmployees int; SELECT @NumEmployees = COUNT(*) FROM #EmployeePool; WITH RandomizedCustomers AS ( SELECT CAST(c.Criteria AS int) AS CustomerID, dbo.fnUtil_Random(@NumEmployees) AS RandomRank FROM dbo.fnUtil_ParseCriteria(@CustomerIDs, 'int') c) SELECT rc.CustomerID, ep.EmployeeID FROM RandomizedCustomers rc JOIN #EmployeePool ep ON ep.EmployeeRank = rc.RandomRank; DROP TABLE #EmployeePool; The following can be assumed about all executions of the above: The result of dbo.fnUtil_Random() is always an int value greater than zero and less than or equal to the argument passed in. Since it's being called above with @NumEmployees which has the value 2, this function always evaluates to 1 or 2. The result of dbo.fnUtil_ParseCriteria(@CustomerIDs, 'int') produces a one-column, one-row table that contains a sql_variant with a base type of 'int' that has the value 219935. Given the above assumptions, it makes sense (to me, anyway) that the result of the expression above should always produce a two-column table containing one record - CustomerID and an EmployeeID. The CustomerID should always be the int value 219935, and the EmployeeID should be either 42 or 43. However, this is not always the case. Sometimes I get the expected single record. Other times I get two records (one for each EmployeeID), and still others I get no records. However, if I replace the RandomizedCustomers CTE with a true temp table, the problem vanishes completely. Every time I think I have an explanation for this behavior, it turns out to not make sense or be impossible, so I literally cannot explain why this would happen. Since the problem does not happen when I replace the CTE with a temp table, I can only assume it has something to do with the functions inside CTEs are evaluated during joins to that CTE. Do any of you have any theories?

    Read the article

  • Check to See if File is in Repository with SharpSVN

    - by Jason
    How do I check if a file is already in a repository (or NOT in the repository) so I can determine whether I need to 'add' it first before doing the check in? (For the record, I have check-in working, but I get an exception when I try to check in a file that has not yet been added to the repository.) Thanks

    Read the article

  • What are the Tags Around Default iPhone Address Book People Phone Number Labels?

    - by rnistuk
    My question concerns markup that surrounds some of the default phone number labels in the Person entries of the Contact list on the iPhone. I have created an iPhone contact list address book entry for a person, "John Smith" with the following phone number entries: Mobile (604) 123-4567 iPhone (778) 123-4567 Home (604) 789-4561 Work (604) 456-7891 Main (604) 789-1234 megaphone (234) 567-8990 Note that the first five labels are default labels provided by the Contacts application and the last label, "megaphone", is a custom label. I wrote the following method to retrieve and display the labels and phone numbers for each person in the address book: -(void)displayPhoneNumbersForAddressBook { ABAddressBookRef book = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(book); ABRecordRef record = CFArrayGetValueAtIndex(people, 0); ABMultiValueRef multi = ABRecordCopyValue(record, kABPersonPhoneProperty); NSLog(@"---------" ); NSLog(@"displayPhoneNumbersForAddressBook" ); CFStringRef label, phone; for (CFIndex i = 0; i < ABMultiValueGetCount(multi); ++i) { label = ABMultiValueCopyLabelAtIndex(multi, i); phone = ABMultiValueCopyValueAtIndex(multi, i); NSLog(@"label: \"%@\" number: \"%@\"", (NSString*)label, (NSString*)phone); CFRelease(label); CFRelease(phone); } NSLog(@"---------" ); CFRelease(multi); CFRelease(people); CFRelease(book); } and here is the output for the address book entry that I entered: 2010-03-08 13:24:28.789 test2m[2479:207] --------- 2010-03-08 13:24:28.789 test2m[2479:207] displayPhoneNumbersForAddressBook 2010-03-08 13:24:28.790 test2m[2479:207] label: "_$!<Mobile>!$_" number: "(604) 123-4567" 2010-03-08 13:24:28.790 test2m[2479:207] label: "iPhone" number: "(778) 123-4567" 2010-03-08 13:24:28.791 test2m[2479:207] label: "_$!<Home>!$_" number: "(604) 789-4561" 2010-03-08 13:24:28.791 test2m[2479:207] label: "_$!<Work>!$_" number: "(604) 456-7891" 2010-03-08 13:24:28.792 test2m[2479:207] label: "_$!<Main>!$_" number: "(604) 789-1234" 2010-03-08 13:24:28.792 test2m[2479:207] label: "megaphone" number: "(234) 567-8990" 2010-03-08 13:24:28.793 test2m[2479:207] --------- What are the markup characters _$!< and >!$_ surrounding most, save for iPhone, of the default labels for? Can you point me to where in the "Address Book Programming Guide for iPhone OS" I can find the information? Thank you for your help.

    Read the article

  • Implement Semi-Round-Robin file which can be expanded and saved on demand

    - by ircmaxell
    Ok, that title is going to be a little bit confusing. Let me try to explain it a little bit better. I am building a logging program. The program will have 3 main states: Write to a round-robin buffer file, keeping only the last 10 minutes of data. Write to a buffer file, ignoring the time (record all data). Rename entire buffer file, and start a new one with the past 10 minutes of data (and change state to 1). Now, the use case is this. I have been experiencing some network bottlenecks from time to time in our network. So I want to build a system to record TCP traffic when it detects the bottleneck (detection via Nagios). However by the time it detects the bottlenecking, most of the useful data has already been transmitted. So, what I'd like is to have a deamon that runs something like dumpcap all the time. In normal mode, it'll only keep the past 10 minutes of data (Since there's no point in keeping a boat load of data if it's not needed). But when Nagios alerts, I will send a signal in the deamon to store everything. Then, when Naigos recovers it will send another signal to stop storing and flush the buffer to a save file. Now, the problem is that I can't see how to cleanly store a rotating 10 minutes of data. I could store a new file every 10 minutes and delete the old ones if in mode 1. But that seems a bit dirty to me (especially when it comes to figuring out when the alert happened in the file). Ideally, the file that was saved should be such that the alert is always at the 10:00 mark in the file. While that is possible with new files every 10 minutes, it seems like a bit dirty to "repair" the files to that point. Any ideas? Should I just do a rotating file system and combine them into 1 at the end (doing quite a bit of post-processing)? Is there a way to implement the semi-round-robin file cleanly so that there is no need for any post-processing? Thanks Oh, and the language doesn't matter as much at this stage (I'm leaning towards Python, but have no objection to any other language. It's less of an issue than the overall design)...

    Read the article

< Previous Page | 139 140 141 142 143 144 145 146 147 148 149 150  | Next Page >