等差数列の求め方
一般項は
an = a + (n - 1)d
等比数列の求め方
一般項は
an = ar ^ n - 1
flutter create watashi_app
flutter run
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApp3 { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void InputChangedHandler(object sender, RoutedEventArgs e) { Debug.WriteLine("InputChangedHanlder is called."); } } public static class EventHelper { public static readonly DependencyProperty IsEventRaisingProperty = DependencyProperty.RegisterAttached("IsEventRaising", typeof(bool), typeof(EventHelper), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnIsEventRaisingChanged))); public static bool GetIsEventRaising(DependencyObject sender) { return (bool)sender.GetValue(IsEventRaisingProperty); } public static void SetIsEventRaising(DependencyObject sender, bool ier) { sender.SetValue(IsEventRaisingProperty, ier); } public static readonly RoutedEvent InputChangedEvent = EventManager.RegisterRoutedEvent( "InputChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(EventHelper) ); public static void AddInputChangedHandler(DependencyObject sender, RoutedEventHandler handler) { UIElement element = sender as UIElement; if (element != null) { element.AddHandler(InputChangedEvent, handler); } } public static void RemoveInputChangedHandler(DependencyObject sender, RoutedEventHandler handler) { UIElement element = sender as UIElement; if (element != null) { element.RemoveHandler(InputChangedEvent, handler); } } private static void OnIsEventRaisingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { (sender as TextBox).TextChanged += (_s, _e) => { (sender as TextBox).RaiseEvent(new RoutedEventArgs(InputChangedEvent)); }; } } }
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp3" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:Custom="http://infragistics.com/DockManager" x:Class="WpfApp3.MainWindow" mc:Ignorable="d" Title="MainWindow X" Height="350" Width="525"> <Grid> <TextBox local:EventHelper.IsEventRaising="True" local:EventHelper.InputChanged="InputChangedHandler" /> </Grid> </Window>
<Slider x:Name="slider1" HorizontalAlignment="Left" Margin="49,36,0,0" VerticalAlignment="Top" Width="257" /> <TextBox HorizontalAlignment="Left" Height="24" Margin="49,85,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="257" Text="{Binding ElementName=slider1, Path=Value}"/>
<Window x:Class="TriggerDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:TriggerDemo" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Content="button1" Height="30" Width="200"> <Button.Resources> <Style TargetType="Button"> <Style.Triggers> <!--Content が "button1" ならば--> <Trigger Property="Content" Value="button1"> <!--背景色を赤色に変更--> <Setter Property="Background" Value="Red"/> </Trigger> <!--Button 上にマウスがホバーしていたら--> <Trigger Property="IsMouseOver" Value="True"> <!--前景色を白色に変更--> <Setter Property="Foreground" Value="White"/> </Trigger> </Style.Triggers> </Style> </Button.Resources> </Button> </Grid> </Window>
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } public static double GetRecord(DependencyObject obj) { return (double)obj.GetValue(RecordProperty); } public static void SetRecord(DependencyObject obj, double value) { obj.SetValue(RecordProperty, value); } // Using a DependencyProperty as the backing store for Record. This enables animation, styling, binding, etc... public static readonly DependencyProperty RecordProperty = DependencyProperty.RegisterAttached("Record", typeof(double), typeof(MainWindow), new FrameworkPropertyMetadata(0.0) ); private void Button_Click(object sender, RoutedEventArgs e) { var btn = sender as Button; Debug.WriteLine(btn.GetValue(RecordProperty)); } }
<Window x:Class="AttachedPropertyDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:AttachedPropertyDemo" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Content="abc" Height="30" Width="200" local:MainWindow.Record="3.0" Click="Button_Click"/> </Grid> </Window>
<Window x:Class="WpfApp3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp3" mc:Ignorable="d" xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="MainWindow X" Height="350" Width="525"> <Grid> <Grid.Resources> <sys:Int32 x:Key="num1">123</sys:Int32> </Grid.Resources> <TextBox x:Name="textBox1" Height="30" Width="250" Text="abc" ToolTip="{Binding Source={StaticResource num1}}"/> </Grid> </Window>
<Window x:Class="WpfApp3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp3" mc:Ignorable="d" Title="MainWindow X" Height="350" Width="525"> <Grid> <TextBox x:Name="textBox1" Height="30" Width="250" Text="abc" ToolTip="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=Title}"/> </Grid> </Window>
<input type="button" id="apiButton" class="btn" value="Web Api Test" /> <script> function asyncCall() { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if ((xhr.readyState === 4) && (xhr.status === 200)) { var json = xhr.response; console.log(json); } } xhr.open("GET", "/api/values", true); xhr.send(null); } var button1 = document.getElementById("apiButton"); button1.addEventListener("click", asyncCall, false); </script>
public class Item { public int Id { get; set; } public string Name { get; set; } public DateTime RegisteredOn { get; set; } public int CategoryId { get; set; } } public class ValuesController : ApiController { // GET api/values public IEnumerable<Item> Get() { List<Item> items = new List<Item>(); items.Add(new Item { Id = 1, Name = "Toshihiko", CategoryId = 1, RegisteredOn = DateTime.Today }); items.Add(new Item { Id = 2, Name = "Takashi", CategoryId = 1, RegisteredOn = DateTime.Today }); return items; } }
@Component({ selector: 'my-app', template: `<h1>Hello {{name}}</h1>`, })
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule);
{ "name": "angular-quickstart", ... "scripts": { ... "start": "concurrently \"npm run build:watch\" \"npm run serve\"", ... },
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<a [href]="url">go to Yahoo!</a>`,//プロパティバインディング }) export class AppComponent { url = "http://www.yahoo.co.jp"; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<input type="button" [value]="myText" (click)="myClick()"/>`,//イベントハンドリング }) export class AppComponent { myText = "クリック前"; myClick() { this.myText = "クリック後"; } }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<input type="button" [value]="myText" (click)="myClick($event)"/>`,//イベント引数 }) export class AppComponent { myText = "クリック前"; myClick(e: MouseEvent) { this.myText = "クリック後"; console.log(e.target); } }
@Component({ selector: 'my-app', template: `<input #myInput type="text" (input)="log(myInput.value)"/>`,//テンプレート参照変数 }) export class AppComponent { log(myInput: string) { console.log(myInput); } }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <input #myInput type="text" (input)="0"/> <label>「{{myInput.value}}」が入力されました。</label> `, }) export class AppComponent { }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <input #myInput type="text" (keyup.enter)="log($event)"/> `, }) export class AppComponent { log(e: MouseEvent){ var target: HTMLTextAreaElement = <HTMLTextAreaElement>e.target; console.log(target.value); } }
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms';//追加 import { AppComponent } from './app.component'; @NgModule({ imports: [ BrowserModule, FormsModule ],//FormsModule を追加 declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', //template に form 要素を定義し、form 要素内に input 要素を 2 つ定義します。 //どちらかの input 要素の値を変更すると、もう一方の input 要素の値も自動的に変更されます。 //両方の input 要素は共に、ngModel を利用して myValue プロパティの値を双方向バインドしています。 template: ` <form> <input id="myText1" name="myText1" type="text" [(ngModel)]="myValue"/> <input id="myText2" name="myText2" type="text" [(ngModel)]="myValue"/> </form> ` }) export class AppComponent { myValue = "abc"; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <p>{{myText | uppercase}}</p> <p>{{myText | lowercase}}</p> <p>{{myNumber | currency}}</p> <p>{{myNumber | currency: 'JPY': true}}</p> ` }) export class AppComponent { myText = "ABCdef"; myNumber = 198000; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <p>{{items.length | i18nPlural: status}}</p> ` }) export class AppComponent { items = ["a", "b", "c", "d", "e"]; status={ "=0": "None is selected yet.", "=1": "1 item is selected.", "other": "# items are selected", } }
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms';//追加 import { AppComponent } from './app.component'; @NgModule({ imports: [ BrowserModule, FormsModule ],//FormsModule を追加 declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <form> <label for="show">check the box</label> <input id="show" name="show" type="checkbox" [(ngModel)]="isVisible" /> </form> <div *ngIf="isVisible"> text here... </div> ` }) export class AppComponent { isVisible = false; }