Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 52/448 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • C# XMLWriter + prevent "/" "<" "<" chars

    - by flurreh
    Hello, I have a xmlWriter and want to write String which containt chars of "/" "<" "" (which are part of the xml syntax and break the xml code). Here is my c# code: public Boolean Initialize(String path) { Boolean result = true; XmlWriterSettings settings = new XmlWriterSettings(); settings.CheckCharacters = true; settings.Encoding = Encoding.UTF8; settings.Indent = true; xmlWriter = XmlWriter.Create(path, settings); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("TestData"); isInitialized = true; return result; } public void WriteProducts(List<Product> productList) { if (isInitialized == true) { foreach (Product product in productList) { xmlWriter.WriteStartElement("Product"); xmlWriter.WriteElementString("Id", product.ProdId); xmlWriter.WriteElementString("Name", product.ProdName); xmlWriter.WriteElementString("GroupId", product.ProdGroup); xmlWriter.WriteElementString("Price", product.ProdPrice.ToString((Consts.FORMATTED_PRICE))); xmlWriter.WriteEndElement(); } } } public void Close() { xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); } The application runs without any errors, but if I look in the xml file, the xml is incomplete because the xmlwriter stops writing the product nodes when a product name contains one of the above mentioned characters. Is there a way to fix this problem?

    Read the article

  • How to understand "if ( obj.length === +obj.length )" Javascript condition statement?

    - by humanityANDpeace
    I have run across a condition statement which I have some difficulties to understand. It looks like (please note the +-sign on the right-hand-side) this: obj.length === +obj.length. Can this condition and its purpose/syntax be explained? Looking at the statement (without knowing it) provokes the impression that it is a dirty hack of some sort, but I am almost certain that underscore.js is rather a well designed library, so there must be a better explanation. Background I found this statement used in some functions of the underscore.js library (underscore.js annotated source). My guesswork is that this condition statement is somehow related to testing for a variable obj to be of Array type? (but I am totally unsure). I have tried to test this using this code. var myArray = [1,2,3]; testResult1 = myArray.length === +myArray.length; console.log( testResult1 ); //prints true var myObject = { foo : "somestring", bar : 123 }; testResult2 = myObject.length === +myObject.length; console.log( testResult2 ); //prints false

    Read the article

  • Syntax for finding structs in multisets - C++

    - by Sarah
    I can't seem to figure out the syntax for finding structs in containers. I have a multiset of Event structs. I'm trying to find one of these structs by searching on its key. I get the compiler error commented below. struct Event { public: bool operator < ( const Event & rhs ) const { return ( time < rhs.time ); } bool operator > ( const Event & rhs ) const { return ( time > rhs.time ); } bool operator == ( const Event & rhs ) const { return ( time == rhs.time ); } double time; int eventID; int hostID; int s; }; typedef std::multiset< Event, std::less< Event > > EventPQ; EventPQ currentEvents; double oldRecTime = 20.0; EventPQ::iterator ceItr = currentEvents.find( EventPQ::key_type( oldRecTime ) ); // no matching function call I've tried a few permutations to no avail. I thought defining the conditional equality operator was going to be enough.

    Read the article

  • How can i test my TSQL syntax?

    - by acidzombie24
    Quick question: How do i get some kind of database to use to test my sql syntax and create basic data. I have Sqlite Code which i'll soon put on a server. I have sql server 2008 installed with visual studio 2010. I tried connecting to the database and had no luck. I also tried using a .mdf file instead thinking its a file and i wont have connectivity issues. Wrong, i still couldnt connect and i used this site to help me (i'm aware its 2005) In that case i used var conn = new SqlConnection(@"Server=.\SQLExpress;AttachDbFilename=C:\dev\src\test\SQL_DB_VS_Test\test.mdf;Database=dbo;Trusted_Connection=Yes;"); exception Unable to open the physical file "C:\dev\src\test\SQL_DB_VS_Test\test.mdf". Operating system error 5: "5(Access is denied.)". Cannot attach the file 'C:\dev\src\test\SQL_DB_VS_Test\test.mdf' as database 'dbo'. with trusted = no i get Login failed for user ''. (What user am i suppose to set...). I created the .mdf with visual studio somehow.

    Read the article

  • INSERT INTO ...SELECT syntax error in join operator

    - by user1477356
    I'm trying to write a shopping basket into a order + orderline in a sql database from C# asp.net. the orderline will contain a ordernumber, total price, productid, quantity etc. for every item in the basket. The order itself will contain the ordernumber as primary key and will be linked to the different lines through it. Everything worked fine yesterday, but now as i tried to use a SELECT command in the insert into statement to get things more dynamic i'm getting the above described syntax error. Does anybody know what's wrong with this statement: INSERT INTO [order] (klant_id,totaalprijs,btw,subtotaal,verzendkosten) SELECT klant.id , SUM(orderregel.totaalprijs) , SUM(orderregel.btw) , SUM(orderregel.totaalprijs) - SUM(orderregel.btw) , 7.50 FROM orderregel INNER JOIN klant ON [order].klant_id = klant.id WHERE klant.username = 'jerry' GROUP BY id; the ordernumber in the "order" table is on autonumber, in the asp codebehind there is a for each which handles the lines being written for every product, there's an index set on 0 outside of this loop and is heightened with 1 every end of it. The executenonquery of the order is only executed once at the beginning of the first loop and the lines are added after with MAX(ordernumber) as ordernumber. I hope i have provided enough information and somebody is capable of helping me. Thanks in advance!

    Read the article

  • Can't see anything wrong with simple code

    - by melee
    Here is my implementation file: using namespace std; #include <iostream> #include <iomanip> #include <string> #include <stack> //line 5 #include "proj05.canvas.h" //----------------Constructor----------------// Canvas::Canvas() //line 10 { Title = ""; Nrow = 0; Ncol = 0; image[][]; // line 15 PixelCoordinates.r = 0; PixelCoordinates.c = 0; } //-------------------Paint------------------// line 20 void Canvas::Paint(int R, int C, char Color) { cout << "Paint to be implemented" << endl; } The errors I'm getting are these: proj05.canvas.cpp: In function 'std::istream& operator>>(std::istream&, Canvas&)': proj05.canvas.cpp:11: error: expected `;' before '{' token proj05.canvas.cpp:22: error: a function-definition is not allowed here before '{' token proj05.canvas.cpp:24: error: expected `}' at end of input proj05.canvas.cpp:24: error: expected `}' at end of input These seem like simple syntax errors, but I am not sure what's wrong. Could someone decode these for me? I'd really appreciate it, thanks for your time!

    Read the article

  • Trouble defining method for Javascript class definition.

    - by btoverdrive
    I'm somewhat new to object oriented programming in Javascript and I'm trying to build a handler object and library for a list of items I get back from an API call. Ideally, I'd like the library functions to be members of the handler class. I'm having trouble getting my class method to work however. I defined as part of the class bcObject the method getModifiedDateTime, but when I try to echo the result of the objects call to this method, I get this error: Error on line 44 position 26: Expected ';' this.getModifiedDateTime: function(epochtime) { which leads me to believe that I simply have a syntax issue with my method definition but I can't figure out where. response( { "items": [ {"id":711,"name":"Shuttle","lastModifiedDate":"1268426336727"}, {"id":754,"name":"Formula1","lastModifiedDate":"1270121717721"} ], "extraListItemsAttr1":"blah", "extraListItemsAttr2":"blah2" }); function response(MyObject) { bcObject = new bcObject(MyObject); thing = bcObject.getModifiedDateTime(bcObject.videoItem[0].lastModifiedDate); SOSE.Echo(thing); } function bcObject(listObject) { // define class members this.responseList = {}; this.videoCount = 0; this.videoItem = []; this.responseListError = ""; // instantiate members this.responseList = listObject; this.videoCount = listObject.items.length; // populate videoItem array for (i=0;i<this.videoCount;i++) { this.videoItem[i] = listObject.items[i]; } this.getModifiedDateTime: function(epochtime) { var dateStringOutput = ""; var myDate = new Date(epochtime); dateStringOutput = myDate.toLocaleString(); return dateStringOutput; }; }

    Read the article

  • C++: Trouble with dependent types in templates

    - by Rosarch
    I'm having trouble with templates and dependent types: namespace Utils { void PrintLine(const string& line, int tabLevel = 0); string getTabs(int tabLevel); template<class result_t, class Predicate> set<result_t> findAll_if(typename set<result_t>::iterator begin, set<result_t>::iterator end, Predicate pred) // warning C4346 { set<result_t> result; return findAll_if_rec(begin, end, pred, result); } } namespace detail { template<class result_t, class Predicate> set<result_t> findAll_if_rec(set<result_t>::iterator begin, set<result_t>::iterator end, Predicate pred, set<result_t> result) { typename set<result_t>::iterator nextResultElem = find_if(begin, end, pred); if (nextResultElem == end) { return result; } result.add(*nextResultElem); return findAll_if_rec(++nextResultElem, end, pred, result); } } Compiler complaints, from the location noted above: warning C4346: 'std::set<result_t>::iterator' : dependent name is not a type. prefix with 'typename' to indicate a type error C2061: syntax error : identifier 'iterator' What am I doing wrong?

    Read the article

  • Javascript ( jQuery ) Error: SyntaxError: missing ) after argument list

    - by Obmerk Kronen
    I have the simplest function : jQuery(document).ajaxSuccess(function(e, xhr, settings) { var widget_id_base = '099_cf_samurai_widget'; if(settings.data.search('action=save-widget') != -1 && settings.data.search('id_base=' + widget_id_base) != -1) { // alert(\'yay!'\); my_function_chosen_099(); } }); function my_function_chosen_099(){ jQuery(".chzn-select").chosen(); } which works just fine , but When I add the width Parameter like so : function my_function_chosen_k99(){ jQuery(".chzn-select").chosen(width:'95%'); } it gives me an error of: Error: SyntaxError: missing ) after argument list Source File: http://localhost/my-path/js/o99.chosen.init.js?ver=k99 Line: 20, Column: 41 Source Code: jQuery(".chzn-select").chosen(width:"95%"); .............................................| I have tried escaping: jQuery(".chzn-select").chosen(width:\"95%"\); and even double jQuery(".chzn-select").chosen(width:\\"95%"\\); and in my desperation, even jQuery(".chzn-select").chosen( width:"95%" ); I checked and rechecked the closing of brackets , and also tried with single quotes ' - but nothing . There appear to be a lot of similar questions here , but all I saw was escaping problems, ANd I have tried all that I know .. What is wrong here ?? I assume it is not a simple syntax error - or is it ? ( one which I can not find .. )

    Read the article

  • How do you create a generic method in a class?

    - by Seth Spearman
    Hello, I am really trying to follow the DRY principle. I have a sub that looks like this? Private Sub DoSupplyModel OutputLine("ITEM SUMMARIES") Dim ItemSumms As New SupplyModel.ItemSummaries(_currentSupplyModel, _excelRows) ItemSumms.FillRows() OutputLine("") OutputLine("NUMBERED INVENTORIES") Dim numInvs As New SupplyModel.NumberedInventories(_currentSupplyModel, _excelRows) numInvs.FillRows() OutputLine("") End Sub I would like to collapse these into a single method using generics. For the record, ItemSummaries and NumberedInventories are both derived from the same base class DataBuilderBase. I can't figure out the syntax that will allow me to do ItemSumms.FillRows and numInvs.FillRows in the method. FillRows is declared as Public Overridable Sub FillRows in the base class. Thanks in advance. EDIT Here is my end result Private Sub DoSupplyModels() DoSupplyModelType("ITEM SUMMARIES",New DataBlocks(_currentSupplyModel,_excelRows) DoSupplyModelType("DATA BLOCKS",New DataBlocks(_currentSupplyModel,_excelRows) End Sub Private Sub DoSupplyModelType(ByVal outputDescription As String, ByVal type As DataBuilderBase) OutputLine(outputDescription) type.FillRows() OutputLine("") End Sub But to answer my own question...I could have done this... Private Sub DoSupplyModels() DoSupplyModelType(Of Projections)("ITEM SUMMARIES") DoSupplyModelType(Of DataBlocks)("DATA BLOCKS") End Sub Private Sub DoSupplyModelType(Of T as DataBuilderBase)(ByVal outputDescription As String, ByVal type As T) OutputLine(outputDescription) dim type as New T(_currentSupplyModel,_excelRows) type.FillRows() OutputLine("") End Sub Is that right? Does the New T() work? Seth

    Read the article

  • codeigniter avoiding html div's

    - by rabidmachine9
    Hello there!Is there a proper syntax to avoid div's in codeigniter? I don't really like opening and closing tags all the time... <div class="theForm"> <?php echo form_open('edit/links');//this form uploads echo "Enter the Name: ". form_input('name','name'); echo "Enter the Link: ". form_input('url','url'); echo " ".form_submit('submit', 'Submit'); echo form_close(); if (isset($linksQuery) && count($linksQuery)){ foreach($linksQuery as $link){ echo anchor($link['link'], $link['name'].".", array("class" => "links")); echo form_open('edit/links',array('class' => 'deleteForm')); echo form_hidden('name',$link['name']); echo " ".form_submit('delete','Delete'); echo form_close(); echo br(2); } } ?> </div>

    Read the article

  • Parse error after upgrading to PHP 5.3

    - by poer
    I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3. When I use echo/print or heredocs to print all the HTML part of the code, the error is gone. My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code inside PHP code? This is my php code: function pk_stt2_admin_print_delete_form(){ global $wpdb; if ( isset($_POST['delete_terms']) && !empty($_POST['delete_terms']) ){ $msg = 'Search terms'; $success = pk_stt2_db_delete_searchterms( $_POST['delete_terms'] ); } elseif ( isset($_POST['delete_all']) ){ $msg = 'All search terms'; $success = pk_stt2_db_delete_searchterms( 'delete_all_terms' ); } else { ?> <div id="message" class="updated fade"> <p> Please enter the search terms to be deleted, separate them with a comma. </p> </div> <?php } if ( $success ){ ?> <div id="message" class="updated fade"> <p> <?php echo $msg; ?> have been deleted, <?php echo $success; ?> rows effected. </p> </div> <?php } else { ?> <div id="message" class="updated fade"> <p> Failed to delete search terms. </p> </div> <?php } } Thanks.

    Read the article

  • Stored Procedure, 'incorrect syntax error'

    - by jacksonSD
    Attempting to figure out sp's, and I'm getting this error: "Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword 'Procedure'." the error seems to be on the if, but I can drop other existing tables with stored procedures the exact same way so I'm not clear on why this isn't working. can anyone shed some light? Begin Set nocount on Begin Try Create Procedure uspRecycle as if OBJECT_ID('Recycle') is not null Drop Table Recycle create table Recycle (RecycleID integer constraint PK_integer primary key, RecycleType nchar(10) not null, RecycleDescription nvarchar(100) null) insert into Recycle (RecycleID,RecycleType,RecycleDescription) values ('1','Compost','Product is compostable, instructions included in packaging') insert into Recycle (RecycleID,RecycleType,RecycleDescription) values ('2','Return','Product is returnable to company for 100% reuse') insert into Recycle (RecycleID,RecycleType,RecycleDescription) values ('3','Scrap','Product is returnable and will be reclaimed and reprocessed') insert into Recycle (RecycleID,RecycleType,RecycleDescription) values ('4','None','Product is not recycleable') End Try Begin Catch DECLARE @ErrMsg nvarchar(4000); SELECT @ErrMsg = ERROR_MESSAGE(); Throw 50001, @ErrMsg, 1; End Catch -- checking to see if table exists and is loaded: If (Select count(*) from Recycle) >1 begin Print 'Recycle table created and loaded '; Print getdate() End set nocount off End

    Read the article

  • Simple syntax question

    - by stabby
    Hey everyone, First off, sorry for my noob-ness. Believe me when i say ive been rtfm'ing. Im not lazy, im just dumb (apparently). On the bright side, this could earn someone some easy points here. I'm trying to do a match/replace with a pattern that contains special characters, and running into syntax errors in a Flex 3 app. I just want the following regex to compile... (while also replacing html tags with "") value.replace(/</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?>/g, ""); On a side note, the pattern /<.*?/g wouldn't work in cases where there are html entities between tags, like so: <TEXTFORMAT LEADING="2"> <P ALIGN="LEFT"> <FONT FACE="Arial" SIZE="11" COLOR="#4F4A4A" LETTERSPACING="0" KERNING="0"><one</FONT> </P> </TEXTFORMAT><TEXTFORMAT LEADING="2"> <P ALIGN="LEFT"> <FONT FACE="Arial" SIZE="11" COLOR="#4F4A4A" LETTERSPACING="0" KERNING="0">two</FONT> </P> </TEXTFORMAT> The first regex would get both "<one" and "two", but the second would only get "hi" Thanks! Stabby L

    Read the article

  • Please explain this delete top 100 SQL syntax

    - by Patrick
    Basically I want to do this: delete top( 100 ) from table order by id asc but MS SQL doesn't allow order in this position The common solution seems to be this: DELETE table WHERE id IN(SELECT TOP (100) id FROM table ORDER BY id asc) But I also found this method here: delete table from (select top (100) * from table order by id asc) table which has a much better estimated execution plan (74:26). Unfortunately I don't really understand the syntax, please can some one explain it to me? Always interested in any other methods to achieve the same result as well. EDIT: I'm still not getting it I'm afraid, I want to be able to read the query as I read the first two which are practically English. The above queries to me are: delete the top 100 records from table, with the records ordered by id ascending delete the top 100 records from table where id is anyone of (this lot of ids) delete table from (this lot of records) table I can't change the third one into a logical English sentence... I guess what I'm trying to get at is how does this turn into "delete from table (this lot of records)". The 'from' seems to be in an illogical position and the second mention of 'table' is logically superfluous (to me).

    Read the article

  • C# return and display syntax issue

    - by thatdude
    I am having trouble passing the return value from TheMethod() to Main and displaying the word if the if statement is passed as true. I have thought of two ways of doing this, neither has worked but I think I am missing synatx. Using a return ?; non void method and then displaying the returned value. Using a void method and actually writing out(example below) So yes I am new at this, however I have made so many iterations everything is blending together and I have forgot what I have tried. Any help on the syntax be great for either of these ways. Basically I need it to iterate numbers 1,2,3,4 and depending on if the current iteration matches an expression in the if statements it will display a word. Example: if (3 = i) { Console.WriteLine("Word"); } Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Proj5 { class Program { int i = 0; static void Main(int i) { for (i = 0; i < 101; i++) { Console.WriteLine("test"); } } string TheMethod(int i) { string f = "Word1"; string b = "Word2"; if (i == 3) { return f; } if (i == 5) { return b; } if (0 == (i % 3)) { return f; } if (0 == i % 5) { return b; } else { return b; } } } }

    Read the article

  • Problems building nodejs on MacOS Snow Leopard

    - by mrwooster
    I am having trouble building nodejs on MacOS Snow Leopard. I think it might have something to do with my PATH variable not being set correctly for the developer tools location. For some reason, the Developer tools (gcc, g++, make etc) are all stored in /Developer/usr/bin I added it to my PATH variable as follows: $ export PATH=$PATH:/Developer/usr/bin $ echo $PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Developer/usr/bin When i try to configure it complains about not finding open-ssl, ok, not a big problem. So I try with --without-ssl : $ ./configure --without-ssl Checking for program g++ or c++ : /Developer/usr/bin/g++ Checking for program cpp : /Developer/usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /Developer/usr/bin/ranlib Checking for g++ : ok Checking for program gcc or cc : /Developer/usr/bin/gcc Checking for gcc : ok Checking for library dl : yes Checking for library util : yes Checking for library rt : not found --- libeio --- Checking for library pthread : yes Checking for function pthread_create : not found /Users/Guy/git_src/node/node/deps/libeio/wscript:13: error: the configuration failed (see '/Users/Guy/git_src/node/node/build/config.log') Anyone know how I can get round this? I am suspicious that it might be something to do with the PATH or another ENV variable, but not sure. Thanks G

    Read the article

  • How install ImageMagic 6.6.2 on Ubuntu 10.04 (lucid)

    - by Svyatoslavik
    How install ImageMagic 6.6.2 on Ubuntu 10.04 (lucid) Problem that lucid have old ImageMagic version(6.5.2) Its very important because me need work with SVG grafics, In my local pc I have ubuntu 11.04 and ImageMagic 6.6.2 and all work fine, In server I have 6.5... and I have problem. Reinstall ubuntu to 11.* this is no solution. I tried change /etc/apt/source.list from ubuntu 10.04 (lucid) to list from ubuntu 11.04 (natty) and update ImageMagic. After this action I have ImageMagic 6.6.2 (I looked phpinfo()) but ImageMagick is not work now. If I try do any action I get error: [error] 8996#0: *19983 FastCGI sent in stderr: "PHP Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `/tmp/magick-XXnYKWKC' @ error/constitute.c/ReadImage/532' How it fix? Or how return to old version imagemagick? Problem if I try install from sources: /tmp/image/ImageMagick-6.7.2-7# ./configure configuring ImageMagick 6.7.2-7 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking whether build environment is sane... yes checking for a BSD-compatible install... /usr/bin/install -c checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/tmp/image/ImageMagick-6.7.2-7': configure: error: C compiler cannot create executables See `config.log' for more details /tmp/image/ImageMagick-6.7.2-7#

    Read the article

  • ASP.net Repeater Control Problem (nothing outputted)

    - by Phil
    I have the following db code in my usercontrol (content.ascx.vb): If did = 0 Then s = "select etc (statement works on server)" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", Data.SqlDbType.Int) x.Parameters("@contentid").Value = contentid c.Open() r = x.ExecuteReader If r.HasRows Then Contactinforepeater.DataSource = r End If c.Close() r.Close() Else s = "select etc (statement works on server)" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", SqlDbType.Int) x.Parameters("@contentid").Value = contentid x.Parameters.Add("@did", SqlDbType.Int) x.Parameters("@did").Value = did c.Open() r = x.ExecuteReader If r.HasRows Then Contactinforepeater.DataSource = r c.Close() r.Close() End If End If Then I have the following repeater control markup in my usercontrol (content.ascx): <asp:Repeater ID="Contactinforepeater" runat="server"> <HeaderTemplate> <h1>Contact Information</h1> </HeaderTemplate> <ItemTemplate> <table width="50%"> <tr> <td colspan="2"><%#Container.DataItem("position")%></td> </tr> <tr> <td>Name:</td> <td><%#Container.DataItem("surname")%></td> </tr> <tr> <td>Telephone:</td> <td><%#Container.DataItem("telephone")%></td> </tr> <tr> <td>Fax:</td> <td><%#Container.DataItem("fax")%></td> </tr> <tr> <td>Email:</td> <td><%#Container.DataItem("email")%></td> </tr> </table> </ItemTemplate> <SeparatorTemplate><br /><hr /><br /></SeparatorTemplate> </asp:Repeater> When I insert this usercontrol into default.aspx with this code: <%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %> and <form id="form1" runat="server"> <div> <uc1:Content ID="Content" runat="server" /> </div> </form> I do not get any error messages but the expected content from the database is not displayed. Can someone please show me the syntax to get this working or point out where I am going wrong? Thanks in advance!

    Read the article

  • ASP.net Repeater Control Problem (nothing outputted from datasource(sqldatareader))

    - by Phil
    I have the following code to get the repeaters' data in my usercontrol (content.ascx.vb): If did = 0 Then s = "select etc (statement works on server)" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", Data.SqlDbType.Int) x.Parameters("@contentid").Value = contentid c.Open() r = x.ExecuteReader If r.HasRows Then Contactinforepeater.DataSource = r End If c.Close() r.Close() Else s = "select etc (statement works on server)" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", SqlDbType.Int) x.Parameters("@contentid").Value = contentid x.Parameters.Add("@did", SqlDbType.Int) x.Parameters("@did").Value = did c.Open() r = x.ExecuteReader If r.HasRows Then Contactinforepeater.DataSource = r c.Close() r.Close() End If End If Then I have the following repeater control markup in my usercontrol (content.ascx): <asp:Repeater ID="Contactinforepeater" runat="server"> <HeaderTemplate> <h1>Contact Information</h1> </HeaderTemplate> <ItemTemplate> <table width="50%"> <tr> <td colspan="2"><%#Container.DataItem("position")%></td> </tr> <tr> <td>Name:</td> <td><%#Container.DataItem("surname")%></td> </tr> <tr> <td>Telephone:</td> <td><%#Container.DataItem("telephone")%></td> </tr> <tr> <td>Fax:</td> <td><%#Container.DataItem("fax")%></td> </tr> <tr> <td>Email:</td> <td><%#Container.DataItem("email")%></td> </tr> </table> </ItemTemplate> <SeparatorTemplate><br /><hr /><br /></SeparatorTemplate> </asp:Repeater> When I insert this usercontrol into default.aspx with this code: <%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %> and <form id="form1" runat="server"> <div> <uc1:Content ID="Content" runat="server" /> </div> </form> I do not get any error messages but the expected content from the database is not displayed. Can someone please show me the syntax to get this working or point out where I am going wrong? Thanks in advance!

    Read the article

  • error: expected `;' before '{' token - What is the cause?

    - by melee
    Here is my implementation file: using namespace std; #include <iostream> #include <iomanip> #include <string> #include <stack> //line 5 #include "proj05.canvas.h" //----------------Constructor----------------// Canvas::Canvas() //line 10 { Title = ""; Nrow = 0; Ncol = 0; image[][100]; // line 15 position.r = 0; position.c = 0; } //-------------------Paint------------------// line 20 void Canvas::Paint(int R, int C, char Color) { cout << "Paint to be implemented" << endl; } The errors I'm getting are these: proj05.canvas.cpp: In function 'std::istream& operator>>(std::istream&, Canvas&)': proj05.canvas.cpp:11: error: expected `;' before '{' token proj05.canvas.cpp:22: error: a function-definition is not allowed here before '{' token proj05.canvas.cpp:24: error: expected `}' at end of input proj05.canvas.cpp:24: error: expected `}' at end of input These seem like simple syntax errors, but I am not sure what's wrong. Could someone decode these for me? I'd really appreciate it, thanks for your time! EDIT Here is the definition of Canvas in my .h file: #ifndef CANVAS_H #define CANVAS_H #include <iostream> #include <iomanip> #include <string> #include <stack> class Canvas { public: Canvas(); void Paint(int R, int C, char Color); const int Nrow; const int Ncol; string Title; int image[][100]; stack<int> path; struct PixelCoordinates { unsigned int r; unsigned int c; } position; }; #endif

    Read the article

  • Redirecting users in JSP from within a includes - java syntax error

    - by Mark Hazlett
    Hey everyone, So my setup for my web application is that I have a general header and footer and then I just include them in all my other pages so that all the common elements for all the pages are in a single page. The only problem I'm running into is when I want to redirect the user back to a login page if the "username" session has not already been created. The problem that I"m running into is that I have an if statement at the top of my header.jsp and then I have the else in the footer.jsp and it is giving me a java syntax error. Any ideas? Here is the code I'm referring to... <%@page contentType="text/html" pageEncoding="UTF-8"%> <% if(session.getAttribute("username") != null) { %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <!-- CSS files --> <link rel="stylesheet" href="../CSS/headerStyle.css" type="text/css" media="screen" /> <title>Insert title here</title> </head> <body> <div id="container"> <div id="header"> <div id="headerTitle">Title</div> </div> </div> <%} %> And then here is the footer <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../CSS/headerStyle.css" type="text/css" media="screen" /> </head> <body> <div id="footer"></div> </body> </html> <% else { response.sendRedirect("../wa_login/login.jsp"); } %> However it is giving me an error on the else statement because the else doesn't have an if statement because it's in the header file.

    Read the article

  • On asp:Table Control how do we create a thead ?

    - by balexandre
    from MSDN article on the subject we can see that we create a TableHeaderRowthat conatins TableHeaderCells. but they add the table header like this: myTable.Row.AddAt(0, headerRow); witch outputs the HTML: <table id="Table1" ... > <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... and it should have <thead> and <tbody> (so it works seamless with tablesorter) :) <table id="Table1" ... > <thead> <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> </thead> <tbody> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... </tbody> the HTML aspx code is <asp:Table ID="Table1" runat="server" /> How can I output the correct syntax? Just as information, the GridViewcontrol has this builed in as we just need to set teh Accesbility and use the HeaderRow gv.UseAccessibleHeader = true; gv.HeaderRow.TableSection = TableRowSection.TableHeader; gv.HeaderRow.CssClass = "myclass"; but the question is for the Table control.

    Read the article

  • Rails on server syntax error?

    - by Danny McClelland
    Hi Everyone, I am trying to get my rails application running on my web server, but when I run the rake db:migrate I get the following error: r oot@oak [/home/macandco/rails_apps/survey_manager]# rake db:migrate (in /home/macandco/rails_apps/survey_manager) == Baseapp: migrating ======================================================== -- create_table(:settings, {:force=>true}) -> 0.0072s -- create_table(:users) -> 0.0072s -- add_index(:users, :login, {:unique=>true}) -> 0.0097s -- create_table(:profiles) -> 0.0084s -- create_table(:open_id_authentication_associations, {:force=>true}) -> 0.0067s -- create_table(:open_id_authentication_nonces, {:force=>true}) -> 0.0064s -- create_table(:roles) -> 0.0052s -- create_table(:roles_users, {:id=>false}) -> 0.0060s rake aborted! An error has occurred, all later migrations canceled: 555 5.5.2 Syntax error. g9sm2526951gvc.8 Has anyone come across this before? Thanks, Danny Main Migration file c lass Baseapp < ActiveRecord::Migration def self.up # Create Settings Table create_table :settings, :force => true do |t| t.string :label t.string :identifier t.text :description t.string :field_type, :default => 'string' t.text :value t.timestamps end # Create Users Table create_table :users do |t| t.string :login, :limit => 40 t.string :identity_url t.string :name, :limit => 100, :default => '', :null => true t.string :email, :limit => 100 t.string :mobile t.string :signaturenotes t.string :crypted_password, :limit => 40 t.string :salt, :limit => 40 t.string :remember_token, :limit => 40 t.string :activation_code, :limit => 40 t.string :state, :null => :false, :default => 'passive' t.datetime :remember_token_expires_at t.string :password_reset_code, :default => nil t.datetime :activated_at t.datetime :deleted_at t.timestamps end add_index :users, :login, :unique => true # Create Profile Table create_table :profiles do |t| t.references :user t.string :real_name t.string :location t.string :website t.string :mobile t.timestamps end # Create OpenID Tables create_table :open_id_authentication_associations, :force => true do |t| t.integer :issued, :lifetime t.string :handle, :assoc_type t.binary :server_url, :secret end create_table :open_id_authentication_nonces, :force => true do |t| t.integer :timestamp, :null => false t.string :server_url, :null => true t.string :salt, :null => false end create_table :roles do |t| t.column :name, :string end # generate the join table create_table :roles_users, :id => false do |t| t.column :role_id, :integer t.column :user_id, :integer end # Create admin role and user admin_role = Role.create(:name => 'admin') user = User.create do |u| u.login = 'admin' u.password = u.password_confirmation = 'advices' u.email = '[email protected]' end user.register! user.activate! user.roles << admin_role end def self.down # Drop all BaseApp drop_table :settings drop_table :users drop_table :profiles drop_table :open_id_authentication_associations drop_table :open_id_authentication_nonces drop_table :roles drop_table :roles_users end end

    Read the article

  • T_INLINE_HTML? What's wrong with this?

    - by Charlie Pigarelli
    <? switch($data['type']) : ?> <? case 'log': ?> <? while ($row = $data['loop']->fetch()) : ?> <table class="t-errors"> <tr> <td> <b>IP:</b> <? echo $row['LogShellIP']; ?> <b>Command:</b> <? echo $row['LogShellCommand']; ?> <b>Executed:</b> <? echo $row['LogShellReturn']; ?> <b>Time:</b> <? echo format::time($row['LogShellTime']); ?> </td> </tr> </table> <? endwhile; ?> <? break; ?> <? case 'fatal': ?> <? case 'warning': ?> <? case 'notice': ?> <? case 'unknown': ?> <? while ($row = $data['loop']->fetch()) : ?> <table class="t-errors"> <tr> <td <? if ($row['LogErrorSeen'] == 0) { echo 'class="e-selected"'; } ?>> <b>String:</b> <? echo $row['LogErrorString']; ?> <b>File:</b> <? echo $row['LogErrorFile']; ?> <b>Line:</b> <? echo $row['LogErrorLine']; ?> <b>Context:</b> <? echo $row['LogErrorContext']; ?> <b>Ip:</b> <? echo $row['LogErrorIP']; ?> <b>Time:</b> <? echo format::time($row['LogErrorTime']); ?> </td> </tr> </table> <? endwhile; ?> <? break; ?> <? endswitch; ? I'm getting this error: Parse error: syntax error, unexpected T_INLINE_HTML, expecting T_ENDSWITCH or T_CASE or T_DEFAULT in /Applications/XAMPP/xamppfiles/htdocs/Smooth Framework/tpl/terminal.tpl.php on line 33 Where line 33 is the line 2 of this script. This is inserted in a template context. What's wrong with this? He is expecting a T_CASE and that's what is there!

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >