Karabiner help key remapping - keyboard

I broke my "j" button on my macbook pro, any idea how I can replace the j with right-command + "k"?
I tried a couple of different things but could not get it to work.
I would appreciate any help.
Thank you!

In your private.xml, something like this should work:
<?xml version="1.0"?>
<root>
<item>
<name>New J</name>
<identifier>private.new_j_key</identifier>
<autogen>__KeyToKey__ KeyCode::K, ModifierFlag::COMMAND_R, KeyCode::J</autogen>
</item>
</root>

Related

Shape with an alternated bi-color border in android studio

I would like to create a shape to use as a background for an element, since the app has red and orange as main colors I would like to make a cool border, however I have only managed to find how to put a single color and don't really know how to do a sort of a design.
I would like to do something like this (I made this quickly in paint just a demonstration of my idea):
Shape with cool alternated border
Ok I worked on it a bit and came to a solution that isn't exactly what I was trying to do but it will be good enough I guess. This is the code to put in the xml file in the drawable folder:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle"
android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
<stroke
android:width="10dp"
android:color="#color/colorAccent"/>
</shape>
</item>
<item>
<shape
android:shape="rectangle"
android:padding="10dp">
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
<stroke
android:width="8dp"
android:color="#color/colorPrimary"
android:dashGap="10dp"
android:dashWidth="8dp" />
</shape>
</item>
</layer-list>
this code will produce this result:
shape with bicolor border
Hope this helps anybody

Repeating node multiple times based on the input structure

I have one requirement, I am new to XSLT language so I am looking for your help for my below requirement.
Below is the input xml payload
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:sendfile xmlns:ns0="namepsace here">
<Delivery>
<IssueDateTime>2016-05-24T09:25:19z</IssueDateTime>
<Item>
<order>
<orderChar>
<orderName />
<orderVal />
</orderChar>
<orderInfo>
<Product />
<Batch />
<Qty />
<UOM />
</orderInfo>
</order>
</Item>
</Delivery>
so in the file orderchar node and orderInfo node will repeat multiple times based on that in receiver structure 2 nodes should repeat. for example
orderchar segment is repeating 20 times, in receiver also E1ADRM segment should repeat same number of times.
order info also same case in receiver E1DRM segment should repeat same number of times.In case any of the node will not come in receiver also the segment should not populate.
I think we can do this some value of select with that syntax. could you please help me on this.
I tried with below code and able to generate the node. but when repeated nodes are coming the repeated receiver nodes are not populating.
<ns0:if test="count(./order/orderChar)!=0">
<E1EDL12 SEGMENT="1">
<ATNAM>
<ns0:value-of select="./orderChar/orderName"/>
</ATNAM>
<ATWRT>
<ns0:value-of select="./orderChar/orderName"/>
</ATWRT>
</E1EDL12>
above code tried for only for one segment.could you please suggest what modification I have to do to populate multiple times.
Regards,
Janardhan
You really haven't made your requirement very clear, but my guess would be that you want something like:
<xsl:for-each select="orderChar">
<ATNAM>
<xsl:value-of select="orderName"/>
</ATNAM>
<ATWRT>
<xsl:value-of select="./orderChar/orderName"/>
</ATWRT>
</xsl:for-each>

Icon of the menu item not appearing

I hope to find answer of this question and any help will be appreciated,
when i use blank\empty activity the icon of the menu item doesn't appear !
but using basic activity it works fine .
thanks in advance .
this is the menu xmlcode
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/one"
android:icon="#drawable/images"
android:showAsAction="always"
android:title="one"
/>
its works as i said for basic Activity but its not for empty\blank Activity
for the appearance of the menu icon
xmlns:app="http://schemas.android.com/apk/res-auto" put this in menu before your item tag and use 'app:' instead of 'android:' at "showAsAction" LIKE
use this:
app:showAsAction="always"
instead of
android:showAsAction="always"

How can I programmatically create a shape in Android

I have following myRec.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<corners android:radius="1dp"
android:bottomRightRadius="0dp"
android:bottomLeftRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="0dp"/>
<stroke
android:color="#color/my_button_border"
android:width="1dp" />
<solid android:color="#android:color/transparent" />
</shape>
</item>
</selector>
.... and would like to create the same shape programmatically so that I can freely change color in runtime. How can I achieve it? Much thanks in advance
Take a look at the android.graphics.drawable.ShapeDrawable class and the Shape class subclasses, suchs as:
PathShape
RectShape
ArcShape
OvalShape
RoundRectShape
ShapeDrawable receives a shape in the constructor, and then you have a lot of function to modify the shape. Also, you can retrieve the Paint asociated to the ShapeDrawable so you can alter things like the color and so.
Also, take a look at this small example:
http://www.edumobile.org/android/android-tutorial/shape-drawing-example-in-android/
where you can see some diferent shapes, and some efects suchs as the CornerPathEffect,
Use shapedrawable, gradientdrawable with
http://developer.android.com/reference/android/graphics/CornerPathEffect.html

Layout like Cards in android

I want to make an android layout like Google Cards,i know there is an Open Source Libraries, however i want only the Layout and the gray hex background style. I could not find information about this, how i can make this possible? im Attaching new Google maps v7 Layout so you can get the idea.
bg_card.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#CCC" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="#FFF" />
</shape>
</item>
</layer-list>
Or just set the background of the card to #FFF and add at the bottom:
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#CCC" />
NOTE:
For everyone who doesn't care about using a library, you should use
a CardView from the Android support library.
Sample code.
<item name="android:windowBackground">#ffe3e3e3</item>
In your style.xml should make you happy ;-)
And for the layout, copying the card background should be enough isn't it?
We can use the LayerList as above to achieve this (OR) by using the nine patch image get same effect, we need not create nine patch image separately for this puprpose android drawable have one.
if you are using eclipse: android:background="#drawable/abc_menu_dropdown_panel_holo_light"
copy paste the above line as your View backround.
or if you are using android studio copy paste the following line:
android:background="#android:drawable/dialog_holo_light_frame"

Resources