Search Results

Search found 4 results on 1 pages for 'mihail stoynov'.

Page 1/1 | 1 

  • Is it possible to share Skype's profile across OSs?

    - by Mihail
    in my machine I have two Windows OSs plus a Linux based one and I have Skype in them all. I don't mind Linux because there software is already different, but I wanted to sync my profile between both Windows so that I have access to all the conversiations and settings independently of which I'm using. So I created a directory junction of %AppData%\Skype\username but when I change OS when I start Skype I get a message telling me that the password was wrong and I have to input it again. This works until I change to the other where I get the same message. Is it possible to share Skype's profile across OSs? If so, how?

    Read the article

  • Mocking successive calls of similar type via sequential mocking

    - by mehfuzh
    In this post , i show how you can benefit from  sequential mocking feature[In JustMock] for setting up expectations with successive calls of same type.  To start let’s first consider the following dummy database and entity class. public class Person {     public virtual string Name { get; set; }     public virtual int Age { get; set; } }   public interface IDataBase {     T Get<T>(); } Now, our test goal is to return different entity for successive calls on IDataBase.Get<T>(). By default, the behavior in JustMock is override , which is similar to other popular mocking tools. By override it means that the tool will consider always the latest user setup. Therefore, the first example will return the latest entity every-time and will fail in line #12: Person person1 = new Person { Age = 30, Name = "Kosev" }; Person person2 = new Person { Age = 80, Name = "Mihail" };   var database = Mock.Create<IDataBase>();   Queue<Person> queue = new Queue<Person>();   Mock.Arrange(() => database.Get<Person>()).Returns(() => queue.Dequeue()); Mock.Arrange(() => database.Get<Person>()).Returns(person2);   // this will fail Assert.Equal(person1.GetHashCode(), database.Get<Person>().GetHashCode());   Assert.Equal(person2.GetHashCode(), database.Get<Person>().GetHashCode()); We can solve it the following way using a Queue and that removes the item from bottom on each call: Person person1 = new Person { Age = 30, Name = "Kosev" }; Person person2 = new Person { Age = 80, Name = "Mihail" };   var database = Mock.Create<IDataBase>();   Queue<Person> queue = new Queue<Person>();   queue.Enqueue(person1); queue.Enqueue(person2);   Mock.Arrange(() => database.Get<Person>()).Returns(queue.Dequeue());   Assert.Equal(person1.GetHashCode(), database.Get<Person>().GetHashCode()); Assert.Equal(person2.GetHashCode(), database.Get<Person>().GetHashCode()); This will ensure that right entity is returned but this is not an elegant solution. So, in JustMock we introduced a  new option that lets you set up your expectations sequentially. Like: Person person1 = new Person { Age = 30, Name = "Kosev" }; Person person2 = new Person { Age = 80, Name = "Mihail" };   var database = Mock.Create<IDataBase>();   Mock.Arrange(() => database.Get<Person>()).Returns(person1).InSequence(); Mock.Arrange(() => database.Get<Person>()).Returns(person2).InSequence();   Assert.Equal(person1.GetHashCode(), database.Get<Person>().GetHashCode()); Assert.Equal(person2.GetHashCode(), database.Get<Person>().GetHashCode()); The  “InSequence” modifier will tell the mocking tool to return the expected result as in the order it is specified by user. The solution though pretty simple and but neat(to me) and way too simpler than using a collection to solve this type of cases. Hope that helps P.S. The example shown in my blog is using interface don’t require a profiler  and you can even use a notepad and build it referencing Telerik.JustMock.dll, run it with GUI tools and it will work. But this feature also applies to concrete methods that includes JM profiler and can be implemented for more complex scenarios.

    Read the article

  • Refactor a link and an image

    - by Mihail Stoynov
    I have to write an link with an image inside. Instead of explaining, here's the code I have now: <c:if test="${userSession.loggedUser eq null and company.image != null}"> <a onclick="${rich:component('loginPanel')}.show()"> <img src="/download.do?hash=#{company.image.hash}" /> </a> </c:if> <c:if test="${userSession.loggedUser eq null and company.image == null}"> <a onclick="${rich:component('loginPanel')}.show()"> <img src="${request.contextPath}/img/icons/logo_default.jpg" /> </a> </c:if> <c:if test="${userSession.loggedUser ne null and company.image != null}"> <a href="company.xhtml?${company.name}"> <img src="/download.do?hash=#{company.image.hash}" /> </a> </c:if> <c:if test="#{userSession.loggedUser ne null and company.image == null}"> <a href="company.xhtml?${company.name}"> <img src="${request.contextPath}/img/icons/logo_default.jpg" /> </a> </c:if> This code looks awful - there are two exact links with two exact images but combined in all possible combinations. Is there a better way? Is there a way to avoid c:if - it created tables? Update: Bozho proposes: You can replace <c:if and <a with <h:outputLink rendered="#{..}". Apart from that I don't see any other optimization. But it doesn't work. This does not render correctly: <a href=> <h:outputLink rendered="#{..} <h:outputLink rendered="#{..} </a> (the image is outside the anchor) This does render fine: <h:outputLink value=> <h:outputLink rendered="#{..} <h:outputLink rendered="#{..} </a> , but it always adds href and in two of the cases I don't want href when rendered.

    Read the article

  • Java regex skipping matches

    - by Mihail Burduja
    I have some text; I want to extract pairs of words that are not separated by punctuation. Thi is the code: //n-grams Pattern p = Pattern.compile("[a-z]+"); if (n == 2) { p = Pattern.compile("[a-z]+ [a-z]+"); } if (n == 3) { p = Pattern.compile("[a-z]+ [a-z]+ [a-z]+"); } Matcher m = p.matcher(text.toLowerCase()); ArrayList<String> result = new ArrayList<String>(); while (m.find()) { String temporary = m.group(); System.out.println(temporary); result.add(temporary); } The problem is that it skips some matches. For example "My name is James", for n = 3, must match "my name is" and "name is james", but instead it matches just the first. Is there a way to solve this?

    Read the article

1