Rectangle 27 6

<UITableViewDataSource, UITableViewDelegate>
@interface InformatieSectieViewController : UIViewController < UITableViewDataSource, UITableViewDelegate>

I would expect a warning on the lines (in InformatieSectieViewController.m):

tabView.delegate = self;
    tabView.dataSource = self;

But I do not get this warning.

Yes, that's curious. If you use UIViewController, you really should see those warnings. If you have other warnings, sometime you won't see some subsequent warnings. Or sometimes if you edit the header, don't save and/or build, you might not see the warning until you do. Or try selecting "Clean" from the "Build" menu, and then re-build, and see if you get the warning.

Regardless, even if you don't see these warnings, you should still define it to conform to those two protocols, as it will make your code completion in Xcode easier.

If you use a UITableViewController as the base class, though, you don't need to define it as conforming to those two protocols because it already conforms to UITableViewDataSource and UITableViewDelegate.

And in answer to the broader question of how to add the table view to a view with other stuff on it, rather than doing the following in loadView:

self.view = tabview;

You should, instead, be doing the following in loadView:

self.view = [[UIView alloc] init];
[self.view addSubview:tabview];

Or if you are not building the view programmatically in loadView, but rather using a NIB or storyboard, you can then just do the following in viewDidLoad:

[self.view addSubview:tabview];

Regardless, by making sure you have another a main UIView, and your UITableView is a subview, you can therefore add other controls to that main view.

Looking further into your code sample, I see that you're creating the controller, grabbing its view, adding that view as a subview, and then letting the controller fall out of scope. That's a really bad practice. If ARC, you will get exceptions. If non-ARC, you'll leak if you ever dismiss this view (not a problem, though, if this is your top level view).

Worse, if you do this, your view controller won't receive certain events (notably rotation events, but possibly others). See WWDC 2011 - Implementing UIViewController Containment for discussion of importance of keeping your view and view controller hierarchies synchronized.

rootViewController
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.

    // create your controller any way you want

    self.viewController = [[InformatieSectieViewController alloc] init];

    // if not using ARC, it should be
    //
    // self.viewController = [[[InformatieSectieViewController alloc] init] autorelease];

    // by defining this as your root view controller, you'll be assured that the controller
    // is now part of the controller hierarchy

    self.window.rootViewController = self.viewController;

    [self.window makeKeyAndVisible];

    return YES;
}

If this view controller is not the top level controller, you would create it in the presenting controller, and either do a modal or push segue from the presenting view controller, e.g.:

- (void)transitionToNextViewController
{
    UIViewController *controller = [[InformatieSectieViewController alloc] init];

    // again, if not using ARC, that line should be:
    //
    // UIViewController *controller = [[[InformatieSectieViewController alloc] init] autorelease];

    [self presentViewController:controller animated:YES completion:nil];

    // or
    // [self.navigationController pushViewController:controller animated:YES];
}

Or, in the unlikely event that you're using a custom container view controller, you'd do something like:

- (void)addChild
{
    UIViewController *controller = [[InformatieSectieViewController alloc] init];

    // again, if not using ARC, that line should be:
    //
    // UIViewController *controller = [[[InformatieSectieViewController alloc] init] autorelease];

    [self addChildViewController:controller];
    controller.view.frame = CGRectMake(x, y, width, height);
    [self.view addSubview:controller.view];
    [controller didMoveToParentViewController:self];
}

Any one of those three techniques will ensure that your view controller hierarchy will be synchronized with your view hierarchy. I know this seems like it's overkill, but you'll run into problems later if you don't handle it in one of these three ways.

I know there's a lot here, but I hope it helps. I apologize if it's confusing.

Thanks for your answer. I understand that UITableViewController conforms to UITableViewDataSource and UITableViewDelegate. What I meant is that I expect a warning when I use UIViewController instead of UITableViewController.

@PeterVerwoerd re warnings for delegate and dataSource, I misunderstood you (because I saw you define your UITableViewController as conforming to those two protocols, which is unnecessary because it already conforms) and find that when you defined a UIViewController that didn't conform that you didn't get warnings. I get warnings. Sometimes, if there are warnings early in the code, subsequent ones aren't generated. Not sure. Bottom line, when using UIViewController, you should declare it to conform to those two protocols, but when using UITableViewController, you shouldn't.

Thanx, that's what I thought as well. Don't know why I don't get warnings though, I'll look into it some more.

@PeterVerwoerd I've significantly updated my answer to reflect (a) our conversation above; (b) the barrage of comments I've been sending you; and (c) variations on some of those alloc statements if you happen to not be using ARC (though I'd heartily encourage you to use ARC, as it eliminates tons of routine memory leaks).

Wow, that's a lot of code, I'll be checking it out. I am using ARC (I am used to Java, so when I started coding Obj-c, ARC seemed the most sensible way to go for me :-))

ios - How do I put a UITableView into a UIView - Stack Overflow

ios uitableview uiview
Rectangle 27 38

As it should be for any project.

On windows that means you can't use MFC and would have to change all the 'C' standard lib functions to MS's s_versions

Yes. However, I must add that for my personal projects I simply #pragma away the security warnings. _s versions are not really safe and are unportable and slow.

that doesn't sound like you're eating the dog food.... :D

C / C++ compiler warnings: do you clean up all your code to remove the...

c++ c compiler-construction warnings
Rectangle 27 3

No. Not all warnings, and not be any means.

Not all warnings: some compilers have implemented stylistic or inaccurate warnings, it's often better to deactive those warnings as they distract from real issues.

Not by any means: warnings are used by the compiler to signal something suspicious going on, the most interesting warnings signal possible undefined behavior for example. The goal should not be to remove the warning just to appease the compiler, it should be to make sure that the behavior is well-defined, and if it is not to make it well-defined.

My advice is to first review the set of activated warnings, and prune the useless ones. Then, to understand what the warnings left are about, and to agree on the best way to deal with each (with the goal of getting defined behavior). And finally you'll be able to get to work on your codebase.

Since our libs depend on many different third party libs (boost, qt, TAO, gsoap, etc.), ends up that we have to use many different int types and such as size_t, int, int32, etc, it is really inevitable to have warnings in such case, should we just use explicit cast to force to conversion, or just leave the warning there, really not sure.

You should avoid comparing signed and unsigned and you should avoid possible truncation. boost::numeric_cast<> assists in safe casts (it checks the value of the target and throws on underflow/overflow).

If you determine a warning isn't useful and disable it that counts as removing the warning. The point of requiring builds to produce zero warnings or using -Werror is so that new warnings get noticed and dealt with instead of letting 'unimportant' warnings pile up until they hide real issues. So I would say "Yes, all warnings."

c++ - is it best practice to try to remove ALL compiler warnnings with...

c++ compiler-construction warnings
Rectangle 27 3

No. Not all warnings, and not be any means.

Not all warnings: some compilers have implemented stylistic or inaccurate warnings, it's often better to deactive those warnings as they distract from real issues.

Not by any means: warnings are used by the compiler to signal something suspicious going on, the most interesting warnings signal possible undefined behavior for example. The goal should not be to remove the warning just to appease the compiler, it should be to make sure that the behavior is well-defined, and if it is not to make it well-defined.

My advice is to first review the set of activated warnings, and prune the useless ones. Then, to understand what the warnings left are about, and to agree on the best way to deal with each (with the goal of getting defined behavior). And finally you'll be able to get to work on your codebase.

Since our libs depend on many different third party libs (boost, qt, TAO, gsoap, etc.), ends up that we have to use many different int types and such as size_t, int, int32, etc, it is really inevitable to have warnings in such case, should we just use explicit cast to force to conversion, or just leave the warning there, really not sure.

You should avoid comparing signed and unsigned and you should avoid possible truncation. boost::numeric_cast<> assists in safe casts (it checks the value of the target and throws on underflow/overflow).

If you determine a warning isn't useful and disable it that counts as removing the warning. The point of requiring builds to produce zero warnings or using -Werror is so that new warnings get noticed and dealt with instead of letting 'unimportant' warnings pile up until they hide real issues. So I would say "Yes, all warnings."

c++ - is it best practice to try to remove ALL compiler warnnings with...

c++ compiler-construction warnings
Rectangle 27 5

Always clean up your warnings. If you have a specific case where you know the warning is ok, then suppress it for that instance only.

While some warnings can be benign, most signify a real problem with the code.

If you don't clean up all of your warnings then the warning list will continue to grow and the real problem cases will be lost in a sea of warning noise.

C / C++ compiler warnings: do you clean up all your code to remove the...

c++ c compiler-construction warnings
Rectangle 27 69

You can tell IntelliJ to not to warn about used for any method/field annotated with the annotation the "unused" method has.

It should be a quick fix all you have to do is hit <Alt>+<Enter> and select Suppress for methods annotated by ...

You don't need to add anything to you code and you only have to do this once per annotation.

unfortunately I do not have this option, my annotation is @WebMethod and I am using Intellij 14.1.1 . Any idea why I do not have this option available?

This works with recent versions like a charm. IntelliJ really comes with some magic.

I've accidentally suppressed this for "fields annotated with xx". To undo this operation find <component name="EntryPointsManager"> in the .idea/misc.xml file and adapt it (don't forget to update the list attribute, when you change the count of items)

java - Telling IntelliJ IDEA which methods not to identify as unused -...

java spring annotations intellij-idea aop
Rectangle 27 19

I agree it's best to eliminate all warnings. If you're getting thousands of warnings you should prioritize your fixes.

Start be setting your compiler to the lowest warning level. These warnings should be the most important. When those are fixed, increment your warning level and repeat until you reach the highest warning level. Then set your compile options such that warnings are treated as errors.

If you find a warning that you suspect is safe to ignore, do some research to verify your theory. Only then disable it and only in the most minimal way possible. Most compilers have #pragma directives that can disable/enable warnings for just a portion of a file. Here's a Visual C++ example:

typedef struct _X * X; // from external header, not 64-bit portable

#pragma warning( push )
#pragma warning( disable: 4312 ) // 64-bit portability warning
X x = reinterpret_cast< X >( 0xDDDDDDDD ); // we know X not 64-bit portable
#pragma warning( pop )

Note that this only disables the warning for a single line of code. Using this method also allows you to do simple text searching of your code in the future to make changes.

Alternatively you can usually disable a particular warning for a single file or for all files. IMHO this is dangerous and should only be a last resort.

I'd personally prefer to see a comment next to that #pragma warning(disable: 4312) so that I didn't have to go and look up the warning number to know what it was... If it's not obvious from the description of the warning then I'd also like a reason for why it's safe to disable it.

good point, I actually removed the comment for brevity, I'll add it back in

also - just as when fixing errors, often fixing a couple near the top fixes a slew of cascaded ones down below :)

C / C++ compiler warnings: do you clean up all your code to remove the...

c++ c compiler-construction warnings
Rectangle 27 6

This with no warnings!

HashMap<String, String> meMap=new HashMap<String, String>();
    meMap.put("Color1","Red");
    meMap.put("Color2","Blue");
    meMap.put("Color3","Green");
    meMap.put("Color4","White");

    for (Object o : meMap.keySet()) {
        Toast.makeText(getBaseContext(), meMap.get(o.toString()),
                Toast.LENGTH_SHORT).show();
    }

Android - Get value from HashMap - Stack Overflow

android android-widget hashmap
Rectangle 27 6

This with no warnings!

HashMap<String, String> meMap=new HashMap<String, String>();
    meMap.put("Color1","Red");
    meMap.put("Color2","Blue");
    meMap.put("Color3","Green");
    meMap.put("Color4","White");

    for (Object o : meMap.keySet()) {
        Toast.makeText(getBaseContext(), meMap.get(o.toString()),
                Toast.LENGTH_SHORT).show();
    }

Android - Get value from HashMap - Stack Overflow

android android-widget hashmap
Rectangle 27 165

This is a problem of Webrick. you can use "Thin" instead. Add this to Gemfile gem 'thin' then rails s will use thin instead of Webrick, and the warn will disappear. share|improve this answer edited Aug 10 '13 at 17:03 Jay Sullivan 7,51383769 answered Apr 20 '12 at 15:35 Cam Song 2,82011415

@cam song: almost correct: rails s thin will use thin instead of Webrick, and the warn will disappear.

I second using thin instead of WEBrick. However. On Windows the install of the thin dependencies (more specifically the eventmachine) may be problematic. I use the following in my Gemfile to get a clean install of thin: gem 'eventmachine', '1.0.0.rc.4', :platforms => [:mswin, :mingw]. Note: I installed Rails via the RailsInstaller which includes the DevKit. Might not work without it(?).

On Rails 3.2 and above rails s will use thin if it exists in the Gemfile.

puma

ruby on rails - WARN Could not determine content-length of response bo...

ruby-on-rails ruby-on-rails-3
Rectangle 27 10

Ignore the Warnings, After Competion of Installation, Restart Eclipse.

You can either choose

But as a web-developer, I still prefer Notepad++, it has necessary code assists.

Help > Install New Software > Add > Archive > Select the Downloaded Plug-in.zip

Right Click on the css file > Properties > Web Content Settings > Select CSS3 Profile > ok

I'm not sure where I missed, but I can't find "Static Web Project" after installed Google Plugin for Eclipse. The only new project type is something about Google App Engine.

What version of Eclipse are you using?

Indigo Service Release 1. Later I tried Aptana plugin, and it works

It's always better to use latest version of any IDE, you can try Juno JEE for better results

Any good, visual HTML5 Editor or IDE? - Stack Overflow

ide editor html5 html-editor
Rectangle 27 165

This is a problem of Webrick. you can use "Thin" instead. Add this to Gemfile gem 'thin' then rails s will use thin instead of Webrick, and the warn will disappear. share|improve this answer edited Aug 10 '13 at 17:03 Jay Sullivan 7,51383769 answered Apr 20 '12 at 15:35 Cam Song 2,82011415

@cam song: almost correct: rails s thin will use thin instead of Webrick, and the warn will disappear.

I second using thin instead of WEBrick. However. On Windows the install of the thin dependencies (more specifically the eventmachine) may be problematic. I use the following in my Gemfile to get a clean install of thin: gem 'eventmachine', '1.0.0.rc.4', :platforms => [:mswin, :mingw]. Note: I installed Rails via the RailsInstaller which includes the DevKit. Might not work without it(?).

On Rails 3.2 and above rails s will use thin if it exists in the Gemfile.

puma

ruby on rails - WARN Could not determine content-length of response bo...

ruby-on-rails ruby-on-rails-3
Rectangle 27 40

A (often discouraged) alternative is the error suppression operator @. It is a specific language construct to shut down undesired notices and warnings, but should be used with care.

First, it incurs a microperformance penalty over using isset. That's not measurable in real world applications, but should be considered in data heavy iterations. Secondly it might obstruct debugging, but at the same time suppressed errors are in fact passed on to custom error handlers (unlike isset decorated expressions).

If you are curious what is the performance impact, this article summarises it well, derickrethans.nl/.

@GajusKuizinas There have been quoite a few changes since 2009, in particular php.net/ChangeLog-5.php#5.4.0 changes the outcome drastically (see "Zend Engine, performance" and "(silence) operator").

Thanks @mario, interesting. Now, if someone was good enough to benchmark the two... 3v4l.org/CYVOn/perf#tabs 3v4l.org/FLp3D/perf#tabs According to this test, seem to be identical (notice that scale changes).

I tested with PHP 5.4 and the performance still bad.

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index",...

php arrays variables warnings undefined-index
Rectangle 27 3

If there are warnings, then you need to check each one to ensure that there is no problem. Doing this over and over is a waste of time. Not doing this implies will lead to errors creeping into your code.

There are ways to remove a warning (e.g. #pragma argsused).

Let the compiler do the work.

C / C++ compiler warnings: do you clean up all your code to remove the...

c++ c compiler-construction warnings
Rectangle 27 11

Pay attention to all warnings . Do not only solve errors. GCC shows this Warning

warning: address of local variable 'a' returned

This is power of C++. You should care about memory. With the -Werror flag, this warning becames an error and now you have to debug it.

c++ - Can a local variable's memory be accessed outside its scope? - S...

c++ memory-management local-variables dangling-pointer
Rectangle 27 28

Warning: open_basedir restriction in effect

This warning can appear with various functions that are related to file and directory access. It warns about a configuration issue.

The warning itself does not break anything, but most often a script does not properly work if file-access is prevented.

The fix is normally to change the PHP configuration, the related setting is called open_basedir.

Sometimes the wrong file or directory names are used, the fix is then to use the right ones.

This occurs most often on a shared host, people don't usually lock themselves out of directories :-)

debugging - Reference - What does this error mean in PHP? - Stack Over...

php debugging warnings
Rectangle 27 28

Warning: open_basedir restriction in effect

This warning can appear with various functions that are related to file and directory access. It warns about a configuration issue.

The warning itself does not break anything, but most often a script does not properly work if file-access is prevented.

The fix is normally to change the PHP configuration, the related setting is called open_basedir.

Sometimes the wrong file or directory names are used, the fix is then to use the right ones.

This occurs most often on a shared host, people don't usually lock themselves out of directories :-)

debugging - Reference - What does this error mean in PHP? - Stack Over...

php debugging warnings
Rectangle 27 28

Warning: open_basedir restriction in effect

This warning can appear with various functions that are related to file and directory access. It warns about a configuration issue.

The warning itself does not break anything, but most often a script does not properly work if file-access is prevented.

The fix is normally to change the PHP configuration, the related setting is called open_basedir.

Sometimes the wrong file or directory names are used, the fix is then to use the right ones.

This occurs most often on a shared host, people don't usually lock themselves out of directories :-)

debugging - Reference - What does this error mean in PHP? - Stack Over...

php debugging warnings
Rectangle 27 28

Warning: open_basedir restriction in effect

This warning can appear with various functions that are related to file and directory access. It warns about a configuration issue.

The warning itself does not break anything, but most often a script does not properly work if file-access is prevented.

The fix is normally to change the PHP configuration, the related setting is called open_basedir.

Sometimes the wrong file or directory names are used, the fix is then to use the right ones.

This occurs most often on a shared host, people don't usually lock themselves out of directories :-)

debugging - Reference - What does this error mean in PHP? - Stack Over...

php debugging warnings
Rectangle 27 28

Warning: open_basedir restriction in effect

This warning can appear with various functions that are related to file and directory access. It warns about a configuration issue.

The warning itself does not break anything, but most often a script does not properly work if file-access is prevented.

The fix is normally to change the PHP configuration, the related setting is called open_basedir.

Sometimes the wrong file or directory names are used, the fix is then to use the right ones.

This occurs most often on a shared host, people don't usually lock themselves out of directories :-)

debugging - Reference - What does this error mean in PHP? - Stack Over...

php debugging warnings