Rectangle 27 11

Morichika is spot on. I had the same problem, but then it sorted itself out by doing:

    * Template Name: Front Page

Template Dropdown not showing up within Wordpress administrator page -...

wordpress wordpress-theming
Rectangle 27 10

One way to solve the problem in SourceTree

as I'm on Windows I don't have a command line tool nor do I know how to use one :( Is it the only way to get that sorted out? The GUI doesn't cover all the git's functions? Original Poster

Regarding Git GUIs, no, they don't cover all of Git's functions. They don't even come close. I suggest you check out one of the answers in How do I edit an incorrect commit message in Git?, Git is flexible enough that there are multiple solutions...from the command line.

SourceTree might actually come with the msysgit bash shell already, or it might be able to use the standard Windows command shell. Either way, you open it up form SourceTree by clicking the Terminal button:

That being said, here's one way you can do it in SourceTree. Since you mentioned in the comments that you don't mind "reverting back to the faulty commit" (by which I assume you actually mean resetting, which is a different operation in Git), then here are the steps:

  • Do a hard reset in SourceTree to the bad commit by right-clicking on it and selecting Reset current branch to this commit, and selecting the hard reset option from the drop down.
  • Click the Commit button, then
  • Click on the checkbox at the bottom that says "Amend latest commit".
  • Make the changes you want to the message, then click Commit again. Voila!

if it's not possible because it's already pushed to Bitbucket, I would not mind creating a new repository and starting over.

Does this mean that you're the only person working on the repo? This is important because it's not trivial to change the history of a repo (like by amending a commit) without causing problems for your collaborators. However, assuming that you're the only person working on the repo, then the next thing you would want to do is force push your changed history to the remote.

Be aware, though, that because you did a hard reset to the faulty commit, then force pushing causes you to lose all work that come after it previously. If that's okay, then you might need to use the following command at the command line to do the force push, because I couldn't find an option to do it in SourceTree:

git push remote-repo head -f

You should really learn how to use Git from the command line anyways though, it'll make you more proficient in Git. #ProTip, use msysgit and turn on Quick Edit mode on in the terminal properties, so that you can double click to highlight a line of text, right click to copy, and right click again to paste. It's pretty quick.

git - Edit a commit message in SourceTree Windows (already pushed to r...

git atlassian-sourcetree
Rectangle 27 15

Indeed, if you sorted out the iterator then buffering could now be your problem. You could tell the python in the sub-process not to buffer its output.

proc = subprocess.Popen(['python','-u', ''],stdout=subprocess.PIPE)

I have needed this when calling python from within python.

python - read subprocess stdout line by line - Stack Overflow

python subprocess
Rectangle 27 6

I sorted out the answer for myself and would like to share it with others who experience the same problem.

The problem is that for some reason the AVAssetExportPresetPassthrough is not working properly in ios5. Substituting it with AVAssetExportPresetAppleM4A solved the issue. But it takes longer to export now.

Anybody have any idea why AVAssetExportPresetPassthrough is not working? Its causing a lot of time delay while exporting with AVAssetExportPresetAppleM4A.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

iphone - AVAssetExportSession not working in ios5 - Stack Overflow

iphone objective-c ios5 avfoundation avassetexportsession
Rectangle 27 1

Here's a fully vectorized solution to your problem:

import numpy as np
from scipy.spatial.distance import pdist

def smallest(M, f):
    # compute the condensed distance matrix
    dst = pdist(M, 'euclidean')
    # indices of the upper triangular matrix
    rows, cols = np.triu_indices(M.shape[0], k=1)
    # indices of the f smallest distances
    idx = np.argsort(dst)[:f]
    # gather results in the specified format: distance, row, column
    return np.vstack((dst[idx], rows[idx], cols[idx])).T

Notice that np.argsort(dst)[:f] yields the indices of the smallest f elements of the condensed distance matrix dst sorted in ascending order.

The following demo reproduces the result of your toy example and shows how the function smallest deals with a fairly large matrix of integers:

In [59]: X = np.array([[2, 3, 5], [2, 3, 6], [2, 3, 8], [2, 3, 3], [2, 3, 4]])

In [60]: smallest(X, 5)
array([[ 1.,  0.,  1.],
       [ 1.,  0.,  4.],
       [ 1.,  3.,  4.],
       [ 2.,  0.,  3.],
       [ 2.,  1.,  2.]])

In [61]: large_X = np.random.randint(100, size=(10000, 2000))

In [62]: large_X
array([[ 8, 78, 97, ..., 23, 93, 90],
       [42,  2, 21, ..., 68, 45, 62],
       [28, 45, 30, ...,  0, 75, 48],
       [26, 88, 78, ...,  0, 88, 43],
       [91, 53, 94, ..., 85, 44, 37],
       [39,  8, 10, ..., 46, 15, 67]])

In [63]: %time smallest(large_X, 5)
Wall time: 1min 32s
array([[ 1676.12529365,  4815.        ,  5863.        ],
       [ 1692.97253374,  1628.        ,  2950.        ],
       [ 1693.558384  ,  5742.        ,  8240.        ],
       [ 1695.86408654,  2140.        ,  6969.        ],
       [ 1696.68853948,  5477.        ,  6641.        ]])

How fast would this be for a matrix like 10000 x 2000?

Also, there can be duplicate values there just can't be any values from a diagonal like index (1,1),(0,0),(n,n). But this seems to only include unique values. I just want the f smallest distances that are not row,col (n,n)

"Notice that np.unique(dst)[:f] yields the smallest f distances from dst sorted in ascending order without any duplicate values." I can't figure out how to efficiently yield the smallest f distances from dat sorted in ascending order. There can be no values but none from row,col (n,n) thought if that makes sense

Just did! I am concerned with this line top_f = np.unique(dst)[:f] I have been trying to find a way to keep these elements not necessarily remove all duplicates because if I have 4 minimum elements and 3 are zeros then I want to keep all 3 indices with zeros and then add the 4th and final element to the list with its value

python - huge matrix sorted and then find smallest elements with their...

python sorting numpy scipy scikit-learn
Rectangle 27 4

Ok i sorted it out. The problem was that i thought jquery was smart enough to think "ok, this buddy has a function that shoots when images are loaded. OFC it will go on even if there're no images inside the content div". Unfortunately it's not like that, if you write an event like

$("#mydiv img").on('load', function(){
alert("images loaded");

the alert will only trigger if there're images inside #mydiv and if the images have been loaded. If #mydiv contains only text, the function won't be triggered either. I solved by adding

if ($("#main_content").find("img").length > 0) {
     $("#main_content img").on('load', function() {

else the normal ajax loading function.

Jquery ajax, wait for images to load before firing function - Stack Ov...

jquery ajax load priority-queue
Rectangle 27 4

At the end I sorted out my problem with this article spring security csrf-protection for rest services, hope it could be useful to other people fighting with spring as me!

java - Cannot get csrf protection in spring boot enabled - Stack Overf...

java spring spring-security spring-boot csrf
Rectangle 27 4

I am on Android Studio 2.0 and facing the same problem. The solution provided by Rudy Kurniawan sorted out this issue. The affected file can be located by:

The "Project" pane is default on the left. To find it, inspect the name of the side tabs, click it, then use the top pull down box to get to "Android". Expand the tree in the pane to find the target file. Double-click it to edit.

I'm on Intellij IDEA with Maven Build.

java - Unsupported major.minor version 52.0 in my app - Stack Overflow

java android maven-plugin
Rectangle 27 2

I've had this problem when installing the mysql gem before, and a quick fix is just to copy the libmysql.dll into your ruby bin folder. I recently got rails running off of a WAMP MySQL server without a problem, so if this doesn't solve it post a more specific error message once you've sorted out the dependency issue and I'll look at my configuration.

Copying libmysql.dll indeed solved the problem. However, I would like to know how to solve this issue "properly", without hacking like this. I would like to understand how Rails knows where MySQL installed, i.e. where does it looks for libmysql.dll ?

I think the proper way to fix it is to update your PATH to include the directory containing libmysql.dll. I don't remember if I tried this before giving up and moving the dll. If you try this and it works, let me know; we actually do this a lot where I work, and it's just an accepted hack.

Problem with Ruby on Rails installation - How to use WAMP MySQL instal...

mysql ruby-on-rails ruby-on-rails-3 windows-xp installation
Rectangle 27 2

OK, I know this question is a few days old but I wasn't sure if you got this issue sorted or not so I had a look. I played around with this for a while now and this is what the problem is and how you could solve it.

The problem you are having is that the special characters causing issues are one of the many (I think 20) special characters, such as % and ".

In your example the problem is the % character. As pointed out by Priyank here:

The route values are posted as part of the URL string.

The Url string (not query string parameter) can't handle %(%25), "(%22) and so on. Further, as pointed out by Lee Gunn in the same post: http://localhost:1423/Home/Testing/23/!%40%23%24%25%3f%26*%201 - (this will blow up)

One of the ways to fix this is to remove {MyString} from the route mapping. To make your root mapping look like this:

    new { controller = "Home", action = "Testing", id = 0, MyString = UrlParameter.Optional }

Now when you set MyString it will be turned into a query string parameter which works perfectly fine. I did try that and it did work.

Priyank also mentioned in the SO post I linked above that you maybe could solve this with a custom ValueProvider but you would have to follow his linked article their to check if that is something that would apply to you.

url - ASP.Net MVC: Passing a string parameter to an action using Redir... url routing redirect url-encoding
Rectangle 27 2

Well, after so many years you would definitely have sorted out this issue but still wanted to answer for all those who are new to this problem:

The datepicker should take the format YYYY-MM-DD as its value. Single digit days and months should be padded with a 0. January is 01. You can simply modify your date format as

@Value = Model.DateCreated.ToString("yyyy-MM-dd")

html - Bind Datetime Model value to datepicker and pass them to contro...

html jquery-ui date datepicker
Rectangle 27 2

Well, after so many years you would definitely have sorted out this issue but still wanted to answer for all those who are new to this problem:

The datepicker should take the format YYYY-MM-DD as its value. Single digit days and months should be padded with a 0. January is 01. You can simply modify your date format as

@Value = Model.DateCreated.ToString("yyyy-MM-dd")

html - Bind Datetime Model value to datepicker and pass them to contro...

html jquery-ui date datepicker
Rectangle 27 1

I seem to have sorted out the problem. The problem is with the Routes.Clear(); I took it out and now everything is working fine. Here is my changes that I did to the code above:

public class RegisterRoutesBootstrapperTask : RegisterRoutesBase
     public RegisterRoutesBootstrapperTask(RouteCollection routes)
          : base(routes)

     protected override void Register()

               new { controller = "Home", action = "Index", id = UrlParameter.Optional }
public class MvcApplication : AutofacMvcApplication
     public MvcApplication()
} - MVC areas not diplaying when registering routes and areas wi... autofac
Rectangle 27 3

Firstly lets look at the difference between Radix Sort and Bucket Sort because that is generally a confusing thing because the idea seems the same. Then we look at Counting Sort which is like a primary version of these two and what problems with counting sort cause the other two to be used

The initial pass of both Radix and Bucket sort are the same.The elements are put in 'Buckets' i.e 0-10, 11-20, ...and so on, depending upon the number of digits in the largest no, i.e the radix. In the next pass, however, bucket sort orders up these 'buckets' and appends them into one array. However, the radix sort method appends the buckets with-out further sorting, and 're-buckets' it based on the second digit (ten's place) of the numbers. Hence, Bucket sort is more efficient for 'Dense' arrays, while Radix Sort can handle sparse arrays well. Well think of bucket sort as this

Suppose you have a list of n records each with a key that's a number from 1 to k (we generalize the problem a little so k is not necessarily equal to n).

We can solve this by making an array of linked lists. We move each input record into the list in the appropriate position of the array then concatenate all the lists together in order.

bucket sort(L)
    list Y[k+1]
    for (i = 0; i <= k; i++) Y[i] = empty
    while L nonempty
        let X = first record in L
        move X to Y[key(X)]
    for (i = 0; i <= k; i++)
    concatenate Y[i] onto end of L

What to do when k is large? Think about the decimal representation of a number x = a + 10 b + 100 c + 1000 d + ... where a,b,c etc all in range 0..9. These digits are easily small enough to do bucket sort.

radix sort(L):
    bucket sort by a
    bucket sort by b
    bucket sort by c
radix sort(L):
while (some key is nonzero)
    bucket sort(keys mod 10)
    keys = keys / 10

Why do we do the sort least important digit first? For that matter, why do we do more than one bucket sort, since the last one is the one that puts everything into place? Answer: If we're trying to sort things by hand we tend to do something different: first do a bucket sort, then recursively sort the values sharing a common first digit. This works, but is less efficient since it splits the problem up into many subproblems. By contrast, radix sorting never splits up the list; it just applies bucket sorting several times to the same list. In radix sorting, the last pass of bucket sorting is the one with the most effect on the overall order. So we want it to be the one using the most important digits. The previous bucket sorting passes are used only to take care of the case in which two items have the same key (mod 10) on the last pass.

Now that we have that out of the way all Counting sort does is it keeps an auxiliary array C with k elements, all initialized to 0.

We make one pass through the input array A and for each element i in A that we see, we increment C[i] by 1. After we iterate through the n elements of A and update C, the value at index j of C corresponds to how many times j appeared in A. This step takes O(n) time to iterate through A. Once we have C, we can construct the sorted version of A by iterating through C and inserting each element j a total of C[j] times into a new list (or A itself). Iterating through C takes O(k) time.The end result is a sorted A and in total it took O(n + k) time to do so.

The downfall of counting sort is that it may not be too practical if the range of elements is too large. For example, if the range of the n elements we need to sort was from 1 to n 3 , then simply creating the auxiliary array C will take O(n^3) time and counting sort will asymptotically do worse than insertion sort. This also takes O(n^3) space which is signicant larger than any of space used by any other sorting algorithm weve learned so far. Radix sort helps solve this problem by sorting the elements digit by digit

algorithm - Radix sort vs Counting sort vs Bucket sort. What's the dif...

algorithm sorting radix-sort bucket-sort counting-sort
Rectangle 27 1

I had exactly the same problem and I found out it was caused by a transitive dependency from org.jmock:jmock-junit4. It was sorted when I replaced it with org.jmock:jmock.

java - NoSuchFieldError when trying to run a jUnit test with Spring - ...

java spring junit spring-test
Rectangle 27 1

You wouldn't believe it. I barely can myself. I sorted it out. I worked it all by myself. After a quick google it would appear nobody ever on the internet has encountered the same problem I had.

It turns out the .htaccess file was formatted with CR linebreaks instead of LF or CRLF. I was using PHPStorm to edit the htaccess file, and PHPStorm prefers CR. The closest I ever had to it working was triggering 500 errors when I'd fill it with a few statements.

Apache.... What are you playing at? Why are you like that? Goddamnit. It's past midnight now, and I've spent all day working on this. I'm exhausted. I feel completely defeated. Just a husk of the man I was this morning. Now my ordeal is finally over I'm off to bed, not before I spend a few delicate moments with myself screaming into a pillow. Good night.

apache - XAMPP .htaccess in subdirectory not working - Stack Overflow

apache .htaccess xampp
Rectangle 27 5

Maybe your problem is not the cookie, but the browser showing a cached version of your admin page. Could that be? If it disappears when you hit F5, it's probably that. This can be sorted by setting the right cache-control headers.

Check out this SO question on the issue of how to set caching. The question is about exactly the other way round (forcing browsers to cache) but you'll figure out what to change to turn caching off.

ok, that makes sense, but why am i still able to access the admin page directly even after i've destroyed the session??

nevermind i think i figured it out - i didn't call session_start() on my logout page (the logout text links to a logout page which calls my above function)

It would still be smart to remove the cookie, in order to increase cacheability of anonymous content with caches such as Varnish. If the browser keeps sending a cookie Varnish will not cache the response, even if you're generating the exact same response for every visitor.

The OP's underlying concept is not flawed. He shows the textbook method of ending a login session as documented in the PHP manual.

(PHP) How to destroy the session cookie correctly? - Stack Overflow

php cookies session
Rectangle 27 1

I have sorted this problem now, I was able to do it without much work really once I found out how config files could be loaded in.

I made sure my config file was named after the assembly loaded via MEF, so if my assembly was:

You would make a config file named:

then you would call:

var config = ConfigurationManager.OpenExeConfiguration("some-custom-plugin.dll");
var someValue = config.AppSettings["some-app-setting"];

So hope this helps someone as it took me a while to find this simple thing out. mvc - ASP MVC & MEF with plugin config files - Stack Overflow web-config connection-string mef
Rectangle 27 1

As all the others my first impression was you are confused if the dictionary is sorted by keys and not by values. But reading your comments this doesn't seem the problem.

So i simply (like the others too) pasted the code into Visual Studio and let it run. The output was (as expected):

String 3
String 4
String 1
String 2

If the order differs on your machine, there seems to be something really weird going on there. Maybe you can make another run, but make a little change to your foreach statement:

foreach (var item in dic)

Now in item you'll get a KeyValuePair<int, string>, which will nicely printed out like this:

[1, String 3]
[70, String 4]
[100, String 1]
[1113, String 2]

So you'll get another check what exact key belongs to each value you got and maybe find another clue why you get a sorting you don't expect.

Hi, I've addded some more information please take a look I think I was over simplfying the explanation

C# SortedDictionary producing unusual results - Stack Overflow

c# sorteddictionary