Resolve git error: “cannot lock ref”

error: cannot lock ref ‘refs/remotes/origin/branch-A’: is at 0123456789DASfasdf but expected 9999asdfqwerqwer

1. Open FETCH_HEAD and remove all of branches that have ” branch-A” keyword
2. Remove file in folder .git/refs/remotes/origin/branch-A

What are the advantages of manual gearboxes?

Whether you prefer manual or automatic gearboxes will come down to personal preference, but there are some clear advantages to driving a manual.

For a start, they’re generally cheaper to buy and better on fuel than automatics.

There are a number of reasons for this – automatic gearboxes are usually heavier than manuals, and traditional torque-converter auto ’boxes would waste energy building the resistance of hydraulic fluid to transfer drive from the engine to the wheels.

Manual gearboxes are generally better for those who like to feel in control, too.

If you’re planning an overtake, for example, in a manual you can drop down a gear in advance for a quick reaction when you need the acceleration.

In an automatic, there might be slight hesitation when you floor the accelerator.

Today, many automatics come with manual or sport modes for this situation, however.

The same applies in poor conditions such as driving across a muddy field or in the snow.

An automatic gearbox might get confused and select the wrong gear, spinning the wheels or struggling to maintain momentum.

In a manual, you can select a higher gear to increase torque, or slow down using the gears rather than the brakes, helping the driver remain in control.

Khung ảnh ếch và heo

Chuẩn bị những dụng cụ này nhé:
– Vải dạ các màu

– Kéo, kim chỉ

– Bông
Bước 1:

– Cắt vải dạ hồng thành hai miếng đầu, một cái mũi, hai má, hai thân , hai cánh và một mắt cho chú heo.

– Cắt 3 miếng hình vuông (2 rỗng và 1 không rỗng) cùng những hình trang trí khác.

Bước 2:

– Khâu trái tim vào thân heo và khâu má, mắt, mũi cho phần đầu chú heo.

Bước 3:

– Khâu hai miếng thân lại với nhau rồi nhồi bông bông vào.

Bước 4:

– Tương tự, khâu hai miếng đầu lại với nhau rồi nhồi đầy bông vào các bạn nhé!

Bước 5:

– Ráp đầu và thân bé heo lại và đính thêm một cái nơ ở phần cổ.

Bước 6:

– Tiếp theo, mình may chập hai miếng khung hình vuông lại với nhau. May bốn cạnh bên trong và một cạnh bên ngoài.

Bước 7:

– Cuối cùng, các bạn may miếng hình vuông vào mặt sau rồi đính các phần trang trí lên mặt trước. Các bạn chú ý chỉ may 3 cạnh, chừa lại một cạnh để cho hình vào nhé!

Cùng lồng ảnh vào khung và ngắm thành quả thôi!

Các bạn nhớ đính cả dây nối giữa 2 phần khung ảnh để có thể treo lên nhé!


JSF c:forEach vs ui:repeat


This is probably one of the most frequently asked questions on the JSF mailing list. Why doesn’t my c:forEach tag work correctly? Unfortunately, there are may ways to misuse the JSTL tags available in JSF, so the answer isn’t always simple. Here is an explanation of the differences between c:forEach and ui:repeat, along with some examples which will hopefully save you some headaches.

TagHandlers vs Components

The most important thing to understand about the JSTL tags in JSF is that they do not represent components and never become a part of the component tree once the view has been built. Rather, they are tags which are actually responsible for building the tree in the first place. Once they have done their job they expire, are no more, cease to be, etc etc.

Here is a table of the semantics of several common tags. I just discovered, reading the Facelets code, that validators and converters are classified separately. I had always thought they were just tag handlers, but I imagine they behave in much the same way.

any custom tag file
any custom UIComponent

One of the problems here is that there is no naming convention to indicate which tags correspond to which constructs. You’ve just got to know, or find out.

When is the view built?

Now that you understand that tag handlers are only effective when the tree is built, the next logical question should be well, when is tree built?

The short answer is that a new view is built for every request which is not a postback. During a postback, the view is reconstructed from saved state. Quite confusing, and not very obvious I know, but there you have it.

Common laments

The most common pitfalls are either with the JSF lifecycle, EL evaluation or combining tag handlers with components.

My c:if always evaluates to false

<h:dataTable values="${numbers}" var="number">
    <c:if test="${number > 5}">
      <h:outputText value="${number}"/>

Yes, the c:if is always evaluating to false! But it is only ever evaluated once – when the tree is built. The h:outputText component never makes it into the tree. Solution: replace the c:if with:

<ui:fragment rendered="${number > 5}"> ... </ui:fragment>

You could also use the rendered attribute on the h:outputText component in this example.

My ui:include fails inside ui:repeat

<ui:repeat value="#{bean.items}" var="item">
   <ui:include src="#{item.src}"/>

The EL for the ui:include is evaluated when the view is built and is invalid since it relies on a variable only made available by the ui:repeat during rendering. Use c:forEach in this case.

My recursive tag never stops

  <ui:repeat value="${item.children} var="child">
    <li><eg:myTag item="${child}"/></li>

The stop condition in this recursion is supposed to be when you run out of children. The problem is that the custom eg:myTag is just a tag handler, like a special version of ui:include. When the view is built, the ui:repeat has no influence on the building process and can’t stop the recursion. Use c:forEach here instead of ui:repeat. Or better still, convert your tag file to a real UIComponent.

You might also recognise that the ${child} EL expression is meaningless during build time in this example, unless you use c:foreach.

My list doesn’t change size after deleting or adding an item

  <c:forEach items="${list}" var="item">
    <h:outputText value="${}"/><br/>
  <h:commandButton value="Create new item" action="..."/>
  <h:commandButton value="Delete an item" action="..."/>

When your view was built you only had, say, 5 items. If you post back to this view and add or delete an item, your view still has 5 h:outputText components in it since it was restored from saved state. In this simple case, you should use ui:repeat and your tree will always contain one h:ouputText component which is iterated over with differing values of ${item}.

If you rely on using c:forEach to dynamically include different form components you could run into difficulty. Always try to think about what the resulting tree looks like and remember it doesn’t change on a postback.

Suggestions for the future

Probably the best relief to this problem would be to come up with a better syntax or naming convention to distinguish between tag handlers and components. I imagine you could also improve compilation performance if you did this.

Secondly, we need better terminology. I’ve used the terms tag handler and component in this blog which isn’t too bad. The Facelets’ FAQ [1] uses the terms build-time tags and render-time tags which is a bit misleading because render-time tags (components) are involved in all phases of the JSF lifecycle, not just the Render View phase.

Whatever happens, tag handlers are very useful (would you use facelets without ui:decorate?) so let’s not get rid of them.