Editor's note: Charles Bolden is administrator of NASA. He flew on four space shuttle missions, two as commander. The views expressed are his own.
(CNN) -- Everywhere you look, there is renewed interest in space. Two of the top grossing movies of the past two years were "Gravity" and "Interstellar," while recent real-life space dramas have been even more fascinating than fiction.
Take the unprecedented 37-year, 12-billion-mile odyssey of NASA's Voyager spacecraft -- the first human-made object to venture into interstellar space. In 2012, our Curiosity rover made its harrowing landing on Mars. We also provided key support and instruments to the European Space Agency's Rosetta spacecraft and the recent first-ever robotic landing on a comet with its Philae lander.
Everywhere I go, the world over, students, citizens, scientists, explorers and entrepreneurs are eager to get in on the action in this new era of space exploration. And we are just a few days from yet another extraordinary milestone toward a human journey to Mars.
On Thursday, NASA's Orion spacecraft will blast off from Cape Canaveral Air Force Station on its first test flight -- a major step in meeting President Barack Obama's bold challenge, supported by Congress, that America send humans to Mars by the 2030s.
Mars? Is Elon Musk nuts?
As the administrator of NASA, I am excited by the opportunity to launch this historic journey. As a former astronaut, I am proud and a bit envious of the amazing men and women -- members of our elite astronaut corps -- who are now in training to perhaps be the first people to set foot on the surface of another planet.
Our uncrewed test flight will send Orion 3,600 miles above Earth, farther into space than any craft designed for astronauts has gone since the last Apollo moon mission more than 40 years ago.
The mission has two primary goals. First, as we have seen with two recent launch failures, space travel is a dangerous business, which is why this test flight will stress systems critical to ensuring the safety of future astronauts. These include the heat shield, parachutes, avionics and attitude control. We intend to learn as much as possible before Orion carries astronauts to explore an asteroid and then on a journey to Mars.
Our second major goal is to expose the spacecraft to the orbital environment it will endure on missions into deep space. We will measure Orion's performance from launch through its four-hour flight, splashdown and recovery in the Pacific Ocean.
NASA is leveraging expertise and resources from across the agency to achieve this next giant leap in space exploration. For example, Curiosity measured radiation on the way to Mars and is now sending back radiation data from the Martian surface. In September, NASA's MAVEN (Mars Atmosphere and Volatile Evolution Mission) became the first orbiter to study the Martian upper atmosphere, MAVEN will greatly improve our understanding of how Mars has changed over time and the potential for habitability. Our deep-space exploration program is also driving development of technologies such as solar electric propulsion, which will power tomorrow's missions.
NASA is also changing the way we do business, beginning with our commitment to help build an American commercial space industry that is second to none. As President Obama has said, the greatest nation on earth should not be dependent on other nations to get into space. That is why we are now forming partnerships with American aerospace companies to ferry cargo, and soon humans, to and from the International Space Station. These commercial partnerships are proving that America works best when government and private-sector ingenuity work as a team. Our commercial partners are not only allowing NASA to focus on our big goal of a human mission to Mars, they are also creating good jobs and strengthening our economy.
The world has learned much about the Red Planet after decades of exploration with rovers and orbiters, but the time has come for human exploration, and we intend to meet the challenge. The Orion test flight is the first step. It is important to remember that NASA sent humans to the moon by setting a goal that seemed beyond our reach. With our Journey to Mars program, NASA is once again well on its way to breathing new life into an American dream and turning science fiction into science fact.


text:
package com.intellij.compiler.impl;

import com.intellij.CommonBundle;
import com.intellij.compiler.*;
import com.intellij.compiler.progress.CompilerTask;
import com.intellij.compiler.server.BuildManager;
import com.intellij.compiler.server.DefaultMessageHandler;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.compiler.ex.CompilerPathsEx;
import com.intellij.openapi.deployment.DeploymentUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.CompilerModuleExtension;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.wm.*;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
import com.intellij.packaging.impl.compiler.ArtifactsCompiler;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.util.Chunk;
import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.util.ThrowableRunnable;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.text.DateFormatUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.jps.api.CmdlineProtoUtil;
import org.jetbrains.jps.api.CmdlineRemoteProto;
import org.jetbrains.jps.api.GlobalOptions;
import org.jetbrains.jps.api.TaskFuture;
import org.jetbrains.jps.model.java.JavaSourceRootType;

import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.lang.ref.WeakReference;
import java.util.*;
import java.util.concurrent.TimeUnit;

import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;

public class CompileDriver {
  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");

  private static final Key<Boolean> COMPILATION_STARTED_AUTOMATICALLY = Key.create("compilation_started_automatically");
  private static final Key<ExitStatus> COMPILE_SERVER_BUILD_STATUS = Key.create("COMPILE_SERVER_BUILD_STATUS");
  private static final long ONE_MINUTE_MS = 60L * 1000L;

  private final Project myProject;
  private final Map<Module, String> myModuleOutputPaths = new HashMap<>();
  private final Map<Module, String> myModuleTestOutputPaths = new HashMap<>();

  @SuppressWarnings("deprecation") private CompilerFilter myCompilerFilter = CompilerFilter.ALL;

  public CompileDriver(Project project) {
    myProject = project;
  }

  @SuppressWarnings("deprecation")
  public void setCompilerFilter(CompilerFilter compilerFilter) {
    myCompilerFilter = compilerFilter == null? CompilerFilter.ALL : compilerFilter;
  }

  public void rebuild(CompileStatusNotification callback) {
    doRebuild(callback, new ProjectCompileScope(myProject));
  }

  public void make(CompileScope scope, CompileStatusNotification callback) {
    if (validateCompilerConfiguration(scope)) {
      startup(scope, false, false, callback, null);
    }
    else {
      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
    }
  }

  public boolean isUpToDate(CompileScope scope) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("isUpToDate operation started");
    }

    final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true, false, false, isCompilationStartedAutomatically(scope));
    final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, true, false);

    final Ref<ExitStatus> result = new Ref<>();

    task.start(() -> {
      final ProgressIndicator indicator = compileContext.getProgressIndicator();
      if (indicator.isCanceled() || myProject.isDisposed()) {
        return;
      }
      try {
        final TaskFuture future = compileInExternalProcess(compileContext, true);
        if (future != null) {
          while (!future.waitFor(200L, TimeUnit.MILLISECONDS)) {
            if (indicator.isCanceled()) {
              future.cancel(false);
            }
          }
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
      finally {
        result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));
        if (!myProject.isDisposed()) {
          CompilerCacheManager.getInstance(myProject).flushCaches();
        }
      }
    }, null);

    if (LOG.isDebugEnabled()) {
      LOG.debug("isUpToDate operation finished");
    }

    return ExitStatus.UP_TO_DATE.equals(result.get());
  }

  public void compile(CompileScope scope, CompileStatusNotification callback) {
    if (validateCompilerConfiguration(scope)) {
      startup(scope, false, true, callback, null);
    }
    else {
      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
    }
  }

  private void doRebuild(CompileStatusNotification callback, final CompileScope compileScope) {
    if (validateCompilerConfiguration(compileScope)) {
      startup(compileScope, true, false, callback, null);
    }
    else {
      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
    }
  }

  public static void setCompilationStartedAutomatically(CompileScope scope) {
    //todo[nik] pass this option as a parameter to compile/make methods instead
    scope.putUserData(COMPILATION_STARTED_AUTOMATICALLY, Boolean.TRUE);
  }

  private static boolean isCompilationStartedAutomatically(CompileScope scope) {
    return Boolean.TRUE.equals(scope.getUserData(COMPILATION_STARTED_AUTOMATICALLY));
  }

  private List<TargetTypeBuildScope> getBuildScopes(@NotNull CompileContextImpl compileContext,
                                                    CompileScope scope,
                                                    Collection<String> paths) {
    List<TargetTypeBuildScope> scopes = new ArrayList<>();
    final boolean forceBuild = !compileContext.isMake();
    List<TargetTypeBuildScope> explicitScopes = CompileScopeUtil.getBaseScopeForExternalBuild(scope);
    if (explicitScopes != null) {
      scopes.addAll(explicitScopes);
    }
    else if (!compileContext.isRebuild() && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {
      CompileScopeUtil.addScopesForModules(Arrays.asList(scope.getAffectedModules()), scopes, forceBuild);
    }
    else {
      scopes.addAll(CmdlineProtoUtil.createAllModulesScopes(forceBuild));
    }
    if (paths.isEmpty()) {
      scopes = mergeScopesFromProviders(scope, scopes, forceBuild);
    }
    return scopes;
  }

  private List<TargetTypeBuildScope> mergeScopesFromProviders(CompileScope scope,
                                                              List<TargetTypeBuildScope> scopes,
                                                              boolean forceBuild) {
    for (BuildTargetScopeProvider provider : BuildTargetScopeProvider.EP_NAME.getExtensions()) {
      List<TargetTypeBuildScope> providerScopes = ReadAction.compute(
        () -> myProject.isDisposed() ? Collections.emptyList()
                                     : provider.getBuildTargetScopes(scope, myCompilerFilter, myProject, forceBuild));
      scopes = CompileScopeUtil.mergeScopes(scopes, providerScopes);
    }
    return scopes;
  }

  @Nullable
  private TaskFuture compileInExternalProcess(@NotNull final CompileContextImpl compileContext, final boolean onlyCheckUpToDate)
    throws Exception {
    final CompileScope scope = compileContext.getCompileScope();
    final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);
    List<TargetTypeBuildScope> scopes = getBuildScopes(compileContext, scope, paths);

    // need to pass scope's user data to server
    final Map<String, String> builderParams;
    if (onlyCheckUpToDate) {
      builderParams = Collections.emptyMap();
    }
    else {
      final Map<Key, Object> exported = scope.exportUserData();
      if (!exported.isEmpty()) {
        builderParams = new HashMap<>();
        for (Map.Entry<Key, Object> entry : exported.entrySet()) {
          final String _key = entry.getKey().toString();
          final String _value = entry.getValue().toString();
          builderParams.put(_key, _value);
        }
      }
      else {
        builderParams = Collections.emptyMap();
      }
    }

    final MessageBus messageBus = myProject.getMessageBus();
    final MultiMap<String, Artifact> outputToArtifact = ArtifactCompilerUtil.containsArtifacts(scopes) ? ArtifactCompilerUtil.createOutputToArtifactMap(myProject) : null;
    final BuildManager buildManager = BuildManager.getInstance();
    buildManager.cancelAutoMakeTasks(myProject);
    return buildManager.scheduleBuild(myProject, compileContext.isRebuild(), compileContext.isMake(), onlyCheckUpToDate, scopes, paths, builderParams, new DefaultMessageHandler(myProject) {
      @Override
      public void sessionTerminated(final UUID sessionId) {
        if (compileContext.shouldUpdateProblemsView()) {
          final ProblemsView view = ProblemsView.SERVICE.getInstance(myProject);
          view.clearProgress();
          view.clearOldMessages(compileContext.getCompileScope(), compileContext.getSessionId());
        }
      }

      @Override
      public void handleFailure(UUID sessionId, CmdlineRemoteProto.Message.Failure failure) {
        compileContext.addMessage(CompilerMessageCategory.ERROR, failure.hasDescription()? failure.getDescription() : "", null, -1, -1);
        final String trace = failure.hasStacktrace()? failure.getStacktrace() : null;
        if (trace != null) {
          LOG.info(trace);
        }
        compileContext.putUserData(COMPILE_SERVER_BUILD_STATUS, ExitStatus.ERRORS);
      }

      @Override
      protected void handleCompileMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {
        final CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind = message.getKind();
        //System.out.println(compilerMessage.getText());
        final String messageText = message.getText();
        if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.PROGRESS) {
          final ProgressIndicator indicator = compileContext.getProgressIndicator();
          indicator.setText(messageText);
          if (message.hasDone()) {
            indicator.setFraction(message.getDone());
          }
        }
        else {
          final CompilerMessageCategory category = kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR ? CompilerMessageCategory.ERROR
            : kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.WARNING ? CompilerMessageCategory.WARNING : CompilerMessageCategory.INFORMATION;

          String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;
          if (sourceFilePath != null) {
            sourceFilePath = FileUtil.toSystemIndependentName(sourceFilePath);
          }
          final long line = message.hasLine() ? message.getLine() : -1;
          final long column = message.hasColumn() ? message.getColumn() : -1;
          final String srcUrl = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, sourceFilePath) : null;
          compileContext.addMessage(category, messageText, srcUrl, (int)line, (int)column);
          if (compileContext.shouldUpdateProblemsView() && kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.JPS_INFO) {
            // treat JPS_INFO messages in a special way: add them as info messages to the problems view
            final Project project = compileContext.getProject();
            ProblemsView.SERVICE.getInstance(project).addMessage(
              new CompilerMessageImpl(project, category, messageText),
              compileContext.getSessionId()
            );
          }
        }
      }

      @Override
      protected void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event) {
        final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type eventType = event.getEventType();
        switch (eventType) {
          case FILES_GENERATED:
            final List<CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile> generated = event.getGeneratedFilesList();
            final CompilationStatusListener publisher = !myProject.isDisposed()? messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS) : null;
            Set<String> writtenArtifactOutputPaths = outputToArtifact != null ? new THashSet<>(FileUtil.PATH_HASHING_STRATEGY) : null;
            for (CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile : generated) {
              final String root = FileUtil.toSystemIndependentName(generatedFile.getOutputRoot());
              final String relativePath = FileUtil.toSystemIndependentName(generatedFile.getRelativePath());
              if (publisher != null) {
                publisher.fileGenerated(root, relativePath);
              }
              if (outputToArtifact != null) {
                Collection<Artifact> artifacts = outputToArtifact.get(root);
                if (!artifacts.isEmpty()) {
                  for (Artifact artifact : artifacts) {
                    ArtifactsCompiler.addChangedArtifact(compileContext, artifact);
                  }
                  writtenArtifactOutputPaths.add(FileUtil.toSystemDependentName(DeploymentUtil.appendToPath(root, relativePath)));
                }
              }
            }
            if (writtenArtifactOutputPaths != null && !writtenArtifactOutputPaths.isEmpty()) {
              ArtifactsCompiler.addWrittenPaths(compileContext, writtenArtifactOutputPaths);
            }
            break;

          case BUILD_COMPLETED:
            ExitStatus status = ExitStatus.SUCCESS;
            if (event.hasCompletionStatus()) {
              final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status completionStatus = event.getCompletionStatus();
              switch (completionStatus) {
                case CANCELED:
                  status = ExitStatus.CANCELLED;
                  break;
                case ERRORS:
                  status = ExitStatus.ERRORS;
                  break;
                case SUCCESS:
                  status = ExitStatus.SUCCESS;
                  break;
                case UP_TO_DATE:
                  status = ExitStatus.UP_TO_DATE;
                  break;
              }
            }
            compileContext.putUserDataIfAbsent(COMPILE_SERVER_BUILD_STATUS, status);
            break;

          case CUSTOM_BUILDER_MESSAGE:
             if (event.hasCustomBuilderMessage()) {
               final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.CustomBuilderMessage message = event.getCustomBuilderMessage();
               if (GlobalOptions.JPS_SYSTEM_BUILDER_ID.equals(message.getBuilderId()) && GlobalOptions.JPS_UNPROCESSED_FS_CHANGES_MESSAGE_ID.equals(message.getMessageType())) {
                 final String text = message.getMessageText();
                 if (!StringUtil.isEmpty(text)) {
                   compileContext.addMessage(CompilerMessageCategory.INFORMATION, text, null, -1, -1);
                 }
               }
             }
             break;

        }
      }
    });
  }

  private void startup(final CompileScope scope,
                       final boolean isRebuild,
                       final boolean forceCompile,
                       final CompileStatusNotification callback,
                       final CompilerMessage message) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    final String contentName = CompilerBundle.message(forceCompile ? "compiler.content.name.compile" : "compiler.content.name.make");
    final boolean isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
    final CompilerTask compileTask = new CompilerTask(myProject, contentName, isUnitTestMode, true, true, isCompilationStartedAutomatically(scope));

    StatusBar.Info.set("", myProject, "Compiler");
    // ensure the project model seen by build process is up-to-date
    myProject.save();
    if (!isUnitTestMode) {
      ApplicationManager.getApplication().saveSettings();
    }
    PsiDocumentManager.getInstance(myProject).commitAllDocuments();
    FileDocumentManager.getInstance().saveAllDocuments();

    final CompileContextImpl compileContext = new CompileContextImpl(myProject, compileTask, scope, !isRebuild && !forceCompile, isRebuild);

    final Runnable compileWork = () -> {
      final ProgressIndicator indicator = compileContext.getProgressIndicator();
      if (indicator.isCanceled() || myProject.isDisposed()) {
        if (callback != null) {
          callback.finished(true, 0, 0, compileContext);
        }
        return;
      }
      CompilerCacheManager compilerCacheManager = CompilerCacheManager.getInstance(myProject);
      try {
        LOG.info("COMPILATION STARTED (BUILD PROCESS)");
        if (message != null) {
          compileContext.addMessage(message);
        }
        if (isRebuild) {
          CompilerUtil.runInContext(compileContext, "Clearing build system data...",
                                    (ThrowableRunnable<Throwable>)() -> compilerCacheManager
                                      .clearCaches(compileContext));
        }
        final boolean beforeTasksOk = executeCompileTasks(compileContext, true);

        final int errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);
        if (!beforeTasksOk || errorCount > 0) {
          COMPILE_SERVER_BUILD_STATUS.set(compileContext, errorCount > 0 ? ExitStatus.ERRORS : ExitStatus.CANCELLED);
          return;
        }

        final TaskFuture future = compileInExternalProcess(compileContext, false);
        if (future != null) {
          while (!future.waitFor(200L, TimeUnit.MILLISECONDS)) {
            if (indicator.isCanceled()) {
              future.cancel(false);
            }
          }
          if (!executeCompileTasks(compileContext, false)) {
            COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);
          }
          if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
            COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.ERRORS);
          }
        }
      }
      catch (ProcessCanceledException ignored) {
        compileContext.putUserDataIfAbsent(COMPILE_SERVER_BUILD_STATUS, ExitStatus.CANCELLED);
      }
      catch (Throwable e) {
        LOG.error(e); // todo
      }
      finally {
        compilerCacheManager.flushCaches();

        final long duration = notifyCompilationCompleted(compileContext, callback, COMPILE_SERVER_BUILD_STATUS.get(compileContext));
        CompilerUtil.logDuration(
          "\tCOMPILATION FINISHED (BUILD PROCESS); Errors: " +
            compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
            "; warnings: " +
            compileContext.getMessageCount(CompilerMessageCategory.WARNING),
          duration
        );
      }
    };

    compileTask.start(compileWork, () -> {
      if (isRebuild) {
        final int rv = Messages.showOkCancelDialog(
            myProject, "You are about to rebuild the whole project.\nRun 'Build Project' instead?", "Confirm Project Rebuild",
            "Build", "Rebuild", Messages.getQuestionIcon()
        );
        if (rv == Messages.OK /*yes, please, do run make*/) {
          startup(scope, false, false, callback, null);
          return;
        }
      }
      startup(scope, isRebuild, forceCompile, callback, message);
    });
  }

  @Nullable @TestOnly
  public static ExitStatus getExternalBuildExitStatus(CompileContext context) {
    return context.getUserData(COMPILE_SERVER_BUILD_STATUS);
  }

  /** @noinspection SSBasedInspection*/
  private long notifyCompilationCompleted(final CompileContextImpl compileContext, final CompileStatusNotification callback, final ExitStatus _status) {
    final long duration = System.currentTimeMillis() - compileContext.getStartCompilationStamp();
    if (!myProject.isDisposed()) {
      // refresh on output roots is required in order for the order enumerator to see all roots via VFS
      final Module[] affectedModules = compileContext.getCompileScope().getAffectedModules();

      if (_status != ExitStatus.UP_TO_DATE && _status != ExitStatus.CANCELLED) {
        // have to refresh in case of errors too, because run configuration may be set to ignore errors
        Collection<String> affectedRoots = ContainerUtil.newHashSet(CompilerPathsEx.getOutputPaths(affectedModules));
        if (!affectedRoots.isEmpty()) {
          ProgressIndicator indicator = compileContext.getProgressIndicator();
          indicator.setText("Synchronizing output directories...");
          CompilerUtil.refreshOutputRoots(affectedRoots);
          indicator.setText("");
        }
      }
    }
    SwingUtilities.invokeLater(() -> {
      int errorCount = 0;
      int warningCount = 0;
      try {
        errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);
        warningCount = compileContext.getMessageCount(CompilerMessageCategory.WARNING);
      }
      finally {
        if (callback != null) {
          callback.finished(_status == ExitStatus.CANCELLED, errorCount, warningCount, compileContext);
        }
      }

      if (!myProject.isDisposed()) {
        final String statusMessage = createStatusMessage(_status, warningCount, errorCount, duration);
        final MessageType messageType = errorCount > 0 ? MessageType.ERROR : warningCount > 0 ? MessageType.WARNING : MessageType.INFO;
        if (duration > ONE_MINUTE_MS && CompilerWorkspaceConfiguration.getInstance(myProject).DISPLAY_NOTIFICATION_POPUP) {
          ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, messageType, statusMessage);
        }

        final String wrappedMessage = _status != ExitStatus.UP_TO_DATE? "<a href='#'>" + statusMessage + "</a>" : statusMessage;
        final Notification notification = CompilerManager.NOTIFICATION_GROUP.createNotification(
          "", wrappedMessage,
          messageType.toNotificationType(),
          new MessagesActivationListener(compileContext)
        ).setImportant(false);
        compileContext.getBuildSession().registerCloseAction(notification::expire);
        notification.notify(myProject);

        if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) {
          final String msg = DateFormatUtil.formatDateTime(new Date()) + " - " + statusMessage;
          compileContext.addMessage(CompilerMessageCategory.INFORMATION, msg, null, -1, -1);
        }
      }

    });
    return duration;
  }

  private static String createStatusMessage(final ExitStatus status, final int warningCount, final int errorCount, long duration) {
    String message;
    if (status == ExitStatus.CANCELLED) {
      message = CompilerBundle.message("status.compilation.aborted");
    }
    else if (status == ExitStatus.UP_TO_DATE) {
      message = CompilerBundle.message("status.all.up.to.date");
    }
    else  {
      if (status == ExitStatus.SUCCESS) {
        message = warningCount > 0
               ? CompilerBundle.message("status.compilation.completed.successfully.with.warnings", warningCount)
               : CompilerBundle.message("status.compilation.completed.successfully");
      }
      else {
        message = CompilerBundle.message("status.compilation.completed.successfully.with.warnings.and.errors", errorCount, warningCount);
      }
      message = message + " in " + StringUtil.formatDuration(duration);
    }
    return message;
  }

  // [mike] performance optimization - this method is accessed > 15,000 times in Aurora
  private String getModuleOutputPath(Module module, boolean inTestSourceContent) {
    Map<Module, String> map = inTestSourceContent ? myModuleTestOutputPaths : myModuleOutputPaths;
    return map.computeIfAbsent(module, k -> CompilerPaths.getModuleOutputPath(module, inTestSourceContent));
  }

  public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {
    final CompilerTask progressManagerTask = new CompilerTask(myProject, contentName, false, false, true, isCompilationStartedAutomatically(scope));
    final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, false, false);

    FileDocumentManager.getInstance().saveAllDocuments();

    progressManagerTask.start(() -> {
      try {
        task.execute(compileContext);
      }
      catch (ProcessCanceledException ex) {
        // suppressed
      }
      finally {
        if (onTaskFinished != null) {
          onTaskFinished.run();
        }
      }
    }, null);
  }

  private boolean executeCompileTasks(final CompileContext context, final boolean beforeTasks) {
    if (myProject.isDisposed()) {
      return false;
    }
    final CompilerManager manager = CompilerManager.getInstance(myProject);
    final ProgressIndicator progressIndicator = context.getProgressIndicator();
    progressIndicator.pushState();
    try {
      CompileTask[] tasks = beforeTasks ? manager.getBeforeTasks() : manager.getAfterTasks();
      if (tasks.length > 0) {
        progressIndicator.setText(
          CompilerBundle.message(beforeTasks ? "progress.executing.precompile.tasks" : "progress.executing.postcompile.tasks"));
        for (CompileTask task : tasks) {
          if (!task.execute(context)) {
            return false;
          }
        }
      }
    }
    finally {
      progressIndicator.popState();
      StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
      if (statusBar != null) {
        statusBar.setInfo("");
      }
      if (progressIndicator instanceof CompilerTask) {
        ApplicationManager.getApplication().invokeLater(((CompilerTask)progressIndicator)::showCompilerContent);
      }
    }
    return true;
  }

  private boolean validateCompilerConfiguration(final CompileScope scope) {
    try {
      final Module[] scopeModules = scope.getAffectedModules();
      final List<String> modulesWithoutOutputPathSpecified = new ArrayList<>();
      final List<String> modulesWithoutJdkAssigned = new ArrayList<>();
      final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
      boolean projectSdkNotSpecified = false;
      boolean projectOutputNotSpecified = false;
      for (final Module module : scopeModules) {
        if (!compilerManager.isValidationEnabled(module)) {
          continue;
        }
        final boolean hasSources = hasSources(module, JavaSourceRootType.SOURCE);
        final boolean hasTestSources = hasSources(module, JavaSourceRootType.TEST_SOURCE);
        if (!hasSources && !hasTestSources) {
          // If module contains no sources, shouldn't have to select JDK or output directory (SCR #19333)
          // todo still there may be problems with this approach if some generated files are attributed by this module
          continue;
        }
        final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
        if (jdk == null) {
          projectSdkNotSpecified |= ModuleRootManager.getInstance(module).isSdkInherited();
          modulesWithoutJdkAssigned.add(module.getName());
        }
        final String outputPath = getModuleOutputPath(module, false);
        final String testsOutputPath = getModuleOutputPath(module, true);
        if (outputPath == null && testsOutputPath == null) {
          CompilerModuleExtension compilerExtension = CompilerModuleExtension.getInstance(module);
          projectOutputNotSpecified |= compilerExtension != null && compilerExtension.isCompilerOutputPathInherited();
          modulesWithoutOutputPathSpecified.add(module.getName());
        }
        else {
          if (outputPath == null) {
            if (hasSources) {
              modulesWithoutOutputPathSpecified.add(module.getName());
            }
          }
          if (testsOutputPath == null) {
            if (hasTestSources) {
              modulesWithoutOutputPathSpecified.add(module.getName());
            }
          }
        }
      }
      if (!modulesWithoutJdkAssigned.isEmpty()) {
        showNotSpecifiedError("error.jdk.not.specified", projectSdkNotSpecified, modulesWithoutJdkAssigned, ProjectBundle.message("modules.classpath.title"));
        return false;
      }

      if (!modulesWithoutOutputPathSpecified.isEmpty()) {
        showNotSpecifiedError("error.output.not.specified", projectOutputNotSpecified, modulesWithoutOutputPathSpecified, DefaultModuleConfigurationEditorFactory.getInstance().getOutputEditorDisplayName());
        return false;
      }

      final List<Chunk<ModuleSourceSet>> chunks = ModuleCompilerUtil.getCyclicDependencies(myProject, Arrays.asList(scopeModules));
      for (final Chunk<ModuleSourceSet> chunk : chunks) {
        final Set<ModuleSourceSet> sourceSets = chunk.getNodes();
        if (sourceSets.size() <= 1) {
          continue; // no need to check one-module chunks
        }
        Sdk jdk = null;
        LanguageLevel languageLevel = null;
        for (final ModuleSourceSet sourceSet : sourceSets) {
          Module module = sourceSet.getModule();
          final Sdk moduleJdk = ModuleRootManager.getInstance(module).getSdk();
          if (jdk == null) {
            jdk = moduleJdk;
          }
          else {
            if (!jdk.equals(moduleJdk)) {
              showCyclicModulesHaveDifferentJdksError(ModuleSourceSet.getModules(sourceSets));
              return false;
            }
          }

          LanguageLevel moduleLanguageLevel = EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module);
          if (languageLevel == null) {
            languageLevel = moduleLanguageLevel;
          }
          else {
            if (!languageLevel.equals(moduleLanguageLevel)) {
              showCyclicModulesHaveDifferentLanguageLevel(ModuleSourceSet.getModules(sourceSets));
              return false;
            }
          }
        }
      }
      return true;
    }
    catch (Throwable e) {
      LOG.info(e);
      return false;
    }
  }

  private void showCyclicModulesHaveDifferentLanguageLevel(Set<Module> modulesInChunk) {
    Module firstModule = ContainerUtil.getFirstItem(modulesInChunk);
    LOG.assertTrue(firstModule != null);
    String moduleNameToSelect = firstModule.getName();
    final String moduleNames = getModulesString(modulesInChunk);
    Messages.showMessageDialog(myProject, CompilerBundle.message("error.chunk.modules.must.have.same.language.level", moduleNames),
                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());
    showConfigurationDialog(moduleNameToSelect, null);
  }

  private void showCyclicModulesHaveDifferentJdksError(Set<Module> modulesInChunk) {
    Module firstModule = ContainerUtil.getFirstItem(modulesInChunk);
    LOG.assertTrue(firstModule != null);
    String moduleNameToSelect = firstModule.getName();
    final String moduleNames = getModulesString(modulesInChunk);
    Messages.showMessageDialog(myProject, CompilerBundle.message("error.chunk.modules.must.have.same.jdk", moduleNames),
                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());
    showConfigurationDialog(moduleNameToSelect, null);
  }

  private static String getModulesString(Collection<Module> modulesInChunk) {
    final StringBuilder moduleNames = StringBuilderSpinAllocator.alloc();
    try {
      for (Module module : modulesInChunk) {
        if (moduleNames.length() > 0) {
          moduleNames.append("\n");
        }
        moduleNames.append("\"").append(module.getName()).append("\"");
      }
      return moduleNames.toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(moduleNames);
    }
  }

  private static boolean hasSources(Module module, final JavaSourceRootType rootType) {
    return !ModuleRootManager.getInstance(module).getSourceRoots(rootType).isEmpty();
  }

  private void showNotSpecifiedError(@NonNls final String resourceId, boolean notSpecifiedValueInheritedFromProject, List<String> modules,
                                     String editorNameToSelect) {
    String nameToSelect = null;
    final StringBuilder names = StringBuilderSpinAllocator.alloc();
    final String message;
    try {
      final int maxModulesToShow = 10;
      for (String name : modules.size() > maxModulesToShow ? modules.subList(0, maxModulesToShow) : modules) {
        if (nameToSelect == null && !notSpecifiedValueInheritedFromProject) {
          nameToSelect = name;
        }
        if (names.length() > 0) {
          names.append(",\n");
        }
        names.append("\"");
        names.append(name);
        names.append("\"");
      }
      if (modules.size() > maxModulesToShow) {
        names.append(",\n...");
      }
      message = CompilerBundle.message(resourceId, modules.size(), names.toString());
    }
    finally {
      StringBuilderSpinAllocator.dispose(names);
    }

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      LOG.error(message);
    }

    Messages.showMessageDialog(myProject, message, CommonBundle.getErrorTitle(), Messages.getErrorIcon());
    showConfigurationDialog(nameToSelect, editorNameToSelect);
  }

  private void showConfigurationDialog(@Nullable String moduleNameToSelect, @Nullable String tabNameToSelect) {
    ProjectSettingsService service = ProjectSettingsService.getInstance(myProject);
    if (moduleNameToSelect != null) {
      service.showModuleConfigurationDialog(moduleNameToSelect, tabNameToSelect);
    }
    else {
      service.openProjectSettings();
    }
  }

  private static class MessagesActivationListener extends NotificationListener.Adapter {
    private final WeakReference<Project> myProjectRef;
    private final Object myContentId;

    MessagesActivationListener(CompileContextImpl compileContext) {
      myProjectRef = new WeakReference<>(compileContext.getProject());
      myContentId = compileContext.getBuildSession().getContentId();
    }

    @Override
    protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
      final Project project = myProjectRef.get();
      if (project != null && !project.isDisposed() && CompilerTask.showCompilerContent(project, myContentId)) {
        final ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        if (tw != null) {
          tw.activate(null, false);
        }
      }
      else {
        notification.expire();
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
Learning how to program in Oman in the 90's
I grew up in Oman and lived there until I finished high-school in 1999. In 1991, when I was ten years old, my father bought me a 386SX for my birthday having noticed my burgeoning interest in computers. For the first few months, I mainly played games. But even that was a non-trivial endeavor in those days. You couldn't just click or touch an icon on the screen to launch the game; you had to use command-line1. The technician who set up the computer showed me a few MS-DOS commands and I learned others from my friends who already owned computers.
Don't use class literals as type-tokens
Generics were added to the Java language within J2SE 5.0, and there was much rejoicing. It was finally possible to deal with containers in a type-safe manner. Prior to the availability of generics, Java developers had to do things like this:
List people = new ArrayList();
people.add(new Person("Donkey Kong"));
people.add(new Person("Guybrush Threepwood"));
Person pirate = (Person) people.get(1);
This kind of code is very fragile since it is not easy to keep track what is inside a container. If at runtime, the object you retrieve is not of the type that you're expecting, you can get a ClassCastException. It is also remarkably easy to pollute a container by shoving objects of different types inside there, which makes it even more difficult to keep track of the types of the objects inside. Workarounds included littering code with instanceof checks, or creating a wrapper class (for example a class called PeopleList that would delegate to an internal List instance) around the container so that you could have control over the types of objects being inserted.
When generics finally arrived, people were ecstatic because now you could do things like this:
List<Person> people = new ArrayList<Person>();
Person pirate = people.get(1); //It just works!
This meant no-more ugly workarounds, which means that things are awesome! Right?
Heroku template for Spring 4 app with Oracle Java 8 and Tomcat 7.0.54
I've been playing around with Heroku at work for the past week or two. Heroku is pretty awesome if you want to get an app up and running quickly. Heroku does support Java and they have a few Java templates. Their current offering for Java uses Spring 3 and Tomcat 7.0.54 with Java 7. However, the version of Spring is somewhat older and they also use OpenJDK's Java instead of Oracle's Java. I wanted to try out Java 8 and also use a newer version of Spring so I upgraded the existing template to support both of those (I used a forked version of a custom buildpack for Java 8). I also had to update Heroku's Web Runner to use Tomcat 7.0.54 (I have a pull-request waiting but I'm not sure if/when it will get approved so I have an artifact on GitHub that Maven can pull).
You can check out the template here.
The image that lied about itself
A few weeks ago, I ran into a puzzling issue at work. Someone was uploading an image which made it past our file-size checks, but caused an OutOfMemoryError and a heap dump when the code attempted to resize it. The information we had from the heap-dump was that it was trying to allocate memory for an image whose resolution was 18,375×11,175. What didn't make sense is how this image was even getting through our file-size checks, because there is no way we would ever let in an image of that size.
In the code, we have a global limit for the largest file we will accept. We also have a separate limit for image uploads. If the image is over this size, but under the global limit, we will resize the image to a smaller size. The strange part was that the large image was making it past the global check, which meant that the size of the incoming data was below the global limit, but above the image-size limit. How could this be?
On a hunch, I hypothesized that perhaps the entire image wasn't making it through. Perhaps only a part of the image was making it through with its header left intact. In an image file, there is usually a header that conveys information about the file format, the color space, and the resolution of the image! I figured that even though the data are incomplete, enough information was present in the header to enable the resizing code to make sense of it. When it tries to allocate memory for this image, based on the resolution it gets from the header, it runs out of memory!
To verify this, I manually hex-edited a file that was of proper size to have a ridiculously-large resolution. I then uploaded this file and was able to witness the behavior happening even though the file was of the proper size! So what's the lesson here? Don't only rely on file-size limits for images; you have to look at the resolution as well!
I am at JavaOne! The last time I was here was in '08, when it was run by Sun. Of course, it's run by Oracle now. The first day has been pretty good. I attended sessions on Garbage Collection, the Nashorn JavaScript engine, writing DSLs, and about parallelization options offered by JDK 7 and 8 to leverage multicore processors. Pretty good first day!
Nashorn looks pretty interesting and I will be giving it a closer look when I come back home. They are also looking for people to help out so I am going to see if I can contribute anything useful.
Today I will be checking out a talk on Lambdas by Brian Goetz and will also be going to a talk on Big Data. Finally I also have some BOF (birds of a feather) sessions on evolutionary algorithms and writing parsers in Scala. Pretty interesting day and I'm looking forward to it!
Implementing pinch-zoom and pan/drag in an Android view on the canvas
I was trying to get pinch-zoom and panning working on an Android view today. Basically I was trying to implement the same behavior you see when you use Google Maps (for example). You can zoom in and pan around until the edge of the image, but no further. Also, if the image is fully zoomed out, you can't pan the image. Implementing the pinch-zoom functionality was pretty easy. I found an example on StackOverflow. I then wanted to implement panning (or dragging) as well. However, I wasn't able to easily find examples and tutorials for this functionality. I started with this example that comes from the third edition of the Hello, Android! book but I didn't get too far. So I started playing around a little bit with the events and started writing some code from scratch (using the example from Hello, Android!) so that I could have a better idea of what was happening.
As I mentioned before, getting zoom to work was pretty easy. Implementing panning/dragging was the hard part. The major issues I encountered and subsequently fixed were the following:
Panning continues indefinitely in all directions.
When you zoom and then pan, stop, and then start again, the view jerks to a new position instead of panning from the existing position.
Excessive panning towards the left and top can be constrained, but panning towards the right and bottom is not so easily constrained.
Once I fixed all the problems, I figured that it would be nice to document it for future reference, and I also think it would be a useful resource for others who have the same problem. Now a little disclaimer before I go any further: I'm not an Android expert and I'm really not that great with graphics; I just started it learning to program for Android this semester for one of my Masters electives. So there might be a better way of doing all this, and if there is, please let me know! Also, if you want to skip all the explanations and just see the code, you can skip to the last page.
Akṣi: Handwritten-digit-recognizing neural-network
I've always been interested in Neural Networks (ever since I first found out about them around 10 years ago). However, I never got a chance to learn about them or write one of my own; this is something I've wanted to do for some time. I got the opportunity this semester when my professor in my advanced data-structures class told us that we could pick any topic we liked, for a semester project. I thought that this would be the perfect time for me to learn about neural networks and create one of my own.
The end result was Akṣi, a neural network that recognizes hand-written digits. I've hosted it using Google's App Engine. Please check it out!
Setting the content type to text/plain for a JSON response from a Spring controller
I was using a jQuery plugin called a ajaxfileupload to upload a file through AJAX. Technically what the plugin does isn't AJAX. It creates a hidden form and an iframe, and then submits the form using the iframe as the target. The iframe will then end up with the response from the server. This response is then read-in by the plugin and handled appropriately. In my case I was using a controller action that would return JSON (using the .action extension). The action uses Spring's MappingJacksonJSONView that returns JSON with a content type of application/json (as it should). This works perfectly in Chrome, however in both Firefox and IE, the user is presented with a dialog box that asks them to download the JSON response. This is obviously not what I wanted. The reason this is happening is because the response is being directly submitted to the iframe (and therefore, the page). That is, it's not coming through via the XMLHttpRequest object. So IE and FF don't know what to do with it and assume that it is something the user would want to download. The solution to this problem is to set the content-type to text/plain. This wasn't as straightforward as I thought it would be.
Initially I was going to call the render(…) method of MappingJacksonJsonView but that didn't work because the content-type had already been set to application/json. The solution I came up with was to duplicate some of the code (ugh) inside MappingJacksonJsonView to get the JSON as a string and to then write that to the response:
@RequestMapping
public void processFileUpload(HttpServletResponse response, Model model, ...) {
//Set the content-type and charset of the response
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
//I need to use another OutputStream here; I cannot use the response's OutputStream because that will cause errors
//later on when the JSP needs to render its content (recall that getOutputStream() can only be called exactly once
//on a response). Therefore I'm writing the data to a ByteArrayOutputStream and then writing the byte array from
//the ByteArrayOutputStream to the response manually.
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectMapper objectMapper = new ObjectMapper();
JsonGenerator generator = objectMapper.getJsonFactory().createJsonGenerator(byteArrayOutputStream, JsonEncoding.UTF8);
//Before I can convert the data into JSON, I will need to filter some attributes out of the model (namely BindingResult)
Map<String, Object> result = new HashMap<String, Object>();
for(Map.Entry<String, Object> entry : model.asMap().entrySet()) {
if(!(entry.getValue() instanceof BindingResult)) {
result.put(entry.getKey(), entry.getValue());
objectMapper.writeValue(generator, result);
response.getWriter().write(new String(byteArrayOutputStream.toByteArray(), "UTF8"));
This still seems a little hacky to me. A possible improvement is to annotate the action with @ResponseBody and return the JSON as a string without involving the response at all. If anyone has a better solution, I'm all ears!
Fixing Maven 3.0.3's dependency-resolution performance-regression
TL; DR; version: Maven 3.0.3 has a performance-regression while resolving dependencies. This is because it uses version 1.11 of aether. The problem has been fixed in version 1.12 of aether, but a version of maven with this library is not available. I built maven from source with the 1.12 version of aether, so use maven-3.0.3-with-aether-1.12.zip if you have the same problem.
The whole story: At work we use Maven to build our project. Over the last few months, we started noticing a disparity in build times between different developers even though the hardware they were using was similar to each other (Core i7's with 6 Gb RAM). Initially we suspected that it might have to do with SSD performance-degradation. Some of us were using SSD's that didn't support TRIM and others didn't have TRIM enabled. I was one of the few with the former problem. I secure-erased my drive but still saw no performance benefits. I even got a new drive and even with that I didn't see much of an improvement either.
We finally realized that the build-time disparity was related to the version of maven some developers were using. On maven 3.0b1, build times are much faster compared to 3.0.3. In 3.0.3 there is a performance regression when maven tries to build the dependency graph. For example, using 3.0b1 our project built in 3 minutes and 30 seconds, whereas using 3.0.3, the build times were upwards of 9 minutes. Long build-times take away from the amount of productive coding-time a developer has.
I was determined to find the reason for this performance regression and did some investigation by looking at the source for 3.0b1 and 3.0.3. In 3.0b1, maven uses its own code to resolve dependencies and build the dependency graph, whereas in 3.0.3 it uses the aether library. For more background information on the matter, take a look at this post on the maven developer's mailing list and this JIRA issue.
Long story short, to get better build times, maven needs to use version 1.12 of aether. I downloaded the maven source and edited the pom.xml file to use version 1.12 of aether. I then built maven from source and got a deployable version that uses the newer aether library. When I tested it out, the build times were comparable to 3.0b1.
I initially thought that version 3.0.4 of maven would include version 1.12 of aether. But it turns out that there were licensing changes and so the maven developers are discussing whether to include it. In the meantime, you can use this version of maven that I built from source, which includes version 1.12 of aether. It's a zip file and you can install it like you would normally install maven.
Implementing JSONP in Spring MVC 3.0.x
In Spring 3, it's very easy to get a view to return JSON. However, there is no built-in mechanism to return JSONP. I was able to find a pretty good tutorial That uses Spring's DelegatingFilterProxy. I implemented this solution and I got it to work, but I didn't like the fact that I had to create a separate filter and a bunch of other classes just for that. I also wanted to use a specific extension (.jsonp) for JSONP just to make it more explicit. Spring uses MappingJacksonJsonView to return JSON. I figured that I could extend this view and have it return JSONP instead of JSON.

redpajama_set_name: RedPajamaCommonCrawl


Republicans have sought to limit Medicaid, and a key component of those efforts is requiring that those who receive Medicaid benefits work. But many already do, and others can't, a scholar explains.
Several states now have their first female senator and more than 100 women will enter the House of Representatives.


The Braven BRV-X is an outdoor rugged portable bluetooth speaker which has IPX7 waterproof rating. This portable bluetooth speaker also comes with a 5200mAh power bank which enables you to charge external devices such as your mobile phone. With its shock absorbent and waterproof design, you can take the Braven BRV-X to anywhere from rocky canyons to backyard barbecues.
Designed for outdoor enthusiasts, the Braven BRV-X booms with 12 hours of music playtime, which is perfect for rocky canyons, powdered slopes, raging rapids, sandy dunes or even backyard barbecues. The BRV-X is designed with an IPX7 certified waterproof, shock absorbent, portable body and features a powerful 5200mAh power bank to charge external devices. Customize your listening experience for any environment by choosing indoor or outdoor mode. For an immersive left and right stereo experience, pair two Braven BRV-X speakers together using TrueWireless.
With an IPX7 certified waterproof rating, the BRV-X is protected from rainfall, splashing and can be fully submersed in water one meter deep for up to 30 minutes. Its rugged exterior and impact-resistant frame make it ready for any adventure.
Optimized playback modes can be adjusted for indoor or outdoor listening environments. Outdoor mode provides bright, long-range audio, while indoor mode creates rich sound with deep, full bass.
Take your outdoor listening experience further with the BRV-X Speaker's ability to wirelessly pair to a second speaker. Once paired, rock out in left and right stereo sound.


A collection of our thoughts and ramblings on wine, tastings, and events.
Do 'natural' wines have a place in a healthy lifestyle?
As seen here at Budburst 2016, natural wine brings together all sorts of different people, for different reasons. Where do health concerns come into this? Amongst the crowd was a noticeable contingent of people new to the wine world. Sylvaine ponders wether natural wine means something completely different to this health-conscious crowd.
First of all, let's set things clear, I am neither a doctor nor a nutritionist. For health reasons I have spent a lot of time researching in the domain of nutrition in the past year. Real food has always been close to my heart. My mum and both grannies always had a vege garden and some fruit trees, so I grew up eating a lot of home grown food. All of what you are about to read is based on my own research and understanding. My intention here is not to persuade you to change the way you eat or live but to open up a discussion on what place do natural wines have in our lifestyle choices.
Organic, wholefoods are nothing new. If anything, it's simply what food used to be. But today it seems to be a fast growing movement, getting so big in fact that supermarkets are getting on board and big companies are cleverly using it in their marketing strategies, often at our (the consumers) expense.
Whether what you are looking for is simply organically grown food, gluten free or dairy free products, a vegetarian or Paleo diet, superfoods, supplements… It is clear that we are getting more aware that what we eat directly affects how we feel and how healthy we are as human beings. Consequently, more people are trying to make the right choice on what to put on their plate.
So, what about wine? Do organic/natural wines have a place in a healthy lifestyle?
Are those same people shopping at the health store and ordering their box of organic veges buying organic/natural wines? Or does wine answer to different rules? After all, wine is not vital. Wine is recreational. And isn't alcohol toxic to our systems anyway? Why bother? Let's save our bucks and buy any wine that suits our budget regardless of how it has been produced.
Well, I think yes, organically grown and naturally made wines should be considered too if you care about what goes into your body.
Organic food is grown without the use of harmful fertilisers and synthetic pesticides, GMO plants, growth hormones (meat), and usually not processed using irradiation, industrial solvents or synthetic food additives. Regulations vary from country to country but the idea is to reduce, if not eliminate, potentially dangerous products in the growing and the processing of these foods. Whole foods are foods which are unprocessed and unrefined, or processed and refined as little as possible, before being consumed. Think of whole fruit and vegetables, natural nuts, unpolished grains and beans, meats, non-homogenised dairy products, muscovado sugar...the list goes on.
Looking at these 2 definitions, it is clear that not all organic food is also a 'whole' food, nor all whole foods are organic. We can say that organically farmed products oppose conventionally farmed ones. And whole foods oppose manufactured/processed foods. Your healthiest option would be organic, whole foods in my opinion.
Now I hear you say: Why? What's wrong with processed food?Not all processed food is bad, but the most processed and refined, the less nutrients and vitamins, the less 'life' is left in them. Do you expect our body to function well eating 'dead' food?
Off course, some processing is ok, think sausages, flour, cheese, yoghurt, dried fruits... The idea is to stay as close as possible to the starting product and avoid the excessive amounts of sugar, salt and bad fats often associated with heavily processed food. That applies to organic food too indeed. You can make crisps from organically grown potatoes, using organic sunflower oil and organic salt. It doesn't make it a healthy snack!
Now, let's get back to WINE..
As with our food, we have some wines made from conventionally grown grapes, machine harvested, fermented with commercial selected yeast, and to which a lot of 'modern' winemaking techniques are applied to, before they are bottled and shipped to your supermarket or liquor store. Every time you'll buy a bottle of a one particular wine you are pretty much guaranteed it will taste the same or similar enough to the previous or next bottle of the same wine. Some of these wines can be open for a good while and not spoil. I've had a bottle of such wines which I never finished. After a month in my fridge I expected to find some vinegar. Nope! It has lost most of its fruit flavours but was barely oxidised and not spoiled! If you are the type to enjoy a small glass of wine every now and then but can't afford to waste the rest of the bottle after 4 days, well that sort of wine comes in pretty handy. But it kind of says something about the wine itself too. There are a lot of techniques and products available to winemakers to play with nowadays. If wine labels had to display a list of ingredients, some of them would show a list as long as this paragraph (and that wouldn't even include the different processing techniques applied to the wine). For a snapshot of what is allowed in wine production in NZ, check out the poster from Budburst 2016 below. These are your 'manufactured' wines!
At the other extreme of winemaking you'll find the 'natural' wines. Those wines are usually made from organically or biodynamically grown grapes. If not, it's probably because the winemaker doesn't own his own vineyard, depends on grape growers and hasn't manage to find organically grown vineyards or convinced his growers to switch viticulture methods yet. Here the grapes will be carefully selected and sorted, the fermentation will start naturally with the wild yeasts and the ferments pretty much left to do their job, under a watchful eye but with minimum manipulation or intervention. The wines might go through a coarse filtration and small addition of sulfur dioxide at bottling and that's it! You have some fermented grape juice which may be a bit cloudy, show some sediments after a while in bottle and may taste quite different from a bottle to another. Because: it's alive! And living things change! Those wines are not standardised and can be a bit more fragile (spoil easily) but they also offer a unique experience every time you open a new bottle!
The 2 examples above are at the extremes. There are a lot of variants in between. Some wines may be organic with a lot of manipulation, some may be grown in a sustainable way with careful handling in the winery. Every combination is possible. Just as with our food.
But I'm asking: does it matter, for your health's sake, which type of wine you drink? Do natural wines have a place in a healthy lifestyle? Or is it just a fad? Hippie, wacky stuff?
I think you know my point of view on the subject. What's yours?
Be the first to know about upcoming tastings, events and other wine happenings.


After studying zoology in Edinburgh, I went to Glasgow and qualified as a veterinary surgeon in 2004. After working in Ayrshire and Yorkshire, I later settled in the North East and have been here for ten years.
I am an active member of the Cleveland concert band and play the Clarinet. I enjoy keeping fit by training for triathlons. I have a busy home life looking after Super Jeff the rabbit, Jimmy ginger cat and Tia my beautiful elderly spaniel. I am currently working at a certificate in small animal surgery so my knowledge is expanded for the future.
I have lived in Portugal my whole life in a little place called Guimaes, where I studied at the universidade De Lisboa Faculdade De Medicina Veterinaria qualifying in 2016. It wasn't until February 2017 I decided to move to England to expand my knowledge and skills in a small animal practice.
My main interests is in feline medicine. In my spare time I love reading horror books, but if I was to choose an author I love JK Rowling and her Harry Potter novels.
After qualifying in 2016 from the Universidade Lusofona de Humanidades e Tecnologias, Lisbon Portugal. I made the decision to move to sunny England to work for Vets4Pets. I really love to play with my dogs, going to the cinema, visiting historical sites, museums and travelling plus spending time with family and friends. I have a keen interest in soft tissue and orthopaedic surgeries.
I graduated from the University of Bern in Switzerland in December 2015 and worked in different private practices in and near Geneva for a year and a half. I then moved to England to start a rotating internship in a referral Hospital which ended in September 2018.
Since, I am working at Vets4Pets in Middlesbrough to expand my skills in first opinion practices in the UK. I like all aspect of veterinary medicine but particularly enjoy surgery in which I would like to specialize later..
I qualified from Myerscough College in 2005. I specialise in surgical and in turn have gained a BSAVA merit surgical Award. I am also a coach with an A1 assessor award.
I have a keen interest in surgical and behaviour and enjoy leading my team of nurses, who I have coached from the beginning of their career.I am really proud of what a strong team I have and work alongside here at Middlesbrough.
I qualified from Myerscough College in 2015, with a honours degree in Veterinary nursing.
I have a keen interest in rabbits and small fury's and really enjoy hosting our puppy party class weekly here at the practice.
I started working here July 2014 as a student veterinary nurse, I studied at Myerscough College and have recently qualified in June 2017. The best bits of my job are seeing the puppies on a daily basis and looking after your pets post operation.
I have been here since the practice opened in 2009. I am the animal health care assistant and my main focus is weight management as I love to tackle pet obesity. I have two adorable dachshunds called Dougal and Dexter.
I really love meeting new people and working with such a great team, I also love helping out in surgery and making sure your pets are comfortable and settled after their operation.
I started working at Vets4pets October 2015, my main responsibility is social media and customer service. I really enjoy working at Vets4pets because I work with such a fabulous team, and get to be one of the first people to meet and greet your pet into our surgery.
When I'm not at work I enjoy walking my two cheeky Chihuahuas Teddy and Percy.
I started working here January 2015, after returning from maternity leave I work two days a week looking after all your customer needs. I love seeing old and new patients as each pet has a different personality. At home I have a German Shepherd dog called Rosie.
I'm one of the client care coordinators and I have been working here since June 2018. I look after your customer needs and greet your pets into the practice. I have no pets at home so it's a lovely change coming in to see a different variety of animals every day. One of my favourite things is having puppy cuddles during the week here.
I have been working at Vets4Pets as a client care co-ordinator part time since October 2018. I am responsible for looking after client needs and making sure that their pets have a comfortable visit. We have a good working team here in the Middlesbrough branch and it's a pleasure to work with such good kind colleagues and friends. At home I have a cheeky but adorable border collie named Louie.
I started here in March 2016, I look after financials and insurance, I really like seeing all the variety of dogs that come into the practice, and love puppy cuddles. At home I have a dog called Harvey and a wonderful lizard called Eddie.


text:
NEW RIHANNA UNVEILS NEW FRAGRANCE CRUSH
Labels: rihanna new perfume, RIHANNA UNVEILS NEW FRAGRANCE CRUSH
RiRi's got another fragrance for you. This time, the Grammy-winning, chart-topping songstress debuts Crush by Rihanna.
The second fragrance in her namesake RiRi collection (following last year's RiRi) is said to be "empowering, strong, confident, and unapologetic," as a "mysteriously sexy and provocative scent," according to its press release.
The clear bottle, which Rihanna also designed, has a golden, elegant look while the box matches that aesthetic, adding a touch of pink to set things off.
Posted by House Of Glitz at 6/16/2016 0 comments Links to this post
ICON MISSY ELLIOT TO BE HONORED AT VH1'S HIP HOP HONORS
Labels: ICON MISSY ELLIOT TO BE HONORED AT VH1 HIP HOP HONORS, VH1 HIP HOP HONORS
All hail Missy Elliott.
VH1 has announced that the rap icon will join Queen Latifah as the second confirmed honoree at this year's "Hip Hop Honors: All Hail the Queens" event, which is slated to air live from New York on July 11 at 9 p.m. ET.
Missy's success in hip-hop has garnered her critical praise and commercial acclaim. All six of the Grammy-winning rapper's studio albums have gone platinum or better and she's the only female MC to have that distinction. Overall, she's sold more than 30 million albums worldwide.
Additional honorees for this year will be announced later this week.
"Hip Hop Honors" has been on a hiatus for six years, but it's back now to celebrate "female pioneers, trailblazers, and trend-setters." In the past, the show has honored acts like Public Enemy, Tupac Shakur, and the Notorious B.I.G.
Missy Elliott is definitely no stranger to the show. She was also recognized at the 4th annual "Hip Hop Honors." A video of the tribute performance featuring Ciara, Timbaland, Eve, Keyshia Cole, and .
VIDEO: ICE CUBE, BIG SEAN, & A$AP ROCKY TURN THEIR HITS INTO KIDZ BOP TRACKS
Labels: & A$AP ROCKY TURN THEIR HITS INTO KIDZ BOP TRACKS, BIG SEAN, BOB TRACKS, ICE CUBE
Ice Cube and Jimmy Kimmel give hip-hop a Kidz Bop twist with the help of Big Sean, Lil Jon, Ty Dolla $ign, and A$AP Rocky.
The rap stars joined "Jimmy Kimmel Live!" for a hilarious bit where a joint like Sean's "IDFWU," for example, turns into "I Can't Tie My Shoes," and N.W.A's "F**k Tha Police" becomes "Hug Tha Police."
"I've been seeing this Kidz Bop bullshit for years," Cube says in the clip. "It got me thinking, 'Why can't we do a Kidz Bop with hip-hop?'"
Elsewhere, Ty's "Paranoid" becomes a song about baths, Lil Jon's "Get Low" morphs into a track about tetherball, and Rocky's "F**kin' Problems" is all about toy trucks.
Interestingly enough, Kidz Bop actually has flipped rap songs into child-friendly joints in the past. That includes Flo Rida's "My House," Macklemore's "Thrift Shop," and Wiz Khalifa's Charlie Puth-assisted "See You Again."
USHER & YUNA PERFORM 'CRUSH' AT THE ROOTS PICNIC
Labels: USHER, USHER AND YUNA PERFORM 'CRUSH' AT THE ROOTS PICNIC
Getting it in....Leave it to Usher and Yuna to "Crush" a duet.
The soulful duo teamed up for a performance of their collaboration off Yuna's Chapters at The Roots Picnic 2016, the annual Philadelphia show put on by the legendary Roots crew.
"So grateful that Usher and The Roots invited me to perform 'Crush' during his set at The Roots Picnic 2016, Penn's Landing, Philadelphia," said Yuna.
"Crush" is a single off Yuna's third studio album Chapters, which dropped last month.
For his part, Mr. Raymond has been keeping busy this week, releasing two new singles: "Crash" and the Young Thug-assisted "No Limit."
To watch how their chemistry translates on stage, check out the performance below.
ICON MISSY ELLIOT TO BE HONORED AT VH1'S HIP HOP H...
VIDEO: ICE CUBE, BIG SEAN, & A$AP ROCKY TURN THEIR...


Buscada designed the exhibition graphics and orienting information for this exhibition of photographs along Broadway's length by architectural photographer Cervin Robinson.
Curated by Gary Van Zante and exhibited at the MIT Wolk Gallery and the Municipal Art Society, New York, the exhibition required a design strategy that positioned the images on map and provided a key to their location as well as referencing a brief architectural history.
Images copyright : Gabrielle Bendiner-Viani, Cervin Robinson, Judith Daniels, Elizabeth Werbe.


.of the Azerbaijani exclave of Naxçıvan (lying wholly within Armenia) was almost entirely ethnic Azerbaijani, whereas the enclave of Nagorno-Karabakh (lying wholly within Azerbaijan) was predominantly ethnic Armenian.
Oganesson is a synthetic chemical element with symbol Og and atomic number 118. It was first synthesized in 2002 at the Joint Institute for Nuclear Research (JINR) in Dubna, Russia by a joint team of Russian and American scientists.In December 2015, it was recognized as one of four new elements by the Joint Working Party of the .
Acid Plant Database April 27, 201 8. The information in this database is believed to be current. If there are any errors or omissions please notify .
Empowering activists and communities opposed to mining through information on global mining trends, specific projects and mining industry .