Search Results

Search found 163 results on 7 pages for 'tf rz'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • catching a deadlock in a simple odd-even sending

    - by user562264
    I'm trying to solve a simple problem with MPI, my implementation is MPICH2 and my code is in fortran. I have used the blocking send and receive, the idea is so simple but when I run it it crashes!!! I have absolutely no idea what is wrong? can anyone make quote on this issue please? there is a piece of the code: integer,parameter::IM=100,JM=100 REAL,ALLOCATABLE ::T(:,:),TF(:,:) CALL MPI_COMM_RANK(MPI_COMM_WORLD,RNK,IERR) CALL MPI_COMM_SIZE(MPI_COMM_WORLD,SIZ,IERR) prv = rnk-1 nxt = rnk+1 LIM = INT(IM/SIZ) IF (rnk==0) THEN ALLOCATE(TF(IM,JM)) prv = MPI_PROC_NULL ELSEIF(rnk==siz-1) THEN NXT = MPI_PROC_NULL LIM = LIM+MOD(IM,SIZ) END IF IF (MOD(RNK,2)==0) THEN CALL MPI_SEND(T(2,:),JM+2,MPI_REAL,PRV,10,MPI_COMM_WORLD,IERR) CALL MPI_RECV(T(1,:),JM+2,MPI_REAL,PRV,20,MPI_COMM_WORLD,STAT,IERR) ELSE CALL MPI_RECV(T(LIM+2,:),JM+2,MPI_REAL,NXT,10,MPI_COMM_WORLD,STAT,IERR) CALL MPI_SEND(T(LIM+1,:),JM+2,MPI_REAL,NXT,20,MPI_COMM_WORLD,IERR) END IF as I understood even processes are not receiving anything while the odd ones finish sending successfully, in some cases when I added some print to observe what is going on I saw that the variable NXT is changing during the sending procedure!!! for example all the odd process was sending message to process 0 not their next one!

    Read the article

  • Serialize XML child and keep namespaces in Java

    - by Guido García
    I have an Document object that is modeling a XML like this one: <RootNode xmlns="http://a.com/a" xmlns:b="http://b.com/b"> <Child /> </RootNode> Using Java DOM, I need to get the <Child> node and serialize it to XML, but keeping the root node namespaces. This is what I currently have, but it does not serialize the namespaces: public static void main(String[] args) throws Exception { String xml = "<RootNode xmlns='http://a.com/a' xmlns:b='http://b.com/b'><Child /></RootNode>"; DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes())); Node childNode = doc.getFirstChild().getFirstChild(); // serialize to string StringWriter sw = new StringWriter(); DOMSource domSource = new DOMSource(childNode); StreamResult streamResult = new StreamResult(sw); TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); serializer.transform(domSource, streamResult); String serializedXML = sw.toString(); System.out.println(serializedXML); } Current output: <?xml version="1.0" encoding="UTF-8"?> <Child/> Expected output: <?xml version="1.0" encoding="UTF-8"?> <Child xmlns='http://a.com/a' xmlns:b='http://b.com/b' />

    Read the article

  • "no inclosing instance error " while getting top term frequencies for document from Lucene index

    - by Julia
    Hello ! I am trying to get the most occurring term frequencies for every particular document in Lucene index. I am trying to set the treshold of top occuring terms that I care about, maybe 20 However, I am getting the "no inclosing instance of type DisplayTermVectors is accessible" when calling Comparator... So to this function I pass vector of every document and max top terms i would like to know protected static Collection getTopTerms(TermFreqVector tfv, int maxTerms){ String[] terms = tfv.getTerms(); int[] tFreqs = tfv.getTermFrequencies(); List result = new ArrayList(terms.length); for (int i = 0; i < tFreqs.length; i++) { TermFrq tf = new TermFrq(terms[i], tFreqs[i]); result.add(tf); } Collections.sort(result, new FreqComparator()); if(maxTerms < result.size()){ result = result.subList(0, maxTerms); } return result; } /Class for objects to hold the term/freq pairs/ static class TermFrq{ private String term; private int freq; public TermFrq(String term,int freq){ this.term = term; this.freq = freq; } public String getTerm(){ return this.term; } public int getFreq(){ return this.freq; } } /*Comparator to compare the objects by the frequency*/ class FreqComparator implements Comparator{ public int compare(Object pair1, Object pair2){ int f1 = ((TermFrq)pair1).getFreq(); int f2 = ((TermFrq)pair2).getFreq(); if(f1 > f2) return 1; else if(f1 < f2) return -1; else return 0; } } Explanations and corrections i will very much appreciate, and also if someone else had experience with term frequency extraction and did it better way, I am opened to all suggestions! Please help!!!! Thanx!

    Read the article

  • Androids ExpandableListView - where to put the button listener for buttons that are children

    - by CommonKnowledge
    I have been playing around a lot with the ExpandableListView and I cannot figure out where to add the button listeners for the button that will be the children in the view. I did manage to get a button listener working that uses getChildView() below, but it seems to be the same listener for all the buttons. The best case scenario is that I would be able to implement the button listeners in the class that instantiates the ExpandableListAdapter class, and not have to put the listeners in the actual ExpandableListAdapter class. At this point I don't even know if that is possible I have been experimenting with this tutorial/code: HERE getChildView() @Override public View getChildView(int set_new, int child_position, boolean view, View view1, ViewGroup view_group1) { ChildHolder childHolder; if (view1 == null) { view1 = LayoutInflater.from(info_context).inflate(R.layout.list_group_item_lv, null); childHolder = new ChildHolder(); childHolder.section_btn = (Button)view1.findViewById(R.id.item_title); view1.setTag(childHolder); childHolder.section_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(info_context, "button pushed", Toast.LENGTH_SHORT).show(); } }); }else { childHolder = (ChildHolder) view1.getTag(); } childHolder.section_btn.setText(children_collection.get(set_new).GroupItemCollection.get(child_position).section); Typeface tf = Typeface.createFromAsset(info_context.getAssets(), "fonts/AGENCYR.TTF"); childHolder.section_btn.setTypeface(tf); return view1; } Any help would be much appreciated. Thank you and I will be standing by.

    Read the article

  • PHP: problem rendering large images (error 321)

    - by JP19
    Hi ... its me again with a php problem :) Following is part of my PHP script which is rendering JPEG images. ... $tf=$requested_file; $image_type="jpeg"; header("Content-type: image/${image_type}"); $CMD="\$image=imagecreatefrom${image_type}('$tf'); image${image_type}(\$image);"; eval($CMD); exit; ... There is no syntactical error, because above code is working fine for small images, but for large images, it gives: Error 321 (net::ERR_INVALID_CHUNKED_ENCODING): Unknown error. in the browser. To be sure, I created two images using imagemagick from same source image - one resized to 10% of original and other 90%. http://mostpopularsports.net/images/misc/ttt10.jpg works http://mostpopularsports.net/images/misc/ttt90.jpg gives Error 301 in the browser. There is a related question with solution posted by OP here Error writing content through Apache. but I cannot understand how to make the fix. Can someome help me with it? I have looked at the headers in Chrome. For the first request, everything is fine. For the second request - the request headers are all garbled. Both images are jpeg (as they are created from imagemagick. But still to be sure I checked): misc/ttt10.jpg: JPEG image data, JFIF standard 1.01 misc/ttt90.jpg: JPEG image data, JFIF standard 1.01 Finally, the way I fixed is, remove the Transfer-Encoding: chunked header from the response. [This header was sent by apache only when the data was large enough]. (I had an internal proxy, so did it in the proxy script - otherwise one may need to do it in apache settings). There were some good answers and I have selected the one that helped me solve the problem best. thanks JP

    Read the article

  • Clear button at uisearchbar not working at all

    - by kevin.ng
    I created a search bar programmatically and added to my view using the codes below: - (void)viewDidLoad { searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(xPositionForSearchBar, yPositionForSearchBar, widthForSearchBar, heightForSearchBar)]; UIView *bg = [[searchBar subviews] objectAtIndex:0]; searchBar.delegate = self; searchBar.placeholder = @"Search record"; for(UIView *view in searchBar.subviews){ if([view isKindOfClass:[UITextField class]]){ UITextField *tf = (UITextField *)view; tf.delegate = self; break; } } [bg removeFromSuperview]; [self.view addSubview: searchBar]; } The code is implemented with UISearchBarDelegate and UITextFieldDelegate. I have tried using - (void)searchBarCancelButtonClicked:(UISearchBar *)aSearchBar { NSLog(@"cancel clicked"); searchBar.text = @""; [aSearchBar resignFirstResponder]; } - (BOOL)textFieldShouldClear:(UITextField *)textField { NSLog(@"clear"); [self performSelector:@selector(searchBarCancelButtonClicked:) withObject:searchBar afterDelay: 0.1]; return YES; } and yet, the text inside the searchBar is not cleared at all when i click on the "clear button" - a circle with a "X" inside. The clear button works when I implemented it in IB. Wonder why? Kindly advice, many thanks.

    Read the article

  • Error using 'send_file' for ruby/rails - help appreciated

    - by user1653279
    I am trying to create a link to download a file from the file system. For this, I define the following in the "license_helper.rb" file: def license_download_link(license, link_text = nil) if link_text.blank? link_text = image_tag("download_icon.png", :border => 0, :width => 32, :height =>32, :alt => 'Download License', :title => 'Download License') end tempLicenseFile = "tempLicense.xml" File.open("#{tempLicenseFile}", 'w') do |tf| tf.puts license.data end command = "./runLicenseEncoder.bat #{tempLicenseFile}" generateEncryptedLicenseFile = `#{command}` theLicenseFile = "license.xml" link_to link_text, "license/download" end My "view" just calls this helper class: <td><%= license_download_link(license, ' ') %></td> In the 'routes.rb' file, I have defined the following: map.licensedownload "license.xml", :controller = 'licenses', :action = 'download' map.download "/licenses/download", :controller = 'licenses', :action = 'download' In the 'controller', I have 'licenses_controller.rb' which includes the following: def download theLicense = @license licenseFileName = "license.xml" send_file "#{licenseFileName}" , :type => "application/xml", :filename => "#{licenseFileName}" end However, I am unable to obtain the '@license' attribute from the database in the controller. Could someone please let me know what I am doing wrong here and why I am unable to get the value for "@license". Thanks for your time, Regards, --- AJ

    Read the article

  • Relating text fields to check boxes in Java

    - by Finzz
    This program requires the user to login and request a database to access. The program then gets a connection object, searches through the database storing the column names into a vector for later use. The problem comes with implementing text fields to allow the user to search for specific values within the database. I can get the check boxes and text fields to appear using a gridlayout and add them to a panel. How do I relate the text fields to their appropriate check box? I've tried adding them to a vector, but then they can't also be added to the panel as well. I've searched for a way to name the text fields as the loop cycles through the column names, but it seems impossible to do without having them declared ahead of time. This can't be done either, as it's impossible to determine the attributes that the user will request. I just need to be able to know the names of the text fields so I can test to see if the user entered information and perform the necessary logic. Let me know if you have to see the rest of the code to give an answer, but hopefully you get the general idea of what I'm trying to accomplish. Picture of UI: try { ResultSet r2 = con.getMetaData().getColumns("", "", rb.getText(), ""); colNames1 = new Vector<String>(); columns1 = new Vector<JCheckBox>(); while (r2.next()) { colNames1.add(r2.getString(4)); JCheckBox cb = new JCheckBox(r2.getString(4)); JTextField tf = new JTextField(10); columns1.add(cb); p3.add(cb); p3.add(tf); } }

    Read the article

  • How does gluLookAt work?

    - by Chan
    From my understanding, gluLookAt( eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z ); is equivalent to: glRotatef(B, 0.0, 0.0, 1.0); glRotatef(A, wx, wy, wz); glTranslatef(-eye_x, -eye_y, -eye_z); But when I print out the ModelView matrix, the call to glTranslatef() doesn't seem to work properly. Here is the code snippet: #include <stdlib.h> #include <stdio.h> #include <GL/glut.h> #include <iomanip> #include <iostream> #include <string> using namespace std; static const int Rx = 0; static const int Ry = 1; static const int Rz = 2; static const int Ux = 4; static const int Uy = 5; static const int Uz = 6; static const int Ax = 8; static const int Ay = 9; static const int Az = 10; static const int Tx = 12; static const int Ty = 13; static const int Tz = 14; void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); GLfloat lmodel_ambient[] = { 0.8, 0.0, 0.0, 0.0 }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); } void displayModelviewMatrix(float MV[16]) { int SPACING = 12; cout << left; cout << "\tMODELVIEW MATRIX\n"; cout << "--------------------------------------------------" << endl; cout << setw(SPACING) << "R" << setw(SPACING) << "U" << setw(SPACING) << "A" << setw(SPACING) << "T" << endl; cout << "--------------------------------------------------" << endl; cout << setw(SPACING) << MV[Rx] << setw(SPACING) << MV[Ux] << setw(SPACING) << MV[Ax] << setw(SPACING) << MV[Tx] << endl; cout << setw(SPACING) << MV[Ry] << setw(SPACING) << MV[Uy] << setw(SPACING) << MV[Ay] << setw(SPACING) << MV[Ty] << endl; cout << setw(SPACING) << MV[Rz] << setw(SPACING) << MV[Uz] << setw(SPACING) << MV[Az] << setw(SPACING) << MV[Tz] << endl; cout << setw(SPACING) << MV[3] << setw(SPACING) << MV[7] << setw(SPACING) << MV[11] << setw(SPACING) << MV[15] << endl; cout << "--------------------------------------------------" << endl; cout << endl; } void reshape(int w, int h) { float ratio = static_cast<float>(w)/h; glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, ratio, 1.0, 425.0); } void draw() { float m[16]; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glGetFloatv(GL_MODELVIEW_MATRIX, m); gluLookAt( 300.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f ); glColor3f(1.0, 0.0, 0.0); glutSolidCube(100.0); glGetFloatv(GL_MODELVIEW_MATRIX, m); displayModelviewMatrix(m); glutSwapBuffers(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(400, 400); glutInitWindowPosition(100, 100); glutCreateWindow("Demo"); glutReshapeFunc(reshape); glutDisplayFunc(draw); init(); glutMainLoop(); return 0; } No matter what value I use for the eye vector: 300, 0, 0 or 0, 300, 0 or 0, 0, 300 the translation vector is the same, which doesn't make any sense because the order of code is in backward order so glTranslatef should run first, then the 2 rotations. Plus, the rotation matrix, is completely independent of the translation column (in the ModelView matrix), then what would cause this weird behavior? Here is the output with the eye vector is (0.0f, 300.0f, 0.0f) MODELVIEW MATRIX -------------------------------------------------- R U A T -------------------------------------------------- 0 0 0 0 0 0 0 0 0 1 0 -300 0 0 0 1 -------------------------------------------------- I would expect the T column to be (0, -300, 0)! So could anyone help me explain this? The implementation of gluLookAt from http://www.mesa3d.org void GLAPIENTRY gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz) { float forward[3], side[3], up[3]; GLfloat m[4][4]; forward[0] = centerx - eyex; forward[1] = centery - eyey; forward[2] = centerz - eyez; up[0] = upx; up[1] = upy; up[2] = upz; normalize(forward); /* Side = forward x up */ cross(forward, up, side); normalize(side); /* Recompute up as: up = side x forward */ cross(side, forward, up); __gluMakeIdentityf(&m[0][0]); m[0][0] = side[0]; m[1][0] = side[1]; m[2][0] = side[2]; m[0][1] = up[0]; m[1][1] = up[1]; m[2][1] = up[2]; m[0][2] = -forward[0]; m[1][2] = -forward[1]; m[2][2] = -forward[2]; glMultMatrixf(&m[0][0]); glTranslated(-eyex, -eyey, -eyez); }

    Read the article

  • VIM UI language issue

    - by AlexParamonov
    I am using VIM for a while, but never faces such a problem. When i connect to my desktop Ubuntu PC via ssh from a tablet (Asus tf Prime) using terminal emulator (screen-256-colors) I got my vim in Chinese... On desktop it is correctly working in English. I've tried to set set langmenu=en_US.UTF-8 language en_US.UTF-8 but it do not help... See screenshot You may find my configuration on github

    Read the article

  • Java JPanel not showing up....

    - by user69514
    I'm not sure what I am doing wrong, but the text for my JPanels is not showing up. I just get the question number text, but the question is not showing up. Any ideas what I am doing wrong? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class NewFrame extends JFrame { JPanel centerpanel; // For the questions. CardLayout card; // For the centerpanel. JTextField tf; // Used in question 1. boolean // Store selections for Q2. q2Option1, q2Option2, q2Option3, q2Option4; JList q4List; // For question 4. double // Score on each question. q1Score = 0, q2Score = 0, q3Score = 0, q4Score = 0; // Constructor. public NewFrame (int width, int height) { this.setTitle ("Snoot Club Membership Test"); this.setResizable (true); this.setSize (width, height); Container cPane = this.getContentPane(); // cPane.setLayout (new BorderLayout()); // First, a welcome message, as a Label. JLabel L = new JLabel ("<html><b>Are you elitist enough for our exclusive club?" + " <br>Fill out the form and find out</b></html>"); L.setForeground (Color.blue); cPane.add (L, BorderLayout.NORTH); // Now the center panel with the questions. card = new CardLayout (); centerpanel = new JPanel (); centerpanel.setLayout (card); centerpanel.setOpaque (false); // Each question will be created in a separate method. // The cardlayout requires a label as second parameter. centerpanel.add (firstQuestion (), "1"); centerpanel.add (secondQuestion(), "2"); centerpanel.add (thirdQuestion(), "3"); centerpanel.add (fourthQuestion(), "4"); cPane.add (centerpanel, BorderLayout.CENTER); // Next, a panel of four buttons at the bottom. // The four buttons: quit, submit, next-question, previous-question. JPanel bottomPanel = getBottomPanel (); cPane.add (bottomPanel, BorderLayout.SOUTH); // Finally, show the frame. this.setVisible (true); } // No-parameter constructor. public NewFrame () { this (500, 300); } // The first question uses labels for the question and // gets input via a textfield. A panel containing all // these things is returned. The question asks for // a vacation destination: the more exotic the location, // the higher the score. JPanel firstQuestion () { // We will package everything into a panel and return the panel. JPanel subpanel = new JPanel (); // We will place things in a single column, so // a GridLayout with one column is appropriate. subpanel.setLayout (new GridLayout (8,1)); JLabel L1 = new JLabel ("Question 1:"); L1.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L1); JLabel L2 = new JLabel (" Select a vacation destination"); L2.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L2); JLabel L3 = new JLabel (" 1. Baltimore"); L3.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L3); JLabel L4 = new JLabel (" 2. Disneyland"); L4.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L4); JLabel L5 = new JLabel (" 3. Grand Canyon"); L5.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L5); JLabel L6 = new JLabel (" 4. French Riviera"); L6.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L6); JLabel L7 = new JLabel ("Enter 1,2,3 or 4 below:"); L7.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L7); // Here's the textfield to get user-input. tf = new JTextField (); tf.addActionListener ( new ActionListener () { // This interface has only one method. public void actionPerformed (ActionEvent a) { String q1String = a.getActionCommand(); if (q1String.equals ("2")) q1Score = 2; else if (q1String.equals ("3")) q1Score = 3; else if (q1String.equals ("4")) q1Score = 4; else q1Score = 1; } } ); subpanel.add (tf); return subpanel; } // For the second question, a collection of checkboxes // will be used. More than one selection can be made. // A listener is required for each checkbox. The state // of each checkbox is recorded. JPanel secondQuestion () { JPanel subpanel = new JPanel (); subpanel.setLayout (new GridLayout (7,1)); JLabel L1 = new JLabel ("Question 2:"); L1.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L1); JLabel L2 = new JLabel (" Select ONE OR MORE things that "); L2.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L2); JLabel L3 = new JLabel (" you put into your lunch sandwich"); L3.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L3); // Initialize the selections to false. q2Option1 = q2Option2 = q2Option3 = q2Option4 = false; // First checkbox. JCheckBox c1 = new JCheckBox ("Ham, beef or turkey"); c1.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JCheckBox c = (JCheckBox) i.getSource(); q2Option1 = c.isSelected(); } } ); subpanel.add (c1); // Second checkbox. JCheckBox c2 = new JCheckBox ("Cheese"); c2.addItemListener ( new ItemListener () { // This is where we will react to a change in checkbox. public void itemStateChanged (ItemEvent i) { JCheckBox c = (JCheckBox) i.getSource(); q2Option2 = c.isSelected(); } } ); subpanel.add (c2); // Third checkbox. JCheckBox c3 = new JCheckBox ("Sun-dried Arugula leaves"); c3.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JCheckBox c = (JCheckBox) i.getSource(); q2Option3 = c.isSelected(); } } ); subpanel.add (c3); // Fourth checkbox. JCheckBox c4 = new JCheckBox ("Lemon-enhanced smoked Siberian caviar"); c4.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JCheckBox c = (JCheckBox) i.getSource(); q2Option4 = c.isSelected(); } } ); subpanel.add (c4); return subpanel; } // The third question allows only one among four choices // to be selected. We will use radio buttons. JPanel thirdQuestion () { JPanel subpanel = new JPanel (); subpanel.setLayout (new GridLayout (6,1)); JLabel L1 = new JLabel ("Question 3:"); L1.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L1); JLabel L2 = new JLabel (" And which mustard do you use?"); L2.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L2); // First, create the ButtonGroup instance. // We will add radio buttons to this group. ButtonGroup bGroup = new ButtonGroup(); // First checkbox. JRadioButton r1 = new JRadioButton ("Who cares?"); r1.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JRadioButton r = (JRadioButton) i.getSource(); if (r.isSelected()) q3Score = 1; } } ); bGroup.add (r1); subpanel.add (r1); // Second checkbox. JRadioButton r2 = new JRadioButton ("Safeway Brand"); r2.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JRadioButton r = (JRadioButton) i.getSource(); if (r.isSelected()) q3Score = 2; } } ); bGroup.add (r2); subpanel.add (r2); // Third checkbox. JRadioButton r3 = new JRadioButton ("Fleishman's"); r3.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JRadioButton r = (JRadioButton) i.getSource(); if (r.isSelected()) q3Score = 3; } } ); bGroup.add (r3); subpanel.add (r3); // Fourth checkbox. JRadioButton r4 = new JRadioButton ("Grey Poupon"); r4.addItemListener ( new ItemListener () { public void itemStateChanged (ItemEvent i) { JRadioButton r = (JRadioButton) i.getSource(); if (r.isSelected()) q3Score = 4; } } ); bGroup.add (r4); subpanel.add (r4); return subpanel; } // For the fourth question we will use a drop-down Choice. JPanel fourthQuestion () { JPanel subpanel = new JPanel (); subpanel.setLayout (new GridLayout (3,1)); JLabel L1 = new JLabel ("Question 4:"); L1.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L1); JLabel L2 = new JLabel (" Your movie preference, among these:"); L2.setFont (new Font ("SansSerif", Font.ITALIC, 15)); subpanel.add (L2); // Create a JList with options. String[] movies = { "Lethal Weapon IV", "Titanic", "Saving Private Ryan", "Le Art Movie avec subtitles"}; q4List = new JList (movies); q4Score = 1; q4List.addListSelectionListener ( new ListSelectionListener () { public void valueChanged (ListSelectionEvent e) { q4Score = 1 + q4List.getSelectedIndex(); } } ); subpanel.add (q4List); return subpanel; } void computeResult () { // Clear the center panel. centerpanel.removeAll(); // Create a new panel to display in the center. JPanel subpanel = new JPanel (new GridLayout (5,1)); // Score on question 1. JLabel L1 = new JLabel ("Score on question 1: " + q1Score); L1.setFont (new Font ("Serif", Font.ITALIC, 15)); subpanel.add (L1); // Score on question 2. if (q2Option1) q2Score += 1; if (q2Option2) q2Score += 2; if (q2Option3) q2Score += 3; if (q2Option4) q2Score += 4; q2Score = 0.6 * q2Score; JLabel L2 = new JLabel ("Score on question 2: " + q2Score); L2.setFont (new Font ("Serif", Font.ITALIC, 15)); subpanel.add (L2); // Score on question 3. JLabel L3 = new JLabel ("Score on question 3: " + q3Score); L3.setFont (new Font ("Serif", Font.ITALIC, 15)); subpanel.add (L3); // Score on question 4. JLabel L4 = new JLabel ("Score on question 4: " + q4Score); L4.setFont (new Font ("Serif", Font.ITALIC, 15)); subpanel.add (L4); // Weighted score. double avg = (q1Score + q2Score + q3Score + q4Score) / (double) 4; JLabel L5; if (avg <= 3.5) L5 = new JLabel ("Your average score: " + avg + " - REJECTED!"); else L5 = new JLabel ("Your average score: " + avg + " - WELCOME!"); L5.setFont (new Font ("Serif", Font.BOLD, 20)); //L5.setAlignment (JLabel.CENTER); subpanel.add (L5); // Now add the new subpanel. centerpanel.add (subpanel, "5"); // Need to mark the centerpanel as "altered" centerpanel.invalidate(); // Everything "invalid" (e.g., the centerpanel above) // is now re-computed. this.validate(); } JPanel getBottomPanel () { // Create a panel into which we will place buttons. JPanel bottomPanel = new JPanel (); // A "previous-question" button. JButton backward = new JButton ("Previous question"); backward.setFont (new Font ("Serif", Font.PLAIN | Font.BOLD, 15)); backward.addActionListener ( new ActionListener () { public void actionPerformed (ActionEvent a) { // Go back in the card layout. card.previous (centerpanel); } } ); bottomPanel.add (backward); // A forward button. JButton forward = new JButton ("Next question"); forward.setFont (new Font ("Serif", Font.PLAIN | Font.BOLD, 15)); forward.addActionListener ( new ActionListener () { public void actionPerformed (ActionEvent a) { // Go forward in the card layout. card.next (centerpanel); } } ); bottomPanel.add (forward); // A submit button. JButton submit = new JButton ("Submit"); submit.setFont (new Font ("Serif", Font.PLAIN | Font.BOLD, 15)); submit.addActionListener ( new ActionListener () { public void actionPerformed (ActionEvent a) { // Perform submit task. computeResult(); } } ); bottomPanel.add (submit); JButton quitb = new JButton ("Quit"); quitb.setFont (new Font ("Serif", Font.PLAIN | Font.BOLD, 15)); quitb.addActionListener ( new ActionListener () { public void actionPerformed (ActionEvent a) { System.exit (0); } } ); bottomPanel.add (quitb); return bottomPanel; } } public class Survey { public static void main (String[] argv) { NewFrame nf = new NewFrame (600, 300); } }

    Read the article

  • Branching and Merging Improvements in TFS2010

    - by jehan
    Introducing the concept of “first class branches” is a significant improvement as part of the 2010 release with respect to version control.  Not only does it help to distinguish between folders and branches, but it enables branch visualizations. Let us see improvements in detail. ·         In TFS2008, you don’t know which of the folders are Branches: All folders looks the same, all have the folder icon. Now, In TFS 2010 there is a new icon that shows which of the folder is a Branch.       ·      There is no visual means to manage branches in TFS2008:   You dont have any means to identify which branches are related and the relation type. Now, In TFS 2010 you have visual tools to see the Branches Hierarchy. In order to see a Branch Hierarchy just Right Click the Branch and choose: Branching and Merging –> View Hierarchy     ·         In TFS2008, there is no option to track changes path between the Branches:  If you have made a merge in a Branch you can’t track from which Branch this Merge came from. Now, you have the tools that shows the path of change between the Branches, you can also see where change was added on a timeline.  In order to track a change do the following: Step1: Right click the Branch and click View History   Step 2: Choose a changeset to track and click the “Track Changeset” button.     Step 3: Choose the branches that will be in the view and click “Visualize”. In above visual, you can see that Changesets 108,109,110 and 119 where merged from Main to Release1.0 Branch and then “Release_1.0” Branched to “Dev1.0. Step4: You can also see the Merges on a Timeline by clicking on the “Timeline Tracking” button.   Creating New Branches: In TFS 2010, the creation of branches has been streamlined a bit from the process in 2008.  In 2008, creating a new branch was like every other action in the system – changes were pended on the client, and then checked in to the server. Because of this creating new branch in TFS2008 was time-consuming process.  In TFS2010, the step where changes are pended has been bypassed and now performing the branch creation is entirely on the server.  With this approach, the round trip time for downloading a copy of each file on the branch and then uploading each file again has been eliminated.  Note: In TFS2010, the new branch will be created and committed as a single operation on the server. Pending changes will not be created, it doesn’t require a check-in as it will be carried out as a single operation and it’s not possible to cancel.     Manage Branch Permissions: The properties view for branches is also different than that of ordinary folders or file, containing some metadata for the branch, relationship information, and permissions for the branch. In TFS2008, the users who have checkout and Check-in permissions can create a branch. But, In TFS2010 you can control the permissions for Branches using Manage Branch permissions.   Reparent option in TFS2010: In TFS2008, if we have two branches which don’t have parent-child relation and we want perform merge between these two branches then we have to perform baseless merge using tf.exe command line. I have two branches Release_1.0 and Dev1.0_F2 which don’t have any relation between them, that’s why when I click on merge option in Release_1.0, in Target Branch it’s not showing Dev1.0_F2 branch to perform the merges.     Let us see what can we do for this in TFS2010, first perform a TFS baseless merge to establish a relationship between the parent branch and the child branches.  It will only merge the folder, not its contents. TFS baseless merges are performed via the command line using VS2010 command prompt and do the following:   tf merge /baseless <ParentBranch> <childBranch> Check in your pending changes. It will create the link between the branches but the relationships are still not completed.  Now, select the child branch in Source Control Explorer and from the File menu choose Source Control –> Branching and Merging –> Reparent.      In the dialog box,  choose the appropriate branch as the new parent.   Click Reparent and then go to parent branch and click merge. Now, will see that in Target Branch option Dev1.0_F2 branch is added.         Converting Folders to Branches and Branches to Folders: You can convert any Folder as Branch from Context Menu by performing right click on the folderàBranching and MergingàConvert to Branch. In similar way, you can convert the Branches to Folder using Convert to Folder option available in File Menu (FileàSource ControlàBranching and MergingàConvert to Branch). This option is not available in context menu.

    Read the article

  • Ein besonderes Oracle Business Breakfast in Berlin

    - by Detlef Drewanz
    Seit mehreren Jahren finden bei uns Business Breakfasts statt. Diese Veranstaltung ist üblicherweise an Technologen mit tiefem technologischen Wissensdurst gerichtet. Aus einem besonderen Anlass ist die Veranstaltung am 13.6.2014 in unserem Customer Visit Center in Berlin etwas speziell. Anlässlich des Solaris 11.2 Launches tourt Herr Markus Flierl, Oracle VP Software Development, gerade durch Deutschland. Wir haben ihn nach Berlin in unser Customer Visit Center eingeladen, um mit Ihnen Ihre Cloud Strategien und Anforderungen an ein modernes Betriebssystem zu diskutieren. Vielleicht setzen Sie zurzeit ein Betriebssystem ein, welches nicht aus dem Hause Oracle stammt. Das macht nichts. Auch dann ist der Besuch zu dieser Veranstaltung interessant, denn Herr Flierl interessiert sich ebenso für Ihre Anforderungen und Entscheidungsgrundlagen. Übrigens: Markus Flierl ist in Südddeutschland geboren und aufgewachsen und spricht somit fließend Deutsch. Agenda Start Ende Titel 08:30 09:30 Registrierung und Frühstück 09:30 09:45 Begrüßung und Einleitung Ralf Zenses, Oracle Senior Director Systems Sales Consulting Europe North 09:45 11:30 Strategien für OpenStack, Software Defined Networking und RZ Automatisierung: Cloud Management Integriert, nicht nur Installiert Markus Flierl, Oracle VP Software Development 11:30 11:45 Pause 11:45 12:15 Solaris 11.2 OpenStack Demo Joost Pronk, Oracle Senior Principle Product Strategy Manager 12:15 13:00 Unified Archiving und SCAP: Die finale Antwort auf Migrations- und Compliance Fragen Detlef Drewanz, Oracle Master Principle Sales Consultant Weitere Details und den Link zur Anmeldung finden Sie hier. Die Veranstaltung ist offen für alle Interessierten. Ich freue mich auf Ihren Besuch. Wir sehen uns.

    Read the article

  • Why are only some of my objects being rendered?

    - by BleedObsidian
    Every time I create a new asteroid the previous one is no longer rendered? I did some debugging and printed out the size of Array-List 'Small' and when a new asteroid is created it doesn't go down, so the thread is still there it's just not being rendered, Why? StatePlay: package me.bleedobsidian.astroidjump; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; public class StatePlay extends BasicGameState { int stateID = 10; Player player; Asteroids asteroids; StatePlay(int stateID) { this.stateID = stateID; } @Override public int getID() { return stateID; } @Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { ResManager.loadImages(); player = new Player(); asteroids = new Asteroids(); } @Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { g.setAntiAlias(true); player.render(g); asteroids.render(g); g.drawString("Asteroids: " + Asteroids.small.size(), 10, 25); } @Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { player.update(gc, delta); asteroids.update(delta); } } Asteroids: package me.bleedobsidian.astroidjump; import java.util.ArrayList; import java.util.Timer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.SpriteSheet; public class Asteroids { public static ArrayList<Asteroid_Small> small = new ArrayList<Asteroid_Small>(); static SpriteSheet small_sprites = new SpriteSheet(ResManager.asteroids_small_ss, 32, 32); static Image small_1 = small_sprites.getSubImage(0, 0); static Image small_2 = small_sprites.getSubImage(1, 0); static Image small_3 = small_sprites.getSubImage(2, 0); static Image small_4 = small_sprites.getSubImage(3, 0); static boolean asteroids = true; static int diff = 0; Asteroids() { Task_Asteroids TaskA = new Task_Asteroids(); Timer timer = new Timer("Asteroids"); if(diff == 0) { timer.schedule(TaskA, 0, 4000); } else if(diff == 1) { timer.schedule(TaskA, 0, 3000); } } public static Image chooseSmallImage(int i) { if(i == 0) { return small_1; } else if(i == 1) { return small_2; } else if(i == 2) { return small_3; } else if(i == 3) { return small_4; } else { return small_1; } } public static void level_manager(float x) { if(x < 1000) { diff = 0; } else if(x < 2000) { diff = 1; } else if(x < 3000) { diff = 2; } else if(x < 5000) { diff = 3; } else if(x < 10000) { diff = 4; } else { diff = 5; } } public void update(int delta) { for(int s = 0; s < small.size(); s++) { Asteroid_Small as = small.get(s); as.update(delta); } } public void render(Graphics g) { for(int s = 0; s < small.size(); s++) { Asteroid_Small as = small.get(s); as.render(g); } } public static void setAsteroids(boolean tf) { asteroids = tf; } } Asteroid_Small: package me.bleedobsidian.astroidjump; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; public class Asteroid_Small { private static Image me; private static float x = 0; private static float y = 0; private static float speed = 0; private static float rotation = 0; private static float rotation_speed = 0; Asteroid_Small(Image i, float x, float y, float rs, float sp) { me = i; Asteroid_Small.x = x; Asteroid_Small.y = y; Asteroid_Small.rotation_speed = rs; Asteroid_Small.speed = sp; } public void update(int delta) { x -= speed * delta; rotation += rotation_speed * delta; me.setRotation(rotation); } public void render(Graphics g) { g.drawImage(me, x, y); } } Task_Asteroid: package me.bleedobsidian.astroidjump; import java.util.TimerTask; public class Task_Asteroids extends TimerTask { public void run() { if(Asteroids.diff == 0) { int randImage = (int) (Math.random() * 4); int randHeight = (int) (Math.random() * 480); Asteroids.small.add(new Asteroid_Small(Asteroids.chooseSmallImage(randImage), Player.x + 960, randHeight, 0.05f, 0.04f)); } } }

    Read the article

  • Team Build: The path 'Path' is already mapped in workspace 'workspace' error even after deleting all

    - by Glenn Slaven
    I have this problem when I queue a build. The build dies with the error The path C:\[Path]\Sources is already mapped in workspace [Server Name]. the same as this question. but I've removed all the workspaces on the build agent by running this command: tf workspaces /remove:* and also by deleting the TFS cache folder. I've also restarted the server, but the error keeps happening on each build.

    Read the article

  • Salesforce/PHP - Bulk Outbound message (SOAP), Time out issue

    - by Phill Pafford
    Salesforce can send up to 100 requests inside 1 SOAP message. While sending this type of Bulk Ooutbound message request my PHP script finishes executing but SF fails to accept the ACK used to clear the message queue on the Salesforce side of things. Looking at the Outbound message log (monitoring) I see all the messages in a pending state with the Delivery Failure Reason "java.net.SocketTimeoutException: Read timed out". If my script has finished execution, why do I get this error? I have tried these methods to increase the execution time on my server as I have no access on the Salesforce side: set_time_limit(0); // in the script max_execution_time = 360 ; Maximum execution time of each script, in seconds max_input_time = 360 ; Maximum amount of time each script may spend parsing request data memory_limit = 32M ; Maximum amount of memory a script may consume I used the high settings just for testing. Any thoughts as to why this is failing the ACK delivery back to Salesforce? Here is some of the code: This is how I accept and send the ACK file for the imcoming SOAP request $data = 'php://input'; $content = file_get_contents($data); if($content) { respond('true'); } else { respond('false'); } The respond function function respond($tf) { $ACK = <<<ACK <?xml version = "1.0" encoding = "utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <notifications xmlns="http://soap.sforce.com/2005/09/outbound"> <Ack>$tf</Ack> </notifications> </soapenv:Body> </soapenv:Envelope> ACK; print trim($ACK); } These are in a generic script that I include into the script that uses the data for a specific workflow. I can process about 25 requests (That are in 1 SOAP response) but once I go over that I get the timeout error in the Salesforce queue. for 50 requests is usually takes my PHP script 86.77 seconds. Could it be Apache? PHP? I have also tested just accepting the 100 request SOAP response and just accepting and sending the ACK the queue clears out, so I know it's on my side of things. I show no errors in the apache log, the script runs fine. Thanks for any insight into this, --Phill

    Read the article

  • How to use MVC Contrib Grid to make better table?

    - by DucDigital
    There are actually 2 question i want to cover in this topic. 1) Is there anyway to put table footer into a MVCContrib Grid? (tf) 2) Im writing a small code to display result image into a grid: ----------------------------------- | I || I || I || I || I || I || I | ----------------------------------- | I || I || I || I || I || I || I | ----------------------------------- | I || I || I || I || I || I || I | ----------------------------------- | I || I || I || I || I || I || I | ----------------------------------- I represent Image, this will make as a table to maintain equal width.. But is there anyway of doing this with MVCCOntrib particularly or Asp.net MVC View? Thank you

    Read the article

  • tfidf, am I understanding it right?

    - by alskndalsnd
    Hey everyone, I am interested in doing some document clustering, and right now I am considering using TF-IDF for this. If I am not wrong, TFIDF is particularly used for evaluating the relevance of a document given a query. If I do not have a particular query, how can I apply tfidf to clustering?

    Read the article

  • measuring similarity between documents using jaccard coefficient

    - by jaskirat
    hi i m finding similarity between documents ....nd to measure that i used jaccard coefficient...i did like dis D1=(8,0,0,1) where 8,0,0,1 are the tf-idf scores of the terms t1, t2, t3 , t4 D2=(7,0,0,0) jaccard coefficient= dotproduct(d1,d2) / |d1|+|d2|-dotproduct(d1,d2) and the answer comes out to be " -1.367931 "...what does it signify about the similarity between the documents...pls do reply..please...thank u..

    Read the article

  • IE Positioning Help.

    - by _henry
    I’m currently working on this theme : http://tf.ffffffive.com/fancy/ I just need a few pointers on how to get it working in IE6 and IE7 . -The positioning is a bit off. -If you guys have a helpful blog post of maybe give me a hand with some CSS coding I would really appreciate it. Also the Javascript scrolling effect isn't working correctly due to the positioning. Any tips would be appreciated. Thanks, Henry

    Read the article

  • How do I use compiler intrinsic __fmul_?

    - by Eric Thoma
    I am writing a massively parallel GPU application. I have been optimizing it by hand. I received a 20% performance increase with _fdividef(x, y), and according to The Cuda C Programming Guide (section C.2.1), using similar functions for multiplication and adding is also beneficial. The function is stated as this: "_fmulrn,rz,ru,rd". __fdividef(x,y) was not stated with the arguments in brackets. I was wondering, what are those brackets? If I run the simple code: int t = __fmul_(5,4); I a compiler error about how _fmul is undefined. I have the CUDA runtime included, so I don't think it is a setup thing; rather it is something to do with those square brackets. How do I correctly use this function? Thank you.

    Read the article

  • emacs, colors in term-mode

    - by valya
    Hello, I use Emacs and I run bash with M-x term command. There is a problem: colors in the *terminal* buffer aren't the same as in Gnome Terminal, and they are worse (do you need a screen shot?). How can I fix this? This is pretty annoying :-) Thank you! Linux Mint 9 Emacs 23.1.1 x86_64 __________________ /home/valentin/Work/buzzoola/buzzoola/test/vagrant [.../vagrant]$ echo $TERM eterm-color __________________ /home/valentin/Work/buzzoola/buzzoola/test/vagrant [.../vagrant]$ echo $LS_COLORS rs=0:di=01;34:ln=01;36:hl=44;37:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31 ;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31: *.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31 :*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01 ;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jp eg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;3 5:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.p cx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01; 35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm =01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:* .xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00 ;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*. ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:

    Read the article

  • Torrentflux broke after upgrade

    - by parker.sikand
    A working torrentflux setup seems to have gone broken after upgrading PHP to 5.3 and Postrgres to 9.2beta3 on a FreeBSD 8.2 server. The login screen will show up fine, but after clicking the login button, I get an error : Fatal error: Call to undefined function pg_escape_string() in \ /usr/home/parker/tf/html/inc/lib/adodb/drivers/adodb-postgres64.inc.php \ on line 241 Seems to be an error with PHP and the pgsql php package. The phppgsql package itself is not totally broken because I'm using it to host database driven apps on this server. This is the first and only error I'm seeing from it. How might I go about fixing this problem?

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >