Search Results

Search found 5180 results on 208 pages for 'outside'.

Page 12/208 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • how to set SqlMapClient outside of spring xmls

    - by Omnipresent
    I have the following in my xml configurations. I would like to convert these to my code because I am doing some unit/integration testing outside of the container. xmls: <bean id="MyMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="classpath:sql-map-config-oracle.xml"/> <property name="dataSource" ref="IbatisDataSourceOracle"/> </bean> <bean id="IbatisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/my/mydb"/> </bean> code I used to fetch stuff from above xmls: this.setSqlMapClient((SqlMapClient)ApplicationInitializer.getApplicationContext().getBean("MyMapClient")); my code (for unit testing purposes): SqlMapClientFactoryBean bean = new SqlMapClientFactoryBean(); UrlResource urlrc = new UrlResource("file:/data/config.xml"); bean.setConfigLocation(urlrc); DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("oracle.jdbc.OracleDriver"); dataSource.setUrl("jdbc:oracle:thin:@123.210.85.56:1522:ORCL"); dataSource.setUsername("dbo_mine"); dataSource.setPassword("dbo_mypwd"); bean.setDataSource(dataSource); SqlMapClient sql = (SqlMapClient) bean; //code fails here when the xml's are used then SqlMapClient is the class that sets up then how come I cant convert SqlMapClientFactoryBean to SqlMapClient

    Read the article

  • JQuery Dragging Outside Parent

    - by Andy
    I'm using JQuery's draggable(); to make li elements draggable. The only problem is when the element is dragged outside its parent, it doesn't show up. That is, it doesn't leave the confines of its parent div. An example is here: http://imgur.com/N2N1L.png - it's as if the z-index for everything else has greater priority (and the element slides under everything). Here's the code: $('.photoList li').draggable({ distance: 20, snap: theVoteBar, revert: true, containment: 'document' }); And the li elements are placed in DIVs like this: <div class="coda-slider preload" id="coda-slider-1"> <div class="panel"> <div class="panel-wrapper"> <h2 class="title" style="display:none;">Page 1</h2> <ul class="photoList"> <li> <img class="ui-widget-content" src="photos/1.jpg" style="width:100px;height:100px;" /> </li> </ul> </div> </div> I'm positive the problem is it won't leave its parent container, but I'm not sure what to do to get it out. Any direction or help would be appreciated GREATLY!

    Read the article

  • MapScale not being persisted properly in mxd when programmatically changed outside of ArcMap environ

    - by Vidar
    I am trying to change the scale of a map in an mxd OUTSIDE of ArcMap in a standalone Windows application. The problem is the scale is never persisted - the best code I have come up with is the following: private void UpdateMapScaleInMxd(double scale, string mxdFullPath) { IMapDocument mapDocument = new MapDocumentClass(); mapDocument.Open(mxdFullPath, ""); IPageLayout pageLayout = (IPageLayout)mapDocument.ActiveView; IGraphicsContainer graphicsContainer = (IGraphicsContainer)pageLayout; graphicsContainer.Reset(); IMapFrame mapFrame; IActiveView tmpActiveView = null; IElement element = graphicsContainer.Next(); while (element != null) { if (element is IMapFrame) { mapFrame = (IMapFrame)element; tmpActiveView = (IActiveView)mapFrame.Map; mapFrame.ExtentType = esriExtentTypeEnum.esriExtentScale; mapFrame.MapScale = scale; tmpActiveView.Refresh(); } element = graphicsContainer.Next(); } mapDocument.Save(false, false); mapDocument.Close(); } I check the mxd by opening it up in ArcMap and the map scale has changed, although the little combobox to change the scale is now greyed out - does anyone know what that means!? So now I try to export the map as a PDF in code - and the most frustrating thing is - it exports the map at the previous scale that was set - NOT the scale I just changed it to! So infuriating - if anyone can help me understand where I am going wrong that would be great.

    Read the article

  • c# error for index was outside the bounds of array

    - by iliailiaey
    i have written below code but i have the error:Index was outside the bounds of the array.i cant understand its reason.how can i correct the code for preventing the error?(in the code,i want to make an array byte of size 57600 from an array byte of size 38400) int q = 0; int nbytes = 57600; byte[] gh = new byte[38400]; byte[] byte8 = new byte[nbytes]; byte[] aa = { 0xf8, 0x07, 0XE0, 0X1F }; for (int y = 0; y < nbytes-3; y += 3) { if (q < 38400-3) { byte8[y] = (byte)(gh[q] & aa[1]); byte8[y + 1] = (byte)(((gh[q] & aa[1]) << 5) | ((gh[q + 1] & aa[2]) >> 3)); byte8[y + 2] = (byte)((gh[q + 1] & aa[3]) << 3); q += 2; } }

    Read the article

  • Android Development-cannot download an image outside of onCreate

    - by murad
    hi everyone...... im new to android development........and i am stuck with a problem...... i am trying to develop an android application that shows the user the location of atms,hotels etc on a google map....i havent started working on the gps yet.as of now the app works something like this....first of all a map loads on which i intend to show the users current location......on clicking on the menu button there are 3 options..... -services -about us -quit on selecting services option the following options are available...... -atm -hospital -hotel etc on selecting the atm option we will be shown a screen displaying some text........ on using the menu for this screen we get the following menu items..... -sbi -canara -hdfc -icici etc my intention is that when the user selects the sbi option a map should load showing the various places where there are sbi atms near where the user is currently...... ......i started out with the google map api but i had to quit because when i select one of the menu options, such as "sbi",the map doesnt load......instead i am getting the error "application failed to load"...basically i was trying to load a map activity from my first map activity......after googling a bit without any results i tried another approach.......i tried to download and view the static map of the location i wanted..it worked.......but when i tried to download the static map when i select an option like before i get the same error..."application failed to load"...then i tried downloading 2 images from inside onCreate....that worked.......i cannot do the same thing outside the onCreate.....for eg.inside the function for the selected option... i have given the link to my code below..... if someone can please look into this it would be of great help to me.........i have been sitting with this problem for days now......and its urgent too.......i have done the project in eclipse....... httpDownload.java --- http://dpaste.com/195981/

    Read the article

  • Conditionally colour data points outside of confidence bands in R

    - by D W
    I need to colour datapoints that are outside of the the confidence bands on the plot below differently from those within the bands. Should I add a separate column to my dataset to record whether the data points are within the confidence bands? Can you provide an example please? Example dataset: ## Dataset from http://www.apsnet.org/education/advancedplantpath/topics/RModules/doc1/04_Linear_regression.html ## Disease severity as a function of temperature # Response variable, disease severity diseasesev<-c(1.9,3.1,3.3,4.8,5.3,6.1,6.4,7.6,9.8,12.4) # Predictor variable, (Centigrade) temperature<-c(2,1,5,5,20,20,23,10,30,25) ## For convenience, the data may be formatted into a dataframe severity <- as.data.frame(cbind(diseasesev,temperature)) ## Fit a linear model for the data and summarize the output from function lm() severity.lm <- lm(diseasesev~temperature,data=severity) jpeg('~/Desktop/test1.jpg') # Take a look at the data plot( diseasesev~temperature, data=severity, xlab="Temperature", ylab="% Disease Severity", pch=16, pty="s", xlim=c(0,30), ylim=c(0,30) ) title(main="Graph of % Disease Severity vs Temperature") par(new=TRUE) # don't start a new plot ## Get datapoints predicted by best fit line and confidence bands ## at every 0.01 interval xRange=data.frame(temperature=seq(min(temperature),max(temperature),0.01)) pred4plot <- predict( lm(diseasesev~temperature), xRange, level=0.95, interval="confidence" ) ## Plot lines derrived from best fit line and confidence band datapoints matplot( xRange, pred4plot, lty=c(1,2,2), #vector of line types and widths type="l", #type of plot for each column of y xlim=c(0,30), ylim=c(0,30), xlab="", ylab="" )

    Read the article

  • Accessing red5 server outside the localhost

    - by user1039290
    I am new on red5 server so I stuck in. I am trying to record videos from webcam and save them in to my server. To do this, I installed red5 to my server. In addition, I also downloaded red5recorder and put it into my webapps folder. But there is any information about its implementation details. Whatever. So I go on with Red5 SimpleRecorder tutorial. Everything works fine when I tried in my server, but there is a problem when I try to connect to server from other computer to record a video. Actually, video recording is handled but the recorded video is not uploaded to the server. When I work in localhost it works fine, but from outside I couldn't be able to record or upload the video. I change the red5-web.properties document, and set virtual host to my server's IP but it again only works in localhost. What could be the reason? Is it about file permissions? or what could it be? Kind regards, Can

    Read the article

  • JavaScript audio not playing outside of jQuery function

    - by user1814016
    I know the question title doesn't make much sense, but I can't think of a better way to put it. I am a newbie to jQuery and I'm using this code to fade in a <div> and play a sound: $(document).ready(function(){ $('#speech').fadeIn('medium', function() { play('msg_appear'); var sptx = $('<p class="stext">').text('There is nothing here.'); $('#speech').append(sptx); $('.stext').typeOut({marker: '', delay: 22}); }); }); This code runs fine however the sound plays after the fade-in is complete. I wanted it to play while it was fading in, so I tried placing the play() call outside of the fade-in function like this: $(document).ready(function(){ play('msg_appear'); $('#speech').fadeIn('medium', function() { However, now it's not playing at all. There's no errors on the JavaScript console so I'm unsure if it's a syntax error, and probably something obvious, but I don't know what. play() is a function I found to play audio, here it is if it matters at all. I placed it in the same file the above code is; right above the $(document).ready(). function play(sound) { if (window.HTMLAudioElement) { var snd = new Audio(''); if(snd.canPlayType('audio/ogg')) { snd = new Audio(sound + '.ogg'); } else if(snd.canPlayType('audio/mp3')) { snd = new Audio(sound + '.mp3'); } snd.play(); } else { alert('HTML5 Audio is not supported by your browser!'); } }

    Read the article

  • jQuery plugin Private functions inside Vs. Outside the each loop

    - by Pablo
    What is the difference between including private functions in a jQuery plugin in the examples below: Outside the loop: (function( $ ){ var defaults = {}; $.fn.cmFlex = function(opts) { this.each(function() { var $this = $(this); //Element specific options var o = $.extend({}, defaults, opts); //Code here }); function f1(){.... function f3(){.... function f2(){.... }; })( jQuery ); Inside the loop: (function( $ ){ var defaults = {}; $.fn.cmFlex = function(opts) { this.each(function() { var $this = $(this); //Element specific options var o = $.extend({}, defaults, opts); function f1(){.... function f3(){.... function f2(){.... }); }; })( jQuery ); The advantage of including the functions in the loop is that i will be able to access the $this variable as well as the Element specific options from f1() f2() f3(), are there any disadvantages to this?

    Read the article

  • Applying powershell outside IT Management.

    - by Tormod
    Hi. We have a flexible process control system by which automation engineers configure up large application comprising thousands of small logical units that are parameterized and integrated into the control flow. There are many tasks that are repetitive on the granular level, and there are a multitude of proprietary productivity tools that have been made to meet this demand. We have different business segments, and the automation engineers vary across the board in skill sets and interests. Fancy GUI and usability versus flexibility is a common discussion. At first glance, powershell seems to be a sensible platform to implement such tooling and which also would be a advantageous cross-over skill to manage the IT aspects of the system setup and deployment as a whole. This should allow the script savvy their desired flexibility (they are already a scripting crowd) and the GUI dependant could still get their desired GUI underpinned by powershell. But I can't seem to find many people/groups who have tried to use the scriptability and object passing of powershell extensively to accommodate a heterogeneous user community outside the realm of IT management. Do anybody have any tips or word of caution? Am I missing something obvious as to why this shouldn't be done? Shouldn't powershell be taking over the world? ;-)

    Read the article

  • Automate Field Entry in outside site

    - by JClaspill
    I am attempting to automate the entry of data into form fields. The problem is that this data (user/pass) is not known by the user. I'm not expressly hiding it from them, but they also don't need to know it. This is used to automate logins on several of our outside partner websites, who do not want our agents knowing their passwords. Sadly, most of these sites do not have any APIs I can work with... so I have to get the user logged in. I tried using an iframe and javascript, but I ran into the issue of security permissions denying it access. And sadly, our clients do not have access to add our domain to their sites(they seem to be 3rd party). Requirements: - Display webpage - Automatically enter data into fields Would be nice: - Automate signin similar to form.submit() - Flash/AJAX support. These seem to give the VB app issues. Is there a way to do this via javascript/html, and if not, do you have any recommendations for C#/php/asp.net options? PS: I am not sure what this techinque is called, so google isn't helping me it seems. Please set me straight on the terminology of what I am actually trying to accomplish.

    Read the article

  • Eval string for wordpress "in_category" workaround outside the loop

    - by fimbim
    In Wordpress you can´t use "in_category" outside the loop, so I created a function that gives me all the categories my article is in and create a "is_category" if statement out of it. I put my function in my "functions.php": function inCatAlt($catID){ $allCats = get_categories('child_of='.$catID); $childCats = 'is_category('.$catID.') '; foreach($allCats as $childCat){ $childCats.= 'or is_category('.$childCat->cat_ID.') '; }; $allchildCats = trim(trim($childCats, 'or ')); return $allchildCats; } and call this in my sidebar, single and so on: echo inCatAlt(13); which gives me this as a string back: "is_category(13) or is_category(16) or is_category(15)" This is exactly what I needed, but now I want to evaluate the string to use it in a if function like this: if(eval(inCatAlt(13))){ do something } But it doesn´t work. Do I evaluate it wrong or what is the problem? If I copy paste the output into the if function it works fine… Thanks in advanced guys. Is my first time asking something here. I´m curious :)

    Read the article

  • Make UIViewController outside Navigation Controller

    - by user1447316
    i have a question for you. I'm working on this app that has a walkthrough/tutorial screens and also login ones. On each of this screens there is a button to skip this part and go directly to use the app, without completing the registration (you know, so that people can test it before signing-in). As you can see i'm using Storyboards. The NowPlaying04 ViewController is actually the app itself. Obviously, when the user will be a registered one, i should also be able to jump right back to that screen, skipping the walkthrough and signin process. The first question is: how is the best way to structure this? The second quesion is: how i can make a ViewController outside that Navigation controller. Cause as you can see now, the NowPlaying04 ViewController inherits the top navigation bar. Which is a thing that i don't want. I don't need that. I hope that you have understood my question. I'll appreciate any help. Programmatically or by dragging stuff around, i'm ok with all the solutions. The important thing is that it works correctly! :-)

    Read the article

  • jquery ui draggable elements not 'draggable' outside of scrolling div

    - by Stu
    hello all, i am super stumped. i have many elements (floating href tags) in a div with a set height/width, with scroll set to "overflow: auto" in the css. this is the structure of the divs: <div id="tagFun_div_main"> <div id="tf_div_tagsReturn"> <!-- all the draggable elements go in here, the parent div scolls --> </div> <div id=" tf_div_tagsDrop"> <div id="tf_dropBox"></div> </div></div> the parent div's, 'tf_div_tagsReturn' and 'tf_div_tagsDrop' will ultimately float next to each other. here is the jquery which is run after all of the 'draggable' elements have been created with class name 'tag_cell', : $(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main' }); $("#tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); }); as i stated above, the draggable elements are draggable within div 'tf_div_tagsReturn', but they do not visually drag outside of that parent div. worthy to note, if i am dragging one of the draggable elements, and move the mouse over the droppable div, with id 'tf_dropBox', then the hoverclass is fired, i just can't see the draggable element any more. thank you very much for any advice on helping me find a solution. this is my first run at using jquery, so hopefully i am just missing something super obvious. i've been reading the documentation and searching forums thus far to no prevail :( thank you for your time. UPDATE: many thanks to Jabes88 for providing the solution which allowed me to achieve the functionality i was looking for, here is what my jquery ended up looking like, feel free to critique it, as i am new to jquery. $(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main', helper: 'clone', start : function() { this.style.display="none"; }, stop: function() { this.style.display=""; } }); $(".tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); });

    Read the article

  • Display all images from outside web root folder using PHP

    - by micmola
    Hello, I want to display all images that are stored outside my web root folder. Please help me. I am only able to display one image repeatedly. For example, if I have 5 images in my folder, only one image is displayed on my browser 5 times. Please help me on this. I've been working on this problem for over a month now. I'm a newbie. Help. Thank you. Here is the code I'm using. images.php <?php // Get our database connector require("includes/copta.php"); // Grab the data from our people table $sql = "select * from people"; $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error()); $imgLocation = " /uploadfile/"; while ($row = mysql_fetch_array($result)) { $imgName = $row["filename"]; $imgPath = $imgLocation . $imgName; echo "<img src=\"call_images.php?imgPath=" . $imgName . "\" alt=\"\"><br/>"; echo $row['id'] . " " . $imgName. "<br />"; } ?> call_images.php <?php // Get our database connector require("includes/copta.php"); $imgLocation = '/ uploadz/'; $sql = "select * from people"; $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error()); while ($row = mysql_fetch_array($result)) { $imgName = $row["filename"]; $imgPath = $imgLocation . $imgName; // Make sure the file exists if(!file_exists($imgPath) || !is_file($imgPath)) { header('HTTP/1.0 404 Not Found'); die('The file does not exist'); } // Make sure the file is an image $imgData = getimagesize($imgPath); if(!$imgData) { header('HTTP/1.0 403 Forbidden'); die('The file you requested is not an image.'); } // Set the appropriate content-type // and provide the content-length. header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: image/jpg"); header("Content-length: " . filesize($imgPath)); // Print the image data readfile($imgPath); exit(); } ?>

    Read the article

  • Fleunt NHibernate not working outside of nunit test fixtures

    - by thorkia
    Okay, here is my problem... I created a Data Layer using the RTM Fluent Nhibernate. My create session code looks like this: _session = Fluently.Configure(). Database(SQLiteConfiguration.Standard.UsingFile("Data.s3db")) .Mappings( m => { m.FluentMappings.AddFromAssemblyOf<ProductMap>(); m.FluentMappings.AddFromAssemblyOf<ProductLogMap>(); }) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); When I reference the module in a test project, then create a test fixture that looks something like this: [Test] public void CanAddProduct() { var product = new Product {Code = "9", Name = "Test 9"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); using (ISession session = OrmHelper.OpenSession()) { var fromDb = session.Get<Product>(product.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(fromDb, product); Assert.AreEqual(fromDb.Id, product.Id); } My tests pass. When I open up the created SQLite DB, the new Product with Code 9 is in it. the tables for Product and ProductLog are there. Now, when I create a new console application, and reference the same library, do something like this: Product product = new Product() {Code = "10", Name = "Hello"}; IProductRepository repository = new ProductRepository(); repository.AddProduct(product); Console.WriteLine(product.Id); Console.ReadLine(); It doesn't work. I actually get pretty nasty exception chain. To save you lots of head aches, here is the summary: Top Level exception: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.\r\n\r\n The PotentialReasons collection is empty The Inner exception: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. Both the unit test library and the console application reference the exact same version of System.Data.SQLite. Both projects have the exact same DLLs in the debug folder. I even tried copying SQLite DB the unit test library created into the debug directory of the console app, and removed the build schema lines and it still fails If anyone can help me figure out why this won't work outside of my unit tests it would be greatly appreciated. This crazy bug has me at a stand still.

    Read the article

  • Hide a base class method from derived class, but still visible outside of assembly

    - by clintp
    This is a question about tidyness. The project is already working, I'm satisfied with the design but I have a couple of loose ends that I'd like to tie up. My project has a plugin architecture. The main body of the program dispatches work to the plugins that each reside in their own AppDomain. The plugins are described with an interface, which is used by the main program (to get the signature for invoking DispatchTaskToPlugin) and by the plugins themselves as an API contract: namespace AppServer.Plugin.Common { public interface IAppServerPlugin { void Register(); void DispatchTaskToPlugin(Task t); // Other methods omitted } } In the main body of the program Register() is called so that the plugin can register its callback methods with the base class, and then later DispatchTaskToPlugin() is called to get the plugin running. The plugins themselves are in two parts. There's a base class that implements the framework for the plugin (setup, housekeeping, teardown, etc..). This is where DispatchTaskToPlugin is actually defined: namespace AppServer.Plugin { abstract public class BasePlugin : MarshalByRefObject, AppServer.Plugin.Common.IAppServerPlugin { public void DispatchTaskToPlugin(Task t) { // ... // Eventual call to actual plugin code // } // Other methods omitted } } The actual plugins themselves only need to implement a Register() method (to give the base class the delegates to call eventually) and then their business logic. namespace AppServer.Plugin { public class Plugin : BasePlugin { override public void Register() { // Calls a method in the base class to register itself. } // Various callback methods, business logic, etc... } } Now in the base class (BasePlugin) I've implemented all kinds of convenience methods, collected data, etc.. for the plugins to use. Everything's kosher except for that lingering method DispatchTaskToPlugin(). It's not supposed to be callable from the Plugin class implementations -- they have no use for it. It's only needed by the dispatcher in the main body of the program. How can I prevent the derived classes (Plugin) from seeing the method in the base class (BasePlugin/DispatchTaskToPlugin) but still have it visible from outside of the assembly? I can split hairs and have DispatchTaskToPlugin() throw an exception if it's called from the derived classes, but that's closing the barn door a little late. I'd like to keep it out of Intellisense or possibly have the compiler take care of this for me. Suggestions?

    Read the article

  • OpenGL ES functions not accepting values originating outside of it's view

    - by Josh Elsasser
    I've been unable to figure this out on my own. I currently have an Open GLES setup where a view controller both updates a game world (with a dt), fetches the data I need to render, passes it off to an EAGLView through two structures (built of Apple's ES1Renderer), and draws the scene. Whenever a value originates outside of the Open GL view, it can't be used to either translate objects using glTranslatef, or set up the scene using glOrthof. If I assign a new value to something, it will work - even if it is the exact same number. The two structures I have each contain a variety of floating-point numbers and booleans, along with two arrays. I can log the values from within my renderer - they make it there - but I receive errors from OpenGL if I try to do anything with them. No crashes result, but the glOrthof call doesn't work if I don't set the camera values to anything different. Code used to set up scene: [EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); //clears the color buffer bit glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); //sets up the scene w/ ortho projection glViewport(0, 0, 320, 480); glLoadIdentity(); glOrthof(320, 0, dynamicData.cam_x2, dynamicData.cam_x1, 1.0, -1.0); glClearColor(1.0, 1.0, 1.0, 1.0); /*error checking code here*/ "dynamicData" (which is replaced every frame) is created within my game simulation. From within my controller, I call a method (w/in my simulation) that returns it, and pass the result on to the EAGLView, which passes it on to the renderer. I haven't been able to come up with a better solution for this - suggestions in this regard would be greatly appreciated as well. Also, this function doesn't work as well (values originate in the same place): glTranslatef(dynamicData.ship_x, dynamicData.ship_y, 0.0); Thanks in advance. Additional Definitions: Structure (declared in a separate header): typedef struct { float ship_x, ship_y; float cam_x1, cam_x2; } dynamicRenderData; Render data getter (and builder) (every frame) - (dynamicData)getDynRenderData { //d_rd is an ivar, zeroed on initialization d_rd.ship_x = mainShip.position.x; d_rd.ship_y = mainShip.position.y; d_rd.cam_x1 = d_rd.ship_x - 30.0f; d_rd.cam_x2 = d_rd.cam_x1 + 480.0f; return d_rd; } Zeroed at start. (d_rd.ship_x = 0;, etc…) Setting up the view. Prototype (GLView): - (void)draw: (dynamicRenderData)dynamicData Prototype (Renderer): - (void)drawView: (dynamicRenderData)dynamicData How it's called w/in the controller: //controller [glview draw: [world getDynRenderData]]; //glview (within draw) [renderer drawView: dynamicData];

    Read the article

  • PHP Changing Class Variables Outside of Class

    - by Jamie Bicknell
    Apologies for the wording on this question, I'm having difficulties explaining what I'm after, but hopefully it makes sense. Let's say I have a class, and I wish to pass a variable through one of it's methods, then I have another method which outputs this variable. That's all fine, but what I'm after is that if I update the variable which was originally passed, and do this outside the class methods, it should be reflected in the class. I've created a very basic example: class Test { private $var = ''; function setVar($input) { $this->var = $input; } function getVar() { echo 'Var = ' . $this->var . '<br />'; } } If I run $test = new Test(); $string = 'Howdy'; $test->setVar($string); $test->getVar(); I get Var = Howdy However, this is the flow I would like: $test = new Test(); $test->setVar($string); $string = 'Hello'; $test->getVar(); $string = 'Goodbye'; $test->getVar(); Expected output to be Var = Hello Var = Goodbye I don't know what the correct naming of this would be, and I've tried using references to the original variable but no luck. I've come across this in the past, with the PDO prepared statements, see Example #2 $stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)"); $stmt->bindParam(1, $name); $stmt->bindParam(2, $value); // insert one row $name = 'one'; $value = 1; $stmt->execute(); // insert another row with different values $name = 'two'; $value = 2; $stmt->execute(); I know I can change the variable to public and do the following, but it isn't quite the same as how the PDO class handles it, and I'm really looking to mimic that behaviour. $test = new Test(); $test->setVar($string); $test->var = 'Hello'; $test->getVar(); $test->var = 'Goodbye'; $test->getVar(); Any help, ideas, pointers, or advice would be greatly appreciated, thanks.

    Read the article

  • C# Accessing controls from an outside class without "public"

    - by Kurt W
    I know this has been asked before but I believe my situation is a bit different -- or I don't understand the answers given. I have spent about 4 hours working on this solidly and finally realized, I just don't know what to do. I have 2 Forms (Form1, Settings) and a class I created called Themes. I have get/set properties that currently work but are all within Form1 and I would like to move as much code related to themeing as I can OUTSIDE of Form1 and into Themes.cs. Changing Theme: To change the theme, the user opens up the Settings form and selects a theme from the dropdown menu and presses the 'Set' button -- this all works, but now I want to move it into my own class and I can't get the code to compile. Here is example code that works before moving -- note that this is only 2 different controls I want to modify but there are about 30 total. I am abridging the code: Form 1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnSettings_Click(object sender, EventArgs e) { Settings frm = new Settings(this); frm.Show(); } private Color txtRSSURLBGProperty; private Color txtRSSURLFGProperty; public Color TxtRSSURLBGProperty { get { return txtRSSURLBGProperty; } set { txtRSSURL.BackColor = value; } } public Color TxtRSSURLFGProperty { get { return txtRSSURLFGProperty; } set { txtRSSURL.ForeColor = value; } } Settings Form: public partial class Settings : Form { public Settings() { InitializeComponent(); } private Form1 rssReaderMain = null; public Settings(Form requestingForm) { rssReaderMain = requestingForm as Form1; InitializeComponent(); } private void button2_Click(object sender, EventArgs args) { // Appearence settings for DEFAULT THEME if (cbThemeSelect.SelectedIndex == 1) { this.rssReaderMain.TxtRSSURLBGProperty = Color.DarkSeaGreen; this.rssReaderMain.TxtRSSURLFGProperty = Color.White; [......about 25 more of these....] } The theme class is currently empty. Again, the goal is to move as much code into the themes class (specifically the get/set statements if at all possible!) and hopefully just use a method similar to this within the Settings form once the proper drowndown item is selected: SetTheme(Default); I hope someone can help, and I hope I explained it right! I have been racking my brain and I need to have this done fairly soon! Much thanks in advance as I'm sure everyone says. I have teamviewer or logmein if someone wants to remote in -- that is just as easy. I can also send my project as a zip if needed. Thanks so much, Kurt Modified code for review: Form1 form: public partial class Form1 : ThemeableForm { public Form1() { InitializeComponent(); } ThemeableForm form: internal abstract class ThemeableForm : Form { private Color rssLabelBGProperty; private Color rssLabelFGProperty; public Color RssLabelBGProperty { get { return rssLabelBGProperty; } set { lRSS.BackColor = value; } } public Color RssLabelFGProperty { get { return rssLabelFGProperty; } set { lRSS.ForeColor = value; } } Settings form: public Settings(ThemeableForm requestingForm) { rssReaderMain = requestingForm as ThemeableForm; InitializeComponent(); } private ThemeableForm rssReaderMain = null; private void button2_Click(object sender, EventArgs args) { // Appearence settings for DEFAULT THEME if (cbThemeSelect.SelectedIndex == 1) { this.rssReaderMain.LRSSBGProperty = Color.DarkSeaGreen; this.rssReaderMain.LRSSFGProperty = Color.White; } Now the all the controls in my get/set (lRSS in the example code above) error out with does not exist in the current context. I also get the warning: Warning 1The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: Form1 --- The base class 'RSSReader_BKRF.ThemeableForm' could not be loaded. Ensure the assembly has been referenced and that all projects have been built. 0 0

    Read the article

  • Add objects to Arraylist inside loop and get a list of them outside loops

    - by AgusDG
    Im already done with a method to do a shot on a board (bidimensional array). THe shot goes from the bottom to the top, and depending of the direction, it do bounces on the walls to get to the top. The thing is that I did the method to represent the trayectory with an 'x'. Now, I want to add the coordinates x and y of each position of the shot (b [x][y]) to and Arraylist of Objects Position. public Position(int row,int col) { this.row = row; this.col = col; } The thing is that the method uses a for loop and inside if loops, and I'll need to create the objects inside, and get them outside. I did that : public static ArrayList<Position> showTrayectory (char [][] b , int shotDirection, char bubble){ int row = 0, col = 0; ArrayList<Position> aListPos = new ArrayList<Position>(); Position positionsOfShot = new Position(row,col); START = ((RIGHT_WALL)/2) + shotDirection; boolean shotRight = false; if(shotDirection < 0) shotRight = false; else if(shotDirection > 0) shotRight = true; for(int y = BOTTOM,x = START ;y >= 0;y--) { if(!isOut(y,x) && !emptyCell(y,x)) break; if(x <= LEFT_WALL) shotRight = true; if(x >= RIGHT_WALL) shotRight = false; if(!isOut(y,x) && shotRight == true) { positionsOfShot = new Position(y,x); aListPos.add(positionsOfShot); b[y][x] = SHOT; ++x; } if(!isOut(y,x) && shotRight == false){ positionsOfShot = new Position(y,x); aListPos.add(positionsOfShot); b[y][x] = SHOT; --x; } } // The nested for loops below are for showing the positions // But I dont need it that way // I must get the trayectory from an ArrayList and print it from there for(int y=0;y < b.length;y++){ System.out.println(); for(int x=0;x < b[y].length;x++){ System.out.print(" "+b [y][x]+" "); } } System.out.println("\nTrayectory of the shot ["+shotDirection+"]"); System.out.println("Next bubble ["+bubble+"]"); for( Position ii : aListPos){ System.out.println("(" + positionsOfShot.getFila() + "," + positionsOfShot.getColumna()+")"); } return aListPos; } The sentence " b[y][x] = SHOT; " is still there, to see the proper trayectory of the shot (its not needed that way), but what I need, is getting the trayectory in an ArrayList, and print the trayectory from there. All that I get is a wrong position, and repeated during the number of positions the shot goes through. I need some help. I suppose the problem is that Im creating and adding Position Objects inside an ArrayList inside loops, but in a wrong way. I will need you to explain me how to do it properly ; ) Thanks in advance. I'll add the output for you see better what is that above haha *************************** y b y b g r b g o y g a a r y o y y r b y g r r o b o y y g b a r y r o a y y o o r r g r - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - x - - - - - - - x - - - - - - - x - - - Trayectory of the shot [1] Next bubble [y] (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) Action?

    Read the article

  • Insert <div> outside every three <li>

    - by ignaty
    Hello. I have something like this: function cat_filter() { $.ajax({ type: "POST", url: 'json/cat_filter.aspx', data: "catId=" + "&styleId=" + "&colourId=" + "&sizeId=" + "&minPrice=" + "&maxPrice=", dataType: "json", beforeSend: function () { //load loading cursor }, success: function (data) { var CatItems = ""; for (var x = 0; x < data.PRODUCTS.length; x++) { CatItems += '<li class="jcarousel-item jcarousel-item-horizontal jcarousel-item-' + [x] + ' jcarousel-item-' + [x] + '-horizontal jcarousel-item-placeholder jcarousel-item-placeholder-horizontal"><a class="large_image" href="#"><img src="' + data.PRODUCTS[x].product_img + '" alt="' + data.PRODUCTS[x].product_name + '"></a><h3 class="geo_17_darkbrown">' + data.PRODUCTS[x].product_name + '</h3>'; if (data.PRODUCTS[x].product_onsale == 1) { CatItems += '<img alt="sale" src="assets/images/sale.gif" class="sale"><span class="geo_17_red_linethr">&pound;' + data.PRODUCTS[x].product_retailprice + '</span>&nbsp;&nbsp;<span class="price geo_17_darkbrown">&pound;' + data.PRODUCTS[x].product_webprice + '</span>'; } else { CatItems += '<span class="price geo_17_darkbrown">&pound;' + data.PRODUCTS[x].product_webprice + '</span>'; } if (data.PRODUCTS[x].product_COLOURS) { CatItems += '<span class="colour">'; for (var y = 0; y < data.PRODUCTS[x].product_COLOURS.length; y++) { CatItems += '<span><a href="' + data.PRODUCTS[x].product_COLOURS[y].colours_large + '"><img src="' + data.PRODUCTS[x].product_COLOURS[y].colours_thumb + '" alt="' + data.PRODUCTS[x].product_COLOURS[y].colour_name + '" /></a></span>'; } CatItems += '</span>'; } CatItems += '</li>'; } $('.carousel_00 ul').html(CatItems); }, complete: function () { //remove loading cursor } }); } This code generates this html: <div class="carousel_00"> <ul> <li><a href="#" class="large_image"><img src="assets/images/dress1.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> <span class="colour"> <span><a href="assets/images/big_image_1.gif"><img src="assets/images/black.gif" alt="balck"></a></span> <span><img src="assets/images/brown.gif" alt="brown"></span> <span><img src="assets/images/purple.gif" alt="purple"></span> </span> </li> <li><a href="#"><img src="assets/images/dress2.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><img class="sale" src="assets/images/sale.gif" alt="sale" /><a href="#"><img src="assets/images/dress3.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="geo_17_red_linethr">&pound;99.99</span>&nbsp;&nbsp;<span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><a href="#"><img src="assets/images/dress1.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;59.99</span> </li> <li><a href="#"><img src="assets/images/dress2.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><a href="#"><img src="assets/images/dress3.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><a href="#"><img src="assets/images/dress1.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><a href="#"><img src="assets/images/dress2.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> <li><a href="#"><img src="assets/images/dress3.gif" alt="image"></a> <h3 class="geo_17_darkbrown">Rachel Dress</h3> <span class="price geo_17_darkbrown">&pound;89.99</span> </li> </ul></div> What I need is that every 3 li's will be in div /div. I know that this is not semantic and not right, but this is only for example. (Basically if I will figure put how to do this, I will replace li's on spans and that div that i need outside li's on li). Will be very glad if someone will help me. Because code that I have is already too much for me.

    Read the article

  • Include WordPress Content Outside of WordPress

    - by S Pangborn
    I'm looking to build a mobile version of a WordPress site and have most of it built in static files, but am trying to get access to the WordPress content from inside an external PHP file that the mobile site will run from. How can I get access to the loop or database without manually writing SQL queries?

    Read the article

  • JavaScript - Settting property on Object in Image load function, property not set once outside funct

    - by Sunday Ironfoot
    Sometimes JavaScript doesn't make sense to me, consider the following code that generates a photo mosaic based on x/y tiles. I'm trying to set a .Done property to true once each Mosaic image has been downloaded, but it's always false for some reason, what am I doing wrong? var tileData = []; function generate() { var image = new Image(); image.onload = function() { // Build up the 'tileData' array with tile objects from this Image for (var i = 0; i < tileData.length; i++) { var tile = tileData[i]; var tileImage = new Image(); tileImage.onload = function() { // Do something with this tile Image tile.Done = true; }; tileImage.src = tile.ImageUrl; } }; image.src = 'Penguins.jpg'; tryDisplayMosaic(); } function tryDisplayMosaic() { setTimeout(function() { for (var i = 0; i < tileData.length; i++) { var tile = tileData[i]; if (!tile.Done) { tryDisplayMosaic(); return; } } // If we get here then all the tiles have been downloaded alert('All images downloaded'); }, 2000); } Now for some reason the .Done property on the tile object is always false, even though it is explicitly being set to true inside tileImage.onload = function(). And I can ensure you that this function DOES get called because I've placed an alert() call inside it. Right now it's just stuck inside an infinite loop calling tryDisplayMosaic() constantly. Also if I place a loop just before tryDisplayMosaic() is called, and in that loop I set .Done = true, then .Done property is true and alert('All images downloaded'); will get called.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >