Daily Archives

Articles indexed Sunday June 30 2013

Page 3/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Transforming object world space matrix to a position in world space

    - by Fredrik Boston Westman
    Im trying to make a function for picking objects with a bounding sphere however I have run in to a problem. First I check against my my bounding sphere, then if it checks out then I test against the vertexes. I have already tested my vertex picking method and it work fine, however when I check first with my bounding sphere method it dosnt register anything. My conclusion is that when im transform my sphere position in to the position of the object in world space, the transformation goes wrong ( I base this on the fact the the x coordinate always becomes 1, even tho i translate non of my meshes along the x-axis to 1). So my question is: What is the proper way to transform a objects world space matrix to a position vector ? This is how i do it now: First i set my position vector to 0. XMVECTOR meshPos = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); Then I trannsform it with my object space matrix, and then add the offset to the center of the mesh. meshPos = XMVector3TransformCoord(meshPos, meshWorld) + centerOffset;

    Read the article

  • Making a game "resize-safe"

    - by CPP_Person
    It's one thing to get the graphics aligned perfectly, it's another to do this for every single resolution and not take too much time and/or make the code unreadable due to size. Games like Battlefield 3 and Minecraft seem to manage this. But what do they do to keep things from stretching or going off the screen? I don't know any algorithms to do this. I'd like some help on this topic. I've always programmed games that only handle a single resolution, so help would be appreciate.

    Read the article

  • EaseFunction in LoopEntityModifier

    - by Siddharth
    For my game, I need EaseFunction in LoopEntityModifier. In my game, I am rotating ball over certain object. For giving effect I want to use EaseFunction. I want to rotate ball around an object take around 4 to 5 round that was already rotating but I want add some effect so that it looks good. For this I have to use EaseFunction which suits my needs. But if I put EaseFunction in rotation modifier then each round rotation modifier apply an effect of EaseFunction that I want only one time occur either starting or ending time. So if I can able to provide EaseFunction in LoopEntityModifier then it will good for me or something similar also work for me. At present my code is something similar like this. new LoopEntityModifier(new RotationModifier(...)); I hope someone has some idea on this.

    Read the article

  • Create links programmatically inside an EmberJS view

    - by Michael Gallego
    I have a pretty complex view to render which involves some kind of recursion (the typical folder/file nested list). The fact that it contains heterogeneous objects (folders and files) make it even harder to write Handlebars templates. Therefore, the only solution I've found is to create a view, and manually fill the render buffer. I came with the following solution: App.LibraryContentList = Ember.View.extend({ tagName: 'ol', classNames: ['project-list', 'dd-list'], nameChanged: function() { this.rerender(); }.observes('[email protected]'), render: function(buffer) { // We only start with depth of zero var content = this.get('content').filterProperty('depth', 0); content.forEach(function(item) { this.renderItem(buffer, item); }, this); }, renderItem: function(buffer, item) { switch (item.constructor.toString()) { case 'Photo.Folder': this.renderFolder(buffer, item); break; case 'Photo.File': this.renderFile(buffer, item); break; } }, renderFolder: function(buffer, folder) { buffer.push('<li class="folder dd-item">'); buffer.push('<span class="dd-handle">' + folder.get('name') + '</span>'); // Merge sub folders and files, and sort them by sort order var content = this.mergeAndSort(); if (content.get('length') > 0) { buffer.push('<ol>'); content.forEach(function(item) { this.renderItem(buffer, item); }, this); buffer.push('</ol>'); } buffer.push('</li>'); }, renderFile: function(buffer, album) { buffer.push('<li class="album dd-item">'); buffer.push('<span class="dd-handle">' + file.get('name') + '</span>'); buffer.push('</li>'); } }); Now, what I'd like is to be able to add links so that each folder and each file is clickable and redirect to another route. But how am I supposed to do that, as I don't have access to the linkTo helper? I've tried to play with the LinkView view, but without any success. Should I register handlers manually for each item? I've also thought about breaking that with a CollectionView instead, and splitting the content by depth so that I could render it using templates, but it seems more complicated. Any thoughts?

    Read the article

  • Permanent remove of logo in Windows Scripting Host (WSH() scripts.

    - by antonio
    I know two ways to remove the logo permanently. The "official" one: cscript //Nologo //S Will save current command line options for current user. A ftype approach with admin privileges: ftype wsffile="%SystemRoot%\System32\CScript.exe" //nologo "%%1" %%* ftype jsfile="%SystemRoot%\System32\CScript.exe" //nologo "%%1" %%* ftype vbsfile="%SystemRoot%\System32\CScript.exe" //nologo "%%1" %%* Double-%'s are needed only if you use the lines in a batch file. The latter will all users via affect the reg key HKEY_CLASSES_ROOT\<file>\Shell\Open\Command, where <file> can be wsffile, jsfile or vbsfile. Do you know where are stored the cscript //Nologo //S settings?

    Read the article

  • Sending text to textarea

    - by user2536258
    I have a textarea that I would like to send a value to and I am using the following to achieve this.. <textarea style="width: 300px; height: 150px;" name="message"></textarea> <a href="#updates" onclick="document.sendform.message.value='7'; return true;"style="color:white">Year 7</a> This is working as expected however it also overwrites any text that is in the textarea already, is there any way I can achieve this without over writing the existing text in the textarea? Thanks

    Read the article

  • cannot see values from list in c#

    - by PriceCheaperton
    I have the following code: But i cannot response write the values in the list for debugging purposes... public void LottoWinners(object sender, EventArgs e) { Dictionary<int, int> number = new Dictionary<int, int>(); Random generator = new Random(); while (number.Count < 6) { number[generator.Next(1, 49)] = 1; } int[] lotto = number.Keys.OrderBy(n => n).ToArray(); List<int> lst = lotto.OfType<int>().ToList(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < lst.Count; i++) // Loop through List with for { builder.Append(lst).Append("|"); // Append string to StringBuilder } string result = builder.ToString(); // Get string from StringBuilder Response.Write(result); } But all i see is as my result. I should be seeing the values of my list! System.Collections.Generic.List`1

    Read the article

  • CSS overflow character not pushing down <div>

    - by Uncle Toby
    I have a <div> called bigbox which contain a <div>called wrapper . The wrapper contain 2 <div> called textbox and checkbox. If the characters inside textbox overflow , it doesn't push the other wrapper below . How can I make the below wrapper go down ? here is the jsfiddle : http://jsfiddle.net/WA63P/ <html> <head> <title>Page</title> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <style type="text/css"> .bigbox { background-color: #F5E49C; color: #000; padding: 0 5px; width:280px; height:500px; position: absolute; text-align: center;content: "";display: block;clear: both; } .box { background-color: #272822; color: #9C5A3C; height:100px; width:260px; margin-bottom: 10px; position: relative; top:10px; } .textbox { background-color: #FFFFFF; color: #272822; height:100px; width:160px;float:left;text-align: left } .checkbox { background-color: #FFFFFF; height:50px; width:50px; float:right; d } </style> <div class="bigbox"> <div class="box"> <div class="textbox">background background background background background background background background background background background background background background background background background background background background background background </div> <div class="checkbox"> </div> </div> <div class="box"> <div class="textbox"> </div> <div class="checkbox"> </div> </div> </body> </html>

    Read the article

  • QList as a function parameter - Linking Error - LNK2019

    - by user2445136
    I have an issue with QList as a function parameter and I'll be glad if you can assist me. I have this code for example: void SpinBoxList_Enable(QList spinBoxList) { foreach(QWidget mWidget,*spinBoxList) mWidget-setEnabled(false); } and in the implemantation file I use the QList variable as a pointer: SpinBoxList_Enable(&controlBoardSpinBoxList); ( controlBoardSpinBoxList is a variable of QList ). The Function ToggleBoards_Slot(bool) is a slot that uses When I compile, I get this error message: 1cmosaixserialnumber.obj : error LNK2019: unresolved external symbol "private: void __cdecl CMosaixSerialNumber::SpinBoxList_Disable(class QList *)" (?SpinBoxList_Disable@CMosaixSerialNumber@@AEAAXPEAV?$QList@PEAVQWidget@@@@@Z) referenced in function "public: void __cdecl CMosaixSerialNumber::ToggleBoards_Slot(bool)" (?ToggleBoards_Slot@CMosaixSerialNumber@@QEAAX_N@Z) 1cmosaixserialnumber.obj : error LNK2019: unresolved external symbol "private: void __cdecl CMosaixSerialNumber::SpinBoxList_Enable(class QList *)" (?SpinBoxList_Enable@CMosaixSerialNumber@@AEAAXPEAV?$QList@PEAVQWidget@@@@@Z) referenced in function "private: void __cdecl CMosaixSerialNumber::on_ControlBoardCheckBox_StateChanged(int)" (?on_ControlBoardCheckBox_StateChanged@CMosaixSerialNumber@@AEAAXH@Z) How can I fix this ? Thanks, EVH671

    Read the article

  • Test if single linked list is circular by traversing it only once

    - by user1589754
    I am a fresher and I was asked this question in a recent interview I gave. The question was --- By traversing each element of linked list just once find if the single linked list is circular at any point. To this I answered that we will store reference of each node while traversing the list in another linked list and for every node in the list being tested we will find if the reference exists in the list I am storing the references. The interviewer said that he needs a more optimized way to solve this problem. Can anyone please tell me what would be a more optimized method to solve this problem.

    Read the article

  • loop html table using jquery and for loop (not for each)

    - by Mandeep Singh
    I have a HTML table <table id="mytab"> <thead> <th>col1</th> <th>col2</th> </thead> <tbody> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>11</td> <td>22</td> </tbody> </table> and i am writing the jquery function function LoopTable() { $row = $('#mytab tbody >tr"); //here I have successfully find all the rows. //now i want to loop on rows and find each column row for (var i=0; i<$rows.length; i++) { //need something here to find col data } what I should use to have column values from row

    Read the article

  • Check if window has focus

    - by user2536244
    I need to check if the user has windows on focus, I'm currently doing this: var isonfocus=true; window.onblur = function(){ isonfocus=false; } window.onfocus = function(){ isonfocus=true; } And whenever I need to check if the user has the windows on focus I just do if(isonfocus==true). Problem: if the user loses focus before the page loads, even if I do if(isonfocus==true) it will return true, even though the window is not on focus, and defining the var to false var isonfocus=false; will do the reverse. Can someone help me? Thanks.

    Read the article

  • How to preserve data integrity while minimizing the transmission size

    - by user1500578
    we have sensors in the wild that send their data to a server every day via TCP/IP, either through 3G or through satellite for the physical layer. The sensors can automatically switch from one to the other depending on their location and the quality of the signal with the local 3G operator. Given that the 3G and satellite communications are very expensive, we want to minimize the amount of data to send. But also, we want to protect ourselves from lost data. What would be the best strategy to ensure with reasonable certainty that the integrity of our data is preserved, while minimizing the amount of redundancy, i.e the amount of data transmitted ? I've read about the zfec codec, but I'm not sure if we need to transmit all the chunks, or if we need to send a hash code along each chunk.

    Read the article

  • SQLite join selection from the same table using reference from another table

    - by daikini
    I have two tables: table: points |key_id | name | x | y | ------------------------ |1 | A |10 |20 | |2 | A_1 |11 |21 | |3 | B |30 |40 | |4 | B_1 |31 |42 | table: pairs |f_key_p1 | f_key_p2 | ---------------------- |1 | 2 | |3 | 4 | Table 'pairs' defines which rows in table 'points' should be paired. How can I query database to select paired rows? My desired query result would be like this: |name_1|x_1|x_2|name_2|x_2|y_2| ------------------------------- |A |10 |20 |A_1 |11 |21 | |B |30 |40 |B_1 |31 |41 |

    Read the article

  • find whether the string starts and ends with the same word

    - by Ajax
    I am trying to check whether the string starts and ends with the same word. egearth. s=raw_input(); m=re.search(r"^(earth).*(earth)$",s) if m is not None: print "found" my problem is when the string consists only of one word eg: earth At present I have hard coded this case by if m is not None or s=='earth': print "found" Is there any other way to do this? EDIT: words in a string are separated by spaces. looking for a regex solution some examples: "earth is earth" ,"earth", -- valid "earthearth", "eartheeearth", "earth earth mars" -- invalid

    Read the article

  • Is there a more clear way to write out multiple functions that are part of an object?

    - by Gemma
    I have the following: $scope.modalReset = function () { gridService.modalReset($scope); } $scope.rowAction = function (action, row) { gridService.rowAction(action, $scope, row, 'Question'); } $scope.submitItem = function (formData) { gridService.submitItem($scope, 'Question', formData); } Is there a way that these function calls could be written more simply. I am not looking to combine them. There are all functions that are part of the scope object.

    Read the article

  • Manual metrics and treemap components

    - by Greg
    I have a problem with SonarQube. I use web API to inject manual metrics values for a project like this : curl -u nom:password -d "resource=<projet>&metric=<key de la metric>&val=<valeur>" http://localhost:8081/sonar/api/manual_measures One of these metrics is a percentage and this metric is declared as a Percentage value in Sonar in Settings = Manual Metrics window. I have a project with components and each project and components have this metric value. When I want to show this metric as a color metric in a "treemap of components" of widget, all the treemap is grey (as if values are not defined). But if I put mouse on the name of component in treemap, I saw the color metric value as a percentage value like this : myComponent - ncloc: 800 - myMetric: 84,0% Moreover, scale metric color does not appear in treemap title (after Size ncloc Color <my metric>).

    Read the article

  • Pull datasets from DB and manipulate into separate arrays

    - by dresdin
    My DB has four fields, date:date, morning:integer, afternoon:integer, evening:integer. Google charts needs the data split into one array per dataset (example below). What's the best way to do this? ['Day', 'Morning', 'Afternoon', 'Evening'], ['06/27/13', 1000, 400 234], ['06/28/13', 1170, 460 275], ['06/29/13', 660, 1120 377], ['06/30/13', 1030, 540 934] I've tried this without much luck: var data = google.visualization.arrayToDataTable([ <% @todo.each do |t| %> ['Day', 'Morning', 'Afternoon', 'Evening'], [<%= t.date.strftime("%m/%d/%y") %>, <%= t.morning %>, <%= t.afternoon %>, <%= t.evening %>] <% end %> ]);

    Read the article

  • Having Issue with Bounded Wildcards in Generic

    - by Sanjiv
    I am new to Java Generics, and I'm currently experimenting with Generic Coding....final goal is to convert old Non-Generic legacy code to generic one... I have defined two Classes with IS-A i.e. one is sub-class of other. public class Parent { private String name; public Parent(String name) { super(); this.name = name; } } public class Child extends Parent{ private String address; public Child(String name, String address) { super(name); this.address = address; } } Now, I am trying to create a list with bounded Wildcard. and getting Compiler Error. List<? extends Parent> myList = new ArrayList<Child>(); myList.add(new Parent("name")); // compiler-error myList.add(new Child("name", "address")); // compiler-error myList.add(new Child("name", "address")); // compiler-error Bit confused. please help me on whats wrong with this ?

    Read the article

  • WebSocket handshake with Ruby and EM::WebSocket::Server

    - by Chad Johnson
    I am trying to create a simple WebSocket connection in JavaScript against my Rails app. I get the following: WebSocket connection to 'ws://localhost:4000/' failed: Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing What am I doing wrong? Here is my code: JavaScript: var socket = new WebSocket('ws://localhost:4000'); socket.onopen = function() { var handshake = "GET / HTTP/1.1\n" + "Host: localhost\n" + "Upgrade: websocket\n" + "Connection: Upgrade\n" + "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\n" + "Sec-WebSocket-Protocol: quote\n" + "Sec-WebSocket-Version: 13\n" + "Origin: http://localhost\n"; socket.send(handshake); }; socket.onmessage = function(data) { console.log(data); }; Ruby: require 'rubygems' require 'em-websocket-server' module QuoteService class WebSocket < EventMachine::WebSocket::Server def on_connect handshake_response = "HTTP/1.1 101 Switching Protocols\n" handshake_response << "Upgrade: websocket\n" handshake_response << "Connection: Upgrade\n" handshake_response << "Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=\n" handshake_response << "Sec-WebSocket-Protocol: quote\n" send_message(handshake_response) end def on_receive(data) puts 'RECEIVED: ' + data end end end EventMachine.run do print 'Starting WebSocket server...' EventMachine.start_server '0.0.0.0', 4000, QuoteService::WebSocket puts 'running' end The handshake headers are per Wikipedia.

    Read the article

  • Why can't I retrieve the entities I've just persisted?

    - by felipecao
    I've got this web service that basically queries the database and returns all persisted entities. For testing purposes, I've created a TestDataManager that persists 2 example entities after Spring context is loaded (BTW, I'm using JAX-WS, Spring, Hibernate and HSQLDB). My TestDataManager looks like this: @Component public class TestDataManager { @Resource private SessionFactory sf; @PostConstruct @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW) public void insertTestData(){ sf.openSession(); sf.openSession().beginTransaction(); sf.openSession().persist(new Site("site one")); sf.openSession().persist(new Site("site two")); sf.openSession().flush(); } } My JAX-WS endpoint looks like this: @WebService public class SmartBrickEndpoint { @Resource private WebServiceContext context; public Set<Site> getSitesForUser(String user){ return getSiteService().findByUser(new User(user)); } private ISiteService getSiteService(){ ServletContext servletContext = (ServletContext) context.getMessageContext().get("javax.xml.ws.servlet.context"); return (ISiteService) BeanRetriever.getBean(servletContext, ISiteService.class); } } This my Service class: @Component @Transactional(readOnly = true) public class SiteService implements ISiteService { @Resource private ISiteDao siteDao; @Override public Set<Site> findByUser(User user) { return siteDao.findByUser(user); } } This is my DAO: @Component @Transactional(readOnly = true) public class SiteDao implements ISiteDao { @Resource private SessionFactory sessionFactory; @Override public Set<Site> findByUser(User user) { Set<Site> sites = new LinkedHashSet<Site>(sessionFactory.getCurrentSession().createCriteria(Site.class).list()); return sites; } } This is my applicationContext.xml: <context:annotation-config /> <context:component-scan base-package="br.unirio.wsimxp.dao"/> <context:component-scan base-package="br.unirio.wsimxp.service"/> <context:component-scan base-package="br.unirio.wsimxp.spring"/> <bean id="applicationDS" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> <property name="url" value="jdbc:hsqldb:file:sites"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="applicationDS" /> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.connection.release_mode">on_close</prop> <!--<prop key="hibernate.current_session_context_class">thread</prop>--> <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop> <prop key="hibernate.hbm2ddl.auto">create-drop</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> This is what's going on now: when the app is deployed, TestDataManager#insertTestData kicks-in (due to @PostConstruct) and persist does not raise any exception. I should have 2 entities in the DB by now. Afterwards, I invoke the endpoint by a SOAP client, and the request goes all the way up to the DAO. The Hibernate invocation does not raise any exception, but the returned list is empty. The odd thing is, in TestDataManager, if I switch from sf.openSession() to sf.getCurrentSession(), I get an error message: "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here". What I am doing wrong here? Why is the query "not seeing" the persisted entities? Why do I need to invoke sf.openSession() on TestDataManager although it's annotated with @Transactional? I have done some tests with hibernate.current_session_context_class=thread in application.xml, but then I just switch problems in each class. I'd like not needing to manually invoke sf.openSession() and leave that for Hibernate to take care. Thanks a lot for any help!

    Read the article

  • How to validate expression on button click in asp.net C#

    - by Hamad
    I am making a website and I have made a form fields like email field and validation expressions associated with it. Validation is initiated on text change. But i want it t execute on "submit" button click event. I have searched but could not locate the solution to my problem. Please tel me why is this happening and how can i make it right. I am new to this web development field, So need help from you guys. Thanks in advance!!! Hamad

    Read the article

  • ASP.Net Web API in Visual Studio 2010

    - by sreejukg
    Recently for one of my project, it was necessary to create couple of services. In the past I was using WCF, since my Services are going to be utilized through HTTP, I was thinking of ASP.Net web API. So I decided to create a Web API project. Now the real issue is that ASP.Net Web API launched after Visual Studio 2010 and I had to use ASP.Net web API in VS 2010 itself. By default there is no template available for Web API in Visual Studio 2010. Microsoft has made available an update that installs ASP.Net MVC 4 with web API in Visual Studio 2010. You can find the update from the below url. http://www.microsoft.com/en-us/download/details.aspx?id=30683 Though the update denotes ASP.Net MVC 4, this also includes ASP.Net Web API. Download the installation media and start the installer. As usual for any update, you need to agree on terms and conditions. The installation starts straight away, once you clicked the Install button. If everything goes ok, you will see the success message. Now open Visual Studio 2010, you can see ASP.Net MVC 4 Project template is available for you. Now you can create ASP.Net Web API project using Visual Studio 2010. When you create a new ASP.Net MVC 4 project, you can choose the Web API template. Further reading http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api http://www.asp.net/mvc/mvc4

    Read the article

  • Configuring HP Proliant iLO using hponcfg

    - by Abhay Kumar
    I am configuring an iLO using hponcfg by logging into the machine remotely and running hponcfg with scripts Mod_Directory.xml and then with Mod_Network.xml. I am enabling the DHCP on the device. But after the above scripts are executed successfully and upon rebooting the iLO, it shows the IP address to be 0.0.0.0. What is missing here, so that the iLO gets an IP from DHCP automatically after configuration?

    Read the article

  • Squid proxy server not forwarding traffic

    - by DilbertDave
    I'm trying to set up a web filtering system (dans guardian) on my home network but am failing at the first hurdle - configuring the Squid Proxy server. No matter what I do I cannot seem to configure it properly and I just receive the 'Requested URL could not be received' error page. If I remove the proxy setting on the browser everything works normally. Ultimately I want to run this on something like a Raspberry Pi but at the moment I'm testing with a virtual machine (although efforts with a netbook were equally unsuccessful). The VM has a clean installation of Linux Mint 15 and I've installed squid via apt-get. I've followed numerous walkthroughs but this on (https://help.ubuntu.com/lts/serverguide/squid.html) pretty much sums up the process I've been taking. I'm obviously missing something but cannot figure it out - any assistance appreciated.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >