Search Results

Search found 27766 results on 1111 pages for 'bad idea jeans'.

Page 53/1111 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Is it a good idea to apply some basic macros to simplify code in a large project?

    - by DoctorT
    I've been working on a foundational c++ library for some time now, and there are a variety of ideas I've had that could really simplify the code writing and managing process. One of these is the concept of introducing some macros to help simplify statements that appear very often, but are a bit more complicated than should be necessary. For example, I've come up with this basic macro to simplify the most common type of for loop: #define loop(v,n) for(unsigned long v=0; v<n; ++v) This would enable you to replace those clunky for loops you see so much of: for (int i = 0, i < max_things; i++) With something much easier to write, and even slightly more efficient: loop (i, max_things) Is it a good idea to use conventions like this? Are there any problems you might run into with different types of compilers? Would it just be too confusing for someone unfamiliar with the macro(s)?

    Read the article

  • MULTIPLE CRITERIA TABLE JOIN

    - by user1447203
    I have a table listing clothing items (shirt, trousers, etc) named . Each item is identified with a unique CLOTHING.CLOTHING_ID. So a blue shirt is 01, a flowery shirt is 12 and jeans are 07 say. I have a second table identifying outfits with a column for shirts, for trousers, shoes etc. For example Outfit 1: shirt 01, trousers 07 (i.e. blue shirt with jeans) Outfit 2: shirt 12, trousers 07 (so flowery shirt with jeans). This table is named and each outfit is unique with OUTFIT_LIST.OUTFIT_ID. I want to produce a select statement that will list each outfit's contents, i.e. find the clothing specified in Outfit 1. Any help would be very much appreciated, and apologies in advance if I am missing a very simple solution. I have been playing with JOINS of all descriptions and CONCATS and so on with now luck - I am very new to this. Thanks.

    Read the article

  • Is it a good idea to include a large text variable in compiled code?

    - by gladman
    I am writing a program that produces a formatted file for the user, but it's not only producing the formatted file, it does more. I want to distribute a single binary to the end user and when the user runs the program, it will generate the xml file for the user with appropriate data. In order to achieve this, I want to give the file contents to a char array variable that is compiled in code. When the user runs the program, I will write out the char file to generate an xml file for the user. char* buffers = "a xml format file contents, \ this represent many block text \ from a file,..."; I have two questions. Q1. Do you have any other ideas for how to compile my file contents into binary, i.e, distribute as one binary file. Q2. Is this even a good idea as I described above?

    Read the article

  • I am getting a 400 Bad Request error when using Nginx and PHP-FPM, why?

    - by Bob
    I am trying to run a website (that requires PHP - it technically doesn't require MySQL at this time, but it may sometime in the near future as I continue developing it, so I went ahead and installed that as well) using nginx 1.2.4 and PHP-FPM 5.3.3 on Ubuntu 12.04.1 LTS. As far as I know, I haven't done anything wrong, but clearly something is not quite right - I seem to be getting a 400 Bad Request error whenever I try to browse to my website. I've been mostly following one guide, and I've done more or less everything it recommends, except for not setting up PHP-FPM to use a Unix Socket and I used service as opposed to /etc/init.d/ when starting/stopping nginx, PHP, and MySQL. Anyways, here are my relevant configuration files (I have only censored personal/sensitive details, like my domain name - which contains my real name): /etc/nginx/nginx.conf user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } /etc/nginx/sites-enabled/subdomain.mydomain.net server { listen 80; # listen for IPv4 listen [::]:80; # listen for IPv6 server_name www.subdomain.mydomain.net subdomain.mydomain.net; access_log /srv/www/subdomain.mydomain.net/logs/access.log; error_log /srv/www/subdomain.mydomain.net/logs/error.log; location / { root /srv/www/subdomain.mydomain.net/public; index index.php; } location ~ \.php$ { try_files $uri =400; include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/subdomain.mydomain.net/public$fastcgi_script_name; } } All the directories listed in the configuration files above are correct on my server (to the extent of my knowledge). I have not included /etc/php5/fpm/pool.d/www.conf or /etc/php5/fpm/php.ini in this post as they're rather long, but I have posted them on Pastebin: http://pastebin.com/ensErJD8 and http://pastebin.com/T23dt7vM, respectively. Although, the only thing I've changed in either of the two files was in php.ini, where I set expose_php to off so as to hide the .php file extension from users. What can I do to resolve my issue? Please let me know if I need to supply any additional details.

    Read the article

  • Why would 1.000 subforms in a db be a bad idea?

    - by KlaymenDK
    Warm-up I'm trying to come up with a good way to implement customized document forms. It's for a tool to request access to applications; each application will want to ask its own specific questions. The thing is, we have one kind of (common) user who needs to fill in and submit documents based on templates, and another kind of (super) user who needs to be able to define what each template needs to contain. One implementation option would be to use a form (with the basic mandatory stuff), and have that form dynamically include a subform appropriate to the specific task at hand. The gist of the matter is that we could (=will!) quite easily end up having many hundreds of different subforms! (NB. These subforms will be maintained in an automated manner, but that is another topic that may be considered outside the scope of this Question.) Question It's common knowledge that having a lot of views in a Notes database is Bad Thing. But has anyone tried pushing the number of forms or subforms and made any experiences regarding performance?

    Read the article

  • Implementing comparision operators via 'tuple' and 'tie', a good idea?

    - by Xeo
    (Note: tuple and tie can be taken from Boost or C++11.) When writing small structs with only two elements, I sometimes tend to choose a std::pair, as all important stuff is already done for that datatype, like operator< for strict-weak-ordering. The downsides though are the pretty much useless variable names. Even if I myself created that typedef, I won't remember 2 days later what first and what second exactly was, especially if they are both of the same type. This gets even worse for more than two members, as nesting pairs pretty much sucks. The other option for that is a tuple, either from Boost or C++11, but that doesn't really look any nicer and clearer. So I go back to writing the structs myself, including any needed comparision operators. Since especially the operator< can be quite cumbersome, I thought of circumventing this whole mess by just relying on the operations defined for tuple: Example of operator<, e.g. for strict-weak-ordering: bool operator<(MyStruct const& lhs, MyStruct const& rhs){ return std::tie(lhs.one_member, lhs.another, lhs.yet_more) < std::tie(rhs.one_member, rhs.another, rhs.yet_more); } (tie makes a tuple of T& references from the passed arguments.) Edit: The suggestion from @DeadMG to privately inherit from tuple isn't a bad one, but it got quite some drawbacks: If the operators are free-standing (possibly friends), I need to inherit publicly With casting, my functions / operators (operator= specifically) can be easily bypassed With the tie solution, I can leave out certain members if they don't matter for the ordering Are there any drawbacks in this implementation that I need to consider?

    Read the article

  • Is it an good idea to make a wrapper specifically for a DateTime that respresents Now?

    - by Dirk Boer
    I have been noticing lately that is really nice to use a DateTime representing 'now' as an input parameter for your methods, for mocking and testing purposes. Instead of every method calling DateTime.UtcNow themselves, I do it once in the upper methods and forward it on the lower ones. So a lot of methods that need a 'now', have an input parameter DateTime now. (I'm using MVC, and try to detect a parameter called now and modelbind DateTime.UtcNow to it) So instead of: public bool IsStarted { get { return StartTime >= DateTime.UtcNow; } } I usually have: public bool IsStarted(DateTime now) { return StartTime >= now; } So my convention is at the moment, if a method has a DateTime parameter called now, you have to feed it with the current time. Of course this comes down to convention, and someone else can easily just throw some other DateTime in there as a parameter. To make it more solid and static-typed I am thinking about wrapping DateTime in a new object, i.e. DateTimeNow. So in one of the most upper layers I will convert the DateTime to a DateTimeNow and we will get compile errors when, someone tries to fiddle in a normal DateTime. Of course you can still workaround this, but at least if feels more that you are doing something wrong at point. Did anyone else ever went into this path? Are there any good or bad results on the long term that I am not thinking about?

    Read the article

  • How to use Scala in IntelliJ IDEA (or: why is it so difficult to get a working IDE for Scala)?

    - by Alex R
    I recently gave up trying to use Scala in Eclipse (basic stuff like completion doesn't work). So now I'm trying IntelliJ. I'm not getting very far. I've been able to edit programs (within syntax highlighting and completion... yay!). But I'm unable to run even the simplest "Hello World". This was the original error: Scala signature Predef has wrong version Expected 5.0 found: 4.1 in .... scala-library.jar But that was yesterday with IDEA 9.0.1. See below... UPDATE Today I uninstalled IntelliJ 9.0.1, and installed 9.0.2 Early Availability, with the 4/14 stable version of the Scala plug-in. Then I setup a project from scratch through the wizards: new project from scratch JDK is 1.6.u20 accept the default (project) instead of global / module accept the download of Scala 2.8.0beta1 into project's lib folder Created a new class: object hello { def main(args: Array[String]) { println("hello: " + args); } } For my efforts, I now have a brand-new error :) Here it is: Scalac internal error: class java.lang.ClassNotFoundException [java.net.URLClassLoader$1.run(URLClassLoader.java:202), java.security.AccessController.doPrivileged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.java:190), java.lang.ClassLoader.loadClass(ClassLoader.java:307), sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301), java.lang.ClassLoader.loadClass(ClassLoader.java:248), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:169), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:72)] FINAL UPDATE I uninstalled 9.0.2 EA and reinstalled 9.0.1, but this time went with the 2.7.3 version of Scala rather than the default 2.7.6, because 2.7.3 is the one shown in the screen-shots at the IntelliJ website (I guess the screen-shots prove that they actually tested this version!). Now everything works!!!

    Read the article

  • What does JSLint's "Bad Escapement" mean in this case?

    - by karlthorwald
    I thougth "bad escapement" stands for wrong use escaping with slash. Why does JSLint bring up the message in this function on the 3d line (for...) ? function splitTags(commaSeparated) { var tagArray = commaSeparated.split(','); for (var i=tagArray.length - 1; i>=0; --i ){ tagArray[i] = f.trim(tagArray[i]); } return tagArray; }

    Read the article

  • MVVM/WPF: Using a ObservableCollection<T> as a list in a domain model, is that good/bad ?

    - by msfanboy
    I have aggregated models like Customer:Order:Product. As my View is bound to the BillingViewModel which has a Property Customers of type ObservableCollection and ONE customer in this collection has a "list" of orders named ObservableCollection and ONE order in this collection has a "list" of products named ObservableCollection Well I need the ObservableCollection`s for databinding but should a domain model really have a ObservableCollection ? normally it has a List or IEnumerable ! Is this bad habit or having side effects?

    Read the article

  • Why do I get a "Bad Gateway" error with my Perl CGI program on IIS?

    - by Eyla
    I'm trying to run sample Perl script on Windows 7 and I configured IIS 7 to allow ActivePerl to run but I'm getting this error: HTTP Error 502.2 - Bad Gateway The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Hello World. ". Module CgiModule Notification ExecuteRequestHandler Handler Perl Script (PL) Error Code 0x00000000 Requested URL http://localhost:80/hello.pl Physical Path C:\inetpub\wwwroot\hello.pl Logon Method Anonymous Logon User Anonymous and here is my Perl script: #!/usr/bin/perl print "Hello World.\n";

    Read the article

  • Php index page utitlizing an idea for a superswitch...

    - by Matt
    I dont know if this is a great idea...or a crap one. But I was thinking I may use one page to display all my pages using includes. Here is what my index.php would look like...on the functions include there is a function called "superSwitch" which will determine what requested page will be included....for instance if I do a get ?a=a it will goto the function superSwitch(a) superSwitch will take it and associate it with (login.php) then respond with such... here is the code for the index.php...please let me know if this makes sense and might work, or should I just stick to long blocks of code (which is why I am trying this because I hate long pages full of code...) of course as you can tell it is not actually including anything yet...the print is for debugging purposes. :) Thanks, Matt <?php //includes Functions include_once('inc/func.inc.php'); //set superget variable $superget = @$_GET['a']; //check if superget is set or null if (!$superget) { echo "Nothing Requested :)"; } else { //sanitizes the superget request $supergetr = supergetSanitize($superget) //uses the result "good" or "nogood" to determine what happens if ( $supergetr == "good" ) { //pulls superSwitch value of the request $ssresult = superSwitch($superget); print_r ($ssresult); } //if the sanitize is nogood else { //the superSwitch is instructed to respond with a 404 page $superget = "404" $ssresult = superSwitch($superget); print_r ($ssresult); } } ?>

    Read the article

  • Extension Methods - IsNull and IsNotNull, good or bad use?

    - by Jaimal Chohan
    I like readability. So, I came up with an extension mothod a few minutes ago for the (x =! null) type syntax, called IsNotNull. Inversly, I also created a IsNull extension method, thus if(x == null) becomes if(x.IsNull()) and if(x != null) becomes if(x.IsNotNull()) However, I'm worried I might be abusing extension methods. Do you think that this is bad use of Extenion methods?

    Read the article

  • Is it bad to explicitly compare against boolean constants e.g. if (b == false) in Java?

    - by polygenelubricants
    Is it bad to write: if (b == false) //... while (b != true) //... Is it always better to instead write: if (!b) //... while (!b) //... Presumably there is no difference in performance (or is there?), but how do you weigh the explicitness, the conciseness, the clarity, the readability, etc between the two? Note: the variable name b is just used as an example, ala foo and bar.

    Read the article

  • Is it a good idea to use MySQL and Neo4j together?

    - by Sanoj
    I will make an application with a lot of similar items (millions), and I would like to store them in a MySQL database, because I would like to do a lot of statistics and search on specific values for specific columns. But at the same time, I will store relations between all the items, that are related in many connected binary-tree-like structures (transitive closure), and relation databases are not good at that kind of structures, so I would like to store all relations in Neo4j which have good performance for this kind of data. My plan is to have all data except the relations in the MySQL database and all relations with item_id stored in the Neo4j database. When I want to lookup a tree, I first search the Neo4j for all the item_id:s in the tree, then I search the MySQL-database for all the specified items in a query that would look like: SELECT * FROM items WHERE item_id = 45 OR item_id = 345435 OR item_id = 343 OR item_id = 78 OR item_id = 4522 OR item_id = 676 OR item_id = 443 OR item_id = 4255 OR item_id = 4345 Is this a good idea, or am I very wrong? I haven't used graph-databases before. Are there any better approaches to my problem? How would the MySQL-query perform in this case?

    Read the article

  • Is it bad to use a model directly from a view in codeigniter?

    - by jason
    I know normally the data is passed thru to the view with the controller. however, currently in my view I load my model ($this-load-model('Db_model');) so i can use it in a loop to retrieve a users profile picture path from a array of IDs that is passed from controller. Will loading the db model in the view to accomplish this make my site more vulnerable or bad form? To me it seems to be outside of MVC concept but its working atm. thanks

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >