This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#a remote call calls this method of the controller. | |
def purposes | |
@purpose = Purpose.new(params[:purpose]) | |
@purpose.fidelity_report_id = params[:fidelity_report_id] | |
@purpose.user_id = @user.id | |
@purpose.save | |
respond_to do |format| | |
format.js {} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This generates the form | |
<% @fidelity_report.send_froms.where(:attached=>true).each do |send_from| %> | |
<% if send_from.id==nil; next; end #don't generate a record for the new one%> | |
<%= form_for(send_from, :url=>fidelity_report_report_entities_send_froms_path(@fidelity_report,@send_from), :remote=>true) do |f| %> | |
to: <%= send_from.content %> <%= f.check_box :attached, :onchange => "detachEntity(this)"%> <%= f.label :attached %> | |
<%=f.hidden_field :id %> | |
<% end %> | |
<% end %> | |
#This is the generated section of html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package helloworld; | |
import javax.swing.JColorChooser; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.colorchooser.AbstractColorChooserPanel; | |
import java.awt.*; | |
import java.awt.event.MouseAdapter; | |
import java.awt.event.MouseEvent; | |
import java.awt.geom.Rectangle2D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I request the base file in my app I get the following output to the console. | |
Rendered home/index.html.erb within layouts/application (1.5ms) | |
Completed 500 Internal Server Error in 1091ms (ActiveRecord: 0.0ms) | |
2: <html> | |
3: <head> | |
4: <title>Fidelity</title> | |
5: <%= stylesheet_link_tag "application", :media => "all" %> | |
6: <%= javascript_include_tag "application" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package helloworld; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.JScrollPane; | |
import javax.swing.JTable; | |
import javax.swing.WindowConstants; | |
import javax.swing.table.AbstractTableModel; | |
import javax.swing.table.TableColumn; | |
import javax.swing.table.TableColumnModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__kernel void calculateForces( __global float* positions, __global int* connections, __global float* forces){ | |
int i = get_global_id(0); | |
if(i<999){ | |
int a = connections[2*i]; | |
int b = connections[2*i + 1]; | |
float delta = positions[b] - positions[a]; | |
forces[a] += delta; | |
forces[b] -= delta; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#ifdef __APPLE__ | |
#include <OpenCL/cl.h> | |
#else | |
#include <CL/cl.h> | |
#endif | |
const int N = 1000; //number of points. | |
const float dx = 1.0/(N-1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean missing = false; | |
for(B b: collectionB){ | |
boolean found = false; | |
for(A a: collectionA){ | |
if(b.getField().equals(a.getField())){ | |
found=true; | |
break; | |
} | |
} | |
if(!found){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JEditorPane; | |
import javax.swing.JFrame; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Created on 11.05.17. | |
*/ | |
public class OthmEditor { | |
List<String> lines = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
public class OptionOptions{ | |
public static void main(String[] args){ | |
while(true){ | |
String[] options = {"OK", "NOT OK"}; | |
String message = "What"; | |
int n = JOptionPane.showOptionDialog(null, message, "Nytt smycke", JOptionPane.OK_CANCEL_OPTION, |
OlderNewer