text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using FluentAssertions.Common;
using FluentAssertions.Execution;

namespace FluentAssertions.Equivalency
{
    /// <remarks>
    /// I think (but did not try) this would have been easier using 'dynamic' but that is
    /// precluded by some of the PCL targets.
    /// </remarks>
    public class GenericDictionaryEquivalencyStep : IEquivalencyStep
    {
        public bool CanHandle(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config)
        {
            Type subjectType = config.GetSubjectType(context);

            return ((context.Subject != null) && GetIDictionaryInterfaces(subjectType).Any());
        }

        private static Type[] GetIDictionaryInterfaces(Type type)
        {
            return Common.TypeExtensions.GetClosedGenericInterfaces(
                type,
                typeof(IDictionary<,>));
        }

        public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent, IEquivalencyAssertionOptions config)
        {
            if (PreconditionsAreMet(context, config))
            {
                AssertDictionaryEquivalence(context, parent, config);
            }

            return true;
        }

        private static bool PreconditionsAreMet(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config)
        {
            Type subjectType = config.GetSubjectType(context);

            return (AssertImplementsOnlyOneDictionaryInterface(context.Subject)
                    && AssertIsCompatiblyTypedDictionary(subjectType, context.Expectation)
                    && AssertSameLength(context.Subject, subjectType, context.Expectation));
        }

        private static bool AssertImplementsOnlyOneDictionaryInterface(object subject)
        {
            Type[] interfaces = GetIDictionaryInterfaces(subject.GetType());
            bool multipleInterfaces = (interfaces.Count() > 1);

            if (multipleInterfaces)
            {
                AssertionScope.Current.FailWith(
                    string.Format(
                        "{{context:Subject}} implements multiple dictionary types.  "
                        + "It is not known which type should be use for equivalence.{0}"
                        + "The following IDictionary interfaces are implemented: {1}",
                        Environment.NewLine,
                        String.Join(", ", (IEnumerable<Type>)interfaces)));
                return false;
            }

            return true;
        }

        private static bool AssertIsCompatiblyTypedDictionary(Type subjectType, object expectation)
        {
            Type subjectDictionaryType = GetIDictionaryInterface(subjectType);
            Type subjectKeyType = GetDictionaryKeyType(subjectDictionaryType);

            Type[] expectationDictionaryInterfaces = GetIDictionaryInterfaces(expectation.GetType());

            if (!expectationDictionaryInterfaces.Any())
            {
                AssertionScope.Current.FailWith(
                    "{context:subject} is a dictionary and cannot be compared with a non-dictionary type.");
                return false;
            }

            Type[] suitableDictionaryInterfaces = expectationDictionaryInterfaces.Where(
                @interface => GetDictionaryKeyType(@interface).IsAssignableFrom(subjectKeyType)).ToArray();

            if (suitableDictionaryInterfaces.Count() > 1)
            {
                // Code could be written to handle this better, but is it really worth the effort?
                AssertionScope.Current.FailWith(
                    "The expected object implements multiple IDictionary interfaces.  "
                    + "If you need to use ShouldBeEquivalentTo in this case please file "
                    + "a bug with the FluentAssertions devlopment team");
                return false;
            }

            if (!suitableDictionaryInterfaces.Any())
            {
                AssertionScope.Current.FailWith(
                    string.Format(
                        "The {{context:subject}} dictionary has keys of type {0}; "
                        + "however, the expected dictionary is not keyed with any compatible types.{1}"
                        + "The expected dictionary implements: {2}",
                        subjectKeyType,
                        Environment.NewLine,
                        string.Join(",", (IEnumerable<Type>)expectationDictionaryInterfaces)));
                return false;
            }

            return true;
        }

        private static Type GetDictionaryKeyType(Type subjectType)
        {
            return subjectType.GetGenericArguments()[0];
        }

        private static bool AssertSameLength(object subject, Type subjectType, object expectation)
        {
            string methodName =
                ExpressionExtensions.GetMethodName(() => AssertSameLength<object, object, object, object>(null, null));

            MethodCallExpression assertSameLength = Expression.Call(
                typeof(GenericDictionaryEquivalencyStep),
                methodName,
                GetDictionaryTypeArguments(subjectType)
                    .Concat(GetDictionaryTypeArguments(expectation.GetType()))
                    .ToArray(),
                Expression.Constant(subject, GetIDictionaryInterface(subjectType)),
                Expression.Constant(expectation, GetIDictionaryInterface(expectation.GetType())));

            return (bool)Expression.Lambda(assertSameLength).Compile().DynamicInvoke();
        }

        private static IEnumerable<Type> GetDictionaryTypeArguments(Type subjectType)
        {
            var dictionaryType = GetIDictionaryInterface(subjectType);

            return dictionaryType.GetGenericArguments();
        }

        private static Type GetIDictionaryInterface(Type subjectType)
        {
            return GetIDictionaryInterfaces(subjectType).Single();
        }

        private static bool AssertSameLength<TSubjectKey, TSubjectValue, TExpectKey, TExpectedValue>(
            IDictionary<TSubjectKey, TSubjectValue> subject,
            IDictionary<TExpectKey, TExpectedValue> expectation)
        {
            return
                AssertionScope.Current.ForCondition(subject.Count == expectation.Count)
                    .FailWith(
                        "Expected {context:subject} to be a dictionary with {0} item(s), but found {1} item(s).",
                        expectation.Count,
                        subject.Count);
        }

        private static void AssertDictionaryEquivalence(
            IEquivalencyValidationContext context,
            IEquivalencyValidator parent,
            IEquivalencyAssertionOptions config)
        {
            Type subjectType = config.GetSubjectType(context);

            string methodName =
                ExpressionExtensions.GetMethodName(
                    () => AssertDictionaryEquivalence<object, object, object, object>(null, null, null, null, null));

            var assertDictionaryEquivalence = Expression.Call(
                typeof(GenericDictionaryEquivalencyStep),
                methodName,
                GetDictionaryTypeArguments(subjectType)
                    .Concat(GetDictionaryTypeArguments(context.Expectation.GetType()))
                    .ToArray(),
                Expression.Constant(context),
                Expression.Constant(parent),
                Expression.Constant(config),
                Expression.Constant(context.Subject, GetIDictionaryInterface(subjectType)),
                Expression.Constant(context.Expectation, GetIDictionaryInterface(context.Expectation.GetType())));

            Expression.Lambda(assertDictionaryEquivalence).Compile().DynamicInvoke();
        }

        private static void AssertDictionaryEquivalence<TSubjectKey, TSubjectValue, TExpectKey, TExpectedValue>(
            EquivalencyValidationContext context,
            IEquivalencyValidator parent,
            IEquivalencyAssertionOptions config,
            IDictionary<TSubjectKey, TSubjectValue> subject,
            IDictionary<TExpectKey, TExpectedValue> expectation) where TSubjectKey : TExpectKey
        {
            foreach (TSubjectKey key in subject.Keys)
            {
                TExpectedValue expectedValue;

                if (expectation.TryGetValue(key, out expectedValue))
                {
                    if (config.IsRecursive)
                    {
                        parent.AssertEqualityUsing(context.CreateForDictionaryItem(key, subject[key], expectation[key]));

                    }
                    else
                    {
                        subject[key].Should().Be(expectation[key], context.Because, context.BecauseArgs);
                    }
                }
                else
                {
                    AssertionScope.Current.FailWith("{context:subject} contains unexpected key {0}", key);
                }
            }
        }
    }
}


text:
\documentclass[11pt,a4paper,landscape]{article}
\usepackage{titling,graphicx,palatino,amsmath,enumerate,booktabs,listings,color}
\usepackage[none]{hyphenat}
\usepackage[parfill]{parskip}
\usepackage{pgfplots}
\usepackage{longtable}
\usepackage[top=2 cm, bottom= 2 cm, left=1 cm, right=1 cm]{geometry}
\usepackage{enumitem}
\begin{document}

\section*{Sprint reflection Plan 3}
Context : Multimedia services\\
Group : Multimedia services 1\\

\begin{table}[h]
\begin{tabular}{|p{3cm}|p{5.0cm}|p{3.0cm}|p{2.2cm}|p{2.2cm}|p{2.0cm}|p{5cm}}
\textbf{User Story} & \textbf{Task} & \textbf{Task assigned to} & \textbf{Estimated Effort per Task (Hours)} & \textbf{Actual Effort per Task (Hours)} & \textbf{Done} & \textbf{Notes}\\
As a team member, I want to improve our documentation based on the feedback of our stakeholders.

&
\begin{enumerate}
\item Process feedback Product Planning.
\item Add proper Glossary for Product Planning.
\item Review changes to Product Planning.
\item Review changes to Emergent Architecture Design.
\end{enumerate}

&
\begin{enumerate}
\item Eva Anker
\item Gijs Weterings
\item Jaap Heijligers
\item Jaap Heijligers
\end{enumerate}

&
\begin{enumerate}
\item 6 hours
\item 2 hours
\item 2 hours
\item 2 hours
\end{enumerate}

&
\begin{enumerate}
\item 6 hours
\item 2 hours
\item 2 hours
\item 2 hours
\end{enumerate}
&
\begin{enumerate}
\item Yes
\item Yes
\item Yes
\item Yes
\end{enumerate}
&
\begin{enumerate}
\item
\item
\item
\item JW was in charge of the changes. This has been an oversight in the product planning.
\end{enumerate}
\\
\end{tabular}
\end{table}
\begin{table}[h]
\begin{tabular}{|p{3cm}|p{5.0cm}|p{3.0cm}|p{2.2cm}|p{2.2cm}|p{2.0cm}|p{5cm}}
As a Scrum Master, I want my team to have a clear vision of the architecture of the system we will be building this sprint.
&
\begin{enumerate}
\item Brainstorm about best architecture
\item Prototype architectures
\end{enumerate}

&
\begin{enumerate}
\item Gijs Weterings
\item Tim van der Lippe
\end{enumerate}

&

\begin{enumerate}
\item 4 hours
\item 4 hours
\end{enumerate}
&
\begin{enumerate}
\item 26 hours
\item 0 hours
\end{enumerate}
&
\begin{enumerate}
\item Yes
\item No

\end{enumerate}
&
\begin{enumerate}
\item This issue has taken up a lot of time.
This is partly due to the fact we only guessed 4 hours, this should have been 4 hours per person.
Also, we took the time because we have made some pretty big changes to our future planning.
We had a meeting with Cynthia on Tuesday, to strategize our planning.
We will deviate from the neural network we planned, because getting enough training data would be a master thesis size project, according to Cynthia.
We agreed on dropping the neural network, and develop a different mechanism to automatically update initial values.
Most of the training will be delegated to users, possibly in a gamification manner.
\item Due to the big changes in the issue above, we opted to delay the prototyping to a point where we have a better strategy.
\end{enumerate}
\end{tabular}
\end{table}
\begin{table}[h]
\begin{tabular}{|p{3cm}|p{5.0cm}|p{3.0cm}|p{2.2cm}|p{2.2cm}|p{2.0cm}|p{5cm}}
As a developer I want my frontend to have a more interactive communication with the backend.
&
\begin{enumerate}
\item Get a clear definition of the responses for the API calls.
\item Make a call to the API to get a list of rooms based on selected mood.
\item Make a call to the API to retrieve new messages and insert them in the chatbox.
\end{enumerate}

&

\begin{enumerate}
\item Jaap Heijligers
\item Gijs Weterings
\item Eva Anker
\end{enumerate}

&
\begin{enumerate}
\item 6 hours
\item 2 hours
\item 2 hours
\end{enumerate}
&
\begin{enumerate}
\item 10 hours
\item 2 hours
\item 2 hours
\end{enumerate}
&
\begin{enumerate}
\item Yes
\item Yes
\item Yes
\end{enumerate}
&
\begin{enumerate}
\item We opted to use the time we had left to get a clear view of the API work. We held this conversation with 4 of us, which is why we have extra time here.
\item
\item
\end{enumerate}
\end{tabular}
\end{table}

\end{document}

redpajama_set_name: RedPajamaGithub


text:
package com.nec.strudel.workload.job;

import java.util.Random;

import com.nec.congenio.ConfigValue;
import com.nec.strudel.workload.util.TimeValue;

public interface WorkItem {
    String tagName();

    ConfigValue getConfig();

    ConfigParam getParam();

    String getType();

    int numOfThreads();

    Random getRandom();

    TimeValue startSlackTime();

    String getClassPath();
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
AlbumModel (MyMusic
1.0
     API Reference)
</TITLE>

<META NAME="date" CONTENT="2014-10-13">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

com.tcl.lzhang1.mymusic.model

Class AlbumModel

java.lang.Object
  com.tcl.lzhang1.mymusic.model.BaseModel
      com.tcl.lzhang1.mymusic.model.AlbumModel

All Implemented Interfaces:
java.io.Serializable

public class AlbumModel
extends BaseModel

See Also:
Serialized Form

Constructor Summary

AlbumModel()

Method Summary

 java.lang.String
getAlbum_name()

 java.lang.String
getId()

 int
getSongCount()

 void
setAlbum_name(java.lang.String album_name)

 void
setId(java.lang.String id)

 void
setSongCount(int songCount)

 java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

AlbumModel

public AlbumModel()

Method Detail

getId

public java.lang.String getId()

setId

public void setId(java.lang.String id)

getAlbum_name

public java.lang.String getAlbum_name()

setAlbum_name

public void setAlbum_name(java.lang.String album_name)

getSongCount

public int getSongCount()

setSongCount

public void setSongCount(int songCount)

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
{%extends "issue_base.html"%}
{%block title1%}Publish+Mail -{%endblock%}
{%block head%}{{form.media}}{%endblock%}
{%block issue_body%}

Publish + Mail Draft Comments

  <form action="{%url codereview.views.publish issue.key.id%}"
        method="post" id="publish-form">
  <input type="hidden" name="xsrf_token" value="{{xsrf_token}}">

  {%ifnotequal user issue.owner%}

Subject:	{{issue.subject}}

  {%endifnotequal%}
  {{form}}

    The message will be included in the email sent (if any).

      <input type="submit" value="Publish All My Drafts" />
      {%if draft_message%}
      <input type="button" onclick="return discard(this);"
	     value="Discard Message" />
      {%endif%}

  </form>

{%if preview%}

Unpublished Drafts:

{{preview|wordwrap:"80"|urlizetrunc:80}}

{%endif%}

{%endblock%}


text:
package com.reason.ide.settings;

import com.intellij.execution.wsl.*;
import com.intellij.openapi.application.*;
import com.intellij.openapi.fileChooser.*;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.*;
import com.intellij.openapi.project.*;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.*;
import com.intellij.openapi.roots.libraries.ui.*;
import com.intellij.openapi.roots.libraries.ui.impl.*;
import com.intellij.openapi.ui.*;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.impl.wsl.*;
import com.intellij.util.ui.*;
import com.intellij.workspaceModel.ide.impl.legacyBridge.library.*;
import com.reason.comp.dune.*;
import com.reason.comp.ocaml.*;
import com.reason.ide.console.*;
import com.reason.ide.library.*;
import jpsplugin.com.reason.*;
import org.jetbrains.annotations.*;

import javax.swing.*;
import javax.swing.table.*;
import java.awt.event.*;
import java.nio.file.*;
import java.util.*;

public class ORSettingsConfigurable implements SearchableConfigurable, Configurable.NoScroll {
    @Nls
    private static final String BS_PLATFORM_LOCATION_LABEL = "Choose bs-platform Directory: ";
    @Nls
    private static final String ESY_EXECUTABLE_LABEL = "Choose esy Executable: ";

    private final @NotNull Project myProject;
    private ORSettings mySettings;
    private final List<String[]> myEnv = new ArrayList<>();

    private JPanel myRootPanel;
    private JTabbedPane myTabs;

    private TextFieldWithBrowseButton myOpamLocation;
    private boolean myIsWsl = false;
    private String myCygwinBash;

    // General
    private JTextField f_generalFormatWidthColumns;
    private JCheckBox f_generalIsFormatOnSave;
    private JCheckBox myUseSuperErrorsCheckBox;

    // BuckleScript
    private JCheckBox f_bsIsEnabled;
    private TextFieldWithBrowseButton f_bsPlatformLocation;

    // Opam
    private JComboBox<String> mySwitchSelect;

    // Esy
    private TextFieldWithBrowseButton f_esyExecutable;
    private JLabel myDetectionLabel;
    private JTable myOpamLibraries;

    public ORSettingsConfigurable(@NotNull Project project) {
        myProject = project;
    }

    @NotNull
    @Override
    public String getId() {
        return getHelpTopic();
    }

    @NotNull
    @Nls
    @Override
    public String getDisplayName() {
        return "OCaml(Reason) / Rescript";
    }

    @NotNull
    @Override
    public String getHelpTopic() {
        return "settings.reason";
    }

    @Nullable
    @Override
    public JComponent createComponent() {
        mySettings = myProject.getService(ORSettings.class);
        createGeneralTab();
        createBsTab();
        createOpamTab();
        createEsyTab();

        mySwitchSelect.addItemListener(itemEvent -> {
            if (itemEvent.getStateChange() == ItemEvent.SELECTED) {
                String version = (String) itemEvent.getItem();
                clearEnv();
                listLibraries(version);
            }
        });
        myOpamLibraries.setBorder(BorderFactory.createLineBorder(JBUI.CurrentTheme.DefaultTabs.borderColor()));
        listLibraries(mySettings.getSwitchName());

        return myRootPanel;
    }

    @Override
    public void apply() {
        // General
        mySettings.setFormatOnSaveEnabled(f_generalIsFormatOnSave.isSelected());
        mySettings.setFormatColumnWidth(sanitizeInput(f_generalFormatWidthColumns));
        mySettings.setUseSuperErrors(myUseSuperErrorsCheckBox.isSelected());
        // BuckleScript
        mySettings.setBsEnabled(f_bsIsEnabled.isSelected());
        mySettings.setBsPlatformLocation(sanitizeInput(f_bsPlatformLocation));
        // Opam
        mySettings.setOpamLocation(sanitizeInput(myOpamLocation));
        mySettings.setCygwinBash(myCygwinBash);
        mySettings.setIsWsl(myIsWsl);
        mySettings.setSwitchName((String) mySwitchSelect.getSelectedItem());
        // Esy
        mySettings.setEsyExecutable(sanitizeInput(f_esyExecutable));

        // Create external library based on the selected opam switch
        createExternalLibraryDependency(mySettings);
        // Compute env
        OpamEnv opamEnv = myProject.getService(OpamEnv.class);
        opamEnv.computeEnv(mySettings.getOpamLocation(), mySettings.getSwitchName(), mySettings.getCygwinBash(), null);
        // Display compiler info in console (if any)
        myProject.getService(ORToolWindowManager.class).showShowToolWindows();
    }

    private void createExternalLibraryDependency(@NotNull ORSettings settings) {
        Project project = settings.getProject();
        if (settings.getSwitchName().isEmpty()) {
            return;
        }

        LibraryTable projectLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(project);
        LibraryTable.ModifiableModel projectLibraryTableModel = projectLibraryTable.getModifiableModel();

        String libraryName = "switch:" + settings.getSwitchName();

        // Remove existing lib
        Library oldLibrary = projectLibraryTableModel.getLibraryByName(libraryName);
        VirtualFile opamRootCandidate = VirtualFileManager.getInstance().findFileByNioPath(Path.of(settings.getOpamLocation(), settings.getSwitchName()));
        if (opamRootCandidate != null && opamRootCandidate.exists() && opamRootCandidate.isValid()) {
            Library library = oldLibrary == null ? projectLibraryTableModel.createLibrary(libraryName, OclLibraryKind.INSTANCE) : null;
            Library.ModifiableModel libraryModel = library == null ? null : library.getModifiableModel();

            if (libraryModel != null) {
                OclLibraryType libraryType = (OclLibraryType) LibraryType.findByKind(OclLibraryKind.INSTANCE);
                LibraryRootsComponentDescriptor rootsComponentDescriptor = libraryType.createLibraryRootsComponentDescriptor();
                List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Collections.singleton(opamRootCandidate), myRootPanel, project, rootsComponentDescriptor);
                for (OrderRoot orderRoot : orderRoots) {
                    libraryModel.addRoot(orderRoot.getFile(), orderRoot.getType());
                }
            }

            ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(() -> {
                if (libraryModel != null) {
                    libraryModel.commit();
                    projectLibraryTableModel.commit();
                }

                // Find module that contains dune config root file
                Map<Module, VirtualFile> duneContentRoots = Platform.findContentRootsFor(project, DunePlatform.DUNE_PROJECT_FILENAME);
                for (Module module : duneContentRoots.keySet()) {
                    ModuleRootModificationUtil.updateModel(module, moduleModel -> {
                        // Remove all libraries entries that are of type Ocaml
                        moduleModel.orderEntries().forEach(entry -> {
                            Library entryLibrary = (entry instanceof LibraryOrderEntry) ? ((LibraryOrderEntry) entry).getLibrary() : null;
                            PersistentLibraryKind<?> entryLibraryKind = (entryLibrary instanceof LibraryBridge) ? ((LibraryBridge) entryLibrary).getKind() : null;
                            if (entryLibraryKind instanceof OclLibraryKind) {
                                moduleModel.removeOrderEntry(entry);
                            }

                            return true;
                        });
                        // Add the new lib as order entry
                        moduleModel.addLibraryEntry(library == null ? oldLibrary : library);
                    });
                }
            }));
        }
    }

    private void listLibraries(@NotNull String version) {
        myProject.getService(OpamProcess.class)
                .list(myOpamLocation.getText(), version, myCygwinBash, libs -> {
                    myEnv.clear();
                    if (libs != null) {
                        myEnv.addAll(libs);
                    }
                    myOpamLibraries.setModel(createDataModel());
                });
    }

    @NotNull
    private AbstractTableModel createDataModel() {
        return new AbstractTableModel() {
            @Override
            public int getRowCount() {
                return myEnv.size();
            }

            @Override
            public int getColumnCount() {
                return 3;
            }

            @Override
            public @NotNull Object getValueAt(int rowIndex, int columnIndex) {
                String[] columns = myEnv.get(rowIndex);
                return columns.length <= columnIndex ? "" : columns[columnIndex];
            }
        };
    }

    private void clearEnv() {
        myEnv.clear();
        myOpamLibraries.setModel(createDataModel());
    }

    @Override
    public boolean isModified() {
        // General
        boolean isFormatOnSaveModified =
                f_generalIsFormatOnSave.isSelected() != mySettings.isFormatOnSaveEnabled();
        boolean isFormatWidthColumnsModified =
                !f_generalFormatWidthColumns.getText().equals(mySettings.getFormatColumnWidth());
        boolean isUseSuperErrorModified = myUseSuperErrorsCheckBox.isSelected() != mySettings.isUseSuperErrors();
        // Bs
        boolean isBsEnabledModified = f_bsIsEnabled.isSelected() != mySettings.isBsEnabled();
        boolean isBsPlatformLocationModified =
                !f_bsPlatformLocation.getText().equals(mySettings.getBsPlatformLocation());
        // Opam
        boolean isOpamLocationModified =
                !myOpamLocation.getText().equals(mySettings.getOpamLocation());
        boolean isOpamSwitchModified = !mySettings.getSwitchName().equals(mySwitchSelect.getSelectedItem());
        // Esy
        boolean isEsyExecutableModified =
                !f_esyExecutable.getText().equals(mySettings.getEsyExecutable());

        return isFormatOnSaveModified || isFormatWidthColumnsModified || isUseSuperErrorModified
                || isBsEnabledModified || isBsPlatformLocationModified || isOpamLocationModified
                || isOpamSwitchModified || isEsyExecutableModified;
    }

    @Override
    public void reset() {
        // General
        f_generalIsFormatOnSave.setSelected(mySettings.isFormatOnSaveEnabled());
        f_generalFormatWidthColumns.setText(mySettings.getFormatColumnWidth());
        myUseSuperErrorsCheckBox.setSelected(mySettings.isUseSuperErrors());
        // BuckleScript
        f_bsIsEnabled.setSelected(mySettings.isBsEnabled());
        f_bsPlatformLocation.setText(mySettings.getBsPlatformLocation());
        // Opam
        myOpamLocation.setText(mySettings.getOpamLocation());
        myCygwinBash = mySettings.getCygwinBash();
        myIsWsl = mySettings.isWsl();
        // Esy
        f_esyExecutable.setText(mySettings.getEsyExecutable());

        setDetectionText();
        createSwitch(mySettings.getOpamLocation());
    }

    private void createGeneralTab() {
    }

    private void setDetectionText() {
        if (myCygwinBash != null) {
            myDetectionLabel.setText("Cygwin detected");
        } else if (myIsWsl) {
            myDetectionLabel.setText("WSL detected");
        } else {
            myDetectionLabel.setText("");
        }
    }

    private void createBsTab() {
        Project project = mySettings.getProject();
        f_bsPlatformLocation.addBrowseFolderListener(BS_PLATFORM_LOCATION_LABEL, null, project,
                FileChooserDescriptorFactory.createSingleFolderDescriptor());
    }

    private void detectSwitchSystem(@NotNull VirtualFile dir) {
        myIsWsl = dir.getPath().replace("/", "\\").startsWith(WslConstants.UNC_PREFIX);
        myCygwinBash = null;
        if (!myIsWsl && Platform.isWindows()) { // cygwin
            VirtualFile binDir = findBinary(dir);
            if (binDir != null && binDir.isValid()) {
                VirtualFile opam = binDir.findChild("bash.exe");
                if (opam != null && opam.isValid()) {
                    myCygwinBash = opam.getPath();
                }
            }
        }
    }

    private void createOpamTab() {
        Project project = mySettings.getProject();
        TextBrowseFolderListener browseListener = new TextBrowseFolderListener(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project) {
            @Override
            protected void onFileChosen(@NotNull VirtualFile chosenDir) {
                super.onFileChosen(chosenDir);

                detectSwitchSystem(chosenDir);
                setDetectionText();
                createSwitch(chosenDir.getPath());
            }

        };

        final String[] previousOpamLocation = new String[1];

        FocusListener focusListener = new FocusListener() {
            @Override public void focusGained(FocusEvent e) {
                previousOpamLocation[0] = myOpamLocation.getText();
            }

            @Override
            public void focusLost(FocusEvent e) {
                String path = myOpamLocation.getText();
                String oldPath = previousOpamLocation[0];
                if (!path.equals(oldPath)) {
                    VirtualFile chosenDir = VirtualFileManager.getInstance().findFileByNioPath(Path.of(path));
                    if (chosenDir == null) {
                        createSwitch("");
                        clearEnv();
                    } else {
                        detectSwitchSystem(chosenDir);
                        setDetectionText();
                        createSwitch(chosenDir.getPath());
                    }
                }
            }
        };

        myOpamLocation.getTextField().addFocusListener(focusListener);
        myOpamLocation.addBrowseFolderListener(browseListener);
    }

    private VirtualFile findBinary(@Nullable VirtualFile dir) {
        if (dir == null) {
            return null;
        }

        VirtualFile child = dir.findChild("bin");
        if (child != null) {
            return child;
        }

        return findBinary(dir.getParent());
    }

    private void createSwitch(@NotNull String opamLocation) {
        OpamProcess opamProcess = new OpamProcess(myProject);
        opamProcess.listSwitch(opamLocation, myCygwinBash, opamSwitches -> {
            boolean switchEnabled = opamSwitches != null && !opamSwitches.isEmpty();
            mySwitchSelect.removeAllItems();
            mySwitchSelect.setEnabled(switchEnabled);
            if (switchEnabled) {
                boolean useOpamSelection = mySettings.getSwitchName().isEmpty();
                //System.out.println("Add: [" + Joiner.join(", ", opamSwitches) + "]");
                for (OpamProcess.OpamSwitch opamSwitch : opamSwitches) {
                    mySwitchSelect.addItem(opamSwitch.name);
                    if (opamSwitch.isSelected && useOpamSelection) {
                        mySwitchSelect.setSelectedIndex(mySwitchSelect.getItemCount() - 1);
                    }
                }
                if (!useOpamSelection) {
                    mySwitchSelect.setSelectedItem(mySettings.getSwitchName());
                }
            } else {
                clearEnv();
            }
        });
    }

    private void createEsyTab() {
        Project project = mySettings.getProject();
        f_esyExecutable.addBrowseFolderListener(ESY_EXECUTABLE_LABEL, null, project,
                FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor());
    }

    private static @NotNull String sanitizeInput(@NotNull JTextField textField) {
        return sanitizeInput(textField.getText());
    }

    private static @NotNull String sanitizeInput(@NotNull TextFieldWithBrowseButton textFieldWithBrowseButton) {
        return sanitizeInput(textFieldWithBrowseButton.getText());
    }

    private static @NotNull String sanitizeInput(@NotNull String input) {
        return input.trim();
    }
}


text: extern __inline__ void dead_function() {}


text:
package org.jetbrains.plugins.textmate.language;

import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class TextMateBlockCommentPair {
  private final @NotNull String prefix;
  private final @NotNull String suffix;

  public TextMateBlockCommentPair(@NotNull String prefix, @NotNull String suffix) {
    this.prefix = prefix;
    this.suffix = suffix;
  }

  public @NotNull String getPrefix() {
    return prefix;
  }

  public @NotNull String getSuffix() {
    return suffix;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    TextMateBlockCommentPair pair = (TextMateBlockCommentPair)o;

    if (!prefix.equals(pair.prefix)) return false;
    if (!suffix.equals(pair.suffix)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    return Objects.hash(prefix, suffix);
  }
}


text:
package com.palantir.atlasdb.timelock;

import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import com.palantir.lock.CloseableLockService;
import com.palantir.lock.LockService;
import java.io.IOException;
import org.junit.Test;

public class TimeLockServicesTest {
    @Test
    public void doNotCloseRepeatedInterfaceMultipleTimes() throws IOException {
        LockService lockService = mock(LockService.class);
        AsyncTimelockService asyncTimelockService = mock(AsyncTimelockService.class);
        AsyncTimelockResource asyncTimelockResource = mock(AsyncTimelockResource.class);

        getTimeLockServices(lockService, asyncTimelockService, asyncTimelockResource)
                .close();

        verify(asyncTimelockService, times(1)).close();
    }

    @Test
    public void closesCloseableImplementationsOfNotNecessarilyCloseableInterfaces() throws IOException {
        CloseableLockService closeableLockService = mock(CloseableLockService.class);
        AsyncTimelockService asyncTimelockService = mock(AsyncTimelockService.class);
        AsyncTimelockResource asyncTimelockResource = mock(AsyncTimelockResource.class);

        getTimeLockServices(closeableLockService, asyncTimelockService, asyncTimelockResource)
                .close();

        verify(closeableLockService).close();
    }

    @Test
    public void exceptionsWhenClosingDoNotAffectOverallClosure() throws IOException {
        CloseableLockService closeableLockService = mock(CloseableLockService.class);
        AsyncTimelockService asyncTimelockService = mock(AsyncTimelockService.class);
        AsyncTimelockResource asyncTimelockResource = mock(AsyncTimelockResource.class);

        doThrow(new RuntimeException()).when(asyncTimelockService).close();
        doThrow(new RuntimeException()).when(closeableLockService).close();

        getTimeLockServices(closeableLockService, asyncTimelockService, asyncTimelockResource)
                .close();

        verify(closeableLockService).close();
        verify(asyncTimelockService).close();
    }

    private TimeLockServices getTimeLockServices(
            LockService lockService,
            AsyncTimelockService asyncTimelockService,
            AsyncTimelockResource asyncTimelockResource) {
        return TimeLockServices.create(
                asyncTimelockService, lockService, asyncTimelockService, asyncTimelockResource, asyncTimelockService);
    }
}


text:
package org.keycloak.authorization.admin;

import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;

import org.keycloak.authorization.AuthorizationProvider;
import org.keycloak.authorization.model.ResourceServer;
import org.keycloak.models.ClientModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.services.resources.admin.AdminEventBuilder;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;

/**
 * @author Pedro Igor
 */
public class AuthorizationService {

    private final AdminPermissionEvaluator auth;
    private final ClientModel client;
    private ResourceServer resourceServer;
    private final AuthorizationProvider authorization;
    private final AdminEventBuilder adminEvent;

    public AuthorizationService(KeycloakSession session, ClientModel client, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent) {
        this.client = client;
        this.authorization = session.getProvider(AuthorizationProvider.class);
        this.adminEvent = adminEvent;
        this.resourceServer = this.authorization.getStoreFactory().getResourceServerStore().findByClient(this.client);
        this.auth = auth;
    }

    @Path("/resource-server")
    public Object resourceServer() {
        if (resourceServer == null) {
            throw new NotFoundException();
        }

        return getResourceServerService();
    }

    public ResourceServerService getResourceServerService() {
        return new ResourceServerService(this.authorization, this.resourceServer, this.client, this.auth, adminEvent);
    }

    public void enable(boolean newClient) {
        this.resourceServer = getResourceServerService().create(newClient);
    }

    public void disable() {
        if (isEnabled()) {
            getResourceServerService().delete();
        }
    }

    public boolean isEnabled() {
        return this.resourceServer != null;
    }
}


text:
int main()
{
 char server_message[256]="you reached the server"; //the mesaage when client reaches the server
 int server_socket; // create an integer to hold the return value of socket call
 server_socket=socket(AF_INET,SOCK_STREAM,0); //create server socket.
 //define server address
 struct sockaddr_in server_address;
 server_address.sin_family=AF_INET;
 server_address.sin_port=htons(9002);
 server_address.sin_addr.s_addr =INADDR_ANY;
 //bind the socket to  our specified ip and port
 bind(server_socket,(struct sockaddr*) &server_address,sizeof(server_address));// bind the server with ip and port number.
 listen(server_socket,5);//to start listining for connections,queue size .
 //Accept the connection
 int client_socket;
 client_socket=accept(server_socket,NULL,NULL)//now we have 2 way connection with client and server,structure of client address
 //send the message
 send(client_socket,server_message,sizeof(server_message),0);
 //close the socket
 close(server_socket);

 return 0;
}

N


text:
"""Database API

Public facing database api that leverages a provided implementation to
execute database operations.
"""
import logging
import os

from seedbox.common import timeutil
from seedbox import constants
from seedbox.db import models

LOG = logging.getLogger(__name__)

class DBApi(object):
    """Provides API for supported database operations.

    :param impl: database plugin instance
    :type impl: :class:`~seedbox.db.base.Connection`
    """

    def __init__(self, impl):
        self.impl = impl

    def clear(self):
        """Clears all data from database."""
        self.impl.clear()

    def backup(self):
        """Backup database."""
        self.impl.backup()

    def shrink_db(self):
        """Shrink database."""
        self.impl.shrink_db()

    def save_torrent(self, torrent):
        """Performs save (insert/update) operation on an instance of torrent.

        :param torrent: an instance of a torrent
        :return: saved torrent instance
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        return self.impl.save(torrent)

    def bulk_save_torrents(self, value_map, qfilter):
        """Performs save (update) operation on multiple instances.

         Using the provided data map.

        :param value_map: data attributes and values to update
        :param qfilter: query filter to determine instances to update
        """
        self.impl.bulk_update(value_map, models.Torrent, qfilter)

    def delete_torrent(self, torrent):
        """Performs delete operation on specific instance of torrent.

        :param torrent: an instance of torrent
        """
        self.impl.delete(torrent)

    def delete_torrents(self, qfilter):
        """Performs delete operation on selection of torrent instances.

        :param qfilter: query filter to determine instances to delete.
        """
        self.impl.delete_by(models.Torrent, qfilter)

    def get_torrents(self, qfilter):
        """Perform select operation on selection of torrent instances.

        :param qfilter: query filter to determine instances to fetch.
        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        return self.impl.fetch_by(models.Torrent, qfilter)

    def get_torrents_active(self):
        """Retrieves active torrents.

        Perform select operation using a pre-defined criteria for what
        constitutes an active torrent.

        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        qfilter = {'and': [{'=': {'invalid': False}},
                           {'=': {'purged': False}},
                           {'=': {'failed': False}},
                           {'in': {'state': constants.ACTIVE_STATES}}
                           ]}
        return self.get_torrents(qfilter)

    def get_torrents_by_state(self, state, failed=False):
        """Retrieve torrents by specified state.

        Perform select operation using a pre-defined criteria to get torrents
        by a specific state.

        :param state: name of the state of the torrent
        :param failed: flag indicating to include failed entries or not
        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        qfilter = {'and': [{'=': {'state': state}},
                           {'=': {'failed': True if failed else False}}
                           ]}
        return self.get_torrents(qfilter)

    def get_torrents_eligible_for_purging(self):
        """Retrieves eligible to purge.

        Perform select operation using a pre-defined criteria for what
        constitutes eligible for purging.

        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        qfilter = {'and': [{'=': {'invalid': False}},
                           {'=': {'purged': False}},
                           {'in': {'state': constants.INACTIVE_STATES}}
                           ]}
        return self.get_torrents(qfilter)

    def get_torrents_eligible_for_removal(self):
        """Retrieve torrents eligible for removal.

        Perform select operation using a pre-defined criteria for what
        constitutes eligible for removal.

        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        qfilter = {'and': [{'=': {'purged': True}},
                           {'in': {'state': constants.INACTIVE_STATES}}
                           ]}
        return self.get_torrents(qfilter)

    def get_torrent_by_name(self, name):
        """Fetch torrent by name.

        Perform select operation using the name of torrent to fetch torrent.

        :param name: the name of torrent
        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        qfilter = {'=': {'name': name}}
        return list(self.get_torrents(qfilter))

    def get_torrent(self, torrent_id):
        """Fetch torrent by id.

        Perform select operation using the primary key of torrent to fetch
        torrent.

        :param torrent_id: primary key of torrent
        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        return self.impl.fetch(models.Torrent, torrent_id)

    def fetch_or_create_torrent(self, name):
        """Fetch or create torrent by name.

        Performs select operation using the name of torrent to fetch torrent,
        and if the torrent is not found, then the save (insert) operation is
        performed using the name of the torrent.

        :param name: the name of a torrent
        :return: torrent instance(s)
        :rtype: :class:`~seedbox.db.models.Torrent`
        """
        _torrent = self.get_torrent_by_name(name)
        if not _torrent:
            _torrent = self.save_torrent(models.Torrent(None, name))
        else:
            _torrent = _torrent.pop()
        return _torrent

    def save_media(self, media):
        """Saves media file metadata.

        Perform save (insert/update) operation on an instance of media.

        :param media: an instance of media file
        :return: media file instance
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        return self.impl.save(media)

    def bulk_create_medias(self, medias):
        """Saves metadata for multiple media files.

        Perform save (insert) operation on a list of instances of media.

        :param medias: a list of instances of media file
        :return: media file instance(s)
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        return list(self.impl.bulk_create(medias))

    def delete_media(self, media):
        """Deletes metadata for media file.

        Perform delete operation on an instance of media.

        :param media: an instance of media file
        """
        self.impl.delete(media)

    def delete_medias(self, qfilter):
        """Deletes metadata for multiple media files.

        Perform delete operation on a list of instances of media.

        :param qfilter: query filter to determine instances to delete
        """
        self.impl.delete_by(models.MediaFile, qfilter)

    def get_medias(self, qfilter):
        """Retrieves metadata for multiple media files.

        Perform select operation on selection of media instances.

        :param qfilter: query filter to determine instances to fetch.
        :return: media file instance(s)
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        return self.impl.fetch_by(models.MediaFile, qfilter)

    def get_medias_by_torrent(self, torrent_id):
        """Fetch all media file metadata by torrent id.

        Perform select operation using the primary key of torrent to fetch
        associated media.

        :param torrent_id: primary key of torrent
        :return: media file instance(s)
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        qfilter = {'=': {'torrent_id': torrent_id}}
        return self.get_medias(qfilter)

    def get_medias_by(self, torrent_id, file_path=None, compressed=None,
                      synced=None, missing=None, skipped=None):
        """Retrieve media file metadata using specified criteria.

        Perform select operation using a combination of the provided
        parameters to find specified media.

        :param torrent_id: primary key of torrent
        :param file_path: location where media exist on file system
                          (default: None; ignore attribute)
        :param compressed: flag to indicate to include or exclude compressed
                           media (default: None; ignore attribute)
        :param synced: flag to indicate to include or exclude synced media (
                       default: None; ignored attribute)
        :param missing: flag to indicate to include or exclude missing media
                        (default: None; ignored attribute)
        :param skipped: flag to indicate to include or exclude skipped media
                        (default: None; ignored attribute)
        :return: media file instance(s)
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        conditions = [{'=': {'torrent_id': torrent_id}}]
        if file_path is not None:
            conditions.append({'=': {'file_path': file_path}})
        if compressed is not None:
            conditions.append(
                {'=': {'compressed': True if compressed else False}})
        if synced is not None:
            conditions.append({'=': {'synced': True if synced else False}})
        if missing is not None:
            conditions.append({'=': {'missing': True if missing else False}})
        if skipped is not None:
            conditions.append({'=': {'skipped': True if skipped else False}})
        qfilter = {'and': conditions}
        return self.get_medias(qfilter)

    def get_processed_medias(self, torrent_id):
        """Retrieve processed media files by torrent id.

        Performed select operation using torrent primary key and pre-defined
        criteria for what constitutes processed media.

        :param torrent_id: torrent primary key
        :return: media file instance(s)
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        qfilter = {'and': [{'=': {'torrent_id': torrent_id}},
                           {'or': [{'=': {'synced': True}},
                                   {'=': {'missing': True}},
                                   {'=': {'skipped': True}}
                                   ]}
                           ]}
        return self.get_medias(qfilter)

    def get_media(self, media_id):
        """Fetch media file metadata by id.

        Perform select operation using media primary key to fetch media.

        :param media_id: media primary key
        :return: media file instance
        :rtype: :class:`~seedbox.db.models.MediaFile`
        """
        return self.impl.fetch(models.MediaFile, media_id)

    def save_appstate(self, appstate):
        """Perform save (insert/update) operation on an instance of appstate.

        :param appstate: an instance of appstate
        :return: appstate instance
        :rtype: :class:`~seedbox.db.models.AppState`
        """
        return self.impl.save(appstate)

    def delete_appstate(self, appstate):
        """Perform delete operation on an instance of appstate.

        :param appstate: an instance of appstate
        """
        self.impl.delete(appstate)

    def get_appstate(self, name):
        """Retrieve appstate by name.

        Perform select operation using name of appstate to fetch an instance
        of appstate.

        :param name: name of an appstate instance
        :return: appstate instance
        :rtype: :class:`~seedbox.db.models.AppState`
        """
        return self.impl.fetch(models.AppState, name)

    def clean_up(self):
        """Cleans up data within tables.

        Periodically check for data no longer needed (fully processed,
        invalid, or deleted) and then remove from the database.
        """
        LOG.debug('starting perform_db_cleanup...')

        lpd = self.get_appstate('last_purge_date')
        last_purge_date = lpd.value if lpd else None
        LOG.debug('last_purge_date: %s', last_purge_date)

        if last_purge_date is None:
            LOG.info('First running...setting last purge date to now')
            # never been purged so need to set an initial date (today)
            self.save_appstate(models.AppState('last_purge_date',
                                               timeutil.utcnow()))
            return

        if timeutil.is_older_than(last_purge_date, timeutil.ONE_WEEK):
            LOG.debug('last purge > 1 week ago....ready for some clean up.')
            # ready to start purge process....
            torrents = list(self.get_torrents_eligible_for_purging())
            if torrents:
                LOG.debug('found torrents eligible for purging: %s',
                          len(torrents))
                # perform database backup
                self.backup()

                LOG.debug('purging media associated with torrents....')
                qfilter = {
                    'in': {'torrent_id': [tor.torrent_id for tor in torrents]}
                }
                self.delete_medias(qfilter)

                qfilter = {
                    'in': {'id': [tor.torrent_id for tor in torrents]}
                }
                self.bulk_save_torrents({'purged': True}, qfilter)

                # now reset the last purge date to now.
                self.save_appstate(models.AppState('last_purge_date',
                                                   timeutil.utcnow()))

            else:
                # no torrents eligible for purging
                LOG.debug('no torrents found eligible for purging...')

        # done deleting mediafiles; now delete any torrents that were
        # found to be missing from filesystem thereby no longer in
        # need of caching.
        torrents_to_delete = []
        for torrent in self.get_torrents_eligible_for_removal():
            if not os.path.exists(os.path.join(
                    self.impl.conf.torrent.torrent_path, torrent.name)):
                # actual torrent file no longer exists so we can safely
                # delete the torrent from cache
                torrents_to_delete.append(torrent.torrent_id)

        if torrents_to_delete:
            LOG.debug('found torrents eligible for removal: %s',
                      len(torrents_to_delete))
            self.delete_torrents({'in': {'id': torrents_to_delete}})

        LOG.debug('perform_db_cleanup completed')


text:
namespace g{
namespace Fuse{
namespace Input{

// public delegate void IsFocusableChangedHandler(object sender, Fuse.Input.IsFocusableChangedArgs args) :48
uDelegateType* IsFocusableChangedHandler_typeof();

}}} // ::g::Fuse::Input


text:
layout: default
title: Judges
is_ndoch: true
---

Competition Information

Judges

Andrew Hyder

Andrew Hyder is a civic hacker who enjoys making apps and maps. He is the developer relations engineer at Code for America where he travels the world helping volunteers build useful technology for their cities. As a 2013 CfA Fellow in Kansas City he advised on open data legislation, helped organized a volunteer Brigade, and developed BizFriend.ly to help small business owners adopt new technology. A trained urban planner he has built school yards, bicycle paths, and neighborhood parks around the Bay Area.

Ayori Selassie

Ayori is an Oakland, CA native, a mother, entrepreneur and tech professional. She is a self taught software developer since age 11 and first founder at age 16 and has worked in tech sector for the last 16 years. Currently she is a Senior Solution
      Engineer at Salesforce where she’s also held roles in Product Management, Business Analysis, and Technical Engineering. Prior to salesforce.com Ayori held engineering roles at large global outfits such as ABB Inc and Schneider Electric. She's
      lead several initiatives at Salesforce to support women and underrepresented groups of color including serving as President of Boldforce, an employee resource group she founded to support, mentor, retain and recruit employees of African and African
      American descent.

Ayori’s list of social contributions include organizing the first ever Hackathon on Black Male Achievement (Startup Weekend Oakland Black Male Achievement), founding Pitch Mixer Entrepreneur Forum (a pre-incubator for entrepreneurs
      in undeveloped regions), founding and serving as the President of Boldforce, an affinity group at Salesforce supporting people of African descent, serving on the Communities Board at the Anita Borg Institute, mentoring Emerging Leaders in the Middle
      East and Africa for TechWomen (U.S. Department of State initiative started by Secretary of State Hilary R. Clinton), mentoring young African American males for The Hidden Genius Project (which provides black boys with knowledge, skills and support
      to create technical jobs in the 21st century), Producing/Designing Sid’s Day of Discovery (science education android based tablet video game for pre-schoolers) for the Jim Henson Company featuring Sid the Science Kid and helping a long list
      of Fortune 500 enterprise businesses maintain their competitive differentiation by adopting cloud strategies.

Dan Parham

Dan Parham co-founded Neighborland with Candy Chang and Tee Parham. Neighborland is a platform that helps residents and community leaders take action on their most important issues. 150 organizations have engaged with 500,000 neighbors to collaboratively
      shape the development of their communities. Dan is the lead designer, product manager, and runs operations for the team.

Before founding Neighborland, Dan was a Director of User Experience at Yahoo, working for the Marketplaces and Advertising Platform teams. Previously, Dan was the Associate Creative Director for Aol’s entertainment division. Dan received a BFA
      from the University of North Carolina.

Dan’s work has been recognized by the Venice Biennale of Architecture, American Institute of Graphic Arts, and Cooper Hewitt National Design Museum.

Dan has spoken about civic engagement and technology at the Smart Cities World Congress in Barcelona, San Francisco Placemaking Summit at the American Institute of Architects, Adaptive Metropolis Conference at UC Berkeley, and SPUR San Jose.

Dave Selinger

Dave Selinger is CEO and Founder of RichRelevance, focussed on personalizing the consumer digital experience. He has been with the company for 7 years. He is the founder of mytwofrontteeth.org and now sits on the board of non-profit 'The Family Giving Tree'.

Peter Shanley

Peter Shanley is the Neo Evangelist and a Principal in the SF office. Peter's passion for business strategy and customer development powers his charter to share Neo’s values with the world. From connecting with teams across the Enterprise and
      Startup landscape to exposing the Neo Way to best-in-class practitioners across the globe, Peter's role bridges business development, marketing and recruiting. Prior to joining Neo, Peter worked across the Fortune 500 and Startup world to bring
      new ventures to market. He was a product manager at HP Labs/Snapfish and the program director of the Yahoo! Brickhouse product incubator. Between those roles he was VP of Customer Development at Betable where he led the strategic pivot that resulted
      in an $18.5M Series A investment.

Peter is passionate about social justice and impact, applying modern methods and practices to the big problems of our time. He organizes Civic Love and TEDxMarketStreet in San Francisco, advises Code for America
      and a diverse set of non-profit, philanthropic and government leaders, and champions an impact vertical for Neo's consulting practice.

Submission Guidelines

Deadline: Sunday June 7th, 2:30 pm

Submit on ChallengePost

Schedule

2:30 - Submit projects on challenge post

3:00-3:10 - Introduce judges

3:10-4:30 - Teams present

4:30-4:45 - Judges deliberate

4:45-5:00 - Award Ceremony

5:00-6:00 - Closing Reception

Judging Criteria

Impact: How much impact (quality and quantity) could the solution have? Could this solution solve a big or small problem?

Product/Market Fit: How well does the solution fit the needs of the problem they chose to tackle? How user-friendly is the solution?

Creativity: Are there similar solutions available today? Is the solution innovative?

Sustainability: How and Do they have a plan for next steps? How prepared are they to continue their work beyond the event?

Presentation: How well did the team communicate the problem and solution? How well did they respond to the questions from judges?

Minimum Project Goals

 Identify users

 Show supporting data

 Complete a competitive assessment

 Have either a minimum viable product AND/OR concrete conceptual plan

 List your next steps

 Show potential civic and social partners

Prizes

1st Place

    4 Full-time memberships to Galvanize for 2 months and Free SF National Day of Civic Hacking T-Shirts

2nd Place

    4 25-Hour Hub Membership to Impact Hub for the whole team and Free SF National Day of Civic Hacking T-Shirts

3rd Place

    Complimentary tickets to the Exploratorium and Free SF National Day of Civic Hacking T-Shirts

4th Place

    5 copies of "Coined: The Rich Life of Money and How Its History Has Shaped Us" by Kabir Seghal and Free SF National Day of Civic Hacking T-Shirts

5th Place

    5 copies of "Haline" by Sundeep Ahuja and Free SF National Day of Civic Hacking T-Shirts

Popular Vote

    Free SF National Day of Civic Hacking T-Shirts


text:
import pytz
import flickrapi
import datetime as date

from flickrapi.shorturl import url
from django.conf import settings
from django.core.cache import cache

class Flickr(object):

    api = None
    api_key = settings.FLICKR_API_KEY
    api_secret = settings.FLICKR_SECRET_KEY
    api_token = settings.FLICKR_AUTH_TOKEN
    api_token_secret = settings.FLICKR_AUTH_TOKEN_SECRET
    user_id = settings.FLICKR_USER_ID
    username = settings.FLICKR_USERNAME
    url = settings.FLICKR_URL

    def __init__(self):
        self.api = flickrapi.FlickrAPI(self.api_key, self.api_secret, cache=True)
        self.api.cache = flickrapi.SimpleCache(timeout=300, max_entries=200)

    def get_collections(self):
        sets = self.api.photosets.getList(user_id=self.user_id)
        for set in sets.find('collections'):
            yield set

    def get_photoset(self, photoset_id):
        sets = self.api.photosets.getInfo(photoset_id=photoset_id)
        return sets.find('photoset')

    def get_photosets(self, photoset_id=None):
        if photoset_id:
            yield self.get_photoset(photoset_id)
        else:
            sets = self.api.photosets.getList(user_id=self.user_id)
            for set in sets.find('photosets'):
                yield set

    def get_photos_from_photoset(self, slug):
        for photo in self.api.walk_set(slug):
            yield photo

    def get_photo(self, photo_id):
        result = self.api.photos.getInfo(photo_id=photo_id)
        image = result.find('photo')
        dates = image.find('dates')
        created_date = date.datetime.fromtimestamp(int(dates.attrib['posted']), tz=pytz.utc)
        modified_date = date.datetime.fromtimestamp(int(dates.attrib['lastupdate']), tz=pytz.utc)
        taken_date = date.datetime.strptime(dates.attrib['taken'], '%Y-%m-%d %H:%M:%S').replace(tzinfo=pytz.utc)
        photo = {
            'photo_id': photo_id,
            'title': image.find('title').text or photo_id,
            'description': image.find('description').text,
            'taken': taken_date,
            'created_date': created_date,
            'modified_date': modified_date,
            'type': image.attrib['originalformat'],
            'farm': image.attrib['farm'],
            'server': image.attrib['server'],
            'full_path': image.find(".//url[@type='photopage']").text,
        }
        return photo

    def get_photo_size(self, photo_id, label='Original'):
        result = self.api.photos.getSizes(photo_id=photo_id)
        query = ".//sizes/size[@label='{0}']".format(label)
        size = {
            'photo_id': photo_id,
            'width': result.find(query).attrib['width'],
            'height': result.find(query).attrib['height'],
            'source': result.find(query).attrib['source'],
            'url': result.find(query).attrib['url'],
        }
        return size

    def get_photo_url(self, slug):
        return url(slug)

    def set_photo_info(self, photo):
        if not photo.slug: return
        result = self.api.photos.setMeta(photo_id=photo.slug, title=photo.title, description=photo.description)
        return result

    def get_photo_context(self, photo):
        if not photo.slug: return
        result = self.api.photos.getAllContexts(photo_id=photo.slug)
        context = {
            'photoset_id': result.find(".//set").attrib['id'],
            'title': result.find(".//set").attrib['title'],
        }
        return context

    def set_photoset_info(self, photoset):
        if not photoset.slug: return
        result = self.api.photosets.editMeta(photoset_id=photoset.slug, title=photoset.title, description=photoset.description)
        return result

    def set_photoset_list(self, photoset):
        if not photoset.slug: return
        list = photoset.photos.values_list('slug', flat=True).order_by('id')
        result = self.api.photosets.editPhotos(photoset_id=photoset.slug, primary_photo_id=photoset.primary, photo_ids=','.join(list))
        return result

    def set_permissions(self, photo, is_public=0, is_friend=1, is_family=1):
        if not photo.slug: return
        result = self.api.photos.setPerms(photo_id=photo.slug, is_public=is_public, is_friend=is_friend, is_family=is_family)
        return result

    def delete_photo(self, photo):
        if not photo.slug: return
        result = self.api.photos.delete(photo_id=photo.slug)
        return result

    def delete_photoset(self, photoset):
        if not photoset.slug: return
        result = self.api.photosets.delete(photoset_id=photoset.slug)
        return result

    def create_photoset(self, photoset):
        params = {
            'title': photoset.title,
            'description': photoset.description,
            'primary_photo_id': photoset.primary
        }
        result = self.api.photosets.create(**params)
        photoset = result.find('photoset')
        set = {
            'photoset_id': int(photoset.attrib['id']),
            'url': photoset.attrib['url'],
        }
        return set

    def add_photo_to_photoset(self, photo, photoset):
        if not photo.slug and not photoset.slug: return
        params = {'photo_id': photo.slug, 'photoset_id': photoset.slug}
        return self.api.photosets.addPhoto(**params)

    def upload_photo(self, photo, is_public=0):
        params = {
            'filename': photo.full_path,
            'title': photo.title,
            'description': photo.description,
            'is_public': is_public,
            'is_family': 1,
            'is_friend': 1
        }
        result = self.api.upload(**params)
        photoid = result.find('photoid').text
        return int(photoid)