Internet & Technology

Selectedchoice(selected_value) example

So in my TYPE class to define the form, I have :

class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('customType', ChoiceType::class, array(
'label'=>'custom type',
'choices' => array(
'choice 1' => 'choice 1',
'choice 2' => 'choice 2',
),
'multiple' => false,
));

//.I looked at selectedchoice(selected_value).

counting frequency of letters in text using matlab

suppose we have following text

s='i love georgia and its nature';


what i want is to count frequency of occurrence of each letter(space are not included of course) and sketch some chart(for example bar chart), first i have created code which counts letters using map container

function character_count(s)
% s is given string and given program will count occurence of letters in
% sentence
MAP=containers.S = lower(strrep(s, ' ', ''));
[values, ~, b] = unique(S, 'stable');

hist(b, unique(b))
set(gca, 'xtick', 1:numel(values), 'xticklabels', num2cell(values))


Or if you want a histogram of all letters

S = lower(strrep(s, ' ', ''));
counts = histcounts(double(S), double('a':'z'));
bar(counts)
set(gca, 'xtick', 1:26, 'xticklabels', num2cell('a':'z'))


How about this as a simpler method?

Storing MySQL password as hash

I know this has been asked many times before, but I can't find the answer I am looking for:

I have a C# application that connects to a MySQL database, currently the username, password and database name are stored in plain text in a.Is it possible to store the database's password as a hash in the config and pass that instead of the a plain string?

emu8086- program adding two number and the output will shown

If you type in the keyboard 3 it will be 3 + and type another number 3 it will be 3 =
3+3=6
I'm new in this subject and it very hard for me to understand this please help me and thank you in advance


Int 21h /0ah
Data -> AL
1st register
2nd register Al

Add 1st register, 2nd register
Register
Al
Print

mov ah, 09h
mov dx, enterfnstr
int 21h
mov ah, 01h
int 21h
mov bl, al
sub bl, 30h
mov ah, 09h
mov dx, entersnstr
int 21h
mov ah,01h
int 21h
sub al, 30h
add al, bl
aaa
dec ah
mov bh, ah
add bh, 30h
add al, 30h
mov bl, al
mov ah, 09h
mov dx, sum
int 21h
mov ah, 02h
mov dl, bh
int 21h
mov ah, 02h
mov dl, bl
int 21h
mov ah, 0
int 16h


; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt

org 100h

mov ah,1h ;read the character ,input stored in al
int 21h

len equ 32
mov bl,al ;bl stores first input

mov al,'+' ;print the character
mov ah,0eh
int 10h

mov ah,1h ;read the character ,input stored in al
int 21h

mov cl,al ;cl another reg

mov dl,bl ;moving the value of bl to dl
mov ah,2h

mov dl,cl ;moving the value of cl to dl
mov ah,2h

mov al,'=' ;print the character
mov ah,0eh
int 10h

sub bl,30h ;converted first to decimal
sub cl,30h

add bl,cl

add bl,30h

mov dl,bl ;print the character
mov ah,2h
int 21h


ret

Android how to add an expandable listView for navigation drawer item?

I have a navigation drawer with items & sub items
where drawer items layout like this

<item android:title="items"
android:icon="@drawable/items"
>
<menu>
<item
android:id="@+id/addItem"
android:title="items collection one" />
<item
android:id="@+id/editItem"
android:title="items collection two" />
<item
android:id="@+id/viewItem"
android:title="items collection three />
</menu>
</item>


I have more than one like previous one
I need the children items to have expandable listView appearing when onClick event
I found tutorials on adding expandable listView to navigation drawer but I need to to add it not to the drawer itself but to the items of drawer like this question
here

Use custom layout for your Drawer , which contain RecyclerView.Expandable list is created by using appropriate adapter for RecyclerView

OpenIddict with Angular2-jwt

IqDnWJJKRtAh0BWKcdQgg_Gm_rnarffdnq5ksqpm0m6BnslI0EZ-7CugSG0223k6_FwuU7iSCiI2Cu7O2uaUedDEOdoIwyxpaEyr6yjzT5pxw7hbMnNxmxAydEajqE3OI-C55vzK0nhv9ToS93dz_QF8MIQ5EMIJ1cGXXO9wqQQ0xLvX7o2wIlM3rYvh_OORdALBxl5byMsrtc3ZrVj-BEiYuuwrUwSU5oPlH28o_Oo030s9NGqaQNea5T3PNQAL8-qC6aIdcDLBwOYZevTGGLMxde9czk_Duc0mkp5KtsyVZ-oV3qTh-EdZxpPjttu5_5Bh-8YCDLP5AzOsyX5sbg"
expiration_date:"1485784700807"
expires_in:1800
id_token:"eyJhbGciOiJSUzI1NiIsImtpZCI6IlJHRUVHM0FCSUJNVllHTEdQSjFSNjNRRkdHQlVKRUlHLU9ITy1QREgiLCJ0eXAiOiJKV1QifQ.AddScoped<UserManager<AppUser>, AppUserManager>();
services.

Comparing 2 columns in mysql [closed]

im having 2 tables with bellow data (Not match data can be in amount1 or amount2)

date ID amount1 amount2
11-2-16 2 2 0
11-2-16 1 5 11
11-2-16 3 0 9
12-2-16 2 4 0
12-2-16 1 4 0


Table 2

Bdate BID Bamount1 Bamount2
11-2-16 1 5 11
11-2-16 2 1 0
11-2-16 3 0 6
12-2-16 1 4 0
12-2-16 2 1 0


what i need is to show the data which is not match in both table like below

Date id Amoun1 Bamount1 Amount2 Bamount
11-2-16 2 2 1
11-2-16 3 9 6
12-2-16 2 4 1


Appreciate your help

Create table/insert data

CREATE TABLE Table1
(`date` VARCHAR(7), `ID` INT, `amount1` INT, `amount2` INT)
;

INSERT INTO Table1
(`date`, `ID`, `amount1`, `amount2`)
VALUES
('11-2-16', 2, 2, 0),
('11-2-16', 1, 5, 11),
('11-2-16', 3, 0, 9),
('12-2-16', 2, 4, 0),
('12-2-16', 1, 4, 0)
;


CREATE TABLE Table2
(`Bdate` VARCHAR(7), `BID` INT, `Bamount1` INT, `Bamount2` INT)
;

INSERT INTO Table2
(`Bdate`, `BID`, `Bamount1`, `Bamount2`)
VALUES
('11-2-16', 1, 5, 11),
('11-2-16', 2, 1, 0),
('11-2-16', 3, 0, 6),
('12-2-16', 1, 4, 0),
('12-2-16', 2, 1, 0)
;


Query

Join on date and id and use where to filter out where the fields don't match.date AS "Date"
, Table1.