Daily Archives

Articles indexed Monday April 5 2010

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

  • Does the order of arguments in a conditional statement affect execution time in php?

    - by dd0x
    Hi, As far as I know when writing a conditional statement in C such as the following: if ( some_function() == 100 && my_var == 5 ) { //do something } is slower to execute than if ( my_var == 5 && some_function() == 100 ) { //do something } because it's faster to execute the my_var == 5 rather than all of the code in the function ( because if my_var != 5, then the rest of the if statement would not even be executed )...so I am wondering if the same is true for conditional statements in PHP?

    Read the article

  • Why do people have to use multiple versions of jQuery in the same page?

    - by reprogrammer
    I have noticed that sometimes people have to use multiple versions of jQuery in the same page (See question 1 and question 2). I assume people have to carry old versions of jQuery because some pieces of their code is based on an older version of jQuery. Obviously, this approach causes inefficiency. The ideal solution is to refactor the old code to use the newer jQuery API. I wonder if there are tools that automate the process of upgrading a piece of code to use a newer version of jQuery. I've never written programs in in either Javascript or jQuery. So, I'd like to hear from programmers experienced in these language about their opinion on this issue. In particular, I'd like to know the following. How much of problem it is to have to load multiple versions of jQuery? Have you ever had to load multiple versions of any other library in the same page? Do you know of any refactoring tools that helps you migrate your code to use the updated API? Do you think such a refactoring tool is useful? Are you willing to use it?

    Read the article

  • Start PyGTK cellrenderer edit from code

    - by mkotechno
    I have a treeview with an editable CellRendererText: self.renderer = gtk.CellRendererText() self.renderer.set_property('editable', True) But now I need to launch the edition from code instead from user, this is to focus the user attention in the fact he just created a new row and needs to be named. I tried this but does not work: self.renderer.start_editing( gtk.gdk.Event(gtk.gdk.NOTHING), self.treeview, str(index), gtk.gdk.Rectangle(), gtk.gdk.Rectangle(), 0) Neither does not throw errors, but the documentation about for what is each argument is not clear, in fact I really don't know if start_editing method is for this. All suggestions are welcome, thanks.

    Read the article

  • VMware Workstation reboot 32-bit host when starting 32/64-bit guest using VT-x

    - by Powerman
    I'm trying to start 64-bit guest (MacOSX and Windows7) on 32-bit host (Hardened Gentoo Linux, kernel 2.6.28-hardened-r9) using VMware Workstation (6.5.3.185404 and 7.0.1.227600). If VT-X disabled in BIOS, VMware refuse to start 64-bit guest (as expected). If VT-X enabled in BIOS, VMware start guest without complaining, but then, in about a second (I suppose as soon as guest try to switch on 64-bit) my host reboots (actually, it's more like reset - normal reboot procedure skipped and BIOS POST start immediately). My hardware is Core 2 Duo 6600 on ASUS P5B-Deluxe with latest stable BIOS 1101. I've power-cycled system, then enabled Vanderpool in BIOS. My CPU doesn't support Trusted Execution Technology, and there no way to disable it in BIOS. I've rebooted several times after that, sometimes with power-cycled, and ensure Vandertool is enabled in BIOS. I've also run VMware-guest64check-5.5.0-18463 tool, and it report "This host is capable of running a 64-bit guest operating system under this VMware product.". About a year ago I tried to disable hardened in kernel to ensure this isn't because of PaX/GrSecurity, but that doesn't help. I have not checked 32-bit guests with VT-X enabled yet, but without VT-X they works ok. ASUS provide "beta" BIOS updates, but according to their descriptions these updates doesn't fix this issue, so I'm not sure is it good idea to try it. My best guess now it's motherboard/BIOS bug. Any ideas? Update 1: I've tried to boot vt.iso provided at http://communities.vmware.com/docs/DOC-8978 and here is it report: CPU 0: VT is enabled on this core CPU 1: VT is enabled on this core Update 2: I've just tried to boot 32-bit guests (Windows7, Ubuntu9.04 and Gentoo) using all possible virtualization modes. In Automatic, Automatic with Replay, Binary translation everything works, in Intel VT-x/EPT or AMD-V/RVI I got message "This host does not support EPT. Using software virtualization with a software MMU." and everything works. BUT in Intel VT-x or AMD-V mode all 32-bit guests reset host just like 64-bit guests! So, this issue is not specific to 64-bit guests. One more thing. Using Intel VT-x or AMD-V mode for both 32/64-bit guests my host reset right after starting VM, i.e. before VM BIOS POST and before guest even start booting. But using Intel VT-x/EPT or AMD-V/RVI VM BIOS runs ok, then 64-bit guests start booting (Windows7 completed "Loading files" progressbar), and only after that host reset.

    Read the article

  • Why does my motherboard go through an endless reboot cycle when 8 GB of memory is attempted vs 6 GB?

    - by nizm0
    I never got an answer in my googling to this about a year ago and have an extra stick of memory I'd like to be able to use. When is inserted the computer starts, and then reboots immediately in an endless reboot cycle. As soon as the 4th stick is removed, the computer works fine. Right now I have 6 GB of my 8 GB installed. Is there a solution that I am missing to enabling this motherboard to actually boot up with all 8 GB (it supports it). Right now it won't even boot up to BIOS with the 4 sticks... only 3? Memory: 1 x G.SKILL 4 GB (2 x 2 GB) 240-Pin DDR2 SDRAM DDR2 1100 (PC2 8800) Dual Channel Kit Desktop Memory Model F2-8800CL5D-4GBPI - Retail (URL: ) http://www.newegg.com/Product/Product.aspx?Item=N82E16820231194 Motherboard: 1 x GIGABYTE GA-EP45-UD3R LGA 775 Intel P45 ATX Intel Motherboard - Retail ( URL: )http://www.newegg.com/Product/Product.aspx?Item=N82E16813128359

    Read the article

  • Can't delete C:\Config.Msi\75ce84f.rbf

    - by Hugh Allen
    I can't delete C:\Config.Msi\75ce84f.rbf It's not causing any problems but it's a mystery I'd like to solve, preferably before the next reboot because it's scheduled for deletion then (see pendmoves). it's not readonly, system or hidden it's not in use by another process (according to Process Explorer) the NT security permissions aren't the problem either - I am the owner and have Full Control ; as a double-check, the Effective Permissions tab shows that I have permission to delete. Yet trying to delete the file gives "Access is Denied" from both Explorer and cmd. I can however rename it or move it to another folder on the same drive. I can also read it and Virustotal says it's clean which is what I would expect (it's just a Windows Installer temp file - a copy of some DLL I think). The relevant line from Process Monitor is: 6:52:14.3726983 PM 112 Explorer.EXE SetDispositionInformationFile C:\Config.Msi\75ce84f.rbf CANNOT DELETE Delete: True Write 1232 Background: I'm using XP SP2. I recently repaired my Adobe Reader installation to make it the default browser plugin again instead of Foxit. (there seems to be no UI to do it otherwise?) So the installer did its thing and then asked to reboot. As is my habit when rebooting is inconvenient I declined the offer and ran pendmoves to find out what files the installer had scheduled to move / delete. It wanted to delete two files with .rbf extension (rollback files) located in C:\Config.msi\. (this applies to both even though I've been speaking about one). So I tried to delete them manually and couldn't. Does anyone have any ideas what could be preventing deletion? (and I don't think it's malware even though I'm not running AV at the moment)

    Read the article

  • PHP Streaming CSV always adds UTF-8 BOM

    - by Mustafa Ashurex
    The following code gets a 'report line' as an array and uses fputcsv to tranform it into CSV. Everything is working great except for the fact that regardless of the charset I use, it is putting a UTF-8 bom at the beginning of the file. This is exceptionally annoying because A) I am specifying iso and B) We have lots of users using tools that show the UTF-8 bom as characters of garbage. I have even tried writing the results to a string, stripping the UTF-8 BOM and then echo'ing it out and still get it. Is it possible that the issue resides with Apache? If I change the fopen to a local file it writes it just fine without the UTF-8 BOM. header("Content-type: text/csv; charset=iso-8859-1"); header("Cache-Control: no-store, no-cache"); header("Content-Disposition: attachment; filename=\"report.csv\""); $outstream = fopen("php://output",'w'); for($i = 0; $i < $report-rowCount; $i++) { fputcsv($outstream, $report-getTaxMatrixLineValues($i), ',', '"'); } fclose($outstream); exit;

    Read the article

  • java.lang.ClassCastException: $Proxy99 cannot be cast

    - by svaret
    Hi, I am using JBoss4.2.2 and java6. The deployed ear's name is apa.ear In a servlet I have the following code line: placeBid = (PlaceBid) context.lookup("apa/" + PlaceBid.class.getSimpleName() + "/remote"); I have a generated jboss-app.xml like this: <jboss-app> <loader-repository>apa:app=ejb3</loader-repository> </jboss-app> When trying to get the PlaceBid via the context I get this exception java.lang.ClassCastException: $Proxy99 cannot be cast to se.nextit.actionbazaar.buslogic.PlaceBid The PlaceBid interface looks like this: @Remote public interface PlaceBid { Long addBid(String userId, Long itemId, Double bidPrice); } When I run the example coming with EJB3 in action it works. EJB3 in action sample code comes with ant building. I want to use Maven so I have rearranged the code some. However, I don't understan what I am doing wrong here. I have some thoughts about the jboss-app.xml file. I am not sure of how its content should look like. Grateful for any help. Best wishes Lasse

    Read the article

  • Basic Tomcat Servlet error.

    - by ajay
    package mypackage; import java.io.*; import javax.servlet.http.*; import javax.servlet.*; public class Hello extends HttpServlet { public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); out.println("Hello, world!"); out.close(); } } web.xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>Hello, World Application</display-name> <description> This is a simple web application with a source code organization based on the recommendations of the Application Developer's Guide. </description> <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>mypackage.Hello</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app> I am then doing ant all , ant reload and also /etc/init.d/tomcat restart But I get this error on browser: HTTP Status 404 - /hello/ type Status report message /hello/ description The requested resource (/hello/) is not available. Apache Tomcat/6.0.26 What could be wrong?

    Read the article

  • Is writing a reference atomic on 64bit VMs

    - by Steffen Heil
    Hi The java memory model mandates that writing a int is atomic: That is, if you write a value to it (consisting of 4 bytes) in one thread and read it in another, you will get all bytes or none, but never 2 new bytes and 2 old bytes or such. This is not guaranteed for long. Here, writing 0x1122334455667788 to a variable holding 0 before could result in another thread reading 0x112233440000000 or 0x0000000055667788. Now the specification does not mandate object references to be either int or long-sized. For type safety reasons I suspect they are guaranteed to be written atomiacally, but on a 64bit VM these references could be very well 64bit values (merely memory addresses). No here are my question: Are there any memory model specs covering this (that I haven't found)? Are long-writes suspect to be atomic on 64bit VMs? Are VMs forced to map references to 32bit? Regards, Steffen

    Read the article

  • WCF REST based services authentication schemes

    - by FlySwat
    I have a simple authentication scheme for a set of semi-public REST API's we are building: /-----------------------\ | Client POST's ID/Pass | | to an Auth Service | \-----------------------/ [Client] ------------POST----------------------> [Service/Authenticate] | /-------------------------------\ | Service checks credentials | [Client] <---------Session Cookie------- | and generates a session token | | | in a cookie. | | \-------------------------------/ | [Client] -----------GET /w Cookie -------------> [Service/Something] | /----------------------------------\ | Client must pass session cookie | | with each API request | | or will get a 401. | \----------------------------------/ This works well, because the client never needs to do anything except receive a cookie, and then pass it along. For browser applications, this happens automatically by the browser, for non browser applications, it is pretty trivial to save the cookie and send it with each request. However, I have not figured out a good approach for doing the initial handshake from browser applications. For example, if this is all happening using a AJAX technique, what prevents the user from being able to access the ID/Pass the client is using to handshake with the service? It seem's like this is the only stumbling block to this approach and I'm stumped.

    Read the article

  • What is the best scripting language to embed in a C# desktop application.

    - by Ewan Makepeace
    We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an option), but the managed code derivative VSTA (I think) seems to have withered on the vine. What is now the best choice for an embedded scripting language on Windows .NET?

    Read the article

  • What's the best way to do cross browser testing?

    - by Doug
    What's the best way for me to check if my website is compatible in IE7,8, Safari, FF, and Chrome without having to install each and everyone? I mainly want to check the CSS, HTML, and JavaScript. Update I put a bounty in hopes there is a more practical solution for someone like myself. I am using Windows 7 Home Premium x64. Update2 I don't mind installing these browsers now, but I can't even if I wanted to. Windows 7 doesn't allow me to install IE7.

    Read the article

  • Best way to define an immutable class in Objective C

    - by Patrick Marty
    Hi, I am a newbie in Objective C and I was wondering what is the best way to define an immutable class in Objective-C (like NSString for example). I want to know what are the basic rules one has to follow to make a class immutable. I think that : setters shouldn't be provided if properties are used, they should be readonly accessInstanceVariablesDirectly must be override and return NO Did I forget something ? Thanks

    Read the article

  • Odd "Object reference not set to an instance of an object" involving xWinForms

    - by Kyle
    Hey, I've been trying to get the xWinForms 3.0 library (a library with forms support in xna) working with my C# XNA Game project but I keep getting the same problem. I add the reference to my project, put in the using statement, declare a formCollection variable and then I try to initialize it. whenever I run the project I get stopped on this line: formCollection = new FormCollection(this.Window, Services, ref graphics); it gives me the error: " System.NullReferenceException was unhandled Message="Object reference not set to an instance of an object." Source="Microsoft.Xna.Framework" StackTrace: at Microsoft.Xna.Framework.Graphics.VertexShader..ctor(GraphicsDevice graphicsDevice, Byte[] shaderCode) at Microsoft.Xna.Framework.Graphics.SpriteBatch.ConstructPlatformData() at Microsoft.Xna.Framework.Graphics.SpriteBatch..ctor(GraphicsDevice graphicsDevice) at xWinFormsLib.FormCollection..ctor(GameWindow window, IServiceProvider services, GraphicsDeviceManager& graphics) at GameSolution.Game2.LoadContent() in C:\Users\Owner\Documents\School\Year 3\Winter\Soen 390\TeamWTF_3\SourceCode\GameSolution\GameSolution\Game2.cs:line 45 at Microsoft.Xna.Framework.Game.Initialize() at GameSolution.Game2.Initialize() in C:\Users\Owner\Documents\School\Year 3\Winter\Soen 390\TeamWTF_3\SourceCode\GameSolution\GameSolution\Game2.cs:line 37 at Microsoft.Xna.Framework.Game.Run() at GameSolution.Program.Main(String[] args) in C:\Users\Owner\Documents\School\Year 3\Winter\Soen 390\TeamWTF_3\SourceCode\GameSolution\GameSolution\Program.cs:line 14 InnerException: " In a project I downloaded that used the xWinForms, I put the following code in and it compiled and ran no error. but when I put it in my project I get the error. Am I making some stupid mistake about including dlls or something? I've been at this for hours and I can't seem to find anything that would cause this. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; using xWinFormsLib; namespace GameSolution { public class Game2 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; FormCollection formCollection; public Game2() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); } protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); formCollection = new FormCollection(this.Window, Services, ref graphics); } protected override void Update(GameTime gameTime) { base.Update(gameTime); } protected override void Draw(GameTime gameTime) { base.Draw(gameTime); } } } Any help would be greatly appreciated ._.

    Read the article

  • Using the Drop Box folder while sharing on Mac OS X, files are locked.

    - by vgm64
    While using the Drop Box in the Shared folder on two MacBook Pros running Mac OS X 10.6, I noticed that when files were dropped into the drop box they were read only (locked?) when going from one of the laptops to the other (but not necessarily the other direction). Is there a way to change this? My girlfriend nearly had an aneurism because she couldn't rename a file. I duplicated it and deleted the original, but this seems unnecessary. I remember the permissions on the file were: nobody: Read Only everyone: Read Only

    Read the article

  • touch pad randomly stopped working on ubuntu desktop

    - by Narcolapser
    Question: What steps can I take to make a touchpad that once worked, work again. Info: I'm running ubuntu desktop on my net book. it has been working more or less fine. There have been some minor issues. but nothing to bad. recently I was messing around with burning a mandriva .iso, and suddenly my touch pad just stops working. every now and then it will work for a brief moment after I bring back from sleep mode. The computer says that there is a touch pad and that it is active. any tips?

    Read the article

  • I cannot connect to SQL Server Express using VB.NET

    - by konin
    Can someone tell me what I am missing? I am using this connection string to connect to my database and still it won't connect: Dim str As String = "Provider = .NET Framework Data Provider for SQL Server; Data Source=C:\Users\konin\Documents\UHMS\bin\Debug\UHMS.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" This is the process I used to get the data source: right-click the database select properties and click select data source I hope I am clear enough. Thanks for reading. Edit: Error Message is as follows: unable to connect to database please contact administrator

    Read the article

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