Daily Archives

Articles indexed Tuesday January 11 2011

Page 28/37 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • visual studio C++ toggle comment ? comment while not whole line is selected ?

    - by Mr_and_Mrs_D
    2 questions actually : 1) shortcut to toggle comment on selected lines ? Available on all iDEs I used starting with notepad++ 2)the ctrl-k, ctrl-c exhibits this behavior (quoted from someplace nicely worded): C#: Each line where some text is selected is commented at the line-start with double-slash. If nothing is selected, the line where the cursor is is commented. C++: If nothing is selected or complete lines are selected, it behaves as above. However, if parts of a line are selected, and no comment is selected as part of the selection (ex. select something in the middle of a code line), then the selection is surrounded by /* and */. since I code in C++ I find this behavior annoying - I want to be able to comment out lines partially selected - any workarounds ?

    Read the article

  • Rails 3 Routing help

    - by Rod Nelson
    OK i'm new to rails 3 and the new routing is driving me mad. I just a good example i was looking at the info on http://rizwanreza.com/2009/12/20/revamped-routes-in-rails-3 but it don't make sense to me. i need an example please! I have my root down that's not hard. I have Site as my controller and i have index help and about then i have a second controller users with index and register on the register page i have 3 text boxes and a submit when i hit submit i get Routing Error No route matches "/user/register" if you need me to i will post my routes file

    Read the article

  • jQuery: 'async: false' Not Working With IE7 / IE6

    - by Norbert
    I created a simple tracking script which adds the users info to a database when the page is unloaded. It works on all browsers except IE7 and IE6. IE7 gives me errors, but I can't open the "debugger" because I'm using the standalone version (or at least that's what I think the problems is). I removed the async: false, from the script below and I didn't get any errors, but I need async set to false in order for the script to work. Any ideas? $(window).unload(function() { $.ajax({ type: "POST", async: false, url: "add.php", data: "ip=" + jIp + "&date=" + jDate + "&time=" + jTime, }); }); Update: I got IE7 to display the error, kinda. When I click OK on the dialog on top, it closes both dialogs. Ugh!

    Read the article

  • What is a NullReferenceException in .NET?

    - by John Saunders
    (I'm creating this separate question and answer because every question we get on NullReferenceException is really the same) I have some code and when it executes, it throws a NullReferenceException, saying, "Object reference not set to an instance of an object.". What does this mean, and what can I do about it? Note again, that this is a question meant to focus answers to the canonical "what is a NullReferenceException and why did I get one" question. I do know what a NullReferenceException is, as my answer below demonstrates.

    Read the article

  • How to choose between UUIDs, autoincrement/sequence keys and sequence tables for database primary keys?

    - by Tim
    I'm looking at the pros and cons of these three primary methods of coming up with primary keys for database rows. So assuming I am using a database that supports more than one of these methods, is there a simple heuristic to determine what the best option would be for me? How do considerations such a distributed/multiple masters, performance requirements, ORM use, security and testing have on the choice? Any unexpected drawbacks that one might run into?

    Read the article

  • The most efficient way to calculate an integral in a dataset range

    - by Annalisa
    I have an array of 10 rows by 20 columns. Each columns corresponds to a data set that cannot be fitted with any sort of continuous mathematical function (it's a series of numbers derived experimentally). I would like to calculate the integral of each column between row 4 and row 8, then store the obtained result in a new array (20 rows x 1 column). I have tried using different scipy.integrate modules (e.g. quad, trpz,...). The problem is that, from what I understand, scipy.integrate must be applied to functions, and I am not sure how to convert each column of my initial array into a function. As an alternative, I thought of calculating the average of each column between row 4 and row 8, then multiply this number by 4 (i.e. 8-4=4, the x-interval) and then store this into my final 20x1 array. The problem is...ehm...that I don't know how to calculate the average over a given range. The question I am asking are: Which method is more efficient/straightforward? Can integrals be calculated over a data set like the one that I have described? How do I calculate the average over a range of rows?

    Read the article

  • What's the "correct way" to organize this project?

    - by user571747
    I'm working on a project that allows multiple users to submit large data files and perform operations on them. The "backend" which performs these operations is written in Perl while the "frontend" uses PHP to load HTML template files and determines which content to deliver. Data is stored in a database (MySQL, SQLite, Oracle) and while there is data which has not yet been acted upon, Perl adds it to a running queue which delivers data to other threads based on system load. In addition, there may be pre- and post-processing of the data before and after the main Perl script operates (the specifications are unclear) so I may want to allow these processors to be user-selectable plugins. I had been writing this project in a more procedural fashion but I am quickly realizing the benefit of separating concerns as to limit the scope one change has on the rest of the project. I'm quite unexperienced with design patterns and am curious what the best way to proceed is. I've heard MVC thrown around quite a bit but I am unsure of how to apply it. Specifically, what are some good options to structure this code (in terms of design patterns and folder hierarchy)? How can I achieve this with both PHP and Perl while minimizing duplicated code between languages? Should I keep my PHP files in the top level so I don't have ugly paths in the URL? Also, if I want to provide interchangeable databases, does each table need its own DAO implementation?

    Read the article

  • Anyone know how do i get the real time feeds on gas station price in US via webservice version?

    - by tomtom
    Hi, Anyone has pointers on how to get real time US gas station feeds via webservice ? I'm trying to develop an iphone app that give users real time gas station price near their location. Currently i was wondering is there a legit government service that produce real time gas station price in the US on a daily basis? I heard about http://gasbuddy.com/ but i don't know where they get the data source from and was not sure if i should base on their data as well. On the other hand, there is a bunch of iphone apps on the apple store that show the gas price info. I'm clueless on how did the developers got their source from to get the nearest gas station price locations. Anyone has any suggestion? Thanks for the info :- )

    Read the article

  • PHP export to text file - Only saving first line.

    - by wertz8090
    I'm trying to export some extracted $_POST information into a text file, however my code is only capturing the first variable and ignoring the rest. I'm saving the information to the text file in this manner: $values = "First Name: $fName\r\n"; $values .= "Last Name: $lName\r\n"; $values .= "Address: $address\r\n"; etc. This is the code I use to write to the text file: $fp = @fopen("person.data", "w") or die("Couldn't open person.data for writing!"); $numBytes = @fwrite($fp, $values) or die("Couldn't write values to file!"); @fclose($fp); Any ideas on why it would only save the first $values ($fName) variable but not the rest of them? It actually saves the first part of the $values string for all of them (so I see Last Name:, Address:, etc. on separate lines in the text file) but the called variables $lName and $address do not appear.

    Read the article

  • Hibernate criteria with projection not performing query for @OneToMany mapping

    - by Josh
    I have a domain object, Expense, that has a field called initialFields. It's annotated as so: @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, orphanRemoval = true) @JoinTable(blah blah) private final List<Field> initialFields; Now I'm trying to use Projections in order to only pull certain fields for performance reasons, but when doing so the initialFields field is always null. It's the only OneToMany field and the only field I am trying to retrieve with the projection that is behaving this way. If I use a regular HQL query initialFields is populated appropriately, but of course I can't limit the fields. Anyone ever seen anything like this?

    Read the article

  • How to add and relate a node within the parent nodes add form in Drupal.

    - by Espen Christensen
    Hi, I want to accomplish the following scenario in Drupal: You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons. Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be related to this lisence, and only this lisence. Say you would like to apply for a lisence, and relate 4 persons to this lisence, then insted of creating the lisence and then create the 4 persons and relate them to the lisence, i would like to do this "inline". So when i add a lisence, there would be a way to add 1 or more persons that would relate to the lisence node. Is this possible, and if so how? I have been looking at the node reference module, and that manages to reference a node to another, but not to add them inline with the other. With the web-development framework Django, there is a way to this with something called "inline-editing", where you get the content-type fields inside another content-type creation form. There you bind them togheter with a ForeignKey. Anybody know of something simular in Drupal, if not, is it another way to achive something simular, that would be as user-friendly?

    Read the article

  • Jquery hide is not working in my Dialog box close span

    - by kumar
    $('.ui-dialog-titlebar-close ui-corner-all').hide(); this is the hide for my Jquery dialog close 'X' span.. this is not working in my case. I am trying to hide that Close becuase its not showing me in my dialog when I resize my dialog then its showing me.. some reason my CSS not showing me that Close button correctly on my POPUP. Can any body help me out. here is my code and CSS. $("#window").dialog({ resizable: true, height: 180, title: titles, width: 500, modal: true, open: function () { $('.ui-widget-overlay').show(); $('.ui-dialog-titlebar-close ui-corner-all').hide(); }, buttons: { "OK": function () { $(this).dialog("close"); if (redirectURL) { window.location = redirectURL; } } } }); here is my CSS. <style> .ui-widget-overlay { background: black; opacity: 0.5; filter: alpha(opacity = 50); position: absolute; top: 0; left: 10; } </style> Can any body tell me how to show My Close 'X' correctly on my dialog or I need to hide that Close 'X' thanks

    Read the article

  • Executing JavaScript with Python without X.

    - by Thomas
    I want to parse a html-page that unfortunately requires JavaScript to show any content. In order to do so I use a small python-script that pulls the html-code of the page, but after that I have to execute the JavaScript in a DOM-context which seems pretty hard. To make it even harder I want to use it in a server environment that has no X11-server. Note: I already read about http://code.google.com/p/pywebkitgtk/ but it seems to need a X-server.

    Read the article

  • How to query the SPView object

    - by Hugo Migneron
    I have a SPView object that contains a lot of SPListItem objects (there are many fields in the view). I am only interested in one of these fields. Let's call it specialField Given that view and specialField, I want to know if a value is contained in specialField. Here is a way of doing what I want to do : String specialField = "Special Field"; String specialValue = "value"; SPList list = SPContext.Current.Site.RootWeb.Lists["My List"]; SPView view = list.Views["My View"]; //This is the view I want to query SPQuery query = new SPQuery(); query.Query = view.Query; SPListItemCollection items = list.GetItems(query); foreach(SPListItem item in items) { var value = item[specialField]; if(value != null) && (value.ToString() == specialValue) { //My value is found. This is what I was looking for. //break out of the loop or return } } //My value is not found. However, iterating through each ListItem hardly seems optimal, especially as there might be hundreds of items. This query will be executed often, so I am looking for an efficient way to do this. EDIT I will not always be working with the same view, so my solution cannot be hardcoded (it has to be generic enough that the list, view and specialField can be changed.

    Read the article

  • PHP Zip Archive sporadically creating multiple files

    - by user516558
    I have a PHP script (running PHP 5.2 on Apache 2.2) that creates a zip archive of files for a user to download. Everything seems to work just fine; the only issue I have is that periodically multiple files will be created before the ZIP archive is successfully finished. Example: archive-name.zip archive-name.zip.a09600 archive-name.zip.b09600 archive-name.zip.c09600 This does not happen every single time; only periodically - the file is still created but sometimes these extra 'files' are left on the server after it finishes. The code that creates the ZIP archive is as follows: $zip_archive = new ZipArchive(); $zip_archive->open($archiveFullName,ZIPARCHIVE::CREATE); if(!file_exists($archiveFullName)) { foreach ($completed_file_arr as $zip_file) { $isFiller = substr($zip_file,-8) == "_err.txt"; if(!$isFiller) { $zip_archive->addFile($zip_file,$localname); } else $zip_archive->addFromString ($zip_file, "The requested source file could not be found."); } } while(!$zip_archive->close()) sleep(1); //ensure that the ZIP file finishes closing

    Read the article

  • Qt/C++ Error handling

    - by ShiGon
    I've been doing a lot of research about handling errors with Qt/C++ and I'm still as lost as when I started. Maybe I'm looking for an easy way out (like other languages provide). One, in particular, provides for an unhandled exception which I use religiously. When the program encounters a problem, it throws the unhandled exception so that I can create my own error report. That report gets sent from my customers machine to a server online which I then read later. The problem that I'm having with C++ is that any error handling that's done has to be thought of BEFORE hand (think try/catch or massive conditionals). In my experience, problems in code are not thought of before hand else there wouldn't be a problem to begin with. Writing a cross-platform application without a cross-platform error handling/reporting/trace mechanism is a little scary to me. My question is: Is there any kind of Qt or C++ Specific "catch-all" error trapping mechanism that I can use in my application so that, if something does go wrong I can, at least, write a report before it crashes?

    Read the article

  • Detecting regional settings (List Separator) from web

    - by Toms Mikoss
    After having the unpleasant surprise that Comma Seperated Value (CSV) files are not necessarily comma-separated, I'm trying to find out if there is any way to detect what the regional settings list separator value is on the client machine from http request. Scenario is as follows: A user can download some data in CSV format from web site (RoR, if it matters). That CSV file is generated on the fly, sent to the user, and most of the time double-clicked and opened in MS Excel on Windows machine at the destination. Now, if the user has ',' set as the list separator, the data is properly arranged in columns, but if any other separator (';' is widely used here) is set, it all just gets thrown into a single column. So, is there any way to detect what separator is used on the client machine, and generate the file accordingly? I have a sinking feeling that it is not, but I'd like to be sure before I pass the 'can't be done, sorry' line to the customer :)

    Read the article

  • Geolocation through Android's GPS Provider on a website?

    - by Corey Ogburn
    I'm trying to get the geolocation of the mobile device in a regular website, not a webview of an application or anything native like that. I'm getting a location, but it's highly inaccurate, the accuracy comes back as 3230 or some other outrageous number. I'm assuming that's in meters, either way it's not nearly accurate enough. By comparison, the same webpage on a laptop gets an accuracy of 30-40. My first thought was that it was using the Network Provider instead of the GPS Provider, telling me where I am based on tower location and reach. A little research later I found enableHighAccuracy and set it true in the options that I pass. After including that, I still notice no difference. Here's the test page's HTML/javascript: <html> <head> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript"> function OnLoad() { $("#Status").text("Init"); if (navigator.geolocation) { $("#Status").text("Supports Geolocation"); navigator.geolocation.getCurrentPosition(HandleLocation, LocationError, { enableHighAccuracy: true }); $("#Status").text("Sent position request..."); } else { $("#Status").text("Doesn't support geolocation"); } } function HandleLocation(position) { $("#Status").text("Received response:"); $("#Position").text("(" + position.coords.latitude + ", " + position.coords.longitude + ") accuracy: " + position.coords.accuracy); var loc = new Microsoft.Maps.Location(position.coords.latitude, position.coords.longitude); GetMap(loc); } function LocationError(error) { switch(error.code) { case error.PERMISSION_DENIED: alert("Location not provided"); break; case error.POSITION_UNAVAILABLE: alert("Current location not available"); break; case error.TIMEOUT: alert("Timeout"); break; default: alert("unknown error"); break; } } function GetMap(loc) { var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {credentials: "Aj59meaCR1e7rNgkfQy7j08Pd3mzfP1r04hGesGmLe2a3ZwZ3iGecwPX2SNPWq5a", center: loc, mapTypeId: Microsoft.Maps.MapTypeId.road, zoom: 15}); } </script> </head> <body onload="javascript:OnLoad()"> <div id="Status"></div> <div id="Position"></div><br/> <div id='mapDiv' style="position:relative; width:600px; height:400px;"></div> </body> </html> I'm testing this on a rooted MyTouch 3G running Cyanogen 6.1 stable, Android 2.2 and GPS is enabled. In case rooting was a problem, I have also had various friends and coworkers try the webpage on their non-rooted 2.0+ Android devices. Each phone had various effects on the accuracy, but none were better than 1000, I attribute this to the different carriers. I have not (but eventually will) tested with iPhone or other location-aware cell phones.

    Read the article

  • Is there a way to batch create DNS slave zones on a new slave DNS server?

    - by Josh
    I currently have a DNS server which is serving as a master DNS server for a number of our domains. I want to set up a brand new secondary DNS server. Is there any way I can automatically have BIND on the new server act as a secondary for all the domains on the primary server? In case it matters, I have Webmin on the primary server. I believe Webmin has an option to create a zone as a secondary on another server when creating a new master zone on one server, but I don;t know of any way to batch create secondary zones for a number of existing master zones. Maybe I'm missing something. Is there a way to "batch create" DNS slave zones on a brand new slave DNS server for all the DNS zones on an existing master?

    Read the article

  • Can you see something wrong in my .htaccess?

    - by AlexV
    OK, after many search, trial and errors I've managed to create an .htaccess that do what I wanted (see explanations and questions after the code block): <IfModule mod_rewrite.c> RewriteEngine On #1 If the requested file is not url-mapper.php (to avoid .htaccess loop) RewriteCond %{REQUEST_FILENAME} (?<!url-mapper\.php)$ #2 If the requested URI does not end with an extension OR if the URI ends with .php* RewriteCond %{REQUEST_URI} !\.(.*) [OR] RewriteCond %{REQUEST_URI} \.php.*$ [NC] #3 If the requested URI is not in an excluded location RewriteCond %{REQUEST_URI} !^/seo-urls\/(excluded1|excluded2)(/.*)?$ #Then serve the URI via the mapper RewriteRule .* /seo-urls/url-mapper.php?uri=%{REQUEST_URI} [L,QSA] </IfModule> This is what the .htaccess should do: #1 is checking that the file requested is not url-mapper.php (to avoid infinite redirect loops). This file will always be at the root of the domain. #2 the .htaccess must only catch URLs that don't end with an extension (www.foo.com -- catch | www.foo.com/catch-me -- catch | www.foo.com/dont-catch.me -- don't catch) and URLs ending with .php* files (.php, .php4, .php5, .php123...). #3 some directories (and childs) can be excluded from the .htaccess (in this case /seo-urls/excluded1 and /seo-urls/excluded2). Finally the .htaccess feed the mapper with an hidden GET parameter named uri containing the requested uri. Even if I tested and everything works, I want to know if what I do is correct (and if it's the "best" way to do it). I've learned a lot with this "project" but I still consider myself a beginner at .htaccess and regular expressions so I want to triple check it there before putting it in production...

    Read the article

  • Wordpress: Problem installing on dedicated windows server 2008/IIS7

    - by Niels Bosma
    I'm having trouble with installing Wordpress on a dedicated Microsoft Windows Web Server 2008 R2. I've installed Wordpress Version 2.9.2 from Web platform installer 3.0. After installation when I try to access wordpress, either from ~/index.php or ~/wp-admin/install.php I get the error: HTTP Error 500.0 - Internal Server Error File monitoring is enabled for a file which could not be found Modul: FastCgiModule Notification: ExecuteRequestHandler Handler: PHP52_via_FastCGI Error Code: 0x80070003 I have both .Net 2.0 and .Net 4.0 installed. Adding a "phpinfo.php" gives me the same error. The application pool in IIS7 that's used for the website is: "No Managed Code" and set to "Integrated" in "Managed Pipeline Mode". I've tried to reboot the machine. What's more can I try?

    Read the article

  • How to troubleshoot this memory usage?

    - by Camran
    I have a classifieds website. I use PHP, MySql, and SOLR. Solr uses a Servlet Container, in my case JETTY, which is java application. I just noticed that something was terribly wrong on my website. I opened the terminal and entered the "top" command and noticed that JAVA was EATING all the cpu and mem. Now I thought "Ok, maybe I need more mem and cpu" So I increased it. But along with the increase the java app started eating more. This has never happened before, and it is either a bug, or a hack of some kind. Anyways, I need to troubleshoot this now, and so I wonder how do I do this? Can I somehow pinpoint exactly when the memory usage started to go up from some error log? How does one troubleshoot this? How do I prevent it? Is it possible to prevent too many requests somehow, if they are within a timeline? Thanks

    Read the article

  • Simple Central Storage for HA mail server

    - by jtnire
    Hi Everyone, I will have 2 Postfix servers. One will be a backup of the other. What is the easiest method to provide central storage to both of these boxes? My infrastructure is very simple: Just a lot of Xen hosts, so there is no SAN or anything. Each Xen host does have RAID1 though. I don't mind mounting NFS shares on each of those mail servers, as long as the NFS server wasn't a single point of failure. Is there such a thing as redundant NFS? Any help would be appreciated Thanks

    Read the article

  • Debian, 2 NICs load-balancing or agregating with one same gateway

    - by pouney
    Hi, I have one server, with double NICs connected to one switch with the same gateway. Behind the switch we have internet. |Debian| - eth0 - switch - internet - eth1 - same I don't understand how to load-balancing between eth0 and eth1. The inbound/outbound traffic always use eth1. This is the config: # The primary network interface allow-hotplug eth0 auto eth0 iface eth0 inet static address 192.168.248.82 netmask 255.255.255.240 network 192.168.248.80 broadcast 192.168.248.95 gateway 192.168.248.81 allow-hotplug eth1 auto eth1 iface eth1 inet static address 192.168.248.83 netmask 255.255.255.240 network 192.168.248.80 broadcast 192.168.248.95 gateway 192.168.248.81 Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth1 192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth0 0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth1 0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth0 Ips aren't real, it's just for the example. Anybody have an idea on correct routing to use eth0 on 192.168.248.82 and eth1 on 192.168.248.83 ? I have many example for multiple gateway but here it's the same. Thanks all. Regards

    Read the article

  • CPU temperatures high on new build after gaming

    - by Reznor
    My friend had a problem with his computer a while back. His games were crashing, even within the menus. He was stumped as to what the problem was, so I posted on here requesting help. He found out the day later, when his computer would start up but wouldn't display anything on the screen. His video card must have came screwed up. So, he got a replacement. Now, there's a new problem. His temperatures, which were acceptable before, are now insanely high. His GPU temperature runs 70-80c, which is understandable considering he's running his games maxed out, but the real problem here is his processor and motherboard temperatures. All four of his cores are running at 88-90c after coming out of a game. His motherboard temperature was also 70c at one point. In terms of cooling, his case should definitely be adequate. He has an Antec Twelve Hundred. He's using stock fans. The cable management in his case is very good; better than average. He's using the stock heatsink with the processor too, but note, it was fine before the replacement, so it isn't like there's some inherent problem. He has checked the case too. Everything's fine! No cables in the way. The heatsink is seated properly. He turned his case fans up to high, as well, but the temperatures are persisting. Could the processor be overheating due to running games maxed out? Any ideas?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >