Daily Archives

Articles indexed Monday June 7 2010

Page 8/113 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • slowly rotate an object towards another object

    - by numerical25
    I have an object that points in the direction of another object (i.e. it rotates to the direction that the second objects x and y coordinates are at) below is the code I use. var distx = target.x - x; var disty = target.y - y; var angle:Number = Math.atan2(disty, distx); var vx:Number = Math.cos(angle) * cspeed; var vy:Number = Math.sin(angle) * cspeed; rotation = angle * 180/Math.PI; x += vx; y += vy; as you can see. Not only does it rotate towards the target object, but it also moves towards it too. When I play the movie, the object instantly points to the targeted object and moves towards it. I would like for it to slowly turn towards the object instead of instantly turning towards it. anyone know how to do this.

    Read the article

  • Split Panel using javascript

    - by Tim
    Hi All, I'm trying to code a split panel, Left and right. Each will have a button which you can click on and it will toggle that panel, while expanding the other. I am clueless as to where to start off? Is there an example that already does this? Can someone help me out. Thanks

    Read the article

  • iPhone: Chained views

    - by Michael
    I want to have dynamically created views and be able to scroll(change views like in camera roll) either from my program or user should also be able to do that. The views should contain only a simple text. Each view has to replace other, so they are like chained. The other example is the screenshots of applications in app store application details. I don't know which classes to check/start so if anyone can give me an idea of how this could be designed I would appreciate it.

    Read the article

  • Can't change permission/ownership/group of external hard drive on Ubuntu.

    - by MikeN
    I have an external hard drive connected to my Linux box. I wanted to setup a web server to access files on it, but the permission on all files and directories on the drive are "rwx" for the owner which is my local login, and the group is the "root" group. I need the files readable by the apache user, I was trying to set all files to be "chmod a+rwx -R *", but this doesn't do anything (gives no errros, just has no effect.) I tried chaning the group using "chgrp" to my user group, but that won't work either, it gives me errors that I lack permission even when I run all those commands as sudo! What's up with this hard drive??? "sudo chmod a+rwx *" should work on anything, right?

    Read the article

  • Is it possible to rsync your web site to another backup server and use the same .htaccess files?

    - by stephenmm
    I am trying to use rsync to replicate all the files from one web server to another server that could act as a backup if the first one went down. The problem I am having is that the .htaccess file requires the AuthUserFile to have the fully quallified path to the .htpasswd file and I cannot make the paths the same on the two machines. Does anyone know how I might use the same .htaccess file on two different servers? Thanks for any help that can be provided.

    Read the article

  • If I uninstall Bonjour and Apple Mobile Device Support will transferring songs to my ipod via itunes

    - by Kate
    I am one of those people who hate to have even one unnecessary program installed. I noticed when I downloaded and installed itunes two other components were installed and shows up in my control panel Uninstall programs screen: "Bonjour" and "Apple Mobile Device Support". Are these two necessary for itunes to work? I never buy songs via itunes, just use the program to transfer smp3s to my ipod.

    Read the article

  • ado.net Concurrency violation

    - by Bicubic
    My first time using ADO.net. Trying to make database of Users. First I populate my DataSet: adapter.AcceptChangesDuringFill = true; adapter.AcceptChangesDuringUpdate = true; adapter.Fill(dataset); To create a user: User user = new User(); user.datarow = dataset.Users.NewUsersRow(); user.Name = username; user.PasswordHash = GetHash(password); user.Rights = UserRights.None; users.Add(user); dataset.Users.AddUsersRow(user.datarow); adapter.Update(dataset); When a user property is modified: adapter.Update(dataset); Creation by itself is fine. If I take an existing user and make multiple changes, fine. Multiple creations in a row, fine. Creation followed by a property change, I get this: "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." Any ideas?

    Read the article

  • Menu Control in Master Page fails to use CSS styles

    - by Shaun
    I'm working on a web application that uses ASP.NET 3.5 and C#. Structurally, I have a master page with a menu control on it. The control serves as my navigation, and it gets its items from a SiteMapDataSource control and a corresponding Web.sitemap file. The problem is that some styles do not render properly when you specify the CssClass property. More specifically, the selected and hover styles don't respond to css styles. Consider the code below: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>A webpage</title> </head> <body> <form id="form1" runat="server"> <div id="page"> <asp:Menu ID="navMenu" Orientation="Horizontal" StaticMenuStyle-CssClass="staticMenu" StaticMenuItemStyle-CssClass="staticMenuItem" StaticSelectedStyle-CssClass="staticSelectedItem" StaticHoverStyle-CssClass="staticHoverItem" runat="server"> </asp:Menu> <asp:SiteMapDataSource ID="srcSiteMap" runat="server" ShowStartingNode="false" /> <br /> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form> </body> </html> Suppose I had a corresponding .css file with the following: .staticMenuItem { background-color:Red; } .staticSelectedItem { background-color:Green; } .staticHoverItem { background-color:Blue; } What will happen is that my item backgrounds will properly be red, but my selected item will not be green and the item I'm hovering my mouse over will not be blue. This seems true regardless of whether or not I include the style in the head of the master page or in an external file in default theme as specified in the web.config file. If I specify the styles in the asp.net xml like so: <asp:Menu ID="navMenu" Orientation="Horizontal" runat="server"> <StaticSelectedStyle BackColor="Green" Font-Underline="True" Font-Bold="True" /> <StaticHoverStyle BackColor="Gray" /> </asp:Menu> It appears to work properly in Firefox, but the style is never embedded in the html in Internet Explorer. Odd. Does anybody have any insight into what is causing this problem and how to neatly work around it? I'm aware I might be able to programmically determine the current page and select the corresponding menu item manually so it receives the proper style class, but before I resort to hacking C# and Javascript together to fix this functionality, I'm open to ideas.

    Read the article

  • QPainter paints garbage

    - by DSblizzard
    Fragment of program code: def add_link(Item0Num, Item1Num): global Mw, View # Mw - MainWindow if Item0Num != Item1Num and not link_exists(Item0Num, Item1Num): append( links_to(Item1Num), Item0Num ) append( links_from(Item0Num), Item1Num ) LinkGi = TLinkGi() Mw.Scene.addItem(LinkGi) LinkGi.setZValue(200) LinkGi.scale(1 / View.Scale, 1 / View.Scale) LinkGi.Item0Num = Item0Num LinkGi.Item1Num = Item1Num class TLinkGi(QGraphicsItem): def paint(self, Painter, StyleOptionGraphicsItem, Widget): global Mw, View Pen = QPen(Qt.black, 1) Painter.setPen(Pen) X0, Y0 = task_center(self.Item0Num) self.setPos(X0, Y0) X1, Y1 = task_center(self.Item1Num) X, Y = int( (X1 - X0) * View.Scale ), int( (Y1 - Y0) * View.Scale ) Painter.drawLine(0, 0, X, Y) #Mw.Scene.update(0, 0, Plan.Size, Plan.Size) # (1) #Mw.gvMain.repaint() # (2) def boundingRect(self): global View Rect = QRectF(0, 0, Plan.Size, Plan.Size) return Rect This paints such garbage: http://img697.imageshack.us/content_round.php?page=done&l=img697/5395/qpaintergarbage1.jpg When lines (1) and (2) are uncommented things doesn't become much better: http://img63.imageshack.us/content_round.php?page=done&l=img63/9693/qpaintergarbage0.jpg Please help me to solve this problem.

    Read the article

  • MS Access: Why is ADODB.Recordset.BatchUpdate so much slower than Application.ImportXML?

    - by apenwarr
    I'm trying to run the code below to insert a whole lot of records (from a file with a weird file format) into my Access 2003 database from VBA. After many, many experiments, this code is the fastest I've been able to come up with: it does 10000 records in about 15 seconds on my machine. At least 14.5 of those seconds (ie. almost all the time) is in the single call to UpdateBatch. I've read elsewhere that the JET engine doesn't support UpdateBatch. So maybe there's a better way to do it. Now, I would just think the JET engine is plain slow, but that can't be it. After generating the 'testy' table with the code below, I right clicked it, picked Export, and saved it as XML. Then I right clicked, picked Import, and reloaded the XML. Total time to import the XML file? Less than one second, ie. at least 15x faster. Surely there's an efficient way to insert data into Access that doesn't require writing a temp file? Sub TestBatchUpdate() CurrentDb.Execute "create table testy (x int, y int)" Dim rs As New ADODB.Recordset rs.CursorLocation = adUseServer rs.Open "testy", CurrentProject.AccessConnection, _ adOpenStatic, adLockBatchOptimistic, adCmdTableDirect Dim n, v n = Array(0, 1) v = Array(50, 55) Debug.Print "starting loop", Time For i = 1 To 10000 rs.AddNew n, v Next i Debug.Print "done loop", Time rs.UpdateBatch Debug.Print "done update", Time CurrentDb.Execute "drop table testy" End Sub I would be willing to resort to C/C++ if there's some API that would let me do fast inserts that way. But I can't seem to find it. It can't be that Application.ImportXML is using undocumented APIs, can it?

    Read the article

  • how to check whether some entered InnerText is present in an XML or not and to give an exception?

    - by Damodar
    Hey all, I have written a code in C# - XML which checks whether a value is there or not in a given XML document and prints the value and the particular tag associated with the value. When we enter the Value of the Inner Text it will look for the value in the document and find it. I dont understand what exception to catch when the entered value is not there in the document. I tried doing like this but it is not working. 1. if (inpXMLString != AppChildNode.InnerText) throw new InvalidDataException("The entered value" + " " + inpXMLString + " " + "doesnot exist"); Here : inpXMLstring = entered value; AppChildNode.InnerText = value of the tags searched. 2. catch (System.Xml.XmlException e1) { Console.WriteLine(e1.Message); } this does not give any exception when the entered value is not there in the XML document. Please help me in this regard.

    Read the article

  • What are the "Navigation Properties" in this data model for?

    - by d03boy
    I've been wondering how to properly set up many-to-many relationships in ASP.NET MVC 2 using Linq2Sql for quite some time now. I found this blog post that seems to have a similar model layout as mine. If you take a look at the first screenshot showing the data model you can see that each model has "Navigation Properties" at the bottom of it. What exactly is this and why don't my models have them? I have the proper foreign keys put in to place. Most specifically, I am looking at the relationship between the Article and Category models since that is the only many-to-many relationship that I see and that's what I'm trying to model. Obviously I use an intermediary joining table between these two tables but I am having trouble understanding the proper methodology for modeling that relationship and I'm not finding this information anywhere on The Google.

    Read the article

  • after_create :create a new line in DB

    - by Karl Entwistle
    Hey guys I was wondering if anyone could help me with an issue im having, basically id like to have Account.create after a PayPal notification is received, There is a simple cart model which corresponds to line_items within the cart so add_account_to_market would look like this in pseudo code def add_account_to_market if status == "Completed" find the line items(via cart_id) that correspond to the cart.id that just been paid create an account with user_id set to the current carts user id end end Ive never tried to do something like this in Rails and its not working, Ive been pulling my hair out all night trying to fix this, hopefully someone can help or point me in the right direction. Thanks :) class PaymentNotification < ActiveRecord::Base belongs_to :cart serialize :params after_create :mark_cart_as_purchased after_create :add_account_to_market private def mark_cart_as_purchased if status == "Completed" cart.update_attribute(:purchased_at, Time.now) cart.update_attribute(:paid, true) end end def add_account_to_market if status == "Completed" l = LineItem.find(:all, :conditions => "cart_id = '#{cart.id}'") for l.quantity Account.new(:user_id => cart.user_id) end end end end PS mark_cart_as_purchased method is working fine, its just the add_account_to_market im having issues with.

    Read the article

  • SQL SERVER Subquery or Join Various Options SQL Server Engine Knows the Best Part 2

    This blog post is part 2 of the earlier written article SQL SERVER Subquery or Join Various Options SQL Server Engine knows the Best by Paulo R. Pereira. Paulo has left excellent comment to earlier article once again proving the point that SQL Server Engine is smart enough to figure out the [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • What makes MVVM uniquely suited to WPF?

    - by Reed Copsey
    The Model-View-ViewModel is very popular with WPF and Silverlight. I've been using this for my most recent projects, and am a very large fan. I understand that it's a refinement of MVP. However, I am wondering exactly what unique characteristics of WPF (and Silverlight) allow MVVM to work, and prevent (or at least make difficult) this pattern from working using other frameworks or technologies. I know MVVM has a strong dependency on the powerful data binding technology within WPF. This is the one feature which many articles and blogs seem to mention as being the key to WPF providing the means of the strong separation of View from ViewModel. However, data binding exists in many forms in other UI frameworks. There are even projects like Truss that provide WPF-style databinding to POCO in .NET. What features, other than data binding, make WPF and Silverlight uniquely suited to Model-View-ViewModel?

    Read the article

  • Ruby Detect method

    - by JZ
    Select makes sense. But can someone explain .detect to me? I don't understand these data. >> [1,2,3,4,5,6,7].detect { |x| x.between?(3,4) } => 3 >> [1,2,3,4,5,6,7].detect { |x| x.between?(3,6) } => 3 >> [1,2,3,4,5,6,7].detect { |x| x.between?(3,7) } => 3 >> [1,2,3,4,5,6,7].detect { |x| x.between?(2,7) } => 2 >> [1,2,3,4,5,6,7].detect { |x| x.between?(1,7) } => 1 >> [1,2,3,4,5,6,7].detect { |x| x.between?(6,7) } => 6 >> [1,2,3,4,5,6,7].select { |x| x.between?(6,7) } => [6, 7] >> [1,2,3,4,5,6,7].select { |x| x.between?(1,7) } => [1, 2, 3, 4, 5, 6, 7]

    Read the article

  • How do I call the methods in a model via controller? Zend Framework

    - by Joel
    Hi guys, I've been searching for tutorials to better understand this, but I'm having no luck. Please forgive the lengthy explination, but I want make sure I explain myself well. First, I'm quite new to the MVC structure, though I have been doing tutorials and learning as best I can. I have been moving over a live site into the Zend Framework model. So far, I have all the views within views/scripts/index/example.phtml. So therefore I'm using one IndexController and I have the code in each Action method for each page: IE public function exampleAction() Because I didn't know how to interact with a model, I put all the methods at the bottom of the controller (a fat controller). So basically, I had a working site by using a View and Controller and no model. ... Now I'm trying to learn how to incorporate the Model. So I created a View at: view/scripts/calendar/index.phtml I created a new Controller at: controller/CalendarControllers.php and a new model at: model/Calendar.php The problem is I think I'm not correctly communication with the model (I'm still new to OOP). Can you look over my controller and model and tell me if you see a problem. I'm needing to return an array from runCalendarScript(), but I'm not sure if I can return an array into the object like I'm trying to? I don't really understand how to "run" the runCalendarScript() from the controller? Thanks for any help! I'm stripping out most of the guts of the methods for the sake of brevity: controller: <?php class CalendarController extends Zend_Controller_Action { public function indexAction() { $finishedFeedArray = new Application_Model_Calendar(); $this->view->googleArray = $finishedFeedArray; } } model: <?php class Application_Model_Calendar { public function _runCalendarScript(){ $gcal = $this->_validateCalendarConnection(); $uncleanedFeedArray = $this->_getCalendarFeed($gcal); $finishedFeedArray = $this->_cleanFeed($uncleanedFeedArray); return $finishedFeedArray; } //Validate Google Calendar connection public function _validateCalendarConnection() { ... return $gcal; } //extracts googles calendar object into the $feed object public function _getCalendarFeed($gcal) { ... return $feed; } //cleans the feed to just text, etc protected function _cleanFeed($uncleanedFeedArray) { $contentText = $this->_cleanupText($event); $eventData = $this->_filterEventDetails($contentText); return $cleanedArray; } //Cleans up all formatting of text from Calendar feed public function _cleanupText($event) { ... return $contentText; } //filterEventDetails protected function _filterEventDetails($contentText) { ... return $data; } }

    Read the article

  • Reading Unicode files line by line C++

    - by Roger Nelson
    What is the correct way to read Unicode files line by line in C++? I am trying to read a file saved as Unicode (LE) by Windows Notepad. Suppose the file contains simply the characters A and B on separate lines. In reading the file byte by byte, I see the following byte sequence (hex) : FE FF 41 00 0D 00 0A 00 42 00 0D 00 0A 00 So 2 byte BOM, 2 byte 'A', 2byte CR , 2byte LF, 2 byte 'B', 2 byte CR, 2 byte LF . I tried reading the text file using the following code: std::wifstream file("test.txt"); file.seekg(2); // skip BOM std::wstring A_line; std::wstring B_line; getline(file,A_line); // I get "A" getline(file,B_line); // I get "\0B" I get the same results using operator instead of getline file >> A_line; file >> B_line; It appears that the single byte CR character is is being consumed only as the single byte. or CR NULL LF is being consumed but not the high byte NULL. I would expect wifstream in text mode would read the 2byte CR and 2byte LF. What am I doing wrong? It does not seem right that one should have to read a text file byte by byte in binary mode just to parse the new lines.

    Read the article

  • Remove HTML entities

    - by Sreelal
    Hi, I am developing an application for iPhone.I need to remove html entities like ["<p>"] in a parsed xml response.Is there any direct way to remove all such entities.??

    Read the article

  • Is there a way to change the console Icon at runtime

    - by klumsy
    i'm not interested in changing the actual icon in the EXE that shows up in windows explorer, but just the icon that shows up in the top left of the console window. Already i set the icon in the visual studio project and i'm getting it nicely in windows explorer, and also that icon is showing up in the console window, i just want to be able to change it in the console windows at runtime. I.e lets say i wanted to put an icon that shows there are new emails or something.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >