Search Results

Search found 8959 results on 359 pages for 'bad decisions'.

Page 235/359 | < Previous Page | 231 232 233 234 235 236 237 238 239 240 241 242  | Next Page >

  • Visual Studio Add-in Exec running Automatically

    - by NewProgrammer
    Hey guys, I have a dilemma that I am uncertain about, as I not sure if it's is exactly possible for a Visual Studio Add-in to run its code automatically. I need an add-in that can run passively, like a logger for Visual Studios. However, the Exec method that I know so far can only execute commandbar functionality, but I need the code to execute when the user right-clicks, or select a line of text. I was able to make an automatic logger if i put my code in the "querystatus", but that would be considered bad programming, and it does not log when I simply select a piece of text. Does anyone know how to make a passive or automatic running code in Visual Studios?

    Read the article

  • An exception to the "only one implementation" rule ?

    - by ereOn
    While I was reading the accepted answer of this question, I had the following question: Typically, methods are defined in header files (.hpp or whatever), and implementation in source files (.cpp or whatever). One of the main reasons it is bad practice to ever include a "source file" (#include <source_file.cpp>) is that its methods implementation would then be duplicated, resulting in linking errors. When one writes: #ifndef BRITNEYSPEARS_HPP #define BRITNEYSPEARS_HPP class BritneySpears { public: BritneySpears() {}; // Here the constructor has implementation. }; #endif /* BRITNEYSPEARS_HPP */ He is giving the implementation of the constructor (here an "empty" implementation, but still). But why then including this header file multiple times (aka. on different source files) will not generate a "duplicate definition" error at link time ?

    Read the article

  • Visual C++/CLI "An unhandled exception of type 'System.StackOverflowException' occurred in"

    - by JennyWong
    Hi, I have a game I am making, it is giving me this message... "An unhandled exception of type 'System.StackOverflowException' occurred in game.exe" To explain...I have a 2D array with 9 different opening moves and I am getting a random number to use as the array reference to retrieve the details needed for a move... you may get the same move again - but that's illegal. the move may be illegal for other reasons too So to try and fix this, I am calling the function again from within the function. The error occurs very randomly Is this bad practise to call a function from within itself? What would be a better way to randomly row from a 2D array, AND if it isn't accept to get another one.... Or better still, how can I retrieve a random LEGAL move?

    Read the article

  • Securing input of private / protected methods?

    - by ts
    Hello, normally, all sane developers are trying to secure input of all public methods (casting to proper types, validating, sanitizing etc.) My question is: are you in your code validating also parameters passed to protected / private methods? In my opinion it is not necessary, if you securize properly parameters of public methods and return values from outside (other classes, db, user input etc...). But I am constantly facing frameworks and apps (ie. prestashop to name one) where validation is often repeated in method call, in method body and once again for securize returned value - which, I think, is creating performace overhead and is also a sign of bad design.

    Read the article

  • testing directory S_ISDIR acts inconsistently

    - by coubeatczech
    hi, I'm doing simple tests on all files in directory. But from some reason, sometimes, they behave wrongly? What's bad with my code? using namespace std; int main() { string s = "/home/"; struct dirent * file; DIR * dir = opendir(s.c_str()); while ((file = readdir(dir)) != NULL){ struct stat * file_info = new (struct stat); stat(file-d_name,file_info); if ((file_info-st_mode & S_IFMT) == S_IFDIR) cout << "dir" << endl; else cout << "other" << endl; } closedir(dir); }

    Read the article

  • Encoding problem in Java Server Side application.

    - by NikolayGS
    Hi! I have following problem - i`m running Java WS application. The server side (Axis2 WS Modules on Apache Tomcat) is running at Ubuntu server. The problem is when i get some information from client side in cyrilic and store in database it goes like "?????". If i add data in db directly(From Remote MYSQL Console - there is NO problem). Before move to ubuntu server side was at Windows XP and there was no problem? Sorry for bad explanation, but i have no idea where to start! Thanks in advance!

    Read the article

  • Safari on the iPhone & iPad gives colour feedback on touch, I want to stop this.

    - by Owen
    Clicking on an element which has a Javascript handler makes the element go have a 'grey overlay'. This is normally fine but I'm using event delegation to handle the touchdown events of many child elements. Because of the delegation the 'grey overlay' is appearing over the parent element and looks bad and confusing. I could attach event handlers to the individual elements to avoid the problem but this would be computationally very wasteful. I'd rather have some webkit css property that I can override to turn it off. I already have visual feedback in my app so the 'grey overlay' is not needed. Any ideas?

    Read the article

  • SharePoint SLK and T-SQL xp_cmdshell safety

    - by Mitchell Skurnik
    I am looking into a TSQL command called "xp_cmdshell" to use to monitor a change to a the SLK (SharePoint Learning Kit) database and then execute a batch or PowerShell script that will trigger some events that I need. (It is bad practice to modify SharePoint's database directly, so I will be using its API) I have been reading on various blogs and MSDN that there are some security concerns with this approach. The sites suggest that you limit security so the command can be executed by only a specific user role. What other tips/suggestions would you recommend with using "xp_cmdshell"? Or should I go about this another way and create a script or console application that constantly checks if a change has been made? I am running Server 2008 with SQL 2008.

    Read the article

  • Linq to SQL - design question.

    - by UshaP
    HI, Currently i have one big datacontex with 35 tables (i dragged all my DB tables to the designer). I must admit it is very comfortable cause i have ORM to my full DB and query with linq is easy and simple. My questions are: 1. Would you consider it bad design to have one datacontext with 35 tables or should i split it to logic units? 2. Is there any performance penalties for using such a big datacontext? Thanks, Pini.

    Read the article

  • How to raise an error, if the parsed number of a C++ stdlib stream is immediatly followed by a non whitespace character?

    - by Micha Wiedenmann
    In the following example, I didn't expect, that 1.2345foo would be parsed. Since I am reading data files, it is probably better to raise an error and notify the user. Is peek() the correct thing to do here? #include <iostream> #include <sstream> int main() { std::stringstream in("1.2345foo"); double x; in >> x; if (in) { std::cout << "good\n"; } else { std::cout << "bad\n"; } } Output good

    Read the article

  • Business applications suck, is there anything else out there?

    - by GenEric35
    It seems most of the work is in business is applications like inventory, sales, banks, medical, human resources, government, insurance, document processing, file archiving etc. Would you agree? From my point of view business applications seem to occupy over 90% of the job offerings(because no one wants to work on those?). Furthermore, each big app I have worked on, the application itself sucked, like being paid in compensation for putting up with a bad code base and product. Seeing how those business apps seem to occupy most of the market, should one accept that this is just the sad reality of this business? Do you get to develop on projects that are more dynamic than those?

    Read the article

  • How to Regex.IsMatch at a specified offset in .NET?

    - by romkyns
    Suppose I want to match "abc" within the string s only if it occurs exactly at index n. int n = 2; Console.WriteLine(new Regex("abc").IsMatch("01abc", n)); // true Console.WriteLine(new Regex("abc").IsMatch("0123abc", n)); // true (but want false) Console.WriteLine(new Regex("^abc").IsMatch("01abc", n)); // false (but want true) Seems that the only way to achieve this without using Substring on the input is something like this: var match = new Regex("abc").Match("0123abc", n); Console.WriteLine(match.Success && match.Index == n); This isn't too bad, except that when there is no match at the starting offset then the entire input will be scanned unnecessarily, which is probably slower for most regexes than actually creating a substring prior to the match. (I didn't time it though). Am I missing an obvious overload or setting that would restrict a match to the supplied offset only?

    Read the article

  • Including external C++ libraries in version control

    - by m0tive
    I'm currently starting a project which is going to be developed on a few different computer and I'm keeping in sync with bzr. In the project I'm using a couple of 3rd party libraries, like SDL. In the past I've just pushed a copy of the compiled library to my version control, but that usually seems to massively inflate the size of the branch and generally seem like a bad idea. Is that the normal practice, just pushing the required libraries, or is there a better way of added libraries to distributed version control like bzr or git? (I know on svn you can use svn:external to do something similar to this)

    Read the article

  • How to query range of data in DB2 with highest performance?

    - by Fuangwith S.
    Usually, I need to retrieve data from a table in some range; for example, a separate page for each search result. In MySQL I use LIMIT keyword but in DB2 I don't know. Now I use this query for retrieve range of data. SELECT * FROM( SELECT SMALLINT(RANK() OVER(ORDER BY NAME DESC)) AS RUNNING_NO , DATA_KEY_VALUE , SHOW_PRIORITY FROM EMPLOYEE WHERE NAME LIKE 'DEL%' ORDER BY NAME DESC FETCH FIRST 20 ROWS ONLY ) AS TMP ORDER BY TMP.RUNNING_NO ASC FETCH FIRST 10 ROWS ONLY but I know it's bad style. So, how to query for highest performance?

    Read the article

  • Arguments against Create or Update

    - by Nix
    Recently someone stated that they thought all Creates should be CreateOrUpdates. Instinctively i thought bad, but now I am trying to find out if I have any grounds. Situation interface IService{ void Create(Object a); void Update(Object a); } or interface IService{ void CreateOrUpdate(Object a); } My first thought is if you implemented everything CreateOrUpdate then you have no control if someone accidentally sends you wrong data, or concurrency issues where someone changes a "primary" field right before you call update.... But if you remove those cases, are there any other cons?

    Read the article

  • Instance where embedded C++ compilers don't support multiple inheritance?

    - by Nathan
    I read a bit about a previous attempt to make a C++ standard for embedded platforms where they specifically said multiple inheritance was bad and thus not supported. From what I understand, this was never implemented as a mainstream thing and most embedded C++ compilers support most standard C++ constructs. Are there cases where a compiler on a current embedded platform (i.e. something not more than a few years old) absolutely does not support multiple inheritance? I don't really want to do multiple inheritance in a sense where I have a child with two full implementations of a class. What I am most interested in is inheriting from a single implementation of a class and then also inheriting one or more pure virtual classes as interfaces only. This is roughly equivalent to Java/.Net where I can extend only one class but implement as many interfaces as I need. In C++ this is all done through multiple inheritance rather than being able to specifically define an interface and declare a class implements it.

    Read the article

  • android startactivity

    - by mnish
    Hello, I have an application that contains 3 activities A, B and C. The activity A is the one that gets started when I start my app. From A I start B using startActivity(A.this, B.class), this goes well. What goes wrong is when I want to start the activity C from B. this how the manifestfile looks like: <activity android:name=".B"/> <activity android:name=".C"/> I know that I can do the follwoings: start B from A and then from B go back to A and then start C or let B has its own manifestfile thus a stand lone app, and let C be an activity within this app. Any suggestion is welcome. My apoligies for my bad english. thank you

    Read the article

  • python unit testing os.remove fails file system

    - by hwjp
    Am doing a bit of unit testing on a function which attempts to open a new file, but should fail if the file already exists. when the function runs sucessfully, the new file is created, so i want to delete it after every test run, but it doesn't seem to be working: class MyObject_Initialisation(unittest.TestCase): def setUp(self): if os.path.exists(TEMPORARY_FILE_NAME): try: os.remove(TEMPORARY_FILE_NAME) except WindowsError: #TODO: can't figure out how to fix this... #time.sleep(3) #self.setUp() #this just loops forever pass def tearDown(self): self.setUp() any thoughts? The Windows Error thrown seems to suggest the file is in use... could it be that the tests are run in parallel threads? I've read elsewhere that it's 'bad practice' to use the filesystem in unit testing, but really? Surely there's a way around this that doesn't invole dummying the filesystem?

    Read the article

  • Database Schema Versioning Strategies

    - by Jack Ryan
    I work on a project that uses a reasonably large database, the live version weighing in at somewhere around 60-80GB. The live database is the only real definitive source of our schema, and because of its size duplicating this database is too slow to be done often. This means we have ended up developing our database schema in a pretty ad hoc way, using sql compare to migrate changes from dev dbs to the live system, and only wiping our dev dbs every month or two. I am hoping to get some pointers on how to improve our database development work flow so that we have a little more control. Some things to think about: Currently nobody is really in charge of the database schema, all developers can change it if they need to, though generally these decisions are talked about before they are done. There are stored procedures, functions, and views in the database. These should probably be dumped to files so they can be reloaded on every build. Schema changes should probably be checked in as scripts. We have started to do this recently. However all our scripts must then be numbered (because there may be dependencies between them), and must be re runnable (because our build script currently runs them all in order). This makes them hard to read because they are full of conditionals that check whether tables or columns already exist. This is a step that is often forgotten by developers. Getting a new database should be quick and easy. This is currently a big problem, it takes several hours to get a copy of last nights backup and restore it onto a dev machine. Some mechanism needs to be in place to allow developers to update static data. We have tables that contain data that is never updated through the application, but does potentially need to be changed when we do a new release (often this drives dropdowns). The whole thing needs to be runnable as part of a build script. Are there any tools that can be used to help to do this? Eventually I would like to be at a point where a new DB can be built from scratch without copying any data from the live system. I don't mind writing some scripts to glue all the steps together but each part should be easily editable so that we continue to use it rather than make changes directly on DBs.

    Read the article

  • BeanUtils getPropertyOfMapBean

    - by dx-cp
    Hi, Im wondering if it is possible to get data from property which is map cotaining pairs Key-StringArray (Map) in BeanUtils library. I just simply need to access one of array elements by calling propertyName=string[0]. Current version (1.8.3) does not support indexed properties. If you look into their code you will find in class PropertyUtilsBean in method getPropertyOfMapBean: if (resolver.isIndexed(propertyName) || resolver.isMapped(propertyName)) { throw new IllegalArgumentException( "Indexed or mapped properties are not supported on" + " objects of type Map: " + propertyName); } way too bad:-( Have any of you any tip how to do it somehow differently?

    Read the article

  • How do I escape a string for a shell command in nodejs (V8 Javascript engine)?

    - by Maciek
    In nodejs, the only way to execute external commands is via sys.exec(cmd). I'd like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a command and then push data to it (only to exec and receive its standard+error outputs), so it appears the only way I've got to do this right now is via a single string command such as: var dangerStr = "bad stuff here"; sys.exec("echo '" + dangerStr + "' | somecommand"); Most answers to questions like this have focused on either regex which doesn't work for me in nodejs (which uses Google's V8 Javascript engine) or native features from other languages like Python. I'd like to escape dangerStr so that it's safe to compose an exec string like the one above. If it helps, dangerStr will contain JSON data.

    Read the article

  • Session State Anti-Pattern

    - by Curiosity
    I know the SOLID principles and other design patterns fairly well and have been programming for some time now - seeing many a bit of code throughout the years. Having said that, I'm having trouble coming up with a name to give the pattern, or lack thereof, to bits of code I've been dealing with at a current engagement. The application is an ASP.NET C# WebForms application, backed by a SQL Server/Mainframe backend (more mainframe than backend) and it's riddled with Session State properties being accessed/mutated from multiple pages/classes. Accessing/mutating global variables/application state was usually shunned upon while I was in school. Apparently the creators of this magnificent application didn't think it was such a bad idea. Question: Is there a name for such a pattern/anti-pattern that relies so heavily on Session State? I'd like to call the pig by its name ...

    Read the article

  • Should I use a modified singleton design pattern that only allows one reference to its instance?

    - by Graham
    Hi, I have a class that would normally just generate factory objects, however this class should only used once throughout the program in once specifix place. What is the best design pattern to use in this instance? I throught that having a modified singleton design which only allows one reference to instance throughout the program would be the correct way to go. So only the first call to getInstance() returns the factory library. Is this a good or bad idea? Have I missed out another fundermental design pattern for solving this problem? Thanks for your help.

    Read the article

  • Resize Report to set on one page by wide

    - by adopilot
    Is there a possibility to set size of Report to fit on one page pragmatically. In excel there is option for page Scaling where We can set how many pages by tall and by wide is going to be printed . Does exists something analog in SSRS2008 ? I am using Sql Report Server 2008 and Ill try to do that by exporting report to excel and after that to set numbers of pages using ASP and C#. But the bad thing that I do not have office system installed on my server, and If I deploy code over visual studio project for Excel worksheet I am afraid that is not going to work on my server. Subquestion Are there any .NET library for Excel which implement the needed function for page scaling that can work without Office installed on target server.

    Read the article

  • Image expire time

    - by Jens
    The google page speed tool recommends me to set 'Expires' headers for images etc. But what is the most efficient way to set an Expires header for an image? In now redirect all image requests to an imagehandler.php using htaccess: /* HTTP/1.1 404 Not Found, HTTP/1.1 400 Bad Request and content type detection stuff ... */ header( "Content-Type: " . $content_type ); header( "Cache-Control: public" ); header( "Last-Modified: ".gmdate("D, d M Y H:i:s", filemtime($path))." GMT"); header( "Expires: ". date("r",time() + (60*60*24*30))); readfile( $path ); But of course this adds extra loading time for my images on first request, and I was wondering if there was a better solution for this.

    Read the article

< Previous Page | 231 232 233 234 235 236 237 238 239 240 241 242  | Next Page >