Search Results

Search found 438 results on 18 pages for 'c2 0'.

Page 15/18 | < Previous Page | 11 12 13 14 15 16 17 18  | Next Page >

  • maps, iterators, and complex structs - STL errors

    - by Austin Hyde
    So, I have two structs: struct coordinate { float x; float y; } struct person { int id; coordinate location; } and a function operating on coordinates: float distance(const coordinate& c1, const coordinate& c2); In my main method, I have the following code: map<int,person> people; // populate people map<int,map<float,int> > distance_map; map<int,person>::iterator it1,it2; for (it1=people.begin(); it1!=people.end(); ++it1) { for (it2=people.begin(); it2!=people.end(); ++it2) { float d = distance(it1->second.location,it2->second.location); distance_map[it1->first][d] = it2->first; } } However, I get the following error upon build: stl_iterator_base_types.h: In instantiation of ‘std::iterator_traits<coordinate>’: stl_iterator_base_types.h:129: error: no type named ‘iterator_category’ in ‘struct coordinate’ stl_iterator_base_types.h:130: error: no type named ‘value_type’ in ‘struct coordinate’ stl_iterator_base_types.h:131: error: no type named ‘difference_type’ in ‘struct coordinate’ stl_iterator_base_types.h:132: error: no type named ‘pointer’ in ‘struct coordinate’ stl_iterator_base_types.h:133: error: no type named ‘reference’ in ‘struct coordinate’ And it blames it on the line: float d = distance(it1->second.location,it2->second.location); Why does the STL complain about my code?

    Read the article

  • Problem with MessageContract, Generic return types and clientside naming

    - by Soeteman
    I'm building a web service which uses MessageContracts, because I want to add custom fields to my SOAP header. In a previous topic, I learned that a composite response has to be wrapped. For this purpose, I devised a generic ResponseWrapper class. [MessageContract(WrapperNamespace = "http://mynamespace.com", WrapperName="WrapperOf{0}")] public class ResponseWrapper<T> { [MessageBodyMember(Namespace = "http://mynamespace.com")] public T Response { get; set; } } I made a ServiceResult base class, defined as follows: [MessageContract(WrapperNamespace = "http://mynamespace.com")] public class ServiceResult { [MessageBodyMember] public bool Status { get; set; } [MessageBodyMember] public string Message { get; set; } [MessageBodyMember] public string Description { get; set; } } To be able to include the request context in the response, I use a derived class of ServiceResult, which uses generics: [MessageContract(WrapperNamespace = "http://mynamespace.com", WrapperName = "ServiceResultOf{0}")] public class ServiceResult<TRequest> : ServiceResult { [MessageBodyMember] public TRequest Request { get; set; } } This is used in the following way [OperationContract()] ResponseWrapper<ServiceResult<HCCertificateRequest>> OrderHealthCertificate(RequestContext<HCCertificateRequest> context); I expected my client code to be generated as ServiceResultOfHCCertificateRequest OrderHealthCertificate(RequestContextOfHCCertificateRequest context); Instead, I get the following: ServiceResultOfHCCertificateRequestzSOTD_SSj OrderHealthCertificate(CompType1 c1, CompType2 c2, HCCertificateRequest context); CompType1 and CompType2 are properties of the RequestContext class. The problem is that a hash is added to the end of ServiceResultOfHCCertificateRequestzSOTD_SSj. How do I need define my generic return types in order for the client type to be generated as expected (without the hash)?

    Read the article

  • Setting the comment of a column to that of another column in Postgresql

    - by dland
    Suppose I create a table in Postgresql with a comment on a column: create table t1 ( c1 varchar(10) ); comment on column t1.c1 is 'foo'; Some time later, I decide to add another column: alter table t1 add column c2 varchar(20); I want to look up the comment contents of the first column, and associate with the new column: select comment_text from (what?) where table_name = 't1' and column_name = 'c1' The (what?) is going to be a system table, but after having looked around in pgAdmin and searching on the web I haven't learnt its name. Ideally I'd like to be able to: comment on column t1.c1 is (select ...); but I have a feeling that's stretching things a bit far. Thanks for any ideas. Update: based on the suggestions I received here, I wound up writing a program to automate the task of transferring comments, as part of a larger process of changing the datatype of a Postgresql column. You can read about that on my blog.

    Read the article

  • Changing Positions of the Chart When Creating Multiple Charts Automatically via Vbasic in Excel 2007

    - by McVey
    I am creating a new chart for each row of data in an Excel spreadsheet. I have the Vbasic working properly, but I want to change the position of the chart on the sheet that is added for each row. Below is my code, what do I need to do to change the position of the chart on the page automatically? Ideally, I would like it to be in the upper left hand corner of each sheet. Sub DrawCharts() Dim Ws As Worksheet Dim NewWs As Worksheet Dim cht As Chart Dim LastRow As Long Dim CurrRow As Long Set Ws = ThisWorkbook.Worksheets("Sheet1") LastRow = Ws.Range("A65536").End(xlUp).Row For CurrRow = 2 To LastRow Set NewWs = ThisWorkbook.Worksheets.Add NewWs.Name = Ws.Range("A" & CurrRow).Value Set cht = ThisWorkbook.Charts.Add With cht .ChartType = xl3DColumnClustered .SeriesCollection.NewSeries .SeriesCollection(1).Values = "=" & Ws.Name & "!R" & CurrRow & "C3:R" & CurrRow & "C8" .SeriesCollection(1).Name = "=" & Ws.Name & "!R" & CurrRow & "C2" .SeriesCollection(1).XValues = "Sheet1!R1C3:R1C8" .Axes(xlValue).MinimumScale = 0 .Axes(xlValue).MaximumScale = 1 .Axes(xlValue).MajorUnit = 0.2 .SetElement (msoElementDataLabelShow) .SetElement (msoElementLegendNone) .Location Where:=xlLocationAsObject, Name:=NewWs.Name End With Next CurrRow End Sub Any help is appreciated.

    Read the article

  • Java - abstract class, equals(), and two subclasses

    - by msr
    Hello, I have an abstract class named Xpto and two subclasses that extend it named Person and Car. I have also a class named Test with main() and a method foo() that verifies if two persons or cars (or any object of a class that extends Xpto) are equals. Thus, I redefined equals() in both Person and Car classes. Two persons are equal when they have the same name and two cars are equal when they have the same registration. However, when I call foo() in the Test class I always get "false". I understand why: the equals() is not redefined in Xpto abstract class. So... how can I compare two persons or cars (or any object of a class that extends Xpto) in that foo() method? In summary, this is the code I have: public abstract class Xpto { } public class Person extends Xpto{ protected String name; public Person(String name){ this.name = name; } public boolean equals(Person p){ System.out.println("Person equals()?"); return this.name.compareTo(p.name) == 0 ? true : false; } } public class Car extends Xpto{ protected String registration; public Car(String registration){ this.registration = registration; } public boolean equals(Car car){ System.out.println("Car equals()?"); return this.registration.compareTo(car.registration) == 0 ? true : false; } } public class Teste { public static void foo(Xpto xpto1, Xpto xpto2){ if(xpto1.equals(xpto2)) System.out.println("xpto1.equals(xpto2) -> true"); else System.out.println("xpto1.equals(xpto2) -> false"); } public static void main(String argv[]){ Car c1 = new Car("ABC"); Car c2 = new Car("DEF"); Person p1 = new Person("Manel"); Person p2 = new Person("Manel"); foo(p1,p2); } }

    Read the article

  • Run-time error'9' subscript out of range

    - by Chris
    The error occurs when I rename the file. I need to be able to the macro automatically recognise the change in the file name and apply it to the macro. Is there any way to do this without having to manually change it each time which will no work for what I need this to do Sub OccurenceSort() ' ' OccurenceSort Macro ' Macro recorded 4/9/2010 by Chris Greenlee ' ' Keyboard Shortcut: Ctrl+o ' Sheets("Occurences").Select Range("A1:D58").Select Range("D58").Activate Selection.Sort Key1:=Range("B2"), Order1:=xlDescending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Sheets("Chart").Select ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.PlotArea.Select ActiveChart.ChartArea.Select ActiveChart.SeriesCollection(1).Values = "=Occurences!R2C2:R12C2" End Sub Sub OccurenceByValue() ' ' OccurenceByValue Macro ' Macro recorded 4/9/2010 by Chris Greenlee ' ' Keyboard Shortcut: Ctrl+v ' ActiveWindow.Visible = False Windows("QA Project - Automated Charts v1.1.xls").Activate Sheets("Occurences").Select Range("A1:D58").Select Range("D58").Activate Selection.Sort Key1:=Range("C2"), Order1:=xlDescending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Sheets("Chart").Select ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Values = "=Occurences!R2C3:R12C3" End Sub Sub OccurencesByPercentIncreaseToScore() ' ' OccurencesByPercentIncreaseToScore Macro ' Macro recorded 4/9/2010 by Chris Greenlee ' ' Keyboard Shortcut: Ctrl+p ' ActiveWindow.Visible = False Windows("QA Project - Automated Charts v1.1.xls").Activate Sheets("Occurences").Select Range("A1:D58").Select Range("D58").Activate Selection.Sort Key1:=Range("D2"), Order1:=xlDescending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Sheets("Chart").Select ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Values = "=Occurences!R2C4:R12C4" End Sub The problem occurs with this line Windows("QA Project - Automated Charts v1.1.xls").Activate

    Read the article

  • Reading and writing XML over an SslStream

    - by Mark
    I want to read and write XML data over an SslStream. The data (written and read) consists of objects serialized by an XmlSerializer. I have tried the following; (left some details out for clarity!) TcpClient tcpClient = new TcpClient(server, port); SslStream sslStream = new SslStream(tcpClient.GetStream(), true, new RemoteCertificateValidationCallback(ValidateServerCertificate), null); sslStream.AuthenticateAsClient(server); XmlReader xmlReader = XmlReader.Create(sslStream,readerSettings); XmlWriter xmlWriter = XmlWriter.Create(sslStream,writerSettings); myClass c = new myClass (); XmlSerializer serializer = new XmlSerializer(typeof(myClass)); serializer.Serialize(xmlWriter, c); myClass c2 = (myClass )serializer.Deserialize(xmlReader); First of all, it appears that writing to the stream succeeds. But the XmlSerializer throws an error because of invalid XML. It appears that the first character read from the stream is '00' or a null-character. (I have googled this problem, and see a million people with the same 'problem', but no viable solution.) I can work around this 'issue' by using a StreamReader, read everything into a string and then use that string as input for another stream that the serializer can use. (Very dirty, but it works.) Second problem is, that when I try to use the same SslStream to write a second request, I do not get a response from the Reader. (The server DOES send a valid XML response though!) So the serializer.Serialize(xmlWriter, c3) works, but reading from the stream yields no results. I have tried several different classes that implement Stream. (StreamReader, XmlTextReader, etc.) Anyone has an idea how reading and writing XML data to and from an SslStream is supposed to work? Thanks in advance!

    Read the article

  • Cursor on Path doesn't appear in SilverLight

    - by Rahul Soni
    I am trying to draw a circle with a glass effect using Alpha. I am successful in creating that by using the below XAML. The cursor changes to Hand for the Ellipses, but it doesn't affect Path. Basically, I want to show "hand" cursor wherever the mouse appears over the circle. I hope this is not a known issue and I am missing something small. Any help is really appreciated. <Ellipse Cursor="Hand" Width="200" Height="200" Fill="#C42222" Canvas.Left="0" Canvas.Top="0" /> <Ellipse Cursor="Hand" Width="200" Height="200" Canvas.Left="0" Canvas.Top="0"> <Ellipse.Fill> <RadialGradientBrush GradientOrigin="0.3,0.7"> <GradientStop Offset="0" Color="#00000000" /> <GradientStop Offset="1" Color="#66000000" /> </RadialGradientBrush> </Ellipse.Fill> </Ellipse> <Path Cursor="Hand" Stretch="Fill" Height="114.598" Width="198.696" Data="M98.388435,-1.3301961 C98.388435,-1.3301961 117.1151,-3.094949 141.69321,8.1370029 C156.42262,14.868201 167.67375,23.694145 175.66234,33.657074 C183.67349,43.648144 181.90166,37.8708 191.90166,58.8708 C201.90166,79.870796 199.16658,89.212738 199.13568,92.90377 C198.77556,135.92146 175.45959,97.59124 156.75465,81.024025 C140.98892,67.060104 117.41241,64.357407 114.41241,64.357407 C111.4124,64.357407 83.061241,60.114159 63.061195,71.114143 C43.061146,82.114136 39.637829,86.429352 22.999804,100.99996 C6.5005584,115.44904 2.9997537,112.99996 2.9997537,112.99996 C2.9997537,112.99996 -1.1832786,97.194221 1.9997513,81.999893 C7.2054667,57.150185 13.999762,47.999939 17.999771,42.999943 C21.999781,37.99995 29.935833,23.400871 54.053131,10.21261 C78.91642,-3.3835876 98.388435,-1.3301961 98.388435,-1.3301961 z"> <Path.Fill> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#55FFFFFF" Offset="0"/> <GradientStop Color="#11FFFFFF" Offset="0.5"/> <GradientStop Color="#00FFFFFF" Offset="1"/> </LinearGradientBrush> </Path.Fill> </Path>

    Read the article

  • Solving Naked Triples in Sudoku

    - by Kave
    Hello, I wished I paid more attention to the math classes back in Uni. :) How do I implement this math formula for naked triples? Naked Triples Take three cells C = {c1, c2, c3} that share a unit U. Take three numbers N = {n1, n2, n3}. If each cell in C has as its candidates ci ? N then we can remove all ni ? N from the other cells in U.** I have a method that takes a Unit (e.g. a Box, a row or a column) as parameter. The unit contains 9 cells, therefore I need to compare all combinations of 3 cells at a time that from the box, perhaps put them into a stack or collection for further calculation. Next step would be taking these 3-cell-combinations one by one and compare their candidates against 3 numbers. Again these 3 numbers can be any possible combination from 1 to 9. Thats all I need. But how would I do that? How many combinations would I get? Do I get 3 x 9 = 27 combinations for cells and then the same for numbers (N)? How would you solve this in classic C# loops? No Lambda expression please I am already confused enough :) Many Thanks for any help,

    Read the article

  • BitShifting with BigIntegers in Java

    - by ThePinkPoo
    I am implementing DES Encryption in Java with use of BigIntegers. I am left shifting binary keys with Java BigIntegers by doing the BigInteger.leftShift(int n) method. Key of N (Kn) is dependent on the result of the shift of Kn-1. The problem I am getting is that I am printing out the results after each key is generated and the shifting is not the expected out put. The key is split in 2 Cn and Dn (left and right respectively). I am specifically attempting this: "To do a left shift, move each bit one place to the left, except for the first bit, which is cycled to the end of the block. " It seems to tack on O's on the end depending on the shift. Not sure how to go about correcting this. Results: c0: 11110101010100110011000011110 d0: 11110001111001100110101010100 c1: 111101010101001100110000111100 d1: 111100011110011001101010101000 c2: 11110101010100110011000011110000 d2: 11110001111001100110101010100000 c3: 1111010101010011001100001111000000 d3: 1111000111100110011010101010000000 c4: 111101010101001100110000111100000000 d4: 111100011110011001101010101000000000 c5: 11110101010100110011000011110000000000 d5: 11110001111001100110101010100000000000 c6: 1111010101010011001100001111000000000000 d6: 1111000111100110011010101010000000000000 c7: 111101010101001100110000111100000000000000 d7: 111100011110011001101010101000000000000000 c8: 1111010101010011001100001111000000000000000 d8: 1111000111100110011010101010000000000000000 c9: 111101010101001100110000111100000000000000000 d9: 111100011110011001101010101000000000000000000 c10: 11110101010100110011000011110000000000000000000 d10: 11110001111001100110101010100000000000000000000 c11: 1111010101010011001100001111000000000000000000000 d11: 1111000111100110011010101010000000000000000000000 c12: 111101010101001100110000111100000000000000000000000 d12: 111100011110011001101010101000000000000000000000000 c13: 11110101010100110011000011110000000000000000000000000 d13: 11110001111001100110101010100000000000000000000000000 c14: 1111010101010011001100001111000000000000000000000000000 d14: 1111000111100110011010101010000000000000000000000000000 c15: 11110101010100110011000011110000000000000000000000000000 d15: 11110001111001100110101010100000000000000000000000000000

    Read the article

  • How to bind an ADF Table on button click

    - by Juan Manuel Formoso
    Coming from ASP.NET I'm having a hard time with basic ADF concepts. I need to bind a table on a button click, and for some reason I don't understand (I'm leaning towards page life cycle, which I guess is different from ASP.NET) it's not working. This is my ADF code: <af:commandButton text="#{viewcontrollerBundle.CMD_SEARCH}" id="cmdSearch" action="#{backingBeanScope.indexBean.cmdSearch_click}" partialSubmit="true"/> <af:table var="row" rowBandingInterval="0" id="t1" value="#{backingBeanScope.indexBean.transactionList}" partialTriggers="::cmdSearch" binding="#{backingBeanScope.indexBean.table}"> <af:column sortable="false" headerText="idTransaction" id="c2"> <af:outputText value="#{row.idTransaction}" id="ot4"/> </af:column> <af:column sortable="false" headerText="referenceCode" id="c5"> <af:outputText value="#{row.referenceCode}" id="ot7"/> </af:column> </af:table> This is cmdSearch_click: public String cmdSearch_click() { List l = new ArrayList(); Transaction t = new Transaction(); t.setIdTransaction(BigDecimal.valueOf(1)); t.setReferenceCode("AAA"); l.add(t); t = new Transaction(); t.setIdTransaction(BigDecimal.valueOf(2)); t.setReferenceCode("BBB"); l.add(t); setTransactionList(l); // AdfFacesContext.getCurrentInstance().addPartialTarget(table); return null; } The commented line also doesn't work. If I populate the list on my Bean's constructor, the table renders ok. Any ideas?

    Read the article

  • Exception on inserting into Access 2010 in C Sharp

    - by slao.it
    Hello, I am getting this exception when inserting into a Access 2010 database. Ex: System.Data.OleDb.OleDbException (0x80040E14): Syntax error in string in query expression ''CityName ?'. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at ReadingData.Program.Main(String[] args) in C:\Users\user\documents\visual studio 2010\Projects\ReadingData\ReadingData\Program.cs:line 238 INSERT INTO CranbrookMain (ID,BlockNo,Plot,SubPlot,Code,Type,LastName,FirstName,ServiceHome,ServiceAddress,ServiceCity,Notes) VALUES ('1','Y','37','DS','C2','O','SMITH','John','Service Inc.','520B SLATER ROAD N.W.','CityName','CityName ? ') insertSQL = "INSERT INTO CranbrookMain (ID,BlockNo,Plot,SubPlot,Code,Type,LastName," + "FirstName,ServiceHome,ServiceAddress,ServiceCity,Notes) VALUES (" + "'"+id+ "','" + blockNo + "','" + plot + "','" + subPlot + "','" + code + "','" + type + "','" + lastname + "','" + firstname + "','" + serviceHome + "','" + serviceAddress + "','" + serviceCity + "','" + notes +"')"; Console.WriteLine(); OleDbCommand cmd = new OleDbCommand(insertSQL, con); // creating query command cmd.ExecuteNonQuery(); The error occurs in cmd.ExecuteNonQuery() function call. The above SQL INSERT statement works fine if I directly execute in the Access 2010 file.

    Read the article

  • Concatenate CLOB-rows with PL/SQL

    - by david K
    Hi, I've got a table which has an id and a clob content like: Create Table v_example_l ( nip number, xmlcontent clob ); We insert our data: Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>delta</name><content>548484646846484</content></block></section>'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>omega</name><content>545648468484</content></block></section>'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>gamma</name><content>54564846qsdqsdqsdqsd8484</content></block></section>'); I'm trying to do a function that concatenates the rows of the clob that gone be the result of a select, i mean without having to give multiple parameter about the name of table or such, i should only give here the column that contain the clobs, and it should handle the rest. CREATE OR REPLACE function assemble_clob(q varchar2) return clob is v_clob clob; tmp_lob clob; hold VARCHAR2(4000); --cursor c2 is select xmlcontent from V_EXAMPLE_L where id=17852 cur sys_refcursor; begin OPEN cur FOR q; LOOP FETCH cur INTO tmp_lob; EXIT WHEN cur%NOTFOUND; --v_clob := v_clob || XMLTYPE.getClobVal(tmp_lob.xmlcontent); v_clob := v_clob || tmp_lob; END LOOP; return (v_clob); --return (dbms_xmlquery.getXml( dbms_xmlquery.set_context("Select 1 from dual")) ) end assemble_clob; The function is broken... (if anybody could give me a help, thanks a lot, and i'm noob in sql so ....). Thanks!

    Read the article

  • OpenGL Calls Lock/Freeze

    - by Necrolis
    I am using some dell workstations(running WinXP Pro SP 2 & DeepFreeze) for development, but something was recenlty loaded onto these machines that prevents any opengl call(the call locks) from completing(and I know the code works as I have tested it on 'clean' machines, I also tested with simple opengl apps generated by dev-cpp, which will also lock on the dell machines). I have tried to debug my own apps to see where exactly the gl calls freeze, but there is some global system hook on ZwQueryInformationProcess that messes up calls to ZwQueryInformationThread(used by ExitThread), preventing me from debugging at all(it causes the debugger, OllyDBG, to go into an access violation reporting loop or the program to crash if the exception is passed along). the hook: ntdll.ZwQueryInformationProcess 7C90D7E0 B8 9A000000 MOV EAX,9A 7C90D7E5 BA 0003FE7F MOV EDX,7FFE0300 7C90D7EA FF12 CALL DWORD PTR DS:[EDX] 7C90D7EC - E9 0F28448D JMP 09D50000 7C90D7F1 9B WAIT 7C90D7F2 0000 ADD BYTE PTR DS:[EAX],AL 7C90D7F4 00BA 0003FE7F ADD BYTE PTR DS:[EDX+7FFE0300],BH 7C90D7FA FF12 CALL DWORD PTR DS:[EDX] 7C90D7FC C2 1400 RETN 14 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C the messed up function + call: ntdll.ZwQueryInformationThread 7C90D7F0 8D9B 000000BA LEA EBX,DWORD PTR DS:[EBX+BA000000] 7C90D7F6 0003 ADD BYTE PTR DS:[EBX],AL 7C90D7F8 FE ??? ; Unknown command 7C90D7F9 7F FF JG SHORT ntdll.7C90D7FA 7C90D7FB 12C2 ADC AL,DL 7C90D7FD 14 00 ADC AL,0 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C So firstly, anyone know what if anything would lead to OpenGL calls cause an infinite lock,and if there are any ways around it? and what would be creating such a hook in kernal memory ? Update: After some more fiddling, I have discovered a few more kernal hooks, a lot of them are used to nullify data returned by system information calls(such as the remote debugging port), I also managed to find out the what ever is doing this is using madchook.dll(by madshi) to do this, this dll is also injected into every running process(these seem to be some anti debugging code). Also, on the OpenGL side, it seems Direct X is fine/unaffected(I ran one of the DX 9 demo's without problems), so could one of these kernal hooks somehow affect OpenGL?

    Read the article

  • IEnumerable.Cast not calling cast overload

    - by Martin Neal
    I'm not understanding something about the way .Cast works. I have an explicit (though implicit also fails) cast defined which seems to work when I use it "regularly", but not when I try to use .Cast. Why? Here is some compilable code that demonstrates my problem. public class Class1 { public string prop1 { get; set; } public int prop2 { get; set; } public static explicit operator Class2(Class1 c1) { return new Class2() { prop1 = c1.prop1, prop2 = c1.prop2 }; } } public class Class2 { public string prop1 { get; set; } public int prop2 { get; set; } } void Main() { Class1[] c1 = new Class1[] { new Class1() {prop1 = "asdf",prop2 = 1}}; //works Class2 c2 = (Class2)c1[0]; //doesn't work: Compiles, but throws at run-time //InvalidCastException: Unable to cast object of type 'Class1' to type 'Class2'. Class2 c3 = c1.Cast<Class2>().First(); }

    Read the article

  • deserialize system.outofmemoryexception

    - by clanier9
    I've got a serializeable class called Cereal with several public fields shown here <Serializable> Public Class Cereal Public id As Integer Public cardType As Type Public attacker As String Public defender As String Public placedOn As String Public attack As Boolean Public placed As Boolean Public played As Boolean Public text As String Public Sub New() End Sub End Class My client computer is sending a new Cereal to the host by serializing it shown here 'sends data to host stream (c1) Private Sub cSendText(ByVal Data As String) Dim bf As New BinaryFormatter Dim c As New Cereal c.text = Data bf.Serialize(mobjClient.GetStream, c) End Sub The host listens to the stream for activity and when something gets put on it, it is supposed to deserialize it to a new Cereal shown here 'accepts data sent from the client, raised when data on host stream (c2) Private Sub DoReceive(ByVal ar As IAsyncResult) Dim intCount As Integer Try 'find how many byte is data SyncLock mobjClient.GetStream intCount = mobjClient.GetStream.EndRead(ar) End SyncLock 'if none, we are disconnected If intCount < 1 Then RaiseEvent Disconnected(Me) Exit Sub End If Dim bf As New BinaryFormatter Dim c As New Cereal c = CType(bf.Deserialize(mobjClient.GetStream), Cereal) If c.text.Length > 0 Then RaiseEvent LineReceived(Me, c.text) Else RaiseEvent CardReceived(Me, c) End If 'starts listening for action on stream again SyncLock mobjClient.GetStream mobjClient.GetStream.BeginRead(arData, 0, 1024, AddressOf DoReceive, Nothing) End SyncLock Catch e As Exception RaiseEvent Disconnected(Me) End Try End Sub when the following line executes, I get a System.OutOfMemoryException and I cannot figure out why this isn't working. c = CType(bf.Deserialize(mobjClient.GetStream), Cereal) The stream is a TCPClient stream. I'm new to serialization/deserialization and using visual studio 11

    Read the article

  • What function does .NET NPV() use? Doesn't match manual calculations

    - by Matthew PK
    I am using the NPV() function in VB.NET to get NPV for a set of cash flows. However, the result of NPV() is not consistent with my results performing the calculation manually (nor the Investopedia NPV calc... which matches my manual results) My correct manual results and the NPV() results are close, within 5%.. but not the same... Manually, using the NPV formula: NPV = C0 + C1/(1+r)^1 + C2/(1+r)^2 + C3/(1+r)^3 + .... + Cn/(1+r)^n The manual result is stored in RunningTotal With rate r = 0.04 and period n = 10 Here is my relevant code: EDIT: Do I have OBOB somewhere? YearCashOutFlow = CDbl(TxtAnnualCashOut.Text) YearCashInFlow = CDbl(TxtTotalCostSave.Text) YearCount = 1 PAmount = -1 * (CDbl(TxtPartsCost.Text) + CDbl(TxtInstallCost.Text)) RunningTotal = PAmount YearNPValue = PAmount AnnualRateIncrease = CDbl(TxtUtilRateInc.Text) While AnnualRateIncrease > 1 AnnualRateIncrease = AnnualRateIncrease / 100 End While AnnualRateIncrease = 1 + AnnualRateIncrease ' ZERO YEAR ENTRIES ListBoxNPV.Items.Add(Format(PAmount, "currency")) ListBoxCostSave.Items.Add("$0.00") ListBoxIRR.Items.Add("-100") ListBoxNPVCum.Items.Add(Format(PAmount, "currency")) CashFlows(0) = PAmount '''' Do While YearCount <= CInt(TxtLifeOfProject.Text) ReDim Preserve CashFlows(YearCount) CashFlows(YearCount) = Math.Round(YearCashInFlow - YearCashOutFlow, 2) If CashFlows(YearCount) > 0 Then OnePos = True YearNPValue = CashFlows(YearCount) / (1 + DiscountRate) ^ YearCount RunningTotal = RunningTotal + YearNPValue ListBoxNPVCum.Items.Add(Format(Math.Round(RunningTotal, 2), "currency")) ListBoxCostSave.Items.Add(Format(YearCashInFlow, "currency")) If OnePos Then ListBoxIRR.Items.Add((IRR(CashFlows, 0.1)).ToString) ListBoxNPV.Items.Add(Format(NPV(DiscountRate, CashFlows), "currency")) Else ListBoxIRR.Items.Add("-100") ListBoxNPV.Items.Add(Format(RunningTotal, "currency")) End If YearCount = YearCount + 1 YearCashInFlow = AnnualRateIncrease * YearCashInFlow Loop

    Read the article

  • SSL over TDS, SQL Server 2005 Express

    - by reuvenab
    I capture packets sent/received by Win Xp machine when connecting to SQL Server 2005 Express using TLS encryption. Server and Client exchange Hello messages Server and Client send ChangeCipherSpec message Then Server and Client server send strange message that is not described in TLS protocol What is the message and if SSL over TDS is standard compliant at all? Server side capture: 16 **SSL Handshake** 03 01 00 4a 02 ServerHello 00 00 46 03 01 4b dd 68 59 GMT 33 13 37 98 10 5d 57 9d ff 71 70 dc d6 6f 9e 2c Random[00..13] cb 96 c0 2e b3 2f 9b 74 67 05 cc 96 Random[14..27] 20 72 26 00 00 0f db 7f d9 b0 51 c2 4f cd 81 4c Session ID 3f e3 d2 d1 da 55 c0 fe 9b 56 b7 6f 70 86 fe bb Session ID 54 Session ID 00 04 Cipher Suite 00 Compression 14 03 01 00 01 01 **ChangeCipherSpec** 16 03 01 ???? Finished ??? 00 20 d0 da cc c4 36 11 43 ff 22 25 8a e1 38 2b ???? ??? 71 ce f3 59 9e 35 b0 be b2 4b 1d c5 21 21 ce 41 ???? ??? 8e 24

    Read the article

  • dynamically created controls and postback

    - by Mark
    Hi all, I have created dynamic controls (Radiobuttonlists) in an asp.net page (c#). I create them after a button click like this. RadioButtonList rbl = new RadioButtonList(); c2.Controls.Add(rbl); //Set properties of rbl rbl.RepeatLayout = RepeatLayout.Flow; rbl.ID = string.Format("rbl{0}", item.QuestionID); rbl.RepeatDirection = RepeatDirection.Horizontal; rbl.Items.Add(new ListItem("True", "1")); rbl.Items.Add(new ListItem("False", "0")); rbl.Items.Add(new ListItem("?", "-1")); Now the problem arises when I click the submit button, the controls are lost. I know it's better to actually put the controls in page_init event. but is there no workaround so I can still initiate my controls after button click? And is it good to first create button, then add it to control collection and then set its properties? Thankd in advance Kind regards, Mark

    Read the article

  • SQL Server stored procedure + set error message from the records of a table

    - by lucky
    Hello, My question is I have a table with the set of records. I am calling a stored procedure for some other purpose. But when ever it finds some duplicate records. It need to return as error message back to php. C1 C2 c3 abc 32 21.03.2010 def 35 04.04.2010 pqr 45 30.03.2010 abc 12 04.05.2010 xyz 56 01.03.2010 ghi 21 06.05.2010 def 47 17.02.2010 klm 93 04.03.2010 xyz 11 01.03.2010 For the above set it need to check for the records that has the same c1. The stored procedure should return as abc,def,xyz are duplicate. I tried something like this. This will not work it has more than 1 set of duplicate records. Please help me to enhance this to solve the purpose. SET @duplicate = (SELECT c1 FROM temp GROUP BY c1 HAVING count(c1) > 1) --Check for duplicate concession Nr. IF(len(@duplicate) > '1') BEGIN SET @error = @error + ' Duplicate C1 Number:- ' + @duplicate SET @errorcount = @errorcount + 1 END As this one type error I am checking for errorcount. IF @errorcount <> '0' BEGIN GOTO E_General_Error END -- If an error occurs, rollback and exit E_General_Error: PRINT 'Error' SET @error = @error IF @@error <> 0 SET @error = 'Database update failed' ROLLBACK TRANSACTION update_database RETURN END Now it is able to return Duplicate c1 number abc. If there are more than 1 problem comes. Thanks in advance!

    Read the article

  • what exactly is this.id ?

    - by kwokwai
    Hi all, I was doing some dynamic effect on DIV using JQuery when I found that the returned value of this.id varied from function to function. I got two sets of simple parent-child DIV tags like this: <DIV ID="row"> <DIV ID="c1"> <Input type="radio" name="testing" id="testing" VALUE="1">testing1 </DIV> </DIV> <DIV ID="row"> <DIV ID="c2"> <Input type="radio" name="testing" id="testing" VALUE="2">testing2 </DIV> </DIV> Code 1. $('#row DIV').mouseover(function(){ radio_btns.each(function() { $('#row DIV).addClass('testing'); // worked }); }); Code 2. $('#row DIV').mouseover(function(){ var childDivID = this.id; radio_btns.each(function() { $('#'+childDivID).parent('DIV').addClass('testing'); // didn't work }); }); I don't understand why only the first code couldn work and highlighted all the "row" DIV, but the first code failed to do so?

    Read the article

  • Java Enumeration of Musical Notes

    - by Crupler
    How would you create an enumeration of the musical notes in Java, with each notes having an octave and then a keyed variable? This is what I have so far... public enum Notes { c, cS, d, dS, e, f, fS, g, gS, a, aS, b; int octave; boolean isPlaying; } So when I access the enums in my code I write something like this... Notes.c.octave = 4; Notes.c.isPlaying = true; Now here is my question: How can I have an isPlaying boolean for each note in each octave? Like so: Notes.c.octave.isPlaying = true; Or would I have to go like: public enum Notes { c1, cS1, d1, dS1, e1, f1, fS1, g1, gS1, a1, aS1, b1 c2, cS2, d2, dS2, e2, f2, fS2, g2, gS2, a2, aS2, b2; etc... boolean isPlaying; } Thank you in advance for taking your time to answer this question!

    Read the article

  • Assigning values to the lable through database depending on listbox values

    - by SurajVitekar
    I want to assign the values of five labels from database regarding to values selected in listbox. The db query returns single column with multiple records. Please help. I'm working with C# 2010 and MS SQL. My current code is: private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { try { String c1, c2; c1 = "NULL"; MessageBox.Show("LB index :"+listBox1.SelectedIndex.ToString()); //p = listBox1.SelectedItem.ToString(); SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=localhost;Initial Catalog=eVoting;Integrated Security=True;Pooling=False"; con.Open(); MessageBox.Show("List bOx sect :"+listBox1.SelectedValue.ToString()); SqlCommand cmd = new SqlCommand("select Firstname from candidates where position ='" + listBox1.SelectedValue.ToString() + "'", con); int index = 0; SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) { if (index == 0) { c1 = reader[index].ToString(); radioButton1.Text = c1; } if (index == 1) { c1 = reader[index].ToString(); radioButton2.Text = c1; } if (index == 2) { c1 = reader[index].ToString(); radioButton3.Text = c1; } if (index == 3) { c1 = reader[index].ToString(); radioButton4.Text = c1; } if (index == 4) { c1 = reader[index].ToString(); radioButton4.Text = c1; } if (index == 5) { c1 = reader[index].ToString(); radioButton5.Text = c1; } MessageBox.Show("c1 :" + c1); index++; } } catch (Exception E) { } }

    Read the article

  • Can you override just part of a control template in silverlight

    - by mattmanser
    Is it possible to change or modify a specific part of a control template without having to recreate the entire control template of the control in the xaml? For example, I was trying to get rid of the border of a textbox, so I could throw together a basic search box with rounded corners (example xaml below). Setting the borderthickness to 0 works fine, until you mouse over the textbox and a pseudo border they added to the control flashes up. If I look at the controltemplate for the textbox, I can even see the visual state is named, but cannot think of how to disable it. Without overriding the control template of the TextBox, how would I stop the Visual State Manager firing the mouse over effect on the TextBox? <Border Background="White" CornerRadius="10" VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="3" BorderBrush="#88000000"> <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Width="200" Margin="5,0,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="16" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Path Height="13" Width="14" Stretch="Fill" Stroke="#FF000000" StrokeThickness="2" Data="M9.5,5 C9.5,7.4852815 7.4852815,9.5 5,9.5 C2.5147185,9.5 0.5,7.4852815 0.5,5 C0.5,2.5147185 2.5147185,0.5 5,0.5 C7.4852815,0.5 9.5,2.5147185 9.5,5 z M8.5,8.4999971 L13.5,12.499997" /> <TextBox GotFocus="TextBox_GotFocus" Background="Transparent" Grid.Column="1" BorderThickness="0" Text="I am searchtext" Margin="5,0,5,0" HorizontalAlignment="Stretch" /> </Grid> </Border>

    Read the article

  • Display data FROM Sheet1 on Sheet2 based on conditional value

    - by Shawn
    Imagine a worksheet with 30 pieces of information, such as: A1= Start Date A2 = End Date A3 = Resource Name A4 = Cost .... A30 = Whatever B1 = 1/1/2010 B2 = 2/15/2010 B3 = Joe Smith B4 = $10,000.00 ... B30 = Blah Blah Now imagine a third column, C. The purpose of the third column is to determine WHICH report that row of data needs to appear in. C1 = Report 1 C2 = Report 1 and Report 2 C3 = Report 4 and Report 7 C4 = Report 1 and Report 5 ... C30 = Report 2 Each report is on Sheets 2, 3, 4, 5 and so on (depending on how many I decide to create). As you can see form my example above, some data may need to appear in multiple reports. For example, the data in Row 3 (Resource Name: Joe Smith) needs to appear in Report 4 and Report 7. That is to say, it needs to DYNAMICALLY appear on two additional worksheets. If I change the values in column C, then the reports need to update automatically. How can I create the worksheets which will serve as the reports such that they only diaplay the rows which have been "flagged" to be displayed in that report? Thanks!

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18  | Next Page >