Search Results

Search found 5122 results on 205 pages for 'max'.

Page 80/205 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • MySQL Cursor Issue

    - by James Inman
    I've got the following code - this is the first time I've really attempted using cursors. DELIMITER $$ DROP PROCEDURE IF EXISTS demo$$ DROP TABLE IF EXISTS temp$$ CREATE TEMPORARY TABLE temp( id INTEGER NOT NULL AUTO_INCREMENT, start DATETIME NOT NULL, end DATETIME NOT NULL, PRIMARY KEY(id) ) $$ CREATE PROCEDURE demo() BEGIN DECLARE done INT DEFAULT 0; DECLARE a, b DATETIME; DECLARE cur1 CURSOR FOR SELECT MAX(end) AS end FROM ( SELECT id, start, end, @r := @r + (start > @edate) AS num, @edate := GREATEST(@edate, end) FROM ( SELECT @r := 0, @edate := '0001-01-01' ) vars, student_lectures WHERE ( student_id = 1 AND start >= '2010-04-26 00:00:00' AND end <= '2010-04-30 23:59:59' ) ORDER BY start ) q GROUP BY num; DECLARE cur2 CURSOR FOR SELECT MIN(start) AS start FROM ( SELECT id, start, end, @r := @r + (start > @edate) AS num, @edate := GREATEST(@edate, end) FROM ( SELECT @r := 0, @edate := '0001-01-01' ) vars, student_lectures WHERE ( student_id = 1 AND start >= '2010-04-26 00:00:00' AND end <= '2010-04-30 23:59:59' ) ORDER BY start ) q GROUP BY num LIMIT 1, 18446744073709551615; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cur1; OPEN cur2; REPEAT FETCH cur1 INTO a; FETCH cur2 INTO b; IF NOT done THEN INSERT INTO temp(start, end) VALUES(a,b); END IF; UNTIL done END REPEAT; CLOSE cur1; CLOSE cur2; END $$ SELECT * FROM temp; I'm not getting anything outputted into the temp table. Running the following query gives me output, so I know there's rows it should be matching - but I imagine I've made some obvious mistake. SELECT MAX(end) AS end FROM ( SELECT id, start, end, @r := @r + (start > @edate) AS num, @edate := GREATEST(@edate, end) FROM ( SELECT @r := 0, @edate := '0001-01-01' ) vars, student_lectures WHERE ( student_id = 1 AND start >= '2010-04-26 00:00:00' AND end <= '2010-04-30 23:59:59' ) ORDER BY start ) q GROUP BY num; The output this query returns: +---------------------+ | end | +---------------------+ | 2010-04-26 13:00:00 | | 2010-04-26 18:15:00 | | 2010-04-27 11:00:00 | | 2010-04-27 13:00:00 | | 2010-04-27 18:15:00 | | 2010-04-28 13:00:00 | | 2010-04-29 13:00:00 | | 2010-04-29 18:15:00 | | 2010-04-30 13:00:00 | | 2010-04-30 15:15:00 | | 2010-04-30 17:15:00 | +---------------------+ 11 rows in set (0.02 sec)

    Read the article

  • Error when calling SQL SP via LINQ

    - by PaulC
    Newbie problem: I have a SQL SP with ten parameters (eight input, two output) but when I attempt to call it via LINQ from code I get the following error message: "The best overloaded method match for 'DataClassesDataContext.ST_CR_CREATE_CASE_BASIS(string, string, string, string, System.DateTime?, string, string, string, ref int?, ref int?)' has some invalid arguments". The params with ? appear to be unrecognized, but I'm baffled: the data types match the SQL types, the number of parameters match, the other parmeters don't exhibit the same behaviour. Can anyone tell me what's going on? Thanks in advance. -- SQL SP: create procedure ST_CR_CREATE_CASE_BASIS @p_Pers_No nvarchar (50), @p_Subject nvarchar (255), @p_RQ_XML nvarchar(max), @p_RQ_XSL nvarchar(max), @p_Date_Submit smalldatetime, @p_User_ID_Submit nvarchar (255), @p_RQ_Status nvarchar (50), @p_User_ID_OnBehalf nvarchar (255), @p_Case_Number int output, @p_RQ_ID int output as begin -- ... etc.; the SP works fine when called from SSMS The code-behind proc from the aspx page looks like this: protected void cmdSubmit_Click(object sender, EventArgs e) { using (DataClassesDataContext vDataCont = new DataClassesDataContext()) { Int32 vNewCaseNr; Int32 vNewReqNr; DateTime vNow = System.DateTime.Now; vDataCont.ST_CR_CREATE_CASE_BASIS("101", "Test Subject Late Wed", null, null, vNow , "101", "1", "101", ref vNewCaseNr, vNewReqNr); } }

    Read the article

  • Get percentiles of data-set with group by month

    - by Cylindric
    Hello, I have a SQL table with a whole load of records that look like this: | Date | Score | + -----------+-------+ | 01/01/2010 | 4 | | 02/01/2010 | 6 | | 03/01/2010 | 10 | ... | 16/03/2010 | 2 | I'm plotting this on a chart, so I get a nice line across the graph indicating score-over-time. Lovely. Now, what I need to do is include the average score on the chart, so we can see how that changes over time, so I can simply add this to the mix: SELECT YEAR(SCOREDATE) 'Year', MONTH(SCOREDATE) 'Month', MIN(SCORE) MinScore, AVG(SCORE) AverageScore, MAX(SCORE) MaxScore FROM SCORES GROUP BY YEAR(SCOREDATE), MONTH(SCOREDATE) ORDER BY YEAR(SCOREDATE), MONTH(SCOREDATE) That's no problem so far. The problem is, how can I easily calculate the percentiles at each time-period? I'm not sure that's the correct phrase. What I need in total is: A line on the chart for the score (easy) A line on the chart for the average (easy) A line on the chart showing the band that 95% of the scores occupy (stumped) It's the third one that I don't get. I need to calculate the 5% percentile figures, which I can do singly: SELECT MAX(SubQ.SCORE) FROM (SELECT TOP 45 PERCENT SCORE FROM SCORES WHERE YEAR(SCOREDATE) = 2010 AND MONTH(SCOREDATE) = 1 ORDER BY SCORE ASC) AS SubQ SELECT MIN(SubQ.SCORE) FROM (SELECT TOP 45 PERCENT SCORE FROM SCORES WHERE YEAR(SCOREDATE) = 2010 AND MONTH(SCOREDATE) = 1 ORDER BY SCORE DESC) AS SubQ But I can't work out how to get a table of all the months. | Date | Average | 45% | 55% | + -----------+---------+-----+-----+ | 01/01/2010 | 13 | 11 | 15 | | 02/01/2010 | 10 | 8 | 12 | | 03/01/2010 | 5 | 4 | 10 | ... | 16/03/2010 | 7 | 7 | 9 | At the moment I'm going to have to load this lot up into my app, and calculate the figures myself. Or run a larger number of individual queries and collate the results.

    Read the article

  • Templates, and C++ operator for logic: B contained by set A

    - by James Morris
    In C++, I'm looking to implement an operator for selecting items in a list (of type B) based upon B being contained entirely within A. In the book "the logical design of digital computers" by Montgomery Phister jr (published 1958), p54, it says: F11 = A + ~B has two interesting and useful associations, neither of them having much to do with computer design. The first is the logical notation of implication... The second is notation of inclusion... This may be expressed by a familiar looking relation, B < A; or by the statement "B is included in A"; or by the boolean equation F11= A + ~B = 1. My initial implementation was in C. Callbacks were given to the list to use for such operations. An example being a list of ints, and a struct containting two ints, min and max, for selection purposes. There, selection would be based upon B = A-min && B <= A-max. Using C++ and templates, how would you approach this after having implemented a generic list in C using void pointers and callbacks? Is using < as an over-ridden operator for such purposes... <ugh> evil? </ugh> (or by using a class B for the selection criteria, implementing the comparison by overloading ?)

    Read the article

  • How should I start playing with 3D

    - by MarceloRamires
    I'm a developer for just about 6 months now, and since I enjoy programming I make a couple of little programs. I've started making encripters, calculators, tools, stuff to play with DropBox (hehe), stuff that play with bitmaps, drawing graphics, and even a program to update the MSN display image according to the artwork of the music you're listening yo on iTunes. Now I kind of ran off ideas of programs to deal with information, and I've had an idea: play around with 3d! so I've read a little about it and figured I'd have to have good notions on position and math on point spacial position (which I do, from my 3d modelling experience), but I don't know how to use API's for it, so I've 'simulated' simple 3d with a simple program I've made (it's just a spinning cube, please, first one to open it, comment here stating that it's safe, i've got no reason to harm anyone's pc.) One of my other hobbies is 3d modelling (completly amateur) and I'd like to mix these hobbies together! Here are some questions: 1) What would be a nice 3d development tool for a .NET programmer like me? 2) Is there a way of using 3d models made in 3DS Max ? (I intend on modelling characters) 3) What knowledges should I have in order to render it, and move it areound ? 4) Which API should I use ? NOTE: Not a dupe, I'm asking for directions specific for .NET development possibly using 3ds MAX, and there are no questions about it!

    Read the article

  • Fixing color in scatter plots in matplotlib

    - by ajhall
    Hi guys, I'm going to have to come back and add some examples if you need them, which you might. But, here's the skinny- I'm plotting scatter plots of lab data for my research. I need to be able to visually compare the scatter plots from one plot to the next, so I want to fix the color range on the scatter plots and add in a colorbar to each plot (which will be the same in each figure). Essentially, I'm fixing all aspects of the axes and colorspace etc. so that the plots are directly comparable by eye. For the life of me, I can't seem to get my scatter() command to properly set the color limits in the colorspace (default)... i.e., I figure out my total data's min and total data's max, then apply them to vmin, vmax, for the subset of data, and the color still does not come out properly in both plots. This must come up here and there, I can't be the only one that wants to compare various subsets of data amongst plots... so, how do you fix the colors so that each data keeps it's color between plots and doesn't get remapped to a different color due to the change in max/min of the subset -v- the whole set? I greatly appreciate all your thoughts!!! A mountain-dew and fiery-hot cheetos to all! -Allen

    Read the article

  • Is there some advantage to filling a stack with nils and interpreting the "top" as the last non-nil value?

    - by dwilbank
    While working on a rubymonk exercise, I am asked to implement a stack with a hard size limit. It should return 'nil' if I try to push too many values, or if I try to pop an empty stack. My solution is below, followed by their solution. Mine passes every test I can give it in my IDE, while it fails rubymonk's test. But that isn't my question. Question is, why did they choose to fill the stack with nils instead of letting it shrink and grow like it does in my version? It just makes their code more complex. Here's my solution: class Stack def initialize(size) @max = size @store = Array.new end def pop empty? ? nil : @store.pop end def push(element) return nil if full? @store.push(element) end def size @store.size end def look @store.last end private def full? @store.size == @max end def empty? @store.size == 0 end end and here is the accepted answer class Stack def initialize(size) @size = size @store = Array.new(@size) @top = -1 end def pop if empty? nil else popped = @store[@top] @store[@top] = nil @top = @top.pred popped end end def push(element) if full? or element.nil? nil else @top = @top.succ @store[@top] = element self end end def size @size end def look @store[@top] end private def full? @top == (@size - 1) end def empty? @top == -1 end end

    Read the article

  • SQL Server Reset Identity Increment for all tables

    - by DanSpd
    Basically I need to reset Identity Increment for all tables to its original. Here I tried some code, but it fails. http://pastebin.com/KSyvtK5b actual code from link: USE World00_Character GO -- Create a cursor to loop through the System Ojects and get each table name DECLARE TBL_CURSOR CURSOR -- Declare the SQL Statement to cursor through FOR ( SELECT Name FROM Sysobjects WHERE Type='U' ) -- Declare the @SQL Variable which will hold our dynamic sql DECLARE @SQL NVARCHAR(MAX); SET @SQL = ''; -- Declare the @TblName Variable which will hold the name of the current table DECLARE @TblName NVARCHAR(MAX); -- Open the Cursor OPEN TBL_CURSOR -- Setup the Fetch While that will loop through our cursor and set @TblName FETCH NEXT FROM TBL_CURSOR INTO @TblName -- Do this while we are not at the end of the record set WHILE (@@FETCH_STATUS <> -1) BEGIN -- Appeand this table's select count statement to our sql variable SET @SQL = @SQL + ' ( SELECT '''+@TblName+''' AS Table_Name,COUNT(*) AS Count FROM '+@TblName+' ) UNION'; -- Delete info EXEC('DBCC CHECKIDENT ('+@TblName+',RESEED,(SELECT IDENT_SEED('+@TblName+')))'); -- Pull the next record FETCH NEXT FROM TBL_CURSOR INTO @TblName -- End the Cursor Loop END -- Close and Clean Up the Cursor CLOSE TBL_CURSOR DEALLOCATE TBL_CURSOR -- Since we were adding the UNION at the end of each part, the last query will have -- an extra UNION. Lets trim it off. SET @SQL = LEFT(@SQL,LEN(@SQL)-6); -- Lets do an Order By. You can pick between Count and Table Name by picking which -- line to execute below. SET @SQL = @SQL + ' ORDER BY Count'; --SET @SQL = @SQL + ' ORDER BY Table_Name'; -- Now that our Dynamic SQL statement is ready, lets execute it. EXEC (@SQL); GO error message: Error: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '('. How can I either fix that SQL or reset identity for all tables to its original? Thank you

    Read the article

  • jQuery UI slider coming out looking wierd

    - by jondavidjohn
    http://cl.ly/2W1V3s0G2G3y3D133I3U <--screenshot of rendered slider It acts normally by clicking the inner whitespace of the slider and dragging, values act accordingly, but the handles do not move and fill the area, and the line at the top grows/shrinks with the difference of the two values. Here is the code I am using to initiate the slider. $('.sliderific').each(function(){ alert($(this).attr('id')); $(this).slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { $(this).nextAll('.left:first').text(ui.values[ 0 ]); $(this).nextAll('.right:first').text(ui.values[ 1 ]); } }); }); and here is the DOM it's being applied to... <div class="white notwide"> <div id="price-slider" class="sliderific"></div> <span class="em small gray left center">Min Price</span> <span class="em small gray right center">Max Price </span> </div> EDIT : Also, I have verified I am including the proper css and the jquery theme images are connecting and being loaded.

    Read the article

  • oracle sequence init

    - by gospodin
    I wanted to export 3 tables from db1 into db2. Before the export starts, I will create the sequences for those 3 tables. CREATE SEQUENCE TEST_SEQ START WITH 1 INCREMENT BY 1; After the export, I will reinitialize sequnce values to match the max(id) + 1 from the table. CREATE OR REPLACE PROCEDURE "TEST_SEQUENCE" AUTHID CURRENT_USER is v_num number; begin select max(ID) into v_num from TABLE_1; EXECUTE IMMEDIATE 'ALTER SEQUENCE TEST_SEQ INCREMENT BY ' || v_num; EXECUTE IMMEDIATE 'ALTER SEQUENCE 1TEST_SEQ INCREMENT BY 1'; end; / show errors; execute TEST_SEQ; This procedure compiles and executes without problems. But when I want to check t he last value of the sequence, like select TEST_SEQ.nextval from dual; I still get the "1". Can someone tell me why my procedure did not impact my sequence? ps. I am using oracle sql developper to pass sql. Thanks

    Read the article

  • jQuery Character Counter Inside Newly Created Tooltip

    - by Dodinas
    Hello all, I'm having a difficult time figuring this one out. I'm attempting to have a user open a tooltip (using jQuery qTip). What this does is create a "new" tooltip element on the page; it takes it from an existing hidden HTML div on the webpage. Once this new tooltip is created, it has a character counter that is supposed to dynamically update as the user types in the textbox (which is inside the tooltip). The "Max Length Character Counter" script can be found here. However, the "counter" portion is not working inside the newly created tooltip. Any ideas how I can bind this max length character counter to the tooltip? Here's what I'm working with so far: function load_qtip(apply_qtip_to) { $(apply_qtip_to).each(function(){ $(this).qtip({ content: $(".tooltip-contents"), //this is a DIV in the HTML show: 'click', hide: 'unfocus' }); }); } $(document).ready(function() { load_qtip(".tooltip"); $('.my_textbox').maxlength({ 'feedback' : '.my_counter' }); }); And here's what the HTML basically looks like (remember, though, this entire div is "replicated" into a new tooltip): <div class="tooltip_contents"> <form> <div class="my_counter" id="counter">55</div> <textarea class="my_textbox" maxlength="55" id="textbox"></textarea> <input type="button" value="Submit"> </form> </div> Any direction/suggestions on this would be great, as I am completely lost. Thanks very much!

    Read the article

  • Passing a var as an argument

    - by Lienau
    On a site I'm making I need to have a progress bar, I found one that suited my needs. By default it will incrementally change the color when a certain percentage is reached (0-30 red, 30-70 orange, etc). My only problem is changing them, I can set them easily with a static number such as 50, but when I try to do it dynamically (ie: 2000*.3 = 600) it fails. I don't know much js/jquery so this is especially difficult for me, if you could help that would be great. I'm pretty sure it's something really simple I'm missing. The code that Fails: var barmax = 2000; var orangeBound = Math.round(barmax * .3); var greenBound = Math.round(barmax * .7); //alert(orangeBound+":"+greenBound); $("#pb1").progressBar({ max: barmax, textFormat: 'fraction', barImage: { 0: 'images/progressbg_red.gif', orangeBound: 'images/progressbg_orange.gif', greenBound: 'images/progressbg_green.gif'} }); The code that works but I can't use because it has to be dynamic: $("#pb1").progressBar({ max: barmax, textFormat: 'fraction', barImage: { 0: 'images/progressbg_red.gif', 600: 'images/progressbg_orange.gif', 1400: 'images/progressbg_green.gif'} }); If you need to see the source, here. Thanks again!

    Read the article

  • Batch script crashing

    - by TamirGali
    My Batch script keeps crashing with the note: "set was unexpected at this time" which I could only see via video recording and checking frame by frame. here is the script: @echo off color 6f set min=0 set max=25 goto REDIR :REDIR set var=0 goto TOP :TOP cls set /a var=%var%+1 set /a rand%var%=%random% %% (max - min + 1)+ min if %rand2%==%rand1% set var=0&goto TOP if %rand3%==%rand2% set var=1&goto TOP if %rand4%==%rand3% set var=2&goto TOP if %rand5%==%rand4% set var=3&oto TOP if %rand6%==%rand5% set var=4&goto TOP if %rand7%==%rand6% set var=5&goto TOP if %rand8%==%rand7% set var=6&goto TOP if %rand9%==%rand8% set var=7&goto TOP if %rand10%==%rand9% set var=8&goto TOP if %rand11%==%rand10% set var=9&goto TOP if %rand12%==%rand11% set var=10&goto TOP if %rand13%==%rand12% set var=11&goto TOP if %rand14%==%rand13% set var=12&goto TOP if %rand15%==%rand14% set var=13&goto TOP if %rand16%==%rand15% set var=14&goto TOP if %rand17%==%rand16% set var=15&goto TOP if %rand18%==%rand17% set var=16&goto TOP if %rand19%==%rand18% set var=17&goto TOP if %rand20%==%rand19% set var=18&goto TOP if %rand21%==%rand20% set var=19&goto TOP if %rand22%==%rand21% set var=20&goto TOP if %rand23%==%rand22% set var=21&goto TOP if %rand24%==%rand23% set var=22&goto TOP if %rand25%==%rand24% set var=23&goto TOP if %rand26%==%rand25% set var=24&goto TOP if %var%==26 goto SHOW goto TOP :SHOW cls echo A=%rand1% echo B=%rand2% echo C=%rand3% echo D=%rand4% echo E=%rand5% echo F=%rand6% echo G=%rand7% echo H=%rand8% echo I=%rand9% echo J=%rand10% echo K=%rand11% echo L=%rand12% echo M=%rand13% echo N=%rand14% echo O=%rand15% echo P=%rand16% echo Q=%rand17% echo R=%rand18% echo S=%rand19% echo T=%rand20% echo U=%rand21% echo V=%rand22% echo W=%rand23% echo X=%rand24% echo Y=%rand25% echo Z=%rand26% pause goto REDIR

    Read the article

  • Strangely structured xml code finding last value of a certain type using java

    - by Damien.Bell
    Thus the structure is something like this: OasisReportMessagePayloadRTOReport_ItemReport_Data Under report data it's broken into categories: >>Zone >>Type >>Value >>Interval What I need to do is: Get the value if the type is equal to 'myType' and the interval value is the LARGEST. So an example of the xml might be (under report_data): OasisReport MessagePayload RTO REPORT_ITEM REPORT_DATA <zone>myZone1</zone> -- This should be the same in all reports since I only get them for 1 zone <type>myType</type> --This can change from line to line <value>12345</value>--This changes every interval <Interval>122</Interval> -- This is essentially how many 5 minute intervals have taken place since the beginning of a day, finding the "max" lets me know it's the newest data. Thereby I want to find stuff of "MyType" for the "max" interval and pull the Value (into a string, or a double, if not I can convert from string. Can someone help me with this task? Thanks! Note: I've used Xpath to handle things like this in the past, but it seems outlandish for this... as it's SO complex (since not all the reports live in the same report_item, and not all the types are the same in each report)

    Read the article

  • How to find the latest row for each group of data

    - by Jason
    Hi All, I have a tricky problem that I'm trying to find the most effective method to solve. Here's a simplified version of my View structure. Table: Audits AuditID | PublicationID | AuditEndDate | AuditStartDate 1 | 3 | 13/05/2010 | 01/01/2010 2 | 1 | 31/12/2009 | 01/10/2009 3 | 3 | 31/03/2010 | 01/01/2010 4 | 3 | 31/12/2009 | 01/10/2009 5 | 2 | 31/03/2010 | 01/01/2010 6 | 2 | 31/12/2009 | 01/10/2009 7 | 1 | 30/09/2009 | 01/01/2009 There's 3 query's that I need from this. I need to one to get all the data. The next to get only the history data (that is, everything but exclude the latest data item by AuditEndDate) and then the last query is to obtain the latest data item (by AuditEndDate). There's an added layer of complexity that I have a date restriction (This is on a per user/group basis) where certain user groups can only see between certain dates. You'll notice this in the where clause as AuditEndDate<=blah and AuditStartDate=blah Foreach publication, select all the data available. select * from Audits Where auditEndDate<='31/03/10' and AuditStartDate='06/06/2009'; foreach publication, select all the data but Exclude the latest data available (by AuditEndDate) select * from Audits left join (select AuditId as aid, publicationID as pid and max(auditEndDate) as pend from Audit where auditenddate <= '31/03/2009' /* user restrict / group by pid) Ax on Ax.pid=Audit.pubid where pend!=Audits.auditenddate AND auditEndDate<='31/03/10' and AuditStartDate='06/06/2009' / user restrict */ Foreach publication, select only the latest data available (by AuditEndDate) select * from Audits left join (select AuditId as aid, publicationID as pid and max(auditEndDate) as pend from Audit where auditenddate <= '31/03/2009'/* user restrict / group by pid) Ax on Ax.pid=Audit.pubid where pend=Audits.auditenddate AND auditEndDate<='31/03/10' and AuditStartDate='06/06/2009' / user restrict */ So at the moment, query 1 and 3 work fine, but query 2 just returns all the data instead of the restriction. Can anyone help me? Thanks jason

    Read the article

  • How to make UISlider output nice rounded numbers exponentially?

    - by RickiG
    Hi I am implementing a UISlider a user can manipulate to set a distance. I have never used the CocoaTouch UISlider, but have used other frameworks sliders, usually there is a variable for setting the "step" and other "helper" properties. The documentation for the UISlider deals only with a max and min value, and the output is always a 6 decimal float with a linear relation to the position of the "slider nob". I guess I will have to implement the desired functionality step by step. To the user, the min/max values range from 10 m to 999 Km, I am trying to implement this in an exponential way, that will feel natural to the user. I.e. the user experiences a feeling of control over the values, big or small. Also that the "output" has reasonable values. Values like 10m 200m 2.5km 150 km etc. instead of 1.2342356 m or 108.93837756 km. I would like for the step size to increase by 10m for the first 200m, then maybe by 50m up to 500m, then when passing the 1000 m value, it starts to deal with Kilometers, so then it is step size = 1 km up until 50 km, then maybe 25 km steps etc. Any way I go about this I end up doing a lot of rounding and a lot of calculations wrapped in a forrest of if statements and NSString/Number conversions, each time the user moves the slider just a little. I was hoping someone could lend me a bit of inspiration/math help or make me aware of a more lean approach to solving this problem. My last idea is to populate and array with a 100 string values, then have the slider int value correspond to a string, this is not very flexible, but doable. Thank you in advance for any help given:)

    Read the article

  • Oracle - Getting Select Count(*) from ... as an output parameter in System.Data.OracleClient

    - by cbeuker
    Greetings all, I have a question. I am trying to build a parametrized query to get me the number of rows from a table in Oracle. Rather simple. However I am an Oracle newbie.. I know in SQL Server you can do something like: Select @outputVariable = count(*) from sometable where name = @SomeOtherVariable and then you can set up an Output parameter in the System.Data.SqlClient to get the @outputVariable. Thinking that one should be able to do this in Oracle as well, I have the following query Select count(*) into :theCount from sometable where name = :SomeValue I set up my oracle parameters (using System.Data.OracleClient - yes I know it will be deprecated in .Net 4 - but that's what I am working with for now) as follows IDbCommand command = new OracleCommand(); command.CommandText = "Select count(*) into :theCount from sometable where name = :SomeValue"); command.CommandType = CommandType.Text; OracleParameter parameterTheCount = new OracleParameter(":theCount ", OracleType.Number); parameterTheCount .Direction = ParameterDirection.Output; command.Parameters.Add(parameterTheCount ); OracleParameter parameterSomeValue = new OracleParameter(":SomeValue", OracleType.VarChar, 40); parameterSomeValue .Direction = ParameterDirection.Input; parameterSomeValue .Value = "TheValueToLookFor"; command.Parameters.Add(parameterSomeValue ); command.Connection = myconnectionObject; command.ExecuteNonQuery(); int theCount = (int)parameterTheCount.Value; At which point I was hoping the count would be in the parameter parameterTheCount that I could readily access. I keep getting the error ora-01036 which http://ora-01036.ora-code.com tells me to check my binding in the sql statement. Am I messing something up in the SQL statement? Am I missing something simple elsewhere? I could just use command.ExecuteScaler() as I am only getting one item, and am probably going to end up using that, but at this point, curiosity has got the better of me. What if I had two parameters I wanted back from my query (ie: select max(ColA), min(ColB) into :max, :min.....) Thanks..

    Read the article

  • Cross-Platform Language + GUI Toolkit for Prototyping Multimedia Applications

    - by msutherl
    I'm looking for a language + GUI toolkit for rapidly prototyping utility applications for multimedia installations. I've been working with Max/MSP/Jitter for many years, but I'd like to add a text-based language to my 'arsenal' for tasks apart from 'content production'. (When it comes to actual media synthesis, my choices are clear [SuperCollider + MSP for audio, Jitter + Quartz + openFrameworks for video]). I'm looking for something that maintains some of the advantages of Max, but is lower-level, faster, more cross-platfrom (Linux support), and text-based. Integration with powerful sound/video libraries is not a requirement. Some requirements: Cross-platform (at least OSX and Linux, Windows is a plus) Fast and easy cross-platform GUIs with no platform-specific modification GUI code separated from backend code as much as possible Good for interfacing with external serial devices (micro-controllers) Good network support (UDP/TCP) Good libraries for multi-media (video, sound, OSC) are a plus Asynchronous synchronous UNIX integration is a plus The options that come to mind: AS3/Flex (not a fan of AS3 or the idea of running in the Flash Player) openFrameworks (C++ framework, perhaps a bit too low level [looking for fast development time] and biased toward video work) Java w/ Processing libraries (like openFrameworks, just slower) Python + Qt (is Qt appropriate for rapid prototyping?) Python + Another GUI toolkit SuperCollider + Swing (yucky GUI development) Java w/ SWT Any other options? What do you recommend?

    Read the article

  • Please help optimizing a long running query (left outer join, with 2 subqueries)

    - by 46and2
    Hi all. The query I need help with is: SELECT d.bn, d.4700, d.4500, ... , p.`Activity Description` FROM ( SELECT temp.bn, temp.4700, temp.4500, .... FROM `tdata` temp GROUP BY temp.bn HAVING (COUNT(temp.bn) = 1) ) d LEFT OUTER JOIN ( SELECT temp2.bn, max(temp2.FPE) AS max_fpe, temp2.`Activity Description` FROM `pdata` temp2 GROUP BY temp2.bn ) p ON p.bn = d.bn; The ... represents other fields that aren't really important to solving this problem. The issue is on the the second subquery - it is not using the index I have created and I am not sure why, it seems to be because of the way TEXT fields are handled. The first subquery uses the index I have created and runs quite snappy, however an explain on the second shows a 'Using temporary; Using filesort'. Please see the indexes I have created in the below table create statements. Can anyone help me optimize this? By way of quick explanation the first subquery is meant to only select records that have unique bn's, the second, while it looks a bit wacky (with the max function there which is not being used in the result set) is making sure that only one record from the right part of the join is included in the result set. My table create statements are CREATE TABLE `tdata` ( `BN` varchar(15) DEFAULT NULL, `4000` varchar(3) DEFAULT NULL, `5800` varchar(3) DEFAULT NULL, .... KEY `BN` (`BN`), KEY `idx_t3010`(`BN`,`4700`,`4500`,`4510`,`4520`,`4530`,`4570`,`4950`,`5000`,`5010`,`5020`,`5050`,`5060`,`5070`,`5100`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 CREATE TABLE `pdata` ( `BN` varchar(15) DEFAULT NULL, `FPE` datetime DEFAULT NULL, `Activity Description` text, .... KEY `BN` (`BN`), KEY `idx_programs_2009` (`BN`,`FPE`,`Activity Description`(100)) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 Thanks!

    Read the article

  • Malware - Technical anlaysis

    - by nullptr
    Note: Please do not mod down or close. Im not a stupid PC user asking to fix my pc problem. I am intrigued and am having a deep technical look at whats going on. I have come across a Windows XP machine that is sending unwanted p2p traffic. I have done a 'netstat -b' command and explorer.exe is sending out the traffic. When I kill this process the traffic stops and obviously Windows Explorer dies. Here is the header of the stream from the Wireshark dump (x.x.x.x) is the machines IP. GNUTELLA CONNECT/0.6 Listen-IP: x.x.x.x:8059 Remote-IP: 76.164.224.103 User-Agent: LimeWire/5.3.6 X-Requeries: false X-Ultrapeer: True X-Degree: 32 X-Query-Routing: 0.1 X-Ultrapeer-Query-Routing: 0.1 X-Max-TTL: 3 X-Dynamic-Querying: 0.1 X-Locale-Pref: en GGEP: 0.5 Bye-Packet: 0.1 GNUTELLA/0.6 200 OK Pong-Caching: 0.1 X-Ultrapeer-Needed: false Accept-Encoding: deflate X-Requeries: false X-Locale-Pref: en X-Guess: 0.1 X-Max-TTL: 3 Vendor-Message: 0.2 X-Ultrapeer-Query-Routing: 0.1 X-Query-Routing: 0.1 Listen-IP: 76.164.224.103:15649 X-Ext-Probes: 0.1 Remote-IP: x.x.x.x GGEP: 0.5 X-Dynamic-Querying: 0.1 X-Degree: 32 User-Agent: LimeWire/4.18.7 X-Ultrapeer: True X-Try-Ultrapeers: 121.54.32.36:3279,173.19.233.80:3714,65.182.97.15:5807,115.147.231.81:9751,72.134.30.181:15810,71.59.97.180:24295,74.76.84.250:25497,96.234.62.221:32344,69.44.246.38:42254,98.199.75.23:51230 GNUTELLA/0.6 200 OK So it seems that the malware has hooked into explorer.exe and hidden its self quite well as a Norton Scan doesn't pick anything up. I have looked in Windows firewall and it shouldn't be letting this traffic through. I have had a look into the messages explorer.exe is sending in Spy++ and the only related ones I can see are socket connections etc... My question is what can I do to look into this deeper? What does malware achieve by sending p2p traffic? I know to fix the problem the easiest way is to reinstall Windows but I want to get to the bottom of it first, just out of interest.

    Read the article

  • Passing Binary Data to a Stored Procedure in SQL Server 2008

    - by Joe Majewski
    I'm trying to figure out a way to store files in a database. I know it's recommended to store files on the file system rather than the database, but the job I'm working on would highly prefer using the database to store these images (files). There are also some constraints. I'm not an admin user, and I have to make stored procedures to execute all the commands. This hasn't been of much difficulty so far, but I cannot for the life of me establish a way to store a file (image) in the database. When I try to use the BULK command, I get an error saying "You do not have permission to use the bulk load statement." The bulk utility seemed like the easy way to upload files to the database, but without permissions I have to figure a work-a-round. I decided to use an HTML form with a file upload input type and handle it with PHP. The PHP calls the stored procedure and passes in the contents of the file. The problem is that now it's saying that the max length of a parameter can only be 128 characters. Now I'm completely stuck. I don't have permissions to use the bulk command and it appears that the max length of a parameter that I can pass to the SP is 128 characters. I expected to run into problems because binary characters and ascii characters don't mix well together, but I'm at a dead end... Thanks

    Read the article

  • Update table variable with function

    - by Joris
    I got a table variable @RQ, I want it updated using a table-valued function. Now, I think I do the update wrong, because my function works... The function: ALTER FUNCTION [dbo].[usf_GetRecursiveFoobar] ( @para int, @para datetime, @para varchar(30) ) RETURNS @ReQ TABLE ( Onekey int, Studnr nvarchar(10), Stud int, Description nvarchar(32), ECTSGot decimal(5,2), SBUGot decimal(5,0), ECTSmax decimal(5,2), SBUmax decimal(5,0), IsFree bit, IsGot int, DateGot nvarchar(10), lvl int, path varchar(max) ) AS BEGIN; WITH RQ AS ( --RECURSIVE QUERY ) INSERT @ReQ SELECT RQ.Onekey, RQ.Studnr, RQ.Stud, RQ.Description, RQ.ECTSGot, RQ.SBUGot, RQ.ECTSmax, RQ.SBUmax, RQ.IsFree, RQ.IsGot, RQ.DatumGot, RQ.lvl, RQ.path FROM RQ RETURN END Now, when I run a simple query: DECLARE @ReQ TABLE ( OnderwijsEenheid_key int, StudentnummerHSA nvarchar(10), Student_key int, Omschrijving nvarchar(32), ECTSbehaald decimal(5,2), SBUbehaald decimal(5,0), ECTSmax decimal(5,2), SBUmax decimal(5,0), IsVrijstelling bit, IsBehaald int, DatumBehaald nvarchar(10), lvl int, path varchar(max) ) INSERT INTO @ReQ SELECT * FROM usf_GetRecursiveFoobar(@para1, @para2, @para3) I got error: Msg 8152, Level 16, State 13, Line 20 String or binary data would be truncated. The statement has been terminated. Why? What to do about it?

    Read the article

  • How to access Youtube_it ruby query results?

    - by spectro
    I am trying to implement the youtube_it youtube api wrapper for ruby and have it working except I'm stumped as to how the query results should be accessed. Here is my query: client.videos_by(:query => "penguin", :max_results => 1) Submitting request [url=http://gdata.youtube.com/feeds/api/videos?max-results=1&start-index=1&vq=penguin]. => #<YouTubeIt::Response::VideoSearch:0xb6c41b14 @feed_id="http://gdata.youtube.com/feeds/api/videos", @updated_at=Wed Nov 03 18:01:39 UTC 2010, @videos=[#<YouTubeIt::Model::Video:0xb6c424d8 @thumbnails=[#<YouTubeIt::Model::Thumbnail:0xb6c6b694 @url="http://i.ytimg.com/vi/oSbLpQEZP1Y/2.jpg", @width=120, @height=90, @time="00:01:34">, #<YouTubeIt::Model::Thumbnail:0xb6c6b248 @url="http://i.ytimg.com/vi/oSbLpQEZP1Y/1.jpg", @width=120, @height=90, @time="00:00:47">, #<YouTubeIt::Model::Thumbnail:0xb6c6a988 @url="http://i.ytimg.com/vi/oSbLpQEZP1Y/3.jpg", @width=120, @height=90, @time="00:02:21">, #<YouTubeIt::Model::Thumbnail:0xb6c69e34 @url="http://i.ytimg.com/vi/oSbLpQEZP1Y/0.jpg", @width=320, @height=240, @time="00:01:34">], @categories=[#<YouTubeIt::Model::Category:0xb6ca5d6c @term="Music", @label="Music">], @noembed=false, @racy=false, @favorite_count=7862, @duration=188, @author=#<YouTubeIt::Model::Author:0xb6c9942c @name="wili", @uri="http://gdata.youtube.com/feeds/api/users/wili">, @updated_at=Tue Nov 02 08:45:25 UTC 2010, @longitude=nil, @position=nil, @view_count=1682350, @html_content="penguin", @media_content=[#<YouTubeIt::Model::Content:0xb6c770d4 @url="http://www.youtube.com/v/oSbLpQEZP1Y?f=videos&app=youtube_gdata", @duration=188, @format=#<YouTubeIt::Model::Video::Format:0xb656d108 @name=:swf, @format_code=5>, @default=true, @mime_type="application/x-shockwave-flash">, #<YouTubeIt::Model::Content:0xb6c766d4 @url="rtsp://v5.cache3.c.youtube.com/CiILENy73wIaGQlWPxkBpcsmoRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp", @duration=188, @format=#<YouTubeIt::Model::Video::Format:0xb656d11c @name=:rtsp, @format_code=1>, @default=false, @mime_type="video/3gpp">, #<YouTubeIt::Model::Content:0xb6c75d38 @url="rtsp://v8.cache3.c.youtube.com/CiILENy73wIaGQlWPxkBpcsmoRMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp", @duration=188, @format=#<YouTubeIt::Model::Video::Format:0xb656d0f4 @name=:three_gpp, @format_code=6>, @default=false, @mime_type="video/3gpp">], @description="penguin", @latitude=nil, @title="penguin", @published_at=Mon May 08 18:11:01 UTC 2006, @player_url="http://www.youtube.com/watch?v=oSbLpQEZP1Y&feature=youtube_gdata_player", @rating=#<YouTubeIt::Model::Rating:0xb6c5eb4c @min=1, @max=5, @average=4.676985, @rater_count=2746>, @keywords=["pigloo", "penguin"], @video_id="http://gdata.youtube.com/feeds/api/videos/oSbLpQEZP1Y", @where=nil>], @total_result_count=291282, @offset=1, @max_result_count=1> I would like to retrieve the URL and thumbnail links. Any ideas?

    Read the article

  • Exec problem in SQL Server 2005

    - by IordanTanev
    Hi, I have the situation where i have two databases with same structure. The first have some data in its data tables. I need to create a script that will transfer the data from the first database to the second. I have created this script. DECLARE @table_name nvarchar(MAX), @query nvarchar(MAX) DECLARE @table_cursor CURSOR SET @table_cursor = CURSOR FAST_FORWARD FOR SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES OPEN @table_cursor FETCH NEXT FROM @table_cursor INTO @table_name WHILE @@FETCH_STATUS = 0 BEGIN SET @query = 'INSERT INTO ' + @table_name + ' SELECT * FROM MyDataBase.dbo.' + @table_name print @query exec @query FETCH NEXT FROM @table_cursor INTO @table_name END CLOSE @table_cursor DEALLOCATE @table_cursor The problem is that when I run the script the "print @query" statement prints statement like this INSERT INTO table SELECT * FROM MyDataBase.dbo.table When I copy this and run it from Management studio it works fine. But when the script tries to run it with exec I get this error Msg 911, Level 16, State 1, Line 21 Could not locate entry in sysdatabases for database 'INSERT INTO table SELECT * FROM MPDEV090314'. No entry found with that name. Make sure that the name is entered correctly. Hope someone can tell me whot is wront with this. Best Regards, Iordan Tanev

    Read the article

  • Increment non unique field during SQL insert

    - by phill
    I'm not sure how to word this cause I am a little confused at the moment, so bare with me while I attempt to explain, I have a table with the following fields: OrderLineID, OrderID, OrderLine, and a few other unimportant ones. OrderLineID is the primary key and is always unique(which isn't a problem), OrderID is a foreign key that isn't unique(also not a problem), and OrderLine is a value that is not unique in the table, but should be unique for any OrderIDs that are the same...so if that didn't make sense, perhaps a picture OrderLineID, OrderID, OrderLine 1 1 1 2 1 2 3 1 3 4 2 1 5 2 2 For all OrderIDs there is a unique OrderLine. I am trying to create an insert statement that gets the max OrderLine value for a specific OrderId so I can increment it, but it's not working so well and I could use a little help. What I have right now is below, I build the sql statement in a program and replace OrderID # with an actual value. I am pretty sure the problem is with the nested select statement, and incrementing the result, but I can't find any examples that do this since my google skills are weak apparently.... INSERT INTO tblOrderLine (OrderID, OrderLine) VALUES (<OrderID #>, (SELECT MAX(OrderLine) FROM tblOrderLine WHERE orderID = <same OrderID #>)+1) any help would be nice.

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >