Skip to content

Instantly share code, notes, and snippets.

View npatta01's full-sized avatar
💭
Coding Some Deep Learning Projects

Nidhin Pattaniyil npatta01

💭
Coding Some Deep Learning Projects
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using SQLite;
@npatta01
npatta01 / JavaFxApplication.java
Created April 23, 2013 07:03
Default Application class created from JavaFX FXML template project
public class JavaFXApplication extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
@npatta01
npatta01 / Sample.fxml
Created April 23, 2013 07:07
Sample.fxml before binding
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication3.SampleController">
<children>
@npatta01
npatta01 / SampleController.java
Created April 23, 2013 07:25
SampleController: referencing gui components in te controller
......
public class SampleController implements Initializable {
@FXML
private Label label;
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
@npatta01
npatta01 / SampleController.java
Created April 23, 2013 07:27
Sample Controller.java with string property
public class SampleController implements Initializable {
// Define the property
private StringProperty counter = new SimpleStringProperty();
// Define a getter for the property's value
public final String getCounter(){return counter.get();}
// Define a setter for the property's value
public final void setCounter(String value){counter.set(value);}
@npatta01
npatta01 / Sample.xml
Created April 23, 2013 07:55
Sample.fxml with binding in view
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication.SampleController">
<children>
<phone:PhoneApplicationPage
x:Class="KhanAcademyWp8.Views.VideoDetailPage"
.....
shell:SystemTray.IsVisible="True" DataContext="{Binding Video, Mode=OneWay, Source={StaticResource Locator}}">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
public class ViewModelLocator
{
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
....
if (ViewModelBase.IsInDesignModeStatic)//if in desing time
{
SimpleIoc.Default.Register<IKhanAcademyService, DesignKhanAcademyService>();
}else{
@npatta01
npatta01 / App.xml
Last active December 16, 2015 20:39
<?xml version="1.0" encoding="utf-8"?>
<Application x:Class="KhanAcademyWp8.App"
.....
xmlns:viewModel2="clr-namespace:KhanAcademyWp8.ViewModel"
mc:Ignorable="d" >
<Application.Resources>
<viewModel2:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
...
</Application.Resources>
public class VideoViewModel : ViewModelBase
{
public RelayCommand Navigate { get; private set; }
public string DownloadUrl
{
get { return _video.DownloadUrl; }
}
public string Title
{