Daily Archives

Articles indexed Wednesday May 12 2010

Page 14/121 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Does the order of case in Switch statement can vary the performance?

    - by Bipul
    Let say I have a switch statement as below Switch(alphabet){ case "f": //do something break; case "c": //do something break; case "a": //do something break; case "e": //do something break; } Now suppose I know that the frequency of having Alphabet e is highest followed by a, c and f respectively. So, I just restructured the case statement order and made them as follows. Switch(alphabet){ case "e": //do something break; case "a": //do something break; case "c": //do something break; case "f": //do something break; } Will the second Switch statement better perform(means faster) than the first switch statement? If yes and if in my program I need to call this switch statement say many times, will that be a substantial improvement? Or if not in any how can I use my frequency knowledge to improve the performance? Thanks

    Read the article

  • Is adding a bit mask to all tables in a database useful?

    - by Tom
    A colleague is adding a bit mask to all our database tables. In theory this is so we can track certain properties of each row across the entire system. For example... Is the row shipped with the system or added by the client once they've started using the system Has the row been deleted from the table (soft deletes) Is the row a default value within a set of rows Is this a good idea? Are there other uses where this approach would be beneficial? My preference is these properties are obviously important, and having a dedicated column for each property is justified to make what is happening clearer to fellow developers.

    Read the article

  • Where does Tomcat append / to directory paths?

    - by Anonymouse
    Suppose my Tomcat webapps directory looks like this: webapps/ webapps/fooapp/ webapps/fooapp/WEB-INF/ webapps/fooapp/WEB-INF/web.xml webapps/fooapp/bardir/ When I make a GET request for /fooapp/bardir, Tomcat sees that webapps/fooapp/bardir is a directory and sends back a 302 to /fooapp/bardir/ (with a slash at the end). Here is my question: Where in the Tomcat source code does this take place? (I'm looking at 6.0.x but a correct answer for any version would be a great starting point.) The only reference material I can find on this subject is in the Catalina Functional Specifications which states, regarding the Default Servlet: On each HTTP GET request processed by this servlet, the following processing shall be performed: [...] If the requested resource is a directory: If the request path does not end with "/", redirect to a corresponding path with "/" appended so that relative references in welcome files are resolved correctly. However, this functionality does not appear to be in org.apache.catalina.servlets.DefaultServlet; or at least, it's not there exclusively: if I replace the default servlet in web.xml with a servlet whose servlet-class does not exist, directory paths still come back 302 to add the slash, while every other request comes back with an error as expected.

    Read the article

  • can't properly shutdown ubuntu and sound problem on HP mini 311 netbook

    - by Viele
    hi, I recently bought a HP mini 311 netbook. I replaced its harddrive and installed ubuntu 10.04. Since then, I have encountered some very strange problem with its sound and shutdown/reboot. At times, when I start the computer, it will have no sound, on the GUI the sound is at max, but no sound is available. This sometimes also happen after after upgrades, hibernate, and toggling the wireless radio button. Strangely, when the sound is out the device will also refuse to be shutdown. If I shutdown the computer using the GUI, it will simply go back to the log in screen without actually shutting down. If I use "sudo shutdown 0", the computer will hang on the loading screen of the shut down process. I had to force the pc to shutdown by holding the power button down. usually (probably always) after I force a turn-off then start off again. the sound and shutdown become normal. I wonder if anyone have clues regarding to the cause of this problem. This the info about the computer: 1) installed ubuntu 10.04LTS RC, later upgraded to formal released version. 2) cat /proc/asound/version == "Advanced Linux Sound Architecture Driver Version 1.0.21." however, when doing 'alsaconf' the version displayed is 1.0.23 any help is appreciated. Thanks

    Read the article

  • Loop elements with Jquery and call Omniture s.tl() function to track

    - by ilovewebdev
    Hi, i have a page with a list of items. Each item has a print now link (a.printMe) to print each item. At the end of the list, there's a print all link (a.printAll) to print all items. I want to track number of times an item was printed. If a.printAll link is clicked, then i will send all the item's tracking value to Omniture. I added tracking string into individual item's a.printMe href attribute and track with the following functions: $('a.printMe').click(function() { var value = $(this).attr('href'); track(value); }); $('a.printAll').click(function() { $('a.printMe').each(function() { this.click(); }); // works in IE only. IE 6-8 }); function track(value) { var s = s_gi('account'); s.prop10 = value; s.linkTrackVars = 'prop10'; s.tl(true, 'o'); } The problem is only the last item (in the list) has its value sent to Omniture when i clicked on a.printAll. I finally got the above to work in IE but not Firefox. Anyone encounter this before?

    Read the article

  • How do I make a hyperlink to a local executable?

    - by Scott Ferguson
    We have an Intranet website, and a WPF windows executable installed on every workstation. How can we create a hyperlink on the intranet website that will launch the locally installed executable? Ideally we want the launch to be seamless. Is there a way of setting the browsers trust settings so that it won't display a security warning dialog for this executable? We have full admin capabilities on each workstation, and each user only uses Internet Explorer. We also know the correct local path for the exe.

    Read the article

  • Is is possible to use transparency in an iPhone app icon?

    - by yukon
    I created a 57X57 Circle-shaped icon (without shine) which has transparency outside of the circle-shape for my app. I can successfully install the app on Simulator and iPhone. It works fine, and looks great. However, can I submit an icon with transparency to Apple. Will they accept it? I can't find any apps which have transparency in their icon... instead they use a kind of pseudo-transparency - a jet black background with no shine.

    Read the article

  • Memcachedb Versus MongoDB Versus CouchDB in terms of file based caching solution?

    - by Scott Faisal
    We need a caching solution that essentially caches data (text files) anywhere from 3 days up to a week based on user preferences and criteria. In this case memory based caching does not make sense to us. We were referred to MemcacheDB however I also thought of some NO SQL solutions. Our current application uses RDMS (MYSQL) and I guess it makes sense to use MemcacheDB however NOSQL does appeal as it is something more on the horizon. However we have not deployed a production level application under NOSQL and the beta stuff does not settle well with management/investors. Any how what are your thoughts and how would you address it? Thank You

    Read the article

  • Mach-O binaries using FASM

    - by vruz
    is anybody using FASM to produce Mach-O binaries? it's my assembler of choice and I thought it would be nice to learn whether that's possible to accomplish and whether somebody is already doing it. thanks in advance.

    Read the article

  • How to keep submit button visible and executable upon textarea onblur

    - by ninumedia
    I have a <div id="comment_posting_holder"> tag that holds a form with two elements: a textarea box and a submit button. I want to have the div tag (containing the textarea and submit button) disappear if I click somewhere "OTHER" than the submit button. I have a start for the code below. So upon leaving focus from the textarea, I can make the div tag disappear. I tried placing in a mouseclick event inside the blur function for the submit button but that did not work. Any suggestions? Thank you! **Facebook does this with it's comments. If you click on a "Post your comment..." field the textarea appears and then it will disappear upon losing focus other than if you pressed the submit button. $('textarea').blur(function() { $('#comment_posting_holder).hide(); });

    Read the article

  • communication between threads in java

    - by Noona
    How can I make a thread run only if the other thread is running too, meaning, if I return from run in one thread, then I want the other to stop running too, my code looks something like this: ClientMessageHandler clientMessagehandler = new ClientMessageHandler(); ServerMessageHandler serverMessagehandler = new ServerMessageHandler(); Thread thread1 = new Thread(serverMessagehandler); Thread thread2 = new Thread(clientMessagehandler); thread2.start(); thread1.start(); i want to cause thread1 to stop running when thread2 stops running. thanks

    Read the article

  • Helpful advice on developing a professional MS Word add-on

    - by Dan Tao
    A few months back I put together a simple proof-of-concept piece of software for a small firm with an idea for a document editing tool. The company wanted this tool to be integrated into Microsoft Word, understandably, to maximize its accessibility to the average user. I essentially wrote the underlying library with all of the core functionality as a C# project, and then used VSTO to get it running inside of Word. It felt like a bit of a duct tape solution, really; but then, I have (practically) zero experience developing tools for integration with MS Office, and it was only a proof of concept anyway. Well, the firm was quite pleased with my work overall, and they're looking to move from "proof of concept" to the real deal. Fortunately, as I said, the core functionality is all there and will only need to be somewhat tweaked and enhanced. My main concern is figuring out how to put together an application that will integrate with MS Word in a clean and polished way, and which can be deployed easily in accordance with a regular user's expectations (i.e., simply running an install program and voila, it's there in Word). I seem to remember reading somewhere that nobody uses VSTO for real professional projects. Is this true? False? What are the alternatives? And what are the tips and gotchas that I should be aware of before getting started on this issue of MS Word integration?

    Read the article

  • Telugu (unicode) font rendering in emacs

    - by Prakash K
    [I asked the following question in stackoverflow, and I have been redirected here. I hope I can get some answers here. My question at stackoverflow had two small images showing the example rendering of text. As a new user at superuser, I am not being allowed to include them here, nor I am allowed to post more than one hyperlink. And, I don't have enough reputation on SO to migrate that question. Please look at the stackoverflow question for the images. Sorry about the inconvenience.] I sometimes edit text in telugu language. However, when I open the file (UTF-8 encoded) in GNU emacs (version 23.1.50.1 on Ubuntu Jaunty) the text rendering is incorrect. The same text file opened in gedit is rendered correctly. Here's a snippet: ????????? ???? ???? ???????? rendred in gedit: Please see the SO question for the image showing telugu text rendering in gedit And, the emacs rendering of the same text: Please see the SO question for the image showing telugu text rendering in emacs Wherever glyphs need to be composited (not sure if it's the right word), emacs (or whatever library it uses) is not doing it right. Is there anyway to fix this? Perhaps tuning some setting in my configuration? Any ideas, please?

    Read the article

  • updating changes from one database to another database in the same server

    - by Pavan Kumar
    I have a copy of client database say 'DBCopy' which already contains modified data. The copy of the client database (DBCopy) is attached to the SQL Server where the Central Database (DBCentral) exists. Then I want to update whatever changes already present in DBCopy to DBCentral. Both DBCopy and DBCentral have same schema. How can i do it programatically using C#.NET maybe with a button click. Can you give me an example code as how to do it?. I am using SQL Server 2005 Standard Edition and VS 2008 SP1. In the actual scenario there are about 7 client database all with same schema as the central database. I am bringing copy of each client database and attach it to Central Server where the central database resides and try to update changes present in each copy of the client database to central database one by one programatically using C# .NET . The clients and the central server are physically seperate machines present in different places. They are not interconnected. I need to only update and insert new data. I am not bothered about deletion of data. Thanks and regards Pavan

    Read the article

  • running a program in Unix vs in Windows

    - by Hristo
    I'm compiling a simple program written in C and I'm using Eclipse as an IDE, both in Windows 7 and on my MacBook Pro. Very simple program my friend wrote and asked me to help him with: int a = 0; char b[2]; printf("Input first class info:\n"); printf("Credit Hours: \n"); scanf("%d", &a); printf("Letter Grade: "); scanf("%s", b); So when I run this on my mac, each line prints and when I encounter the scanf(), I can input and continue as expected. In Windows, I have to input everything and then it will print all the lines. I'm not sure why this is happening... what is the difference b/w Windows and Mac here? Mac: Input first class info: Credit Hours: 4 Letter Grade: B+ Windows: 4 B+ Input first class info: Credit Hours: Letter Grade: Thanks, Hristo

    Read the article

  • Problems with Ruby "||" "or"?

    - by Kevin
    Beginning Ruby Question: I'm trying to see if a string variable's contents is either "personal" "email" or "password". I'm trying: if params[:action] == "password" || "email" || "personal" foo else don't foo end But that doesn't work and returns strange results, and using IRB to play around with "or" statements I have no idea why the following happens: irb(main):040:0> a = "email" => "email" irb(main):041:0> a == "password" || "email" => "email" irb(main):042:0> a == "email" || "password" => true I just want something that if any of the 3 variables are true no matter what order they are in it returns true, if not it returns false. Anyone want to help this n00b out?

    Read the article

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