Search Results

Search found 2037 results on 82 pages for 'khanna param'.

Page 24/82 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Getting identity from Ado.Net Update command

    - by rboarman
    My scenario is simple. I am trying to persist a DataSet and have the identity column filled in so I can add child records. Here's what I've got so far: using (SqlConnection connection = new SqlConnection(connStr)) { SqlDataAdapter adapter = new SqlDataAdapter("select * from assets where 0 = 1", connection); adapter.MissingMappingAction = MissingMappingAction.Passthrough; adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; SqlCommandBuilder cb = new SqlCommandBuilder(adapter); var insertCmd = cb.GetInsertCommand(true); insertCmd.Connection = connection; connection.Open(); adapter.InsertCommand = insertCmd; adapter.InsertCommand.CommandText += "; set ? = SCOPE_IDENTITY()"; adapter.InsertCommand.UpdatedRowSource = UpdateRowSource.OutputParameters; var param = new SqlParameter("RowId", SqlDbType.Int); param.SourceColumn = "RowId"; param.Direction = ParameterDirection.Output; adapter.InsertCommand.Parameters.Add(param); SqlTransaction transaction = connection.BeginTransaction(); insertCmd.Transaction = transaction; try { assetsImported = adapter.Update(dataSet.Tables["Assets"]); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); // Log an error } connection.Close(); } The first thing that I noticed, besides the fact that the identity value is not making its way back into the DataSet, is that my change to add the scope_identity select statement to the insert command is not being executed. Looking at the query using Profiler, I do not see my addition to the insert command. Questions: 1) Why is my addition to the insert command not making its way to the sql being executed on the database? 2) Is there a simpler way to have my DataSet refreshed with the identity values of the inserted rows? 3) Should I use the OnRowUpdated callback to add my child records? My plan was to loop through the rows after the Update() call and add children as needed. Thank you in advance. Rick

    Read the article

  • vb.net documentation and exception question

    - by dcp
    Let's say I have this sub in vb.net: ''' <summary> ''' Validates that <paramref name="value"/> is not <c>null</c>. ''' </summary> ''' ''' <param name="value">The object to validate.</param> ''' ''' <param name="name">The variable name of the object.</param> ''' ''' <exception cref="ArgumentNullException">If <paramref name="value"/> is <c>null</c>.</exception> Sub ValidateNotNull(ByVal value As Object, ByVal name As String) If value Is Nothing Then Throw New ArgumentNullException(name, String.Format("{0} cannot be null.", name)) End If End Sub My question is, is it proper to call this ValidateNotNull (which is what I would call it in C#) or should I stick with VB terminology and call it ValidateNotNothing instead? Also, in my exception, is it proper to say "cannot be null", or would it be better to say "cannot be Nothing"? I sort of like the way I have it, but since this is VB, maybe I should use Nothing. But since the exception itself is called ArgumentNullException, it feels weird to make the message say "cannot be Nothing". Anyway, I guess it's pretty nitkpicky, just wondered what you folks thought.

    Read the article

  • How to document an accessor/mutator method in phpDoc/javaDoc?

    - by nickf
    Given a function which behaves as either a mutator or accessor depending on the arguments passed to it, like this: // in PHP, you can pass any number of arguments to a function... function cache($cacheName) { $arguments = func_get_args(); if (count($arguments) >= 2) { // two arguments passed. MUTATOR. $value = $arguments[1]; // use the second as the value $this->cache[$cacheName] = $value; // *change* the stored value } else { // 1 argument passed, ACCESSOR return $this->cache[$cacheName]; // *get* the stored value } } cache('foo', 'bar'); // nothing returned cache('foo') // 'bar' returned How do you document this in PHPDoc or a similar automated documentation creator? I had originally just written it like this: /** * Blah blah blah, you can use this as both a mutator and an accessor: * As an accessor: * @param $cacheName name of the variable to GET * @return string the value... * * As a mutator: * @param $cacheName name of the variable to SET * @param $value the value to set * @return void */ However, when this is run through phpDoc, it complains because there are 2 return tags, and the first @param $cacheName description is overwritten by the second. Is there a way around this?

    Read the article

  • struts2 action not calling properly

    - by Ziplin
    On default I want my struts2 app to forward to an action: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="false" /> <package name="myApp" namespace="/myApp" extends="struts-default"> <action name="Login_*" method="{1}" class="myApp.SessionManager"> <result name="input">/myApp/Login.jsp</result> <result type="redirectAction">Menu</result> </action> </package> <package name="default" namespace="/" extends="struts-default"> <default-action-ref name="index" /> <action name="index"> <result type="redirectAction"> <param name="actionName">Login_input.action</param> <param name="namespace">/myApp</param> </result> </action> </package> </struts> I'm looking for the application to call SessionManager.input(), but instead it calls SessionManager.execute().

    Read the article

  • Struts 2 how to display messages saved in a Interceptor which would redirec to another action?

    - by mui13
    in my interceptor, if user doesn't have enough right, there would be a warn message: public String intercept(ActionInvocation invocation) throws Exception { ActionContext actionContext = invocation.getInvocationContext(); Map<String, Object> sessionMap = actionContext.getSession(); User loginUser = (User) sessionMap.get("user"); Object action = invocation.getAction(); if (loginUser != null && loginUser.getRole().getId() != Constant.AUTHORITY_ADMIN) { ((ValidationAware) action).addFieldError("user.authority", ((DefaultAction) action).getText("user.action.authority.not.enough")); return DefaultAction.HOME_PAGE; } return invocation.invoke(); } then, it would redirect to "HOME_PAGE" action, if success, display information in the jsp. So how to display the warn message? i have used two interceptors configed in strust.xml, for admin right requirment: <interceptor-stack name="authorityStack"> <interceptor-ref name="authority" /> <interceptor-ref name="defaultStack" /> <interceptor-ref name="store"> <param name="operationMode">STORE</param> </interceptor-ref> </interceptor-stack> default is: <interceptor-stack name="default"> <interceptor-ref name="login" /> <interceptor-ref name="defaultStack" /> <interceptor-ref name="store"> <param name="operationMode">AUTOMATIC</param> </interceptor-ref> </interceptor-stack>

    Read the article

  • WCF RIA Services Custom Type with Collection of Custom Types

    - by Blakewell
    Is it possible to have a custom type within a custom type and have the result returned via WCF RIA services? I have the following two classes below, but I can't gain access to the Verticies property within the Polygon class. I assume it is because it is a custom class, or something to do with it being a List collection. Polygon Class public class Polygon { public Polygon() { _vertices = new List<Location>(); } private int _id; [Key] public int Id { get; set; } private List<Location> _vertices; public List<Location> Vertices { get { return _vertices; } set { _vertices = value; } } } Location Class public class Location { public Location() { } /// <summary> /// Default constructor for creating a Location object /// </summary> /// <param name="latitude"></param> /// <param name="longitude"></param> public Location( double latitude, double longitude ) { _latitude = latitude; _longitude = longitude; } private int _id; [Key] public int Id { get { return _id; } set { _id = value; } } private double _latitude; /// <summary> /// Latitude coordinate of the location /// </summary> public double Latitude { get { return _latitude; } set { _latitude = value; } } private double _longitude; /// <summary> /// Longitude coordiante of the location /// </summary> public double Longitude { get { return _longitude; } set { _longitude = value; } } }

    Read the article

  • How do I set a flash object to open a url in a new window?

    - by Keith Donegan
    Hi Guys, I have this code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="250"> <param name="movie" value="Spotify_premium_300x250.swf" /> <param name="quality" value="high" /> <embed src="Spotify_premium_300x250.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="300" height="250"></embed> </object> EDIT: Code from Tom <object onclick="javascript: window.open('http://www.stackoverflow.com', _blank, 'width=1024, height=600, menubar=no, resizable=yes');" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="250"> <param name="movie" value="Spotify_premium_300x250.swf" /> <param name="quality" value="high" /> <embed src="Spotify_premium_300x250.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="300" height="250"></embed> </object> I would like it as when a user clicks the flash object, it's opens a URL in a new window. How would I go about doing this? Cheers, Keith

    Read the article

  • What should the name of this class be?

    - by Tim Murphy
    Naming classes is sometimes hard. What do you think name of the class should be? I originally created the class to use as a cache but can see its may have other uses. Example code to use the class. Dim cache = New NamePendingDictionary(Of String, Sample) Dim value = cache("a", Function() New Sample()) And here is the class that needs a name. ''' <summary> ''' Enhancement of <see cref="System.Collections.Generic.Dictionary"/>. See the Item property ''' for more details. ''' </summary> ''' <typeparam name="TKey">The type of the keys in the dictionary.</typeparam> ''' <typeparam name="TValue">The type of the values in the dictionary.</typeparam> Public Class NamePendingDictionary(Of TKey, TValue) Inherits Dictionary(Of TKey, TValue) Delegate Function DefaultValue() As TValue ''' <summary> ''' Gets or sets the value associated with the specified key. If the specified key does not exist ''' then <paramref name="createDefaultValue"/> is invoked and added to the dictionary. The created ''' value is then returned. ''' </summary> ''' <param name="key">The key of the value to get.</param> ''' <param name="createDefaultValue"> ''' The delegate to invoke if <paramref name="key"/> does not exist in the dictionary. ''' </param> ''' <exception cref="T:System.ArgumentNullException"><paramref name="key" /> is null.</exception> Default Public Overloads ReadOnly Property Item(ByVal key As TKey, ByVal createDefaultValue As DefaultValue) As TValue Get Dim value As TValue If createDefaultValue Is Nothing Then Throw New ArgumentNullException("createValue") End If If Not Me.TryGetValue(key, value) Then value = createDefaultValue.Invoke() Me.Add(key, value) End If Return value End Get End Property End Class

    Read the article

  • XSLT question, how to transform xml when I have xslt file stored, but object in mem?

    - by JL
    I have a function that takes 2 parameters : 1 = XML file, 2 = XSLT file, then performs a transformation and returns the resulting HTML. Here is the function: /// <summary> /// Will apply an XSLT style to any XML file and return the rendered HTML. /// </summary> /// <param name="xmlFileName"> /// The file name of the XML document. /// </param> /// <param name="xslFileName"> /// The file name of the XSL document. /// </param> /// <returns> /// The rendered HTML. /// </returns> public string TransformXml(string xmlFileName, string xslFileName) { var xtr = new XmlTextReader(xmlFileName) { WhitespaceHandling = WhitespaceHandling.None }; var xd = new XmlDocument(); xd.Load(xtr); var xslt = new System.Xml.Xsl.XslCompiledTransform(); xslt.Load(xslFileName); var stm = new MemoryStream(); xslt.Transform(xd, null, stm); stm.Position = 1; var sr = new StreamReader(stm); xtr.Close(); return sr.ReadToEnd(); } I want to change the function not to accept a file name, but rather a strongly typed object de-serialized (now in the form of a variable). Is this possible? So keep the xslt coming from a file, but the xml input should be a the serialized xml of the object I pass, and I want to do this without file system IO.

    Read the article

  • Applet class loader cannot find one of the classes in the jar

    - by Chry Cheng
    I get the ff. error in Java Console occassionally: Exception in thread "thread applet-my.package.MyApplet-10" java.lang.NoClassDefFoundError: another/package/SomeClass at my.package.MyApplet.init(MyApplet.java:95) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: another.package.SomeClass at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 3 more Caused by: java.io.IOException: open HTTP connection failed:https://myserver/mycontext/applets/another/package/SomeClass.class at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 7 more My applet tag is as follows: <applet codebase="../../applets" code="my.package.MyApplet" class="invisible" id="myApplet"> <param value="value0" name="param0"/> ... <param value="valueN" name="paramN" /> <param value="folder/myApplet__0.0.1177.jar,folder/commons-io-1.3.2__0.0.1177.jar,..." name="cache_archive"/> <param value="0.0.1177.0,0.0.1177.0,...," name="cache_version"/> </applet> It is important I stress the word "occasionally". Sometimes the applet is initialized without a hitch. This also means that, often, when the browser is restarted, the problem goes away. I am aware of http://stackoverflow.com/questions/698890/applet-fails-to-load-class-from-jar and http://stackoverflow.com/questions/872905/applet-class-loader-cannot-find-a-class-in-the-applets-jar but I think they are not applicable to my case. SomeClass and MyApplet are in the same jar and the page is being accessed locally.

    Read the article

  • Help with HTML hyperlink please

    - by liz
    Hello, Can someone help me with this problem: I have a table in a jsp page, with the text in one column being hyperlinks. Whenever anyone of these hyperlinks is clicked the whole table should refresh and repopulate based on the value of the hyperlink clicked. My problem is currently when the hyperlink is clicked the page refreshes with an empty table. I have the following line of HTML code for performing this in my jsp page: <TD><A href="http://localhost:8080/pmweb/gui.jsp" onclick="getResults(param)">hyperlinktext</A></TD>; Below is my getResults function in javascript in the same JSP page: <script type="text/javascript"> var httpRequest; function getResults(param) { var url = "http://localhost:8080/pmweb/api/GetResultsByParam?param=" + param; httpRequest = new XMLHttpRequest(); httpRequest.open("GET", url, true); httpRequest.onreadystatechange = function() {processRequest(); } ; httpRequest.send(null); } I have verified that the getResults function above is working fine itself. When I debugged it I noticed that this getResults function is not entered when the hyperlink is clicked. Anyone know how to get the hyperlink calling the javascript function properly? Thanks very much in advance!

    Read the article

  • How do I include a frameset under CGI.pm?

    - by neversaint
    I want to have a cgi-script that does two things. Take the input from a form. Generate results base on the input values on a frame. I also want the frame to exist only after the result is generated/printed. Below is the simplified code of what I want to do. But somehow it doesn't work. What's the right way to do it? #!/usr/local/bin/perl use CGI ':standard'; print header; print start_html('A Simple Example'), h1('A Simple Example'), start_form, "What's your name? ",textfield('name'), p, "What's the combination?", p, checkbox_group(-name=>'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie']), p, "What's your favorite color? ", popup_menu(-name=>'color', -values=>['red','green','blue','chartreuse']), p, submit, end_form, hr; if (param()) { # begin create the frame print <<EOF; <html><head><title>$TITLE</title></head> <frameset rows="10,90"> <frame src="$script_name/query" name="query"> <frame src="$script_name/response" name="response"> </frameset> EOF # Finish creating frame print "Your name is: ",em(param('name')), p, "The keywords are: ",em(join(", ",param('words'))), p, "Your favorite color is: ",em(param('color')), hr; } print end_html;

    Read the article

  • How to do buffered intersection checks on an IPoint?

    - by Quigrim
    How would I buffer an IPoint to do an intersection check using IRelationalOperator? I have, for arguments sake: IPoint p1 = xxx; IPoint p2 = yyy; IRelationalOperator rel1 = (IRelationalOperator)p1; if (rel.Intersects (p2)) // Do something But now I want to add a tolerance to my check, so I assume the right way to do that is by either buffering p1 or p2. Right? How do I add such a buffer? Note: the Intersects method I am using is an extension method I wrote to simplify my code. Here it is: /// <summary> /// Returns true if the IGeometry is intersected. /// This method negates the Disjoint method. /// </summary> /// <param name="relOp">The rel op.</param> /// <param name="other">The other.</param> /// <returns></returns> public static bool Intersects ( this IRelationalOperator relOp, IGeometry other) { return (!relOp.Disjoint (other)); }

    Read the article

  • Is this a good decorator pattern for javascript?

    - by Kucebe
    I need some simple objects that could become more complex later, with many different properties, so i thought to decorator pattern. I made this looking at Crockford's power constructor and object augmentation: //add property to object Object.prototype.addProperty = function(name, func){ for(propertyName in this){ if(propertyName == name){ throw new Error(propertyName + " is already defined"); } } this[name] = func; }; //constructor of base object var BaseConstructor = function(param){ var _privateVar = param; return{ getPrivateVar: function(){ return _privateVar; } }; }; //a simple decorator, adds one private attribute and one privileged method var simpleDecorator = function(obj, param){ var _privateVar = param; var privilegedMethod1 = function(){ return "privateVar of decorator is: " + _privateVar; }; obj.addProperty("privilegedMethod1", privilegedMethod1); return obj; } //a more complex decorator, adds public and private properties var complexDecorator = function(obj, param1, param2){ //private properties var _privateVar = param1; var _privateMethod = function(x){ for(var i=0; i<x; i++){ _privateVar += x; } return _privateVar; }; //public properties var publicVar = "I'm public"; obj.addProperty("publicVar", publicVar); var privilegedMethod2 = function(){ return _privateMethod(param2); }; obj.addProperty("privilegedMethod2", privilegedMethod2); var publicMethod = function(){ var temp = this.privilegedMethod2(); return "do something: " + temp + " - publicVar is: " + this.publicVar; }; obj.addProperty("publicMethod", publicMethod); return obj; } //new basic object var myObj = BaseConstructor("obj1"); //the basic object will be decorated var myObj = simpleDecorator(obj, "aParam"); //the basic object will be decorated with other properties var myObj = complexDecorator(obj, 2, 3); Is this a good way to have Decorator Pattern in javascript? Are there other better ways to do this?

    Read the article

  • Inserting javascript with jQuery .html

    - by Andrew Appleby
    I'm experiencing an issue with a website I'm working on, where I originally believed I could simply replace $("main").html('THIS') which was originally code for a flash object, with a new and improved HTML5/Javascript version. The original code: $("#main").html('<div style="height: 100%; width: 100%; overflow: hidden;"><object width="100%" height="100%" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">\ <param value="images/uploads/'+image_id+'.swf" name="movie">\ <param value="true" name="allowFullScreen">\ <param value="#737373" name="bgcolor">\ <param value="" name="FlashVars">\ <embed width="100%" height="100%" flashvars="" bgcolor="#737373" allowfullscreen="true" src="images/uploads/'+image_id+'.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\ </object></div>\ '); }); And my (failed) attempt at inserting my new code: $("#main").html('<script type="text/javascript">pano=new pano2vrPlayer("container");skin=new pano2vrSkin(pano);pano.readConfigUrl("xml/tablet_'+image_id+'.xml");hideUrlBar();</script>'); It doesn't even work when I just put , so I know it's gotta be the javascript itself. I've looked at the solutions out there, but I can't make sense in how to properly implement them here in the most efficient way. Your help is much appreciated, thanks!

    Read the article

  • Find and replace certain part of value (jquery)

    - by Hakan
    This might be a little complicated. See code below. When image is clicked I want to change "MY-ID-NUMBER" in "value" and "src" of object. But I want the other information to remain. When link is clicked I want to restore "value" and "src" so I can use the same function for next image that is clicked. Is it possible? Please help! My HTML: <img height="186" width="134" alt="4988" src="i123.jpg"> <img height="186" width="134" alt="4567" src="i124.jpg"> <a class="restore-to-default" href="#">DVD</a> <div class="tdt"> <object width="960" height="540"><param name="movie" value="http://www.domain.com/v3.4/player.swf?file=http://se.player-feed.domain.com/cinema/MY-ID-NUMBER/123-1/><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed id="player" name="player" type="application/x-shockwave-flash" src="http://www.player.domain.com/v3.4/player.swf?file=http://se.player-feed.domain.com/cinema/MY-ID-NUMBER/123-1/&display_title=over&menu=true&enable_link=true&default_quality=xxlarge&controlbar=over&autostart=true&backcolor=000000&frontcolor=ffffff&share=0&repeat=always&displayclick=play&volume=80&linktarget=_blank" width="960" height="540"allowFullScreen="true" allowScriptAccess="always"></embed></object> My jquery: $('img').click(function(){ var alt = $(this).attr("alt"); $('.tdt object').val("alt", alt); // Some how change "MY-ID-NUMBER" into the "alt-value" of image }); $('a').click(function(){ //restore to "MY-ID-NUMBER" }); Thanks!

    Read the article

  • Extend DOMElement object

    - by Comma
    How could I exdend objects provided with Document Object Model? Seems that there is no way according to this [issue][2]. class Application_Model_XmlSchema extends DOMElement { const ELEMENT_NAME = 'schema'; /** * @var DOMElement */ private $_schema; /** * @param DOMDocument $document * @return void */ public function __construct(DOMDocument $document) { $this->setSchema($document->getElementsByTagName(self::ELEMENT_NAME)->item(0)); } /** * @param DOMElement $schema * @return void */ public function setSchema(DOMElement $schema){ $this->_schema = $schema; } /** * @return DOMElement */ public function getSchema(){ return $this->_schema; } /** * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { if (method_exists($this->_schema, $name)) { return call_user_func_array( array($this->_schema, $name), $arguments ); } } } $version = $this->getRequest()->getParam('version', null); $encoding = $this->getRequest()->getParam('encoding', null); $source = 'http://www.w3.org/2001/XMLSchema.xsd'; $document = new DOMDocument($version, $encoding); $document->load($source); $xmlSchema = new Application_Model_XmlSchema($document); $xmlSchema->getAttribute('version'); I got an error: Warning: DOMElement::getAttribute(): Couldn't fetch Application_Model_XmlSchema in C:\Nevermind.php on line newvermind

    Read the article

  • jquery script that used to work is not working with jquery 1.4.2

    - by Zayatzz
    ... and i cant figure out why. The script is following: <script type="text/javascript" src="http://path/to/js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> function openMediaPlayer() { $('#flashMovie').animate({'height':'333px'}); } function closeMediaPlayer() { $('#flashMovie').animate({'height':'80px'}); } jQuery(function($){ $('#videoholder').bind('mouseenter', function(){ openMediaPlayer(); }); $('#videoholder').bind('mouseleave', function(){ closeMediaPlayer(); }); }); </script> <div id="videoholder" style="height:80px;width:412px;"> <object width="412" height="80" type="application/x-shockwave-flash" id="flashMovie" name="flashMovie" style="height: 80px;" data="http://path/to/Player.swf"><param name="menu" value="false"><param name="bgcolor" value="#666666"><param name="allowFullscreen" value="true"><param name="flashvars" value="playlistURL=http://path/to/Player/data/playlist.xml"></object> </div> pure and simple resizing flash object. It worked with older(1.3.2) jquery verision. The animate just does not work. Can anyone tell me what i should change to get it working again? Alan.

    Read the article

  • Java Inheritance - Getting a Parameter from Parent Class

    - by Aaron
    I'm trying to take one parameter from the parent class of Car and add it to my array (carsParked), how can i do this? Parent Class public class Car { protected String regNo; //Car registration number protected String owner; //Name of the owner protected String carColor; /** Creates a Car object * @param rNo - registration number * @param own - name of the owner **/ public Car (String rNo, String own, String carColour) { regNo = rNo; owner = own; carColor = carColour; } /** @return The car registration number **/ public String getRegNo() { return regNo; } /** @return A String representation of the car details **/ public String getAsString() { return "Car: " + regNo + "\nColor: " + carColor; } public String getColor() { return carColor; } } Child Class public class Carpark extends Car { private String location; // Location of the Car Park private int capacity; // Capacity of the Car Park - how many cars it can hold private int carsIn; // Number of cars currently in the Car Park private String[] carsParked; /** Constructor for Carparks * @param loc - the Location of the Carpark * @param cap - the Capacity of the Carpark */ public Carpark (String locations, int room) { location = locations; capacity = room; } /** Records entry of a car into the car park */ public void driveIn() { carsIn = carsIn + 1; } /** Records the departure of a car from the car park */ public void driveOut() { carsIn = carsIn - 1; } /** Returns a String representation of information about the carpark */ public String getAsString() { return location + "\nCapacity: " + capacity + " Currently parked: " + carsIn + "\n*************************\n"; } }

    Read the article

  • jquery script that used to work is not working with jquery 1.4.2

    - by Zayatzz
    ... and i cant figure out why. The script is following: <script type="text/javascript" src="http://path/to/js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> function openMediaPlayer() { $('#flashMovie').animate({'height':'333px'}); } function closeMediaPlayer() { $('#flashMovie').animate({'height':'80px'}); } jQuery(function($){ $('#videoholder').bind('mouseenter', function(){ openMediaPlayer(); }); $('#videoholder').bind('mouseleave', function(){ closeMediaPlayer(); }); }); </script> <div id="videoholder" style="height:80px;width:412px;"> <object width="412" height="80" type="application/x-shockwave-flash" id="flashMovie" name="flashMovie" style="height: 80px;" data="http://path/to/Player.swf"><param name="menu" value="false"><param name="bgcolor" value="#666666"><param name="allowFullscreen" value="true"><param name="flashvars" value="playlistURL=http://path/to/Player/data/playlist.xml"></object> </div> pure and simple resizing flash object. It worked with older(1.3.2) jquery verision. The animate just does not work. Can anyone tell me what i should change to get it working again? Alan.

    Read the article

  • Why is Request not available for my PDF request?

    - by Beska
    We're trying to create a .NET aspx page that will have a PDF within it. Doing this by hardcoding it is easy. <object height="1250px" width="100%" type="application/pdf" data="our.pdf"> <param value="our.pdf" name="src" /> <param value="transparent" name="wmode" /> </object> (don't worry too much about the transparent thing...we're doing that for other reasons...but I include it here "just in case".) The problem is when we want to generate the PDF dynamically. Our code to populate the literal on the front end looks like this: ltrPDF.Text = String.Format("<object height=\"1250px\" width=\"100%\" type=\"application/pdf\" data=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2); ltrPDF.Text += String.Format("<param value=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2); ltrPDF.Text += "<param value=\"transparent\" name=\"wmode\"/>"; ltrPDF.Text += "</object>"; Kind of ugly, but it seems like it should work. But it doesn't. When I debug, and put a breakpoint on the first line of ourPdfGenerator.aspx.cs Page_Load method, I reach the breakpoint without any difficulty. However, the first thing we do is try to use Request.QueryString: string var0 = Request.QueryString["var0"]; which immediately throws an HttpException: "Request is not available in this context." I'm not clear on: Why isn't it available? What can I do about it?

    Read the article

  • How to buffer an IPoint or IGeometry? (How to do buffered intersection checks on an IPoint?)

    - by Quigrim
    How would I buffer an IPoint to do an intersection check using IRelationalOperator? I have, for arguments sake: IPoint p1 = xxx; IPoint p2 = yyy; IRelationalOperator rel1 = (IRelationalOperator)p1; if (rel.Intersects (p2)) // Do something But now I want to add a tolerance to my check, so I assume the right way to do that is by either buffering p1 or p2. Right? How do I add such a buffer? Note: the Intersects method I am using is an extension method I wrote to simplify my code. Here it is: /// <summary> /// Returns true if the IGeometry is intersected. /// This method negates the Disjoint method. /// </summary> /// <param name="relOp">The rel op.</param> /// <param name="other">The other.</param> /// <returns></returns> public static bool Intersects ( this IRelationalOperator relOp, IGeometry other) { return (!relOp.Disjoint (other)); }

    Read the article

  • YouTube API, jQuery attr won't swap element attributes (I think) in IE, but works in FF

    - by Anthony
    JavaScript (jQuery) function display_youtube(new_url) { $('#movie_url').removeAttr('value'); $('#embed_url').removeAttr('src'); $(document).ready(function() { $('#movie_url').attr('value', new_url); $('#embed_url').attr('src', new_url); $('#shade').css('display', 'block'); $('#youtube_player').css('display', 'block'); $('#exit_youtube').css('display', 'block'); }); } HTML <object width="720" height="480"> <param id="movie_url" name="movie" value="http://www.youtube.com/v/_eaToCSn7yU?f=user_uploads&app=youtube_gdata&autoplay=0" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <embed id="embed_url" src="http://www.youtube.com/v/_eaToCSn7yU?f=user_uploads&app=youtube_gdata&autoplay=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="720" height="480" /> </object> Hyperlink <a href="javascript:display_youtube('http://www.youtube.com/v/_eaToCSn7yU?f=user_uploads&app=youtube_gdata&autoplay=1');">Click Here for Fun!</a> What I've done is parsed YouTube's API for the videos on my user channel. The hyperlink above is php generated, meant to trigger the above JavaScript function, and swap the url from attributes contained in ids "movie_url" and "embed_url". Works just like it should in FF, but IE will only perform the .css commands. My guess? IE doesn't like me assigning IDs to PARAM and EMBED, perhaps? What do you think?

    Read the article

  • How to fetch particular element from string after splitting it, using XSLT split() ?

    - by Vijay
    Hi All, I have one query regarding XSLT functions. I am using split function to fetch values from a string. I am using separator as "*". e.g. String : {"item1*item2*item3*item4"} split function I am using is as; <xsl:template name="SplitItemsCollection"> <xsl:param name="list" select="''"/> <xsl:param name="separator" select="'*'"/> <xsl:if test="not($list = '' or $separator = '')"> <xsl:variable name="head" select="substring-before(concat($list, $separator), $separator)"/> <xsl:variable name="tail" select="substring-after($list, $separator)"/> <xsl:value-of select="$head"/> <xsl:call-template name="split"> <xsl:with-param name="list" select="$tail"/> <xsl:with-param name="separator" select="$separator"/> </xsl:call-template> </xsl:if> </xsl:template> This function returns me all the items. Is there any way to fetch particular item from these separated items ? Say I want to fetch item3. Can we do it directly ? Thanks in advance.

    Read the article

  • Calling Base Class Functions with Inherited Type

    - by Kein Mitleid
    I can't describe exactly what I want to say but I want to use base class functions with an inherited type. Like I want to declare "Coord3D operator + (Coord3D);" in one class, but if I use it with Vector3D operands, I want it to return Vector3D type instead of Coord3D. With this line of code below, I add two Vector3D's and get a Coord3D in return, as told to me by the typeid().name() function. How do I reorganize my classes so that I get a Vector3D on return? #include <iostream> #include <typeinfo> using namespace std; class Coord3D { public: float x, y, z; Coord3D (float = 0.0f, float = 0.0f, float = 0.0f); Coord3D operator + (Coord3D &); }; Coord3D::Coord3D (float a, float b, float c) { x = a; y = b; z = c; } Coord3D Coord3D::operator+ (Coord3D &param) { Coord3D temp; temp.x = x + param.x; temp.y = y + param.y; temp.z = z + param.z; return temp; } class Vector3D: public Coord3D { public: Vector3D (float a = 0.0f, float b = 0.0f, float c = 0.0f) : Coord3D (a, b, c) {}; }; int main () { Vector3D a (3, 4, 5); Vector3D b (6, 7, 8); cout << typeid(a + b).name(); return 0; }

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >