Rectangle 27 35

Use the Maven Mojo executor by Don Brown of Atlassian fame to run any other arbitrary plugin.

The Mojo Executor provides a way to to execute other Mojos (plugins) within a Maven 2 plugin, allowing you to easily create Maven 2 plugins that are composed of other plugins.

+1 that's cool, never heard of that before!

Maven plugin executing another plugin - Stack Overflow

maven-2 plugins
Rectangle 27 3

I don a toga and open a can of socratic method.

The Socratic Method named after the Classical Greek philosopher Socrates, is a form of philosophical inquiry in which the questioner explores the implications of others' positions, to stimulate rational thinking and illuminate ideas. This dialectical method often involves an oppositional discussion in which the defense of one point of view is pitted against another; one participant may lead another to contradict himself in some way, strengthening the inquirer's own point.

The problem with the Socratic method is that no one has the patience for it, nor the willingness to follow along.

coding style - How do you tell someone they're writing bad code? - Sta...

coding-style
Rectangle 27 3

I don a toga and open a can of socratic method.

The Socratic Method named after the Classical Greek philosopher Socrates, is a form of philosophical inquiry in which the questioner explores the implications of others' positions, to stimulate rational thinking and illuminate ideas. This dialectical method often involves an oppositional discussion in which the defense of one point of view is pitted against another; one participant may lead another to contradict himself in some way, strengthening the inquirer's own point.

The problem with the Socratic method is that no one has the patience for it, nor the willingness to follow along.

coding style - How do you tell someone they're writing bad code? - Sta...

coding-style
Rectangle 27 5

The only difference is that double quoted strings interpret embedded variables and a number of escape sequences, while single quoted strings do not. E.g.:

'This is $a \n string'
"This is $a \n string"

This is a string containing the value of variable $a and a line break.

Use both as appropriate. If neither escape sequences nor variables are of interest to you, I'd default to single quoted strings; with one exception: if you need single quotes in the string, then double quotes are "cleaner". Compare:

'I don\'t care.'
"I don't care."

I agree with "I'd default to single quoted strings" Even if I need a line break, I'll start with single quote and put ."\n" at the end of it. I also prefer concatenation over lots of escapes within the string.

There is a negligible performance increase using double quotes over single, however this does diminish if you have a lot of variables within it and is specific to the PHP version you're running. I tend to use singles in preference too as I'll often be echoing HTML where arguments should be enclosed with doubles. Consistency is key however.

@PeteAUK The performance difference is so minuscule as to be irrelevant. I'd go for readable source code first and foremost.

@deceze I'd not say irrelevant as it has fluctuated marginally with different versions of PHP (which means it could again) - admittedly not enough to make a difference :D Legibility and consistency should be the name of the game nine times out of ten.

@PeteAUK Sooo... you're saying it pretty much is irrelevant? :D I'll start worrying about it when benchmarking proves that single-vs-double-quotes is a major choking point in my app performance. Which is probably never going to happen... ;)

When should you use single or double quotes in PHP? - Stack Overflow

php quotes
Rectangle 27 2

echo 'Sorry we don\'t have user "'. $name . '" ';
if(in_array($name, $nameArray))
document.getElementById("underInput").innerHTML = '<span style="color: blue">' + message  + '</span>';

That's because php returns internal server error.but with these edits I think it will work

Thanx a lot :D and sorry for stupid mistakes :(

javascript - Ajax , Cannot read property 'documentElement' of null - S...

javascript php ajax xml
Rectangle 27 4

I don't have the reputation to comment, but in response/addition to Don F's answer:

A second parameter of true needs to be added to the json_decode function in order to properly return an associative array:

$params = json_decode(file_get_contents('php://input'), true);

AngularJs $http.post() does not send data - Stack Overflow

angularjs post angular-http
Rectangle 27 4

I don't have the reputation to comment, but in response/addition to Don F's answer:

A second parameter of true needs to be added to the json_decode function in order to properly return an associative array:

$params = json_decode(file_get_contents('php://input'), true);

AngularJs $http.post() does not send data - Stack Overflow

angularjs post angular-http
Rectangle 27 4

For redirect to another controller action you don create instance from it ..you use from

TempData["Key"]="lol";
or
Session["key"]="lol";
return RedirectToAction("ActionName", "ControllerName");

For session you can store yor data in TemData["key"] Or Session["key"] and get it your another action like

var data=TempData["Key"]; 
Or
var data =Session["key"];

c# - Set session in ASP.Net MVC Controller from another class - Stack ...

c# asp.net asp.net-mvc asp.net-mvc-4
Rectangle 27 3

The only difference is that double quoted strings interpret embedded variables and a number of escape sequences, while single quoted strings do not. E.g.:

'This is $a \n string'
"This is $a \n string"

This is a string containing the value of variable $a and a line break.

Use both as appropriate. If neither escape sequences nor variables are of interest to you, I'd default to single quoted strings; with one exception: if you need single quotes in the string, then double quotes are "cleaner". Compare:

'I don\'t care.'
"I don't care."

I agree with "I'd default to single quoted strings" Even if I need a line break, I'll start with single quote and put ."\n" at the end of it. I also prefer concatenation over lots of escapes within the string.

There is a negligible performance increase using double quotes over single, however this does diminish if you have a lot of variables within it and is specific to the PHP version you're running. I tend to use singles in preference too as I'll often be echoing HTML where arguments should be enclosed with doubles. Consistency is key however.

@PeteAUK The performance difference is so minuscule as to be irrelevant. I'd go for readable source code first and foremost.

@deceze I'd not say irrelevant as it has fluctuated marginally with different versions of PHP (which means it could again) - admittedly not enough to make a difference :D Legibility and consistency should be the name of the game nine times out of ten.

@PeteAUK Sooo... you're saying it pretty much is irrelevant? :D I'll start worrying about it when benchmarking proves that single-vs-double-quotes is a major choking point in my app performance. Which is probably never going to happen... ;)

When should you use single or double quotes in PHP? - Stack Overflow

php quotes
Rectangle 27 3

The only difference is that double quoted strings interpret embedded variables and a number of escape sequences, while single quoted strings do not. E.g.:

'This is $a \n string'
"This is $a \n string"

This is a string containing the value of variable $a and a line break.

Use both as appropriate. If neither escape sequences nor variables are of interest to you, I'd default to single quoted strings; with one exception: if you need single quotes in the string, then double quotes are "cleaner". Compare:

'I don\'t care.'
"I don't care."

I agree with "I'd default to single quoted strings" Even if I need a line break, I'll start with single quote and put ."\n" at the end of it. I also prefer concatenation over lots of escapes within the string.

There is a negligible performance increase using double quotes over single, however this does diminish if you have a lot of variables within it and is specific to the PHP version you're running. I tend to use singles in preference too as I'll often be echoing HTML where arguments should be enclosed with doubles. Consistency is key however.

@PeteAUK The performance difference is so minuscule as to be irrelevant. I'd go for readable source code first and foremost.

@deceze I'd not say irrelevant as it has fluctuated marginally with different versions of PHP (which means it could again) - admittedly not enough to make a difference :D Legibility and consistency should be the name of the game nine times out of ten.

@PeteAUK Sooo... you're saying it pretty much is irrelevant? :D I'll start worrying about it when benchmarking proves that single-vs-double-quotes is a major choking point in my app performance. Which is probably never going to happen... ;)

When should you use single or double quotes in PHP? - Stack Overflow

php quotes
Rectangle 27 12

For those who wonder why you want to use an EditoFor if you don`t want it to be editable, I have an example.

[DataType(DataType.Date)]
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0: dd/MM/yyyy}")]
    public DateTime issueDate { get; set; }

and when you want to display that format, the only way it works is with an EditorFor, but I have a jquery datepicker for that "input" so it has to be readonly to avoid the users of writting down wrong dates.

To make it work the way I want I put this in the View...

@Html.EditorFor(m => m.issueDate, new{ @class="inp", @style="width:200px", @MaxLength = "200"})

and this in my ready function...

$('#issueDate').prop('readOnly', true);

Thank you Seichi! This is the real solution to the exact problem!

This is a great answer. It describes what the original question is valid, as well as actually answering the OP. Great job!

Simple straight forward answer thank you very much! Requirements had me jumping back and forth while reviewing a defect I realized my change to editorfor allowed my desired DisplayFormating but I discovered they were no longer read only this was a great find !!!

asp.net mvc 3 - MVC3 EditorFor readOnly - Stack Overflow

asp.net-mvc-3 readonly editorfor
Rectangle 27 3

While using laravel 5 use this code as you don`t need headers.

return response()->download($pathToFile);

If you are using Fileentry you can use below function for downloading.

// download file
public function download($fileId){  
    $entry = Fileentry::where('file_id', '=', $fileId)->firstOrFail();
    $pathToFile=storage_path()."/app/".$entry->filename;
    return response()->download($pathToFile);           
}

This answer would be helpful if it left out the unnecessary parts or even just expanded on them below the pure answer. Fileentry is a different feature not needed for this question. Edit answer and I will upvote because the mentioning of LV5s response()->download().

php - Download files in laravel using Response::download - Stack Overf...

php laravel laravel-4 laravel-routing
Rectangle 27 23

Came here with the same question, and Don's answer got me on the right path. The generators however have : instead of _ in the name for Rails 3:

> rails g rspec:controller soa/user
      create  spec/controllers/soa/user_controller_spec.rb

> rails g rspec:scaffold soa/user
      create  spec/controllers/soa/users_controller_spec.rb
      create  spec/views/soa/users/edit.html.erb_spec.rb
      create  spec/views/soa/users/index.html.erb_spec.rb
      create  spec/views/soa/users/new.html.erb_spec.rb
      create  spec/views/soa/users/show.html.erb_spec.rb
      invoke  helper
      create    spec/helpers/soa/users_helper_spec.rb
      create  spec/routing/soa/users_routing_spec.rb
      invoke  rspec
      create    spec/requests/soa/soa_users_spec.rb

Annoyingly, these are not listed when you run rails g but they are available.

how to Rspec generate in rails? - Stack Overflow

rspec
Rectangle 27 2

I don;t know about 3.5 but to fix it in 4.0 use

<httpRuntime requestValidationMode="2.0" />

in your web.config and set the page directive as you said in your question.

Wow thanks, for some reason it set up the DefaultAppPool as using ASP.NET 4 so the app that was supposed to be using 2 was still ignoring the validaterequest attributes.

ASP.NET - A potentially dangerous Request.Form value was detected - St...

asp.net
Rectangle 27 2

String#splitsplits on white-space by default, so don 't bother with a regex:

"a b c".split # => ["a", "b", "c"]

ruby - How do I split a string without keeping the delimiter? - Stack ...

ruby regex string split delimiter
Rectangle 27 2

but I don,t knoe can i take UDID for older version of ios6

ios - I want unique identifier string which detect iPhone device (just...

iphone ios objective-c uniqueidentifier
Rectangle 27 2

Short answer: I don;t think you can do this without becoming very unpopular.

I think you should read up on the SVN redbook's description of how SVN works, especially the versioning models

In your environment, everyone wants to be able to modify any file locally and then send their changes to the server, merging changes with colleague's changes if necessary. This approach works well if 2 people are not changing the same files all the time, which is typical of most dev shops.

The old TFS/VSS model of checkout a file to work on it is pretty obsolete today - the more 'optimistic' approach where you assume you have exclusive access is much more productive. (as usual its easier to ask forgiveness if it goes wrong than ask permission every time)

Your main problem is that you cannot mix these models - if your colleagues are using the merge model, then you have to as well. You cannot lock a file and expect them to still be able to change any file anytime.

Now, there are tricks you can use to prevent yourself from modifying files you never meant to - I'm not sure of VisualSVN but TortoiseSVN (awesome tool) can run client hooks - ie you can write a program to run on every checkout, and that program can be as simple as setting every file's read-only flag. Whether this is god enough for you is another matter.

Personally, I would get used to the idea of change whatever you like whenever. If you accidentally edit a file, you can see the change indicator (AnkhSVN turns the file icon orange for changed files), and its easy to 'svn revert' changes you didn't want to make. Also SVN lets you see diffs really easily, especially on commit - double click the files in the commit dialog. The productivity gains from being able to work without the tools getting in your way (as I found with TFS continually pinging at me as I tried to edit a file) are huge. The SVN tools are really good to let you "ask forgiveness" so you don't need to run in the crappy old TFS way now you've upgraded to something better.

The other advantage is that this applies to files that are not in a Visual Studio project, if you've ever had a project file that was edited outside VS (eg a generated WCF client stub) then you will appreciate how SVN works - never again will you do a full commit and find that TFS has conveniently decided that your changed file wasn't changed and so didn't need to be committed!

visual studio - VisualSVN - disable auto checkout - Stack Overflow

visual-studio svn tfs tortoisesvn visualsvn
Rectangle 27 2

I don know How it can be cause of the issue but it was originated from:

NSIndexPath *visibleIndexPath = [self.collectionView indexPathForItemAtPoint:midPoint];
//*****updating page control*****
// get the visible rect
CGRect visibleRect = (CGRect) {.origin = self.collectionView.contentOffset,
    .size = self.collectionView.bounds.size};
// get the mid point in the visible rect
CGPoint midPoint = CGPointMake(CGRectGetMidX(visibleRect), CGRectGetMidY(visibleRect));
// find indexPath of the item in that midPoint
 //in iOS 8 Cause the second cell disappear
//NSIndexPath *visibleIndexPath = [self.collectionView indexPathForItemAtPoint:midPoint];
//iterating through visble cells to find the cell which contains midpoint then get get that cell indexpath
for (UICollectionViewCell *cell in [self.collectionView visibleCells]) {
    if (CGRectContainsPoint(cell.frame, midPoint)) {
        NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];

        //update page control
        self.pageControl.currentPage = indexPath.row;
        //quiting loop
        break;
    }
}

uicollectionview - UICollectionViewCell disappears in iOS 8 - Stack Ov...

ios uicollectionview uicollectionviewcell uicollectionviewlayout
Rectangle 27 2

I don;t know about 3.5 but to fix it in 4.0 use

<httpRuntime requestValidationMode="2.0" />

in your web.config and set the page directive as you said in your question.

Wow thanks, for some reason it set up the DefaultAppPool as using ASP.NET 4 so the app that was supposed to be using 2 was still ignoring the validaterequest attributes.

ASP.NET - A potentially dangerous Request.Form value was detected - St...

asp.net
Rectangle 27 6

I don`t know if it is the best way, but I accomplish that making my custom view to override onSizeChanged that way:

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    if (getLayoutParams() != null && w != h) {
        getLayoutParams().height = w;
        setLayoutParams(getLayoutParams());
    }
}

I use this custom view inside a LinearLayout and a GridView and in both it is showing square!

Oh man, you're a life saver, I've been fighting with this for days. Gregory's answer works fine unless you have a lot of children; then, as a comment points out, TextViews don't wrap and most views don't readjust their bounds. But this fixes it!

android - Making GridView items square - Stack Overflow

android gridview